Merge pull request #158 from diamante0018/refactor-movement

[Movement] Refactor+ features
This commit is contained in:
Dss0 2022-02-14 16:41:00 +01:00 committed by GitHub
commit 01acf3e51a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 371 additions and 165 deletions

View File

@ -867,7 +867,7 @@ namespace Components
} }
// Check for frozen controls. Flag name should start with PMF_ // Check for frozen controls. Flag name should start with PMF_
if (CG_ShouldUpdateViewAngles(gamePadIndex) && (clientActive.snap.ps.pm_flags & 0x800) == 0) if (CG_ShouldUpdateViewAngles(gamePadIndex) && (clientActive.snap.ps.pm_flags & Game::PMF_FROZEN) == 0)
{ {
Game::AimInput aimInput{}; Game::AimInput aimInput{};
Game::AimOutput aimOutput{}; Game::AimOutput aimOutput{};

View File

@ -5,47 +5,29 @@ namespace Components
Dvar::Var Movement::PlayerDuckedSpeedScale; Dvar::Var Movement::PlayerDuckedSpeedScale;
Dvar::Var Movement::PlayerLastStandCrawlSpeedScale; Dvar::Var Movement::PlayerLastStandCrawlSpeedScale;
Dvar::Var Movement::PlayerProneSpeedScale; Dvar::Var Movement::PlayerProneSpeedScale;
Dvar::Var Movement::PlayerSpectateSpeedScale;
Dvar::Var Movement::CGUfoScaler;
Dvar::Var Movement::CGNoclipScaler;
Dvar::Var Movement::BGBouncesAllAngles;
Dvar::Var Movement::BGRocketJump;
Dvar::Var Movement::BGPlayerEjection;
Dvar::Var Movement::BGPlayerCollision;
Game::dvar_t* Movement::BGBounces;
int Movement::PMGetEffectiveStance(Game::playerState_s* ps) float Movement::PM_CmdScaleForStance(const Game::pmove_s* pm)
{ {
auto heightTarget = ps->viewHeightTarget; assert(pm->ps != nullptr);
if (heightTarget == 0x16) const auto* playerState = pm->ps;
return Game::PM_EFF_STANCE_LASTSTANDCRAWL;
if (heightTarget == 0x28)
return Game::PM_EFF_STANCE_DUCKED;
if (heightTarget == 0xB)
return Game::PM_EFF_STANCE_PRONE;
return Game::PM_EFF_STANCE_DEFAULT;
}
float Movement::PMCmdScaleForStance(Game::pmove_s* move)
{
auto* playerState = move->ps;
float scale; float scale;
if (playerState->viewHeightLerpTime != 0 && playerState->viewHeightLerpTarget == 0xB) if (playerState->viewHeightLerpTime != 0 && playerState->viewHeightLerpTarget == 0xB)
{ {
scale = move->cmd.serverTime - playerState->viewHeightLerpTime / 400.0f; scale = pm->cmd.serverTime - playerState->viewHeightLerpTime / 400.0f;
if (0.0f <= scale) if (0.0f <= scale)
{ {
auto flags = 0; if (scale > 1.0f)
if (scale < 1.0f)
{
flags |= 1 << 8;
}
if (scale == 1.0f)
{
flags |= 1 << 14;
}
if (flags == 0)
{ {
scale = 1.0f; scale = 1.0f;
return scale * 0.15f + (1.0f - scale) * 0.65f; return scale * 0.15f + (1.0f - scale) * 0.65f;
@ -61,23 +43,11 @@ namespace Components
if ((playerState->viewHeightLerpTime != 0 && playerState->viewHeightLerpTarget == 0x28) && if ((playerState->viewHeightLerpTime != 0 && playerState->viewHeightLerpTarget == 0x28) &&
playerState->viewHeightLerpDown == 0) playerState->viewHeightLerpDown == 0)
{ {
scale = 400.0f / move->cmd.serverTime - playerState->viewHeightLerpTime; scale = 400.0f / pm->cmd.serverTime - playerState->viewHeightLerpTime;
if (0.0f <= scale) if (0.0f <= scale)
{ {
auto flags = 0; if (scale > 1.0f)
if (scale < 1.0f)
{
flags |= 1 << 8;
}
if (scale == 1.0f)
{
flags |= 1 << 14;
}
if (flags == 0)
{ {
scale = 1.0f; scale = 1.0f;
} }
@ -89,7 +59,7 @@ namespace Components
} }
scale = 1.0f; scale = 1.0f;
auto stance = Movement::PMGetEffectiveStance(playerState); const auto stance = Game::PM_GetEffectiveStance(playerState);
if (stance == Game::PM_EFF_STANCE_PRONE) if (stance == Game::PM_EFF_STANCE_PRONE)
{ {
@ -109,14 +79,14 @@ namespace Components
return scale; return scale;
} }
__declspec(naked) void Movement::PMCmdScaleForStanceStub() __declspec(naked) void Movement::PM_CmdScaleForStanceStub()
{ {
__asm __asm
{ {
pushad pushad
push edx push edx
call Movement::PMCmdScaleForStance call Movement::PM_CmdScaleForStance // pm
add esp, 4 add esp, 4
popad popad
@ -124,18 +94,202 @@ namespace Components
} }
} }
Game::dvar_t* Movement::Dvar_RegisterLastStandSpeedScale(const char* name, float defaultVal, float min, float max, int, const char* desc) float Movement::PM_MoveScale(Game::playerState_s* ps, float forwardmove,
float rightmove, float upmove)
{ {
Movement::PlayerLastStandCrawlSpeedScale = Dvar::Register<float>(name, defaultVal, assert(ps != nullptr);
auto max = (std::fabsf(forwardmove) < std::fabsf(rightmove))
? std::fabsf(rightmove)
: std::fabsf(forwardmove);
if (std::fabsf(upmove) > max)
{
max = std::fabsf(upmove);
}
if (max == 0.0f)
{
return 0.0f;
}
auto total = std::sqrtf(forwardmove * forwardmove
+ rightmove * rightmove + upmove * upmove);
auto scale = (ps->speed * max) / (127.0f * total);
if (ps->pm_flags & Game::PMF_WALKING || ps->leanf != 0.0f)
{
scale *= 0.4f;
}
if (ps->pm_type == Game::PM_NOCLIP)
{
return scale * Movement::CGNoclipScaler.get<float>();
}
if (ps->pm_type == Game::PM_UFO)
{
return scale * Movement::CGUfoScaler.get<float>();
}
if (ps->pm_type == Game::PM_SPECTATOR)
{
return scale * Movement::PlayerSpectateSpeedScale.get<float>();
}
return scale;
}
__declspec(naked) void Movement::PM_MoveScaleStub()
{
__asm
{
pushad
push [esp + 0xC + 0x20] // upmove
push [esp + 0xC + 0x20] // rightmove
push [esp + 0xC + 0x20] // forwardmove
push esi // ps
call Movement::PM_MoveScale
add esp, 0x10
popad
ret
}
}
__declspec(naked) void Movement::PM_StepSlideMoveStub()
{
__asm
{
// Check the value of BGBounces
push ecx
push eax
mov eax, Movement::BGBounces
mov ecx, dword ptr [eax + 0x10]
test ecx, ecx
pop eax
pop ecx
// Do not bounce if BGBounces is 0
jle noBounce
// Bounce
push 0x4B1B34
retn
noBounce:
// Original game code
cmp dword ptr [esp + 0x24], 0
push 0x4B1B48
retn
}
}
void Movement::PM_ProjectVelocityStub(const float* velIn, const float* normal, float* velOut)
{
const auto lengthSquared2D = velIn[0] * velIn[0] + velIn[1] * velIn[1];
if (std::fabsf(normal[2]) < 0.001f || lengthSquared2D == 0.0)
{
velOut[0] = velIn[0];
velOut[1] = velIn[1];
velOut[2] = velIn[2];
return;
}
auto newZ = velIn[0] * normal[0] + velIn[1] * normal[1];
newZ = -newZ / normal[2];
const auto lengthScale = std::sqrtf((velIn[2] * velIn[2] + lengthSquared2D)
/ (newZ * newZ + lengthSquared2D));
if (Movement::BGBouncesAllAngles.get<bool>()
|| (lengthScale < 1.f || newZ < 0.f || velIn[2] > 0.f))
{
velOut[0] = velIn[0] * lengthScale;
velOut[1] = velIn[1] * lengthScale;
velOut[2] = newZ * lengthScale;
}
}
// Double bounces
void Movement::Jump_ClearState_Hk(Game::playerState_s* ps)
{
if (Movement::BGBounces->current.integer != Movement::DOUBLE)
{
Game::Jump_ClearState(ps);
}
}
Game::gentity_s* Movement::Weapon_RocketLauncher_Fire_Hk(Game::gentity_s* ent, unsigned int weaponIndex,
float spread, Game::weaponParms* wp, const float* gunVel, Game::lockonFireParms* lockParms, bool a7)
{
auto* result = Game::Weapon_RocketLauncher_Fire(ent, weaponIndex, spread, wp, gunVel, lockParms, a7);
if (ent->client != nullptr && BGRocketJump.get<bool>())
{
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;
}
int Movement::StuckInClient_Hk(Game::gentity_s* self)
{
if (Movement::BGPlayerEjection.get<bool>())
{
return Utils::Hook::Call<int(Game::gentity_s*)>(0x402D30)(self); // StuckInClient
}
return 0;
}
void Movement::CM_TransformedCapsuleTrace_Hk(Game::trace_t* results, const float* start, const float* end,
const Game::Bounds* bounds, const Game::Bounds* capsule, int contents, const float* origin, const float* angles)
{
if (Movement::BGPlayerCollision.get<bool>())
{
Utils::Hook::Call<void(Game::trace_t*, const float*, const float*,
const Game::Bounds*, const Game::Bounds*, int, const float*, const float*)>
(0x478300)
(results, start, end, bounds, capsule, contents, origin, angles); // CM_TransformedCapsuleTrace
}
}
Game::dvar_t* Movement::Dvar_RegisterLastStandSpeedScale(const char* name, float value,
float min, float max, int, const char* desc)
{
Movement::PlayerLastStandCrawlSpeedScale = Dvar::Register<float>(name, value,
min, max, Game::DVAR_FLAG_CHEAT | Game::DVAR_FLAG_REPLICATED, desc); min, max, Game::DVAR_FLAG_CHEAT | Game::DVAR_FLAG_REPLICATED, desc);
return Movement::PlayerLastStandCrawlSpeedScale.get<Game::dvar_t*>(); return Movement::PlayerLastStandCrawlSpeedScale.get<Game::dvar_t*>();
} }
Game::dvar_t* Movement::Dvar_RegisterSpectateSpeedScale(const char* name, float value,
float min, float max, int, const char* desc)
{
Movement::PlayerSpectateSpeedScale = Dvar::Register<float>(name, value,
min, max, Game::DVAR_FLAG_CHEAT | Game::DVAR_FLAG_REPLICATED, desc);
return Movement::PlayerSpectateSpeedScale.get<Game::dvar_t*>();
}
Movement::Movement() Movement::Movement()
{ {
Dvar::OnInit([] Dvar::OnInit([]
{ {
static const char* bg_bouncesValues[] =
{
"disabled",
"enabled",
"double",
nullptr
};
Movement::PlayerDuckedSpeedScale = Dvar::Register<float>("player_duckedSpeedScale", Movement::PlayerDuckedSpeedScale = Dvar::Register<float>("player_duckedSpeedScale",
0.65f, 0.0f, 5.0f, Game::DVAR_FLAG_CHEAT | Game::DVAR_FLAG_REPLICATED, 0.65f, 0.0f, 5.0f, Game::DVAR_FLAG_CHEAT | Game::DVAR_FLAG_REPLICATED,
"The scale applied to the player speed when ducking"); "The scale applied to the player speed when ducking");
@ -143,19 +297,60 @@ namespace Components
Movement::PlayerProneSpeedScale = Dvar::Register<float>("player_proneSpeedScale", Movement::PlayerProneSpeedScale = Dvar::Register<float>("player_proneSpeedScale",
0.15f, 0.0f, 5.0f, Game::DVAR_FLAG_CHEAT | Game::DVAR_FLAG_REPLICATED, 0.15f, 0.0f, 5.0f, Game::DVAR_FLAG_CHEAT | Game::DVAR_FLAG_REPLICATED,
"The scale applied to the player speed when crawling"); "The scale applied to the player speed when crawling");
// 3arc naming convention
Movement::CGUfoScaler = Dvar::Register<float>("cg_ufo_scaler",
6.0f, 0.001f, 1000.0f, Game::DVAR_FLAG_CHEAT | Game::DVAR_FLAG_REPLICATED,
"The speed at which ufo camera moves");
Movement::CGNoclipScaler = Dvar::Register<float>("cg_noclip_scaler",
3.0f, 0.001f, 1000.0f, Game::DVAR_FLAG_CHEAT | Game::DVAR_FLAG_REPLICATED,
"The speed at which noclip camera moves");
Movement::BGBounces = Game::Dvar_RegisterEnum("bg_bounces",
bg_bouncesValues, Movement::DISABLED, Game::DVAR_FLAG_REPLICATED, "Bounce glitch settings");
Movement::BGBouncesAllAngles = Dvar::Register<bool>("bg_bouncesAllAngles",
false, Game::DVAR_FLAG_REPLICATED, "Force bounce from all angles");
Movement::BGRocketJump = Dvar::Register<bool>("bg_rocketJump",
false, Game::DVAR_FLAG_REPLICATED, "Enable CoD4 rocket jumps");
Movement::BGPlayerEjection = Dvar::Register<bool>("bg_playerEjection",
true, Game::DVAR_FLAG_REPLICATED, "Push intersecting players away from each other");
Movement::BGPlayerCollision = Dvar::Register<bool>("bg_playerCollision",
true, Game::DVAR_FLAG_REPLICATED, "Push intersecting players away from each other");
}); });
// Hook PM_CmdScaleForStance in PM_CmdScale_Walk // Hook PM_CmdScaleForStance in PM_CmdScale_Walk
Utils::Hook(0x572F34, Movement::PMCmdScaleForStanceStub, HOOK_CALL).install()->quick(); Utils::Hook(0x572F34, Movement::PM_CmdScaleForStanceStub, HOOK_CALL).install()->quick();
//Hook PM_CmdScaleForStance in PM_GetMaxSpeed //Hook PM_CmdScaleForStance in PM_GetMaxSpeed
Utils::Hook(0x57395F, Movement::PMCmdScaleForStanceStub, HOOK_CALL).install()->quick(); Utils::Hook(0x57395F, Movement::PM_CmdScaleForStanceStub, HOOK_CALL).install()->quick();
// Hook Dvar_RegisterFloat. Only thing that's changed is that the 0x80 flag is not used. // Hook Dvar_RegisterFloat. Only thing that's changed is that the 0x80 flag is not used.
Utils::Hook(0x448B66, Movement::Dvar_RegisterLastStandSpeedScale, HOOK_CALL).install()->quick(); Utils::Hook(0x448B66, Movement::Dvar_RegisterLastStandSpeedScale, HOOK_CALL).install()->quick();
}
Movement::~Movement() // Hook Dvar_RegisterFloat. Only thing that's changed is that the 0x80 flag is not used.
{ Utils::Hook(0x448990, Movement::Dvar_RegisterSpectateSpeedScale, HOOK_CALL).install()->quick();
// Hook PM_MoveScale so we can add custom speed scale for Ufo and Noclip
Utils::Hook(0x56F845, Movement::PM_MoveScaleStub, HOOK_CALL).install()->quick();
Utils::Hook(0x56FABD, Movement::PM_MoveScaleStub, HOOK_CALL).install()->quick();
// Bounce logic
Utils::Hook(0x4B1B2D, Movement::PM_StepSlideMoveStub, HOOK_JUMP).install()->quick();
Utils::Hook(0x57383E, Movement::Jump_ClearState_Hk, HOOK_CALL).install()->quick();
Utils::Hook(0x4B1B97, Movement::PM_ProjectVelocityStub, HOOK_CALL).install()->quick();
// Rocket jump
Utils::Hook(0x4A4F9B, Movement::Weapon_RocketLauncher_Fire_Hk, HOOK_CALL).install()->quick(); // FireWeapon
// Hook StuckInClient & CM_TransformedCapsuleTrace
// so we can prevent intersecting players from being pushed away from each other
Utils::Hook(0x5D8153, Movement::StuckInClient_Hk, HOOK_CALL).install()->quick();
Utils::Hook(0x45A5BF, Movement::CM_TransformedCapsuleTrace_Hk, HOOK_CALL).install()->quick(); // SV_ClipMoveToEntity
Utils::Hook(0x5A0CAD, Movement::CM_TransformedCapsuleTrace_Hk, HOOK_CALL).install()->quick(); // CG_ClipMoveToEntity
} }
} }

View File

@ -6,17 +6,41 @@ namespace Components
{ {
public: public:
Movement(); Movement();
~Movement();
private: private:
enum BouncesSettings { DISABLED, ENABLED, DOUBLE };
static Dvar::Var PlayerDuckedSpeedScale; static Dvar::Var PlayerDuckedSpeedScale;
static Dvar::Var PlayerLastStandCrawlSpeedScale; static Dvar::Var PlayerLastStandCrawlSpeedScale;
static Dvar::Var PlayerProneSpeedScale; static Dvar::Var PlayerProneSpeedScale;
static Dvar::Var PlayerSpectateSpeedScale;
static Dvar::Var CGUfoScaler;
static Dvar::Var CGNoclipScaler;
static Dvar::Var BGBouncesAllAngles;
static Dvar::Var BGRocketJump;
static Dvar::Var BGPlayerEjection;
static Dvar::Var BGPlayerCollision;
// Can't use Var class inside assembly stubs
static Game::dvar_t* BGBounces;
static int PMGetEffectiveStance(Game::playerState_s* ps); static float PM_CmdScaleForStance(const Game::pmove_s* move);
static float PMCmdScaleForStance(Game::pmove_s* move); static void PM_CmdScaleForStanceStub();
static void PMCmdScaleForStanceStub();
static Game::dvar_t* Dvar_RegisterLastStandSpeedScale(const char* name, float defaultVal, float min, float max, int flags, const char* desc); static float PM_MoveScale(Game::playerState_s* ps, float forwardmove, float rightmove, float upmove);
static void PM_MoveScaleStub();
// Bounce logic
static void PM_StepSlideMoveStub();
static void PM_ProjectVelocityStub(const float* velIn, const float* normal, float* velOut);
static void Jump_ClearState_Hk(Game::playerState_s* ps);
static Game::gentity_s* Weapon_RocketLauncher_Fire_Hk(Game::gentity_s* ent, unsigned int weaponIndex, float spread, Game::weaponParms* wp, const float* gunVel, Game::lockonFireParms* lockParms, bool a7);
// Player collison
static int StuckInClient_Hk(Game::gentity_s* self);
static void CM_TransformedCapsuleTrace_Hk(Game::trace_t* results, const float* start, const float* end, const Game::Bounds* bounds, const Game::Bounds* capsule, int contents, const float* origin, const float* angles);
static Game::dvar_t* Dvar_RegisterLastStandSpeedScale(const char* name, float value, float min, float max, int flags, const char* desc);
static Game::dvar_t* Dvar_RegisterSpectateSpeedScale(const char* name, float value, float min, float max, int flags, const char* desc);
}; };
} }

View File

@ -238,34 +238,6 @@ namespace Components
} }
} }
Game::dvar_t* QuickPatch::sv_enableBounces;
__declspec(naked) void QuickPatch::BounceStub()
{
__asm
{
// check the value of sv_enableBounces
push eax;
mov eax, sv_enableBounces;
cmp byte ptr[eax + 16], 1;
pop eax;
// always bounce if sv_enableBounces is set to 1
je bounce;
// original code
cmp dword ptr[esp + 24h], 0;
jnz dontBounce;
bounce:
push 0x004B1B34;
retn;
dontBounce:
push 0x004B1B48;
retn;
}
}
Game::dvar_t* QuickPatch::Dvar_RegisterAspectRatioDvar(const char* name, char**, int defaultVal, int flags, const char* description) Game::dvar_t* QuickPatch::Dvar_RegisterAspectRatioDvar(const char* name, char**, int defaultVal, int flags, const char* description)
{ {
static const char* r_aspectRatioEnum[] = static const char* r_aspectRatioEnum[] =
@ -324,61 +296,6 @@ namespace Components
} }
} }
Game::dvar_t* QuickPatch::g_playerCollision;
__declspec(naked) void QuickPatch::PlayerCollisionStub()
{
__asm
{
// check the value of g_playerCollision
push eax;
mov eax, g_playerCollision;
cmp byte ptr[eax + 16], 0;
pop eax;
// dont collide if g_playerCollision is set to 0
je dontcollide;
// original code
mov eax, dword ptr[esp + 0xa0];
push 0x00478376;
retn;
dontcollide:
mov eax, dword ptr[esp + 0xa0];
mov ecx, dword ptr[esp + 9ch];
push eax;
push ecx;
lea edx, [esp + 48h];
push edx;
mov eax, esi;
push 0x0047838b;
retn;
}
}
Game::dvar_t* QuickPatch::g_playerEjection;
__declspec(naked) void QuickPatch::PlayerEjectionStub()
{
__asm
{
// check the value of g_playerEjection
push eax;
mov eax, g_playerEjection;
cmp byte ptr[eax + 16], 0;
pop eax;
// dont eject if g_playerEjection is set to 0
je donteject;
push 0x005d8152;
retn;
donteject:
push 0x005d815b;
retn;
}
}
BOOL QuickPatch::IsDynClassnameStub(char* a1) BOOL QuickPatch::IsDynClassnameStub(char* a1)
{ {
auto version = Zones::GetEntitiesZoneVersion(); auto version = Zones::GetEntitiesZoneVersion();
@ -456,21 +373,9 @@ namespace Components
// Hook escape handling on open console to change behaviour to close the console instead of only canceling autocomplete // Hook escape handling on open console to change behaviour to close the console instead of only canceling autocomplete
Utils::Hook(0x4F66A3, CL_KeyEvent_ConsoleEscape_Stub, HOOK_JUMP).install()->quick(); Utils::Hook(0x4F66A3, CL_KeyEvent_ConsoleEscape_Stub, HOOK_JUMP).install()->quick();
// bounce dvar
sv_enableBounces = Game::Dvar_RegisterBool("sv_enableBounces", false, Game::DVAR_FLAG_REPLICATED, "Enables bouncing on the server");
Utils::Hook(0x4B1B2D, QuickPatch::BounceStub, HOOK_JUMP).install()->quick();
// Intermission time dvar // Intermission time dvar
Game::Dvar_RegisterFloat("scr_intermissionTime", 10, 0, 120, Game::DVAR_FLAG_REPLICATED | Game::DVAR_FLAG_DEDISAVED, "Time in seconds before match server loads the next map"); Game::Dvar_RegisterFloat("scr_intermissionTime", 10, 0, 120, Game::DVAR_FLAG_REPLICATED | Game::DVAR_FLAG_DEDISAVED, "Time in seconds before match server loads the next map");
// Player Collision dvar
g_playerCollision = Game::Dvar_RegisterBool("g_playerCollision", true, Game::DVAR_FLAG_REPLICATED, "Flag whether player collision is on or off");
Utils::Hook(0x47836F, QuickPatch::PlayerCollisionStub, HOOK_JUMP).install()->quick();
// Player Ejection dvar
g_playerEjection = Game::Dvar_RegisterBool("g_playerEjection", true, Game::DVAR_FLAG_REPLICATED, "Flag whether player ejection is on or off");
Utils::Hook(0x5D814A, QuickPatch::PlayerEjectionStub, HOOK_JUMP).install()->quick();
g_antilag = Game::Dvar_RegisterBool("g_antilag", true, Game::DVAR_FLAG_REPLICATED, "Perform antilag"); g_antilag = Game::Dvar_RegisterBool("g_antilag", true, Game::DVAR_FLAG_REPLICATED, "Perform antilag");
Utils::Hook(0x5D6D56, QuickPatch::ClientEventsFireWeaponStub, HOOK_JUMP).install()->quick(); Utils::Hook(0x5D6D56, QuickPatch::ClientEventsFireWeaponStub, HOOK_JUMP).install()->quick();
Utils::Hook(0x5D6D6A, QuickPatch::ClientEventsFireWeaponMeleeStub, HOOK_JUMP).install()->quick(); Utils::Hook(0x5D6D6A, QuickPatch::ClientEventsFireWeaponMeleeStub, HOOK_JUMP).install()->quick();

View File

@ -27,9 +27,6 @@ namespace Components
static bool InvalidNameCheck(char* dest, const char* source, int size); static bool InvalidNameCheck(char* dest, const char* source, int size);
static void InvalidNameStub(); static void InvalidNameStub();
static Game::dvar_t* sv_enableBounces;
static void BounceStub();
static Dvar::Var r_customAspectRatio; static Dvar::Var r_customAspectRatio;
static Game::dvar_t* Dvar_RegisterAspectRatioDvar(const char* name, char** enumValues, int defaultVal, int flags, const char* description); static Game::dvar_t* Dvar_RegisterAspectRatioDvar(const char* name, char** enumValues, int defaultVal, int flags, const char* description);
static void SetAspectRatioStub(); static void SetAspectRatioStub();
@ -39,10 +36,6 @@ namespace Components
static void ClientEventsFireWeaponStub(); static void ClientEventsFireWeaponStub();
static void ClientEventsFireWeaponMeleeStub(); static void ClientEventsFireWeaponMeleeStub();
static Game::dvar_t* g_playerCollision;
static void PlayerCollisionStub();
static Game::dvar_t* g_playerEjection;
static void PlayerEjectionStub();
static BOOL IsDynClassnameStub(char* a1); static BOOL IsDynClassnameStub(char* a1);
static void CL_KeyEvent_OnEscape(); static void CL_KeyEvent_OnEscape();

View File

@ -378,9 +378,12 @@ namespace Game
Field_AdjustScroll_t Field_AdjustScroll = Field_AdjustScroll_t(0x488C10); Field_AdjustScroll_t Field_AdjustScroll = Field_AdjustScroll_t(0x488C10);
AimAssist_ApplyAutoMelee_t AimAssist_ApplyAutoMelee = AimAssist_ApplyAutoMelee_t(0x56A360); AimAssist_ApplyAutoMelee_t AimAssist_ApplyAutoMelee = AimAssist_ApplyAutoMelee_t(0x56A360);
Weapon_RocketLauncher_Fire_t Weapon_RocketLauncher_Fire = Weapon_RocketLauncher_Fire_t(0x424680);
Jump_ClearState_t Jump_ClearState = Jump_ClearState_t(0x04B3890); Jump_ClearState_t Jump_ClearState = Jump_ClearState_t(0x04B3890);
PM_playerTrace_t PM_playerTrace = PM_playerTrace_t(0x458980); PM_playerTrace_t PM_playerTrace = PM_playerTrace_t(0x458980);
PM_Trace_t PM_Trace = PM_Trace_t(0x441F60); PM_Trace_t PM_Trace = PM_Trace_t(0x441F60);
PM_GetEffectiveStance_t PM_GetEffectiveStance = PM_GetEffectiveStance_t(0x412540);
XAssetHeader* DB_XAssetPool = reinterpret_cast<XAssetHeader*>(0x7998A8); XAssetHeader* DB_XAssetPool = reinterpret_cast<XAssetHeader*>(0x7998A8);
unsigned int* g_poolSize = reinterpret_cast<unsigned int*>(0x7995E8); unsigned int* g_poolSize = reinterpret_cast<unsigned int*>(0x7995E8);

View File

@ -136,7 +136,7 @@ namespace Game
typedef void(__cdecl * Com_EndParseSession_t)(); typedef void(__cdecl * Com_EndParseSession_t)();
extern Com_EndParseSession_t Com_EndParseSession; extern Com_EndParseSession_t Com_EndParseSession;
typedef void(__cdecl * Com_BeginParseSession_t)(const char* why); typedef void(__cdecl * Com_BeginParseSession_t)(const char* filename);
extern Com_BeginParseSession_t Com_BeginParseSession; extern Com_BeginParseSession_t Com_BeginParseSession;
typedef void(__cdecl * Com_SetSpaceDelimited_t)(int); typedef void(__cdecl * Com_SetSpaceDelimited_t)(int);
@ -897,6 +897,9 @@ namespace Game
typedef void(__cdecl * AimAssist_ApplyAutoMelee_t)(const AimInput* input, AimOutput* output); typedef void(__cdecl * AimAssist_ApplyAutoMelee_t)(const AimInput* input, AimOutput* output);
extern AimAssist_ApplyAutoMelee_t AimAssist_ApplyAutoMelee; extern AimAssist_ApplyAutoMelee_t AimAssist_ApplyAutoMelee;
typedef gentity_s*(__cdecl * Weapon_RocketLauncher_Fire_t)(gentity_s* ent, unsigned int weaponIndex, float spread, weaponParms* wp, const float* gunVel, lockonFireParms* lockParms, bool a7);
extern Weapon_RocketLauncher_Fire_t Weapon_RocketLauncher_Fire;
typedef void(__cdecl * Jump_ClearState_t)(playerState_s* ps); typedef void(__cdecl * Jump_ClearState_t)(playerState_s* ps);
extern Jump_ClearState_t Jump_ClearState; extern Jump_ClearState_t Jump_ClearState;
@ -906,6 +909,9 @@ namespace Game
typedef void(__cdecl * PM_Trace_t)(pmove_s*, trace_t*, const float*, const float*, const Bounds*, int, int); typedef void(__cdecl * PM_Trace_t)(pmove_s*, trace_t*, const float*, const float*, const Bounds*, int, int);
extern PM_Trace_t PM_Trace; extern PM_Trace_t PM_Trace;
typedef EffectiveStance(__cdecl * PM_GetEffectiveStance_t)(const playerState_s* ps);
extern PM_GetEffectiveStance_t PM_GetEffectiveStance;
extern XAssetHeader* DB_XAssetPool; extern XAssetHeader* DB_XAssetPool;
extern unsigned int* g_poolSize; extern unsigned int* g_poolSize;

View File

@ -860,6 +860,39 @@ namespace Game
MaterialShaderArgument *args; MaterialShaderArgument *args;
}; };
/* 9045 */
struct visionSetVars_t
{
bool glowEnable;
float glowBloomCutoff;
float glowBloomDesaturation;
float glowBloomIntensity0;
float glowBloomIntensity1;
float glowRadius0;
float glowRadius1;
float glowSkyBleedIntensity0;
float glowSkyBleedIntensity1;
bool filmEnable;
float filmBrightness;
float filmContrast;
float filmDesaturation;
float filmDesaturationDark;
bool filmInvert;
float filmLightTint[3];
float filmMediumTint[3];
float filmDarkTint[3];
bool charPrimaryUseTweaks;
float charPrimaryDiffuseScale;
float charPrimarySpecularScale;
};
struct visField_t
{
const char* name;
int offset;
int fieldType;
};
enum OffhandClass enum OffhandClass
{ {
OFFHAND_CLASS_NONE = 0x0, OFFHAND_CLASS_NONE = 0x0,
@ -1096,6 +1129,32 @@ namespace Game
hudelem_s archival[31]; hudelem_s archival[31];
}; };
enum playerStateFlag
{
PMF_PRONE = 0x1,
PMF_DUCKED = 0x2,
PMF_MANTLE = 0x4,
PMF_LADDER = 0x8,
PMF_SIGHT_AIMING = 0x10,
PMF_BACKWARDS_RUN = 0x20,
PMF_WALKING = 0x40,
PMF_TIME_HARDLANDING = 0x80,
PMF_TIME_KNOCKBACK = 0x100,
PMF_PRONEMOVE_OVERRIDDEN = 0x200,
PMF_RESPAWNED = 0x400,
PMF_FROZEN = 0x800,
PMF_LADDER_FALL = 0x1000,
PMF_JUMPING = 0x2000,
PMF_SPRINTING = 0x4000,
PMF_SHELLSHOCKED = 0x8000,
PMF_MELEE_CHARGE = 0x10000,
PMF_NO_SPRINT = 0x20000,
PMF_NO_JUMP = 0x40000,
PMF_REMOTE_CONTROLLING = 0x80000,
PMF_ANIM_SCRIPTED = 0x100000,
PMF_DIVING = 0x400000
};
enum pmtype_t enum pmtype_t
{ {
PM_NORMAL = 0x0, PM_NORMAL = 0x0,
@ -4616,6 +4675,19 @@ namespace Game
AddonMapEnts *addonMapEnts; AddonMapEnts *addonMapEnts;
}; };
/* 9210 */
struct weaponParms
{
float forward[3];
float right[3];
float up[3];
float muzzleTrace[3];
float gunForward[3];
unsigned int weaponIndex;
const WeaponDef* weapDef;
const WeaponCompleteDef* weapCompleteDef;
};
struct XAsset struct XAsset
{ {
XAssetType type; XAssetType type;
@ -5538,6 +5610,14 @@ namespace Game
static_assert(sizeof(gentity_s) == 0x274); static_assert(sizeof(gentity_s) == 0x274);
struct lockonFireParms
{
bool lockon;
gentity_s* target;
float targetPosOrOffset[3];
bool topFire;
};
#pragma pack(push, 1) #pragma pack(push, 1)
typedef struct client_s typedef struct client_s