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
);
27 SysUtils
, Classes
, Math
,
29 g_basic
, g_language
, g_game
, g_menu
32 procedure r_Serverlist_Draw (var SL
: TNetServerList
; var ST
: TNetServerTable
);
35 sy
, i
, y
, mw
, mx
, l
, motdh
: Integer;
45 e_CharFont_GetSize(gMenuFont
, _lc
[I_NET_SLIST
], ww
, hh
);
46 e_CharFont_Print(gMenuFont
, (gScreenWidth
div 2) - (ww
div 2), 16, _lc
[I_NET_SLIST
]);
48 e_TextureFontGetSize(gStdFont
, cw
, ch
);
50 ip
:= _lc
[I_NET_SLIST_HELP
];
51 mw
:= (Length(ip
) * cw
) div 2;
53 motdh
:= gScreenHeight
- 49 - ch
* b_Text_LineCount(slMOTD
);
55 e_DrawFillQuad(16, 64, gScreenWidth
-16, motdh
, 64, 64, 64, 110);
56 e_DrawQuad(16, 64, gScreenWidth
-16, motdh
, 255, 127, 0);
58 e_TextureFontPrintEx(gScreenWidth
div 2 - mw
, gScreenHeight
-24, ip
, gStdFont
, 225, 225, 225, 1);
63 e_DrawFillQuad(16, motdh
, gScreenWidth
-16, gScreenHeight
-44, 64, 64, 64, 110);
64 e_DrawQuad(16, motdh
, gScreenWidth
-16, gScreenHeight
-44, 255, 127, 0);
65 e_TextureFontPrintFmt(20, motdh
+ 3, slMOTD
, gStdFont
, False, True);
69 if not slReadUrgent
and (slUrgent
<> '') then
71 e_DrawFillQuad(17, 65, gScreenWidth
-17, motdh
-1, 64, 64, 64, 128);
72 e_DrawFillQuad(gScreenWidth
div 2 - 256, gScreenHeight
div 2 - 60,
73 gScreenWidth
div 2 + 256, gScreenHeight
div 2 + 60, 64, 64, 64, 128);
74 e_DrawQuad(gScreenWidth
div 2 - 256, gScreenHeight
div 2 - 60,
75 gScreenWidth
div 2 + 256, gScreenHeight
div 2 + 60, 255, 127, 0);
76 e_DrawLine(1, gScreenWidth
div 2 - 256, gScreenHeight
div 2 - 40,
77 gScreenWidth
div 2 + 256, gScreenHeight
div 2 - 40, 255, 127, 0);
78 l
:= Length(_lc
[I_NET_SLIST_URGENT
]) div 2;
79 e_TextureFontPrint(gScreenWidth
div 2 - cw
* l
, gScreenHeight
div 2 - 58,
80 _lc
[I_NET_SLIST_URGENT
], gStdFont
);
81 l
:= Length(slUrgent
) div 2;
82 e_TextureFontPrintFmt(gScreenWidth
div 2 - 253, gScreenHeight
div 2 - 38,
83 slUrgent
, gStdFont
, False, True);
84 l
:= Length(_lc
[I_NET_SLIST_URGENT_CONT
]) div 2;
85 e_TextureFontPrint(gScreenWidth
div 2 - cw
* l
, gScreenHeight
div 2 + 41,
86 _lc
[I_NET_SLIST_URGENT_CONT
], gStdFont
);
87 e_DrawLine(1, gScreenWidth
div 2 - 256, gScreenHeight
div 2 + 40,
88 gScreenWidth
div 2 + 256, gScreenHeight
div 2 + 40, 255, 127, 0);
94 l
:= Length(slWaitStr
) div 2;
95 e_DrawFillQuad(17, 65, gScreenWidth
-17, motdh
-1, 64, 64, 64, 128);
96 e_DrawQuad(gScreenWidth
div 2 - 192, gScreenHeight
div 2 - 10,
97 gScreenWidth
div 2 + 192, gScreenHeight
div 2 + 11, 255, 127, 0);
98 e_TextureFontPrint(gScreenWidth
div 2 - cw
* l
, gScreenHeight
div 2 - ch
div 2,
104 if (slSelection
< Length(ST
)) then
107 sy
:= y
+ 42 * I
- 4;
108 Srv
:= GetServerFromTable(I
, SL
, ST
);
109 ip
:= _lc
[I_NET_ADDRESS
] + ' ' + Srv
.IP
+ ':' + IntToStr(Srv
.Port
);
111 ip
:= ip
+ ' ' + _lc
[I_NET_SERVER_PASSWORD
] + ' ' + _lc
[I_MENU_YES
]
113 ip
:= ip
+ ' ' + _lc
[I_NET_SERVER_PASSWORD
] + ' ' + _lc
[I_MENU_NO
];
115 if Length(ST
) > 0 then
118 mw
:= (gScreenWidth
- 188);
121 e_DrawFillQuad(16 + 1, sy
, gScreenWidth
- 16 - 1, sy
+ 40, 64, 64, 64, 0);
122 e_DrawLine(1, 16 + 1, sy
, gScreenWidth
- 16 - 1, sy
, 205, 205, 205);
123 e_DrawLine(1, 16 + 1, sy
+ 41, gScreenWidth
- 16 - 1, sy
+ 41, 255, 255, 255);
125 e_DrawLine(1, 16, 85, gScreenWidth
- 16, 85, 255, 127, 0);
126 e_DrawLine(1, 16, motdh
-20, gScreenWidth
-16, motdh
-20, 255, 127, 0);
128 e_DrawLine(1, mx
- 70, 64, mx
- 70, motdh
, 255, 127, 0);
129 e_DrawLine(1, mx
, 64, mx
, motdh
-20, 255, 127, 0);
130 e_DrawLine(1, mx
+ 52, 64, mx
+ 52, motdh
-20, 255, 127, 0);
131 e_DrawLine(1, mx
+ 104, 64, mx
+ 104, motdh
-20, 255, 127, 0);
133 e_TextureFontPrintEx(18, 68, 'NAME/MAP', gStdFont
, 255, 127, 0, 1);
134 e_TextureFontPrintEx(mx
- 68, 68, 'PING', gStdFont
, 255, 127, 0, 1);
135 e_TextureFontPrintEx(mx
+ 2, 68, 'MODE', gStdFont
, 255, 127, 0, 1);
136 e_TextureFontPrintEx(mx
+ 54, 68, 'PLRS', gStdFont
, 255, 127, 0, 1);
137 e_TextureFontPrintEx(mx
+ 106, 68, 'VER', gStdFont
, 255, 127, 0, 1);
140 for I
:= 0 to High(ST
) do
142 Srv
:= GetServerFromTable(I
, SL
, ST
);
144 e_TextureFontPrintEx(18, y
, Srv
.Name
, gStdFont
, 255, 255, 255, 1);
145 e_TextureFontPrintEx(18, y
+ 16, Srv
.Map
, gStdFont
, 210, 210, 210, 1);
147 // Ping and similar count
148 if (Srv
.Ping
< 0) or (Srv
.Ping
> 999) then
149 e_TextureFontPrintEx(mx
- 68, y
, _lc
[I_NET_SLIST_NO_ACCESS
], gStdFont
, 255, 0, 0, 1)
152 e_TextureFontPrintEx(mx
- 68, y
, '<1' + _lc
[I_NET_SLIST_PING_MS
], gStdFont
, 255, 255, 255, 1)
154 e_TextureFontPrintEx(mx
- 68, y
, IntToStr(Srv
.Ping
) + _lc
[I_NET_SLIST_PING_MS
], gStdFont
, 255, 255, 255, 1);
156 if Length(ST
[I
].Indices
) > 1 then
157 e_TextureFontPrintEx(mx
- 68, y
+ 16, '< ' + IntToStr(Length(ST
[I
].Indices
)) + ' >', gStdFont
, 210, 210, 210, 1);
160 e_TextureFontPrintEx(mx
+ 2, y
, g_Game_ModeToText(Srv
.GameMode
), gStdFont
, 255, 255, 255, 1);
163 e_TextureFontPrintEx(mx
+ 54, y
, IntToStr(Srv
.Players
) + '/' + IntToStr(Srv
.MaxPlayers
), gStdFont
, 255, 255, 255, 1);
164 e_TextureFontPrintEx(mx
+ 54, y
+ 16, IntToStr(Srv
.LocalPl
) + '+' + IntToStr(Srv
.Bots
), gStdFont
, 210, 210, 210, 1);
167 e_TextureFontPrintEx(mx
+ 106, y
, IntToStr(Srv
.Protocol
), gStdFont
, 255, 255, 255, 1);
172 e_TextureFontPrintEx(20, motdh
-20+3, ip
, gStdFont
, 205, 205, 205, 1);
173 ip
:= IntToStr(Length(ST
)) + _lc
[I_NET_SLIST_SERVERS
];
174 e_TextureFontPrintEx(gScreenWidth
- 48 - (Length(ip
) + 1)*cw
,
175 motdh
-20+3, ip
, gStdFont
, 205, 205, 205, 1);