From: DeaDDooMER <deaddoomer@deadsoftware.ru>
Date: Sat, 19 Jun 2021 14:33:08 +0000 (+0300)
Subject: system: remove sys_GetTicks
X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=e9689e89adc11f1179ee991bffa4d2be54f6e068;p=d2df-sdl.git

system: remove sys_GetTicks
---

diff --git a/src/game/Doom2DF.lpr b/src/game/Doom2DF.lpr
index b66ba3b..1e76da9 100644
--- a/src/game/Doom2DF.lpr
+++ b/src/game/Doom2DF.lpr
@@ -216,11 +216,7 @@ uses
     binPath: AnsiString = '';
     forceBinDir: Boolean = False;
 
-    wLoadingQuit: Boolean = false;
-    Time, Time_Delta, Time_Old: Int64;
-    Frame: Int64;
-    flag: Boolean = false;
-
+    Time_Old: Int64;
     NoSound: Boolean;
 
 procedure Update ();
@@ -240,10 +236,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;
@@ -269,12 +268,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;
@@ -968,7 +961,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 af3d8ad..cf14239 100644
--- a/src/game/g_game.pas
+++ b/src/game/g_game.pas
@@ -1262,7 +1262,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;
@@ -2361,7 +2361,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 2316d1c..98ca2ab 100644
--- a/src/game/g_net.pas
+++ b/src/game/g_net.pas
@@ -1939,7 +1939,7 @@ begin
   end;
 
   // предупредить что ждем слишком долго через N секунд
-  TimeoutTime := sys_GetTicks() + NET_CONNECT_TIMEOUT;
+  TimeoutTime := GetTickCount64() + NET_CONNECT_TIMEOUT;
 
   OuterLoop := True;
   while OuterLoop do
@@ -1960,7 +1960,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 f4b5618..56dec59 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 ebfdda5..df9e82d 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 12ee896..117215d 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 --- *)
@@ -61,11 +60,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 026d785..5f1b7f3 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)