Skip to content

Commit

Permalink
Make some cheats bindable
Browse files Browse the repository at this point in the history
Additionally, some rearrangements.
  • Loading branch information
MrAlaux committed Nov 29, 2023
1 parent efc30b1 commit 5ae681a
Show file tree
Hide file tree
Showing 5 changed files with 241 additions and 98 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@
- Toggle to apply patch offsets.
- **Further Extended HUD color customization**
- **_Show Kills Percentage [in Stats display]_** setting
- **Made the following cheats bindable to keys:**
- Infinite Ammo;
- Fast Weapons;
- Resurrect;
- Flight Mode;
- Repeat Last Summon;
- Linetarget Query;
- MDK Attack;
- MDK Fist;
- Explosive Hitscan.
- **Show Save Messages** setting
- **_Direct Vertical Aiming_ for melee attacks**
- **_Disable Melee Snapping_** setting
Expand Down
22 changes: 16 additions & 6 deletions src/m_cheat.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ static void cheat_gibbers(); // Everything gibs

static void cheat_resurrect();
static void cheat_fly();
static void cheat_nextmap(); // Emulate level exit
static void cheat_nextsecret(); // Emulate secret level exit
static void cheat_normalexit(); // Emulate normal level exit
static void cheat_secretexit(); // Emulate secret level exit
static void cheat_turbo(char *buf);

// Summon a mobj
Expand Down Expand Up @@ -367,8 +367,8 @@ struct cheat_s cheat[] = {
{"resurrect", NULL, not_net | not_demo, {cheat_resurrect} },
{"idres", NULL, not_net | not_demo, {cheat_resurrect} }, // 'RESURRECT' alternative
{"idfly", NULL, not_net | not_demo, {cheat_fly} },
{"nextmap", NULL, not_net | not_demo, {cheat_nextmap} },
{"nextsecret", NULL, not_net | not_demo, {cheat_nextsecret} },
{"nextmap", NULL, not_net | not_demo, {cheat_normalexit} },
{"nextsecret", NULL, not_net | not_demo, {cheat_secretexit} },
{"turbo", NULL, not_net | not_demo, {cheat_turbo}, -3 },
{"summon", NULL, not_net | not_demo, {cheat_summon} }, // Summon "Menu"
{"summone", NULL, not_net | not_demo, {cheat_summone0} }, // Summon Enemy "Menu"
Expand Down Expand Up @@ -492,12 +492,12 @@ static void cheat_fly()
displaymsg("Fly Mode %s", (plyr->cheats & CF_FLY) ? "ON" : "OFF");
}

static void cheat_nextmap()
static void cheat_normalexit()
{
G_ExitLevel();
}

static void cheat_nextsecret()
static void cheat_secretexit()
{
G_SecretExitLevel();
}
Expand Down Expand Up @@ -1696,6 +1696,16 @@ static const struct {
{ input_notarget, not_net|not_demo, {cheat_notarget}, 0 },
{ input_freeze, not_net|not_demo, {cheat_freeze}, 0 },
{ input_avj, not_net|not_demo, {cheat_avj}, 0 },
// [Nugget] ----------------------------------------------------------------
{ input_infammo, not_net|not_demo, {cheat_infammo}, 0 },
{ input_fastweaps, not_net|not_demo, {cheat_fastweaps}, 0 },
{ input_resurrect, not_net|not_demo, {cheat_resurrect}, 0 },
{ input_fly, not_net|not_demo, {cheat_fly}, 0 },
{ input_summonr, not_net|not_demo, {cheat_summonr}, 0 },
{ input_linetarget, not_net|not_demo, {cheat_linetarget}, 0 },
{ input_mdk, not_net|not_demo, {cheat_mdk}, 0 },
{ input_saitama, not_net|not_demo, {cheat_saitama}, 0 },
{ input_boomcan, not_net|not_demo, {cheat_boomcan}, 0 },
};

boolean M_CheatResponder(event_t *ev)
Expand Down
13 changes: 12 additions & 1 deletion src/m_input.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ enum
input_map_zoomout,
input_map_mark,
input_map_clear,
input_map_mini, // [Nugget] Minimap
input_map_blink, // [Nugget] Blink marks
input_map_tagfinder, // [Nugget] Tag Finder from PrBoomX
input_map_teleport, // [Nugget] Teleport to Automap pointer
input_map_mini, // [Nugget] Minimap
input_map_gobig,
input_map_grid,
input_map_overlay,
Expand Down Expand Up @@ -141,6 +141,17 @@ enum
input_notarget,
input_freeze,
input_avj,
// [Nugget] /------------------------
input_infammo,
input_fastweaps,
input_resurrect,
input_fly,
input_summonr,
input_linetarget,
input_mdk,
input_saitama,
input_boomcan,
// [Nugget] ------------------------/

NUM_INPUT_ID
};
Expand Down
42 changes: 41 additions & 1 deletion src/m_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -2821,7 +2821,10 @@ setup_menu_t keys_settings6[];
setup_menu_t keys_settings7[];
setup_menu_t keys_settings8[];
setup_menu_t keys_settings9[];
setup_menu_t keys_settings10[], keys_settings11[]; // [Nugget]
// [Nugget]
setup_menu_t keys_settings10[];
setup_menu_t keys_settings11[];
setup_menu_t keys_settings12[];

// The table which gets you from one screen table to the next.
setup_menu_t* keys_settings[] =
Expand All @@ -2838,6 +2841,7 @@ setup_menu_t* keys_settings[] =
// [Nugget]
keys_settings10,
keys_settings11,
keys_settings12,
NULL
};

Expand Down Expand Up @@ -3208,6 +3212,42 @@ setup_menu_t keys_settings11[] =
{"Fancy Teleport", S_YESNO|S_STRICT|S_CRITICAL, m_null, KB_X, M_Y + keys11_fancytp * M_SPC, {"fancy_teleport"}},

{"<- PREV", S_SKIP|S_PREV, m_null, M_X_PREV, M_Y_PREVNEXT, {keys_settings10}},
{"NEXT ->", S_SKIP|S_NEXT, m_null, M_X_NEXT, M_Y_PREVNEXT, {keys_settings12}},

// Final entry

{0,S_SKIP|S_END,m_null}

};

enum {
keys12_title1,
keys12_infammo,
keys12_fastweaps,
keys12_resurrect,
keys12_fly,
keys12_summonr,
keys12_linetarg,
keys12_mdk,
keys12_saitama,
keys12_boomcan,
};

setup_menu_t keys_settings12[] =
{
{"Nugget - Cheats", S_SKIP|S_TITLE, m_null, CHEAT_X, M_Y + keys12_title1 * M_SPC},

{"Infinite Ammo", S_INPUT, m_scrn, CHEAT_X, M_Y + keys12_infammo * M_SPC, {0}, input_infammo},
{"Fast Weapons", S_INPUT, m_scrn, CHEAT_X, M_Y + keys12_fastweaps * M_SPC, {0}, input_fastweaps},
{"Resurrect", S_INPUT, m_scrn, CHEAT_X, M_Y + keys12_resurrect * M_SPC, {0}, input_resurrect},
{"Flight Mode", S_INPUT, m_scrn, CHEAT_X, M_Y + keys12_fly * M_SPC, {0}, input_fly},
{"Repeat Last Summon", S_INPUT, m_scrn, CHEAT_X, M_Y + keys12_summonr * M_SPC, {0}, input_summonr},
{"Linetarget Query", S_INPUT, m_scrn, CHEAT_X, M_Y + keys12_linetarg * M_SPC, {0}, input_linetarget},
{"MDK Attack", S_INPUT, m_scrn, CHEAT_X, M_Y + keys12_mdk * M_SPC, {0}, input_mdk},
{"MDK Fist", S_INPUT, m_scrn, CHEAT_X, M_Y + keys12_saitama * M_SPC, {0}, input_saitama},
{"Explosive Hitscan", S_INPUT, m_scrn, CHEAT_X, M_Y + keys12_boomcan * M_SPC, {0}, input_boomcan},

{"<- PREV",S_SKIP|S_PREV,m_null,M_X_PREV,M_Y_PREVNEXT, {keys_settings11}},

// Final entry

Expand Down
Loading

0 comments on commit 5ae681a

Please sign in to comment.