Added bot movement hook

This commit is contained in:
ineedbots 2021-06-28 17:02:13 -06:00
parent 3ed8a393d3
commit a02827278e
3 changed files with 22 additions and 1 deletions

View File

@ -1,4 +1,4 @@
@echo off @echo off
echo Updating submodules... echo Updating submodules...
call git submodule update --init --recursive call git submodule update --init --recursive
call tools\premake5 %* vs2019 call tools\premake5 %* vs2019 --copy-to="G:\SteamLibrary\steamapps\common\Call of Duty 2"

View File

@ -12,10 +12,29 @@ namespace Components
return sprintf(buffer, ConnectString, botName, protocol); return sprintf(buffer, ConnectString, botName, protocol);
} }
void Bots::SV_BotUserMove_Func(Game::client_t*)
{
}
__declspec(naked) void Bots::SV_BotUserMove_Stub()
{
__asm
{
push esi;
call SV_BotUserMove_Func;
add esp, 4;
retn;
}
}
Bots::Bots() Bots::Bots()
{ {
// intercept the sprintf when creating the bot connect string // intercept the sprintf when creating the bot connect string
Utils::Hook(0x45655B, BuildConnectString, HOOK_CALL).install()->quick(); Utils::Hook(0x45655B, BuildConnectString, HOOK_CALL).install()->quick();
// hook bot movement
Utils::Hook(0x45C210, SV_BotUserMove_Stub, HOOK_JUMP).install()->quick();
} }
Bots::~Bots() Bots::~Bots()

View File

@ -11,5 +11,7 @@ namespace Components
static const char* ConnectString; static const char* ConnectString;
static int BuildConnectString(char*, const char*, int, int); static int BuildConnectString(char*, const char*, int, int);
static void SV_BotUserMove_Func(Game::client_t*);
static void SV_BotUserMove_Stub();
}; };
} }