diff --git a/AMBuildScript b/AMBuildScript index d01cb05e..6bf448e2 100644 --- a/AMBuildScript +++ b/AMBuildScript @@ -228,7 +228,9 @@ class MMSPluginConfig(object): if builder.options.opt == '1': cxx.defines += ['NDEBUG'] if cxx.behavior == 'gcc': - cxx.cflags += ['-O3'] + cxx.cflags += ['-O3', '-flto'] + cxx.cxxflags += ['-g1'] # override ambuild's default -g3 flag. + cxx.linkflags += ['-flto'] elif cxx.behavior == 'msvc': cxx.cflags += ['/Ox', '/Zo'] cxx.linkflags += ['/OPT:ICF', '/OPT:REF'] diff --git a/src/movement/mv_player.cpp b/src/movement/mv_player.cpp index 822cdcc4..87714a75 100644 --- a/src/movement/mv_player.cpp +++ b/src/movement/mv_player.cpp @@ -10,6 +10,21 @@ void MovementPlayer::OnProcessMovement() this->walkMoved = false; this->takeoffFromLadder = false; this->collidingWithWorld = false; + + bool onGround = this->GetPlayerPawn()->m_fFlags() & FL_ONGROUND; + if (!this->previousOnGround && onGround) + { + Vector velocity; + this->GetVelocity(&velocity); + this->RegisterLanding(velocity, false); + this->OnStartTouchGround(); + } + else if (this->previousOnGround && !onGround) + { + this->RegisterTakeoff(false); + this->takeoffFromLadder = false; + this->OnStopTouchGround(); + } } void MovementPlayer::OnProcessMovementPost() @@ -26,6 +41,7 @@ void MovementPlayer::OnProcessMovementPost() this->oldAngles = this->moveDataPost.m_vecViewAngles; } this->oldWalkMoved = this->walkMoved; + this->previousOnGround = this->GetPlayerPawn()->m_fFlags() & FL_ONGROUND; } CCSPlayer_MovementServices *MovementPlayer::GetMoveServices() @@ -407,24 +423,9 @@ void MovementPlayer::OnPhysicsSimulate() { this->OnChangeMoveType(this->lastKnownMoveType); } - bool onGround = this->GetPlayerPawn()->m_fFlags() & FL_ONGROUND; - if (!this->previousOnGround && onGround) - { - Vector velocity; - this->GetVelocity(&velocity); - this->RegisterLanding(velocity, false); - this->OnStartTouchGround(); - } - else if (this->previousOnGround && !onGround) - { - this->RegisterTakeoff(false); - this->takeoffFromLadder = false; - this->OnStopTouchGround(); - } } void MovementPlayer::OnPhysicsSimulatePost() { this->lastKnownMoveType = this->GetMoveType(); - this->previousOnGround = this->GetPlayerPawn()->m_fFlags() & FL_ONGROUND; } diff --git a/src/utils/hooks.cpp b/src/utils/hooks.cpp index 9c483572..c1f43d22 100644 --- a/src/utils/hooks.cpp +++ b/src/utils/hooks.cpp @@ -24,6 +24,8 @@ #include "sdk/entity/cbasetrigger.h" +#include "vprof.h" + #include "memdbgon.h" extern CSteamGameServerAPIContext g_steamAPI; @@ -173,7 +175,7 @@ void hooks::Initialize() SH_ADD_HOOK(ISource2GameClients, OnClientConnected, g_pSource2GameClients, SH_STATIC(Hook_OnClientConnected), false); SH_ADD_HOOK(ISource2GameClients, ClientFullyConnect, g_pSource2GameClients, SH_STATIC(Hook_ClientFullyConnect), false); SH_ADD_HOOK(ISource2GameClients, ClientPutInServer, g_pSource2GameClients, SH_STATIC(Hook_ClientPutInServer), false); - SH_ADD_HOOK(ISource2GameClients, ClientActive, g_pSource2GameClients, SH_STATIC(Hook_ClientActive), false); + SH_ADD_HOOK(ISource2GameClients, ClientActive, g_pSource2GameClients, SH_STATIC(Hook_ClientActive), true); SH_ADD_HOOK(ISource2GameClients, ClientDisconnect, g_pSource2GameClients, SH_STATIC(Hook_ClientDisconnect), true); SH_ADD_HOOK(ISource2GameClients, ClientVoice, g_pSource2GameClients, SH_STATIC(Hook_ClientVoice), false); SH_ADD_HOOK(ISource2GameClients, ClientCommand, g_pSource2GameClients, SH_STATIC(Hook_ClientCommand), false); @@ -464,6 +466,7 @@ static_function void Hook_CheckTransmit(CCheckTransmitInfo **pInfo, int infoCoun // ISource2Server static_function void Hook_GameFrame(bool simulating, bool bFirstTick, bool bLastTick) { + VPROF_BUDGET(__func__, "CS2KZ"); g_KZPlugin.serverGlobals = *(g_pKZUtils->GetGlobals()); KZ::timer::CheckAnnounceQueue(); KZ::timer::CheckPBRequests(); @@ -519,7 +522,7 @@ static_function void Hook_ClientActive(CPlayerSlot slot, bool bLoadGame, const c } else { - Warning("WARNING: Player pawn for slot %i not found!\n", slot.Get()); + Warning("[KZ] WARNING: Player pawn for slot %i not found!\n", slot.Get()); } RETURN_META(MRES_IGNORED); } @@ -555,6 +558,7 @@ static_function void Hook_ClientVoice(CPlayerSlot slot) static_function void Hook_ClientCommand(CPlayerSlot slot, const CCommand &args) { + VPROF_BUDGET(__func__, "CS2KZ"); if (META_RES result = KZ::misc::CheckBlockedRadioCommands(args[0])) { RETURN_META(result); @@ -625,6 +629,7 @@ static_function bool Hook_FireEvent(IGameEvent *event, bool bDontBroadcast) // ICvar static_function void Hook_DispatchConCommand(ConCommandHandle cmd, const CCommandContext &ctx, const CCommand &args) { + VPROF_BUDGET(__func__, "CS2KZ"); if (META_RES result = KZ::misc::CheckBlockedRadioCommands(args[0])) { RETURN_META(result);