From 7e4327293236eb3d38cefe692ef1bddb1f1d345b Mon Sep 17 00:00:00 2001 From: yellowtd Date: Tue, 18 Apr 2017 17:23:23 -0400 Subject: [PATCH 01/19] begin titlemap idk my bff jill --- src/d_main.c | 18 ++++++++++++------ src/f_finale.c | 21 +++++++++++++++++---- src/g_game.c | 1 + src/p_user.c | 2 +- 4 files changed, 31 insertions(+), 11 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index b23ffebb4..78a2b2d96 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -318,6 +318,12 @@ static void D_Display(void) // do buffered drawing switch (gamestate) { + case GS_TITLESCREEN: + if (!gamemap) { + F_TitleScreenDrawer(); + break; + } + // Intentional fall-through case GS_LEVEL: if (!gametic) break; @@ -366,10 +372,6 @@ static void D_Display(void) HU_Drawer(); break; - case GS_TITLESCREEN: - F_TitleScreenDrawer(); - break; - case GS_WAITINGPLAYERS: // The clientconnect drawer is independent... case GS_DEDICATEDSERVER: @@ -379,9 +381,10 @@ static void D_Display(void) // clean up border stuff // see if the border needs to be initially drawn - if (gamestate == GS_LEVEL) + if (gamestate == GS_LEVEL || (gamestate == GS_TITLESCREEN && gamemap)) { // draw the view directly + if (!automapactive && !dedicated && cv_renderview.value) { if (players[displayplayer].mo || players[displayplayer].playerstate == PST_DEAD) @@ -436,7 +439,10 @@ static void D_Display(void) lastdraw = false; } - ST_Drawer(); + if (gamestate == GS_LEVEL) + ST_Drawer(); + else + F_TitleScreenDrawer(); HU_Drawer(); } diff --git a/src/f_finale.c b/src/f_finale.c index 167fdd880..2eba96bb7 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -31,6 +31,7 @@ #include "m_random.h" #include "y_inter.h" #include "m_cond.h" +#include "p_local.h" // Stage of animation: // 0 = text, 1 = art screen @@ -999,7 +1000,7 @@ static const char *credits[] = { "", "\1Sprite Artists", "Odi \"Iceman404\" Atunzu", - "Victor \"VAdaPEGA\" Ara\x1Fjo", // Araújo -- sorry for our limited font! D: + "Victor \"VAdaPEGA\" Ara\x1Fjo", // Ara�jo -- sorry for our limited font! D: "Jim \"MotorRoach\" DeMello", "Desmond \"Blade\" DesJardins", "Sherman \"CoatRack\" DesJardins", @@ -1423,13 +1424,16 @@ void F_StartTitleScreen(void) finalecount = 0; else wipegamestate = GS_TITLESCREEN; + + gamemap = 533; titlescrollspeed = (int32_t)ANG1; //@TODO don't hardcode bich + G_DoLoadLevel(true); G_SetGamestate(GS_TITLESCREEN); - CON_ClearHUD(); + players[displayplayer].playerstate = PST_DEAD; // Don't spawn the player in dummy (I'm still a filthy cheater) + //CON_ClearHUD(); // IWAD dependent stuff. S_ChangeMusicInternal("_title", looptitle); - animtimer = 0; demoDelayLeft = demoDelayTime; @@ -1459,7 +1463,9 @@ void F_TitleScreenDrawer(void) return; // We likely came here from retrying. Don't do a damn thing. // Draw that sky! - F_SkyScroll(titlescrollspeed); + if (!gamemap) { + F_SkyScroll(titlescrollspeed); + } // Don't draw outside of the title screewn, or if the patch isn't there. if (!ttwing || (gamestate != GS_TITLESCREEN && gamestate != GS_WAITINGPLAYERS)) @@ -1513,6 +1519,13 @@ void F_TitleScreenTicker(boolean run) if (gameaction != ga_nothing || gamestate != GS_TITLESCREEN) return; + // Do a lil' camera spin if a title map is loaded. + if (gamemap) { + camera.x = camera.y = camera.height = camera.aiming = 0; + camera.z = 128*FRACUNIT; + camera.angle += titlescrollspeed; + } + // no demos to play? or, are they disabled? if (!cv_rollingdemos.value || !numDemos) return; diff --git a/src/g_game.c b/src/g_game.c index 1eef85ada..39fdd8ae0 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1985,6 +1985,7 @@ void G_Ticker(boolean run) break; case GS_TITLESCREEN: + if (gamemap) P_Ticker(run); // then intentionally fall through case GS_WAITINGPLAYERS: F_TitleScreenTicker(run); break; diff --git a/src/p_user.c b/src/p_user.c index 905c3be62..5d55e9d21 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -165,7 +165,7 @@ fixed_t P_ReturnThrustY(mobj_t *mo, angle_t angle, fixed_t move) boolean P_AutoPause(void) { // Don't pause even on menu-up or focus-lost in netgames or record attack - if (netgame || modeattacking) + if (netgame || modeattacking || gamestate == GS_TITLESCREEN) return false; return (menuactive || window_notinfocus); From 1c93b07c863612dbcae8977b69c78910e72eef97 Mon Sep 17 00:00:00 2001 From: yellowtd Date: Tue, 18 Apr 2017 17:36:54 -0400 Subject: [PATCH 02/19] Titlemap - Maincfg variables, unplayability crash fixes --- src/dehacked.c | 19 ++++++++++ src/doomstat.h | 3 ++ src/f_finale.c | 98 +++++++++++++++++++++++++++++++------------------- src/f_finale.h | 2 ++ src/g_game.c | 3 ++ 5 files changed, 89 insertions(+), 36 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 5ba5d75d4..6734f1427 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -3120,6 +3120,25 @@ static void readmaincfg(MYFILE *f) DEH_WriteUndoline(word, va("%d", looptitle), UNDO_NONE); looptitle = (boolean)(value || word2[0] == 'T' || word2[0] == 'Y'); } + else if (fastcmp(word, "TITLEMAP")) + { + // Support using the actual map name, + // i.e., Level AB, Level FZ, etc. + + // Convert to map number + if (word2[0] >= 'A' && word2[0] <= 'Z') + value = M_MapNumber(word2[0], word2[1]); + else + value = get_number(word2); + + DEH_WriteUndoline(word, va("%d", titlemap), UNDO_NONE); + titlemap = (INT16)value; + } + else if (fastcmp(word, "HIDETITLEPICS")) + { + DEH_WriteUndoline(word, va("%d", hidetitlepics), UNDO_NONE); + hidetitlepics = (boolean)(value || word2[0] == 'T' || word2[0] == 'Y'); + } else if (fastcmp(word, "TITLESCROLLSPEED")) { DEH_WriteUndoline(word, va("%d", titlescrollspeed), UNDO_NONE); diff --git a/src/doomstat.h b/src/doomstat.h index f1b7d2169..013ee0835 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -124,6 +124,9 @@ extern INT16 spstage_start; extern INT16 sstage_start; extern INT16 sstage_end; +extern INT16 titlemap; +extern boolean hidetitlepics; + extern boolean looptitle; extern boolean useNightsSS; diff --git a/src/f_finale.c b/src/f_finale.c index 2eba96bb7..beeb0a2ea 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -1425,11 +1425,28 @@ void F_StartTitleScreen(void) else wipegamestate = GS_TITLESCREEN; - gamemap = 533; titlescrollspeed = (int32_t)ANG1; //@TODO don't hardcode bich - G_DoLoadLevel(true); - G_SetGamestate(GS_TITLESCREEN); - players[displayplayer].playerstate = PST_DEAD; // Don't spawn the player in dummy (I'm still a filthy cheater) - //CON_ClearHUD(); + if (titlemap) + { + gamemap = titlemap; + + if (!mapheaderinfo[gamemap-1]) + P_AllocMapHeader(gamemap-1); + + G_DoLoadLevel(true); + G_SetGamestate(GS_TITLESCREEN); + players[displayplayer].playerstate = PST_DEAD; // Don't spawn the player in dummy (I'm still a filthy cheater) + //CON_ClearHUD(); + } + else + { + gamemap = 0; + + if (!mapheaderinfo[gamemap-1]) + P_AllocMapHeader(gamemap-1); + + G_SetGamestate(GS_TITLESCREEN); + CON_ClearHUD(); + } // IWAD dependent stuff. @@ -1471,42 +1488,51 @@ void F_TitleScreenDrawer(void) if (!ttwing || (gamestate != GS_TITLESCREEN && gamestate != GS_WAITINGPLAYERS)) return; - V_DrawScaledPatch(30, 14, 0, ttwing); - - if (finalecount < 57) + // rei|miru: use title pics? + if (hidetitlepics) { - if (finalecount == 35) - V_DrawScaledPatch(115, 15, 0, ttspop1); - else if (finalecount == 36) - V_DrawScaledPatch(114, 15, 0,ttspop2); - else if (finalecount == 37) - V_DrawScaledPatch(113, 15, 0,ttspop3); - else if (finalecount == 38) - V_DrawScaledPatch(112, 15, 0,ttspop4); - else if (finalecount == 39) - V_DrawScaledPatch(111, 15, 0,ttspop5); - else if (finalecount == 40) - V_DrawScaledPatch(110, 15, 0, ttspop6); - else if (finalecount >= 41 && finalecount <= 44) - V_DrawScaledPatch(109, 15, 0, ttspop7); - else if (finalecount >= 45 && finalecount <= 48) - V_DrawScaledPatch(108, 12, 0, ttsprep1); - else if (finalecount >= 49 && finalecount <= 52) - V_DrawScaledPatch(107, 9, 0, ttsprep2); - else if (finalecount >= 53 && finalecount <= 56) - V_DrawScaledPatch(106, 6, 0, ttswip1); - V_DrawScaledPatch(93, 106, 0, ttsonic); + return; } else { - V_DrawScaledPatch(93, 106, 0,ttsonic); - if (finalecount/5 & 1) - V_DrawScaledPatch(100, 3, 0,ttswave1); - else - V_DrawScaledPatch(100,3, 0,ttswave2); - } + V_DrawScaledPatch(30, 14, 0, ttwing); - V_DrawScaledPatch(48, 142, 0,ttbanner); + if (finalecount < 57) + { + if (finalecount == 35) + V_DrawScaledPatch(115, 15, 0, ttspop1); + else if (finalecount == 36) + V_DrawScaledPatch(114, 15, 0,ttspop2); + else if (finalecount == 37) + V_DrawScaledPatch(113, 15, 0,ttspop3); + else if (finalecount == 38) + V_DrawScaledPatch(112, 15, 0,ttspop4); + else if (finalecount == 39) + V_DrawScaledPatch(111, 15, 0,ttspop5); + else if (finalecount == 40) + V_DrawScaledPatch(110, 15, 0, ttspop6); + else if (finalecount >= 41 && finalecount <= 44) + V_DrawScaledPatch(109, 15, 0, ttspop7); + else if (finalecount >= 45 && finalecount <= 48) + V_DrawScaledPatch(108, 12, 0, ttsprep1); + else if (finalecount >= 49 && finalecount <= 52) + V_DrawScaledPatch(107, 9, 0, ttsprep2); + else if (finalecount >= 53 && finalecount <= 56) + V_DrawScaledPatch(106, 6, 0, ttswip1); + V_DrawScaledPatch(93, 106, 0, ttsonic); + } + else + { + V_DrawScaledPatch(93, 106, 0,ttsonic); + if (finalecount/5 & 1) + V_DrawScaledPatch(100, 3, 0,ttswave1); + else + V_DrawScaledPatch(100,3, 0,ttswave2); + } + + V_DrawScaledPatch(48, 142, 0,ttbanner); + + } } // (no longer) De-Demo'd Title Screen diff --git a/src/f_finale.h b/src/f_finale.h index 1f23643be..1e4d3a1e3 100644 --- a/src/f_finale.h +++ b/src/f_finale.h @@ -60,6 +60,8 @@ void F_StartContinue(void); void F_ContinueTicker(void); void F_ContinueDrawer(void); +extern INT16 titlemap; +extern boolean hidetitlepics; extern INT32 titlescrollspeed; // diff --git a/src/g_game.c b/src/g_game.c index 39fdd8ae0..3d89fd6db 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -120,6 +120,9 @@ INT16 spstage_start; INT16 sstage_start; INT16 sstage_end; +INT16 titlemap; +boolean hidetitlepics = false; + boolean looptitle = false; boolean useNightsSS = false; From 217f7ebd386f309d82ff15b68652fb32c7d0ab8e Mon Sep 17 00:00:00 2001 From: yellowtd Date: Tue, 18 Apr 2017 17:45:43 -0400 Subject: [PATCH 03/19] miru asked me for help and im a smelly toast * Fix Crashes With Respect To Switching Between The Normal Title And Her Magic One * Clean Up A Bit Of Code --- src/d_main.c | 9 ++--- src/f_finale.c | 89 ++++++++++++++++++++++++-------------------------- src/f_finale.h | 3 +- src/g_game.c | 4 +-- 4 files changed, 50 insertions(+), 55 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index 78a2b2d96..4fb55d728 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -319,7 +319,7 @@ static void D_Display(void) switch (gamestate) { case GS_TITLESCREEN: - if (!gamemap) { + if (!titlemapinaction) { F_TitleScreenDrawer(); break; } @@ -381,7 +381,7 @@ static void D_Display(void) // clean up border stuff // see if the border needs to be initially drawn - if (gamestate == GS_LEVEL || (gamestate == GS_TITLESCREEN && gamemap)) + if (gamestate == GS_LEVEL || (gamestate == GS_TITLESCREEN && titlemapinaction)) { // draw the view directly @@ -440,11 +440,12 @@ static void D_Display(void) } if (gamestate == GS_LEVEL) + { ST_Drawer(); + HU_Drawer(); + } else F_TitleScreenDrawer(); - - HU_Drawer(); } // change gamma if needed diff --git a/src/f_finale.c b/src/f_finale.c index beeb0a2ea..9959ce0fc 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -32,11 +32,13 @@ #include "y_inter.h" #include "m_cond.h" #include "p_local.h" +#include "p_setup.h" // Stage of animation: // 0 = text, 1 = art screen static INT32 finalecount; INT32 titlescrollspeed = 80; +boolean titlemapinaction = false; static INT32 timetonext; // Delay between screen changes static INT32 continuetime; // Short delay when continuing @@ -1427,27 +1429,26 @@ void F_StartTitleScreen(void) if (titlemap) { + titlemapinaction = true; gamemap = titlemap; if (!mapheaderinfo[gamemap-1]) P_AllocMapHeader(gamemap-1); G_DoLoadLevel(true); - G_SetGamestate(GS_TITLESCREEN); players[displayplayer].playerstate = PST_DEAD; // Don't spawn the player in dummy (I'm still a filthy cheater) + camera.subsector = NULL; // toast is filthy too //CON_ClearHUD(); } else { - gamemap = 0; - - if (!mapheaderinfo[gamemap-1]) - P_AllocMapHeader(gamemap-1); - - G_SetGamestate(GS_TITLESCREEN); + titlemapinaction = false; + gamemap = 1; // g_game.c CON_ClearHUD(); } + G_SetGamestate(GS_TITLESCREEN); + // IWAD dependent stuff. S_ChangeMusicInternal("_title", looptitle); @@ -1480,9 +1481,8 @@ void F_TitleScreenDrawer(void) return; // We likely came here from retrying. Don't do a damn thing. // Draw that sky! - if (!gamemap) { + if (!titlemapinaction) F_SkyScroll(titlescrollspeed); - } // Don't draw outside of the title screewn, or if the patch isn't there. if (!ttwing || (gamestate != GS_TITLESCREEN && gamestate != GS_WAITINGPLAYERS)) @@ -1490,49 +1490,44 @@ void F_TitleScreenDrawer(void) // rei|miru: use title pics? if (hidetitlepics) - { return; + + V_DrawScaledPatch(30, 14, 0, ttwing); + + if (finalecount < 57) + { + if (finalecount == 35) + V_DrawScaledPatch(115, 15, 0, ttspop1); + else if (finalecount == 36) + V_DrawScaledPatch(114, 15, 0,ttspop2); + else if (finalecount == 37) + V_DrawScaledPatch(113, 15, 0,ttspop3); + else if (finalecount == 38) + V_DrawScaledPatch(112, 15, 0,ttspop4); + else if (finalecount == 39) + V_DrawScaledPatch(111, 15, 0,ttspop5); + else if (finalecount == 40) + V_DrawScaledPatch(110, 15, 0, ttspop6); + else if (finalecount >= 41 && finalecount <= 44) + V_DrawScaledPatch(109, 15, 0, ttspop7); + else if (finalecount >= 45 && finalecount <= 48) + V_DrawScaledPatch(108, 12, 0, ttsprep1); + else if (finalecount >= 49 && finalecount <= 52) + V_DrawScaledPatch(107, 9, 0, ttsprep2); + else if (finalecount >= 53 && finalecount <= 56) + V_DrawScaledPatch(106, 6, 0, ttswip1); + V_DrawScaledPatch(93, 106, 0, ttsonic); } else { - V_DrawScaledPatch(30, 14, 0, ttwing); - - if (finalecount < 57) - { - if (finalecount == 35) - V_DrawScaledPatch(115, 15, 0, ttspop1); - else if (finalecount == 36) - V_DrawScaledPatch(114, 15, 0,ttspop2); - else if (finalecount == 37) - V_DrawScaledPatch(113, 15, 0,ttspop3); - else if (finalecount == 38) - V_DrawScaledPatch(112, 15, 0,ttspop4); - else if (finalecount == 39) - V_DrawScaledPatch(111, 15, 0,ttspop5); - else if (finalecount == 40) - V_DrawScaledPatch(110, 15, 0, ttspop6); - else if (finalecount >= 41 && finalecount <= 44) - V_DrawScaledPatch(109, 15, 0, ttspop7); - else if (finalecount >= 45 && finalecount <= 48) - V_DrawScaledPatch(108, 12, 0, ttsprep1); - else if (finalecount >= 49 && finalecount <= 52) - V_DrawScaledPatch(107, 9, 0, ttsprep2); - else if (finalecount >= 53 && finalecount <= 56) - V_DrawScaledPatch(106, 6, 0, ttswip1); - V_DrawScaledPatch(93, 106, 0, ttsonic); - } + V_DrawScaledPatch(93, 106, 0,ttsonic); + if (finalecount/5 & 1) + V_DrawScaledPatch(100, 3, 0,ttswave1); else - { - V_DrawScaledPatch(93, 106, 0,ttsonic); - if (finalecount/5 & 1) - V_DrawScaledPatch(100, 3, 0,ttswave1); - else - V_DrawScaledPatch(100,3, 0,ttswave2); - } - - V_DrawScaledPatch(48, 142, 0,ttbanner); - + V_DrawScaledPatch(100,3, 0,ttswave2); } + + V_DrawScaledPatch(48, 142, 0,ttbanner); } // (no longer) De-Demo'd Title Screen @@ -1546,7 +1541,7 @@ void F_TitleScreenTicker(boolean run) return; // Do a lil' camera spin if a title map is loaded. - if (gamemap) { + if (titlemapinaction) { camera.x = camera.y = camera.height = camera.aiming = 0; camera.z = 128*FRACUNIT; camera.angle += titlescrollspeed; diff --git a/src/f_finale.h b/src/f_finale.h index 1e4d3a1e3..f710a74fb 100644 --- a/src/f_finale.h +++ b/src/f_finale.h @@ -60,9 +60,8 @@ void F_StartContinue(void); void F_ContinueTicker(void); void F_ContinueDrawer(void); -extern INT16 titlemap; -extern boolean hidetitlepics; extern INT32 titlescrollspeed; +extern boolean titlemapinaction; // // WIPE diff --git a/src/g_game.c b/src/g_game.c index 3d89fd6db..c8fa261f2 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -120,7 +120,7 @@ INT16 spstage_start; INT16 sstage_start; INT16 sstage_end; -INT16 titlemap; +INT16 titlemap = 0; boolean hidetitlepics = false; boolean looptitle = false; @@ -1988,7 +1988,7 @@ void G_Ticker(boolean run) break; case GS_TITLESCREEN: - if (gamemap) P_Ticker(run); // then intentionally fall through + if (titlemapinaction) P_Ticker(run); // then intentionally fall through case GS_WAITINGPLAYERS: F_TitleScreenTicker(run); break; From eea7dc4224e8e016f44de83e07515f2b712ed88f Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Tue, 28 Mar 2017 17:54:54 +0100 Subject: [PATCH 04/19] Fixed titlemap wipe lasting too long/happening twice over --- src/d_main.c | 2 +- src/f_finale.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/d_main.c b/src/d_main.c index 4fb55d728..e2cb35f32 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -302,7 +302,7 @@ static void D_Display(void) if (rendermode != render_none) { // Fade to black first - if (gamestate != GS_LEVEL // fades to black on its own timing, always + if (!(gamestate == GS_LEVEL || (gamestate == GS_TITLESCREEN && titlemapinaction)) // fades to black on its own timing, always && wipedefs[wipedefindex] != UINT8_MAX) { F_WipeStartScreen(); diff --git a/src/f_finale.c b/src/f_finale.c index 9959ce0fc..50c94eec3 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -1429,6 +1429,7 @@ void F_StartTitleScreen(void) if (titlemap) { + gamestate_t prevwipegamestate = wipegamestate; titlemapinaction = true; gamemap = titlemap; @@ -1439,6 +1440,8 @@ void F_StartTitleScreen(void) players[displayplayer].playerstate = PST_DEAD; // Don't spawn the player in dummy (I'm still a filthy cheater) camera.subsector = NULL; // toast is filthy too //CON_ClearHUD(); + + wipegamestate = prevwipegamestate; } else { From b68d1ebdb36632327f75969c9d2d24dee25d8bf6 Mon Sep 17 00:00:00 2001 From: yellowtd Date: Mon, 3 Apr 2017 22:12:53 -0400 Subject: [PATCH 05/19] titlemap - fix game crash with skybox point game crash on skybox object use fix --- src/f_finale.c | 38 +++++++++++++++++++++++++++++++++++--- src/r_main.c | 2 +- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/src/f_finale.c b/src/f_finale.c index 50c94eec3..07812946d 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -1436,9 +1436,42 @@ void F_StartTitleScreen(void) if (!mapheaderinfo[gamemap-1]) P_AllocMapHeader(gamemap-1); + maptol = mapheaderinfo[gamemap-1]->typeoflevel; + globalweather = mapheaderinfo[gamemap-1]->weather; + G_DoLoadLevel(true); players[displayplayer].playerstate = PST_DEAD; // Don't spawn the player in dummy (I'm still a filthy cheater) - camera.subsector = NULL; // toast is filthy too + //camera.subsector = NULL; // toast is filthy too + + // Set Default Position + mapthing_t *startpos; + if (playerstarts[0]) + startpos = playerstarts[0]; + else if (deathmatchstarts[0]) + startpos = deathmatchstarts[0]; + else + startpos = NULL; + + if (startpos) + { + camera.x = startpos->x << FRACBITS; + camera.y = startpos->y << FRACBITS; + camera.subsector = R_PointInSubsector(camera.x, camera.y); + camera.z = camera.subsector->sector->floorheight + ((startpos->options >> ZSHIFT) << FRACBITS); + camera.angle = (startpos->angle % 360)*ANG1; + camera.aiming = 0; + } + else + { + camera.x = camera.y = camera.z = camera.angle = camera.aiming = 0; + camera.subsector = NULL; // toast is filthy too + } + camera.chase = true; + camera.height = 0; + + //camera.x = camera.y = camera.height = camera.aiming = 0; + //camera.z = 128*FRACUNIT; + //CON_ClearHUD(); wipegamestate = prevwipegamestate; @@ -1545,8 +1578,7 @@ void F_TitleScreenTicker(boolean run) // Do a lil' camera spin if a title map is loaded. if (titlemapinaction) { - camera.x = camera.y = camera.height = camera.aiming = 0; - camera.z = 128*FRACUNIT; + // Default behavior camera.angle += titlescrollspeed; } diff --git a/src/r_main.c b/src/r_main.c index 4cff0ff83..c4ca7784b 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -1000,7 +1000,7 @@ void R_SetupFrame(player_t *player, boolean skybox) chasecam = (cv_chasecam.value != 0); } - if (player->climbing || (player->pflags & PF_NIGHTSMODE) || player->playerstate == PST_DEAD) + if (player->climbing || (player->pflags & PF_NIGHTSMODE) || player->playerstate == PST_DEAD || gamestate == GS_TITLESCREEN) chasecam = true; // force chasecam on else if (player->spectator) // no spectator chasecam chasecam = false; // force chasecam off From f70b89b22aad5d36172234805ef75a1bb2713e8f Mon Sep 17 00:00:00 2001 From: yellowtd Date: Thu, 20 Apr 2017 17:15:57 -0400 Subject: [PATCH 06/19] titlemap - support for map camera object allows a camera thing to be placed for alternate camera placement besides player and DM starts --- src/dehacked.c | 6 ++++++ src/f_finale.c | 42 +++++++++++++++++++++++++++++++++++++++--- src/p_mobj.c | 4 ++++ 3 files changed, 49 insertions(+), 3 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 6734f1427..95ce0a862 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -8595,6 +8595,12 @@ static inline int lib_getenum(lua_State *L) } else if (fastcmp(word,"paused")) { lua_pushboolean(L, paused); return 1; + } else if (fastcmp(word,"titlemap")) { + lua_pushinteger(L, titlemap); + return 1; + } else if (fastcmp(word,"titlemapinaction")) { + lua_pushboolean(L, titlemapinaction); + return 1; } else if (fastcmp(word,"gametype")) { lua_pushinteger(L, gametype); return 1; diff --git a/src/f_finale.c b/src/f_finale.c index 07812946d..efc87e040 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -1576,10 +1576,46 @@ void F_TitleScreenTicker(boolean run) if (gameaction != ga_nothing || gamestate != GS_TITLESCREEN) return; - // Do a lil' camera spin if a title map is loaded. + thinker_t *th; + mobj_t *mo2; + mobj_t *cameraref = NULL; + + // Execute the titlemap camera settings if (titlemapinaction) { - // Default behavior - camera.angle += titlescrollspeed; + + for (th = thinkercap.next; th != &thinkercap; th = th->next) + { + if (th->function.acp1 != (actionf_p1)P_MobjThinker) // Not a mobj thinker + continue; + + mo2 = (mobj_t *)th; + + if (mo2->type != MT_ALTVIEWMAN) + continue; + + if (mo2) + { + cameraref = mo2; + break; + } + else + break; + } + + if (cameraref) + { + camera.x = cameraref->x; + camera.y = cameraref->y; + camera.z = cameraref->z; + camera.angle = cameraref->angle; + camera.aiming = cameraref->cusval; + } + else + { + // Default behavior: Do a lil' camera spin if a title map is loaded; + // TODO: titlescrollspeed scrolls slow here because it is not an angle + //camera.angle += titlescrollspeed; + } } // no demos to play? or, are they disabled? diff --git a/src/p_mobj.c b/src/p_mobj.c index 8f6b9797e..319845668 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -34,6 +34,7 @@ #ifdef ESLOPE #include "p_slopes.h" #endif +#include "f_finale.h" // protos. static CV_PossibleValue_t viewheight_cons_t[] = {{16, "MIN"}, {56, "MAX"}, {0, NULL}}; @@ -8423,6 +8424,9 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type) #endif switch (mobj->type) { + case MT_ALTVIEWMAN: + if (titlemapinaction) mobj->flags &= ~MF_NOTHINK; + break; case MT_CYBRAKDEMON_NAPALM_BOMB_LARGE: mobj->fuse = mobj->info->mass; break; From cf454dd6fcb17b3c30729888019aca2e8c7d7f84 Mon Sep 17 00:00:00 2001 From: yellowtd Date: Thu, 20 Apr 2017 19:18:07 -0400 Subject: [PATCH 07/19] titlemap - Fix impending doom (???) camera mobj search the last implimentation would have apparently stopped working eventually? Idk --- src/f_finale.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/f_finale.c b/src/f_finale.c index efc87e040..e3a6e9164 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -1590,16 +1590,14 @@ void F_TitleScreenTicker(boolean run) mo2 = (mobj_t *)th; + if (!mo2) + continue; + if (mo2->type != MT_ALTVIEWMAN) continue; - if (mo2) - { - cameraref = mo2; - break; - } - else - break; + cameraref = mo2; + break; } if (cameraref) @@ -1613,8 +1611,7 @@ void F_TitleScreenTicker(boolean run) else { // Default behavior: Do a lil' camera spin if a title map is loaded; - // TODO: titlescrollspeed scrolls slow here because it is not an angle - //camera.angle += titlescrollspeed; + camera.angle += titlescrollspeed*ANG1/64; } } From fd97fdd6839f0c1938ae77118d872c0d755bf8c8 Mon Sep 17 00:00:00 2001 From: yellowtd Date: Thu, 20 Apr 2017 19:36:57 -0400 Subject: [PATCH 08/19] titlemap - cameraref subsector apparently it recalculates without this line, so it should give a tiny performance boost? --- src/f_finale.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/f_finale.c b/src/f_finale.c index e3a6e9164..0f29fadb4 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -1607,6 +1607,7 @@ void F_TitleScreenTicker(boolean run) camera.z = cameraref->z; camera.angle = cameraref->angle; camera.aiming = cameraref->cusval; + camera.subsector = cameraref->subsector; } else { From 068c9d6294cb25f7d2cabd93721739f4806e7880 Mon Sep 17 00:00:00 2001 From: yellowtd Date: Sat, 22 Apr 2017 19:40:18 -0400 Subject: [PATCH 09/19] titlemap - skipintro bugfix game crash with -skipintro enabled, hopefully fixes it and causes no issues anywhere else --- src/r_sky.c | 4 ---- src/screen.c | 3 +++ 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/r_sky.c b/src/r_sky.c index 5162518cb..898424a99 100644 --- a/src/r_sky.c +++ b/src/r_sky.c @@ -64,10 +64,6 @@ void R_SetupSkyDraw(void) // the horizon line in a 256x128 sky texture skytexturemid = (textures[skytexture]->height/2)< Date: Mon, 8 May 2017 23:51:12 +0100 Subject: [PATCH 10/19] Compiling fixes --- src/f_finale.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/f_finale.c b/src/f_finale.c index 0f29fadb4..bcd431d7c 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -1429,6 +1429,8 @@ void F_StartTitleScreen(void) if (titlemap) { + mapthing_t *startpos; + gamestate_t prevwipegamestate = wipegamestate; titlemapinaction = true; gamemap = titlemap; @@ -1444,7 +1446,6 @@ void F_StartTitleScreen(void) //camera.subsector = NULL; // toast is filthy too // Set Default Position - mapthing_t *startpos; if (playerstarts[0]) startpos = playerstarts[0]; else if (deathmatchstarts[0]) @@ -1576,12 +1577,12 @@ void F_TitleScreenTicker(boolean run) if (gameaction != ga_nothing || gamestate != GS_TITLESCREEN) return; - thinker_t *th; - mobj_t *mo2; - mobj_t *cameraref = NULL; - // Execute the titlemap camera settings - if (titlemapinaction) { + if (titlemapinaction) + { + thinker_t *th; + mobj_t *mo2; + mobj_t *cameraref = NULL; for (th = thinkercap.next; th != &thinkercap; th = th->next) { From 3a4e091ba6de7ddb425c7c63cfd32fe1303f6b46 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Tue, 9 May 2017 00:48:07 +0100 Subject: [PATCH 11/19] * Fix titlemap music change bug reported by Larztard * Clean up titlemapinaction so that it isn't true when you're playing * Don't print "SPEEDING OFF TO [ZONE] [ACT 1]..." on screen if it's a titlemap - keep a nice and pretty black screen --- src/f_finale.c | 10 ++++++---- src/f_finale.h | 1 + src/g_game.c | 6 ++++++ src/p_setup.c | 8 ++++++-- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/f_finale.c b/src/f_finale.c index 9cd2f6e14..2d391a4d8 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -39,6 +39,7 @@ static INT32 finalecount; INT32 titlescrollspeed = 80; boolean titlemapinaction = false; +boolean titlemaptransition = false; static INT32 timetonext; // Delay between screen changes static INT32 continuetime; // Short delay when continuing @@ -281,6 +282,8 @@ void F_StartCustomCutscene(INT32 cutscenenum, boolean precutscene, boolean reset void F_StartIntro(void) { + S_StopMusic(); + if (introtoplay) { if (!cutscenes[introtoplay - 1]) @@ -1428,7 +1431,7 @@ void F_StartTitleScreen(void) mapthing_t *startpos; gamestate_t prevwipegamestate = wipegamestate; - titlemapinaction = true; + titlemapinaction = titlemaptransition = true; gamemap = titlemap; if (!mapheaderinfo[gamemap-1]) @@ -1437,9 +1440,8 @@ void F_StartTitleScreen(void) maptol = mapheaderinfo[gamemap-1]->typeoflevel; globalweather = mapheaderinfo[gamemap-1]->weather; - G_DoLoadLevel(true); + G_DoLoadLevel(true); // handles music change players[displayplayer].playerstate = PST_DEAD; // Don't spawn the player in dummy (I'm still a filthy cheater) - //camera.subsector = NULL; // toast is filthy too // Set Default Position if (playerstarts[0]) @@ -1477,6 +1479,7 @@ void F_StartTitleScreen(void) { titlemapinaction = false; gamemap = 1; // g_game.c + S_ChangeMusicInternal("_title", looptitle); CON_ClearHUD(); } @@ -1484,7 +1487,6 @@ void F_StartTitleScreen(void) // IWAD dependent stuff. - S_ChangeMusicInternal("_title", looptitle); animtimer = 0; demoDelayLeft = demoDelayTime; diff --git a/src/f_finale.h b/src/f_finale.h index f710a74fb..7d41b5720 100644 --- a/src/f_finale.h +++ b/src/f_finale.h @@ -62,6 +62,7 @@ void F_ContinueDrawer(void); extern INT32 titlescrollspeed; extern boolean titlemapinaction; +extern boolean titlemaptransition; // // WIPE diff --git a/src/g_game.c b/src/g_game.c index 08d849a80..a3b2d9528 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1635,6 +1635,12 @@ void G_DoLoadLevel(boolean resetplayer) if (gamestate == GS_INTERMISSION) Y_EndIntermission(); + // cleanup + if (titlemaptransition) + titlemaptransition = false; + else + titlemapinaction = false; + G_SetGamestate(GS_LEVEL); for (i = 0; i < MAXPLAYERS; i++) diff --git a/src/p_setup.c b/src/p_setup.c index 4f11c10d0..85f5d346c 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2643,7 +2643,11 @@ boolean P_SetupLevel(boolean skipprecip) // As oddly named as this is, this handles music only. // We should be fine starting it here. - S_Start(); + /// ... as long as this isn't a titlemap transition, that is + if (!titlemapinaction) + S_Start(); + else + S_ChangeMusicInternal("_title", looptitle); // Let's fade to black here // But only if we didn't do the special stage wipe @@ -2657,7 +2661,7 @@ boolean P_SetupLevel(boolean skipprecip) } // Print "SPEEDING OFF TO [ZONE] [ACT 1]..." - if (rendermode != render_none) + if (!titlemapinaction && rendermode != render_none) { // Don't include these in the fade! char tx[64]; From 7f83e0d1343e89b2dc584d018ee1e45dd343f7a9 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Tue, 9 May 2017 11:09:58 +0100 Subject: [PATCH 12/19] * Prevent crash if you go to a map and it doesn't exist. * Handle music fix in smarter way. * Enums! --- src/dehacked.c | 2 +- src/f_finale.c | 21 ++++++++++----------- src/f_finale.h | 11 +++++++++-- src/g_game.c | 17 +++++++++++++---- src/p_setup.c | 2 -- 5 files changed, 33 insertions(+), 20 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 71939ade5..73d52d9bf 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -8646,7 +8646,7 @@ static inline int lib_getenum(lua_State *L) lua_pushinteger(L, titlemap); return 1; } else if (fastcmp(word,"titlemapinaction")) { - lua_pushboolean(L, titlemapinaction); + lua_pushboolean(L, (titlemapinaction != TITLEMAP_OFF)); return 1; } else if (fastcmp(word,"gametype")) { lua_pushinteger(L, gametype); diff --git a/src/f_finale.c b/src/f_finale.c index 2d391a4d8..29e7e83fa 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -38,8 +38,7 @@ // 0 = text, 1 = art screen static INT32 finalecount; INT32 titlescrollspeed = 80; -boolean titlemapinaction = false; -boolean titlemaptransition = false; +UINT8 titlemapinaction = TITLEMAP_OFF; static INT32 timetonext; // Delay between screen changes static INT32 continuetime; // Short delay when continuing @@ -1421,6 +1420,8 @@ void F_GameEndTicker(void) // ============== void F_StartTitleScreen(void) { + S_ChangeMusicInternal("_title", looptitle); + if (gamestate != GS_TITLESCREEN && gamestate != GS_WAITINGPLAYERS) finalecount = 0; else @@ -1431,7 +1432,7 @@ void F_StartTitleScreen(void) mapthing_t *startpos; gamestate_t prevwipegamestate = wipegamestate; - titlemapinaction = titlemaptransition = true; + titlemapinaction = TITLEMAP_LOADING; gamemap = titlemap; if (!mapheaderinfo[gamemap-1]) @@ -1440,7 +1441,10 @@ void F_StartTitleScreen(void) maptol = mapheaderinfo[gamemap-1]->typeoflevel; globalweather = mapheaderinfo[gamemap-1]->weather; - G_DoLoadLevel(true); // handles music change + G_DoLoadLevel(true); + if (!titlemap) + return; + players[displayplayer].playerstate = PST_DEAD; // Don't spawn the player in dummy (I'm still a filthy cheater) // Set Default Position @@ -1465,21 +1469,16 @@ void F_StartTitleScreen(void) camera.x = camera.y = camera.z = camera.angle = camera.aiming = 0; camera.subsector = NULL; // toast is filthy too } + camera.chase = true; camera.height = 0; - //camera.x = camera.y = camera.height = camera.aiming = 0; - //camera.z = 128*FRACUNIT; - - //CON_ClearHUD(); - wipegamestate = prevwipegamestate; } else { - titlemapinaction = false; + titlemapinaction = TITLEMAP_OFF; gamemap = 1; // g_game.c - S_ChangeMusicInternal("_title", looptitle); CON_ClearHUD(); } diff --git a/src/f_finale.h b/src/f_finale.h index 7d41b5720..aadc64ad0 100644 --- a/src/f_finale.h +++ b/src/f_finale.h @@ -61,8 +61,15 @@ void F_ContinueTicker(void); void F_ContinueDrawer(void); extern INT32 titlescrollspeed; -extern boolean titlemapinaction; -extern boolean titlemaptransition; + +typedef enum +{ + TITLEMAP_OFF = 0, + TITLEMAP_LOADING, + TITLEMAP_RUNNING +} titlemap_enum; + +extern UINT8 titlemapinaction; // // WIPE diff --git a/src/g_game.c b/src/g_game.c index a3b2d9528..01d744077 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1636,10 +1636,19 @@ void G_DoLoadLevel(boolean resetplayer) Y_EndIntermission(); // cleanup - if (titlemaptransition) - titlemaptransition = false; + if (titlemapinaction == TITLEMAP_LOADING) + { + if (W_CheckNumForName(G_BuildMapName(gamemap)) == LUMPERROR) + { + titlemap = 0; // let's not infinite recursion ok + Command_ExitGame_f(); + return; + } + + titlemapinaction = TITLEMAP_RUNNING; + } else - titlemapinaction = false; + titlemapinaction = TITLEMAP_OFF; G_SetGamestate(GS_LEVEL); @@ -1650,7 +1659,7 @@ void G_DoLoadLevel(boolean resetplayer) } // Setup the level. - if (!P_SetupLevel(false)) + if (!P_SetupLevel(false)) // this never returns false? { // fail so reset game stuff Command_ExitGame_f(); diff --git a/src/p_setup.c b/src/p_setup.c index 85f5d346c..69c60c3ac 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2646,8 +2646,6 @@ boolean P_SetupLevel(boolean skipprecip) /// ... as long as this isn't a titlemap transition, that is if (!titlemapinaction) S_Start(); - else - S_ChangeMusicInternal("_title", looptitle); // Let's fade to black here // But only if we didn't do the special stage wipe From 13c748531ffb7348fdc5f113b2edb1e0741c1d94 Mon Sep 17 00:00:00 2001 From: yellowtd Date: Fri, 12 May 2017 20:47:42 -0400 Subject: [PATCH 13/19] bootmap (+indentation fix) --- src/d_main.c | 13 +++++++++++++ src/dehacked.c | 14 ++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/src/d_main.c b/src/d_main.c index 616d64d52..5e357ed1d 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -1341,6 +1341,19 @@ void D_SRB2Main(void) ultimatemode = true; } + // rei/miru: bootmap (Idea: starts the game on a predefined map) + if (bootmap && !(M_CheckParm("-warp") && M_IsNextParm())) + { + pstartmap = bootmap; + + if (pstartmap < 1 || pstartmap > NUMMAPS) + I_Error("Cannot warp to map %d (out of range)\n", pstartmap); + else + { + autostart = true; + } + } + if (autostart || netgame || M_CheckParm("+connect") || M_CheckParm("-connect")) { gameaction = ga_nothing; diff --git a/src/dehacked.c b/src/dehacked.c index 73d52d9bf..174447ef2 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -3241,6 +3241,20 @@ static void readmaincfg(MYFILE *f) DEH_WriteUndoline(word, customversionstring, UNDO_NONE); strlcpy(customversionstring, word2, sizeof (customversionstring)); } + else if (fastcmp(word, "BOOTMAP")) + { + // Support using the actual map name, + // i.e., Level AB, Level FZ, etc. + + // Convert to map number + if (word2[0] >= 'A' && word2[0] <= 'Z') + value = M_MapNumber(word2[0], word2[1]); + else + value = get_number(word2); + + DEH_WriteUndoline(word, va("%d", bootmap), UNDO_NONE); + bootmap = (INT16)value; + } else deh_warning("Maincfg: unknown word '%s'", word); } From f5fa67b7ad7be30c871e7fb1fad40c9ae346eaa0 Mon Sep 17 00:00:00 2001 From: yellowtd Date: Fri, 12 May 2017 20:54:06 -0400 Subject: [PATCH 14/19] no idea why this was stashed while the last commit before this one was made.. --- src/doomstat.h | 1 + src/g_game.c | 1 + 2 files changed, 2 insertions(+) diff --git a/src/doomstat.h b/src/doomstat.h index 033381435..0d6dc2bae 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -126,6 +126,7 @@ extern INT16 sstage_end; extern INT16 titlemap; extern boolean hidetitlepics; +extern INT16 bootmap; //bootmap for loading a map on startup extern boolean looptitle; extern boolean useNightsSS; diff --git a/src/g_game.c b/src/g_game.c index 01d744077..c118eba29 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -122,6 +122,7 @@ INT16 sstage_end; INT16 titlemap = 0; boolean hidetitlepics = false; +INT16 bootmap; //bootmap for loading a map on startup boolean looptitle = false; boolean useNightsSS = false; From ba4275c415cf5fe021619d0d9b1f694dd38210f2 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Sat, 13 May 2017 22:38:06 +0100 Subject: [PATCH 15/19] title screen hud hook --- src/f_finale.c | 13 +++++++++++++ src/lua_hud.h | 1 + src/lua_hudlib.c | 32 +++++++++++++++++++++++++++++++- 3 files changed, 45 insertions(+), 1 deletion(-) diff --git a/src/f_finale.c b/src/f_finale.c index 29e7e83fa..4dd73aa02 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -34,6 +34,10 @@ #include "p_local.h" #include "p_setup.h" +#ifdef HAVE_BLUA +#include "lua_hud.h" +#endif + // Stage of animation: // 0 = text, 1 = art screen static INT32 finalecount; @@ -1524,7 +1528,11 @@ void F_TitleScreenDrawer(void) // rei|miru: use title pics? if (hidetitlepics) +#ifdef HAVE_BLUA + goto luahook; +#else return; +#endif V_DrawScaledPatch(30, 14, 0, ttwing); @@ -1562,6 +1570,11 @@ void F_TitleScreenDrawer(void) } V_DrawScaledPatch(48, 142, 0,ttbanner); + +#ifdef HAVE_BLUA +luahook: + LUAh_TitleHUD(); +#endif } // (no longer) De-Demo'd Title Screen diff --git a/src/lua_hud.h b/src/lua_hud.h index ba0a1d894..beaca7883 100644 --- a/src/lua_hud.h +++ b/src/lua_hud.h @@ -42,3 +42,4 @@ boolean LUA_HudEnabled(enum hud option); void LUAh_GameHUD(player_t *stplyr); void LUAh_ScoresHUD(void); +void LUAh_TitleHUD(void); diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index 5b3cd46ce..f2a2be847 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -87,11 +87,13 @@ static const char *const patch_opt[] = { enum hudhook { hudhook_game = 0, - hudhook_scores + hudhook_scores, + hudhook_title }; static const char *const hudhook_opt[] = { "game", "scores", + "title", NULL}; // alignment types for v.drawString @@ -650,6 +652,9 @@ int LUA_HudLib(lua_State *L) lua_newtable(L); lua_rawseti(L, -2, 3); // HUD[2] = scores rendering functions array + + lua_newtable(L); + lua_rawseti(L, -2, 4); // HUD[3] = title rendering functions array lua_setfield(L, LUA_REGISTRYINDEX, "HUD"); luaL_newmetatable(L, META_HUDINFO); @@ -762,4 +767,29 @@ void LUAh_ScoresHUD(void) hud_running = false; } +void LUAh_TitleHUD(void) +{ + if (!gL || !(hudAvailable & (1< Date: Sun, 14 May 2017 16:45:08 +0100 Subject: [PATCH 16/19] Added reset for titlemap (and other title attribute) changes so that the title screen never ends up being some half-formed hybrid Also because I could I added it for intro changes too --- src/d_main.c | 3 +++ src/dehacked.c | 24 +++++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/d_main.c b/src/d_main.c index 5e357ed1d..1d3680ff0 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -683,6 +683,9 @@ void D_AdvanceDemo(void) void D_StartTitle(void) { INT32 i; + + S_StopMusic(); + if (netgame) { if (gametype == GT_COOP) diff --git a/src/dehacked.c b/src/dehacked.c index 174447ef2..406e10716 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -77,6 +77,8 @@ boolean deh_loaded = false; static int dbg_line; static boolean gamedataadded = false; +static boolean titlechanged = false; +static boolean introchanged = false; #ifdef DELFILE typedef struct undehacked_s @@ -3137,11 +3139,13 @@ static void readmaincfg(MYFILE *f) // range check, you morons. if (introtoplay > 128) introtoplay = 128; + introchanged = true; } else if (fastcmp(word, "LOOPTITLE")) { DEH_WriteUndoline(word, va("%d", looptitle), UNDO_NONE); looptitle = (boolean)(value || word2[0] == 'T' || word2[0] == 'Y'); + titlechanged = true; } else if (fastcmp(word, "TITLEMAP")) { @@ -3156,16 +3160,19 @@ static void readmaincfg(MYFILE *f) DEH_WriteUndoline(word, va("%d", titlemap), UNDO_NONE); titlemap = (INT16)value; + titlechanged = true; } else if (fastcmp(word, "HIDETITLEPICS")) { DEH_WriteUndoline(word, va("%d", hidetitlepics), UNDO_NONE); hidetitlepics = (boolean)(value || word2[0] == 'T' || word2[0] == 'Y'); + titlechanged = true; } else if (fastcmp(word, "TITLESCROLLSPEED")) { DEH_WriteUndoline(word, va("%d", titlescrollspeed), UNDO_NONE); titlescrollspeed = get_number(word2); + titlechanged = true; } else if (fastcmp(word, "CREDITSCUTSCENE")) { @@ -3184,16 +3191,19 @@ static void readmaincfg(MYFILE *f) { DEH_WriteUndoline(word, va("%d", numDemos), UNDO_NONE); numDemos = (UINT8)get_number(word2); + titlechanged = true; } else if (fastcmp(word, "DEMODELAYTIME")) { DEH_WriteUndoline(word, va("%d", demoDelayTime), UNDO_NONE); demoDelayTime = get_number(word2); + titlechanged = true; } else if (fastcmp(word, "DEMOIDLETIME")) { DEH_WriteUndoline(word, va("%d", demoIdleTime), UNDO_NONE); demoIdleTime = get_number(word2); + titlechanged = true; } else if (fastcmp(word, "USE1UPSOUND")) { @@ -3230,16 +3240,19 @@ static void readmaincfg(MYFILE *f) strlcat(savegamename, "%u.ssg", sizeof(savegamename)); gamedataadded = true; + titlechanged = true; } else if (fastcmp(word, "RESETDATA")) { DEH_WriteUndoline(word, "0", UNDO_TODO); /// \todo P_ResetData(value); + titlechanged = true; } else if (fastcmp(word, "CUSTOMVERSION")) { DEH_WriteUndoline(word, customversionstring, UNDO_NONE); strlcpy(customversionstring, word2, sizeof (customversionstring)); + //titlechanged = true; } else if (fastcmp(word, "BOOTMAP")) { @@ -3254,6 +3267,7 @@ static void readmaincfg(MYFILE *f) DEH_WriteUndoline(word, va("%d", bootmap), UNDO_NONE); bootmap = (INT16)value; + //titlechanged = true; } else deh_warning("Maincfg: unknown word '%s'", word); @@ -3463,7 +3477,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad) for (i = 0; i < NUMSFX; i++) savesfxnames[i] = S_sfx[i].name; - gamedataadded = false; + gamedataadded = titlechanged = introchanged = false; // it doesn't test the version of SRB2 and version of dehacked file dbg_line = -1; // start at -1 so the first line is 0. @@ -3834,6 +3848,14 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad) if (gamedataadded) G_LoadGameData(); + if (gamestate == GS_TITLESCREEN) + { + if (introchanged) + COM_BufAddText("playintro"); + else if (titlechanged) + COM_BufAddText("exitgame"); // Command_ExitGame_f() but delayed + } + dbg_line = -1; if (deh_num_warning) { From b13a9ad9d16637b76c544dcfd9cbe665cbe3136f Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Sun, 14 May 2017 19:20:00 +0100 Subject: [PATCH 17/19] Support for negative scroll speeds on title screen --- src/f_finale.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/f_finale.c b/src/f_finale.c index 4dd73aa02..eb25e1bec 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -227,7 +227,8 @@ static void F_SkyScroll(INT32 scrollspeed) pat = W_CachePatchName("TITLESKY", PU_CACHE); - animtimer = ((finalecount*scrollspeed)/16) % SHORT(pat->width); + fakedwidth = SHORT(pat->width); + animtimer = ((finalecount*scrollspeed)/16 + fakedwidth) % fakedwidth; fakedwidth = vid.width / vid.dupx; From 65a202e84345d24e39291461fa31d010e613963b Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Sun, 14 May 2017 19:25:46 +0100 Subject: [PATCH 18/19] ACTUALLY let's do this better --- src/f_finale.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/f_finale.c b/src/f_finale.c index eb25e1bec..b46b92945 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -224,18 +224,19 @@ static void F_SkyScroll(INT32 scrollspeed) { INT32 scrolled, x, mx, fakedwidth; patch_t *pat; + INT16 patwidth; pat = W_CachePatchName("TITLESKY", PU_CACHE); - fakedwidth = SHORT(pat->width); - animtimer = ((finalecount*scrollspeed)/16 + fakedwidth) % fakedwidth; + patwidth = SHORT(pat->width); + animtimer = ((finalecount*scrollspeed)/16 + patwidth) % patwidth; fakedwidth = vid.width / vid.dupx; if (rendermode == render_soft) { // if only hardware rendering could be this elegant and complete - scrolled = (SHORT(pat->width) - animtimer) - 1; - for (x = 0, mx = scrolled; x < fakedwidth; x++, mx = (mx+1)%SHORT(pat->width)) + scrolled = (patwidth - animtimer) - 1; + for (x = 0, mx = scrolled; x < fakedwidth; x++, mx = (mx+1)%patwidth) F_DrawPatchCol(x, pat, mx); } #ifdef HWRENDER @@ -243,8 +244,8 @@ static void F_SkyScroll(INT32 scrollspeed) { // if only software rendering could be this simple and retarded scrolled = animtimer; if (scrolled > 0) - V_DrawScaledPatch(scrolled - SHORT(pat->width), 0, 0, pat); - for (x = 0; x < fakedwidth; x += SHORT(pat->width)) + V_DrawScaledPatch(scrolled - patwidth, 0, 0, pat); + for (x = 0; x < fakedwidth; x += patwidth) V_DrawScaledPatch(x + scrolled, 0, 0, pat); } #endif From 87f32abc24e6751f46ee67feab796c120c8e3c62 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Tue, 16 May 2017 14:11:10 +0100 Subject: [PATCH 19/19] i have no idea whether this will fix the garbage or whether it'll get broken again, but here's an attempted fix for VAda's name --- src/f_finale.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/f_finale.c b/src/f_finale.c index b46b92945..eab565ca1 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -1009,7 +1009,7 @@ static const char *credits[] = { "", "\1Sprite Artists", "Odi \"Iceman404\" Atunzu", - "Victor \"VAdaPEGA\" Ara\x1Fjo", // Ara�jo -- sorry for our limited font! D: + "Victor \"VAdaPEGA\" Ara\x1Fjo", // Araújo -- sorry for our limited font! D: "Jim \"MotorRoach\" DeMello", "Desmond \"Blade\" DesJardins", "Sherman \"CoatRack\" DesJardins",