From cfc56c954144275ad94038e8c8462798ad486d5d Mon Sep 17 00:00:00 2001 From: sphere Date: Sun, 14 Jul 2019 15:30:00 +0200 Subject: [PATCH 1/9] Don't upscale the waving flags, make them twice as large instead --- src/info.c | 6 +++--- src/p_mobj.c | 4 +--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/info.c b/src/info.c index 0cbe8d82e..08b1ab5e9 100644 --- a/src/info.c +++ b/src/info.c @@ -11278,8 +11278,8 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL, // xdeathstate sfx_None, // deathsound 0, // speed - 4*FRACUNIT, // radius - 104*FRACUNIT, // height + 8*FRACUNIT, // radius + 208*FRACUNIT, // height 0, // display offset 100, // mass 0, // damage @@ -11305,7 +11305,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL, // xdeathstate sfx_None, // deathsound 0, // speed - 4*FRACUNIT, // radius + 8*FRACUNIT, // radius 1, // height -- this is not a typo 0, // display offset 100, // mass diff --git a/src/p_mobj.c b/src/p_mobj.c index a57998ea0..acc995dd0 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -4662,7 +4662,7 @@ static void P_Boss4PinchSpikeballs(mobj_t *mobj, angle_t angle, fixed_t dz) } dz /= 9; - + while ((base = base->tracer)) // there are 10 per spoke, remember that { dx = (originx + P_ReturnThrustX(mobj, angle, (9*132)<x)/9; @@ -9653,8 +9653,6 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type) { mobj_t *prev = mobj, *cur; UINT8 i; - mobj->destscale <<= 2; - P_SetScale(mobj, mobj->destscale); for (i = 0; i <= 16; i++) // probably should be < but staying authentic to the Lua version { cur = P_SpawnMobjFromMobj(mobj, 0, 0, 0, MT_WAVINGFLAGSEG); From ee937c4df038b60614a248039bc7ed2914368b2c Mon Sep 17 00:00:00 2001 From: sphere Date: Sun, 14 Jul 2019 16:50:45 +0200 Subject: [PATCH 2/9] Add a blue variant of the waving flags. --- src/dehacked.c | 9 +++++--- src/info.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++---- src/info.h | 9 +++++--- src/p_mobj.c | 8 ++++--- 4 files changed, 76 insertions(+), 13 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 31c17f188..18d0b2243 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -5708,7 +5708,8 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_FLAMEHOLDER", "S_FIRETORCH", "S_WAVINGFLAG", - "S_WAVINGFLAGSEG", + "S_WAVINGFLAGSEG1", + "S_WAVINGFLAGSEG2", "S_CRAWLASTATUE", "S_FACESTABBERSTATUE", "S_SUSPICIOUSFACESTABBERSTATUE_WAIT", @@ -7523,8 +7524,10 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_CANDLEPRICKET", // Candle pricket "MT_FLAMEHOLDER", // Flame holder "MT_FIRETORCH", // Fire torch - "MT_WAVINGFLAG", // Waving flag - "MT_WAVINGFLAGSEG", // Waving flag segment + "MT_WAVINGFLAG1", // Waving flag (red) + "MT_WAVINGFLAG2", // Waving flag (blue) + "MT_WAVINGFLAGSEG1", // Waving flag segment (red) + "MT_WAVINGFLAGSEG2", // Waving flag segment (blue) "MT_CRAWLASTATUE", // Crawla statue "MT_FACESTABBERSTATUE", // Facestabber statue "MT_SUSPICIOUSFACESTABBERSTATUE", // :eggthinking: diff --git a/src/info.c b/src/info.c index 08b1ab5e9..4733329f3 100644 --- a/src/info.c +++ b/src/info.c @@ -2338,7 +2338,8 @@ state_t states[NUMSTATES] = {SPR_CTRC, FF_FULLBRIGHT|FF_ANIMATE, 8*3, {A_FlameParticle}, 3, 3, S_FIRETORCH}, // S_FIRETORCH {SPR_CFLG, 0, -1, {NULL}, 0, 0, S_NULL}, // S_WAVINGFLAG - {SPR_CFLG, FF_PAPERSPRITE|1, -1, {NULL}, 0, 0, S_NULL}, // S_WAVINGFLAGSEG + {SPR_CFLG, FF_PAPERSPRITE|1, -1, {NULL}, 0, 0, S_NULL}, // S_WAVINGFLAGSEG1 + {SPR_CFLG, FF_PAPERSPRITE|2, -1, {NULL}, 0, 0, S_NULL}, // S_WAVINGFLAGSEG2 {SPR_CSTA, 0, -1, {NULL}, 0, 0, S_NULL}, // S_CRAWLASTATUE @@ -11261,7 +11262,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, - { // MT_WAVINGFLAG + { // MT_WAVINGFLAG1 1118, // doomednum S_WAVINGFLAG, // spawnstate 1000, // spawnhealth @@ -11288,9 +11289,63 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, - { // MT_WAVINGFLAGSEG + { // MT_WAVINGFLAG2 + 1128, // doomednum + S_WAVINGFLAG, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 0, // speed + 8*FRACUNIT, // radius + 208*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_SOLID, // flags + S_NULL // raisestate + }, + + { // MT_WAVINGFLAGSEG1 -1, // doomednum - S_WAVINGFLAGSEG, // spawnstate + S_WAVINGFLAGSEG1, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 0, // speed + 8*FRACUNIT, // radius + 1, // height -- this is not a typo + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_NOTHINK|MF_NOBLOCKMAP|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOGRAVITY|MF_SCENERY, // flags + S_NULL // raisestate + }, + + { // MT_WAVINGFLAGSEG2 + -1, // doomednum + S_WAVINGFLAGSEG2, // spawnstate 1000, // spawnhealth S_NULL, // seestate sfx_None, // seesound diff --git a/src/info.h b/src/info.h index 44f08a4e9..536034867 100644 --- a/src/info.h +++ b/src/info.h @@ -2467,7 +2467,8 @@ typedef enum state S_FLAMEHOLDER, S_FIRETORCH, S_WAVINGFLAG, - S_WAVINGFLAGSEG, + S_WAVINGFLAGSEG1, + S_WAVINGFLAGSEG2, S_CRAWLASTATUE, S_FACESTABBERSTATUE, S_SUSPICIOUSFACESTABBERSTATUE_WAIT, @@ -4304,8 +4305,10 @@ typedef enum mobj_type MT_CANDLEPRICKET, // Candle pricket MT_FLAMEHOLDER, // Flame holder MT_FIRETORCH, // Fire torch - MT_WAVINGFLAG, // Waving flag - MT_WAVINGFLAGSEG, // Waving flag segment + MT_WAVINGFLAG1, // Waving flag (red) + MT_WAVINGFLAG2, // Waving flag (blue) + MT_WAVINGFLAGSEG1, // Waving flag segment (red) + MT_WAVINGFLAGSEG2, // Waving flag segment (blue) MT_CRAWLASTATUE, // Crawla statue MT_FACESTABBERSTATUE, // Facestabber statue MT_SUSPICIOUSFACESTABBERSTATUE, // :eggthinking: diff --git a/src/p_mobj.c b/src/p_mobj.c index acc995dd0..5e0509a0f 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -8046,7 +8046,8 @@ void P_MobjThinker(mobj_t *mobj) mobj->tracer->z += mobj->height; } break; - case MT_WAVINGFLAG: + case MT_WAVINGFLAG1: + case MT_WAVINGFLAG2: { fixed_t base = (leveltime<<(FRACBITS+1)); mobj_t *seg = mobj->tracer, *prev = mobj; @@ -9649,13 +9650,14 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type) case MT_BIGMINE: mobj->extravalue1 = FixedHypot(mobj->x, mobj->y)>>FRACBITS; break; - case MT_WAVINGFLAG: + case MT_WAVINGFLAG1: + case MT_WAVINGFLAG2: { mobj_t *prev = mobj, *cur; UINT8 i; for (i = 0; i <= 16; i++) // probably should be < but staying authentic to the Lua version { - cur = P_SpawnMobjFromMobj(mobj, 0, 0, 0, MT_WAVINGFLAGSEG); + cur = P_SpawnMobjFromMobj(mobj, 0, 0, 0, ((mobj->type == MT_WAVINGFLAG1) ? MT_WAVINGFLAGSEG1 : MT_WAVINGFLAGSEG2));; P_SetTarget(&prev->tracer, cur); cur->extravalue1 = i; prev = cur; From 79cf8eb08def9d48f770325bd2c3fb217ff1dc63 Mon Sep 17 00:00:00 2001 From: sphere Date: Sun, 14 Jul 2019 17:30:33 +0200 Subject: [PATCH 3/9] Add a blue variant of the pole banner & change some doomednums. --- src/dehacked.c | 9 ++++--- src/info.c | 69 +++++++++++++++++++++++++++++++++++++++++++++----- src/info.h | 9 ++++--- src/p_mobj.c | 5 ++-- 4 files changed, 77 insertions(+), 15 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 18d0b2243..01e2b0bde 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -5699,7 +5699,8 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_CEZFLOWER", "S_CEZPOLE", - "S_CEZBANNER", + "S_CEZBANNER1", + "S_CEZBANNER2", "S_PINETREE", "S_CEZBUSH1", "S_CEZBUSH2", @@ -7515,8 +7516,10 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_SMALLFIREBAR", // Small Firebar "MT_BIGFIREBAR", // Big Firebar "MT_CEZFLOWER", // Flower - "MT_CEZPOLE", // Pole - "MT_CEZBANNER", // Banner + "MT_CEZPOLE1", // Pole (with red banner) + "MT_CEZPOLE2", // Pole (with blue banner) + "MT_CEZBANNER1", // Banner (red) + "MT_CEZBANNER2", // Banner (blue) "MT_PINETREE", // Pine Tree "MT_CEZBUSH1", // Bush 1 "MT_CEZBUSH2", // Bush 2 diff --git a/src/info.c b/src/info.c index 4733329f3..8796eca91 100644 --- a/src/info.c +++ b/src/info.c @@ -2322,9 +2322,10 @@ state_t states[NUMSTATES] = {SPR_BFBR, FF_FULLBRIGHT|15, 1, {NULL}, 0, 0, S_BIGFIREBAR1}, // S_BIGFIREBAR16 {SPR_FWR4, 0, -1, {NULL}, 0, 0, S_NULL}, // S_CEZFLOWER - {SPR_BANR, 1, -1, {NULL}, 0, 0, S_NULL}, // S_CEZPOLE + {SPR_BANR, 0, -1, {NULL}, 0, 0, S_NULL}, // S_CEZPOLE - {SPR_BANR, FF_PAPERSPRITE, -1, {NULL}, 0, 0, S_NULL}, // S_CEZBANNER + {SPR_BANR, FF_PAPERSPRITE|1, -1, {NULL}, 0, 0, S_NULL}, // S_CEZBANNER1 + {SPR_BANR, FF_PAPERSPRITE|2, -1, {NULL}, 0, 0, S_NULL}, // S_CEZBANNER2 {SPR_PINE, 0, -1, {NULL}, 0, 0, S_NULL}, // S_PINETREE {SPR_CEZB, 0, -1, {NULL}, 0, 0, S_NULL}, // S_CEZBUSH1 @@ -11019,7 +11020,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, - { // MT_CEZPOLE + { // MT_CEZPOLE1 1117, // doomednum S_CEZPOLE, // spawnstate 1000, // spawnhealth @@ -11046,9 +11047,63 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, - { // MT_CEZBANNER + { // MT_CEZPOLE2 + 1118, // doomednum + S_CEZPOLE, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 0, // speed + 40*FRACUNIT, // radius + 224*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_NOTHINK|MF_NOBLOCKMAP|MF_NOCLIP|MF_SCENERY, // flags + S_NULL // raisestate + }, + + { // MT_CEZBANNER1 -1, // doomednum - S_CEZBANNER, // spawnstate + S_CEZBANNER1, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 0, // speed + 40*FRACUNIT, // radius + 224*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_NOTHINK|MF_NOBLOCKMAP|MF_NOCLIP|MF_SCENERY, // flags + S_NULL // raisestate + }, + + { // MT_CEZBANNER2 + -1, // doomednum + S_CEZBANNER2, // spawnstate 1000, // spawnhealth S_NULL, // seestate sfx_None, // seesound @@ -11263,7 +11318,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = }, { // MT_WAVINGFLAG1 - 1118, // doomednum + 1128, // doomednum S_WAVINGFLAG, // spawnstate 1000, // spawnhealth S_NULL, // seestate @@ -11290,7 +11345,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = }, { // MT_WAVINGFLAG2 - 1128, // doomednum + 1129, // doomednum S_WAVINGFLAG, // spawnstate 1000, // spawnhealth S_NULL, // seestate diff --git a/src/info.h b/src/info.h index 536034867..a9a0321ec 100644 --- a/src/info.h +++ b/src/info.h @@ -2458,7 +2458,8 @@ typedef enum state S_CEZFLOWER, S_CEZPOLE, - S_CEZBANNER, + S_CEZBANNER1, + S_CEZBANNER2, S_PINETREE, S_CEZBUSH1, S_CEZBUSH2, @@ -4296,8 +4297,10 @@ typedef enum mobj_type MT_SMALLFIREBAR, // Small Firebar MT_BIGFIREBAR, // Big Firebar MT_CEZFLOWER, // Flower - MT_CEZPOLE, // Pole - MT_CEZBANNER, // Banner + MT_CEZPOLE1, // Pole (with red banner) + MT_CEZPOLE2, // Pole (with blue banner) + MT_CEZBANNER1, // Banner (red) + MT_CEZBANNER2, // Banner (blue) MT_PINETREE, // Pine Tree MT_CEZBUSH1, // Bush 1 MT_CEZBUSH2, // Bush 2 diff --git a/src/p_mobj.c b/src/p_mobj.c index 5e0509a0f..396fd3583 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -11737,13 +11737,14 @@ ML_EFFECT5 : Don't stop thinking when too far away P_SpawnMobjFromMobj(mobj, -1*FRACUNIT, 0, 0, MT_THZTREEBRANCH)->angle = mobjangle + ANGLE_270; } break; - case MT_CEZPOLE: + case MT_CEZPOLE1: + case MT_CEZPOLE2: { // Spawn the banner angle_t mobjangle = FixedAngle(mthing->angle<angle = mobjangle + ANGLE_90; + 0, ((mobj->type == MT_CEZPOLE1) ? MT_CEZBANNER1 : MT_CEZBANNER2))->angle = mobjangle + ANGLE_90; } break; case MT_HHZTREE_TOP: From 4e839596a1c8dd677bc94f9aad1a0f3e74e84955 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Sun, 14 Jul 2019 14:55:04 -0400 Subject: [PATCH 4/9] Fix crash with GME sounds when being freed --- src/sdl/mixer_sound.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sdl/mixer_sound.c b/src/sdl/mixer_sound.c index 045e82b15..a1319dbec 100644 --- a/src/sdl/mixer_sound.c +++ b/src/sdl/mixer_sound.c @@ -362,7 +362,7 @@ void *I_GetSfx(sfxinfo_t *sfx) gme_track_info(emu, &info, 0); len = (info->play_length * 441 / 10) << 2; - mem = malloc(len); + mem = Z_Malloc(len, PU_SOUND, 0); gme_play(emu, len >> 1, mem); gme_free_info(info); gme_delete(emu); @@ -435,7 +435,7 @@ void *I_GetSfx(sfxinfo_t *sfx) gme_track_info(emu, &info, 0); len = (info->play_length * 441 / 10) << 2; - mem = malloc(len); + mem = Z_Malloc(len, PU_SOUND, 0); gme_play(emu, len >> 1, mem); gme_free_info(info); gme_delete(emu); From f6842a80b462ff9ec0c7a58fd598dc94a0d3f2e1 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 14 Jul 2019 21:58:48 +0100 Subject: [PATCH 5/9] Fixes for menus: * add gamestate != GS_TIMEATTACK checks to prevent Record Attack or NiGHTS Mode losing their backgrounds * increase bgname to 9 to include the extra NULL byte? (is this a good idea actually) * make M_IterateMenuTree ignore menu levels without a menutype value --- src/f_finale.c | 2 +- src/f_finale.h | 2 +- src/m_menu.c | 8 +++++--- src/m_menu.h | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/f_finale.c b/src/f_finale.c index 27c9ebd68..134bc9fcc 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -67,7 +67,7 @@ static INT32 menuanimtimer; // Title screen: background animation timing mobj_t *titlemapcameraref = NULL; // menu presentation state -char curbgname[8]; +char curbgname[9]; SINT8 curfadevalue; boolean curhidepics; INT32 curbgcolor; diff --git a/src/f_finale.h b/src/f_finale.h index c0c6360c3..663a45412 100644 --- a/src/f_finale.h +++ b/src/f_finale.h @@ -84,7 +84,7 @@ typedef enum extern UINT8 titlemapinaction; extern mobj_t *titlemapcameraref; -extern char curbgname[8]; +extern char curbgname[9]; extern SINT8 curfadevalue; extern boolean curhidepics; extern INT32 curbgcolor; diff --git a/src/m_menu.c b/src/m_menu.c index dca2e552d..53e0182fd 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -2247,6 +2247,8 @@ static INT32 M_IterateMenuTree(menutree_iterator itfunc, void *input) { bitmask = ((1 << MENUBITS) - 1) << (MENUBITS*i); menutype = (activeMenuId & bitmask) >> (MENUBITS*i); + if (!menutype) + continue; if (itfunc(menutype, i, &retval, &input, false)) break; } @@ -2300,7 +2302,7 @@ static boolean MIT_SetCurBackground(UINT32 menutype, INT32 level, INT32 *retval, curbgyspeed = menupres[menutype].titlescrollyspeed != INT32_MAX ? menupres[menutype].titlescrollyspeed : titlescrollyspeed; return true; } - else if (menupres[menutype].bghide && titlemapinaction) // hide the background + else if (gamestate != GS_TIMEATTACK && menupres[menutype].bghide && titlemapinaction) // hide the background { curbghide = true; return true; @@ -2309,7 +2311,7 @@ static boolean MIT_SetCurBackground(UINT32 menutype, INT32 level, INT32 *retval, { if (M_GetYoungestChildMenu() == MN_SP_PLAYER || !defaultname || !defaultname[0]) curbgcolor = 31; - else if (titlemapinaction) // hide the background by default in titlemap + else if (gamestate != GS_TIMEATTACK && titlemapinaction) // hide the background by default in titlemap curbghide = true; else { @@ -2469,7 +2471,7 @@ static void M_HandleMenuPresState(menu_t *newMenu) curbgcolor = -1; curbgxspeed = titlescrollxspeed; curbgyspeed = titlescrollyspeed; - curbghide = true; + curbghide = (gamestate != GS_TIMEATTACK); // show in time attack, hide in other menus // don't do the below during the in-game menus if (gamestate != GS_TITLESCREEN && gamestate != GS_TIMEATTACK) diff --git a/src/m_menu.h b/src/m_menu.h index 04146ebdc..06631dc39 100644 --- a/src/m_menu.h +++ b/src/m_menu.h @@ -123,7 +123,7 @@ typedef enum typedef struct { - char bgname[8]; // name for background gfx lump; lays over titlemap if this is set + char bgname[9]; // name for background gfx lump; lays over titlemap if this is set SINT8 hidetitlepics; // hide title gfx per menu; -1 means undefined, inherits global setting INT32 titlescrollxspeed; // background gfx scroll per menu; inherits global setting INT32 titlescrollyspeed; // y scroll From a1e6f5bdb3406e578c5082908a03b15b592e5450 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 14 Jul 2019 22:28:19 +0100 Subject: [PATCH 6/9] remove some of the GS_TIMEATTACK hacks I added because I now realise I can just turn titlemapinaction off when entering the menus \o/ --- src/m_menu.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index 53e0182fd..932df65fe 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -2302,7 +2302,7 @@ static boolean MIT_SetCurBackground(UINT32 menutype, INT32 level, INT32 *retval, curbgyspeed = menupres[menutype].titlescrollyspeed != INT32_MAX ? menupres[menutype].titlescrollyspeed : titlescrollyspeed; return true; } - else if (gamestate != GS_TIMEATTACK && menupres[menutype].bghide && titlemapinaction) // hide the background + else if (menupres[menutype].bghide && titlemapinaction) // hide the background { curbghide = true; return true; @@ -2311,7 +2311,7 @@ static boolean MIT_SetCurBackground(UINT32 menutype, INT32 level, INT32 *retval, { if (M_GetYoungestChildMenu() == MN_SP_PLAYER || !defaultname || !defaultname[0]) curbgcolor = 31; - else if (gamestate != GS_TIMEATTACK && titlemapinaction) // hide the background by default in titlemap + else if (titlemapinaction) // hide the background by default in titlemap curbghide = true; else { @@ -8236,6 +8236,7 @@ static void M_TimeAttack(INT32 choice) M_PatchSkinNameTable(); G_SetGamestate(GS_TIMEATTACK); // do this before M_SetupNextMenu so that menu meta state knows that we're switching + titlemapinaction = TITLEMAP_OFF; // Nope don't give us HOMs please M_SetupNextMenu(&SP_TimeAttackDef); if (!M_CanShowLevelInList(cv_nextmap.value-1, -1) && levelselect.rows[0].maplist[0]) CV_SetValue(&cv_nextmap, levelselect.rows[0].maplist[0]); @@ -8417,6 +8418,7 @@ static void M_NightsAttack(INT32 choice) G_SetGamestate(GS_TIMEATTACK); // do this before M_SetupNextMenu so that menu meta state knows that we're switching M_SetupNextMenu(&SP_NightsAttackDef); + titlemapinaction = TITLEMAP_OFF; // Nope don't give us HOMs please if (!M_CanShowLevelInList(cv_nextmap.value-1, -1) && levelselect.rows[0].maplist[0]) CV_SetValue(&cv_nextmap, levelselect.rows[0].maplist[0]); else From d44a8ab78ef5869575f545184f5147b39117cd20 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 14 Jul 2019 22:36:14 +0100 Subject: [PATCH 7/9] Slightly unrelated tweak: bghide && titlemapinaction clearly takes precedence over bgname if both are present, so reorder these if statement blocks --- src/m_menu.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index 932df65fe..adf2e0cdb 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -2295,18 +2295,18 @@ static boolean MIT_SetCurBackground(UINT32 menutype, INT32 level, INT32 *retval, curbgcolor = menupres[menutype].bgcolor; return true; } - else if (menupres[menutype].bgname[0] && (!menupres[menutype].bghide || !titlemapinaction)) + else if (menupres[menutype].bghide && titlemapinaction) // hide the background + { + curbghide = true; + return true; + } + else if (menupres[menutype].bgname[0]) { strncpy(curbgname, menupres[menutype].bgname, 8); curbgxspeed = menupres[menutype].titlescrollxspeed != INT32_MAX ? menupres[menutype].titlescrollxspeed : titlescrollxspeed; curbgyspeed = menupres[menutype].titlescrollyspeed != INT32_MAX ? menupres[menutype].titlescrollyspeed : titlescrollyspeed; return true; } - else if (menupres[menutype].bghide && titlemapinaction) // hide the background - { - curbghide = true; - return true; - } else if (!level) { if (M_GetYoungestChildMenu() == MN_SP_PLAYER || !defaultname || !defaultname[0]) From 5ef4dda9b933e4a117582c78b259300f52a5ab27 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 15 Jul 2019 20:25:57 +0100 Subject: [PATCH 8/9] Instead of ignoring blank menutypes in M_IterateMenuTree, ignore them in the MIT_ functions instead. (I'm doing this because MIT_GetMenuAtLevel appears to actually care about whether menutype is zero or not unlike the others; I don't want to break the code designed around that) --- src/m_menu.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index adf2e0cdb..d9d3a6ba0 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -2247,8 +2247,6 @@ static INT32 M_IterateMenuTree(menutree_iterator itfunc, void *input) { bitmask = ((1 << MENUBITS) - 1) << (MENUBITS*i); menutype = (activeMenuId & bitmask) >> (MENUBITS*i); - if (!menutype) - continue; if (itfunc(menutype, i, &retval, &input, false)) break; } @@ -2290,6 +2288,9 @@ static boolean MIT_SetCurBackground(UINT32 menutype, INT32 level, INT32 *retval, (void)retval; (void)fromoldest; + if (!menutype) // if there's nothing in this level, do nothing + return false; + if (menupres[menutype].bgcolor >= 0) { curbgcolor = menupres[menutype].bgcolor; @@ -2330,6 +2331,9 @@ static boolean MIT_ChangeMusic(UINT32 menutype, INT32 level, INT32 *retval, void (void)retval; (void)fromoldest; + if (!menutype) // if there's nothing in this level, do nothing + return false; + if (menupres[menutype].musname[0]) { S_ChangeMusic(menupres[menutype].musname, menupres[menutype].mustrack, menupres[menutype].muslooping); @@ -2354,6 +2358,9 @@ static boolean MIT_SetCurFadeValue(UINT32 menutype, INT32 level, INT32 *retval, (void)retval; (void)fromoldest; + if (!menutype) // if there's nothing in this level, do nothing + return false; + if (menupres[menutype].fadestrength >= 0) { curfadevalue = (menupres[menutype].fadestrength % 32); @@ -2370,6 +2377,9 @@ static boolean MIT_SetCurHideTitlePics(UINT32 menutype, INT32 level, INT32 *retv (void)retval; (void)fromoldest; + if (!menutype) // if there's nothing in this level, do nothing + return false; + if (menupres[menutype].hidetitlepics >= 0) { curhidepics = menupres[menutype].hidetitlepics; From 0f8c046c6f1a0d408d13173905fc2c40506e558c Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 20 Jul 2019 16:30:30 +0100 Subject: [PATCH 9/9] On second thoughts I'll go back to 8 for length in these variables, since as far as I can tell the code doesn't need it to be longer anyway --- src/f_finale.c | 2 +- src/f_finale.h | 2 +- src/m_menu.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/f_finale.c b/src/f_finale.c index 134bc9fcc..27c9ebd68 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -67,7 +67,7 @@ static INT32 menuanimtimer; // Title screen: background animation timing mobj_t *titlemapcameraref = NULL; // menu presentation state -char curbgname[9]; +char curbgname[8]; SINT8 curfadevalue; boolean curhidepics; INT32 curbgcolor; diff --git a/src/f_finale.h b/src/f_finale.h index 663a45412..c0c6360c3 100644 --- a/src/f_finale.h +++ b/src/f_finale.h @@ -84,7 +84,7 @@ typedef enum extern UINT8 titlemapinaction; extern mobj_t *titlemapcameraref; -extern char curbgname[9]; +extern char curbgname[8]; extern SINT8 curfadevalue; extern boolean curhidepics; extern INT32 curbgcolor; diff --git a/src/m_menu.h b/src/m_menu.h index 06631dc39..04146ebdc 100644 --- a/src/m_menu.h +++ b/src/m_menu.h @@ -123,7 +123,7 @@ typedef enum typedef struct { - char bgname[9]; // name for background gfx lump; lays over titlemap if this is set + char bgname[8]; // name for background gfx lump; lays over titlemap if this is set SINT8 hidetitlepics; // hide title gfx per menu; -1 means undefined, inherits global setting INT32 titlescrollxspeed; // background gfx scroll per menu; inherits global setting INT32 titlescrollyspeed; // y scroll