X-Git-Url: https://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fgame%2Fg_window.pas;h=92ee3b97161f475f88d1b9acf04528fa566c813d;hb=a3ef23c31742fba53271c9a5a4dfe6ea26ea5d68;hp=ab211a961557b09ee4cdb772a5b2a8124201dfe2;hpb=3f9f9afcc6f00317e2cac5512e88ca538ff9b903;p=d2df-sdl.git diff --git a/src/game/g_window.pas b/src/game/g_window.pas index ab211a9..92ee3b9 100644 --- a/src/game/g_window.pas +++ b/src/game/g_window.pas @@ -17,6 +17,10 @@ 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 @@ -25,33 +29,40 @@ implementation {$IFDEF ENABLE_RENDER} r_render, {$ENDIF} - {$IFNDEF HEADLESS} + {$IFDEF ENABLE_SYSTEM} g_system, {$ENDIF} e_sound, g_net ; procedure ProcessLoading (forceUpdate: Boolean = False); - var update: Boolean; begin - {$IFDEF HEADLESS} - update := True; - {$ELSE} - update := sys_HandleInput() = False; + {$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} - if update then - begin - {$IFDEF ENABLE_RENDER} - 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 end; end.