1 (* Copyright (C) Doom 2D: Forever Developers
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, version 3 of the License ONLY.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 {$INCLUDE ../../shared/a_modes.inc}
22 procedure r_Serverlist_Draw (var SL
: TNetServerList
; var ST
: TNetServerTable
);
30 SysUtils
, Classes
, Math
,
32 g_basic
, g_language
, g_game
35 procedure r_Serverlist_Draw (var SL
: TNetServerList
; var ST
: TNetServerTable
);
38 sy
, i
, y
, mw
, mx
, l
, motdh
: Integer;
48 e_CharFont_GetSize(gMenuFont
, _lc
[I_NET_SLIST
], ww
, hh
);
49 e_CharFont_Print(gMenuFont
, (gScreenWidth
div 2) - (ww
div 2), 16, _lc
[I_NET_SLIST
]);
51 e_TextureFontGetSize(gStdFont
, cw
, ch
);
53 ip
:= _lc
[I_NET_SLIST_HELP
];
54 mw
:= (Length(ip
) * cw
) div 2;
56 motdh
:= gScreenHeight
- 49 - ch
* b_Text_LineCount(slMOTD
);
58 e_DrawFillQuad(16, 64, gScreenWidth
-16, motdh
, 64, 64, 64, 110);
59 e_DrawQuad(16, 64, gScreenWidth
-16, motdh
, 255, 127, 0);
61 e_TextureFontPrintEx(gScreenWidth
div 2 - mw
, gScreenHeight
-24, ip
, gStdFont
, 225, 225, 225, 1);
66 e_DrawFillQuad(16, motdh
, gScreenWidth
-16, gScreenHeight
-44, 64, 64, 64, 110);
67 e_DrawQuad(16, motdh
, gScreenWidth
-16, gScreenHeight
-44, 255, 127, 0);
68 e_TextureFontPrintFmt(20, motdh
+ 3, slMOTD
, gStdFont
, False, True);
72 if not slReadUrgent
and (slUrgent
<> '') then
74 e_DrawFillQuad(17, 65, gScreenWidth
-17, motdh
-1, 64, 64, 64, 128);
75 e_DrawFillQuad(gScreenWidth
div 2 - 256, gScreenHeight
div 2 - 60,
76 gScreenWidth
div 2 + 256, gScreenHeight
div 2 + 60, 64, 64, 64, 128);
77 e_DrawQuad(gScreenWidth
div 2 - 256, gScreenHeight
div 2 - 60,
78 gScreenWidth
div 2 + 256, gScreenHeight
div 2 + 60, 255, 127, 0);
79 e_DrawLine(1, gScreenWidth
div 2 - 256, gScreenHeight
div 2 - 40,
80 gScreenWidth
div 2 + 256, gScreenHeight
div 2 - 40, 255, 127, 0);
81 l
:= Length(_lc
[I_NET_SLIST_URGENT
]) div 2;
82 e_TextureFontPrint(gScreenWidth
div 2 - cw
* l
, gScreenHeight
div 2 - 58,
83 _lc
[I_NET_SLIST_URGENT
], gStdFont
);
84 l
:= Length(slUrgent
) div 2;
85 e_TextureFontPrintFmt(gScreenWidth
div 2 - 253, gScreenHeight
div 2 - 38,
86 slUrgent
, gStdFont
, False, True);
87 l
:= Length(_lc
[I_NET_SLIST_URGENT_CONT
]) div 2;
88 e_TextureFontPrint(gScreenWidth
div 2 - cw
* l
, gScreenHeight
div 2 + 41,
89 _lc
[I_NET_SLIST_URGENT_CONT
], gStdFont
);
90 e_DrawLine(1, gScreenWidth
div 2 - 256, gScreenHeight
div 2 + 40,
91 gScreenWidth
div 2 + 256, gScreenHeight
div 2 + 40, 255, 127, 0);
97 l
:= Length(slWaitStr
) div 2;
98 e_DrawFillQuad(17, 65, gScreenWidth
-17, motdh
-1, 64, 64, 64, 128);
99 e_DrawQuad(gScreenWidth
div 2 - 192, gScreenHeight
div 2 - 10,
100 gScreenWidth
div 2 + 192, gScreenHeight
div 2 + 11, 255, 127, 0);
101 e_TextureFontPrint(gScreenWidth
div 2 - cw
* l
, gScreenHeight
div 2 - ch
div 2,
102 slWaitStr
, gStdFont
);
107 if (slSelection
< Length(ST
)) then
110 sy
:= y
+ 42 * I
- 4;
111 Srv
:= GetServerFromTable(I
, SL
, ST
);
112 ip
:= _lc
[I_NET_ADDRESS
] + ' ' + Srv
.IP
+ ':' + IntToStr(Srv
.Port
);
114 ip
:= ip
+ ' ' + _lc
[I_NET_SERVER_PASSWORD
] + ' ' + _lc
[I_MENU_YES
]
116 ip
:= ip
+ ' ' + _lc
[I_NET_SERVER_PASSWORD
] + ' ' + _lc
[I_MENU_NO
];
118 if Length(ST
) > 0 then
121 mw
:= (gScreenWidth
- 188);
124 e_DrawFillQuad(16 + 1, sy
, gScreenWidth
- 16 - 1, sy
+ 40, 64, 64, 64, 0);
125 e_DrawLine(1, 16 + 1, sy
, gScreenWidth
- 16 - 1, sy
, 205, 205, 205);
126 e_DrawLine(1, 16 + 1, sy
+ 41, gScreenWidth
- 16 - 1, sy
+ 41, 255, 255, 255);
128 e_DrawLine(1, 16, 85, gScreenWidth
- 16, 85, 255, 127, 0);
129 e_DrawLine(1, 16, motdh
-20, gScreenWidth
-16, motdh
-20, 255, 127, 0);
131 e_DrawLine(1, mx
- 70, 64, mx
- 70, motdh
, 255, 127, 0);
132 e_DrawLine(1, mx
, 64, mx
, motdh
-20, 255, 127, 0);
133 e_DrawLine(1, mx
+ 52, 64, mx
+ 52, motdh
-20, 255, 127, 0);
134 e_DrawLine(1, mx
+ 104, 64, mx
+ 104, motdh
-20, 255, 127, 0);
136 e_TextureFontPrintEx(18, 68, 'NAME/MAP', gStdFont
, 255, 127, 0, 1);
137 e_TextureFontPrintEx(mx
- 68, 68, 'PING', gStdFont
, 255, 127, 0, 1);
138 e_TextureFontPrintEx(mx
+ 2, 68, 'MODE', gStdFont
, 255, 127, 0, 1);
139 e_TextureFontPrintEx(mx
+ 54, 68, 'PLRS', gStdFont
, 255, 127, 0, 1);
140 e_TextureFontPrintEx(mx
+ 106, 68, 'VER', gStdFont
, 255, 127, 0, 1);
143 for I
:= 0 to High(ST
) do
145 Srv
:= GetServerFromTable(I
, SL
, ST
);
147 e_TextureFontPrintEx(18, y
, Srv
.Name
, gStdFont
, 255, 255, 255, 1);
148 e_TextureFontPrintEx(18, y
+ 16, Srv
.Map
, gStdFont
, 210, 210, 210, 1);
150 // Ping and similar count
151 if (Srv
.Ping
< 0) or (Srv
.Ping
> 999) then
152 e_TextureFontPrintEx(mx
- 68, y
, _lc
[I_NET_SLIST_NO_ACCESS
], gStdFont
, 255, 0, 0, 1)
155 e_TextureFontPrintEx(mx
- 68, y
, '<1' + _lc
[I_NET_SLIST_PING_MS
], gStdFont
, 255, 255, 255, 1)
157 e_TextureFontPrintEx(mx
- 68, y
, IntToStr(Srv
.Ping
) + _lc
[I_NET_SLIST_PING_MS
], gStdFont
, 255, 255, 255, 1);
159 if Length(ST
[I
].Indices
) > 1 then
160 e_TextureFontPrintEx(mx
- 68, y
+ 16, '< ' + IntToStr(Length(ST
[I
].Indices
)) + ' >', gStdFont
, 210, 210, 210, 1);
163 e_TextureFontPrintEx(mx
+ 2, y
, g_Game_ModeToText(Srv
.GameMode
), gStdFont
, 255, 255, 255, 1);
166 e_TextureFontPrintEx(mx
+ 54, y
, IntToStr(Srv
.Players
) + '/' + IntToStr(Srv
.MaxPlayers
), gStdFont
, 255, 255, 255, 1);
167 e_TextureFontPrintEx(mx
+ 54, y
+ 16, IntToStr(Srv
.LocalPl
) + '+' + IntToStr(Srv
.Bots
), gStdFont
, 210, 210, 210, 1);
170 e_TextureFontPrintEx(mx
+ 106, y
, IntToStr(Srv
.Protocol
), gStdFont
, 255, 255, 255, 1);
175 e_TextureFontPrintEx(20, motdh
-20+3, ip
, gStdFont
, 205, 205, 205, 1);
176 ip
:= IntToStr(Length(ST
)) + _lc
[I_NET_SLIST_SERVERS
];
177 e_TextureFontPrintEx(gScreenWidth
- 48 - (Length(ip
) + 1)*cw
,
178 motdh
-20+3, ip
, gStdFont
, 205, 205, 205, 1);