Rocket jumps

This commit is contained in:
Diavolo 2022-02-05 17:24:59 +01:00
parent 2c39b16a67
commit 2251319b81
No known key found for this signature in database
GPG Key ID: FA77F074E98D98A5
5 changed files with 85 additions and 6 deletions

View File

@ -9,6 +9,7 @@ namespace Components
Dvar::Var Movement::CGUfoScaler;
Dvar::Var Movement::CGNoclipScaler;
Dvar::Var Movement::BGBouncesAllAngles;
Dvar::Var Movement::BGRocketJump;
Game::dvar_t* Movement::BGBounces;
float Movement::PM_CmdScaleForStance(const Game::pmove_s* pm)
@ -220,6 +221,21 @@ namespace Components
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;
}
Game::dvar_t* Movement::Dvar_RegisterLastStandSpeedScale(const char* name, float value,
float min, float max, int, const char* desc)
{
@ -272,6 +288,9 @@ namespace Components
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");
});
// Hook PM_CmdScaleForStance in PM_CmdScale_Walk
@ -294,9 +313,8 @@ namespace Components
Utils::Hook(0x4B1B2D, Movement::PM_StepSlideMoveStub, HOOK_JUMP).install()->quick();
Utils::Hook(0x57383E, Movement::Jump_ClearStateHook, HOOK_CALL).install()->quick();
Utils::Hook(0x4B1B97, Movement::PM_ProjectVelocityStub, HOOK_CALL).install()->quick();
}
Movement::~Movement()
{
// Rocket jump
Utils::Hook(0x4A4F9B, Movement::Weapon_RocketLauncher_Fire_Hk, HOOK_CALL).install()->quick(); // FireWeapon
}
}

View File

@ -6,7 +6,6 @@ namespace Components
{
public:
Movement();
~Movement();
private:
enum BouncesSettings { DISABLED, ENABLED, DOUBLE };
@ -18,6 +17,7 @@ namespace Components
static Dvar::Var CGUfoScaler;
static Dvar::Var CGNoclipScaler;
static Dvar::Var BGBouncesAllAngles;
static Dvar::Var BGRocketJump;
// Can't use Var class inside assembly stubs
static Game::dvar_t* BGBounces;
@ -32,6 +32,8 @@ namespace Components
static void PM_ProjectVelocityStub(const float* velIn, const float* normal, float* velOut);
static void Jump_ClearStateHook(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);
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

@ -377,6 +377,8 @@ namespace Game
Field_AdjustScroll_t Field_AdjustScroll = Field_AdjustScroll_t(0x488C10);
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);
PM_playerTrace_t PM_playerTrace = PM_playerTrace_t(0x458980);
PM_Trace_t PM_Trace = PM_Trace_t(0x441F60);

View File

@ -133,13 +133,13 @@ namespace Game
typedef void(__cdecl * Com_EndParseSession_t)();
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;
typedef void(__cdecl * Com_SetSpaceDelimited_t)(int);
extern Com_SetSpaceDelimited_t Com_SetSpaceDelimited;
typedef char* (__cdecl * Com_Parse_t)(const char **data_p);
typedef char*(__cdecl * Com_Parse_t)(const char** data_p);
extern Com_Parse_t Com_Parse;
typedef bool (__cdecl * Com_MatchToken_t)(const char **data_p, const char* token, int size);
@ -894,6 +894,9 @@ namespace Game
typedef void(__cdecl * AimAssist_ApplyAutoMelee_t)(const AimInput* input, AimOutput* output);
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);
extern Jump_ClearState_t Jump_ClearState;

View File

@ -860,6 +860,39 @@ namespace Game
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
{
OFFHAND_CLASS_NONE = 0x0,
@ -4608,6 +4641,19 @@ namespace Game
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
{
XAssetType type;
@ -5528,6 +5574,14 @@ namespace Game
char pad[100];
} gentity_t;
struct lockonFireParms
{
bool lockon;
gentity_s* target;
float targetPosOrOffset[3];
bool topFire;
};
#pragma pack(push, 1)
typedef struct client_s
{