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_Map_Load;
139 {$IFDEF ENABLE_MENU}
140 r_GUI_Load;
141 {$ENDIF}
146 begin
147 {$IFDEF ENABLE_MENU}
148 r_GUI_Free;
149 {$ENDIF}
150 r_Map_Free;
157 begin
168 r_Common_Free;
171 {$IFDEF ENABLE_SYSTEM}
174 begin
186 {$ENDIF}
189 begin
190 {$IFDEF ENABLE_SYSTEM}
194 {$ENDIF}
195 r_Textures_Initialize;
196 r_Map_Initialize;
200 begin
201 r_Map_Finalize;
202 r_Textures_Finalize;
206 begin
207 r_Map_Update;
211 begin
215 glLoadIdentity;
218 glLoadIdentity;
222 begin
235 procedure r_Render_DrawText (const text: AnsiString; x, y: Integer; r, g, b, a: Byte; f: TGLFont; p: TBasePoint);
237 begin
239 begin
247 begin
254 begin
257 // hud area is 196 x 240 pixels
265 r_Render_DrawText(IntToStr(MAX(0, p.health)), x + 174, y + 56, 255, 0, 0, 255, menufont, TBasePoint.BP_RIGHT);
266 r_Render_DrawText(IntToStr(MAX(0, p.armor)), x + 174, y + 84, 255, 0, 0, 255, menufont, TBasePoint.BP_RIGHT);
275 begin
288 begin
291 r_Draw_FillRect(x + 14, y + 116 + 4, x + 14 + 168 * p.air div AIR_MAX, y + 116 + 4 + 4, 0, 0, 196, 255);
293 r_Draw_FillRect(x + 14, y + 126 + 4, x + 14 + 168 * p.JetFuel div JET_MAX, y + 126 + 4 + 4, 208, 0, 0, 255);
294 end
295 else
296 begin
299 r_Draw_FillRect(x + 14, y + 124 + 4, x + 14 + 168 * p.air div AIR_MAX, y + 124 + 4 + 4, 0, 0, 196, 255);
305 begin
312 begin
318 begin
319 r_Render_DrawText(_lc[I_PLAYER_SPECT], x + 4, y + 242, 255, 255, 255, 255, stdfont, TBasePoint.BP_LEFTUP);
320 r_Render_DrawText(_lc[I_PLAYER_SPECT2], x + 4, y + 258, 255, 255, 255, 255, stdfont, TBasePoint.BP_LEFTUP);
321 r_Render_DrawText(_lc[I_PLAYER_SPECT1], x + 4, y + 274, 255, 255, 255, 255, stdfont, TBasePoint.BP_LEFTUP);
323 r_Render_DrawText(_lc[I_PLAYER_SPECT1S], x + 4, y + 290, 255, 255, 255, 255, stdfont, TBasePoint.BP_LEFTUP);
328 begin
331 else
334 // TODO draw stats
337 begin
339 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);
344 begin
350 begin
352 exit;
354 SetupMatrix;
361 //e_LogWritefln('r_render_draw: %sx%s', [gScreenWidth, gScreenHeight]);
364 begin
365 // TODO setup player view
366 // TODO setup sectator mode
367 // TODO setup player hear point
368 // TODO setup player view siz
370 // TODO draw player view + setup screen coords
373 // TODO draw holmes inspector
375 // TODO draw messages
376 // TODO draw stats (?)
377 // TODO draw spectator hud
381 begin
382 // TODO draw pause screen
386 begin
389 STATE_FOLD: ;
390 STATE_INTERCUSTOM: ;
391 STATE_INTERSINGLE: ;
392 STATE_ENDPIC: ;
393 STATE_SLIST: ;
397 {$IFDEF ENABLE_MENU}
399 begin
404 {$ENDIF}
406 // TODO draw console
408 // TODO draw holmes interface
412 sys_Repaint;
416 begin
426 begin
427 {$IFDEF ENABLE_SYSTEM}
430 else
433 {$ENDIF}
437 begin
441 {$IFDEF ENABLE_GIBS}
443 begin
446 {$ENDIF}
448 {$IFDEF ENABLE_GFX}
450 begin
453 {$ENDIF}
455 {$IFDEF ENABLE_TOUCH}
457 begin
460 {$ENDIF}
462 {$IFDEF ENABLE_MENU}
464 begin
469 begin
474 begin
479 begin
482 {$ENDIF}
485 begin