Skip to content

Commit

Permalink
Slow Motion button and hitscan-trails cheat
Browse files Browse the repository at this point in the history
Additionally, some readme rewording.
  • Loading branch information
MrAlaux committed Oct 27, 2024
1 parent 6acdf9d commit bc90bf9
Show file tree
Hide file tree
Showing 17 changed files with 315 additions and 33 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## New Features

None.
- **_Slow Motion_ button**
- **_'TRAILS'_ cheat**, to show hitscan trails

## Changes

Expand Down
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ For these settings, their CVAR names are provided alongside the _CFG-only_ label
- _Previous/Next Weapon_ to adjust the camera's movement speed
- Rapid _Strafe On_ double-press to center the camera vertically
- **_Chasecam_** [i.b. ZDoom]
- **Slow Motion** button
- **Zoom** button
- **_Background for all menus_** setting
- **_No palette tint in menus_** setting [i.b. Crispy Doom]
- **_HUD/Menu Shadows_** setting (translucency determined by the CFG-only `hud_menu_shadows_filter_pct` CVAR) [i.b. CRL]
Expand Down Expand Up @@ -85,7 +87,7 @@ For these settings, their CVAR names are provided alongside the _CFG-only_ label
- **_Switch [Weapon] on Pickup_** setting
- **_Allow [Weapon] Switch Interruption_** setting
- **_Prev/Next Skip Ammoless Weapons_** setting, to make the previous/next-weapon buttons skip weapons with insufficient ammo
- Key to **equip last used weapon** [i.b. Cherry Doom]
- Button to **equip last used weapon** [i.b. Cherry Doom]
- **_Horizontal_ Weapon Centering** setting [i.b. DSDA-Doom]
- **Always Bob** setting (CFG-only: `always_bob`)
- **_Bobbing Styles_** selection [p.f. Zandronum]
Expand All @@ -103,7 +105,7 @@ For these settings, their CVAR names are provided alongside the _CFG-only_ label
- Vertical-only target lock-on;
- Horizontal-autoaim indicators;
- Option to account for fuzzy targets [i.b. From Doom With Love];
- Dedicated toggle key.
- Dedicated toggle button.
- **Secret count in "secret revealed" message** [p.f. Crispy Doom]
- **Show Save Messages** setting (CFG-only: `show_save_messages`)
- **_Milestone-Completion Announcements_** setting, to report completion of milestones (e.g. all items acquired)
Expand All @@ -129,9 +131,9 @@ For these settings, their CVAR names are provided alongside the _CFG-only_ label
### Automap

- **Minimap mode** [i.b. DSDA-Doom]
- Key to **_Highlight Points of Interest_**; marks and keyed lines (default: <kbd>B</kbd>)
- **_Tag Finder_**: Position the Automap pointer over a sector and press the _Tag Finder_ key to highlight its activator line(s), and vice versa [p.f. PrBoomX]
- Key to **_Teleport to Automap pointer_**
- Button to **_Highlight Points of Interest_**; marks and keyed lines (default: <kbd>B</kbd>)
- **_Tag Finder_**: Position the Automap pointer over a sector and press the _Tag Finder_ button to highlight its activator line(s), and vice versa [p.f. PrBoomX]
- Button to **_Teleport to Automap pointer_**
- **_Show Thing Hitboxes_** setting
- **Color for trigger lines**, used with IDDT (CFG-only: `mapcolor_trig`)

Expand Down Expand Up @@ -175,11 +177,12 @@ All of these are CFG-only, so their CVAR names are included.
- **_'VALIANT'_** for fast weapons [i.b. ZDoom]
- **_'BOBBERS'_** serves as a shortcut to toggle the two cheats mentioned above, plus IDFA
- **_'GIBBERS'_** to force gibbing on dying enemies, independently of damage dealt
- **_'IDFLY'_** to fly (uses jumping/crouching keys) [i.b. PrBoom+, ZDoom]
- **_'IDFLY'_** to fly (uses jumping/crouching buttons) [i.b. PrBoom+, ZDoom]
- **_'SUMMON'_** to spawn an actor based on its type index [i.b. ZDoom, PrBoomX]
- **_'IDDF'_** to find a key on the Automap
- **_'RESURRECT' / 'IDRES'_** to resurrect the player without toggling IDDQD [i.b. ZDoom]
- **_'LINETARGET'_** to give some info on the player's linetarget [i.b. ZDoom]
- **_'TRAILS'_** to show hitscan trails
- **_'MDK'_** to perform a hitscan attack of 1-million damage [i.b. ZDoom]
- **_'SAITAMA'_** to enable the MDK Fist
- **_'BOOMCAN'_** for explosive hitscan attacks
Expand All @@ -198,11 +201,10 @@ For more details, see the _New Nugget Doom cheats_ section of `docs/cheats.md`.

- **Customizable skill level**, supporting all vanilla settings and a new one for duplicate monster spawns
- **SDL render driver** setting (CFG-only: `sdl_renderdriver`) [p.f. Woof! 14.0.0]
- Key to **toggle zoom**
- **Setting of savegame and screenshot paths in config file** (CFG-only: `savegame_dir` and `screenshot_dir`)
- **Keep palette changes in screenshots** setting (CFG-only: `screenshot_palette`)
- **Allowed mouselook while dead**
- **Interactive character cast** (Turn keys to rotate enemy, Run key to gib, Strafe keys to skip) [p.f. Crispy Doom]
- **Interactive character cast** (Turn buttons to rotate enemy, Run button to gib, Strafe buttons to skip) [p.f. Crispy Doom]
- **Support for optional sounds:** [partially p.f. Crispy Doom]
- Jumping: `DSPLJUMP`;
- Landing: `DSPLLAND`;
Expand Down
3 changes: 3 additions & 0 deletions docs/cheats.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ This cheat functions similarly to the `KEY` cheat, with `C` and `T` specifying t
`RESURRECT` / `IDRES`
Resurrect the player without toggling IDDQD.

`TRAILS`
Enable visualization of hitscan trails.

`LINETARGET`
Toggle Linetarget Query Mode, which gives some info on the player's linetarget (i.e. the shootable thing being aimed at).

Expand Down
77 changes: 75 additions & 2 deletions src/g_game.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,44 @@ static keyframe_t *keyframe_list_head = NULL, *keyframe_list_tail = NULL;

static int keyframe_index = -1;

// Slow Motion ---------------------------------------------------------------

static boolean slow_motion = false;
static float slow_motion_factor = SLOWMO_FACTOR_NORMAL;

boolean G_GetSlowMotion(void)
{
return slow_motion;
}

void G_SetSlowMotion(const boolean value)
{
slow_motion = value;
}

void G_ResetSlowMotion(void)
{
const boolean reset_scale = slow_motion_factor != SLOWMO_FACTOR_NORMAL;

slow_motion = false;
slow_motion_factor = SLOWMO_FACTOR_NORMAL;

if (reset_scale) { G_SetTimeScale(realtic_clock_rate); }
}

float G_GetSlowMotionFactor(void)
{
return slow_motion_factor;
}

void G_SetTimeScale(int scale)
{
if (casual_play && !menuactive && slow_motion_factor != SLOWMO_FACTOR_NORMAL)
{ scale *= slow_motion_factor; }

I_SetTimeScale(scale);
}

// Custom Skill --------------------------------------------------------------

// Actual custom-skill settings, set either by menu or savegames
Expand Down Expand Up @@ -1282,6 +1320,9 @@ static void G_DoLoadLevel(void)
minimap_was_on = false;
}

// Slow Motion
G_ResetSlowMotion();

// Clear visual effects
R_ClearFOVFX();
R_SetShake(-1);
Expand Down Expand Up @@ -2189,7 +2230,12 @@ static void G_DoCompleted(void)

WI_Start (&wminfo);

// [Nugget] Clear visual effects
// [Nugget] ----------------------------------------------------------------

// Slow Motion
G_ResetSlowMotion();

// Clear visual effects
R_ClearFOVFX();
R_SetShake(-1);
}
Expand All @@ -2210,7 +2256,7 @@ static void G_DoWorldDone(void)
// [Nugget] ----------------------------------------------------------------

if (autosave) { G_DoAutosave(); } // Autosave

G_UpdateInitialLoadout(); // Custom Skill
}

Expand Down Expand Up @@ -3753,6 +3799,33 @@ void G_Ticker(void)
R_SetZoom(!R_GetZoom());
}

// Slow Motion -------------------------------------------------------------

boolean change = false;

if (slow_motion && slow_motion_factor != SLOWMO_FACTOR_TARGET)
{
slow_motion_factor -= MAX(0.025f, (slow_motion_factor - SLOWMO_FACTOR_TARGET) / 4);
slow_motion_factor = MAX(SLOWMO_FACTOR_TARGET, slow_motion_factor);
change = true;
}
else if (!slow_motion && slow_motion_factor != SLOWMO_FACTOR_NORMAL)
{
slow_motion_factor += MAX(0.025f, (SLOWMO_FACTOR_NORMAL - slow_motion_factor) / 4);
slow_motion_factor = MIN(SLOWMO_FACTOR_NORMAL, slow_motion_factor);
change = true;
}

static boolean oldmenuactive = false;

if (oldmenuactive != menuactive)
{
oldmenuactive = menuactive;
change = true;
}

if (change) { G_SetTimeScale(realtic_clock_rate); }

// Freecam -----------------------------------------------------------------

if (casual_play && R_GetFreecamMode() == FREECAM_CAM && gamestate == GS_LEVEL)
Expand Down
19 changes: 16 additions & 3 deletions src/g_game.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,18 +113,31 @@ extern int bodyquesize, default_bodyquesize; // killough 2/8/98, 10/98
extern int pars[][10]; // hardcoded array size
extern int cpars[]; // hardcoded array size

// [Nugget] ------------------------------------------------------------------
// [Nugget] ==================================================================

void G_SetAutosaveCountdown(int value); // Autosave

// Rewind
// Rewind --------------------------------------------------------------------

void G_SetRewindCountdown(int value);
void G_EnableRewind(void);
void G_Rewind(void);
void G_ClearExcessKeyFrames(void);
boolean G_KeyFrameRW(void);

// Skill
// Slow Motion ---------------------------------------------------------------

#define SLOWMO_FACTOR_TARGET 0.33f
#define SLOWMO_FACTOR_NORMAL 1.0f

boolean G_GetSlowMotion(void);
void G_SetSlowMotion(const boolean value);
void G_ResetSlowMotion(void);
float G_GetSlowMotionFactor(void);
void G_SetTimeScale(int scale);

// Skill ---------------------------------------------------------------------

void G_SetSkillParms(const skill_t skill);
void G_SetUserCustomSkill(void);
void G_RestartWithLoadout(const boolean current);
Expand Down
15 changes: 15 additions & 0 deletions src/m_cheat.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ static void cheat_reveal_keyx();
static void cheat_reveal_keyxx(int key);

static void cheat_linetarget(); // Give info on the current linetarget
static void cheat_trails(); // Show hitscan trails
static void cheat_mdk(); // Inspired by ZDoom's console command
static void cheat_saitama(); // MDK Fist

Expand Down Expand Up @@ -421,6 +422,7 @@ struct cheat_s cheat[] = {
{"iddfrs", NULL, not_net | not_demo, {cheat_reveal_keyxx}, 4 },

{"linetarget", NULL, not_net | not_demo, {cheat_linetarget} }, // Give info on the current linetarget
{"trails", NULL, not_net | not_demo, {cheat_trails} }, // Show hitscan trails
{"mdk", NULL, not_net | not_demo, {cheat_mdk} },
{"saitama", NULL, not_net | not_demo, {cheat_saitama} }, // MDK Fist
{"boomcan", NULL, not_net | not_demo, {cheat_boomcan} }, // Explosive hitscan
Expand Down Expand Up @@ -782,6 +784,19 @@ static void cheat_linetarget()
displaymsg("Linetarget Query %s", (plyr->cheats & CF_LINETARGET) ? "ON" : "OFF");
}

// Show hitscan trails
static void cheat_trails()
{
const int value = P_CycleShowHitscanTrails();

displaymsg(
"Hitscan Trails: %s",
(value == 2) ? "All"
: (value == 1) ? "Bullets Only"
: "Off"
);
}

// 1-million-damage hitscan attack
static void cheat_mdk()
{
Expand Down
8 changes: 8 additions & 0 deletions src/m_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -2130,6 +2130,14 @@ default_t defaults[] = {
input_crouch, { {INPUT_KEY, 'c'} }
},

{ // [Nugget]
"input_slowmo",
NULL, NULL,
{0}, {UL,UL}, input, ss_keys, wad_no,
"key to toggle slow motion",
input_slowmo, { {0, 0} }
},

{
"input_savegame",
NULL, NULL,
Expand Down
1 change: 1 addition & 0 deletions src/m_input.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ enum

input_crosshair,
input_zoom,
input_slowmo,
input_chasecam,
input_freecam,

Expand Down
8 changes: 5 additions & 3 deletions src/mn_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1602,6 +1602,8 @@ static void M_EndGameResponse(int ch)
G_CheckDemoStatus();
}

G_ResetSlowMotion(); // [Nugget] Slow Motion

// [crispy] clear quicksave slot
quickSaveSlot = -1;

Expand Down Expand Up @@ -2213,7 +2215,7 @@ static boolean ShortcutResponder(const event_t *ev)
realtic_clock_rate += 10;
realtic_clock_rate = BETWEEN(10, 1000, realtic_clock_rate);
displaymsg("Game Speed: %d", realtic_clock_rate);
I_SetTimeScale(realtic_clock_rate);
G_SetTimeScale(realtic_clock_rate); // [Nugget] Slow Motion
}

if (M_InputActivated(input_speed_down) && !D_CheckNetConnect()
Expand All @@ -2222,15 +2224,15 @@ static boolean ShortcutResponder(const event_t *ev)
realtic_clock_rate -= 10;
realtic_clock_rate = BETWEEN(10, 1000, realtic_clock_rate);
displaymsg("Game Speed: %d", realtic_clock_rate);
I_SetTimeScale(realtic_clock_rate);
G_SetTimeScale(realtic_clock_rate); // [Nugget] Slow Motion
}

if (M_InputActivated(input_speed_default) && !D_CheckNetConnect()
&& !strictmode)
{
realtic_clock_rate = 100;
displaymsg("Game Speed: %d", realtic_clock_rate);
I_SetTimeScale(realtic_clock_rate);
G_SetTimeScale(realtic_clock_rate); // [Nugget] Slow Motion
}

if (M_InputActivated(input_help)) // Help key
Expand Down
21 changes: 11 additions & 10 deletions src/mn_setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -1255,20 +1255,21 @@ static setup_menu_t keys_settings7[] =
{
{"Nugget - General", S_SKIP|S_TITLE, KB_X, M_SPC},

{"Jump/Fly Up", S_INPUT|S_STRICT|S_CRITICAL, KB_X, M_SPC, {0}, m_scrn, input_jump},
{"Crouch/Fly Down", S_INPUT|S_STRICT|S_CRITICAL, KB_X, M_SPC, {0}, m_scrn, input_crouch},
{"Jump/Fly Up", S_INPUT|S_STRICT|S_CRITICAL, KB_X, M_SPC, {0}, m_scrn, input_jump},
{"Crouch/Fly Down", S_INPUT|S_STRICT|S_CRITICAL, KB_X, M_SPC, {0}, m_scrn, input_crouch},
MI_GAP,
{"Cycle Chasecam", S_INPUT|S_STRICT, KB_X, M_SPC, {0}, m_scrn, input_chasecam},
{"Toggle Freecam", S_INPUT|S_STRICT, KB_X, M_SPC, {0}, m_scrn, input_freecam},
{"Cycle Chasecam", S_INPUT|S_STRICT, KB_X, M_SPC, {0}, m_scrn, input_chasecam},
{"Toggle Freecam", S_INPUT|S_STRICT, KB_X, M_SPC, {0}, m_scrn, input_freecam},
MI_GAP,
{"Toggle Zoom", S_INPUT|S_STRICT, KB_X, M_SPC, {0}, m_scrn, input_zoom},
{"Zoom FOV", S_NUM |S_STRICT, KB_X, M_SPC, {"zoom_fov"}, m_null, input_null, str_empty, UpdateFOV},
{"Toggle Slow Motion", S_INPUT|S_STRICT, KB_X, M_SPC, {0}, m_scrn, input_slowmo},
{"Toggle Zoom", S_INPUT|S_STRICT, KB_X, M_SPC, {0}, m_scrn, input_zoom},
{"Zoom FOV", S_NUM |S_STRICT, KB_X, M_SPC, {"zoom_fov"}, m_null, input_null, str_empty, UpdateFOV},
MI_GAP,
{"Toggle Crosshair", S_INPUT, KB_X, M_SPC, {0}, m_scrn, input_crosshair},
{"Toggle Crosshair", S_INPUT, KB_X, M_SPC, {0}, m_scrn, input_crosshair},
MI_GAP,
{"Last Used Weapon", S_INPUT|S_STRICT|S_CRITICAL, KB_X, M_SPC, {0}, m_scrn, input_lastweapon},
{"Last Used Weapon", S_INPUT|S_STRICT|S_CRITICAL, KB_X, M_SPC, {0}, m_scrn, input_lastweapon},
MI_GAP,
{"Rewind", S_INPUT|S_STRICT|S_CRITICAL, KB_X, M_SPC, {0}, m_scrn, input_rewind},
{"Rewind", S_INPUT|S_STRICT|S_CRITICAL, KB_X, M_SPC, {0}, m_scrn, input_rewind},

MI_END
};
Expand Down Expand Up @@ -2705,7 +2706,7 @@ void MN_ResetTimeScale(void)
}
}

I_SetTimeScale(time_scale);
G_SetTimeScale(time_scale); // [Nugget] Slow Motion
}

static setup_menu_t gen_settings6[] = {
Expand Down
Loading

0 comments on commit bc90bf9

Please sign in to comment.