Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
435 changes: 435 additions & 0 deletions resources/iw5/_codxe/mods/codjumper/maps/mp/gametypes/cj.gsc

Large diffs are not rendered by default.

Binary file modified resources/iw5/_codxe/mods/codjumper/maps/mp/gametypes/cj.gscbin
Binary file not shown.
50 changes: 50 additions & 0 deletions resources/iw5/_codxe/mods/codjumper/maps/mp/gametypes/war.gsc
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// IW5 GSC SOURCE
// Generated by https://github.com/xensik/gsc-tool

main()
{
if (getdvar("mapname") == "mp_background")
return;

maps\mp\gametypes\cj::main();

maps\mp\gametypes\_globallogic::init();
maps\mp\gametypes\_callbacksetup::setupcallbacks();
maps\mp\gametypes\_globallogic::setupcallbacks();

setdynamicdvar("g_hardcore", 1); // Hardcore HUD
setdynamicdvar("scr_game_forceuav", 0); // Hide Minimap from HUD

level._id_26D9 = 1;
level.onstartgametype = ::onstartgametype;
level.getspawnpoint = ::getspawnpoint;
level._id_2CC6 = ::_id_2CC6;
}

onstartgametype()
{
setclientnamemode("auto_change");

level.spawnmins = (0, 0, 0);
level._id_2FD4 = (0, 0, 0);
maps\mp\gametypes\_spawnlogic::placespawnpoints("mp_tdm_spawn_allies_start");
maps\mp\gametypes\_spawnlogic::placespawnpoints("mp_tdm_spawn_axis_start");
maps\mp\gametypes\_spawnlogic::_id_2FD0("allies", "mp_tdm_spawn");
maps\mp\gametypes\_spawnlogic::_id_2FD0("axis", "mp_tdm_spawn");
level.mapcenter = maps\mp\gametypes\_spawnlogic::_id_2FCD(level.spawnmins, level._id_2FD4);
setmapcenter(level.mapcenter);
}

getspawnpoint()
{
return level.mapcenter + (0, 0, 500);
}

_id_2CC6(var_0, var_1, var_2)
{
var_3 = maps\mp\gametypes\_rank::getscoreinfovalue("kill");
var_1 maps\mp\gametypes\_gamescore::giveteamscoreforobjective(var_1.pers["team"], var_3);

if (game["state"] == "postgame" && game["teamScores"][var_1.team] > game["teamScores"][level.otherteam[var_1.team]])
var_1._id_2D03 = 1;
}
Binary file not shown.
13 changes: 12 additions & 1 deletion src/game/iw5/mp/patches.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,27 @@ void DisableDvarWriteChecks()
*(volatile uint32_t *)0x8232DE2C = 0x60000000;
}

Detour Jump_Start_Detour;

void Jump_Start_Hook(pmove_t *pm, pml_t *pml, double height)
{
static const dvar_t *jump_height = Dvar_FindMalleableVar("jump_height");
Jump_Start_Detour.GetOriginal<Jump_Start_t>()(pm, pml, jump_height->current.value);
}

patches::patches()
{
EnableBouncing();
DisableIdleGunSway();
DisableJumpSlowdown();
DisableDvarWriteChecks();

Jump_Start_Detour = Detour(Jump_Start, Jump_Start_Hook);
Jump_Start_Detour.Install();
}

patches::~patches()
{
Jump_Start_Detour.Remove();
}
} // namespace mp
} // namespace iw5
10 changes: 5 additions & 5 deletions src/game/iw5/mp/pm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ gentity_s *Weapon_RocketLauncher_Fire_Hook(gentity_s *ent, const Weapon *weapon,
weaponParms *gunVel, missileFireParms *fireParms,
missileFireParms *magicBullet, bool a8)
{

// Call the original function
gentity_s *result = Weapon_RocketLauncher_Fire_Detour.GetOriginal<Weapon_RocketLauncher_Fire_t>()(
ent, weapon, spread, wp, gunVel, fireParms, magicBullet, a8);
// NOTE: remove this hack and remove shellshock another way
// // Call the original function
// gentity_s *result = Weapon_RocketLauncher_Fire_Detour.GetOriginal<Weapon_RocketLauncher_Fire_t>()(
// ent, weapon, spread, wp, gunVel, fireParms, magicBullet, a8);

// Reimplement COD4 logic for RPG knockback
// Apply at the end which matches the original game behavior
Expand All @@ -26,7 +26,7 @@ gentity_s *Weapon_RocketLauncher_Fire_Hook(gentity_s *ent, const Weapon *weapon,
ent->client->ps.velocity[2] = ent->client->ps.velocity[2] - wp->forward[2] * 64.0f;
}

return result;
return 0;
}

PlayerMovement::PlayerMovement()
Expand Down
63 changes: 63 additions & 0 deletions src/game/iw5/mp/structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -1679,6 +1679,65 @@ struct __declspec(align(32)) clipMap_t
// unsigned int checksum;
};

struct pmove_t;
struct pml_t;

struct DvarLimits_enumeration
{
int stringCount;
const char **strings;
};

struct DvarLimits_integer
{
int min;
int max;
};

struct DvarLimits_value
{
float min;
float max;
};

struct DvarLimits_vector
{
float min;
float max;
};

union DvarLimits
{
DvarLimits_enumeration enumeration;
DvarLimits_integer integer;
DvarLimits_value value;
DvarLimits_vector vector;
};

union DvarValue
{
bool enabled;
int integer;
unsigned int unsignedInt;
float value;
float vector[4];
const char *string;
unsigned __int8 color[4];
};

struct dvar_t
{
const char *name;
unsigned __int16 flags;
unsigned __int8 type;
bool modified;
DvarValue current;
DvarValue latched;
DvarValue reset;
DvarLimits domain;
dvar_t *hashNext;
};

// Function typedefs

typedef void (*CG_GameMessage_t)(LocalClientNum_t localClientNum, const char *msg);
Expand All @@ -1689,6 +1748,10 @@ typedef XAssetEntry *(*DB_LinkXAssetEntry_t)(XAssetType type, XAssetHeader *head
typedef const char *(*DB_GetXAssetName_t)(const XAsset *asset);
typedef bool (*DB_IsXAssetDefault_t)(XAssetType type, const char *name);

typedef dvar_t *(*Dvar_FindMalleableVar_t)(const char *dvarName);

typedef void (*Jump_Start_t)(pmove_t *pm, pml_t *pml, double height);

typedef unsigned __int8 *(*PMem_AllocFromSource_NoDebug_t)(unsigned int size, unsigned int alignment, unsigned int type,
PMem_Source source);

Expand Down
4 changes: 4 additions & 0 deletions src/game/iw5/mp/symbols.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ static auto DB_GetXAssetName = reinterpret_cast<DB_GetXAssetName_t>(0x821AB560);
static auto DB_LinkXAssetEntry = reinterpret_cast<DB_LinkXAssetEntry_t>(0x821EF3F0);
static auto DB_IsXAssetDefault = reinterpret_cast<DB_IsXAssetDefault_t>(0x821EEEB0);

static auto Dvar_FindMalleableVar = reinterpret_cast<Dvar_FindMalleableVar_t>(0x8232E100);

static auto Jump_Start = reinterpret_cast<Jump_Start_t>(0x820DAF00);

static auto PMem_AllocFromSource_NoDebug = reinterpret_cast<PMem_AllocFromSource_NoDebug_t>(0x823335F0);

static auto Scr_AddInt = reinterpret_cast<Scr_AddInt_t>(0x822BFAB8);
Expand Down