Skip to content
This repository has been archived by the owner on Jun 23, 2019. It is now read-only.

Commit

Permalink
Added missing hook
Browse files Browse the repository at this point in the history
Some special terrains are drawn differently and a hook was missing.
This will be included in the next SoD_SP version.
  • Loading branch information
RoseKavalier committed Jan 24, 2019
1 parent ff23980 commit bd4dabb
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion AnchorBugFix/DllMain.cpp
Expand Up @@ -129,7 +129,12 @@ void __stdcall FixObstacleAnchorBug(HiHook *h, _BattleMgr_ *combat)

int __stdcall RepositionAnchorDef(LoHook *h, HookContext *c)
{
_BattleHex_ *hex = (_BattleHex_*)(c->edi - 0x14);
_BattleHex_ *hex;
if (c->return_address == 0x49452B) // handles the different placement of the hook
hex = (_BattleHex_*)(c->edi - 0x1C); // original case
else
hex = (_BattleHex_*)(c->edi - 0x14); // this is the new, missing, case

_BattleMgr_ *combat = (_BattleMgr_*)c->esi;
if (hex->Flags == 3) // anchor & local obstacle
{
Expand Down Expand Up @@ -220,6 +225,7 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReser
_PI = _P->CreateInstance("AnchorBugFix");
_PI->WriteHiHook(0x465E70, SPLICE_, EXTENDED_, THISCALL_, FixObstacleAnchorBug);
_PI->WriteLoHook(0x4941FE, RepositionAnchorDef);
_PI->WriteLoHook(0x494523, RepositionAnchorDef); // this hook was missing for some special terrains
}
break;

Expand Down

0 comments on commit bd4dabb

Please sign in to comment.