index 8b67f060679935e743f31a0bea4daa6c279a2cda..792606e6fd1dff8c4633ad709608e4ff9d8f710b 100644 (file)
g_system,
{$ENDIF}
SysUtils, Classes, Math,
- e_log, utils,
- g_game, g_options, g_console, g_player, g_weapons, g_language,
- g_net,
+ g_basic,
+ e_log, utils, wadreader,
+ g_game, g_map, g_options, g_console, g_player, g_weapons, g_language, g_triggers,
+ g_net, g_netmaster,
r_draw, r_textures, r_fonts, r_common, r_console, r_map
;
);
var
- menuBG: TGLTexture;
+ BackgroundTexture: THereTexture;
hud, hudbg: TGLTexture;
hudhp: array [Boolean] of TGLTexture;
hudkey: array [0..2] of TGLTexture;
hudair: TGLTexture;
hudjet: TGLTexture;
+ hudrflag, hudrflags, hudrflagd: TGLTexture;
+ hudbflag, hudbflags, hudbflagd: TGLTexture;
procedure r_Render_LoadTextures;
begin
i: Integer;
begin
r_Common_Load;
- menuBG := r_Textures_LoadFromFile(GameWAD + ':TEXTURES/TITLE');
+ BackgroundTexture := DEFAULT(THereTexture);
hud := r_Textures_LoadFromFile(GameWAD + ':TEXTURES/HUD');
hudbg := r_Textures_LoadFromFile(GameWAD + ':TEXTURES/HUDBG');
hudhp[false] := r_Textures_LoadFromFile(GameWAD + ':TEXTURES/MED2');
hudkey[2] := r_Textures_LoadFromFile(GameWAD + ':TEXTURES/KEYB');
hudair := r_Textures_LoadFromFile(GameWAD + ':TEXTURES/AIRBAR');
hudjet := r_Textures_LoadFromFile(GameWAD + ':TEXTURES/JETBAR');
+ hudrflag := r_Textures_LoadFromFile(GameWAD + ':TEXTURES/FLAGHUD_R_BASE');
+ hudrflags := r_Textures_LoadFromFile(GameWAD + ':TEXTURES/FLAGHUD_R_STOLEN');
+ hudrflagd := r_Textures_LoadFromFile(GameWAD + ':TEXTURES/FLAGHUD_R_DROP');
+ hudbflag := r_Textures_LoadFromFile(GameWAD + ':TEXTURES/FLAGHUD_B_BASE');
+ hudbflags := r_Textures_LoadFromFile(GameWAD + ':TEXTURES/FLAGHUD_B_STOLEN');
+ hudbflagd := r_Textures_LoadFromFile(GameWAD + ':TEXTURES/FLAGHUD_B_DROP');
r_Console_Load;
r_Map_Load;
{$IFDEF ENABLE_MENU}
{$ENDIF}
r_Map_Free;
r_Console_Free;
+ hudbflagd.Free;
+ hudbflags.Free;
+ hudbflag.Free;
+ hudrflagd.Free;
+ hudrflags.Free;
+ hudrflag.Free;
hudjet.Free;
hudair.Free;
hudkey[0].Free;
hudhp[false].Free;
hudbg.Free;
hud.Free;
- menuBG.Free;
+ r_Common_FreeThis(BackgroundTexture);
r_Common_Free;
end;
end;
end;
+ procedure r_Render_DrawStatsView (x, y, w, h: Integer; p: TPlayer);
+ var fw, i, maxFrags, top, totalPlayers: Integer; sign: Char; stat: TPlayerStatArray; f: TGLTexture;
+ begin
+ ASSERT(p <> nil);
+
+ if gShowScore and (gGameSettings.GameMode in [GM_TDM, GM_CTF]) then
+ begin
+ (* RED TEAM GOALS *)
+ fw := 0;
+ if gGameSettings.GameMode = GM_CTF then
+ begin
+ case gFlags[FLAG_RED].State of
+ FLAG_STATE_CAPTURED: f := hudrflags;
+ FLAG_STATE_DROPPED: f := hudrflagd;
+ otherwise f := hudrflag;
+ end;
+ if f <> nil then
+ begin
+ fw := f.width + 8; (* + space *)
+ r_Render_DrawTexture(f, x + w - 16, y + 240 - 72 - 4, f.width, f.height, TBasePoint.BP_RIGHTUP);
+ end;
+ end;
+ r_Render_DrawText(IntToStr(gTeamStat[TEAM_RED].Score), x + w - 16 - fw, y + 240 - 72 - 4, TEAMCOLOR[TEAM_RED].R, TEAMCOLOR[TEAM_RED].G, TEAMCOLOR[TEAM_RED].B, 255, menufont, TBasePoint.BP_RIGHTUP);
+
+ (* BLUE TEAM GOALS *)
+ fw := 0;
+ if gGameSettings.GameMode = GM_CTF then
+ begin
+ case gFlags[FLAG_BLUE].State of
+ FLAG_STATE_CAPTURED: f := hudbflags;
+ FLAG_STATE_DROPPED: f := hudbflagd;
+ otherwise f := hudbflag;
+ end;
+ if f <> nil then
+ begin
+ fw := f.width + 8; (* + space *)
+ r_Render_DrawTexture(f, x + w - 16, y + 240 - 32 - 4, f.width, f.height, TBasePoint.BP_RIGHTUP);
+ end;
+ end;
+ r_Render_DrawText(IntToStr(gTeamStat[TEAM_BLUE].Score), x + w - 16 - fw, y + 240 - 32 - 4, TEAMCOLOR[TEAM_BLUE].R, TEAMCOLOR[TEAM_BLUE].G, TEAMCOLOR[TEAM_BLUE].B, 255, menufont, TBasePoint.BP_RIGHTUP);
+ end;
+
+ if gGameSettings.GameType in [GT_CUSTOM, GT_SERVER, GT_CLIENT] then
+ begin
+ if gShowStat then
+ begin
+ r_Render_DrawText(IntToStr(p.Frags), x + w - 16, y, 255, 0, 0, 255, menufont, TBasePoint.BP_RIGHTUP);
+
+ top := 1;
+ maxFrags := 0;
+ totalPlayers := 0;
+ stat := g_Player_GetStats();
+ if stat <> nil then
+ begin
+ totalPlayers := Length(stat);
+ for i := 0 to High(stat) do
+ begin
+ if stat[i].Name <> p.Name then
+ begin
+ maxFrags := MAX(maxFrags, stat[i].Frags);
+ if stat[i].Frags > p.Frags then
+ top := top + 1;
+ end;
+ end;
+ end;
+ if p.Frags >= maxFrags then sign := '+' else sign := '-';
+ r_Render_DrawText(IntToStr(top) + ' / ' + IntToStr(totalPlayers) + ' ' + sign + IntToStr(ABS(p.Frags - maxFrags)), x + w - 16, y + 32, 255, 0, 0, 255, smallfont, TBasePoint.BP_RIGHTUP);
+ end;
+
+ if gLMSRespawn > LMS_RESPAWN_NONE then
+ begin
+ r_Render_DrawText(_lc[I_GAME_WARMUP], x + w - 16 - 64, y + h, 0, 255, 0, 255, menufont, TBasePoint.BP_RIGHTDOWN);
+ r_Render_DrawText(': ' + IntToStr((gLMSRespawnTime - gTime) div 1000), x + w - 16 - 64, y + h, 0, 255, 0, 255, menufont, TBasePoint.BP_LEFTDOWN);
+ end
+ else if gShowLives and (gGameSettings.MaxLives > 0) then
+ begin
+ r_Render_DrawText(IntToStr(p.Lives), x + w - 16, y + h, 0, 255, 0, 255, menufont, TBasePoint.BP_RIGHTDOWN);
+ end;
+ end;
+ end;
+
procedure r_Render_DrawView (x, y, w, h: Integer; p: TPlayer);
var l, t, r, b: Integer;
begin
r_Draw_GetRect(l, t, r, b);
r_Draw_SetRect(x, y, x + w, y + h);
- if p <> nil then
- r_Map_Draw(x, y, w, h, p.obj.x + PLAYER_RECT_CX, p.obj.y + PLAYER_RECT_CY, p)
- else
- r_Map_Draw(x, y, w, h, 0, 0, nil);
-
- // TODO draw stats
-
if p <> nil then
begin
+ r_Map_Draw(x, y, w, h, p.obj.x + PLAYER_RECT_CX, p.obj.y + PLAYER_RECT_CY, p);
+ r_Render_DrawStatsView(x, y, w, h, p);
if p.Spectator and p.NoRespawn then
r_Render_DrawText(_lc[I_PLAYER_SPECT4], x div 2 + w div 2, y div 2 + h div 2, 255, 255, 255, 255, stdfont, TBasePoint.BP_CENTER);
+ end
+ else
+ begin
+ r_Map_Draw(x, y, w, h, 0, 0, nil);
end;
r_Draw_SetRect(l, t, r, b);
r_Draw_SetRect(l, t, r, b);
end;
+ procedure r_Render_DrawBackgroundImage (img: TGLTexture);
+ var fw, w, h: LongInt;
+ begin
+ if img <> nil then
+ begin
+ img := BackgroundTexture.id;
+ if img.width = img.height then fw := img.width * 4 div 3 else fw := img.width; // fix aspect 4:3
+ r_Common_CalcAspect(fw, img.height, gScreenWidth, gScreenHeight, false, w, h);
+ r_Draw_Texture(img, gScreenWidth div 2 - w div 2, 0, w, h, false, 255, 255, 255, 255, false);
+ end
+ end;
+
+ procedure r_Render_DrawBackground (const name: AnsiString);
+ begin
+ if r_Common_LoadThis(name, BackgroundTexture) then
+ r_Render_DrawBackgroundImage(BackgroundTexture.id)
+ end;
+
+ procedure r_Render_DrawServerList (var SL: TNetServerList; var ST: TNetServerTable);
+ var ip: AnsiString; ww, hh, cw, ch, mw, mh, motdh, scrx, scry, i, mx, y: Integer; msg: SSArray; Srv: TNetServer;
+ begin
+ scrx := gScreenWidth div 2;
+ scry := gScreenHeight div 2;
+
+ r_Draw_GetTextSize(_lc[I_NET_SLIST], menufont, ww, hh);
+ r_Render_DrawText(_lc[I_NET_SLIST], gScreenWidth div 2, 16, 255, 255, 255, 255, menufont, TBasePoint.BP_UP);
+
+ r_Draw_GetTextSize('W', stdfont, cw, ch);
+ motdh := gScreenHeight - 49 - ch * b_Text_LineCount(slMOTD);
+
+ r_Draw_FillRect(16, 64, gScreenWidth - 16, motdh, 64, 64, 64, 145);
+ r_Draw_Rect(16, 64, gScreenWidth - 16, motdh, 255, 127, 0, 255);
+
+ r_Render_DrawText(_lc[I_NET_SLIST_HELP], gScreenWidth div 2, gScreenHeight - 8, 255, 255, 255, 255, stdfont, TBasePoint.BP_DOWN);
+
+ if slMOTD <> '' then
+ begin
+ r_Draw_FillRect(16, motdh, gScreenWidth - 16, gScreenHeight - 44, 64, 64, 64, 110);
+ r_Draw_Rect(16, motdh, gScreenWidth - 16, gScreenHeight - 44, 255, 127, 0, 255);
+ msg := Parse2(slMOTD, #10);
+ for i := 0 to High(msg) do
+ r_Render_DrawText(msg[i], 20, motdh + 3 + ch * i, 255, 255, 255, 255, stdfont, TBasePoint.BP_LEFTUP);
+ end;
+
+ if not slReadUrgent and (slUrgent <> '') then
+ begin
+ r_Draw_FillRect(17, 65, gScreenWidth - 17, motdh - 1, 64, 64, 64, 127);
+ r_Draw_FillRect(scrx - 256, scry - 60, scrx + 256, scry + 60, 64, 64, 64, 127);
+ r_Draw_Rect(scrx - 256, scry - 60, scrx + 256, scry + 60, 255, 127, 0, 255);
+ r_Draw_FillRect(scrx - 256, scry - 40, scrx + 256, scry - 40, 255, 127, 0, 255);
+ r_Render_DrawText(_lc[I_NET_SLIST_URGENT], scrx, scry - 58, 255, 255, 255, 255, stdfont, TBasePoint.BP_UP);
+ msg := Parse2(slUrgent, #10);
+ for i := 0 to High(msg) do
+ r_Render_DrawText(msg[i], scrx - 253, scry - 38 + ch * i, 255, 255, 255, 255, stdfont, TBasePoint.BP_LEFTUP);
+ r_Render_DrawText(_lc[I_NET_SLIST_URGENT_CONT], scrx, scry + 41, 255, 255, 255, 255, stdfont, TBasePoint.BP_UP);
+ r_Draw_FillRect(scrx - 256, scry + 40, scrx + 256, scry + 40, 255, 127, 0, 255);
+ end
+ else if SL = nil then
+ begin
+ r_Draw_FillRect(17, 65, gScreenWidth - 17, motdh - 1, 64, 64, 64, 127);
+ r_Draw_Rect(scrx - 192, scry - 10, scrx + 192, scry + 11, 255, 127, 0, 255);
+ r_Render_DrawText(slWaitStr, scrx, scry, 255, 255, 255, 255, stdfont, TBasePoint.BP_CENTER);
+ end
+ else
+ begin
+ y := 90;
+ if slSelection < Length(ST) then
+ begin
+ sy := y + 42 * slSelection - 4;
+ Srv := GetServerFromTable(slSelection, SL, ST);
+ ip := _lc[I_NET_ADDRESS] + ' ' + Srv.IP + ':' + IntToStr(Srv.Port);
+ ip := ip + ' ' + _lc[I_NET_SERVER_PASSWORD] + ' ';
+ if Srv.Password then ip := ip + _lc[I_MENU_YES] else ip := ip +_lc[I_MENU_NO];
+ end;
+
+ mw := gScreenWidth - 188;
+ mx := 16 + mw;
+
+ r_Draw_FillRect(16 + 1, sy, gScreenWidth - 16 - 1, sy + 40, 64, 64, 64, 255);
+ r_Draw_FillRect(16 + 1, sy, gScreenWidth - 16 - 1, sy, 205, 205, 205, 255);
+ r_Draw_FillRect(16 + 1, sy + 41, gScreenWidth - 16 - 1, sy + 41, 255, 255, 255, 255);
+
+ r_Draw_FillRect(16, 85, gScreenWidth - 16, 85, 255, 127, 0, 255);
+ r_Draw_FillRect(16, motdh - 20, gScreenWidth - 16, motdh - 20, 255, 127, 0, 255);
+
+ r_Draw_FillRect(mx - 70, 64, mx - 70, motdh, 255, 127, 0, 255);
+ r_Draw_FillRect(mx, 64, mx, motdh - 20, 255, 127, 0, 255);
+ r_Draw_FillRect(mx + 52, 64, mx + 52, motdh - 20, 255, 127, 0, 255);
+ r_Draw_FillRect(mx + 104, 64, mx + 104, motdh - 20, 255, 127, 0, 255);
+
+ r_Render_DrawText('NAME/MAP', 18, 68, 255, 127, 0, 255, stdfont, TBasePoint.BP_LEFTUP);
+ r_Render_DrawText('PING', mx - 68, 68, 255, 127, 0, 255, stdfont, TBasePoint.BP_LEFTUP);
+ r_Render_DrawText('MODE', mx + 2, 68, 255, 127, 0, 255, stdfont, TBasePoint.BP_LEFTUP);
+ r_Render_DrawText('PLRS', mx + 54, 68, 255, 127, 0, 255, stdfont, TBasePoint.BP_LEFTUP);
+ r_Render_DrawText('VER', mx + 106, 68, 255, 127, 0, 255, stdfont, TBasePoint.BP_LEFTUP);
+
+ for i := 0 to High(ST) do
+ begin
+ Srv := GetServerFromTable(i, SL, ST);
+ r_Render_DrawText(Srv.Name, 18, y, 255, 255, 255, 255, stdfont, TBasePoint.BP_LEFTUP);
+ r_Render_DrawText(Srv.Map, 18, y + 16, 210, 210, 210, 255, stdfont, TBasePoint.BP_LEFTUP);
+
+ if Srv.Ping = 0 then
+ r_Render_DrawText('<1' + _lc[I_NET_SLIST_PING_MS], mx - 68, y, 255, 255, 255, 255, stdfont, TBasePoint.BP_LEFTUP)
+ else if (Srv.Ping >= 0) and (Srv.Ping <= 999) then
+ r_Render_DrawText(IntToStr(Srv.Ping) + _lc[I_NET_SLIST_PING_MS], mx - 68, y, 255, 255, 255, 255, stdfont, TBasePoint.BP_LEFTUP)
+ else
+ r_Render_DrawText(_lc[I_NET_SLIST_NO_ACCESS], mx - 68, y, 255, 0, 0, 255, stdfont, TBasePoint.BP_LEFTUP);
+ if Length(ST[I].Indices) > 1 then
+ r_Render_DrawText('<' + IntToStr(Length(ST[I].Indices)) + '>', mx - 68, y + 16, 210, 210, 210, 255, stdfont, TBasePoint.BP_LEFTUP);
+
+ r_Render_DrawText(g_Game_ModeToText(Srv.GameMode), mx + 2, y, 255, 255, 255, 255, stdfont, TBasePoint.BP_LEFTUP);
+
+ r_Render_DrawText(IntToStr(Srv.Players) + '/' + IntToStr(Srv.MaxPlayers), mx + 54, y, 255, 255, 255, 255, stdfont, TBasePoint.BP_LEFTUP);
+ r_Render_DrawText(IntToStr(Srv.LocalPl) + '+' + IntToStr(Srv.Bots), mx + 54, y + 16, 210, 210, 210, 255, stdfont, TBasePoint.BP_LEFTUP);
+
+ r_Render_DrawText(IntToStr(Srv.Protocol), mx + 106, y, 255, 255, 255, 255, stdfont, TBasePoint.BP_LEFTUP);
+
+ y := y + 42;
+ end;
+
+ r_Render_DrawText(ip, 20, motdh - 20 + 3, 205, 205, 205, 255, stdfont, TBasePoint.BP_LEFTUP);
+ r_Render_DrawText(IntToStr(Length(ST)) + _lc[I_NET_SLIST_SERVERS], gScreenWidth - 48, motdh - 20 + 3, 255, 255, 255, 255, stdfont, TBasePoint.BP_RIGHTUP);
+ end;
+ end;
+
+ function r_Render_TimeToStr (t: LongWord): AnsiString;
+ var h, m, s: Integer;
+ begin
+ h := t div 1000 div 3600;
+ m := t div 1000 div 60 mod 60;
+ s := t div 1000 mod 60;
+ result := Format('%d:%.2d:%.2d', [h, m, s]);
+ end;
+
+ procedure r_Render_DrawStatsColumns (stat: TPlayerStatArray; x, y, w, w1, w2, w3, w4: Integer);
+ var i, cw, ch, yy, team: Integer; r, g, b, rr, gg, bb: Byte; s: AnsiString;
+ begin
+ ASSERT(stat <> nil);
+ r_Draw_GetTextSize('W', stdfont, cw, ch);
+ yy := y;
+ if gGameSettings.GameMode in [GM_TDM, GM_CTF] then
+ begin
+ for team := TEAM_RED to TEAM_BLUE do
+ begin
+ case team of
+ TEAM_RED:
+ begin
+ s := _lc[I_GAME_TEAM_RED];
+ r := 255; g := 0; b := 0;
+ end;
+ TEAM_BLUE:
+ begin
+ s := _lc[I_GAME_TEAM_BLUE];
+ r := 0; g := 0; b := 255;
+ end;
+ end;
+ r_Render_DrawText(s, x, yy, r, g, b, 255, stdfont, TBasePoint.BP_LEFTUP);
+ r_Render_DrawText(IntToStr(gTeamStat[team].Score), x + w1, yy, r, g, b, 255, stdfont, TBasePoint.BP_LEFTUP);
+ INC(yy, ch);
+
+ INC(yy, ch div 4);
+ r_Draw_FillRect(x, yy, x + w - 1, yy, r, g, b, 255);
+ INC(yy, ch div 4);
+
+ for i := 0 to High(stat) do
+ begin
+ if stat[i].Team = team then
+ begin
+ rr := r; gg := g; bb := b;
+ if stat[i].Spectator then
+ begin
+ rr := r div 2; gg := g div 2; bb := b div 2;
+ end;
+
+ // Player name
+ if gShowPIDs then s := Format('[%5d] %s', [stat[i].UID, stat[i].Name]) else s := stat[i].Name;
+ r_Render_DrawText(s, x, yy, rr, gg, bb, 255, stdfont, TBasePoint.BP_LEFTUP);
+ // Player ping/loss
+ s := Format(_lc[I_GAME_PING_MS], [stat[i].Ping, stat[i].Loss]);
+ r_Render_DrawText(s, x + w1, yy, rr, gg, bb, 255, stdfont, TBasePoint.BP_LEFTUP);
+ // Player frags
+ s := IntToStr(stat[i].Frags);
+ r_Render_DrawText(s, x + w1 + w2, yy, rr, gg, bb, 255, stdfont, TBasePoint.BP_LEFTUP);
+ // Player deaths
+ s := IntToStr(stat[i].Deaths);
+ r_Render_DrawText(s, x + w1 + w2 + w3, yy, rr, gg, bb, 255, stdfont, TBasePoint.BP_LEFTUP);
+
+ INC(yy, ch);
+ end;
+ end;
+ INC(yy, ch);
+ end;
+ end
+ else if gGameSettings.GameMode in [GM_DM, GM_COOP] then
+ begin
+ r_Render_DrawText(_lc[I_GAME_PLAYER_NAME], x, yy, 255, 127, 0, 255, stdfont, TBasePoint.BP_LEFTUP);
+ r_Render_DrawText(_lc[I_GAME_PING], x + w1, yy, 255, 127, 0, 255, stdfont, TBasePoint.BP_LEFTUP);
+ r_Render_DrawText(_lc[I_GAME_FRAGS], x + w1 + w2, yy, 255, 127, 0, 255, stdfont, TBasePoint.BP_LEFTUP);
+ r_Render_DrawText(_lc[I_GAME_DEATHS], x + w1 + w2 + w3, yy, 255, 127, 0, 255, stdfont, TBasePoint.BP_LEFTUP);
+ INC(yy, ch + 8);
+ for i := 0 to High(stat) do
+ begin
+ rr := 255; gg := 127; bb := 0;
+ if stat[i].Spectator then
+ begin
+ rr := 127; gg := 63; bb := 0;
+ end;
+
+ // Player color
+ r_Draw_Rect(x, yy, x + 16 - 1, yy + 16 - 1, 192, 192, 192, 255);
+ r_Draw_FillRect(x + 1, yy + 1, x + 16 - 1, yy + 16 - 1, stat[i].Color.R, stat[i].Color.G, stat[i].Color.B, 255);
+ // Player name
+ if gShowPIDs then s := Format('[%5d] %s', [stat[i].UID, stat[i].Name]) else s := stat[i].Name;
+ r_Render_DrawText(s, x + 16 + 8, yy, 192, 192, 192, 255, stdfont, TBasePoint.BP_LEFTUP);
+ // Player ping/loss
+ s := Format(_lc[I_GAME_PING_MS], [stat[i].Ping, stat[i].Loss]);
+ r_Render_DrawText(s, x + w1, yy, rr, gg, bb, 255, stdfont, TBasePoint.BP_LEFTUP);
+ // Player frags
+ s := IntToStr(stat[i].Frags);
+ r_Render_DrawText(s, x + w1 + w2, yy, rr, gg, bb, 255, stdfont, TBasePoint.BP_LEFTUP);
+ // Player deaths
+ s := IntToStr(stat[i].Deaths);
+ r_Render_DrawText(s, x + w1 + w2 + w3, yy, rr, gg, bb, 255, stdfont, TBasePoint.BP_LEFTUP);
+
+ INC(yy, ch + 8);
+ end;
+ end;
+ end;
+
+ procedure r_Render_DrawStats;
+ var x, y, w, h, cw, ch, players, w1, w2, w3, w4: Integer; s: AnsiString; stat: TPlayerStatArray;
+ begin
+ players := g_Player_GetCount();
+ r_Draw_GetTextSize('W', stdfont, cw, ch);
+ w := gScreenWidth - (gScreenWidth div 5);
+ h := IfThen(gGameSettings.GameMode in [GM_TDM, GM_CTF], 32 + ch * (11 + players), 40 + ch * 5 + (ch + 8) * players);
+ x := (gScreenWidth div 2) - (w div 2);
+ y := (gScreenHeight div 2) - (h div 2);
+
+ r_Draw_FillRect(x, y, x + w - 1, y + h - 1, 64, 64, 64, 224);
+ r_Draw_Rect(x, y, x + w - 1, y + h - 1, 255, 127, 0, 255);
+
+ case NetMode of
+ NET_SERVER: s := _lc[I_NET_SERVER];
+ NET_CLIENT: s := NetClientIP + ':' + IntToStr(NetClientPort);
+ otherwise s := '';
+ end;
+ r_Render_DrawText(s, x + 16, y + 8, 255, 255, 255, 255, stdfont, TBasePoint.BP_LEFTUP);
+ case gGameSettings.GameMode of
+ GM_DM: if gGameSettings.MaxLives = 0 then s := _lc[I_GAME_DM] else s := _lc[I_GAME_LMS];
+ GM_TDM: if gGameSettings.MaxLives = 0 then s := _lc[I_GAME_TDM] else s := _lc[I_GAME_TLMS];
+ GM_CTF: s := _lc[I_GAME_CTF];
+ GM_COOP: if gGameSettings.MaxLives = 0 then s := _lc[I_GAME_COOP] else s := _lc[I_GAME_SURV];
+ otherwise s := 'Game mode ' + IntToStr(gGameSettings.GameMode);
+ end;
+ r_Render_DrawText(s, x + w div 2, y + 8, 255, 255, 255, 255, stdfont, TBasePoint.BP_UP);
+ r_Render_DrawText(r_Render_TimeToStr(gTime), x + w - 16, y + 8, 255, 255, 255, 255, stdfont, TBasePoint.BP_RIGHTUP);
+
+ s := g_ExtractWadNameNoPath(gMapInfo.Map) + ':\' + g_ExtractFileName(gMapInfo.Map) + ' - ' + gMapInfo.Name;
+ r_Render_DrawText(s, x + w div 2, y + 8 + 24, 200, 200, 200, 255, stdfont, TBasePoint.BP_UP);
+
+ case gGameSettings.GameMode of
+ GM_DM, GM_TDM: s := Format(_lc[I_GAME_FRAG_LIMIT], [gGameSettings.ScoreLimit]);
+ GM_CTF: s := Format(_lc[I_GAME_SCORE_LIMIT], [gGameSettings.ScoreLimit]);
+ GM_COOP: s := _lc[I_GAME_MONSTERS] + ' ' + IntToStr(gCoopMonstersKilled) + '/' + IntToStr(gTotalMonsters);
+ otherwise s := '';
+ end;
+ r_Render_DrawText(s, x + 16, y + 8 + 48, 200, 200, 200, 255, stdfont, TBasePoint.BP_LEFTUP);
+
+ case gGameSettings.GameMode of
+ GM_DM, GM_TDM, GM_CTF: s := Format(_lc[I_GAME_TIME_LIMIT], [gGameSettings.TimeLimit div 3600, (gGameSettings.TimeLimit div 60) mod 60, gGameSettings.TimeLimit mod 60]);
+ GM_COOP: s := _lc[I_GAME_SECRETS] + ' ' + IntToStr(gCoopSecretsFound) + '/' + IntToStr(gSecretsCount);
+ otherwise s := '';
+ end;
+ r_Render_DrawText(s, x + w - 16, y + 8 + 48, 200, 200, 200, 255, stdfont, TBasePoint.BP_RIGHTUP);
+
+ if players > 0 then
+ begin
+ stat := g_Player_GetStats();
+ SortGameStat(stat);
+ w2 := (w - 16) div 6 + 48;
+ w3 := (w - 16) div 6;
+ w4 := w3;
+ w1 := w - 16 - w2 - w3 - w4;
+ r_Render_DrawStatsColumns(stat, x + 16, y + 8 + 80, w - 16, w1, w2, w3, w4);
+ end;
+ end;
+
procedure r_Render_Draw;
begin
if gExit = EXIT_QUIT then
//e_LogWritefln('r_render_draw: %sx%s', [gScreenWidth, gScreenHeight]);
- if gGameOn or (gState = STATE_FOLD) then
+ if gGameOn or ((gState in [STATE_FOLD]) and (EndingGameCounter < 255)) then
begin
- // TODO setup player view
// TODO setup sectator mode
// TODO setup player hear point
- // TODO setup player view siz
- // TODO draw player view + setup screen coords
if (gPlayer1 <> nil) and (gPlayer2 <> nil) then
- begin
+ begin
r_Render_DrawPlayerView(0, 0, gScreenWidth, gScreenHeight div 2 - 2, gPlayer1);
r_Render_DrawPlayerView(0, gScreenHeight div 2 + 2, gScreenWidth, gScreenHeight div 2, gPlayer2);
end
// TODO draw holmes inspector
// TODO draw messages
- // TODO draw stats (?)
+ if IsDrawStat or (gSpectMode = SPECT_STATS) then
+ r_Render_DrawStats;
// TODO draw spectator hud
end;
if not gGameOn then
begin
case gState of
- STATE_MENU: ; // TODO draw menu bg
- STATE_FOLD: ;
- STATE_INTERCUSTOM: ;
- STATE_INTERSINGLE: ;
- STATE_ENDPIC: ;
- STATE_SLIST: ;
+ STATE_NONE: (* do nothing *) ;
+ STATE_MENU: r_Render_DrawBackground(GameWad + ':TEXTURES/TITLE');
+ STATE_FOLD:
+ begin
+ if EndingGameCounter > 0 then
+ r_Draw_FillRect(0, 0, gScreenWidth - 1, gScreenHeight - 1, 0, 0, 0, MIN(MAX(255 - EndingGameCounter, 0), 255));
+ end;
+ STATE_INTERCUSTOM:
+ begin
+ if gLastMap and (gGameSettings.GameMode = GM_COOP) then
+ if EndPicPath <> '' then
+ r_Render_DrawBackground(EndPicPath)
+ else
+ r_Render_DrawBackground(GameWad + ':TEXTURES/' + _lc[I_TEXTURE_ENDPIC])
+ else
+ r_Render_DrawBackground(GameWad + ':TEXTURES/INTER');
+ // TODO draw custom stata
+ {$IFDEF ENABLE_MENU}
+ if g_ActiveWindow <> nil then
+ r_Draw_FillRect(0, 0, gScreenWidth - 1, gScreenHeight - 1, 0, 0, 0, 105);
+ {$ENDIF}
+ end;
+ STATE_INTERSINGLE, STATE_INTERTEXT, STATE_INTERPIC:
+ begin
+ if EndingGameCounter > 0 then
+ begin
+ r_Draw_FillRect(0, 0, gScreenWidth - 1, gScreenHeight - 1, 0, 0, 0, MIN(MAX(255 - EndingGameCounter, 0), 255));
+ end
+ else
+ begin
+ r_Render_DrawBackground(GameWad + ':TEXTURES/INTER');
+ // TODO darw single stats
+ {$IFDEF ENABLE_MENU}
+ if g_ActiveWindow <> nil then
+ r_Draw_FillRect(0, 0, gScreenWidth - 1, gScreenHeight - 1, 0, 0, 0, 105);
+ {$ENDIF}
+ end;
+ end;
+ STATE_ENDPIC:
+ begin
+ if EndPicPath <> '' then
+ r_Render_DrawBackground(EndPicPath)
+ else
+ r_Render_DrawBackground(GameWad + ':TEXTURES/' + _lc[I_TEXTURE_ENDPIC]);
+ {$IFDEF ENABLE_MENU}
+ if g_ActiveWindow <> nil then
+ r_Draw_FillRect(0, 0, gScreenWidth - 1, gScreenHeight - 1, 0, 0, 0, 105);
+ {$ENDIF}
+ end;
+ STATE_SLIST:
+ begin
+ r_Render_DrawBackground(GameWad + ':TEXTURES/TITLE');
+ r_Draw_FillRect(0, 0, gScreenWidth - 1, gScreenHeight - 1, 0, 0, 0, 105);
+ r_Render_DrawServerList(slCurrent, slTable);
+ end;
end;
end;
// TODO draw holmes interface
- glFinish();
glFlush();
+ glFinish();
sys_Repaint;
end;