From 87c10047a57a762d6bd18d299521280788312b5b Mon Sep 17 00:00:00 2001 From: toaster Date: Tue, 22 Sep 2020 18:27:47 +0100 Subject: [PATCH] A bunch of serious heavy lifting to fix title cards and closely related. * Fix the title card fade's one-frame invalid memory read. * Disable a redundant gamestate-activated wipe, which A) horribly broke Encore wipes, B) made normal map transitions take longer than they should, and C) held on the one glitchy title card wipe frame to make the game look more broken than it was. * Fix Encore wipes being broken by the merge. * Disable (not remove; may want to use later) the :nick: patch draw attempts from the title card drawer. * Re-add zonettl support to the title card drawer. * Move the title card drawer in front of the fade (Looks better for if we showcase 2.2 merge footage before creating a better title card). --- src/f_wipe.c | 2 ++ src/g_game.c | 2 +- src/p_setup.c | 3 +++ src/st_stuff.c | 60 ++++++++++++++++++++++++++++++-------------------- 4 files changed, 42 insertions(+), 25 deletions(-) diff --git a/src/f_wipe.c b/src/f_wipe.c index 6d8da96e0..9399598f5 100644 --- a/src/f_wipe.c +++ b/src/f_wipe.c @@ -62,6 +62,7 @@ UINT8 wipedefs[NUMWIPEDEFS] = { 0, // wipe_evaluation_toblack 0, // wipe_gameend_toblack UINT8_MAX, // wipe_intro_toblack (hardcoded) + 99, // wipe_ending_toblack (hardcoded) 99, // wipe_cutscene_toblack (hardcoded) 72, // wipe_encore_toinvert @@ -77,6 +78,7 @@ UINT8 wipedefs[NUMWIPEDEFS] = { 0, // wipe_evaluation_final 0, // wipe_gameend_final 99, // wipe_intro_final (hardcoded) + 99, // wipe_ending_final (hardcoded) 99 // wipe_cutscene_final (hardcoded) }; diff --git a/src/g_game.c b/src/g_game.c index ac65aae81..a9af2358b 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1268,7 +1268,7 @@ void G_StartTitleCard(void) ST_startTitleCard(); // start the title card - WipeStageTitle = (!titlemapinaction); + WipeStageTitle = false; //(!titlemapinaction); -- temporary until titlecards are reworked } // diff --git a/src/p_setup.c b/src/p_setup.c index 352bc39c3..b1e53c361 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -3821,6 +3821,7 @@ boolean P_LoadLevel(boolean fromnetsave) V_EncoreInvertScreen(); F_WipeEndScreen(); + S_StartSound(NULL, sfx_ruby1); F_RunWipe(wipedefs[wipe_encore_toinvert], false, NULL, false, false); // Hold on invert for extra effect. @@ -3917,6 +3918,8 @@ boolean P_LoadLevel(boolean fromnetsave) F_RunWipe(wipedefs[wipe_level_toblack], false, ((levelfadecol == 0) ? "FADEMAP1" : "FADEMAP0"), false, false); } + if (!titlemapinaction) + wipegamestate = GS_LEVEL; // Close text prompt before freeing the old level F_EndTextPrompt(false, true); diff --git a/src/st_stuff.c b/src/st_stuff.c index 71bfc8a25..2bd86181d 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -705,14 +705,17 @@ void ST_runTitleCard(void) // // Draw the title card itself. // + void ST_drawTitleCard(void) { char *lvlttl = mapheaderinfo[gamemap-1]->lvlttl; char *subttl = mapheaderinfo[gamemap-1]->subttl; + char *zonttl = mapheaderinfo[gamemap-1]->zonttl; // SRB2kart UINT8 actnum = mapheaderinfo[gamemap-1]->actnum; INT32 lvlttlxpos, ttlnumxpos, zonexpos; INT32 subttlxpos = BASEVIDWIDTH/2; INT32 ttlscroll = FixedInt(lt_scroll); +#ifdef TITLEPATCHES INT32 zzticker; patch_t *actpat, *zigzag, *zztext; UINT8 colornum; @@ -724,6 +727,7 @@ void ST_drawTitleCard(void) colornum = cv_playercolor[0].value; colormap = R_GetTranslationColormap(TC_DEFAULT, colornum, GTC_CACHE); +#endif if (!G_IsTitleCardAvailable()) return; @@ -738,22 +742,30 @@ void ST_drawTitleCard(void) lt_ticker = lt_lasttic+1; ST_cacheLevelTitle(); + +#ifdef TITLEPATCHES actpat = lt_patches[0]; zigzag = lt_patches[1]; zztext = lt_patches[2]; +#endif lvlttlxpos = ((BASEVIDWIDTH/2) - (V_LevelNameWidth(lvlttl)/2)); if (actnum > 0) lvlttlxpos -= V_LevelNameWidth(va("%d", actnum)); - ttlnumxpos = lvlttlxpos + V_LevelNameWidth(lvlttl); - zonexpos = ttlnumxpos - V_LevelNameWidth(M_GetText("Zone")); + zonexpos = ttlnumxpos = lvlttlxpos + V_LevelNameWidth(lvlttl); + if (zonttl[0]) + zonexpos -= V_LevelNameWidth(zonttl); // SRB2kart + else + zonexpos -= V_LevelNameWidth(M_GetText("Zone")); + ttlnumxpos++; if (lvlttlxpos < 0) lvlttlxpos = 0; +#ifdef TITLEPATCHES if (!splitscreen || (splitscreen && stplyr == &players[displayplayers[0]])) { zzticker = lt_ticker; @@ -762,9 +774,11 @@ void ST_drawTitleCard(void) V_DrawMappedPatch(FixedInt(lt_zigzag), (-zigzag->height+zzticker) % zztext->height, V_SNAPTOTOP|V_SNAPTOLEFT, zztext, colormap); V_DrawMappedPatch(FixedInt(lt_zigzag), (zzticker) % zztext->height, V_SNAPTOTOP|V_SNAPTOLEFT, zztext, colormap); } +#endif if (actnum) { +#ifdef TITLEPATCHES if (!splitscreen) { if (actnum > 9) // slightly offset the act diamond for two-digit act numbers @@ -772,13 +786,16 @@ void ST_drawTitleCard(void) else V_DrawMappedPatch(ttlnumxpos + ttlscroll, 104 - ttlscroll, 0, actpat, colormap); } - V_DrawLevelTitle(ttlnumxpos + ttlscroll, 104, V_SPLITSCREEN, va("%d", actnum)); +#endif + V_DrawLevelTitle(ttlnumxpos + ttlscroll, 104, 0, va("%d", actnum)); } - V_DrawLevelTitle(lvlttlxpos - ttlscroll, 80, V_SPLITSCREEN, lvlttl); - if (!(mapheaderinfo[gamemap-1]->levelflags & LF_NOZONE)) - V_DrawLevelTitle(zonexpos + ttlscroll, 104, V_SPLITSCREEN, M_GetText("Zone")); - V_DrawCenteredString(subttlxpos - ttlscroll, 135, V_SPLITSCREEN|V_ALLOWLOWERCASE, subttl); + V_DrawLevelTitle(lvlttlxpos - ttlscroll, 80, 0, lvlttl); + if (zonttl[0]) + V_DrawLevelTitle(zonexpos + ttlscroll, 104, 0, zonttl); + else if (!(mapheaderinfo[gamemap-1]->levelflags & LF_NOZONE)) + V_DrawLevelTitle(zonexpos + ttlscroll, 104, 0, M_GetText("Zone")); + V_DrawCenteredString(subttlxpos - ttlscroll, 135, 0|V_ALLOWLOWERCASE, subttl); lt_lasttic = lt_ticker; @@ -819,18 +836,6 @@ void ST_drawWipeTitleCard(void) // static void ST_overlayDrawer(void) { - // Decide whether to draw the stage title or not - boolean stagetitle = false; - - // Check for a valid level title - // If the HUD is enabled - // And, if Lua is running, if the HUD library has the stage title enabled - if (G_IsTitleCardAvailable() && *mapheaderinfo[gamemap-1]->lvlttl != '\0' && !(hu_showscores && (netgame || multiplayer))) - { - stagetitle = true; - ST_preDrawTitleCard(); - } - // hu_showscores = auto hide score/time/rings when tab rankings are shown if (!(hu_showscores && (netgame || multiplayer))) K_drawKartHUD(); @@ -878,10 +883,6 @@ static void ST_overlayDrawer(void) if (!(netgame || multiplayer) || !hu_showscores) LUAh_GameHUD(stplyr); - // draw level title Tails - if (stagetitle && (!WipeInAction) && (!WipeStageTitle)) - ST_drawTitleCard(); - if (!hu_showscores && netgame && !mapreset) { if (stplyr->spectator && LUA_HudEnabled(hud_textspectator)) @@ -993,6 +994,8 @@ static void ST_MayonakaStatic(void) void ST_Drawer(void) { + boolean stagetitle = false; // Decide whether to draw the stage title or not + if (needpatchrecache) R_ReloadHUDGraphics(); @@ -1041,6 +1044,12 @@ void ST_Drawer(void) st_translucency = cv_translucenthud.value; + // Check for a valid level title + // If the HUD is enabled + // And, if Lua is running, if the HUD library has the stage title enabled + if ((stagetitle = (G_IsTitleCardAvailable() && *mapheaderinfo[gamemap-1]->lvlttl != '\0' && !(hu_showscores && (netgame || multiplayer))))) + ST_preDrawTitleCard(); + if (st_overlay) { UINT8 i; @@ -1058,7 +1067,10 @@ void ST_Drawer(void) // Draw a fade on level opening if (timeinmap < 16) - V_DrawCustomFadeScreen(((levelfadecol == 0) ? "FADEMAP1" : "FADEMAP0"), 32-(timeinmap*2)); // Then gradually fade out from there + V_DrawCustomFadeScreen(((levelfadecol == 0) ? "FADEMAP1" : "FADEMAP0"), 31-(timeinmap*2)); // Then gradually fade out from there + + if (stagetitle) + ST_drawTitleCard(); ST_drawDebugInfo(); }