summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3cc441c)
raw | patch | inline | side by side (parent: 3cc441c)
author | fgsfds <pvt.fgsfds@gmail.com> | |
Wed, 21 Aug 2019 14:42:35 +0000 (17:42 +0300) | ||
committer | fgsfds <pvt.fgsfds@gmail.com> | |
Wed, 21 Aug 2019 14:42:35 +0000 (17:42 +0300) |
draw console messages on loading screen
src/game/g_console.pas | patch | blob | history | |
src/game/g_language.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_console.pas b/src/game/g_console.pas
index 53f1c4f1a9998d3c328b2f8fd29be4c4a52e720c..5953403c7dd3aa4f4e714d7e1a99de1e927fb770 100644 (file)
--- a/src/game/g_console.pas
+++ b/src/game/g_console.pas
procedure g_Console_Init;
procedure g_Console_Update;
-procedure g_Console_Draw;
+procedure g_Console_Draw (MessagesOnly: Boolean = False);
procedure g_Console_Char (C: AnsiChar);
procedure g_Console_Control (K: Word);
procedure g_Console_Process (L: AnsiString; quiet: Boolean=false);
until not cbufLineUp(sp, ep);
end;
-procedure g_Console_Draw();
+procedure g_Console_Draw(MessagesOnly: Boolean = False);
var
CWidth, CHeight: Byte;
mfW, mfH: Word;
if MsgArray[a].Time > 0 then
e_TextureFontPrintFmt(0, offset_y + CHeight * a, MsgArray[a].Msg, gStdFont, True);
+ if MessagesOnly then Exit;
+
if gChatShow then
begin
if ChatTop then
index 08d315ef1aca69a36369aabd699d50c35d9f1a5e..f622d64be69d1e0d9be4c3120528b4789cfa62ac 100644 (file)
--- a/src/game/g_language.pas
+++ b/src/game/g_language.pas
I_NET_MSG_CLIENT_DONE,
I_NET_MSG_CLIENT_DISC,
I_NET_MSG_KICK,
+ I_NET_MSG_PORTS,
+ I_NET_MSG_TIMEOUT_WARN,
I_NET_MAP_DL,
I_NET_WAD_DL,
'Îòêëþ÷åíèå âûïîëíåíî.'),
('NET MSG KICK', 'You were dropped from the game! Reason: ',
'Âàñ âûáðîñèëî ñ ñåðâåðà! Ïðè÷èíà: '),
+ ('NET MSG PORTS', 'Make sure ports %d and %d are forwarded on the server.',
+ 'Ñïðîñèòå àäìèíà, ïðîáðîñèë ëè îí ïîðòû %d è %d íà ðîóòåðå.'),
+ ('NET MSG TIMEOUT WARN', 'Connection is taking too long.',
+ 'Ñåðâåð íå îòâå÷àåò óæå äîâîëüíî äîëãî.'),
('NET MAP DL', 'Map %s not found. Downloading from the server...',
'Êàðòà %s íå íàéäåíà. Ñêà÷èâàåì ñ ñåðâåðà...'),
diff --git a/src/game/g_net.pas b/src/game/g_net.pas
index 0f3df0f81f384348afba14eeaa326f3ce4ff6f42..907a5beefd437b163adaf1ef934dbc29c55fee58 100644 (file)
--- a/src/game/g_net.pas
+++ b/src/game/g_net.pas
NET_STATE_AUTH = 1;
NET_STATE_GAME = 2;
+ NET_CONNECT_TIMEOUT = 1000 * 10;
+
BANLIST_FILENAME = 'banlist.txt';
NETDUMP_FILENAME = 'netdump';
function g_Net_Connect(IP: string; Port: enet_uint16): Boolean;
var
OuterLoop: Boolean;
+ TimeoutTime, T: Int64;
begin
if NetMode <> NET_NONE then
begin
Exit;
end;
+ // предупредить что ждем слишком долго через N секунд
+ TimeoutTime := GetTimer() + NET_CONNECT_TIMEOUT;
+
OuterLoop := True;
while OuterLoop do
begin
end;
end;
+ T := GetTimer();
+ if T > TimeoutTime then
+ begin
+ TimeoutTime := T + NET_CONNECT_TIMEOUT * 100; // одного предупреждения хватит
+ g_Console_Add(_lc[I_NET_MSG_TIMEOUT_WARN], True);
+ g_Console_Add(Format(_lc[I_NET_MSG_PORTS], [Integer(Port), Integer(NET_PING_PORT)]), True);
+ end;
+
ProcessLoading(true);
if e_KeyPressed(IK_SPACE) or e_KeyPressed(IK_ESCAPE) or e_KeyPressed(VK_ESCAPE) or
end;
g_Console_Add(_lc[I_NET_MSG_ERROR] + _lc[I_NET_ERR_TIMEOUT], True);
+ g_Console_Add(Format(_lc[I_NET_MSG_PORTS], [Integer(Port), Integer(NET_PING_PORT)]), True);
if NetPeer <> nil then enet_peer_reset(NetPeer);
if NetHost <> nil then
begin
diff --git a/src/game/g_window.pas b/src/game/g_window.pas
index d790c4f852c9f468bd51c39ba4a9fd1b221faa20..88b229aa220b888697903da121c21f01e0bbe0f4 100644 (file)
--- a/src/game/g_window.pas
+++ b/src/game/g_window.pas
e_DarkenQuadWH(0, 0, gScreenWidth, gScreenHeight, 150);
DrawLoadingStat();
+ g_Console_Draw(True);
SwapBuffers();
end;
end;