Merge branch 'dedicated-scoretally-crash-fix' into 'next'

Fix dedicated server crashing when exiting special stage (Fixes #453)

Closes #453

See merge request STJr/SRB2!1451
This commit is contained in:
sphere 2021-04-10 11:34:00 -04:00
commit 1d863408c7
3 changed files with 78 additions and 48 deletions

View file

@ -3973,6 +3973,7 @@ static void G_DoCompleted(void)
{ {
G_SetGamestate(GS_INTERMISSION); G_SetGamestate(GS_INTERMISSION);
Y_StartIntermission(); Y_StartIntermission();
Y_LoadIntermissionData();
G_UpdateVisited(); G_UpdateVisited();
G_HandleSaveLevel(); G_HandleSaveLevel();
} }

View file

@ -215,6 +215,81 @@ static void Y_IntermissionTokenDrawer(void)
V_DrawCroppedPatch(32<<FRACBITS, y<<FRACBITS, FRACUNIT/2, 0, tokenicon, 0, 0, tokenicon->width, calc); V_DrawCroppedPatch(32<<FRACBITS, y<<FRACBITS, FRACUNIT/2, 0, tokenicon, 0, 0, tokenicon->width, calc);
} }
//
// Y_LoadIntermissionData
//
// Load patches for drawing the intermission, if acceptable
//
void Y_LoadIntermissionData(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_ctf:
case int_teammatch:
{
data.match.redflag = (intertype == int_ctf) ? rflagico : rmatcico;
data.match.blueflag = (intertype == int_ctf) ? bflagico : bmatcico;
}
/* FALLTHRU */
case int_match:
case int_race:
case int_comp:
{
if (intertype == int_match || intertype == int_race)
{
// get RESULT header
data.match.result = W_CachePatchName("RESULT", PU_PATCH);
}
// get background tile
bgtile = W_CachePatchName("SRB2BACK", PU_PATCH);
break;
}
case int_none:
default:
break;
}
}
// //
// Y_ConsiderScreenBuffer // Y_ConsiderScreenBuffer
// //
@ -1181,10 +1256,9 @@ void Y_DetermineIntermissionType(void)
// //
// Called by G_DoCompleted. Sets up data for intermission drawer/ticker. // Called by G_DoCompleted. Sets up data for intermission drawer/ticker.
// //
//
void Y_StartIntermission(void) void Y_StartIntermission(void)
{ {
INT32 i;
intertic = -1; intertic = -1;
#ifdef PARANOIA #ifdef PARANOIA
@ -1228,23 +1302,12 @@ void Y_StartIntermission(void)
// setup time data // setup time data
data.coop.tics = players[consoleplayer].realtime; 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 // get act number
data.coop.actnum = mapheaderinfo[gamemap-1]->actnum; data.coop.actnum = mapheaderinfo[gamemap-1]->actnum;
// get background patches
bgpatch = W_CachePatchName("INTERSCR", PU_PATCH);
// grab an interscreen if appropriate // grab an interscreen if appropriate
if (mapheaderinfo[gamemap-1]->interscreen[0] != '#') if (mapheaderinfo[gamemap-1]->interscreen[0] != '#')
{ {
interpic = W_CachePatchName(mapheaderinfo[gamemap-1]->interscreen, PU_PATCH);
useinterpic = true; useinterpic = true;
usebuffer = false; usebuffer = false;
} }
@ -1301,21 +1364,9 @@ void Y_StartIntermission(void)
// give out ring bonuses // give out ring bonuses
Y_AwardSpecialStageBonus(); 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 // grab an interscreen if appropriate
if (mapheaderinfo[gamemap-1]->interscreen[0] != '#') if (mapheaderinfo[gamemap-1]->interscreen[0] != '#')
{
interpic = W_CachePatchName(mapheaderinfo[gamemap-1]->interscreen, PU_PATCH);
useinterpic = true; useinterpic = true;
}
else else
useinterpic = false; useinterpic = false;
@ -1408,11 +1459,6 @@ void Y_StartIntermission(void)
data.match.levelstring[sizeof data.match.levelstring - 1] = '\0'; 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; usetile = true;
useinterpic = false; useinterpic = false;
break; break;
@ -1437,10 +1483,6 @@ void Y_StartIntermission(void)
data.match.levelstring[sizeof data.match.levelstring - 1] = '\0'; 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; usetile = true;
useinterpic = false; useinterpic = false;
break; break;
@ -1466,18 +1508,6 @@ void Y_StartIntermission(void)
data.match.levelstring[sizeof data.match.levelstring - 1] = '\0'; 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; usetile = true;
useinterpic = false; useinterpic = false;
break; break;
@ -1502,8 +1532,6 @@ void Y_StartIntermission(void)
data.competition.levelstring[sizeof data.competition.levelstring - 1] = '\0'; data.competition.levelstring[sizeof data.competition.levelstring - 1] = '\0';
// get background tile
bgtile = W_CachePatchName("SRB2BACK", PU_PATCH);
usetile = true; usetile = true;
useinterpic = false; useinterpic = false;
break; break;

View file

@ -14,6 +14,7 @@ extern boolean usebuffer;
void Y_IntermissionDrawer(void); void Y_IntermissionDrawer(void);
void Y_Ticker(void); void Y_Ticker(void);
void Y_LoadIntermissionData(void);
void Y_StartIntermission(void); void Y_StartIntermission(void);
void Y_EndIntermission(void); void Y_EndIntermission(void);