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; font2enc: TConvProc; 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
353 begin
358 end
363 begin
373 begin
382 begin
389 (* --------- Loading screen helpers --------- *)
392 begin
394 r_Common_ProcessLoadingCallback;
398 begin
400 r_Common_ProcessLoading;
404 begin
405 r_LoadScreen_Clear;
410 begin
416 begin
421 function r_Common_LoadTextureFromFile (const filename: AnsiString; log: Boolean = True): TGLTexture;
422 begin
427 function r_Common_LoadTextureMultiFromFile (const filename: AnsiString; log: Boolean = True): TGLMultiTexture;
428 begin
433 function r_Common_LoadTextureMultiFromFileAndInfo (const filename: AnsiString; w, h, count: Integer; log: Boolean = True): TGLMultiTexture;
434 begin
439 function r_Common_LoadTextureMultiTextFromFile (const filename: AnsiString; var txt: TAnimTextInfo; log: Boolean = True): TGLMultiTexture;
440 begin
445 function r_Common_LoadTextureStreamFromFile (const filename: AnsiString; w, h, count, cw: Integer; st: TGLTextureArray; rs: TRectArray; log: Boolean = True): Boolean;
446 begin
451 function r_Common_LoadTextureFontFromFile (const filename: AnsiString; constref f: TFontInfo; font2enc: TConvProc; log: Boolean = true): TGLFont;
452 begin