summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 282bf76)
raw | patch | inline | side by side (parent: 282bf76)
author | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Thu, 31 Aug 2017 23:00:53 +0000 (02:00 +0300) | ||
committer | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Fri, 1 Sep 2017 00:33:55 +0000 (03:33 +0300) |
src/game/g_game.pas | patch | blob | history | |
src/game/g_map.pas | patch | blob | history | |
src/game/g_net.pas | patch | blob | history | |
src/game/g_window.pas | patch | blob | history |
diff --git a/src/game/g_game.pas b/src/game/g_game.pas
index 302b952af4b10f88b81c89e2537faf706921b2b9..cc71ea1a8c64fde887d14fa2a1e908600ada9bfd 100644 (file)
--- a/src/game/g_game.pas
+++ b/src/game/g_game.pas
end;
end;
- ProcessLoading();
+ ProcessLoading(true);
e_PollInput();
g_ActiveWindow := nil;
- ProcessLoading;
+ ProcessLoading(true);
end;
procedure g_Game_StepLoading();
if (ShowCount > LOADING_SHOW_STEP) then
begin
ShowCount := 0;
- ProcessLoading;
+ ProcessLoading();
end;
end;
end;
diff --git a/src/game/g_map.pas b/src/game/g_map.pas
index f2922d4a9622c4f47d342a973a4e58b79d8b4694..bd2b4508903eba80ee82a6956af853c201594878 100644 (file)
--- a/src/game/g_map.pas
+++ b/src/game/g_map.pas
rec, texrec: TDynRecord;
pttit: PTRec;
pannum, trignum, cnt, tgpid: Integer;
+ stt: UInt64;
begin
mapGrid.Free();
mapGrid := nil;
e_LogWritefln('Loading map: %s', [mapResName], MSG_NOTIFY);
g_Game_SetLoadingText(_lc[I_LOAD_MAP], 0, False);
+ stt := curTimeMicro();
+
try
mapReader := g_Map_ParseMap(Data, Len);
except
begin
gMusic.SetByName('');
end;
+
+ stt := curTimeMicro()-stt;
+ e_LogWritefln('map loaded in %s.%s milliseconds', [Integer(stt div 1000), Integer(stt mod 1000)]);
finally
sfsGCEnable(); // enable releasing unused volumes
mapReader.Free();
diff --git a/src/game/g_net.pas b/src/game/g_net.pas
index 576e8772f39b2f2016e6c94670704cafe6079661..b6a60c0fae409bd9fcbca2100547d4fbd3e4f8dc 100644 (file)
--- a/src/game/g_net.pas
+++ b/src/game/g_net.pas
end;
end;
- ProcessLoading();
+ ProcessLoading(true);
e_PollInput();
end;
end;
- ProcessLoading();
+ ProcessLoading(true);
e_PollInput();
diff --git a/src/game/g_window.pas b/src/game/g_window.pas
index 0ac570dad8b00a296278d4e0163f19ee28785b72..1b60950e0acfa4a33a15fcc31c220dc4842d63e3 100644 (file)
--- a/src/game/g_window.pas
+++ b/src/game/g_window.pas
procedure KillGLWindow();
procedure PushExitEvent();
function ProcessMessage(): Boolean;
-procedure ProcessLoading();
+procedure ProcessLoading (forceUpdate: Boolean=false);
procedure ReDrawWindow();
procedure SwapBuffers();
procedure Sleep(ms: LongWord);
SDL2, GL, GLExt, e_graphics, e_log, g_main,
g_console, SysUtils, e_input, g_options, g_game,
g_basic, g_textures, e_sound, g_sound, g_menu, ENet, g_net,
- g_map, g_gfx, g_monsters, g_holmes;
+ g_map, g_gfx, g_monsters, g_holmes, xprofiler;
var
h_Wnd: PSDL_Window;
SDL_PushEvent(@ev);
end;
-procedure ProcessLoading();
+
+var
+ prevLoadingUpdateTime: UInt64 = 0;
+
+procedure ProcessLoading (forceUpdate: Boolean=false);
var
ev: TSDL_Event;
ID: DWORD;
+ stt: UInt64;
begin
FillChar(ev, SizeOf(ev), 0);
//wNeedFree := False;
if not wMinimized then
begin
- if g_Texture_Get('INTER', ID) then
- e_DrawSize(ID, 0, 0, 0, False, False, gScreenWidth, gScreenHeight)
+ if forceUpdate then
+ begin
+ prevLoadingUpdateTime := curTimeMilli();
+ end
else
- e_Clear(GL_COLOR_BUFFER_BIT, 0, 0, 0);
+ begin
+ stt := curTimeMilli();
+ if (stt < prevLoadingUpdateTime) or (stt-prevLoadingUpdateTime >= 400) then
+ begin
+ prevLoadingUpdateTime := stt;
+ forceUpdate := true;
+ end;
+ end;
- DrawLoadingStat();
- SwapBuffers();
+ if forceUpdate then
+ begin
+ if g_Texture_Get('INTER', ID) then
+ begin
+ e_DrawSize(ID, 0, 0, 0, False, False, gScreenWidth, gScreenHeight)
+ end
+ else
+ begin
+ e_Clear(GL_COLOR_BUFFER_BIT, 0, 0, 0);
+ end;
- ReShowCursor();
+ DrawLoadingStat();
+ SwapBuffers();
+
+ ReShowCursor();
+ end;
end;
e_SoundUpdate();
if NetMode = NET_SERVER then
- g_Net_Host_Update
+ begin
+ g_Net_Host_Update();
+ end
else
- if (NetMode = NET_CLIENT) and (NetState <> NET_STATE_AUTH) then
- g_Net_Client_UpdateWhileLoading;
+ begin
+ if (NetMode = NET_CLIENT) and (NetState <> NET_STATE_AUTH) then g_Net_Client_UpdateWhileLoading();
+ end;
wLoadingProgress := False;
end;