DEADSOFTWARE

gl: implement load screen
[d2df-sdl.git] / src / game / g_window.pas
index 2cbc4a75bfc3414fea1b6e83e8ce634a9e8e25d9..92ee3b97161f475f88d1b9acf04528fa566c813d 100644 (file)
@@ -17,32 +17,52 @@ unit g_window;
 
 interface
 
+  procedure g_Game_ClearLoading;
+  procedure g_Game_SetLoadingText (const text: String; maxval: Integer; rewrite: Boolean);
+  procedure g_Game_StepLoading (value: Integer = -1);
+
   procedure ProcessLoading (forceUpdate: Boolean=false);
 
 implementation
 
   uses
-    {$IFNDEF HEADLESS}
+    {$IFDEF ENABLE_RENDER}
       r_render,
     {$ENDIF}
-    e_sound, g_system, g_net
+    {$IFDEF ENABLE_SYSTEM}
+      g_system,
+    {$ENDIF}
+    e_sound, g_net
   ;
 
   procedure ProcessLoading (forceUpdate: Boolean = False);
   begin
-    if sys_HandleInput() = False then
-    begin
-      {$IFNDEF HEADLESS}
-        r_Render_DrawLoading(forceUpdate);
-      {$ENDIF}
-      e_SoundUpdate();
-      // TODO: At the moment, I left here only host network processing, because the client code must
-      // handle network events on its own. Otherwise separate network cases that use different calls to
-      // enet_host_service() WILL lose their packets (for example, resource downloading). So they have
-      // to handle everything by themselves. But in general, this MUST be removed completely, since
-      // updating the window should never affect the network. Use single enet_host_service(), period.
-      if NetMode = NET_SERVER then g_Net_Host_Update();
-    end
+    {$IFDEF ENABLE_RENDER}
+      r_Render_DrawLoading(forceUpdate);
+    {$ENDIF}
+  end;
+
+  procedure g_Game_ClearLoading;
+  begin
+    {$IFDEF ENABLE_RENDER}
+      r_Render_ClearLoading;
+    {$ENDIF}
+  end;
+
+  procedure g_Game_SetLoadingText (const text: String; maxval: Integer; rewrite: Boolean);
+  begin
+    {$IFDEF ENABLE_RENDER}
+      if maxval < 0 then maxval := 0;
+      r_Render_SetLoading(text, maxval);
+    {$ENDIF}
+  end;
+
+  procedure g_Game_StepLoading (value: Integer = -1);
+  begin
+    {$IFDEF ENABLE_RENDER}
+      if value < 0 then value := 1;
+      r_Render_StepLoading(value);
+    {$ENDIF}
   end;
 
 end.