9c6b8b420ff0052207db872a45f3dae8b494dbbb
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
22 type
23 TBasePoint = (
27 );
34 var
39 var
45 procedure r_Common_CalcAspect (ow, oh, nw, nh: LongInt; horizontal: Boolean; out ww, hh: LongInt);
48 procedure r_Common_DrawText (const text: AnsiString; x, y: Integer; r, g, b, a: Byte; f: TGLFont; p: TBasePoint);
51 procedure r_Common_DrawFormatText (const text: AnsiString; x, y: Integer; a: Byte; f: TGLFont; p: TBasePoint);
68 function r_Common_LoadTextureFromFile (const filename: AnsiString; log: Boolean = True): TGLTexture;
69 function r_Common_LoadTextureMultiFromFile (const filename: AnsiString; log: Boolean = True): TGLMultiTexture;
70 function r_Common_LoadTextureMultiFromFileAndInfo (const filename: AnsiString; w, h, count: Integer; log: Boolean = True): TGLMultiTexture;
71 function r_Common_LoadTextureMultiTextFromFile (const filename: AnsiString; var txt: TAnimTextInfo; log: Boolean = True): TGLMultiTexture;
72 function r_Common_LoadTextureStreamFromFile (const filename: AnsiString; w, h, count, cw: Integer; st: TGLTextureArray; rs: TRectArray; log: Boolean = True): Boolean;
73 function r_Common_LoadTextureFontFromFile (const filename: AnsiString; constref f: TFontInfo; skipch: Integer; log: Boolean = true): TGLFont;
78 implementation
80 uses
84 {$IFDEF ENABLE_CORPSES}
85 g_corpses,
86 {$ENDIF}
87 r_draw, r_loadscreen
88 ;
90 var
95 begin
103 begin
111 {$IFDEF ENABLE_CORPSES}
113 begin
116 if (gCorpses <> nil) and (gCorpses[p.Corpse] <> nil) and (gCorpses[p.Corpse].PlayerUID = p.UID) then
119 {$ENDIF}
122 {$IFDEF ENABLE_CORPSES}
124 {$ENDIF}
125 begin
126 {$IFDEF ENABLE_CORPSES}
129 begin
132 begin
136 end
137 else
138 {$ENDIF}
140 begin
144 begin
148 end
149 else
150 begin
154 begin
163 begin
166 begin
170 begin
174 end
176 begin
184 begin
197 procedure r_Common_DrawText (const text: AnsiString; x, y: Integer; r, g, b, a: Byte; f: TGLFont; p: TBasePoint);
199 begin
202 begin
210 begin
217 begin
221 begin
224 begin
230 begin
231 // skip color modifiers
233 otherwise
234 begin
245 procedure r_Common_DrawFormatText (const text: AnsiString; x, y: Integer; a: Byte; f: TGLFont; p: TBasePoint);
246 const
248 ((R:$00; G:$00; B:$00), (R:$FF; G:$00; B:$00), (R:$00; G:$FF; B:$00), (R:$FF; G:$FF; B:$00), (R:$00; G:$00; B:$FF), (R:$FF; G:$FF; B:$FF)),
249 ((R:$00; G:$00; B:$00), (R:$7F; G:$00; B:$00), (R:$00; G:$7F; B:$00), (R:$FF; G:$7F; B:$00), (R:$00; G:$00; B:$7F), (R:$7F; G:$7F; B:$7F))
250 );
251 var
253 begin
256 begin
263 begin
266 begin
278 otherwise
279 begin
281 r_Draw_Text(text[i], cx, cy, colors[dark, color].R, colors[dark, color].G, colors[dark, color].B, a, f);
290 begin
297 (* --------- --------- *)
300 begin
308 begin
320 procedure r_Common_CalcAspect (ow, oh, nw, nh: LongInt; horizontal: Boolean; out ww, hh: LongInt);
321 begin
323 begin
326 end
327 else
328 begin
336 begin
338 begin
340 if img.width = img.height then fw := img.width * 4 div 3 else fw := img.width; // fix aspect 4:3
343 end
347 begin
354 begin
358 result := r_Common_LoadTextureFontFromFile(GameWad + ':FONTS/' + name + 'FONT', info, skiphack, true);
364 begin
373 begin
380 (* --------- Loading screen helpers --------- *)
383 begin
385 r_Common_ProcessLoadingCallback;
389 begin
391 r_Common_ProcessLoading;
395 begin
396 r_LoadScreen_Clear;
401 begin
407 begin
412 function r_Common_LoadTextureFromFile (const filename: AnsiString; log: Boolean = True): TGLTexture;
413 begin
418 function r_Common_LoadTextureMultiFromFile (const filename: AnsiString; log: Boolean = True): TGLMultiTexture;
419 begin
424 function r_Common_LoadTextureMultiFromFileAndInfo (const filename: AnsiString; w, h, count: Integer; log: Boolean = True): TGLMultiTexture;
425 begin
430 function r_Common_LoadTextureMultiTextFromFile (const filename: AnsiString; var txt: TAnimTextInfo; log: Boolean = True): TGLMultiTexture;
431 begin
436 function r_Common_LoadTextureStreamFromFile (const filename: AnsiString; w, h, count, cw: Integer; st: TGLTextureArray; rs: TRectArray; log: Boolean = True): Boolean;
437 begin
442 function r_Common_LoadTextureFontFromFile (const filename: AnsiString; constref f: TFontInfo; skipch: Integer; log: Boolean = true): TGLFont;
443 begin