summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a49e32f)
raw | patch | inline | side by side (parent: a49e32f)
author | fgsfds <pvt.fgsfds@gmail.com> | |
Sun, 11 Aug 2019 00:02:47 +0000 (03:02 +0300) | ||
committer | fgsfds <pvt.fgsfds@gmail.com> | |
Sun, 11 Aug 2019 00:02:47 +0000 (03:02 +0300) |
src/game/g_basic.pas | patch | blob | history | |
src/game/g_netmaster.pas | patch | blob | history | |
src/mastersrv/master.c | patch | blob | history |
diff --git a/src/game/g_basic.pas b/src/game/g_basic.pas
index e5ef3d9c28acdff92c10e22ddf19ef8beb635e92..bd3f50e76b3f2049e0ce6d9b41d63db4da9c8cf8 100644 (file)
--- a/src/game/g_basic.pas
+++ b/src/game/g_basic.pas
function b_Text_Format(S: string): string;
function b_Text_Unformat(S: string): string;
function b_Text_Wrap(S: string; LineLen: Integer): string;
+function b_Text_LineCount(S: string): Integer;
var
gmon_dbg_los_enabled: Boolean = true;
Result := WrapText(S, ''#10, [#10, ' ', '-'], LineLen);
end;
+function b_Text_LineCount(S: string): Integer;
+var
+ I: Integer;
+begin
+ Result := IfThen(S = '', 0, 1);
+ for I := 1 to High(S) do
+ if S[I] = #10 then
+ Inc(Result);
+end;
+
end.
index b413486f610d0276c9d82ca515efdb2a649c41ea..e8a80d691c12c1b7493940081ec72f3eb7a5becd 100644 (file)
--- a/src/game/g_netmaster.pas
+++ b/src/game/g_netmaster.pas
procedure g_Serverlist_Draw(var SL: TNetServerList; var ST: TNetServerTable);
var
Srv: TNetServer;
- sy, i, y, mw, mx, l: Integer;
+ sy, i, y, mw, mx, l, motdh: Integer;
cw: Byte = 0;
ch: Byte = 0;
ww: Word = 0;
ip := _lc[I_NET_SLIST_HELP];
mw := (Length(ip) * cw) div 2;
- e_DrawFillQuad(16, 64, gScreenWidth-16, gScreenHeight-84, 64, 64, 64, 110);
- e_DrawQuad(16, 64, gScreenWidth-16, gScreenHeight-84, 255, 127, 0);
+ motdh := gScreenHeight - 49 - ch * b_Text_LineCount(slMOTD);
+
+ e_DrawFillQuad(16, 64, gScreenWidth-16, motdh, 64, 64, 64, 110);
+ e_DrawQuad(16, 64, gScreenWidth-16, motdh, 255, 127, 0);
e_TextureFontPrintEx(gScreenWidth div 2 - mw, gScreenHeight-24, ip, gStdFont, 225, 225, 225, 1);
// MOTD
if slMOTD <> '' then
begin
- e_DrawFillQuad(16, gScreenHeight-84, gScreenWidth-16, gScreenHeight-44, 64, 64, 64, 110);
- e_DrawQuad(16, gScreenHeight-84, gScreenWidth-16, gScreenHeight-44, 255, 127, 0);
- e_TextureFontPrintFmt(20, gScreenHeight-81, slMOTD, gStdFont, False, True);
+ e_DrawFillQuad(16, motdh, gScreenWidth-16, gScreenHeight-44, 64, 64, 64, 110);
+ e_DrawQuad(16, motdh, gScreenWidth-16, gScreenHeight-44, 255, 127, 0);
+ e_TextureFontPrintFmt(20, motdh + 3, slMOTD, gStdFont, False, True);
end;
// Urgent message
if not slReadUrgent and (slUrgent <> '') then
begin
- e_DrawFillQuad(17, 65, gScreenWidth-17, gScreenHeight-85, 64, 64, 64, 128);
+ e_DrawFillQuad(17, 65, gScreenWidth-17, motdh-1, 64, 64, 64, 128);
e_DrawFillQuad(gScreenWidth div 2 - 256, gScreenHeight div 2 - 60,
gScreenWidth div 2 + 256, gScreenHeight div 2 + 60, 64, 64, 64, 128);
e_DrawQuad(gScreenWidth div 2 - 256, gScreenHeight div 2 - 60,
if SL = nil then
begin
l := Length(slWaitStr) div 2;
- e_DrawFillQuad(17, 65, gScreenWidth-17, gScreenHeight-85, 64, 64, 64, 128);
+ e_DrawFillQuad(17, 65, gScreenWidth-17, motdh-1, 64, 64, 64, 128);
e_DrawQuad(gScreenWidth div 2 - 192, gScreenHeight div 2 - 10,
gScreenWidth div 2 + 192, gScreenHeight div 2 + 11, 255, 127, 0);
e_TextureFontPrint(gScreenWidth div 2 - cw * l, gScreenHeight div 2 - ch div 2,
e_DrawLine(1, 16 + 1, sy + 41, gScreenWidth - 16 - 1, sy + 41, 255, 255, 255);
e_DrawLine(1, 16, 85, gScreenWidth - 16, 85, 255, 127, 0);
- e_DrawLine(1, 16, gScreenHeight-104, gScreenWidth-16, gScreenHeight-104, 255, 127, 0);
+ e_DrawLine(1, 16, motdh-20, gScreenWidth-16, motdh-20, 255, 127, 0);
- e_DrawLine(1, mx - 70, 64, mx - 70, gScreenHeight-84, 255, 127, 0);
- e_DrawLine(1, mx, 64, mx, gScreenHeight-104, 255, 127, 0);
- e_DrawLine(1, mx + 52, 64, mx + 52, gScreenHeight-104, 255, 127, 0);
- e_DrawLine(1, mx + 104, 64, mx + 104, gScreenHeight-104, 255, 127, 0);
+ e_DrawLine(1, mx - 70, 64, mx - 70, motdh, 255, 127, 0);
+ e_DrawLine(1, mx, 64, mx, motdh-20, 255, 127, 0);
+ e_DrawLine(1, mx + 52, 64, mx + 52, motdh-20, 255, 127, 0);
+ e_DrawLine(1, mx + 104, 64, mx + 104, motdh-20, 255, 127, 0);
e_TextureFontPrintEx(18, 68, 'NAME/MAP', gStdFont, 255, 127, 0, 1);
e_TextureFontPrintEx(mx - 68, 68, 'PING', gStdFont, 255, 127, 0, 1);
y := y + 42;
end;
- e_TextureFontPrintEx(20, gScreenHeight-101, ip, gStdFont, 205, 205, 205, 1);
+ e_TextureFontPrintEx(20, motdh-20+3, ip, gStdFont, 205, 205, 205, 1);
ip := IntToStr(Length(ST)) + _lc[I_NET_SLIST_SERVERS];
e_TextureFontPrintEx(gScreenWidth - 48 - (Length(ip) + 1)*cw,
- gScreenHeight-101, ip, gStdFont, 205, 205, 205, 1);
+ motdh-20+3, ip, gStdFont, 205, 205, 205, 1);
end;
procedure g_Serverlist_GenerateTable(SL: TNetServerList; var ST: TNetServerTable);
diff --git a/src/mastersrv/master.c b/src/mastersrv/master.c
index 9745694cef8c88a08005f5833e314cfab92d8298..ce98cfcd0a6e0772edf32b8a0f3155bc3573b291 100644 (file)
--- a/src/mastersrv/master.c
+++ b/src/mastersrv/master.c
int d_readtextfile (const char *fname, char *buf, size_t max) {
FILE *f = fopen(fname, "r");
if (f) {
- fgets(buf, max, f);
+ char line[256] = { 0 };
+ while(fgets(buffer, sizeof(line), (FILE*) fp))
+ printf("%s\n", buffer);
fclose(f);
return 0;
}