From e962cbff359d8ee0abf003a2c4d0934f2a22f536 Mon Sep 17 00:00:00 2001 From: DeaDDooMER Date: Sat, 19 Jun 2021 17:33:08 +0300 Subject: [PATCH] system: remove sys_GetTicks --- src/game/Doom2DF.lpr | 19 ++++++------------- src/game/g_game.pas | 4 ++-- src/game/g_net.pas | 4 ++-- src/game/g_netmaster.pas | 2 +- src/game/opengl/r_game.pas | 2 +- src/game/sdl/g_system.pas | 6 ------ src/game/sdl2/g_system.pas | 6 ------ src/game/stub/g_system.pas | 6 ------ 8 files changed, 12 insertions(+), 37 deletions(-) diff --git a/src/game/Doom2DF.lpr b/src/game/Doom2DF.lpr index 6022ee6..dd58577 100644 --- a/src/game/Doom2DF.lpr +++ b/src/game/Doom2DF.lpr @@ -219,11 +219,7 @@ uses UseNativeMusic: Boolean; {$ENDIF} - wLoadingQuit: Boolean = false; - Time, Time_Delta, Time_Old: Int64; - Frame: Int64; - flag: Boolean = false; - + Time_Old: Int64; NoSound: Boolean; procedure Update (); @@ -243,10 +239,13 @@ end; function ProcessMessage (): Boolean; var i, t: Integer; + flag: Boolean; + Time, Time_Delta: Int64; + Frame: Int64; begin result := sys_HandleInput(); - Time := sys_GetTicks(); + Time := GetTickCount64(); Time_Delta := Time-Time_Old; flag := false; @@ -272,12 +271,6 @@ begin g_Map_ProfilersEnd(); g_Mons_ProfilersEnd(); - if wLoadingQuit then - begin - g_Game_Free(); - g_Game_Quit(); - end; - if (gExit = EXIT_QUIT) then begin result := true; @@ -1005,7 +998,7 @@ end; if (not gGameOn) and gAskLanguage then g_Menu_AskLanguage; {$ENDIF} - Time_Old := sys_GetTicks(); + Time_Old := GetTickCount64(); while not ProcessMessage() do begin end; g_Console_WriteGameConfig; {$IFNDEF HEADLESS} diff --git a/src/game/g_game.pas b/src/game/g_game.pas index 664377c..d49c423 100644 --- a/src/game/g_game.pas +++ b/src/game/g_game.pas @@ -1283,7 +1283,7 @@ begin gDelayedEvents[n].DENum := Num; gDelayedEvents[n].DEStr := Str; if DEType = DE_GLOBEVENT then - gDelayedEvents[n].Time := (sys_GetTicks() {div 1000}) + Time + gDelayedEvents[n].Time := (GetTickCount64() {div 1000}) + Time else gDelayedEvents[n].Time := gTime + Time; Result := n; @@ -2405,7 +2405,7 @@ begin KeyPress(IK_F10); end; - Time := sys_GetTicks() {div 1000}; + Time := GetTickCount64() {div 1000}; // Обработка отложенных событий: if gDelayedEvents <> nil then diff --git a/src/game/g_net.pas b/src/game/g_net.pas index 7c97ea2..96f6790 100644 --- a/src/game/g_net.pas +++ b/src/game/g_net.pas @@ -2028,7 +2028,7 @@ begin end; // предупредить что ждем слишком долго через N секунд - TimeoutTime := sys_GetTicks() + NET_CONNECT_TIMEOUT; + TimeoutTime := GetTickCount64() + NET_CONNECT_TIMEOUT; OuterLoop := True; while OuterLoop do @@ -2049,7 +2049,7 @@ begin end; end; - T := sys_GetTicks(); + T := GetTickCount64(); if T > TimeoutTime then begin TimeoutTime := T + NET_CONNECT_TIMEOUT * 100; // одного предупреждения хватит diff --git a/src/game/g_netmaster.pas b/src/game/g_netmaster.pas index 9f8af0b..1484f6b 100644 --- a/src/game/g_netmaster.pas +++ b/src/game/g_netmaster.pas @@ -200,7 +200,7 @@ var //========================================================================== function GetTimerMS (): Int64; begin - Result := sys_GetTicks() {div 1000}; + Result := GetTickCount64() {div 1000}; end; diff --git a/src/game/opengl/r_game.pas b/src/game/opengl/r_game.pas index 641544f..72c4d62 100644 --- a/src/game/opengl/r_game.pas +++ b/src/game/opengl/r_game.pas @@ -1563,7 +1563,7 @@ var begin if gExit = EXIT_QUIT then Exit; - Time := sys_GetTicks() {div 1000}; + Time := GetTickCount64() {div 1000}; FPSCounter := FPSCounter+1; if Time - FPSTime >= 1000 then begin diff --git a/src/game/sdl/g_system.pas b/src/game/sdl/g_system.pas index bd00376..c228aee 100644 --- a/src/game/sdl/g_system.pas +++ b/src/game/sdl/g_system.pas @@ -20,7 +20,6 @@ interface uses Utils; (* --- Utils --- *) - function sys_GetTicks (): Int64; procedure sys_Delay (ms: Integer); (* --- Graphics --- *) @@ -68,11 +67,6 @@ implementation (* --------- Utils --------- *) - function sys_GetTicks (): Int64; - begin - result := SDL_GetTicks() - end; - procedure sys_Delay (ms: Integer); begin SDL_Delay(ms) diff --git a/src/game/sdl2/g_system.pas b/src/game/sdl2/g_system.pas index aacb4fb..ca33411 100644 --- a/src/game/sdl2/g_system.pas +++ b/src/game/sdl2/g_system.pas @@ -20,7 +20,6 @@ interface uses Utils; (* --- Utils --- *) - function sys_GetTicks (): Int64; procedure sys_Delay (ms: Integer); (* --- Graphics --- *) @@ -66,11 +65,6 @@ implementation (* --------- Utils --------- *) - function sys_GetTicks (): Int64; - begin - result := SDL_GetTicks() - end; - procedure sys_Delay (ms: Integer); begin SDL_Delay(ms) diff --git a/src/game/stub/g_system.pas b/src/game/stub/g_system.pas index 9d14f24..ab42c12 100644 --- a/src/game/stub/g_system.pas +++ b/src/game/stub/g_system.pas @@ -20,7 +20,6 @@ interface uses Utils; (* --- Utils --- *) - function sys_GetTicks (): Int64; procedure sys_Delay (ms: Integer); (* --- Graphics --- *) @@ -47,11 +46,6 @@ implementation (* --------- Utils --------- *) - function sys_GetTicks (): Int64; - begin - Result := Round(TimeStampToMSecs(DateTimeToTimeStamp(Now()))) - end; - procedure sys_Delay (ms: Integer); begin Sleep(ms) -- 2.29.2