summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a78f386)
raw | patch | inline | side by side (parent: a78f386)
author | fgsfds <pvt.fgsfds@gmail.com> | |
Sun, 15 Mar 2020 00:06:29 +0000 (03:06 +0300) | ||
committer | fgsfds <pvt.fgsfds@gmail.com> | |
Sun, 15 Mar 2020 00:06:29 +0000 (03:06 +0300) |
src/game/g_game.pas | patch | blob | history | |
src/game/g_main.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 981082d949b8aa4b5766dc98757319001b108dda..16dd284f92d7baf9d23f428d37c255c7b585cf17 100644 (file)
--- a/src/game/g_game.pas
+++ b/src/game/g_game.pas
procedure g_Game_LoadData();
procedure g_Game_FreeData();
procedure g_Game_Update();
+procedure g_Game_PreUpdate();
procedure g_Game_Draw();
procedure g_Game_Quit();
procedure g_Game_SetupScreenSize();
MC_SEND_CheatRequest(NET_CHEAT_READY);
end;
+procedure g_Game_PreUpdate();
+begin
+ // these are in separate PreUpdate functions because they can interact during Update()
+ // and are synced over the net
+ // we don't care that much about corpses and gibs
+ g_Player_PreUpdate();
+ g_Monsters_PreUpdate();
+ g_Items_PreUpdate();
+ g_Weapon_PreUpdate();
+end;
+
procedure g_Game_Update();
var
Msg: g_gui.TMessage;
end;
end;
- // these are in separate PreUpdate functions because they can interact during Update()
- // we don't care that much about corpses and gibs
- g_Player_PreUpdate();
- g_Monsters_PreUpdate();
- g_Items_PreUpdate();
- g_Weapon_PreUpdate();
-
// Îáíîâëÿåì âñå îñòàëüíîå:
g_Map_Update();
g_Items_Update();
diff --git a/src/game/g_main.pas b/src/game/g_main.pas
index 20419ecc0299fcfc9ae8b4fc982f8f77ff58bcf1..af95f90039433fabd4834b40f6b977878b65234c 100644 (file)
--- a/src/game/g_main.pas
+++ b/src/game/g_main.pas
procedure Update ();
begin
+ // remember old mobj positions, prepare for update
+ g_Game_PreUpdate();
+ // server: receive client commands for new frame
+ // client: receive game state changes from server
+ if (NetMode = NET_SERVER) then g_Net_Host_Update()
+ else if (NetMode = NET_CLIENT) then g_Net_Client_Update();
+ // think
g_Game_Update();
+ // server: send any accumulated outgoing data to clients
+ if NetMode = NET_SERVER then g_Net_Flush();
end;
diff --git a/src/game/g_window.pas b/src/game/g_window.pas
index 1eaf7b9cb50d17b97fdc36a52f5fa733278e4a14..37d979111dff1a34f01f50f30a3287c77f901493 100644 (file)
--- a/src/game/g_window.pas
+++ b/src/game/g_window.pas
begin
flag := true;
for i := 1 to t do
- begin
- if (NetMode = NET_SERVER) then g_Net_Host_Update()
- else if (NetMode = NET_CLIENT) then g_Net_Client_Update();
Update();
- end;
end;
- if NetMode = NET_SERVER then g_Net_Flush();
-
g_Map_ProfilersEnd();
g_Mons_ProfilersEnd();