1 (* Copyright (C) Doom 2D: Forever Developers
2 *
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.
6 *
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.
11 *
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/>.
14 *)
15 {$INCLUDE ../../../shared/a_modes.inc}
18 interface
20 uses
21 {$IFDEF ENABLE_MENU}
22 g_gui,
23 {$ENDIF}
24 g_base // TRectWH
25 ;
27 (* render startup *)
31 (* load globally used textures *)
35 (* load map specific textures *)
47 {$IFDEF ENABLE_GIBS}
49 {$ENDIF}
51 {$IFDEF ENABLE_GFX}
53 {$ENDIF}
55 {$IFDEF ENABLE_TOUCH}
56 // touch screen button location and size
58 {$ENDIF}
60 {$IFDEF ENABLE_MENU}
65 {$ENDIF}
69 implementation
71 uses
72 {$IFDEF USE_GLES1}
73 GLES11,
74 {$ELSE}
76 {$ENDIF}
77 {$IFDEF ENABLE_MENU}
78 r_gui,
79 {$ENDIF}
80 {$IFDEF ENABLE_SYSTEM}
81 g_system,
82 {$ENDIF}
86 g_net,
88 ;
90 type
91 TBasePoint = (
95 );
97 var
109 begin
110 r_Map_LoadTextures;
114 begin
115 r_Map_FreeTextures;
119 const
120 WeapName: array [0..WP_LAST] of AnsiString = ('KASTET', 'SAW', 'PISTOL', 'SHOTGUN1', 'SHOTGUN2', 'MGUN', 'RLAUNCHER', 'PGUN', 'BFG', 'SPULEMET', 'FLAMETHROWER');
121 var
123 begin
124 r_Common_Load;
138 r_Console_Load;
139 r_Map_Load;
140 {$IFDEF ENABLE_MENU}
141 r_GUI_Load;
142 {$ENDIF}
147 begin
148 {$IFDEF ENABLE_MENU}
149 r_GUI_Free;
150 {$ENDIF}
151 r_Map_Free;
152 r_Console_Free;
159 begin
170 r_Common_Free;
173 {$IFDEF ENABLE_SYSTEM}
176 begin
188 {$ENDIF}
191 begin
192 {$IFDEF ENABLE_SYSTEM}
196 {$ENDIF}
197 r_Textures_Initialize;
198 r_Console_Initialize;
199 r_Map_Initialize;
203 begin
204 r_Map_Finalize;
205 r_Console_Finalize;
206 r_Textures_Finalize;
210 begin
211 r_Console_Update;
212 r_Map_Update;
216 begin
229 procedure r_Render_DrawText (const text: AnsiString; x, y: Integer; r, g, b, a: Byte; f: TGLFont; p: TBasePoint);
231 begin
233 begin
241 begin
248 begin
251 // hud area is 196 x 240 pixels
259 r_Render_DrawText(IntToStr(MAX(0, p.health)), x + 174, y + 56, 255, 0, 0, 255, menufont, TBasePoint.BP_RIGHT);
260 r_Render_DrawText(IntToStr(MAX(0, p.armor)), x + 174, y + 84, 255, 0, 0, 255, menufont, TBasePoint.BP_RIGHT);
269 begin
282 begin
285 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_Draw_FillRect(x + 14, y + 126 + 4, x + 14 + 168 * p.JetFuel div JET_MAX, y + 126 + 4 + 4, 208, 0, 0, 255);
288 end
289 else
290 begin
293 r_Draw_FillRect(x + 14, y + 124 + 4, x + 14 + 168 * p.air div AIR_MAX, y + 124 + 4 + 4, 0, 0, 196, 255);
299 begin
306 begin
312 begin
313 r_Render_DrawText(_lc[I_PLAYER_SPECT], x + 4, y + 242, 255, 255, 255, 255, stdfont, TBasePoint.BP_LEFTUP);
314 r_Render_DrawText(_lc[I_PLAYER_SPECT2], x + 4, y + 258, 255, 255, 255, 255, stdfont, TBasePoint.BP_LEFTUP);
315 r_Render_DrawText(_lc[I_PLAYER_SPECT1], x + 4, y + 274, 255, 255, 255, 255, stdfont, TBasePoint.BP_LEFTUP);
317 r_Render_DrawText(_lc[I_PLAYER_SPECT1S], x + 4, y + 290, 255, 255, 255, 255, stdfont, TBasePoint.BP_LEFTUP);
323 begin
329 else
332 // TODO draw stats
335 begin
337 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);
345 begin
354 begin
356 exit;
367 //e_LogWritefln('r_render_draw: %sx%s', [gScreenWidth, gScreenHeight]);
370 begin
371 // TODO setup player view
372 // TODO setup sectator mode
373 // TODO setup player hear point
374 // TODO setup player view siz
376 // TODO draw player view + setup screen coords
378 begin
380 r_Render_DrawPlayerView(0, gScreenHeight div 2 + 2, gScreenWidth, gScreenHeight div 2, gPlayer2);
381 end
382 else
383 begin
387 // TODO draw holmes inspector
389 // TODO draw messages
390 // TODO draw stats (?)
391 // TODO draw spectator hud
395 begin
396 // TODO draw pause screen
400 begin
403 STATE_FOLD: ;
404 STATE_INTERCUSTOM: ;
405 STATE_INTERSINGLE: ;
406 STATE_ENDPIC: ;
407 STATE_SLIST: ;
411 {$IFDEF ENABLE_MENU}
413 begin
418 {$ENDIF}
422 // TODO draw holmes interface
426 sys_Repaint;
430 begin
440 begin
441 {$IFDEF ENABLE_SYSTEM}
444 else
447 {$ENDIF}
451 begin
455 {$IFDEF ENABLE_GIBS}
457 begin
460 {$ENDIF}
462 {$IFDEF ENABLE_GFX}
464 begin
467 {$ENDIF}
469 {$IFDEF ENABLE_TOUCH}
471 begin
474 {$ENDIF}
476 {$IFDEF ENABLE_MENU}
478 begin
483 begin
488 begin
493 begin
496 {$ENDIF}
499 begin
500 // TODO draw loading screen