From 9fd1100d8d43128b84d9a14e9431fb3d3e35410b Mon Sep 17 00:00:00 2001 From: Fabian Greffrath Date: Wed, 15 Feb 2023 08:26:28 +0100 Subject: [PATCH] add support for loading Doom (< 1.2) IWADs (#905) * add support for loading Doom (< 1.2) IWADs * allow to choose Nightmare skill from the menu --- src/i_sound.c | 25 +++++++++++++++++++++++++ src/m_menu.c | 10 +++++----- src/p_spec.c | 12 +----------- src/st_stuff.c | 20 +++++++++++++++++++- 4 files changed, 50 insertions(+), 17 deletions(-) diff --git a/src/i_sound.c b/src/i_sound.c index 0a9044e2..f1bd8045 100644 --- a/src/i_sound.c +++ b/src/i_sound.c @@ -648,6 +648,17 @@ static int GetSliceSize(void) return 1024; } +// [FG] add links for likely missing sounds + +struct { + const int from, to; +} static const sfx_subst[] = { + {sfx_secret, sfx_itmbk}, + {sfx_itmbk, sfx_getpow}, + {sfx_getpow, sfx_itemup}, + {sfx_itemup, sfx_None}, +}; + // // I_InitSound // @@ -705,6 +716,20 @@ void I_InitSound(void) } StopChannel(0); printf("done.\n"); + + // [FG] add links for likely missing sounds + for (i = 0; i < arrlen(sfx_subst); i++) + { + sfxinfo_t *from = &S_sfx[sfx_subst[i].from], + *to = &S_sfx[sfx_subst[i].to]; + + if (from->lumpnum == -1) + { + from->link = to; + from->pitch = NORM_PITCH; + from->volume = 0; + } + } } } } diff --git a/src/m_menu.c b/src/m_menu.c index 57202b17..974cf6b3 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -686,11 +686,11 @@ enum menuitem_t NewGameMenu[]= { - {1,"M_JKILL", M_ChooseSkill, 'i'}, - {1,"M_ROUGH", M_ChooseSkill, 'h'}, - {1,"M_HURT", M_ChooseSkill, 'h'}, - {1,"M_ULTRA", M_ChooseSkill, 'u'}, - {1,"M_NMARE", M_ChooseSkill, 'n'} + {1,"M_JKILL", M_ChooseSkill, 'i', "I'm too young to die."}, + {1,"M_ROUGH", M_ChooseSkill, 'h', "Hey, not too rough."}, + {1,"M_HURT", M_ChooseSkill, 'h', "Hurt me plenty."}, + {1,"M_ULTRA", M_ChooseSkill, 'u', "Ultra-Violence."}, + {1,"M_NMARE", M_ChooseSkill, 'n', "Nightmare!"} }; menu_t NewDef = diff --git a/src/p_spec.c b/src/p_spec.c index f8915ce6..e9ca6cb1 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2092,18 +2092,8 @@ static void P_SecretRevealed(player_t *player) if (hud_secret_message && player == &players[consoleplayer]) { - static int sfx_id = -1; player->secretmessage = s_HUSTR_SECRETFOUND; - - if (sfx_id == -1) - { - sfx_id = I_GetSfxLumpNum(&S_sfx[sfx_secret]) >= 0 ? sfx_secret : - I_GetSfxLumpNum(&S_sfx[sfx_itmbk]) >= 0 ? sfx_itmbk : - -2; - } - - if (sfx_id >= 0) - S_StartSound(NULL, sfx_id); + S_StartSound(NULL, sfx_secret); } } diff --git a/src/st_stuff.c b/src/st_stuff.c index adcd0b15..4991cc59 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -241,6 +241,9 @@ static boolean st_fragson; // main bar left static patch_t *sbar; +// main bar right, for doom 1.0 +static patch_t *sbarr; + // 0-9, tall numbers static patch_t *tallnum[10]; @@ -451,6 +454,10 @@ void ST_refreshBackground(boolean force) // [crispy] center unity rerelease wide status bar V_DrawPatch(st_x, 0, BG, sbar); + // draw right side of bar if needed (Doom 1.0) + if (sbarr) + V_DrawPatch(ST_ARMSBGX, 0, BG, sbarr); + if (st_notdeathmatch) V_DrawPatch(ST_ARMSBGX, 0, BG, armsbg); @@ -1048,7 +1055,16 @@ void ST_loadGraphics(void) } // status bar background bits - sbar = (patch_t *) W_CacheLumpName("STBAR", PU_STATIC); + if (W_CheckNumForName("STBAR") >= 0) + { + sbar = (patch_t *) W_CacheLumpName("STBAR", PU_STATIC); + sbarr = NULL; + } + else + { + sbar = (patch_t *) W_CacheLumpName("STMBARL", PU_STATIC); + sbarr = (patch_t *) W_CacheLumpName("STMBARR", PU_STATIC); + } // face states facenum = 0; @@ -1119,6 +1135,8 @@ void ST_unloadGraphics(void) Z_ChangeTag(keys[i], PU_CACHE); Z_ChangeTag(sbar, PU_CACHE); + if (sbarr) + Z_ChangeTag(sbarr, PU_CACHE); // killough 3/7/98: free each face background color for (i=0;i