diff --git a/src/component/player.cpp b/src/component/player.cpp index a969fb7..93a6af6 100644 --- a/src/component/player.cpp +++ b/src/component/player.cpp @@ -63,6 +63,23 @@ namespace player client->previouslyUsingNightVision = 0; game::Scr_NotifyNum(game::SCRIPTINSTANCE_SERVER, ent->s.number, 0, game::scr_const->night_vision_off, 0); } + + //New addition + if (game::PM_IsSprinting(&client->ps)) + { + if (!client->previouslySprinting) + { + client->previouslySprinting = true; + std::string sprintBeginNotifyStr("sprint_begin"); + game::Scr_NotifyNum(game::SCRIPTINSTANCE_SERVER, ent->s.number, 0, game::SL_GetStringOfSize(game::SCRIPTINSTANCE_SERVER, sprintBeginNotifyStr.data(), 0, sprintBeginNotifyStr.length()), 0); + } + } + else if (client->previouslySprinting) + { + client->previouslySprinting = false; + std::string sprintBeginNotifyStr("sprint_end"); + game::Scr_NotifyNum(game::SCRIPTINSTANCE_SERVER, ent->s.number, 0, game::SL_GetStringOfSize(game::SCRIPTINSTANCE_SERVER, sprintBeginNotifyStr.data(), 0, sprintBeginNotifyStr.length()), 0); + } } void __declspec(naked) G_ClientDoPerFrameNotifies_stub() diff --git a/src/game/game.cpp b/src/game/game.cpp index 7364e60..55c641f 100644 --- a/src/game/game.cpp +++ b/src/game/game.cpp @@ -695,6 +695,11 @@ namespace game } } + bool PM_IsSprinting(const playerState_s* ps) + { + return ps->sprintState.lastSprintStart && ps->sprintState.lastSprintStart > ps->sprintState.lastSprintEnd; + } + game::pathnode_t* Path_ConvertIndexToNode(int index) { return &(*game::gameWorldCurrent)->path.nodes[index]; diff --git a/src/game/game.hpp b/src/game/game.hpp index 74f8631..b5b994e 100644 --- a/src/game/game.hpp +++ b/src/game/game.hpp @@ -79,7 +79,10 @@ namespace game int Path_GeneratePath(path_t* pPath, team_t eTeam, const float* vStartPos, float* vGoalPos, pathnode_t* pNodeFrom, pathnode_t* pNodeTo, int bIncludeGoalPos, int bAllowNegotiationLinks); void Path_UpdateLookahead(path_t* pPath, const float* vStartPos, int bReduceLookaheadAmount, int a4, int bAllowBacktrack); void Path_AddTrimmedAmount(const float* a1, path_t* a2); + + //Reimplemented functions void Path_TransferLookahead(path_t* a1, const float* a2); + bool PM_IsSprinting(const playerState_s* ps); pathnode_t* Path_ConvertIndexToNode(int index); unsigned int __cdecl Path_ConvertNodeToIndex(const game::pathnode_t* node); pathnode_t* Path_GetNegotiationNode(const path_t* pPath); diff --git a/src/game/structs.hpp b/src/game/structs.hpp index d0cfb2d..241489e 100644 --- a/src/game/structs.hpp +++ b/src/game/structs.hpp @@ -1046,8 +1046,12 @@ namespace game float vGunSpeed[3]; int dropWeaponTime; bool previouslyChangingWeapon; + //New additions below + bool previouslySprinting; }; + static_assert(sizeof(gclient_s) == 0x2348); + enum AISpecies : __int32 { AI_SPECIES_HUMAN = 0x0,