Elevators & more
This commit is contained in:
parent
72ff015aa3
commit
8985076bc2
@ -65,6 +65,12 @@ namespace game
|
||||
|
||||
CM_TransformedCapsuleTrace_t CM_TransformedCapsuleTrace;
|
||||
|
||||
Weapon_RocketLauncher_Fire_t Weapon_RocketLauncher_Fire;
|
||||
|
||||
PM_playerTrace_t PM_playerTrace;
|
||||
|
||||
PM_trace_t PM_trace;
|
||||
|
||||
Cmd_ExecuteSingleCommand_t Cmd_ExecuteSingleCommand;
|
||||
|
||||
decltype(longjmp)* _longjmp;
|
||||
@ -669,6 +675,13 @@ namespace game
|
||||
native::CM_TransformedCapsuleTrace = native::CM_TransformedCapsuleTrace_t(
|
||||
SELECT_VALUE(0x4F9B80, 0x541340, 0x0));
|
||||
|
||||
native::Weapon_RocketLauncher_Fire = native::Weapon_RocketLauncher_Fire_t(
|
||||
SELECT_VALUE(0x48C920, 0x5305D0, 0x0));
|
||||
|
||||
native::PM_playerTrace = native::PM_playerTrace_t(SELECT_VALUE(0x4CE600, 0x421F00, 0x0));
|
||||
|
||||
native::PM_trace = native::PM_trace_t(SELECT_VALUE(0x544BF0, 0x41CEB0, 0x0));
|
||||
|
||||
native::Cmd_ExecuteSingleCommand = native::Cmd_ExecuteSingleCommand_t(
|
||||
SELECT_VALUE(0x4D6960, 0x5462B0, 0x4CC360));
|
||||
|
||||
|
@ -105,6 +105,18 @@ namespace game
|
||||
const float* origin, const float* angles);
|
||||
extern CM_TransformedCapsuleTrace_t CM_TransformedCapsuleTrace;
|
||||
|
||||
typedef gentity_s* (*Weapon_RocketLauncher_Fire_t)(gentity_s* ent, const Weapon weapon, float spread,
|
||||
weaponParms* wp, const float* gunVel, missileFireParms* fireParms, missileFireParms* magicBullet);
|
||||
extern Weapon_RocketLauncher_Fire_t Weapon_RocketLauncher_Fire;
|
||||
|
||||
typedef void (*PM_playerTrace_t)(pmove_t* pm, trace_t* results, const float* start, const float* end,
|
||||
const Bounds* bounds, int passEntityNum, int contentMask);
|
||||
extern PM_playerTrace_t PM_playerTrace;
|
||||
|
||||
typedef void (*PM_trace_t)(const pmove_t* pm, trace_t* results, const float* start, const float* end,
|
||||
const Bounds* bounds, int passEntityNum, int contentMask);
|
||||
extern PM_trace_t PM_trace;
|
||||
|
||||
typedef void (*Cmd_ExecuteSingleCommand_t)(LocalClientNum_t localClientNum, int controllerIndex, const char* text);
|
||||
extern Cmd_ExecuteSingleCommand_t Cmd_ExecuteSingleCommand;
|
||||
|
||||
|
@ -709,6 +709,21 @@ namespace game
|
||||
|
||||
static_assert(sizeof(Weapon) == 4);
|
||||
|
||||
struct weaponParms
|
||||
{
|
||||
float forward[3];
|
||||
float right[3];
|
||||
float up[3];
|
||||
float muzzleTrace[3];
|
||||
float gunForward[3];
|
||||
Weapon weapon;
|
||||
bool isAlternate;
|
||||
const void* weapDef;
|
||||
const void* weapCompleteDef;
|
||||
};
|
||||
|
||||
static_assert(sizeof(weaponParms) == 0x4C);
|
||||
|
||||
enum ViewLockTypes
|
||||
{
|
||||
PLAYERVIEWLOCK_NONE = 0x0,
|
||||
@ -745,12 +760,49 @@ namespace game
|
||||
|
||||
struct playerState_s
|
||||
{
|
||||
unsigned char __pad0[0x4EC];
|
||||
int commandTime;
|
||||
int pm_type;
|
||||
int pm_time;
|
||||
int pm_flags;
|
||||
int otherFlags;
|
||||
int linkFlags;
|
||||
int bobCycle;
|
||||
float origin[3];
|
||||
float velocity[3];
|
||||
unsigned char __pad0[0x4B8];
|
||||
unsigned int perks[0x2];
|
||||
unsigned int perkSlots[0x9];
|
||||
unsigned char __pad1[0x2DE8];
|
||||
};
|
||||
|
||||
static_assert(sizeof(playerState_s) == 0x3300);
|
||||
|
||||
struct pmove_t
|
||||
{
|
||||
playerState_s* ps;
|
||||
usercmd_s cmd;
|
||||
usercmd_s oldcmd;
|
||||
int tracemask;
|
||||
int numtouch;
|
||||
int touchents[32];
|
||||
Bounds bounds;
|
||||
float speed;
|
||||
int proneChange;
|
||||
float maxSprintTimeMultiplier;
|
||||
bool mantleStarted;
|
||||
float mantleEndPos[3];
|
||||
int mantleDuration;
|
||||
int viewChangeTime;
|
||||
float viewChange;
|
||||
float fTorsoPitch;
|
||||
float fWaistPitch;
|
||||
int remoteTurretFireTime;
|
||||
int lastUpdateCMDServerTime;
|
||||
unsigned char handler;
|
||||
};
|
||||
|
||||
static_assert(sizeof(pmove_t) == 0x138);
|
||||
|
||||
struct gclient_s
|
||||
{
|
||||
playerState_s ps;
|
||||
@ -835,6 +887,17 @@ namespace game
|
||||
|
||||
static_assert(sizeof(gentity_s) == 0x274);
|
||||
|
||||
struct missileFireParms
|
||||
{
|
||||
gentity_s* target;
|
||||
float targetPosOrOffset[3];
|
||||
float autoDetonateTime;
|
||||
bool lockon;
|
||||
bool topFire;
|
||||
};
|
||||
|
||||
static_assert(sizeof(missileFireParms) == 0x18);
|
||||
|
||||
enum clientState_t
|
||||
{
|
||||
CS_FREE = 0,
|
||||
|
@ -7,6 +7,8 @@ const game::native::dvar_t* player_movement::player_sustainAmmo;
|
||||
const game::native::dvar_t* player_movement::pm_bounces;
|
||||
const game::native::dvar_t* player_movement::pm_playerEjection;
|
||||
const game::native::dvar_t* player_movement::pm_playerCollision;
|
||||
const game::native::dvar_t* player_movement::pm_rocketJump;
|
||||
const game::native::dvar_t* player_movement::pm_elevators;
|
||||
|
||||
void player_movement::pm_weapon_use_ammo(game::native::playerState_s* ps, const game::native::Weapon weapon,
|
||||
bool is_alternate, int amount, game::native::PlayerHandIndex hand)
|
||||
@ -92,6 +94,45 @@ void player_movement::cm_transformed_capsule_trace_stub(game::native::trace_t* r
|
||||
}
|
||||
}
|
||||
|
||||
game::native::gentity_s* player_movement::weapon_rocket_launcher_fire_stub(game::native::gentity_s* ent,
|
||||
const game::native::Weapon weapon, float spread, game::native::weaponParms* wp, const float* gun_vel,
|
||||
game::native::missileFireParms* fire_parms, game::native::missileFireParms* magic_bullet)
|
||||
{
|
||||
auto* result = game::native::Weapon_RocketLauncher_Fire(ent, weapon, spread, wp,
|
||||
gun_vel, fire_parms, magic_bullet);
|
||||
|
||||
if (ent->client != nullptr && player_movement::pm_rocketJump->current.enabled)
|
||||
{
|
||||
ent->client->ps.velocity[0] += (0 - wp->forward[0]) * 64.0f;
|
||||
ent->client->ps.velocity[1] += (0 - wp->forward[1]) * 64.0f;
|
||||
ent->client->ps.velocity[2] += (0 - wp->forward[2]) * 64.0f;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void player_movement::pm_player_trace_stub(game::native::pmove_t* pm, game::native::trace_t* results,
|
||||
const float* start, const float* end, const game::native::Bounds* bounds, int pass_entity_num, int content_mask)
|
||||
{
|
||||
game::native::PM_playerTrace(pm, results, start, end, bounds, pass_entity_num, content_mask);
|
||||
|
||||
if (player_movement::pm_elevators->current.enabled)
|
||||
{
|
||||
results->startsolid = false;
|
||||
}
|
||||
}
|
||||
|
||||
void player_movement::pm_trace(const game::native::pmove_t* pm, game::native::trace_t* results,
|
||||
const float* start, const float* end, const game::native::Bounds* bounds, int pass_entity_num, int content_mask)
|
||||
{
|
||||
game::native::PM_trace(pm, results, start, end, bounds, pass_entity_num, content_mask);
|
||||
|
||||
if (player_movement::pm_elevators->current.enabled)
|
||||
{
|
||||
results->allsolid = false;
|
||||
}
|
||||
}
|
||||
|
||||
const game::native::dvar_t* player_movement::dvar_register_player_sustain_ammo(const char* dvar_name,
|
||||
bool value, unsigned __int16 /*flags*/, const char* description)
|
||||
{
|
||||
@ -105,6 +146,8 @@ void player_movement::patch_mp()
|
||||
{
|
||||
player_movement::pm_playerEjection = game::native::Dvar_RegisterBool("pm_playerEjection",
|
||||
true, game::native::DVAR_CODINFO, "Push intersecting players away from each other");
|
||||
player_movement::pm_rocketJump = game::native::Dvar_RegisterBool("pm_rocketJump",
|
||||
false, game::native::DVAR_CODINFO, "CoD4 rocket jumps");
|
||||
|
||||
utils::hook(0x418D9C, &player_movement::dvar_register_player_sustain_ammo, HOOK_CALL).install()->quick();
|
||||
|
||||
@ -117,6 +160,15 @@ void player_movement::patch_mp()
|
||||
utils::hook(0x4F9EFB, &player_movement::stuck_in_client_stub, HOOK_CALL).install()->quick(); // ClientEndFrame
|
||||
utils::hook(0x57CF45, &player_movement::cm_transformed_capsule_trace_stub, HOOK_CALL).install()->quick(); // SV_ClipMoveToEntity
|
||||
utils::hook(0x482C1B, &player_movement::cm_transformed_capsule_trace_stub, HOOK_CALL).install()->quick(); // CG_ClipMoveToEntity
|
||||
|
||||
utils::hook(0x530CCB, &player_movement::weapon_rocket_launcher_fire_stub, HOOK_CALL).install()->quick(); // FireWeapon
|
||||
|
||||
utils::hook(0x422861, &player_movement::pm_player_trace_stub, HOOK_CALL).install()->quick(); // PM_JitterPoint
|
||||
utils::hook(0x4228B5, &player_movement::pm_player_trace_stub, HOOK_CALL).install()->quick(); // PM_JitterPoint
|
||||
|
||||
utils::hook(0x41F995, &player_movement::pm_trace, HOOK_CALL).install()->quick(); // PM_CheckDuck
|
||||
utils::hook(0x41F8D8, &player_movement::pm_trace, HOOK_CALL).install()->quick(); // PM_CheckDuck
|
||||
utils::hook(0x41F941, &player_movement::pm_trace, HOOK_CALL).install()->quick(); // PM_CheckDuck
|
||||
}
|
||||
|
||||
void player_movement::patch_sp()
|
||||
@ -132,10 +184,20 @@ void player_movement::patch_sp()
|
||||
|
||||
utils::hook(0x41F9A6, &player_movement::cm_transformed_capsule_trace_stub, HOOK_CALL).install()->quick(); // SV_ClipMoveToEntity
|
||||
utils::hook(0x57B14F, &player_movement::cm_transformed_capsule_trace_stub, HOOK_CALL).install()->quick(); // CG_ClipMoveToEntity
|
||||
|
||||
utils::hook(0x643F84, &player_movement::pm_player_trace_stub, HOOK_CALL).install()->quick(); // PM_JitterPoint
|
||||
utils::hook(0x643FDB, &player_movement::pm_player_trace_stub, HOOK_CALL).install()->quick(); // PM_JitterPoint
|
||||
|
||||
utils::hook(0x64181A, &player_movement::pm_trace, HOOK_CALL).install()->quick(); // PM_CheckDuck
|
||||
utils::hook(0x641701, &player_movement::pm_trace, HOOK_CALL).install()->quick(); // PM_CheckDuck
|
||||
utils::hook(0x6417A9, &player_movement::pm_trace, HOOK_CALL).install()->quick(); // PM_CheckDuck
|
||||
}
|
||||
|
||||
void player_movement::post_load()
|
||||
{
|
||||
// Un-cheat missileMacross. It seems it retained its functionality
|
||||
utils::hook::set<BYTE>(SELECT_VALUE(0x44DFED, 0x50DDDD, 0x48C16F), 0x0);
|
||||
|
||||
if (game::is_dedi())
|
||||
{
|
||||
return;
|
||||
@ -145,6 +207,8 @@ void player_movement::post_load()
|
||||
game::native::dvar_flags::DVAR_CODINFO, "CoD4 Bounces");
|
||||
player_movement::pm_playerCollision = game::native::Dvar_RegisterBool("pm_playerCollision",
|
||||
true, game::native::DVAR_CODINFO, "Push intersecting players away from each other");
|
||||
player_movement::pm_elevators = game::native::Dvar_RegisterBool("pm_elevators",
|
||||
false, game::native::DVAR_CODINFO, "CoD4 Elevators");
|
||||
|
||||
if (game::is_mp()) this->patch_mp();
|
||||
else if (game::is_sp()) this->patch_sp();
|
||||
|
@ -12,6 +12,8 @@ private:
|
||||
static const game::native::dvar_t* pm_bounces;
|
||||
static const game::native::dvar_t* pm_playerEjection;
|
||||
static const game::native::dvar_t* pm_playerCollision;
|
||||
static const game::native::dvar_t* pm_rocketJump;
|
||||
static const game::native::dvar_t* pm_elevators;
|
||||
|
||||
static void pm_weapon_use_ammo(game::native::playerState_s* ps, const game::native::Weapon weapon,
|
||||
bool isAlternate, int amount, game::native::PlayerHandIndex hand);
|
||||
@ -27,6 +29,17 @@ private:
|
||||
const float* end, const game::native::Bounds* bounds, const game::native::Bounds* capsule,
|
||||
int contents, const float* origin, const float* angles);
|
||||
|
||||
static game::native::gentity_s* weapon_rocket_launcher_fire_stub(game::native::gentity_s* ent,
|
||||
const game::native::Weapon weapon, float spread, game::native::weaponParms* wp,
|
||||
const float* gun_vel, game::native::missileFireParms* fire_parms, game::native::missileFireParms* magic_bullet);
|
||||
|
||||
static void pm_player_trace_stub(game::native::pmove_t* pm, game::native::trace_t* results,
|
||||
const float* start, const float* end, const game::native::Bounds* bounds,
|
||||
int pass_entity_num, int content_mask);
|
||||
|
||||
static void pm_trace(const game::native::pmove_t* pm, game::native::trace_t* results,
|
||||
const float* start, const float* end, const game::native::Bounds* bounds, int pass_entity_num, int content_mask);
|
||||
|
||||
static void patch_mp();
|
||||
static void patch_sp();
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user