From 397fdef034faf90bb89116e7028340f806c81488 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Mon, 5 Apr 2021 22:34:52 -0400 Subject: [PATCH] Load intermission patches in Y_LoadIntermisionData --- src/g_game.c | 1 + src/y_inter.c | 133 ++++++++++++++++++++++++++++++++------------------ src/y_inter.h | 1 + 3 files changed, 87 insertions(+), 48 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index 2b304b4fd..29ad4086e 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -3973,6 +3973,7 @@ static void G_DoCompleted(void) { G_SetGamestate(GS_INTERMISSION); Y_StartIntermission(); + Y_LoadIntermisionData(); G_UpdateVisited(); G_HandleSaveLevel(); } diff --git a/src/y_inter.c b/src/y_inter.c index bd3b557d7..629d07426 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -215,6 +215,86 @@ static void Y_IntermissionTokenDrawer(void) V_DrawCroppedPatch(32<width, calc); } + +// +// Y_LoadData +// +// Load patches for drawing the intermission, if acceptable +// +void Y_LoadIntermisionData(void) +{ + INT32 i; + + if (dedicated) + return; + + switch (intertype) + { + case int_coop: + { + for (i = 0; i < 4; ++i) + { + if (strlen(data.coop.bonuses[i].patch)) + data.coop.bonuspatches[i] = W_CachePatchName(data.coop.bonuses[i].patch, PU_PATCH); + } + data.coop.ptotal = W_CachePatchName("YB_TOTAL", PU_PATCH); + + // get background patches + bgpatch = W_CachePatchName("INTERSCR", PU_PATCH); + + // grab an interscreen if appropriate + if (mapheaderinfo[gamemap-1]->interscreen[0] != '#') + interpic = W_CachePatchName(mapheaderinfo[gamemap-1]->interscreen, PU_PATCH); + break; + } + case int_spec: + { + for (i = 0; i < 2; ++i) + data.spec.bonuspatches[i] = W_CachePatchName(data.spec.bonuses[i].patch, PU_PATCH); + + data.spec.pscore = W_CachePatchName("YB_SCORE", PU_PATCH); + data.spec.pcontinues = W_CachePatchName("YB_CONTI", PU_PATCH); + + // get background tile + bgtile = W_CachePatchName("SPECTILE", PU_PATCH); + + // grab an interscreen if appropriate + if (mapheaderinfo[gamemap-1]->interscreen[0] != '#') + interpic = W_CachePatchName(mapheaderinfo[gamemap-1]->interscreen, PU_PATCH); + break; + } + case int_match: + case int_race: + case int_teammatch: + case int_ctf: + { + if (intertype == int_match || intertype == int_race) + { + // get RESULT header + data.match.result = W_CachePatchName("RESULT", PU_PATCH); + } + + if (intertype == int_ctf) + { + data.match.redflag = rflagico; + data.match.blueflag = bflagico; + } + else // team match + { + data.match.redflag = rmatcico; + data.match.blueflag = bmatcico; + } + + // get background tile + bgtile = W_CachePatchName("SRB2BACK", PU_PATCH); + break; + } + case int_none: + default: + break; + } +} + // // Y_ConsiderScreenBuffer // @@ -1176,6 +1256,11 @@ void Y_DetermineIntermissionType(void) intertype = int_ctf; } +// +// Y_StartIntermission +// +// Called by G_DoCompleted. Sets up data for intermission drawer/ticker. +// // // Y_StartIntermission // @@ -1183,8 +1268,6 @@ void Y_DetermineIntermissionType(void) // void Y_StartIntermission(void) { - INT32 i; - intertic = -1; #ifdef PARANOIA @@ -1228,23 +1311,12 @@ void Y_StartIntermission(void) // setup time data data.coop.tics = players[consoleplayer].realtime; - for (i = 0; i < 4; ++i) - { - if (strlen(data.coop.bonuses[i].patch)) - data.coop.bonuspatches[i] = W_CachePatchName(data.coop.bonuses[i].patch, PU_PATCH); - } - data.coop.ptotal = W_CachePatchName("YB_TOTAL", PU_PATCH); - // get act number data.coop.actnum = mapheaderinfo[gamemap-1]->actnum; - // get background patches - bgpatch = W_CachePatchName("INTERSCR", PU_PATCH); - // grab an interscreen if appropriate if (mapheaderinfo[gamemap-1]->interscreen[0] != '#') { - interpic = W_CachePatchName(mapheaderinfo[gamemap-1]->interscreen, PU_PATCH); useinterpic = true; usebuffer = false; } @@ -1301,21 +1373,9 @@ void Y_StartIntermission(void) // give out ring bonuses Y_AwardSpecialStageBonus(); - for (i = 0; i < 2; ++i) - data.spec.bonuspatches[i] = W_CachePatchName(data.spec.bonuses[i].patch, PU_PATCH); - - data.spec.pscore = W_CachePatchName("YB_SCORE", PU_PATCH); - data.spec.pcontinues = W_CachePatchName("YB_CONTI", PU_PATCH); - - // get background tile - bgtile = W_CachePatchName("SPECTILE", PU_PATCH); - // grab an interscreen if appropriate if (mapheaderinfo[gamemap-1]->interscreen[0] != '#') - { - interpic = W_CachePatchName(mapheaderinfo[gamemap-1]->interscreen, PU_PATCH); useinterpic = true; - } else useinterpic = false; @@ -1408,11 +1468,6 @@ void Y_StartIntermission(void) data.match.levelstring[sizeof data.match.levelstring - 1] = '\0'; - // get RESULT header - data.match.result = - W_CachePatchName("RESULT", PU_PATCH); - - bgtile = W_CachePatchName("SRB2BACK", PU_PATCH); usetile = true; useinterpic = false; break; @@ -1437,10 +1492,6 @@ void Y_StartIntermission(void) data.match.levelstring[sizeof data.match.levelstring - 1] = '\0'; - // get RESULT header - data.match.result = W_CachePatchName("RESULT", PU_PATCH); - - bgtile = W_CachePatchName("SRB2BACK", PU_PATCH); usetile = true; useinterpic = false; break; @@ -1466,18 +1517,6 @@ void Y_StartIntermission(void) data.match.levelstring[sizeof data.match.levelstring - 1] = '\0'; - if (intertype == int_ctf) - { - data.match.redflag = rflagico; - data.match.blueflag = bflagico; - } - else // team match - { - data.match.redflag = rmatcico; - data.match.blueflag = bmatcico; - } - - bgtile = W_CachePatchName("SRB2BACK", PU_PATCH); usetile = true; useinterpic = false; break; @@ -1502,8 +1541,6 @@ void Y_StartIntermission(void) data.competition.levelstring[sizeof data.competition.levelstring - 1] = '\0'; - // get background tile - bgtile = W_CachePatchName("SRB2BACK", PU_PATCH); usetile = true; useinterpic = false; break; diff --git a/src/y_inter.h b/src/y_inter.h index 859144b1d..08f7cf9bd 100644 --- a/src/y_inter.h +++ b/src/y_inter.h @@ -14,6 +14,7 @@ extern boolean usebuffer; void Y_IntermissionDrawer(void); void Y_Ticker(void); +void Y_LoadIntermisionData(void); void Y_StartIntermission(void); void Y_EndIntermission(void);