From e0708b59cb0af96e37a0583c4414f1606678c252 Mon Sep 17 00:00:00 2001 From: Kippykip Date: Tue, 2 Jun 2020 20:48:20 +1000 Subject: [PATCH] FPS Counter as a Cheat Make the existing doomhack FPS counter a cheat intead of a source edit everytime. A, B, L, Up, Down, B, Left, Left --- include/d_englsh.h | 3 +++ source/d_main.c | 6 ++---- source/m_cheat.c | 14 ++++++++++++++ 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/include/d_englsh.h b/include/d_englsh.h index 0510790..803ccb7 100644 --- a/include/d_englsh.h +++ b/include/d_englsh.h @@ -377,6 +377,9 @@ #define STSTR_ROCKETON "Enemy Rockets On" #define STSTR_ROCKETOFF "Enemy Rockets Off" +#define STSTR_FPSON "FPS Counter On" +#define STSTR_FPSOFF "FPS Counter Off" + /* f_finale.c */ #define E1TEXT \ diff --git a/source/d_main.c b/source/d_main.c index 535a3f4..87aba12 100644 --- a/source/d_main.c +++ b/source/d_main.c @@ -95,8 +95,6 @@ const boolean nodrawers = false; static const char* timedemo = NULL;//"demo1"; -static const boolean show_fps = false; - /* * D_PostEvent - Event handling * @@ -287,7 +285,7 @@ static void D_DoomLoop(void) D_Display(); - if(show_fps) + if(_g->fps_show) { D_UpdateFPS(); } @@ -746,7 +744,7 @@ static void D_DoomMainSetup(void) _g->idmusnum = -1; //jff 3/17/98 insure idmus number is blank - _g->fps_show = show_fps; + _g->fps_show = false; I_InitGraphics(); diff --git a/source/m_cheat.c b/source/m_cheat.c index 7e82705..975f061 100644 --- a/source/m_cheat.c +++ b/source/m_cheat.c @@ -18,6 +18,7 @@ static void cheat_map(void); static void cheat_goggles(void); static void cheat_exit(void); static void cheat_rockets(void); +static void cheat_fps(void); @@ -49,6 +50,7 @@ static const c_cheat cheat_def[] = //Because Goldeneye! {"Enemy Rockets", CHEAT_SEQ(KEYD_A, KEYD_B, KEYD_L, KEYD_R, KEYD_R, KEYD_L, KEYD_B, KEYD_A), cheat_rockets}, + {"FPS Counter Ammo",CHEAT_SEQ(KEYD_A, KEYD_B, KEYD_L, KEYD_UP, KEYD_DOWN, KEYD_B, KEYD_LEFT, KEYD_LEFT), cheat_fps}, }; static const unsigned int num_cheats = sizeof(cheat_def) / sizeof (c_cheat); @@ -252,3 +254,15 @@ static void cheat_rockets() _g->player.message = STSTR_ROCKETOFF; } } + +static void cheat_fps() +{ + _g->fps_show = !_g->fps_show; + if(_g->fps_show) + { + _g->player.message = STSTR_FPSON; + }else + { + _g->player.message = STSTR_FPSOFF; + } +} \ No newline at end of file