aff2252b8c6c2d00ab240100249e2480a4d9c377
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}
28 procedure r_Render_Initialize
;
29 procedure r_Render_Finalize
;
31 (* load globally used textures *)
32 procedure r_Render_Load
;
33 procedure r_Render_Free
;
35 (* load map specific textures *)
36 procedure r_Render_LoadTextures
;
37 procedure r_Render_FreeTextures
;
39 procedure r_Render_Update
;
40 procedure r_Render_Draw
;
42 procedure r_Render_Resize (w
, h
: Integer);
43 procedure r_Render_Apply
;
45 function r_Render_WriteScreenShot (filename
: String): Boolean;
48 function r_Render_GetGibRect (m
, id
: Integer): TRectWH
;
52 procedure r_Render_QueueEffect (AnimType
, X
, Y
: Integer);
56 // touch screen button location and size
57 procedure r_Render_GetKeyRect (key
: Integer; out x
, y
, w
, h
: Integer; out founded
: Boolean);
61 procedure r_Render_GetControlSize (ctrl
: TGUIControl
; out w
, h
: Integer);
62 procedure r_Render_GetLogoSize (out w
, h
: Integer);
63 procedure r_Render_GetMaxFontSize (BigFont
: Boolean; out w
, h
: Integer);
64 procedure r_Render_GetStringSize (BigFont
: Boolean; str
: String; out w
, h
: Integer);
67 procedure r_Render_DrawLoading (force
: Boolean); // !!! remove it
80 {$IFDEF ENABLE_SYSTEM}
83 SysUtils
, Classes
, Math
,
86 g_game
, g_options
, g_console
, g_player
, g_weapons
, g_language
,
88 r_draw
, r_textures
, r_fonts
, r_common
, r_console
, r_map
93 BP_LEFTUP
, BP_UP
, BP_RIGHTUP
,
94 BP_LEFT
, BP_CENTER
, BP_RIGHT
,
95 BP_LEFTDOWN
, BP_DOWN
, BP_RIGHTDOWN
99 BackgroundTexture
: THereTexture
;
101 hud
, hudbg
: TGLTexture
;
102 hudhp
: array [Boolean] of TGLTexture
;
104 hudwp
: array [0..WP_LAST
] of TGLTexture
;
105 hudkey
: array [0..2] of TGLTexture
;
109 procedure r_Render_LoadTextures
;
114 procedure r_Render_FreeTextures
;
119 procedure r_Render_Load
;
121 WeapName
: array [0..WP_LAST
] of AnsiString = ('KASTET', 'SAW', 'PISTOL', 'SHOTGUN1', 'SHOTGUN2', 'MGUN', 'RLAUNCHER', 'PGUN', 'BFG', 'SPULEMET', 'FLAMETHROWER');
126 BackgroundTexture
:= DEFAULT(THereTexture
);
127 hud
:= r_Textures_LoadFromFile(GameWAD
+ ':TEXTURES/HUD');
128 hudbg
:= r_Textures_LoadFromFile(GameWAD
+ ':TEXTURES/HUDBG');
129 hudhp
[false] := r_Textures_LoadFromFile(GameWAD
+ ':TEXTURES/MED2');
130 hudhp
[true] := r_Textures_LoadFromFile(GameWAD
+ ':TEXTURES/BMED');
131 hudap
:= r_Textures_LoadFromFile(GameWAD
+ ':TEXTURES/ARMORHUD');
132 for i
:= 0 to WP_LAST
do
133 hudwp
[i
] := r_Textures_LoadFromFile(GameWAD
+ ':TEXTURES/' + WeapName
[i
]);
134 hudkey
[0] := r_Textures_LoadFromFile(GameWAD
+ ':TEXTURES/KEYR');
135 hudkey
[1] := r_Textures_LoadFromFile(GameWAD
+ ':TEXTURES/KEYG');
136 hudkey
[2] := r_Textures_LoadFromFile(GameWAD
+ ':TEXTURES/KEYB');
137 hudair
:= r_Textures_LoadFromFile(GameWAD
+ ':TEXTURES/AIRBAR');
138 hudjet
:= r_Textures_LoadFromFile(GameWAD
+ ':TEXTURES/JETBAR');
146 procedure r_Render_Free
;
159 for i
:= 0 to WP_LAST
do
161 if hudwp
[i
] <> nil then
170 r_Common_FreeThis(BackgroundTexture
);
174 {$IFDEF ENABLE_SYSTEM}
175 function GetInfo (): TGLDisplayInfo
;
176 var info
: TGLDisplayInfo
;
178 info
:= Default(TGLDisplayInfo
);
179 info
.w
:= Max(1, gRC_Width
);
180 info
.h
:= Max(1, gRC_Height
);
181 info
.bpp
:= Max(1, gBPP
);
182 info
.fullscreen
:= gRC_FullScreen
;
183 info
.maximized
:= gRC_Maximized
;
186 info
.profile
:= TGLProfile
.Compat
;
191 procedure r_Render_Initialize
;
193 {$IFDEF ENABLE_SYSTEM}
194 if sys_SetDisplayModeGL(GetInfo()) = False then
195 raise Exception
.Create('Failed to set videomode on startup.');
196 sys_EnableVSync(gVSync
);
198 r_Textures_Initialize
;
199 r_Console_Initialize
;
203 procedure r_Render_Finalize
;
210 procedure r_Render_Update
;
216 procedure r_Render_GetBasePoint (x
, y
, w
, h
: Integer; p
: TBasePoint
; out xx
, yy
: Integer);
219 TBasePoint
.BP_LEFTUP
, TBasePoint
.BP_LEFT
, TBasePoint
.BP_LEFTDOWN
: xx
:= x
;
220 TBasePoint
.BP_UP
, TBasePoint
.BP_CENTER
, TBasePoint
.BP_DOWN
: xx
:= x
- w
div 2;
221 TBasePoint
.BP_RIGHTUP
, TBasePoint
.BP_RIGHT
, TBasePoint
.BP_RIGHTDOWN
: xx
:= x
- w
;
224 TBasePoint
.BP_LEFTUP
, TBasePoint
.BP_UP
, TBasePoint
.BP_RIGHTUP
: yy
:= y
;
225 TBasePoint
.BP_LEFT
, TBasePoint
.BP_CENTER
, TBasePoint
.BP_RIGHT
: yy
:= y
- h
div 2;
226 TBasePoint
.BP_LEFTDOWN
, TBasePoint
.BP_DOWN
, TBasePoint
.BP_RIGHTDOWN
: yy
:= y
- h
;
230 procedure r_Render_DrawText (const text: AnsiString; x
, y
: Integer; r
, g
, b
, a
: Byte; f
: TGLFont
; p
: TBasePoint
);
233 if p
<> TBasePoint
.BP_LEFTUP
then
235 r_Draw_GetTextSize(text, f
, w
, h
);
236 r_Render_GetBasePoint(x
, y
, w
, h
, p
, x
, y
);
238 r_Draw_Text(text, x
, y
, r
, g
, b
, a
, f
);
241 procedure r_Render_DrawTexture (img
: TGLTexture
; x
, y
, w
, h
: Integer; p
: TBasePoint
);
243 r_Render_GetBasePoint(x
, y
, w
, h
, p
, x
, y
);
244 r_Draw_TextureRepeat(img
, x
, y
, w
, h
, false, 255, 255, 255, 255, false);
247 procedure r_Render_DrawHUD (x
, y
: Integer; p
: TPlayer
);
248 var t
: TGLTexture
; s
: AnsiString;
252 // hud area is 196 x 240 pixels
253 r_Render_DrawTexture(hud
, x
, y
, hud
.width
, hud
.height
, TBasePoint
.BP_LEFTUP
);
254 r_Render_DrawText(p
.name
, x
+ 98, y
+ 16, 255, 0, 0, 255, smallfont
, TBasePoint
.BP_CENTER
);
256 t
:= hudhp
[R_BERSERK
in p
.FRulez
];
257 r_Render_DrawTexture(t
, x
+ 51, y
+ 61, t
.width
, t
.height
, TBasePoint
.BP_CENTER
);
258 r_Render_DrawTexture(hudap
, x
+ 50, y
+ 85, hudap
.width
, hudap
.height
, TBasePoint
.BP_CENTER
);
260 r_Render_DrawText(IntToStr(MAX(0, p
.health
)), x
+ 174, y
+ 56, 255, 0, 0, 255, menufont
, TBasePoint
.BP_RIGHT
);
261 r_Render_DrawText(IntToStr(MAX(0, p
.armor
)), x
+ 174, y
+ 84, 255, 0, 0, 255, menufont
, TBasePoint
.BP_RIGHT
);
264 WEAPON_KASTET
, WEAPON_SAW
: s
:= '--';
265 else s
:= IntToStr(p
.GetAmmoByWeapon(p
.CurrWeap
));
267 r_Render_DrawText(s
, x
+ 174, y
+ 174, 255, 0, 0, 255, menufont
, TBasePoint
.BP_RIGHT
);
269 if p
.CurrWeap
<= WP_LAST
then
271 t
:= hudwp
[p
.CurrWeap
];
272 r_Render_DrawTexture(t
, x
+ 18, y
+ 160, t
.width
, t
.height
, TBasePoint
.BP_LEFTUP
);
275 if R_KEY_RED
in p
.FRulez
then
276 r_Render_DrawTexture(hudkey
[0], x
+ 76, y
+ 214, 16, 16, TBasePoint
.BP_LEFTUP
);
277 if R_KEY_GREEN
in p
.FRulez
then
278 r_Render_DrawTexture(hudkey
[1], x
+ 93, y
+ 214, 16, 16, TBasePoint
.BP_LEFTUP
);
279 if R_KEY_BLUE
in p
.FRulez
then
280 r_Render_DrawTexture(hudkey
[2], x
+ 110, y
+ 214, 16, 16, TBasePoint
.BP_LEFTUP
);
282 if p
.JetFuel
> 0 then
284 r_Render_DrawTexture(hudair
, x
, y
+ 116, hudair
.width
, hudair
.height
, TBasePoint
.BP_LEFTUP
);
286 r_Draw_FillRect(x
+ 14, y
+ 116 + 4, x
+ 14 + 168 * p
.air
div AIR_MAX
, y
+ 116 + 4 + 4, 0, 0, 196, 255);
287 r_Render_DrawTexture(hudjet
, x
, y
+ 126, hudjet
.width
, hudjet
.height
, TBasePoint
.BP_LEFTUP
);
288 r_Draw_FillRect(x
+ 14, y
+ 126 + 4, x
+ 14 + 168 * p
.JetFuel
div JET_MAX
, y
+ 126 + 4 + 4, 208, 0, 0, 255);
292 r_Render_DrawTexture(hudair
, x
, y
+ 124, hudair
.width
, hudair
.height
, TBasePoint
.BP_LEFTUP
);
294 r_Draw_FillRect(x
+ 14, y
+ 124 + 4, x
+ 14 + 168 * p
.air
div AIR_MAX
, y
+ 124 + 4 + 4, 0, 0, 196, 255);
298 procedure r_Render_DrawHUDArea (x
, y
, w
, h
: Integer; p
: TPlayer
);
301 r_Render_DrawTexture(hudbg
, x
, y
, w
, h
, TBasePoint
.BP_LEFTUP
);
304 r_Render_DrawHUD(x
+ w
- 196 + 2, y
, p
);
306 if gShowPing
and g_Game_IsClient
then
308 s
:= _lc
[I_GAME_PING_HUD
] + IntToStr(NetPeer
.lastRoundTripTime
) + _lc
[I_NET_SLIST_PING_MS
];
309 r_Render_DrawText(s
, x
+ 4, y
+ 242, 255, 255, 255, 255, stdfont
, TBasePoint
.BP_LEFTUP
);
314 r_Render_DrawText(_lc
[I_PLAYER_SPECT
], x
+ 4, y
+ 242, 255, 255, 255, 255, stdfont
, TBasePoint
.BP_LEFTUP
);
315 r_Render_DrawText(_lc
[I_PLAYER_SPECT2
], x
+ 4, y
+ 258, 255, 255, 255, 255, stdfont
, TBasePoint
.BP_LEFTUP
);
316 r_Render_DrawText(_lc
[I_PLAYER_SPECT1
], x
+ 4, y
+ 274, 255, 255, 255, 255, stdfont
, TBasePoint
.BP_LEFTUP
);
318 r_Render_DrawText(_lc
[I_PLAYER_SPECT1S
], x
+ 4, y
+ 290, 255, 255, 255, 255, stdfont
, TBasePoint
.BP_LEFTUP
);
322 procedure r_Render_DrawView (x
, y
, w
, h
: Integer; p
: TPlayer
);
323 var l
, t
, r
, b
: Integer;
325 r_Draw_GetRect(l
, t
, r
, b
);
326 r_Draw_SetRect(x
, y
, x
+ w
, y
+ h
);
329 r_Map_Draw(x
, y
, w
, h
, p
.obj
.x
+ PLAYER_RECT_CX
, p
.obj
.y
+ PLAYER_RECT_CY
, p
)
331 r_Map_Draw(x
, y
, w
, h
, 0, 0, nil);
337 if p
.Spectator
and p
.NoRespawn
then
338 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
);
341 r_Draw_SetRect(l
, t
, r
, b
);
344 procedure r_Render_DrawPlayerView (x
, y
, w
, h
: Integer; p
: TPlayer
);
345 var l
, t
, r
, b
: Integer;
347 r_Draw_GetRect(l
, t
, r
, b
);
348 r_Draw_SetRect(x
, y
, x
+ w
, y
+ h
);
349 r_Render_DrawView(x
, y
, w
- 196, h
, p
);
350 r_Render_DrawHUDArea(x
+ w
- 196, y
, 196, h
, p
);
351 r_Draw_SetRect(l
, t
, r
, b
);
354 procedure r_Render_DrawBackgroundImage (img
: TGLTexture
);
355 var fw
, w
, h
: LongInt;
359 img
:= BackgroundTexture
.id
;
360 fw
:= img
.width
* 4 div 3; // fix aspect 4:3
361 r_Common_CalcAspect(fw
, img
.height
, gScreenWidth
, gScreenHeight
, false, w
, h
);
362 r_Draw_Texture(img
, gScreenWidth
div 2 - w
div 2, 0, w
, h
, false, 255, 255, 255, 255, false);
366 procedure r_Render_DrawBackground (const name
: AnsiString);
368 if r_Common_LoadThis(name
, BackgroundTexture
) then
369 r_Render_DrawBackgroundImage(BackgroundTexture
.id
)
372 procedure r_Render_DrawServerList (var SL
: TNetServerList
; var ST
: TNetServerTable
);
373 var ip
: AnsiString; ww
, hh
, cw
, ch
, mw
, mh
, motdh
, scrx
, scry
, i
, mx
, y
: Integer; msg
: SSArray
; Srv
: TNetServer
;
375 scrx
:= gScreenWidth
div 2;
376 scry
:= gScreenHeight
div 2;
378 r_Draw_GetTextSize(_lc
[I_NET_SLIST
], menufont
, ww
, hh
);
379 r_Render_DrawText(_lc
[I_NET_SLIST
], gScreenWidth
div 2, 16, 255, 255, 255, 255, menufont
, TBasePoint
.BP_UP
);
381 r_Draw_GetTextSize('W', stdfont
, cw
, ch
);
382 motdh
:= gScreenHeight
- 49 - ch
* b_Text_LineCount(slMOTD
);
384 r_Draw_FillRect(16, 64, gScreenWidth
- 16, motdh
, 64, 64, 64, 145);
385 r_Draw_Rect(16, 64, gScreenWidth
- 16, motdh
, 255, 127, 0, 255);
387 r_Render_DrawText(_lc
[I_NET_SLIST_HELP
], gScreenWidth
div 2, gScreenHeight
- 8, 255, 255, 255, 255, stdfont
, TBasePoint
.BP_DOWN
);
391 r_Draw_FillRect(16, motdh
, gScreenWidth
- 16, gScreenHeight
- 44, 64, 64, 64, 110);
392 r_Draw_Rect(16, motdh
, gScreenWidth
- 16, gScreenHeight
- 44, 255, 127, 0, 255);
393 msg
:= Parse2(slMOTD
, #10);
394 for i
:= 0 to High(msg
) do
395 r_Render_DrawText(msg
[i
], 20, motdh
+ 3 + ch
* i
, 255, 255, 255, 255, stdfont
, TBasePoint
.BP_LEFTUP
);
398 if not slReadUrgent
and (slUrgent
<> '') then
400 r_Draw_FillRect(17, 65, gScreenWidth
- 17, motdh
- 1, 64, 64, 64, 127);
401 r_Draw_FillRect(scrx
- 256, scry
- 60, scrx
+ 256, scry
+ 60, 64, 64, 64, 127);
402 r_Draw_Rect(scrx
- 256, scry
- 60, scrx
+ 256, scry
+ 60, 255, 127, 0, 255);
403 r_Draw_FillRect(scrx
- 256, scry
- 40, scrx
+ 256, scry
- 40, 255, 127, 0, 255);
404 r_Render_DrawText(_lc
[I_NET_SLIST_URGENT
], scrx
, scry
- 58, 255, 255, 255, 255, stdfont
, TBasePoint
.BP_UP
);
405 msg
:= Parse2(slUrgent
, #10);
406 for i
:= 0 to High(msg
) do
407 r_Render_DrawText(msg
[i
], scrx
- 253, scry
- 38 + ch
* i
, 255, 255, 255, 255, stdfont
, TBasePoint
.BP_LEFTUP
);
408 r_Render_DrawText(_lc
[I_NET_SLIST_URGENT_CONT
], scrx
, scry
+ 41, 255, 255, 255, 255, stdfont
, TBasePoint
.BP_UP
);
409 r_Draw_FillRect(scrx
- 256, scry
+ 40, scrx
+ 256, scry
+ 40, 255, 127, 0, 255);
411 else if SL
= nil then
413 r_Draw_FillRect(17, 65, gScreenWidth
- 17, motdh
- 1, 64, 64, 64, 127);
414 r_Draw_Rect(scrx
- 192, scry
- 10, scrx
+ 192, scry
+ 11, 255, 127, 0, 255);
415 r_Render_DrawText(slWaitStr
, scrx
, scry
, 255, 255, 255, 255, stdfont
, TBasePoint
.BP_CENTER
);
420 if slSelection
< Length(ST
) then
422 sy
:= y
+ 42 * slSelection
- 4;
423 Srv
:= GetServerFromTable(slSelection
, SL
, ST
);
424 ip
:= _lc
[I_NET_ADDRESS
] + ' ' + Srv
.IP
+ ':' + IntToStr(Srv
.Port
);
425 ip
:= ip
+ ' ' + _lc
[I_NET_SERVER_PASSWORD
] + ' ';
426 if Srv
.Password
then ip
:= ip
+ _lc
[I_MENU_YES
] else ip
:= ip
+_lc
[I_MENU_NO
];
429 mw
:= gScreenWidth
- 188;
432 r_Draw_FillRect(16 + 1, sy
, gScreenWidth
- 16 - 1, sy
+ 40, 64, 64, 64, 255);
433 r_Draw_FillRect(16 + 1, sy
, gScreenWidth
- 16 - 1, sy
, 205, 205, 205, 255);
434 r_Draw_FillRect(16 + 1, sy
+ 41, gScreenWidth
- 16 - 1, sy
+ 41, 255, 255, 255, 255);
436 r_Draw_FillRect(16, 85, gScreenWidth
- 16, 85, 255, 127, 0, 255);
437 r_Draw_FillRect(16, motdh
- 20, gScreenWidth
- 16, motdh
- 20, 255, 127, 0, 255);
439 r_Draw_FillRect(mx
- 70, 64, mx
- 70, motdh
, 255, 127, 0, 255);
440 r_Draw_FillRect(mx
, 64, mx
, motdh
- 20, 255, 127, 0, 255);
441 r_Draw_FillRect(mx
+ 52, 64, mx
+ 52, motdh
- 20, 255, 127, 0, 255);
442 r_Draw_FillRect(mx
+ 104, 64, mx
+ 104, motdh
- 20, 255, 127, 0, 255);
444 r_Render_DrawText('NAME/MAP', 18, 68, 255, 127, 0, 255, stdfont
, TBasePoint
.BP_LEFTUP
);
445 r_Render_DrawText('PING', mx
- 68, 68, 255, 127, 0, 255, stdfont
, TBasePoint
.BP_LEFTUP
);
446 r_Render_DrawText('MODE', mx
+ 2, 68, 255, 127, 0, 255, stdfont
, TBasePoint
.BP_LEFTUP
);
447 r_Render_DrawText('PLRS', mx
+ 54, 68, 255, 127, 0, 255, stdfont
, TBasePoint
.BP_LEFTUP
);
448 r_Render_DrawText('VER', mx
+ 106, 68, 255, 127, 0, 255, stdfont
, TBasePoint
.BP_LEFTUP
);
450 for i
:= 0 to High(ST
) do
452 Srv
:= GetServerFromTable(i
, SL
, ST
);
453 r_Render_DrawText(Srv
.Name
, 18, y
, 255, 255, 255, 255, stdfont
, TBasePoint
.BP_LEFTUP
);
454 r_Render_DrawText(Srv
.Map
, 18, y
+ 16, 210, 210, 210, 255, stdfont
, TBasePoint
.BP_LEFTUP
);
457 r_Render_DrawText('<1' + _lc
[I_NET_SLIST_PING_MS
], mx
- 68, y
, 255, 255, 255, 255, stdfont
, TBasePoint
.BP_LEFTUP
)
458 else if (Srv
.Ping
>= 0) and (Srv
.Ping
<= 999) then
459 r_Render_DrawText(IntToStr(Srv
.Ping
) + _lc
[I_NET_SLIST_PING_MS
], mx
- 68, y
, 255, 255, 255, 255, stdfont
, TBasePoint
.BP_LEFTUP
)
461 r_Render_DrawText(_lc
[I_NET_SLIST_NO_ACCESS
], mx
- 68, y
, 255, 0, 0, 255, stdfont
, TBasePoint
.BP_LEFTUP
);
462 if Length(ST
[I
].Indices
) > 1 then
463 r_Render_DrawText('<' + IntToStr(Length(ST
[I
].Indices
)) + '>', mx
- 68, y
+ 16, 210, 210, 210, 255, stdfont
, TBasePoint
.BP_LEFTUP
);
465 r_Render_DrawText(g_Game_ModeToText(Srv
.GameMode
), mx
+ 2, y
, 255, 255, 255, 255, stdfont
, TBasePoint
.BP_LEFTUP
);
467 r_Render_DrawText(IntToStr(Srv
.Players
) + '/' + IntToStr(Srv
.MaxPlayers
), mx
+ 54, y
, 255, 255, 255, 255, stdfont
, TBasePoint
.BP_LEFTUP
);
468 r_Render_DrawText(IntToStr(Srv
.LocalPl
) + '+' + IntToStr(Srv
.Bots
), mx
+ 54, y
+ 16, 210, 210, 210, 255, stdfont
, TBasePoint
.BP_LEFTUP
);
470 r_Render_DrawText(IntToStr(Srv
.Protocol
), mx
+ 106, y
, 255, 255, 255, 255, stdfont
, TBasePoint
.BP_LEFTUP
);
475 r_Render_DrawText(ip
, 20, motdh
- 20 + 3, 205, 205, 205, 255, stdfont
, TBasePoint
.BP_LEFTUP
);
476 r_Render_DrawText(IntToStr(Length(ST
)) + _lc
[I_NET_SLIST_SERVERS
], gScreenWidth
- 48, motdh
- 20 + 3, 255, 255, 255, 255, stdfont
, TBasePoint
.BP_RIGHTUP
);
480 procedure r_Render_Draw
;
482 if gExit
= EXIT_QUIT
then
485 r_Draw_Setup(gScreenWidth
, gScreenHeight
);
487 glClearColor(0.0, 0.0, 0.0, 0.0);
488 glClear(GL_COLOR_BUFFER_BIT
or GL_DEPTH_BUFFER_BIT
);
490 glColor4ub(255, 255, 255, 255);
491 glEnable(GL_SCISSOR_TEST
);
492 r_Draw_SetRect(0, 0, gScreenWidth
, gScreenHeight
);
494 //e_LogWritefln('r_render_draw: %sx%s', [gScreenWidth, gScreenHeight]);
496 if gGameOn
or ((gState
in [STATE_FOLD
]) and (EndingGameCounter
< 255)) then
498 // TODO setup sectator mode
499 // TODO setup player hear point
501 if (gPlayer1
<> nil) and (gPlayer2
<> nil) then
503 r_Render_DrawPlayerView(0, 0, gScreenWidth
, gScreenHeight
div 2 - 2, gPlayer1
);
504 r_Render_DrawPlayerView(0, gScreenHeight
div 2 + 2, gScreenWidth
, gScreenHeight
div 2, gPlayer2
);
508 r_Render_DrawPlayerView(0, 0, gScreenWidth
, gScreenHeight
, gPlayer1
);
511 // TODO draw holmes inspector
513 // TODO draw messages
514 // TODO draw stats (?)
515 // TODO draw spectator hud
518 if gPauseMain
and gGameOn
{$IFDEF ENABLE_MENU}and (g_ActiveWindow
= nil){$ENDIF} then
520 // TODO draw pause screen
526 STATE_NONE
: (* do nothing *) ;
527 STATE_MENU
: r_Render_DrawBackground(GameWad
+ ':TEXTURES/TITLE');
530 if EndingGameCounter
> 0 then
531 r_Draw_FillRect(0, 0, gScreenWidth
- 1, gScreenHeight
- 1, 0, 0, 0, MIN(MAX(255 - EndingGameCounter
, 0), 255));
535 if gLastMap
and (gGameSettings
.GameMode
= GM_COOP
) then
536 if EndPicPath
<> '' then
537 r_Render_DrawBackground(EndPicPath
)
539 r_Render_DrawBackground(GameWad
+ ':TEXTURES/' + _lc
[I_TEXTURE_ENDPIC
])
541 r_Render_DrawBackground(GameWad
+ ':TEXTURES/INTER');
542 // TODO draw custom stata
544 if g_ActiveWindow
<> nil then
545 r_Draw_FillRect(0, 0, gScreenWidth
- 1, gScreenHeight
- 1, 0, 0, 0, 105);
548 STATE_INTERSINGLE
, STATE_INTERTEXT
, STATE_INTERPIC
:
550 if EndingGameCounter
> 0 then
552 r_Draw_FillRect(0, 0, gScreenWidth
- 1, gScreenHeight
- 1, 0, 0, 0, MIN(MAX(255 - EndingGameCounter
, 0), 255));
556 r_Render_DrawBackground(GameWad
+ ':TEXTURES/INTER');
557 // TODO darw single stats
559 if g_ActiveWindow
<> nil then
560 r_Draw_FillRect(0, 0, gScreenWidth
- 1, gScreenHeight
- 1, 0, 0, 0, 105);
566 if EndPicPath
<> '' then
567 r_Render_DrawBackground(EndPicPath
)
569 r_Render_DrawBackground(GameWad
+ ':TEXTURES/' + _lc
[I_TEXTURE_ENDPIC
]);
571 if g_ActiveWindow
<> nil then
572 r_Draw_FillRect(0, 0, gScreenWidth
- 1, gScreenHeight
- 1, 0, 0, 0, 105);
577 r_Render_DrawBackground(GameWad
+ ':TEXTURES/TITLE');
578 r_Draw_FillRect(0, 0, gScreenWidth
- 1, gScreenHeight
- 1, 0, 0, 0, 105);
579 r_Render_DrawServerList(slCurrent
, slTable
);
585 if g_ActiveWindow
<> nil then
588 r_Draw_FillRect(0, 0, gScreenWidth
- 1, gScreenHeight
- 1, 0, 0, 0, 105);
589 r_GUI_Draw_Window(g_ActiveWindow
);
593 r_Console_Draw(false);
595 // TODO draw holmes interface
602 procedure r_Render_Resize (w
, h
: Integer);
612 procedure r_Render_Apply
;
614 {$IFDEF ENABLE_SYSTEM}
615 if sys_SetDisplayModeGL(GetInfo()) then
616 e_LogWriteln('resolution changed')
618 e_LogWriteln('resolution not changed');
619 sys_EnableVSync(gVSync
)
623 function r_Render_WriteScreenShot (filename
: String): Boolean;
629 function r_Render_GetGibRect (m
, id
: Integer): TRectWH
;
631 result
:= r_Map_GetGibSize(m
, id
);
636 procedure r_Render_QueueEffect (AnimType
, X
, Y
: Integer);
638 r_Map_NewGFX(AnimType
, X
, Y
);
642 {$IFDEF ENABLE_TOUCH}
643 procedure r_Render_GetKeyRect (key
: Integer; out x
, y
, w
, h
: Integer; out founded
: Boolean);
650 procedure r_Render_GetControlSize (ctrl
: TGUIControl
; out w
, h
: Integer);
652 r_GUI_GetSize(ctrl
, w
, h
);
655 procedure r_Render_GetLogoSize (out w
, h
: Integer);
657 r_GUI_GetLogoSize(w
, h
);
660 procedure r_Render_GetMaxFontSize (BigFont
: Boolean; out w
, h
: Integer);
662 r_GUI_GetMaxFontSize(BigFont
, w
, h
);
665 procedure r_Render_GetStringSize (BigFont
: Boolean; str
: String; out w
, h
: Integer);
667 r_GUI_GetStringSize(BigFont
, str
, w
, h
);
671 procedure r_Render_DrawLoading (force
: Boolean);
673 // TODO draw loading screen