improve bot stub further ⚡
This commit is contained in:
parent
598eb99461
commit
5c9a5c3eac
@ -247,42 +247,38 @@ namespace Components
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bots::BotAiAction()
|
void Bots::BotAiAction(Game::client_t* cl)
|
||||||
{
|
{
|
||||||
for (auto i = 0; i < *Game::svs_numclients; ++i)
|
if (cl->gentity == nullptr)
|
||||||
{
|
return;
|
||||||
auto* client = &Game::svs_clients[i];
|
|
||||||
|
|
||||||
if (client->state < Game::CS_CONNECTED)
|
Game::usercmd_s ucmd = {0};
|
||||||
continue;
|
const auto entnum = cl->gentity->s.number;
|
||||||
|
|
||||||
if (!client->bIsTestClient)
|
ucmd.serverTime = *Game::svs_time;
|
||||||
continue;
|
|
||||||
|
|
||||||
Game::usercmd_s ucmd = {0};
|
ucmd.buttons = g_botai[entnum].buttons;
|
||||||
|
ucmd.forwardmove = g_botai[entnum].forward;
|
||||||
|
ucmd.rightmove = g_botai[entnum].right;
|
||||||
|
ucmd.weapon = g_botai[entnum].weapon;
|
||||||
|
|
||||||
ucmd.serverTime = *Game::svs_time;
|
cl->deltaMessage = cl->netchan.outgoingSequence - 1;
|
||||||
|
|
||||||
ucmd.buttons = g_botai[i].buttons;
|
Game::SV_ClientThink(cl, &ucmd);
|
||||||
ucmd.forwardmove = g_botai[i].forward;
|
|
||||||
ucmd.rightmove = g_botai[i].right;
|
|
||||||
ucmd.weapon = g_botai[i].weapon;
|
|
||||||
|
|
||||||
client->deltaMessage = client->netchan.outgoingSequence - 1;
|
|
||||||
|
|
||||||
Game::SV_ClientThink(client, &ucmd);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr auto SV_UpdateBots = 0x626E50;
|
constexpr auto SV_BotUserMove = 0x626E50;
|
||||||
__declspec(naked) void Bots::SV_UpdateBots_Hk()
|
__declspec(naked) void Bots::SV_UpdateBots_Hk()
|
||||||
{
|
{
|
||||||
__asm
|
__asm
|
||||||
{
|
{
|
||||||
|
call SV_BotUserMove
|
||||||
|
|
||||||
pushad
|
pushad
|
||||||
|
|
||||||
call SV_UpdateBots
|
push edi
|
||||||
call Bots::BotAiAction
|
call Bots::BotAiAction
|
||||||
|
add esp, 4
|
||||||
|
|
||||||
popad
|
popad
|
||||||
ret
|
ret
|
||||||
|
@ -49,7 +49,7 @@ namespace Components
|
|||||||
|
|
||||||
static void AddMethods();
|
static void AddMethods();
|
||||||
|
|
||||||
static void BotAiAction();
|
static void BotAiAction(Game::client_t* cl);
|
||||||
static void SV_UpdateBots_Hk();
|
static void SV_UpdateBots_Hk();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user