diff --git a/src/spawner/spawner.asm b/src/spawner/spawner.asm index dcd473f..955d61e 100644 --- a/src/spawner/spawner.asm +++ b/src/spawner/spawner.asm @@ -601,9 +601,11 @@ _Init_Game_Check_Spawn_Arg_No_Intro: _HouseClass__Make_Ally_STFU_when_Allying_In_Loading_Screen_Spawner: cmp byte [IsDoingAlliancesSpawner], 1 - jz 0x004BDE68 - test al, al ; hooked by patch - jz 0x4BDE68 + je 0x004BDE68 + cmp byte [AlliesAllowed], 0 + je 0x004BDE68 + test al, al ; fix code that our jump-to-hook destroyed + jz 0x004BDE68 jmp 0x004BDDB9 _SessionClass__Free_Scenario_Descriptions_RETN_Patch: diff --git a/src/trigger_actions_extended.asm b/src/trigger_actions_extended.asm index 8e465cf..dc3db76 100644 --- a/src/trigger_actions_extended.asm +++ b/src/trigger_actions_extended.asm @@ -161,6 +161,8 @@ hack 0x0061913B ; Extend trigger action jump table jz .Remove_Attached_Objects_Action cmp edx, 115 jz .Assign_Mission_To_All_Units_Action + cmp edx, 116 + jz .Make_Ally_One_Sided_Action cmp edx, 68h ja 0x0061A9C5 ; default @@ -419,3 +421,24 @@ hack 0x0061913B ; Extend trigger action jump table jl .AM_Loop_MainBody jmp 0x00619F9F ; success + + +; *********************************** +; *** Make Ally (One-Sided) *** +; *********************************** +.Make_Ally_One_Sided_Action: + mov ecx, [esi+40h] ; Fetch first parameter + cmp ecx, 0FFFFFFFFh + jz 0x00619F9F ; success + call 0x004C4730 ; HouseClass::As_Pointer(HousesType) + mov ecx, [esp+1C4h] ; Fetch owning house from trigger data + push eax + ; We need to increment ScenarioInit to allow houses to ally even if they would be the "last enemies" to each other in multiplayer + mov edi, [ScenarioInit] + inc edi + mov [ScenarioInit], edi + call 0x004BDB50 ; HouseClass::Make_Ally(HouseClass *) + mov edi, [ScenarioInit] + dec edi + mov [ScenarioInit], edi + jmp 0x00619F9F ; success