Skip to content

Commit

Permalink
Patch to allows the multiplayer score screen to be skipped if IsScore…
Browse files Browse the repository at this point in the history
…Skip is set in multiplayer maps.
  • Loading branch information
CCHyper committed Sep 4, 2021
1 parent 2e360c1 commit bf366b0
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions src/extensions/scenario/scenarioext_hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
******************************************************************************/
#include "scenarioext_hooks.h"
#include "scenarioext_functions.h"
#include "tibsun_globals.h"
#include "multiscore.h"
#include "scenario.h"
#include "session.h"
#include "fatal.h"
#include "debughandler.h"
#include "asserthandler.h"
Expand All @@ -35,6 +39,43 @@
#include "hooker_macros.h"


/**
* #issue-522
*
* These patches make the multiplayer score screen to honour the value of
* "IsSkipScore" from ScenarioClass.
*
* @author: CCHyper
*/
DECLARE_PATCH(_Do_Win_Skip_MPlayer_Score_Screen_Patch)
{
/**
* Stolen bytes/code.
*/
++Session.GamesPlayed;

if (!Scen->IsSkipScore) {
MultiScore::Presentation();
}

JMP(0x005DC9DF);
}

DECLARE_PATCH(_Do_Lose_Skip_MPlayer_Score_Screen_Patch)
{
/**
* Stolen bytes/code.
*/
++Session.GamesPlayed;

if (!Scen->IsSkipScore) {
MultiScore::Presentation();
}

JMP(0x005DCD9D);
}


/**
* Main function for patching the hooks.
*/
Expand All @@ -46,4 +87,7 @@ void ScenarioClassExtension_Hooks()
* @author: CCHyper
*/
Patch_Call(0x005E08E3, &Vinifera_Assign_Houses);

Patch_Jump(0x005DC9D4, &_Do_Win_Skip_MPlayer_Score_Screen_Patch);
Patch_Jump(0x005DCD92, &_Do_Lose_Skip_MPlayer_Score_Screen_Patch);
}

0 comments on commit bf366b0

Please sign in to comment.