From 950a02b7b39ef2587fa2cf1873fb227df4816a24 Mon Sep 17 00:00:00 2001 From: Alaux <73968015+MrAlaux@users.noreply.github.com> Date: Sun, 13 Aug 2023 03:54:27 -0300 Subject: [PATCH] Implement "Announce Milestone Completion" setting --- CHANGELOG.md | 5 +++-- README.md | 3 ++- src/doomstat.c | 1 + src/doomstat.h | 5 +++++ src/g_game.c | 1 + src/m_cheat.c | 6 +++++- src/m_menu.c | 5 +++++ src/m_misc.c | 7 +++++++ src/p_inter.c | 24 +++++++++++++++++++++++- src/p_setup.c | 6 ++++++ src/p_spec.c | 31 ++++++++++++++++++++++++------- 11 files changed, 82 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 51548e704..b9e977e36 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,11 +3,12 @@ ## New Features - **Horizontal Weapon Centering** setting -- **Switch [Weapon] on Pickup** setting -- **Blink Missing Keys** setting +- **_Switch [Weapon] on Pickup_** setting +- **_Blink Missing Keys_** setting - **Support for Crispy Doom's optional sounds** - **NUGHUD armor icon** - **Customizable Stats text colors** +- **_Announce Milestone Completion_** setting - **Customizable dark menu background/dark Automap overlay darkening** - **Woof savegame compatibility** diff --git a/README.md b/README.md index 70872e5db..c25ba5bd0 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,7 @@ A few settings are labeled as _**CFG-Only**_: they can only be toggled by editin - **Show Powerup Timers** setting - _**Alternative Arms Display**_ setting, to show the Chainsaw or SSG's availability on the Arms widget in place of the trivial Pistol (CFG-Only: `alt_arms`) - _**Smart Totals**_ setting [p.f. So Doom] -- _**(In)complete Milestone Color**_ choice, to customize the Stats text's colors +- _**(In)complete Milestone Color**_ choices, to customize the Stats text's colors - **Event Timers:** - _"Use" Button Timer_ [p.f. Crispy Doom]; - _Teleport Timer_ [i.b. the above]; @@ -101,6 +101,7 @@ A few settings are labeled as _**CFG-Only**_: they can only be toggled by editin ### Messages - **Secret count in "secret revealed" message** [p.f. Crispy Doom] +- _**Announce Milestone Completion**_ setting, to report completion of milestones (e.g. all items acquired) - Restored _**Message Listing Scrolls Upwards**_ setting, and enabled it by default ### Doom Compatibility diff --git a/src/doomstat.c b/src/doomstat.c index 5e672b94c..44cdb7231 100644 --- a/src/doomstat.c +++ b/src/doomstat.c @@ -201,6 +201,7 @@ int automap_overlay_darkening; // Misc int zoom_fov; +int announce_milestones; int nugget_comp[NUGGET_COMP_TOTAL], default_nugget_comp[NUGGET_COMP_TOTAL]; diff --git a/src/doomstat.h b/src/doomstat.h index 0b6aca9af..6cedff8fe 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -271,6 +271,10 @@ extern int extrakills; // [Nugget]: [So Doom] count kills of resurrected and (r extern int totalitems; extern int totalsecret; +// [Nugget] +typedef enum { MILESTONE_KILLS = 0x1, MILESTONE_ITEMS = 0x2, MILESTONE_SECRETS = 0x4, } milestone_t; +extern milestone_t complete_milestones; + // Timer, for scores. extern int levelstarttic; // gametic at level start extern int basetic; // killough 9/29/98: levelstarttic, adjusted @@ -534,6 +538,7 @@ extern int automap_overlay_darkening; // Misc extern int zoom_fov; +extern int announce_milestones; enum { comp_blazing2, diff --git a/src/g_game.c b/src/g_game.c index b6fcff2b6..33a63b2f1 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -110,6 +110,7 @@ int basetic; // killough 9/29/98: for demo sync int totalkills, totalitems, totalsecret; // for intermission int extraspawns; // [Nugget]: [crispy] count spawned monsters int extrakills; // [Nugget]: [So Doom] count deaths of resurrected and (re)spawned monsters +milestone_t complete_milestones; // [Nugget] int totalleveltimes; // [FG] total time for all completed levels boolean demorecording; boolean longtics; // cph's doom 1.91 longtics hack diff --git a/src/m_cheat.c b/src/m_cheat.c index 3d874c630..a0d1f64a6 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -1197,11 +1197,15 @@ static void cheat_massacre() // jff 2/01/98 kill all monsters // killough 7/20/98: kill friendly monsters only if no others to kill int mask = MF_FRIEND; - // [Nugget] Temporarily disable Bloodier Gibbing if enabled; + // [Nugget] + + // Temporarily disable Bloodier Gibbing if enabled; // it's too much to handle on maps with many monsters int oldgibbing = bloodier_gibbing; bloodier_gibbing = false; + complete_milestones |= MILESTONE_KILLS; // Don't announce + P_MapStart(); do while ((currentthinker=currentthinker->next)!=&thinkercap) diff --git a/src/m_menu.c b/src/m_menu.c index 4bb72b83a..3a2269434 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -4956,6 +4956,7 @@ void M_DrawCompat(void) enum { mess_secret, + mess_milestones, // [Nugget] mess_showtoggle, mess_showpickup, mess_stub1, @@ -4995,6 +4996,10 @@ setup_menu_t mess_settings1[] = // Messages screen {"\"A Secret is Revealed!\" Message", S_CHOICE, m_null, M_X, M_Y + mess_secret*M_SPC, {"hud_secret_message"}, 0, NULL, secretmessage_str}, // [Nugget] + // [Nugget] + {"Announce Milestone Completion", S_YESNO, m_null, M_X, + M_Y + mess_milestones*M_SPC, {"announce_milestones"}}, + {"Show Toggle Messages", S_YESNO, m_null, M_X, M_Y + mess_showtoggle*M_SPC, {"show_toggle_messages"}}, diff --git a/src/m_misc.c b/src/m_misc.c index 2b8555710..dc5a29b3c 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -2976,6 +2976,13 @@ default_t defaults[] = { "\"A secret is revealed!\" message" }, + { // [Nugget] Announce milestone completion + "announce_milestones", + (config_t *) &announce_milestones, NULL, + {0}, {0,1}, number, ss_mess, wad_no, + "1 to announce completion of milestones" + }, + { // red range "hudcolor_mesg", (config_t *) &hudcolor_mesg, NULL, diff --git a/src/p_inter.c b/src/p_inter.c index dd24afcb7..c5d531974 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -674,8 +674,19 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher) return; // killough 12/98: suppress error message } - if (special->flags & MF_COUNTITEM) + if (special->flags & MF_COUNTITEM) { player->itemcount++; + // [Nugget] Announce milestone completion + if (!(complete_milestones & MILESTONE_ITEMS) + && (player->itemcount >= totalitems)) + { + complete_milestones |= MILESTONE_ITEMS; + if (announce_milestones) { + player->secretmessage = "All items acquired!"; + S_StartSound(NULL, sfx_secret); + } + } + } P_RemoveMobj (special); player->bonuscount += BONUSADD; // [Nugget] Bonuscount cap @@ -833,6 +844,17 @@ static void P_KillMobj(mobj_t *source, mobj_t *target) } #endif + // [Nugget] Announce milestone completion + if (!(complete_milestones & MILESTONE_KILLS) + && (players->killcount - (smarttotals ? extrakills : extraspawns) >= totalkills)) + { + complete_milestones |= MILESTONE_KILLS; + if (announce_milestones) { + players->secretmessage = "All enemies killed!"; + S_StartSound(NULL, sfx_secret); + } + } + if (target->player) { // count environment kills against you diff --git a/src/p_setup.c b/src/p_setup.c index a490ad6ef..d963ee40f 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -428,6 +428,12 @@ void P_LoadThings (int lump) P_SpawnMapThing (mt); } + // [Nugget] Reset milestones + if (totalkills) { complete_milestones &= ~MILESTONE_KILLS; } + else { complete_milestones |= MILESTONE_KILLS; } + if (totalitems) { complete_milestones &= ~MILESTONE_ITEMS; } + else { complete_milestones |= MILESTONE_ITEMS; } + Z_Free (data); } diff --git a/src/p_spec.c b/src/p_spec.c index 171af80f1..9ef318952 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2157,15 +2157,28 @@ int disable_nuke; // killough 12/98: nukage disabling cheat static void P_SecretRevealed(player_t *player) { - if (hud_secret_message && player == &players[consoleplayer]) + if (player == &players[consoleplayer]) { - static char str_count[32]; // [Nugget] + // [Nugget] Announce milestone completion + if (!(complete_milestones & MILESTONE_SECRETS) + && player->secretcount >= totalsecret) + { + complete_milestones |= MILESTONE_SECRETS; + if (announce_milestones) { + player->secretmessage = "All secrets revealed!"; + S_StartSound(NULL, sfx_secret); + return; // Skip the normal "Secret revealed" message + } + } - // [Nugget] Secret count in secret revealed message, from Crispy Doom - M_snprintf(str_count, sizeof(str_count), "Secret %d of %d revealed!", player->secretcount, totalsecret); - player->secretmessage = (hud_secret_message == secretmessage_count) ? str_count : s_HUSTR_SECRETFOUND; - - S_StartSound(NULL, sfx_secret); + if (hud_secret_message) { + // [Nugget] Secret count in secret revealed message, from Crispy Doom + static char str_count[32]; + M_snprintf(str_count, sizeof(str_count), "Secret %d of %d revealed!", player->secretcount, totalsecret); + + player->secretmessage = (hud_secret_message == secretmessage_count) ? str_count : s_HUSTR_SECRETFOUND; + S_StartSound(NULL, sfx_secret); + } } } @@ -2532,6 +2545,10 @@ void P_SpawnSpecials (void) } } + // [Nugget] Reset milestones + if (totalsecret) { complete_milestones &= ~MILESTONE_SECRETS; } + else { complete_milestones |= MILESTONE_SECRETS; } + P_RemoveAllActiveCeilings(); // jff 2/22/98 use killough's scheme P_RemoveAllActivePlats(); // killough