Skip to content

Commit

Permalink
"Use" button, teleport and key pickup timers
Browse files Browse the repository at this point in the history
  • Loading branch information
MrAlaux committed Apr 29, 2023
1 parent b394405 commit 90e1a43
Show file tree
Hide file tree
Showing 11 changed files with 104 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

- **_"Fade"_ screen wipe**
- _**Teleporter Zoom**_ setting
- _**"Use" Button Timer**_ setting
- _**Teleport Timer**_ setting
- _**Key Pickup Timer**_ setting

## Changes

Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ A few settings are labeled as _**CFG-Only**_: they can only be toggled by editin
- _**Subtle Idle Bobbing/Breathing**_ setting [p.f. International Doom]
- _**Teleporter Zoom**_ setting [i.b. ZDoom]
- _**Sound Clipping Distance**_ selection, to optionally double the distance at which SFX become audible
- **Event Timers:**
- _"Use" Button Timer_ [p.f. Crispy Doom];
- _Teleport Timer_ [i.b. the above];
- _Key Pickup Timer_ [same as above].
- _**One-Key Quick Save/Load**_ setting, to skip the confirmation prompt
- Setting of condition to _**Advance Internal Demos**_
- _**Quick "Quit Game"**_ setting, to skip the confirmation prompt [p.f. Crispy Doom]
Expand Down
4 changes: 4 additions & 0 deletions src/d_player.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,12 @@ typedef struct player_s
// as view and weapon bobbing have been separated

// [Nugget]

int jumpTics; // Jumping delay
fixed_t crouchOffset; // Viewheight offset, for crouching

// Momentarily display the time at which an event occurred
int event_type, event_time, event_tics;

} player_t;

Expand Down
3 changes: 3 additions & 0 deletions src/doomstat.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ int breathing;
int teleporter_zoom;
int s_clipping_dist_x2;
// Page 5
int timer_use;
int timer_teleport;
int timer_key_pickup;
int one_key_saveload;
int no_page_ticking;
int quick_quitgame;
Expand Down
4 changes: 4 additions & 0 deletions src/doomstat.h
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,10 @@ extern int breathing;
extern int teleporter_zoom;
extern int s_clipping_dist_x2;
// Page 5
enum { TIMER_USE = 1, TIMER_TELEPORT, TIMER_KEYPICKUP, };
extern int timer_use;
extern int timer_teleport;
extern int timer_key_pickup;
extern int one_key_saveload;
extern int no_page_ticking;
extern int quick_quitgame;
Expand Down
21 changes: 20 additions & 1 deletion src/hu_stuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -1323,7 +1323,8 @@ void HU_Drawer(void)
}

// [FG] draw level time widget
if ((automapactive && map_level_time == 1) || map_level_time == 2)
if ((automapactive && map_level_time == 1) || map_level_time == 2
|| plr->event_tics) // [Nugget] Event timer
{
HUlib_drawTextLine(&w_ltime, false);
}
Expand Down Expand Up @@ -2040,6 +2041,24 @@ void HU_Ticker(void)
while (*s)
HUlib_addCharToTextLine(&w_ltime, *s++);
}

// [Nugget] Event timer overrides the level time widget
if (plr->event_tics) {
const int type = plr->event_type;
const int mins = plr->event_time / (60 * TICRATE);
const float secs = (float)(plr->event_time % (60 * TICRATE)) / TICRATE;

if (!plr->event_tics--) { plr->event_type = plr->event_time = 0; }

sprintf(hud_ltime, "%c %02i:%05.02f",
type == TIMER_KEYPICKUP ? 'K' : type == TIMER_TELEPORT ? 'T' : 'U',
mins, secs);

HUlib_clearTextLine(&w_ltime);
s = hud_ltime;
while (*s)
HUlib_addCharToTextLine(&w_ltime, *s++);
}
}

if (hud_timests && ((scaledviewheight < SCREENHEIGHT)
Expand Down
19 changes: 19 additions & 0 deletions src/m_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -4363,6 +4363,9 @@ setup_menu_t gen_settings4[] = { // [Nugget]

enum { // [Nugget]
gen5_title1,
gen5_timeruse,
gen5_timertelept,
gen5_timerkey,
gen5_quicksaveload,
gen5_nopagetic,
gen5_quickexit,
Expand All @@ -4378,9 +4381,16 @@ enum { // [Nugget]
gen5_a11y_invul,
};

static const char *timer_strings[] = {
"Off", "In Demos", "Always", NULL
};

setup_menu_t gen_settings5[] = { // [Nugget]

{"Nugget Settings", S_SKIP|S_TITLE, m_null, M_X, M_Y + gen5_title1 * M_SPC},
{"\"Use\" Button Timer", S_CHOICE, m_null, M_X, M_Y + gen5_timeruse * M_SPC, {"timer_use"}, 0, NULL, timer_strings},
{"Teleport Timer", S_CHOICE, m_null, M_X, M_Y + gen5_timertelept * M_SPC, {"timer_teleport"}, 0, NULL, timer_strings},
{"Key Pickup Timer", S_CHOICE, m_null, M_X, M_Y + gen5_timerkey * M_SPC, {"timer_key_pickup"}, 0, NULL, timer_strings},
{"One-Key Quick Save/Load", S_YESNO, m_null, M_X, M_Y + gen5_quicksaveload * M_SPC, {"one_key_saveload"}},
{"Advance Internal Demos", S_CHOICE, m_null, M_X, M_Y + gen5_nopagetic * M_SPC, {"no_page_ticking"}, 0, NULL, page_ticking_conds},
{"Quick \"Quit Game\"", S_YESNO, m_null, M_X, M_Y + gen5_quickexit * M_SPC, {"quick_quitgame"}},
Expand Down Expand Up @@ -7335,20 +7345,28 @@ static void M_UpdateStrictModeItems(void)

for (int i = gen4_menutint; i <= gen4_berserktint; i++)
{ DISABLE_STRICT(gen_settings4[i]); }

DISABLE_ITEM(!casual_play, gen_settings4[gen4_overunder]);
DISABLE_ITEM(!casual_play, gen_settings4[gen4_jump_crouch]);

for (int i = gen4_viewheight; i <= gen4_sclipdist; i++)
{ DISABLE_STRICT(gen_settings4[i]); }

DISABLE_STRICT(gen_settings5[gen5_timertelept]);
DISABLE_STRICT(gen_settings5[gen5_timerkey]);

for (int i = gen5_level_brightness; i <= gen5_a11y_invul; i++)
{ DISABLE_STRICT(gen_settings5[i]); }

for (int i = comp4_lscollision; i <= comp4_iosdeath; i++)
{ DISABLE_ITEM(!casual_play, comp_settings4[i]); }

for (int i = comp5_blazing2; i <= comp5_keypal; i++)
{ DISABLE_STRICT(comp_settings5[i]); }

DISABLE_ITEM(!casual_play, weap_settings1[weap1_autoaim]);
M_UpdateFreeaimItem();

DISABLE_STRICT(weap_settings2[weap2_bobstyle]);
DISABLE_STRICT(weap_settings2[weap2_squat]);

Expand All @@ -7358,6 +7376,7 @@ static void M_UpdateStrictModeItems(void)

for (int i = enem1_extra_gibbing; i <= enem1_zdoom_drops; i++)
{ DISABLE_ITEM(!casual_play, enem_settings1[i]); }

DISABLE_STRICT(enem_settings2[enem2_fuzzdark]);
}

Expand Down
21 changes: 21 additions & 0 deletions src/m_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,27 @@ default_t defaults[] = {
"1 to double the sound clipping distance"
},

{
"timer_use",
(config_t *) &timer_use, NULL,
{0}, {0,2}, number, ss_gen, wad_no,
"Show time at which Use was pressed (0 = Off, 1 = In Demos, 2 = Always)"
},

{
"timer_teleport",
(config_t *) &timer_teleport, NULL,
{0}, {0,2}, number, ss_gen, wad_no,
"Show time at which a teleporter was used (0 = Off, 1 = In Demos, 2 = Always)"
},

{
"timer_key_pickup",
(config_t *) &timer_key_pickup, NULL,
{0}, {0,2}, number, ss_gen, wad_no,
"Show time at which a key was picked up (0 = Off, 1 = In Demos, 2 = Always)"
},

{
"one_key_saveload",
(config_t *) &one_key_saveload, NULL,
Expand Down
10 changes: 10 additions & 0 deletions src/p_inter.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,12 +259,22 @@ void P_GiveCard(player_t *player, card_t card)
{
if (player->cards[card])
return;

// [Nugget] Fix for "key pickup resets palette"
if (STRICTMODE(!nugget_comp[comp_keypal]))
{ player->bonuscount += BONUSADD; }
else
{ player->bonuscount = BONUSADD; }

player->cards[card] = 1;

// [Nugget] Key pickup timer
if (STRICTMODE(timer_key_pickup == 2 || (timer_key_pickup && (demorecording||demoplayback))))
{
player->event_type = TIMER_KEYPICKUP;
player->event_time = leveltime;
player->event_tics = 5*TICRATE/2; // [crispy] 2.5 seconds
}
}

//
Expand Down
8 changes: 8 additions & 0 deletions src/p_telept.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@ int EV_Teleport(line_t *line, int side, mobj_t *thing)
// [crispy] center view after teleporting
player->centering = true;

// [Nugget] Teleport timer
if (STRICTMODE(timer_teleport == 2 || (timer_teleport && (demorecording||demoplayback))))
{
player->event_type = TIMER_TELEPORT;
player->event_time = leveltime;
player->event_tics = 5*TICRATE/2; // [crispy] 2.5 seconds
}

// [Nugget] Teleporter zoom
if (STRICTMODE(teleporter_zoom)) {
fovfx[FOVFX_TELEPORT] = 55; // Actually, 50 is applied
Expand Down
8 changes: 8 additions & 0 deletions src/p_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,14 @@ void P_PlayerThink (player_t* player)
{
P_UseLines (player);
player->usedown = true;

// [Nugget] Key pickup timer
if (timer_use == 2 || (timer_use && (demorecording||demoplayback)))
{
player->event_type = TIMER_USE;
player->event_time = leveltime;
player->event_tics = 5*TICRATE/2; // [crispy] 2.5 seconds
}
}
}
else
Expand Down

0 comments on commit 90e1a43

Please sign in to comment.