From bf366b0172f40147ff037f642025b32ba5d4494f Mon Sep 17 00:00:00 2001 From: CCHyper <73803386+CCHyper@users.noreply.github.com> Date: Mon, 23 Aug 2021 12:48:24 +0100 Subject: [PATCH] Patch to allows the multiplayer score screen to be skipped if IsScoreSkip is set in multiplayer maps. --- src/extensions/scenario/scenarioext_hooks.cpp | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/src/extensions/scenario/scenarioext_hooks.cpp b/src/extensions/scenario/scenarioext_hooks.cpp index 40f267ff2..54072aff4 100644 --- a/src/extensions/scenario/scenarioext_hooks.cpp +++ b/src/extensions/scenario/scenarioext_hooks.cpp @@ -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" @@ -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. */ @@ -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); }