From 8a9f70875cd90965da70a3d210951f66c797ed65 Mon Sep 17 00:00:00 2001 From: Clownacy Date: Thu, 16 Apr 2020 13:48:15 +0100 Subject: [PATCH] More authentic variable/function names --- devilution/comparer-config.toml | 4 ++-- src/Main.cpp | 33 +++++++++++++++++---------------- src/Main.h | 2 +- 3 files changed, 20 insertions(+), 19 deletions(-) diff --git a/devilution/comparer-config.toml b/devilution/comparer-config.toml index 010b3f1d..1039c25b 100644 --- a/devilution/comparer-config.toml +++ b/devilution/comparer-config.toml @@ -442,7 +442,7 @@ name = "CortBox2" addr = 0x40CA80 [[func]] -name = "DummiedOutLogFunction" +name = "out" addr = 0x40CB30 [[func]] @@ -791,7 +791,7 @@ name = "PutFramePerSecound" addr = 0x412370 [[func]] -name = "GetFramePerSecound" +name = "CountFramePerSecound" addr = 0x4123A0 [[func]] diff --git a/src/Main.cpp b/src/Main.cpp index a8806bc8..40a5cbfa 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -51,6 +51,7 @@ static const char *lpWindowName = "\x93\xB4\x8C\x41\x95\xA8\x8C\xEA"; // '洞窟 static const char *lpWindowName = "Cave Story ~ Doukutsu Monogatari"; #endif +// The original name for this function is unknown void SetWindowName(HWND hWnd) { char window_name[0x100]; @@ -64,36 +65,36 @@ void PutFramePerSecound(void) { if (bFps) { - const unsigned long fps = GetFramePerSecound(); + const unsigned long fps = CountFramePerSecound(); PutNumber4(WINDOW_WIDTH - 40, 8, fps, FALSE); } } -unsigned long GetFramePerSecound(void) +unsigned long CountFramePerSecound(void) { - unsigned long current_tick; - static BOOL need_new_base_tick = TRUE; - static unsigned long frames_this_second; - static unsigned long current_frame; - static unsigned long base_tick; + unsigned long current_tick; // The original name for this variable is unknown + static BOOL first = TRUE; + static unsigned long max_count; + static unsigned long count; + static unsigned long wait; - if (need_new_base_tick) + if (first) { - base_tick = GetTickCount(); - need_new_base_tick = FALSE; + wait = GetTickCount(); + first = FALSE; } current_tick = GetTickCount(); - ++current_frame; + ++count; - if (base_tick + 1000 <= current_tick) + if (wait + 1000 <= current_tick) { - base_tick += 1000; - frames_this_second = current_frame; - current_frame = 0; + wait += 1000; + max_count = count; + count = 0; } - return frames_this_second; + return max_count; } // TODO - Inaccurate stack frame diff --git a/src/Main.h b/src/Main.h index 09808682..9c2f0656 100644 --- a/src/Main.h +++ b/src/Main.h @@ -9,6 +9,6 @@ extern HWND ghWnd; extern BOOL bFullscreen; void PutFramePerSecound(void); -unsigned long GetFramePerSecound(void); +unsigned long CountFramePerSecound(void); BOOL SystemTask(void);