Hook triggers

This commit is contained in:
rackover 2021-04-02 16:13:51 +02:00
parent 2b0529ab7d
commit bb979639d6
2 changed files with 28 additions and 0 deletions

View File

@ -739,6 +739,24 @@ namespace Components
Utils::Hook::Call<void(Game::gentity_s*, int, int)>(0x408910)(ent, unk, unk2);
}
bool Maps::SV_SetTriggerModelHook(Game::gentity_s* ent) {
//Logger::Print("SETTRIGGERMODELHOOK %s\n", ent->target);
std::string classname = Game::SL_ConvertToString(ent->script_classname);
std::string targetname = Game::SL_ConvertToString(ent->targetname);
//std::string test = "";
//if (ent->padding_short) {
// test = Game::SL_ConvertToString(ent->padding_short);
//}
return Utils::Hook::Call<bool(Game::gentity_s*)>(0x5050C0)(ent);
}
int16 Maps::CM_TriggerModelBounds(int modelPointer, Game::Bounds* bounds) {
Game::MapEnts* ents = *reinterpret_cast<Game::MapEnts**>(0x1AA651C);
return Utils::Hook::Call<int16(int, Game::Bounds*)>(0x4416C0)(modelPointer, bounds);
}
Maps::Maps()
{
@ -778,6 +796,14 @@ namespace Components
// disable turrets on CoD:OL 448+ maps for now
Utils::Hook(0x5EE577, Maps::G_SpawnTurretHook, HOOK_CALL).install()->quick();
Utils::Hook(0x44A4D5, Maps::G_SpawnTurretHook, HOOK_CALL).install()->quick();
// Check trigger models
Utils::Hook(0x5FC0F1, Maps::SV_SetTriggerModelHook, HOOK_CALL).install()->quick();
Utils::Hook(0x5FC2671, Maps::SV_SetTriggerModelHook, HOOK_CALL).install()->quick();
Utils::Hook(0x5050D4, Maps::CM_TriggerModelBounds, HOOK_CALL).install()->quick();
//
//#define SORT_SMODELS
#if !defined(DEBUG) || !defined(SORT_SMODELS)

View File

@ -120,5 +120,7 @@ namespace Components
static void SetSpecularStub1();
static void SetSpecularStub2();
static void G_SpawnTurretHook(Game::gentity_s* ent, int unk, int unk2);
static bool SV_SetTriggerModelHook(Game::gentity_s* ent);
static int16 CM_TriggerModelBounds(int brushModelPointer, Game::Bounds* bounds);
};
}