index a11ca7fc02fbf4843d4b051c25532c59a54a7165..bfd0d826ec3a157f2b92d05a5aec88552e54b992 100644 (file)
g_base // TRectWH
;
+ type
+ TProcedure = procedure;
+
(* render startup *)
procedure r_Render_Initialize;
procedure r_Render_Finalize;
procedure r_Render_LoadTextures;
procedure r_Render_FreeTextures;
+ procedure r_Render_Reset;
procedure r_Render_Update;
procedure r_Render_Draw;
procedure r_Render_GetStringSize (BigFont: Boolean; str: String; out w, h: Integer);
{$ENDIF}
- procedure r_Render_DrawLoading (force: Boolean); // !!! remove it
+ procedure r_Render_SetProcessLoadingCallback (p: TProcedure);
+ procedure r_Render_ClearLoading;
+ procedure r_Render_SetLoading (const text: String; maxval: Integer);
+ procedure r_Render_StepLoading (incval: Integer);
+ procedure r_Render_DrawLoading (force: Boolean);
+
+ {$IFDEF ENABLE_HOLMES}
+ function pmsCurMapX (): Integer;
+ function pmsCurMapY (): Integer;
+ function r_Render_HolmesViewIsSet (): Boolean;
+ {$ENDIF}
implementation
uses
- {$IFDEF USE_GLES1}
- GLES11,
- {$ELSE}
- GL, GLEXT,
- {$ENDIF}
+ {$I ../../../nogl/noGLuses.inc}
{$IFDEF ENABLE_MENU}
r_gui,
{$ENDIF}
{$IFDEF ENABLE_SYSTEM}
g_system,
{$ENDIF}
+ {$IFDEF ENABLE_TOUCH}
+ r_touch,
+ {$ENDIF}
+ {$IFDEF ENABLE_HOLMES}
+ r_holmes,
+ {$ENDIF}
SysUtils, Classes, Math,
g_basic,
e_log, utils, wadreader, mapdef,
g_game, g_map, g_panel, g_options, g_console, g_player, g_weapons, g_language, g_triggers, g_monsters,
g_net, g_netmaster,
- r_draw, r_textures, r_fonts, r_common, r_console, r_map
+ r_draw, r_textures, r_fonts, r_common, r_console, r_map, r_loadscreen
;
var
- BackgroundTexture: THereTexture;
-
hud, hudbg: TGLTexture;
hudhp: array [Boolean] of TGLTexture;
hudap: TGLTexture;
var
i: Integer;
begin
+ r_LoadScreen_Load;
r_Common_Load;
- 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');
- hudhp[true] := r_Textures_LoadFromFile(GameWAD + ':TEXTURES/BMED');
- hudap := r_Textures_LoadFromFile(GameWAD + ':TEXTURES/ARMORHUD');
+ r_Common_SetLoading('HUD Textures', 5 + (WP_LAST + 1) + 11);
+ hud := r_Common_LoadTextureFromFile(GameWAD + ':TEXTURES/HUD', [TGLHints.txNoRepeat]);
+ hudbg := r_Common_LoadTextureFromFile(GameWAD + ':TEXTURES/HUDBG', []);
+ hudhp[false] := r_Common_LoadTextureFromFile(GameWAD + ':TEXTURES/MED2', [TGLHints.txNoRepeat]);
+ hudhp[true] := r_Common_LoadTextureFromFile(GameWAD + ':TEXTURES/BMED', [TGLHints.txNoRepeat]);
+ hudap := r_Common_LoadTextureFromFile(GameWAD + ':TEXTURES/ARMORHUD', [TGLHints.txNoRepeat]);
for i := 0 to WP_LAST do
- hudwp[i] := r_Textures_LoadFromFile(GameWAD + ':TEXTURES/' + WeapName[i]);
- hudkey[0] := r_Textures_LoadFromFile(GameWAD + ':TEXTURES/KEYR');
- hudkey[1] := r_Textures_LoadFromFile(GameWAD + ':TEXTURES/KEYG');
- 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');
+ hudwp[i] := r_Common_LoadTextureFromFile(GameWAD + ':TEXTURES/' + WeapName[i], [TGLHints.txNoRepeat]);
+ hudkey[0] := r_Common_LoadTextureFromFile(GameWAD + ':TEXTURES/KEYR', [TGLHints.txNoRepeat]);
+ hudkey[1] := r_Common_LoadTextureFromFile(GameWAD + ':TEXTURES/KEYG', [TGLHints.txNoRepeat]);
+ hudkey[2] := r_Common_LoadTextureFromFile(GameWAD + ':TEXTURES/KEYB', [TGLHints.txNoRepeat]);
+ hudair := r_Common_LoadTextureFromFile(GameWAD + ':TEXTURES/AIRBAR', [TGLHints.txNoRepeat]);
+ hudjet := r_Common_LoadTextureFromFile(GameWAD + ':TEXTURES/JETBAR', [TGLHints.txNoRepeat]);
+ hudrflag := r_Common_LoadTextureFromFile(GameWAD + ':TEXTURES/FLAGHUD_R_BASE', [TGLHints.txNoRepeat]);
+ hudrflags := r_Common_LoadTextureFromFile(GameWAD + ':TEXTURES/FLAGHUD_R_STOLEN', [TGLHints.txNoRepeat]);
+ hudrflagd := r_Common_LoadTextureFromFile(GameWAD + ':TEXTURES/FLAGHUD_R_DROP', [TGLHints.txNoRepeat]);
+ hudbflag := r_Common_LoadTextureFromFile(GameWAD + ':TEXTURES/FLAGHUD_B_BASE', [TGLHints.txNoRepeat]);
+ hudbflags := r_Common_LoadTextureFromFile(GameWAD + ':TEXTURES/FLAGHUD_B_STOLEN', [TGLHints.txNoRepeat]);
+ hudbflagd := r_Common_LoadTextureFromFile(GameWAD + ':TEXTURES/FLAGHUD_B_DROP', [TGLHints.txNoRepeat]);
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;
- hudkey[1].Free;
- hudkey[2].Free;
+ r_Common_FreeAndNil(hudbflagd);
+ r_Common_FreeAndNil(hudbflags);
+ r_Common_FreeAndNil(hudbflag);
+ r_Common_FreeAndNil(hudrflagd);
+ r_Common_FreeAndNil(hudrflags);
+ r_Common_FreeAndNil(hudrflag);
+ r_Common_FreeAndNil(hudjet);
+ r_Common_FreeAndNil(hudair);
+ r_Common_FreeAndNil(hudkey[0]);
+ r_Common_FreeAndNil(hudkey[1]);
+ r_Common_FreeAndNil(hudkey[2]);
for i := 0 to WP_LAST do
- begin
- if hudwp[i] <> nil then
- hudwp[i].Free;
- hudwp[i] := nil;
- end;
- hudap.Free;
- hudhp[true].Free;
- hudhp[false].Free;
- hudbg.Free;
- hud.Free;
- r_Common_FreeThis(BackgroundTexture);
+ r_Common_FreeAndNil(hudwp[i]);
+ r_Common_FreeAndNil(hudap);
+ r_Common_FreeAndNil(hudhp[true]);
+ r_Common_FreeAndNil(hudhp[false]);
+ r_Common_FreeAndNil(hudbg);
+ r_Common_FreeAndNil(hud);
r_Common_Free;
end;
info.maximized := gRC_Maximized;
info.major := 1;
info.minor := 1;
- info.profile := TGLProfile.Compat;
+ {$IFDEF USE_GLES1}
+ info.profile := TGLProfile.Common;
+ {$ELSE}
+ info.profile := TGLProfile.Compat;
+ {$ENDIF}
result := info;
end;
{$ENDIF}
+ procedure r_Render_LogGLInfo;
+ begin
+ e_LogWritefln('GL Vendor: %s', [glGetString(GL_VENDOR)]);
+ e_LogWritefln('GL Renderer: %s', [glGetString(GL_RENDERER)]);
+ e_LogWritefln('GL Version: %s', [glGetString(GL_VERSION)]);
+ e_LogWritefln('GL Shaders: %s', [glGetString(GL_SHADING_LANGUAGE_VERSION)]);
+ e_LogWritefln('GL Extensions: %s', [glGetString(GL_EXTENSIONS)]);
+ end;
+
procedure r_Render_Initialize;
begin
{$IFDEF ENABLE_SYSTEM}
raise Exception.Create('Failed to set videomode on startup.');
sys_EnableVSync(gVSync);
{$ENDIF}
+ {$IFDEF NOGL_INIT}
+ nogl_Init;
+ {$ENDIF}
+ r_Render_LogGLInfo;
+ r_LoadScreen_Initialize;
r_Textures_Initialize;
r_Console_Initialize;
r_Map_Initialize;
r_Map_Finalize;
r_Console_Finalize;
r_Textures_Finalize;
+ r_LoadScreen_Finalize;
+ {$IFDEF NOGL_INIT}
+ nogl_Quit;
+ {$ENDIF}
+ end;
+
+ procedure r_Render_Reset;
+ begin
+ r_Map_Reset;
end;
procedure r_Render_Update;
end;
procedure r_Render_DrawHUDArea (x, y, w, h: Integer; p: TPlayer);
- var s: AnsiString;
+ var s: AnsiString; oldy: Integer;
begin
r_Common_DrawTexture(hudbg, x, y, w, h, TBasePoint.BP_LEFTUP);
if p <> nil then
begin
+ oldy := y;
+ if h < 239 then y := y - 32; (* hack: hide nickname on 640x400 *)
r_Render_DrawHUD(x + w - 196 + 2, y, p);
if p.Spectator then
begin
if p.NoRespawn then
r_Common_DrawText(_lc[I_PLAYER_SPECT1S], x + 4, y + 290, 255, 255, 255, 255, stdfont, TBasePoint.BP_LEFTUP);
end;
+ y := oldy;
end;
if gShowPing and g_Game_IsClient then
if gShowScore and (gGameSettings.GameMode in [GM_TDM, GM_CTF]) then
begin
- (* RED TEAM GOALS *)
+ (* RED TEAM SCORE *)
fw := 0;
if gGameSettings.GameMode = GM_CTF then
begin
end;
r_Common_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 *)
+ (* BLUE TEAM SCORE *)
fw := 0;
if gGameSettings.GameMode = GM_CTF then
begin
end;
procedure r_Render_DrawView (x, y, w, h: Integer; p: TPlayer);
- var l, t, r, b, xx, yy: Integer;
+ var l, t, r, b, xx, yy, cx, cy: Integer;
begin
r_Draw_GetRect(l, t, r, b);
r_Draw_SetRect(x, y, x + w, y + h);
r_Common_GetCameraPos(p, true, xx, yy);
if p <> nil then
begin
- r_Map_Draw(x, y, w, h, xx, yy, p);
+ r_Map_Draw(x, y, w, h, xx, yy, p, cx, cy);
+ {$IFDEF ENABLE_HOLMES}
+ if p = gPlayer1 then
+ begin
+ r_Holmes_plrViewPos(cx, cy);
+ r_Holmes_plrViewSize(h, w);
+ end;
+ {$ENDIF}
r_Render_DrawStatsView(x, y, w, h, p);
if p.Spectator and p.NoRespawn then
r_Common_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, xx, yy, nil);
+ r_Map_Draw(x, y, w, h, xx, yy, nil, cx, cy);
end;
r_Draw_SetRect(l, t, r, b);
end;
procedure r_Render_DrawMapView (x, y, w, h, camx, camy: Integer);
- var l, t, r, b: Integer;
+ var l, t, r, b, cx, cy: Integer;
begin
r_Draw_GetRect(l, t, r, b);
r_Draw_SetRect(x, y, x + w, y + h);
- r_Map_Draw(x, y, w, h, camx, camy, nil);
+ r_Map_Draw(x, y, w, h, camx, camy, nil, cx, cy);
r_Draw_SetRect(l, t, r, b);
end;
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
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);
+ (* window background *)
+ r_Draw_Rect(16, 64, gScreenWidth - 16, motdh + 1, 255, 127, 0, 255);
+ r_Draw_FillRect(16 + 1, 64 + 1, gScreenWidth - 16 - 1, motdh, 64, 64, 64, 145);
r_Common_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);
- r_Common_DrawFormatText(slMOTD, 20, motdh + 3 + ch * i, 255, stdfont, TBasePoint.BP_LEFTUP);
+ r_Draw_FillRect(16 + 1, motdh + 1, gScreenWidth - 16 - 1, gScreenHeight - 44 - 1, 64, 64, 64, 145);
+ r_Common_DrawFormatText(slMOTD, 20, motdh + 3, 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_Draw_Rect(scrx - 256, scry - 60, scrx + 256, scry + 60 + 1, 255, 127, 0, 255);
+ r_Draw_FillRect(scrx - 256 + 1, scry - 60 + 1, scrx + 256 - 1, scry + 60, 64, 64, 64, 127);
+ r_Draw_FillRect(scrx - 256, scry - 40, scrx + 256, scry - 40 + 1, 255, 127, 0, 255);
+ r_Draw_FillRect(scrx - 256, scry + 40, scrx + 256, scry + 40 + 1, 255, 127, 0, 255);
r_Common_DrawText(_lc[I_NET_SLIST_URGENT], scrx, scry - 58, 255, 255, 255, 255, stdfont, TBasePoint.BP_UP);
- r_Common_DrawFormatText(slUrgent, scrx - 253, scry - 38 + ch * i, 255, stdfont, TBasePoint.BP_LEFTUP);
r_Common_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);
+ r_Common_DrawFormatText(slUrgent, scrx - 253, scry - 38, 255, stdfont, TBasePoint.BP_LEFTUP);
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_Draw_Rect(scrx - 192, scry - 10, scrx + 192, scry + 10, 255, 127, 0, 255);
+ r_Draw_FillRect(scrx - 192 + 1, scry - 10 + 1, scrx + 192 - 1, scry + 10 - 1, 64, 64, 64, 145);
r_Common_DrawText(slWaitStr, scrx, scry, 255, 255, 255, 255, stdfont, TBasePoint.BP_CENTER);
end
else
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);
+ (* current selection *)
+ r_Draw_FillRect(16 + 1, sy + 1, gScreenWidth - 16 - 1, sy + 1 + 40, 64, 64, 64, 255);
+ r_Draw_FillRect(16 + 1, sy, gScreenWidth - 16 - 1, sy + 1, 255, 255, 255, 255);
+ r_Draw_FillRect(16 + 1, sy + 1 + 40, gScreenWidth - 16 - 1, sy + 1 + 40 + 1, 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);
+ (* line separators for name/ping/mode.. & address/pasword *)
+ r_Draw_FillRect(16, 85, gScreenWidth - 16, 85 + 1, 255, 127, 0, 255);
+ r_Draw_FillRect(16, motdh - 20, gScreenWidth - 16, motdh - 20 + 1, 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);
+ (* column separators for name/ping/mode/players/version *)
+ r_Draw_FillRect(mx - 70, 64 + 1, mx - 70 + 1, motdh, 255, 127, 0, 255);
+ r_Draw_FillRect(mx, 64 + 1, mx + 1, motdh - 20, 255, 127, 0, 255);
+ r_Draw_FillRect(mx + 52, 64 + 1, mx + 52 + 1, motdh - 20, 255, 127, 0, 255);
+ r_Draw_FillRect(mx + 104, 64 + 1, mx + 104 + 1, motdh - 20, 255, 127, 0, 255);
r_Common_DrawText('NAME/MAP', 18, 68, 255, 127, 0, 255, stdfont, TBasePoint.BP_LEFTUP);
r_Common_DrawText('PING', mx - 68, 68, 255, 127, 0, 255, stdfont, TBasePoint.BP_LEFTUP);
w3 := cw * 8; (* frags width *)
w2 := cw * 12; (* ping/loss width *)
w1 := w - w2 - w3 - w4; (* name width *)
- tw := w1 - cw * 2 - w2; (* team goals *)
+ tw := w1 - cw * 2 - w2; (* team score *)
if cs.PlayerStat = nil then players := 0 else players := Length(cs.PlayerStat);
yy := y;
if cs.GameMode in [GM_TDM, GM_CTF] then
INC(yy, ch);
INC(yy, ch div 4);
- r_Draw_FillRect(x, yy, x + w - 1, yy, r, g, b, 255);
+ r_Draw_FillRect(x, yy, x + w, yy + 1, r, g, b, 255);
INC(yy, ch div 4);
for i := 0 to players - 1 do
end;
// Player color
- r_Draw_Rect(x, yy, x + 16 - 1, yy + 16 - 1, 192, 192, 192, 255);
+ r_Draw_Rect(x, yy, x + 16, yy + 16, 192, 192, 192, 255);
r_Draw_FillRect(x + 1, yy + 1, x + 16 - 1, yy + 16 - 1, cs.PlayerStat[i].Color.R, cs.PlayerStat[i].Color.G, cs.PlayerStat[i].Color.B, 255);
// Player name
if gShowPIDs then s := Format('[%5d] %s', [cs.PlayerStat[i].UID, cs.PlayerStat[i].Name]) else s := cs.PlayerStat[i].Name;
begin
xoff := 0; yoff := 8;
r_Draw_GetTextSize('W', stdfont, cw, ch);
- 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);
+ r_Draw_Rect(x, y, x + w, y + h, 255, 127, 0, 255);
+ r_Draw_FillRect(x + 1, y + 1, x + w - 1, y + h - 1, 64, 64, 64, 224);
(* LINE 1 *)
begin
x0 := x + xx div scale;
y0 := y + yy div scale;
- x1 := x + (xx + ww - 1) div scale;
- y1 := y + (yy + hh - 1) div scale;
+ x1 := x + (xx + ww) div scale;
+ y1 := y + (yy + hh) div scale;
r_Draw_FillRect(x0, y0, x1, y1, r, g, b, alpha);
end;
end;
begin
- r_Draw_FillRect(x, y, (x + gMapInfo.Width - 1) div scale, (y + gMapInfo.Height - 1) div scale, 0, 0, 0, alpha);
+ r_Draw_FillRect(x, y, (x + gMapInfo.Width) div scale, (y + gMapInfo.Height) div scale, 0, 0, 0, alpha);
DrawPanels(gSteps);
DrawPanels(gLifts);
DrawPanels(gWater);
end;
procedure r_Render_Draw;
- var p1, p2: TPlayer; time: LongWord;
+ var p1, p2: TPlayer; time: LongWord; pw, ph: Integer;
begin
if gExit = EXIT_QUIT then
exit;
+ {$IFDEF ENABLE_SYSTEM}
+ (* hack: if r_pixel_scale changed, reset menu and other things *)
+ pw := Round(gWinSizeX / r_pixel_scale);
+ ph := Round(gWinSizeY / r_pixel_scale);
+ if (pw <> gScreenWidth) or (ph <> gScreenHeight) then
+ if assigned(sys_ScreenResize) then
+ sys_ScreenResize(gWinSizeX, gWinSizeY);
+ {$ENDIF}
+
INC(FPSCounter);
time := GetTickCount64();
if time - FPSTime >= 1000 then
FPSTime := time;
end;
- r_Draw_Setup(gScreenWidth, gScreenHeight);
+ r_Draw_Setup(gWinSizeX, gWinSizeY, gScreenWidth, gScreenHeight);
glClearColor(0.0, 0.0, 0.0, 0.0);
- glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);
-
- glColor4ub(255, 255, 255, 255);
- glEnable(GL_SCISSOR_TEST);
- r_Draw_SetRect(0, 0, gScreenWidth, gScreenHeight);
-
- //e_LogWritefln('r_render_draw: %sx%s', [gScreenWidth, gScreenHeight]);
+ glClear(GL_COLOR_BUFFER_BIT);
p1 := nil;
p2 := nil;
if gShowMap then
r_Render_DrawMiniMap(0, 0, 160);
- // TODO draw holmes inspector
+ {$IFDEF ENABLE_HOLMES}
+ r_Holmes_Draw;
+ {$ENDIF}
if MessageText <> '' then
r_Common_DrawFormatText(MessageText, (gScreenWidth - 196) div 2, gScreenHeight div 2, 255, menufont, TBasePoint.BP_CENTER);
if gPauseMain and gGameOn {$IFDEF ENABLE_MENU}and (g_ActiveWindow = nil){$ENDIF} then
begin
- r_Draw_FillRect(0, 0, gScreenWidth - 1, gScreenHeight - 1, 0, 0, 0, 105);
+ r_Draw_FillRect(0, 0, gScreenWidth, gScreenHeight, 0, 0, 0, 105);
r_Common_DrawText(_lc[I_MENU_PAUSE], gScreenWidth div 2, gScreenHeight div 2, 255, 255, 255, 255, menufont, TBasePoint.BP_CENTER);
end;
// TODO F key handle
case gState of
STATE_NONE: (* do nothing *) ;
- STATE_MENU: r_Render_DrawBackground(GameWad + ':TEXTURES/TITLE');
+ STATE_MENU:
+ begin
+ r_Common_DrawBackground(GameWad + ':TEXTURES/TITLE');
+ {$IFDEF ENABLE_MENU}
+ if g_ActiveWindow <> nil then
+ r_Draw_FillRect(0, 0, gScreenWidth, gScreenHeight, 0, 0, 0, 105);
+ {$ENDIF}
+ end;
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));
+ r_Draw_FillRect(0, 0, gScreenWidth, gScreenHeight, 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)
+ r_Common_DrawBackground(EndPicPath)
else
- r_Render_DrawBackground(GameWad + ':TEXTURES/' + _lc[I_TEXTURE_ENDPIC])
+ r_Common_DrawBackground(GameWad + ':TEXTURES/' + _lc[I_TEXTURE_ENDPIC])
else
- r_Render_DrawBackground(GameWad + ':TEXTURES/INTER');
+ r_Common_DrawBackground(GameWad + ':TEXTURES/INTER');
r_Render_DrawCustomStats;
{$IFDEF ENABLE_MENU}
if g_ActiveWindow <> nil then
- r_Draw_FillRect(0, 0, gScreenWidth - 1, gScreenHeight - 1, 0, 0, 0, 105);
+ r_Draw_FillRect(0, 0, gScreenWidth, gScreenHeight, 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));
+ r_Draw_FillRect(0, 0, gScreenWidth, gScreenHeight, 0, 0, 0, MIN(MAX(255 - EndingGameCounter, 0), 255));
end
else
begin
- r_Render_DrawBackground(GameWad + ':TEXTURES/INTER');
+ r_Common_DrawBackground(GameWad + ':TEXTURES/INTER');
r_Render_DrawSingleStats;
{$IFDEF ENABLE_MENU}
if g_ActiveWindow <> nil then
- r_Draw_FillRect(0, 0, gScreenWidth - 1, gScreenHeight - 1, 0, 0, 0, 105);
+ r_Draw_FillRect(0, 0, gScreenWidth, gScreenHeight, 0, 0, 0, 105);
{$ENDIF}
end;
end;
STATE_ENDPIC:
begin
if EndPicPath <> '' then
- r_Render_DrawBackground(EndPicPath)
+ r_Common_DrawBackground(EndPicPath)
else
- r_Render_DrawBackground(GameWad + ':TEXTURES/' + _lc[I_TEXTURE_ENDPIC]);
+ r_Common_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);
+ r_Draw_FillRect(0, 0, gScreenWidth, gScreenHeight, 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_Common_DrawBackground(GameWad + ':TEXTURES/TITLE');
+ r_Draw_FillRect(0, 0, gScreenWidth, gScreenHeight, 0, 0, 0, 105);
r_Render_DrawServerList(slCurrent, slTable);
end;
end;
if g_ActiveWindow <> nil then
begin
if gGameOn then
- r_Draw_FillRect(0, 0, gScreenWidth - 1, gScreenHeight - 1, 0, 0, 0, 105);
+ r_Draw_FillRect(0, 0, gScreenWidth, gScreenHeight, 0, 0, 0, 105);
r_GUI_Draw_Window(g_ActiveWindow);
end;
{$ENDIF}
// TODO draw profilers
- // TODO draw holmes interface
+ {$IFDEF ENABLE_HOLMES}
+ r_Holmes_DrawUI;
+ {$ENDIF}
- // TODO draw touch screen controls
+ {$IFDEF ENABLE_TOUCH}
+ glScalef(1 / r_pixel_scale, 1 / r_pixel_scale, 0);
+ r_Touch_Draw;
+ {$ENDIF}
- glFlush();
- glFinish();
sys_Repaint;
end;
gWinSizeY := h;
gRC_Width := w;
gRC_Height := h;
- gScreenWidth := w;
- gScreenHeight := h;
+ gScreenWidth := Round(w / r_pixel_scale);
+ gScreenHeight := Round(h / r_pixel_scale);
end;
procedure r_Render_Apply;
e_LogWriteln('resolution changed')
else
e_LogWriteln('resolution not changed');
- sys_EnableVSync(gVSync)
+ sys_EnableVSync(gVSync);
+ {$ENDIF}
+ {$IFDEF NOGL_INIT}
+ nogl_Init;
{$ENDIF}
end;
{$IFDEF ENABLE_TOUCH}
procedure r_Render_GetKeyRect (key: Integer; out x, y, w, h: Integer; out founded: Boolean);
begin
- // TODO implement touchscreen
- founded := False;
+ r_Touch_GetKeyRect(key, x, y, w, h, founded)
end;
{$ENDIF}
end;
{$ENDIF}
+ procedure r_Render_SetProcessLoadingCallback (p: TProcedure);
+ begin
+ r_Common_ProcessLoadingCallback := p;
+ end;
+
+ procedure r_Render_ClearLoading;
+ begin
+ r_Common_ClearLoading;
+ end;
+
+ procedure r_Render_SetLoading (const text: String; maxval: Integer);
+ begin
+ r_Common_SetLoading(text, maxval);
+ end;
+
+ procedure r_Render_StepLoading (incval: Integer);
+ begin
+ r_Common_StepLoading(incval);
+ end;
+
procedure r_Render_DrawLoading (force: Boolean);
begin
- // TODO draw loading screen
+ r_Common_DrawLoading(force);
end;
+{$IFDEF ENABLE_HOLMES}
+ function pmsCurMapX (): Integer;
+ begin
+ result := r_holmes.pmsCurMapX();
+ end;
+
+ function pmsCurMapY (): Integer;
+ begin
+ result := r_holmes.pmsCurMapY();
+ end;
+
+ function r_Render_HolmesViewIsSet (): Boolean;
+ begin
+ result := vpSet;
+ end;
+{$ENDIF}
+
end.