From: Holger Schemel Date: Sat, 7 Oct 2017 22:18:33 +0000 (+0200) Subject: changed displaying FPS by cheat code ':fps' instead of always in debug mode X-Git-Tag: 4.0.1.1~39 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=5b2e6a664e1fb401861c5a437ddecb26d59c245b;p=rocksndiamonds.git changed displaying FPS by cheat code ':fps' instead of always in debug mode --- diff --git a/src/events.c b/src/events.c index aa20e2d0..d56edaf9 100644 --- a/src/events.c +++ b/src/events.c @@ -1441,6 +1441,11 @@ static void HandleKeysSpecial(Key key) { SaveNativeLevel(&level); } + else if (is_string_suffix(cheat_input, ":frames-per-second") || + is_string_suffix(cheat_input, ":fps")) + { + global.show_frames_per_second = !global.show_frames_per_second; + } } else if (game_status == GAME_MODE_PLAYING) { diff --git a/src/game.c b/src/game.c index ce4fd8cb..d615d633 100644 --- a/src/game.c +++ b/src/game.c @@ -11212,7 +11212,7 @@ void GameActionsExt() AdvanceFrameAndPlayerCounters(-1); /* advance counters for all players */ - if (options.debug) /* calculate frames per second */ + if (global.show_frames_per_second) { static unsigned int fps_counter = 0; static int fps_frames = 0; @@ -11220,7 +11220,7 @@ void GameActionsExt() fps_frames++; - if (fps_delay_ms >= 500) /* calculate fps every 0.5 seconds */ + if (fps_delay_ms >= 500) /* calculate FPS every 0.5 seconds */ { global.frames_per_second = 1000 * (float)fps_frames / fps_delay_ms; diff --git a/src/init.c b/src/init.c index ea7c8f9a..33f97e45 100644 --- a/src/init.c +++ b/src/init.c @@ -4835,6 +4835,7 @@ static void InitGlobal() global.create_images_dir = NULL; global.frames_per_second = 0; + global.show_frames_per_second = FALSE; global.border_status = GAME_MODE_LOADING; global.anim_status = global.anim_status_next = GAME_MODE_LOADING; diff --git a/src/main.h b/src/main.h index 9545b705..7b15ad91 100644 --- a/src/main.h +++ b/src/main.h @@ -2649,6 +2649,7 @@ struct GlobalInfo int num_toons; float frames_per_second; + boolean show_frames_per_second; /* global values for fading screens and masking borders */ int border_status;