Skip to content

Commit

Permalink
Implement "Announce Milestone Completion" setting
Browse files Browse the repository at this point in the history
  • Loading branch information
MrAlaux committed Aug 13, 2023
1 parent 913b3d3 commit 950a02b
Show file tree
Hide file tree
Showing 11 changed files with 82 additions and 12 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**

Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/doomstat.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];

Expand Down
5 changes: 5 additions & 0 deletions src/doomstat.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -534,6 +538,7 @@ extern int automap_overlay_darkening;

// Misc
extern int zoom_fov;
extern int announce_milestones;

enum {
comp_blazing2,
Expand Down
1 change: 1 addition & 0 deletions src/g_game.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion src/m_cheat.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions src/m_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -4956,6 +4956,7 @@ void M_DrawCompat(void)

enum {
mess_secret,
mess_milestones, // [Nugget]
mess_showtoggle,
mess_showpickup,
mess_stub1,
Expand Down Expand Up @@ -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"}},

Expand Down
7 changes: 7 additions & 0 deletions src/m_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
24 changes: 23 additions & 1 deletion src/p_inter.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions src/p_setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
31 changes: 24 additions & 7 deletions src/p_spec.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 950a02b

Please sign in to comment.