diff --git a/src/Components/Modules/Bots.cpp b/src/Components/Modules/Bots.cpp index 7787d89..bc1dee8 100644 --- a/src/Components/Modules/Bots.cpp +++ b/src/Components/Modules/Bots.cpp @@ -12,9 +12,15 @@ namespace Components return sprintf(buffer, ConnectString, botName, protocol); } - void Bots::SV_BotUserMove_Func(Game::client_t*) + void Bots::SV_BotUserMove_Func(Game::client_t* cl) { + int cl_num = cl - Game::svs->clients; + Game::usercmd_t cmd = {}; + cmd.serverTime = Game::svs->time; + + cl->deltaMessage = cl->netchan.outgoingSequence - 1; + Game::SV_ClientThink(&cmd, cl); } __declspec(naked) void Bots::SV_BotUserMove_Stub() @@ -35,6 +41,9 @@ namespace Components // hook bot movement Utils::Hook(0x45C210, SV_BotUserMove_Stub, HOOK_JUMP).install()->quick(); + + // stop the ping spam + Utils::Hook::Nop(0x45BF59, 5); } Bots::~Bots() diff --git a/src/Components/Modules/HelloWorld.cpp b/src/Components/Modules/HelloWorld.cpp index 825534c..85daad1 100644 --- a/src/Components/Modules/HelloWorld.cpp +++ b/src/Components/Modules/HelloWorld.cpp @@ -5,7 +5,7 @@ namespace Components { HelloWorld::HelloWorld() { - MessageBoxA(nullptr, "MP", "DEBUG", 0); + //MessageBoxA(nullptr, Utils::String::VA("%d", Game::svs), "DEBUG", 0); } HelloWorld::~HelloWorld() diff --git a/src/Game/Game.cpp b/src/Game/Game.cpp index 2ac7f30..2f175c0 100644 --- a/src/Game/Game.cpp +++ b/src/Game/Game.cpp @@ -2,6 +2,32 @@ namespace Game { + clientStatic_t* cls; + serverStatic_t* svs; + server_t* sv; + + scrCompilePub_t* gScrCompilePub; + scrVarPub_t* scrVarPub; + scrVmPub_t* scrVmPub; + + cgs_t* cgsArray; + cg_t* cgArray; + + centity_s* cg_entitiesArray; + + WeaponDef_t** BG_WeaponNames; + + gentity_t* g_entities; + gclient_t* g_clients; + + bgs_s* level_bgs; + + level_locals_t* level; + + stringIndex_t* scr_const; + + bgs_s** bgs_ptr; + void Init(GAMEEXE) { cls = ASSIGN(clientStatic_t*, 0x68A408); @@ -30,5 +56,17 @@ namespace Game bgs_ptr = ASSIGN(bgs_s**, 0x19A1C78); } + + void SV_ClientThink(Game::usercmd_s* cmd, Game::client_t* client) + { + int func_loc = 0x456010; + + __asm + { + mov ecx, client; + mov eax, cmd; + call func_loc; + } + } } diff --git a/src/Game/Game.hpp b/src/Game/Game.hpp index 25d33fd..78074c2 100644 --- a/src/Game/Game.hpp +++ b/src/Game/Game.hpp @@ -7,29 +7,32 @@ namespace Game { void Init(GAMEEXE); - static clientStatic_t* cls; - static serverStatic_t* svs; - static server_t* sv; + extern clientStatic_t* cls; + extern serverStatic_t* svs; + extern server_t* sv; - static scrCompilePub_t* gScrCompilePub; - static scrVarPub_t* scrVarPub; - static scrVmPub_t* scrVmPub; + extern scrCompilePub_t* gScrCompilePub; + extern scrVarPub_t* scrVarPub; + extern scrVmPub_t* scrVmPub; - static cgs_t* cgsArray; - static cg_t* cgArray; + extern cgs_t* cgsArray; + extern cg_t* cgArray; - static centity_s* cg_entitiesArray; + extern centity_s* cg_entitiesArray; - static WeaponDef_t** BG_WeaponNames; + extern WeaponDef_t** BG_WeaponNames; - static gentity_t* g_entities; - static gclient_t* g_clients; + extern gentity_t* g_entities; + extern gclient_t* g_clients; - static bgs_s* level_bgs; + extern bgs_s* level_bgs; - static level_locals_t* level; + extern level_locals_t* level; - static stringIndex_t* scr_const; + extern stringIndex_t* scr_const; - static bgs_s** bgs_ptr; + extern bgs_s** bgs_ptr; + + + void SV_ClientThink(Game::usercmd_s*, Game::client_t*); }