Skip to content

Commit

Permalink
Fix spectator
Browse files Browse the repository at this point in the history
  • Loading branch information
ZivDero committed Sep 20, 2024
1 parent 109c1e3 commit ad944b1
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/extensions/scenario/scenarioext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,7 @@ void ScenarioClassExtension::Assign_Houses()
// Spectators are considered defeated
if (is_spectator)
{
housep->IsDefeated;
housep->IsDefeated = true;
}
}
}
Expand Down
25 changes: 25 additions & 0 deletions src/spawner/modules/spectator_hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,30 @@ void MapClassExt::_Reveal_The_Map()
}


DECLARE_PATCH(_RadarClass_Compute_Radar_Image)
{
if (Spawner::Active)
{
spectator_radar_enabled = false;
if (((HouseClassExt*)PlayerPtr)->_Is_Spectator() && !((HouseClassExt*)PlayerPtr)->_Is_Coach() && PlayerPtr->IsDefeated)
{
Session.ObiWan = true;
Map.Reveal_The_Map();
}
}

// Function epilogue
_asm
{
pop edi
pop esi
pop ebp
add esp, 0x14
ret
}
}


void Spectator_Hooks()
{
Patch_Call(0x00506D7B, &DisplayClassExt::_Encroach_Shadow_Spectator);
Expand All @@ -256,4 +280,5 @@ void Spectator_Hooks()
Patch_Call(0x00428A23, &HouseClassExt::_Is_Ally_Or_Spectator);
Patch_Call(0x004BC608, &HouseClassExt::_Update_Radars);
Patch_Call(0x004BF5D6, &MapClassExt::_Reveal_The_Map);
Patch_Jump(0x005B9CFE, &_RadarClass_Compute_Radar_Image);
}

0 comments on commit ad944b1

Please sign in to comment.