summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8a5320e)
raw | patch | inline | side by side (parent: 8a5320e)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Tue, 8 Jun 2021 08:00:30 +0000 (11:00 +0300) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Fri, 9 Jun 2023 07:43:24 +0000 (10:43 +0300) |
12 files changed:
index 5edceb2c5f9d3c754a4d2f2f8e969fcd46410849..0f691aef424fdc5c39fd69ff915840ff593487cc 100644 (file)
@@ -132,6 +132,7 @@ procedure e_TextureFontPrintCharEx (X, Y: Integer; Ch: Char; FontID: DWORD; Shad
procedure e_ReleaseEngine();
procedure e_BeginRender();
procedure e_Clear(Mask: TGLbitfield; Red, Green, Blue: Single); overload;
+procedure e_Clear(Red, Green, Blue: Single); overload;
procedure e_Clear(); overload;
procedure e_EndRender();
glClear(Mask);
end;
+procedure e_Clear(Red, Green, Blue: Single); overload;
+begin
+ if e_NoGraphics then Exit;
+ glClearColor(Red, Green, Blue, 0);
+ glClear(GL_COLOR_BUFFER_BIT);
+end;
+
procedure e_Clear(); overload;
begin
if e_NoGraphics then Exit;
diff --git a/src/game/g_basic.pas b/src/game/g_basic.pas
index ccfd5d91fdb489b4d539b07818b05a43ea1657ba..bc61b8887170a5898a4d7cbc79453b6f86916699 100644 (file)
--- a/src/game/g_basic.pas
+++ b/src/game/g_basic.pas
function PointToRect(X, Y, X1, Y1: Integer; Width, Height: Word): Integer;
function GetAngle(baseX, baseY, pointX, PointY: Integer): SmallInt;
function GetAngle2(vx, vy: Integer): SmallInt;
-function GetLines(Text: string; FontID: DWORD; MaxWidth: Word): SSArray;
-procedure Sort(var a: SSArray);
function Sscanf(const s: string; const fmt: string;
const Pointers: array of Pointer): Integer;
function InDWArray(a: DWORD; arr: DWArray): Boolean;
uses
Math, geom, e_log, g_map, g_gfx, g_player, SysUtils, MAPDEF,
- StrUtils, e_graphics, g_monsters, g_items, g_game;
+ StrUtils, g_monsters, g_items, g_game;
{$PUSH}
{$WARN 2054 OFF} // unknwon env var
end;
end;
-function GetLines (text: string; FontID: DWORD; MaxWidth: Word): SSArray;
- var
- k: Integer = 1;
- lines: Integer = 0;
- i, len, lastsep: Integer;
-
- function PrepareStep (): Boolean; inline;
- begin
- // Skip leading spaces.
- while PChar(text)[k-1] = ' ' do k += 1;
- Result := k <= len;
- i := k;
- end;
-
- function GetLine (j: Integer; Strip: Boolean): String; inline;
- begin
- // Exclude trailing spaces from the line.
- if Strip then
- while text[j] = ' ' do j -= 1;
-
- Result := Copy(text, k, j-k+1);
- end;
-
- function LineWidth (): Integer; inline;
- var w, h: Word;
- begin
- e_CharFont_GetSize(FontID, GetLine(i, False), w, h);
- Result := w;
- end;
-
-begin
- Result := nil;
- len := Length(text);
- //e_LogWritefln('GetLines @%s len=%s [%s]', [MaxWidth, len, text]);
-
- while PrepareStep() do
- begin
- // Get longest possible sequence (this is not constant because fonts are not monospaced).
- lastsep := 0;
- repeat
- if text[i] in [' ', '.', ',', ':', ';']
- then lastsep := i;
- i += 1;
- until (i > len) or (LineWidth() > MaxWidth);
-
- // Do not include part of a word if possible.
- if (lastsep-k > 3) and (i <= len) and (text[i] <> ' ')
- then i := lastsep + 1;
-
- // Add line.
- SetLength(Result, lines + 1);
- Result[lines] := GetLine(i-1, True);
- //e_LogWritefln(' -> (%s:%s::%s) [%s]', [k, i, LineWidth(), Result[lines]]);
- lines += 1;
-
- k := i;
- end;
-end;
-
-procedure Sort(var a: SSArray);
-var
- i, j: Integer;
- s: string;
-begin
- if a = nil then Exit;
-
- for i := High(a) downto Low(a) do
- for j := Low(a) to High(a)-1 do
- if LowerCase(a[j]) > LowerCase(a[j+1]) then
- begin
- s := a[j];
- a[j] := a[j+1];
- a[j+1] := s;
- end;
-end;
-
function Sscanf(const s: String; const fmt: String;
const Pointers: array of Pointer): Integer;
var
diff --git a/src/game/g_gui.pas b/src/game/g_gui.pas
index fb461784f5468c4b9b2447229a21d7515b26071d..5ed507de39ac83be5367d977ce7bb4a5a46bf92e 100644 (file)
--- a/src/game/g_gui.pas
+++ b/src/game/g_gui.pas
implementation
uses
- {$INCLUDE ../nogl/noGLuses.inc}
g_textures, g_sound, SysUtils, e_res,
g_game, Math, StrUtils, g_player, g_options, g_console, r_playermodel,
g_map, g_weapons, xdynrec, wadreader;
Box: Array [0..8] of DWORD;
Saved_Windows: SSArray;
+function GetLines (text: string; FontID: DWORD; MaxWidth: Word): SSArray;
+ var
+ k: Integer = 1;
+ lines: Integer = 0;
+ i, len, lastsep: Integer;
+
+ function PrepareStep (): Boolean; inline;
+ begin
+ // Skip leading spaces.
+ while PChar(text)[k-1] = ' ' do k += 1;
+ Result := k <= len;
+ i := k;
+ end;
+
+ function GetLine (j: Integer; Strip: Boolean): String; inline;
+ begin
+ // Exclude trailing spaces from the line.
+ if Strip then
+ while text[j] = ' ' do j -= 1;
+
+ Result := Copy(text, k, j-k+1);
+ end;
+
+ function LineWidth (): Integer; inline;
+ var w, h: Word;
+ begin
+ e_CharFont_GetSize(FontID, GetLine(i, False), w, h);
+ Result := w;
+ end;
+
+begin
+ Result := nil;
+ len := Length(text);
+ //e_LogWritefln('GetLines @%s len=%s [%s]', [MaxWidth, len, text]);
+
+ while PrepareStep() do
+ begin
+ // Get longest possible sequence (this is not constant because fonts are not monospaced).
+ lastsep := 0;
+ repeat
+ if text[i] in [' ', '.', ',', ':', ';']
+ then lastsep := i;
+ i += 1;
+ until (i > len) or (LineWidth() > MaxWidth);
+
+ // Do not include part of a word if possible.
+ if (lastsep-k > 3) and (i <= len) and (text[i] <> ' ')
+ then i := lastsep + 1;
+
+ // Add line.
+ SetLength(Result, lines + 1);
+ Result[lines] := GetLine(i-1, True);
+ //e_LogWritefln(' -> (%s:%s::%s) [%s]', [k, i, LineWidth(), Result[lines]]);
+ lines += 1;
+
+ k := i;
+ end;
+end;
+
+procedure Sort(var a: SSArray);
+var
+ i, j: Integer;
+ s: string;
+begin
+ if a = nil then Exit;
+
+ for i := High(a) downto Low(a) do
+ for j := Low(a) to High(a)-1 do
+ if LowerCase(a[j]) > LowerCase(a[j+1]) then
+ begin
+ s := a[j];
+ a[j] := a[j+1];
+ a[j+1] := s;
+ end;
+end;
procedure g_GUI_Init();
begin
if FBackTexture <> '' then // Here goes code duplication from g_game.pas:DrawMenuBackground()
if g_Texture_Get(FBackTexture, ID) then
begin
- e_Clear(GL_COLOR_BUFFER_BIT, 0, 0, 0);
+ e_Clear(0, 0, 0);
e_GetTextureSize(ID, @tw, @th);
if tw = th then
tw := round(tw * 1.333 * (gScreenHeight / th))
e_DrawSize(ID, (gScreenWidth - tw) div 2, 0, 0, False, False, tw, gScreenHeight);
end
else
- e_Clear(GL_COLOR_BUFFER_BIT, 0.5, 0.5, 0.5);
+ e_Clear(0.5, 0.5, 0.5);
// small hack here
if FName = 'AuthorsMenu' then
SetLength(FItems, Length(FItems)+1);
FItems[High(FItems)] := Item;
- if FSort then g_Basic.Sort(FItems);
+ if FSort then g_gui.Sort(FItems);
end;
function TGUIListBox.ItemExists (item: String): Boolean;
FStartLine := 0;
FIndex := -1;
- if FSort then g_Basic.Sort(FItems);
+ if FSort then g_gui.Sort(FItems);
end;
procedure TGUIListBox.SelectItem(Item: String);
diff --git a/src/game/g_menu.pas b/src/game/g_menu.pas
index 3bc2d4c0965c589852206bfac6bfa1a802df3a2e..1af2cbd7d8b9eb8fea12007e3ed8c2960269d4ad 100644 (file)
--- a/src/game/g_menu.pas
+++ b/src/game/g_menu.pas
implementation
uses
- {$INCLUDE ../nogl/noGLuses.inc}
g_gui, g_textures, e_graphics, g_main, g_window, g_game, g_map,
g_basic, g_console, g_sound, g_gfx, g_player, g_options, g_weapons,
e_log, SysUtils, CONFIG, g_playermodel, DateUtils,
index ba175406ab78a14a15e317d2b949b180b712adc4..bb6f10e521e150e7a5d0e81087ee020c533fa333 100644 (file)
--- a/src/game/g_netmaster.pas
+++ b/src/game/g_netmaster.pas
implementation
uses
- e_input, e_graphics, e_log, g_window, g_net, g_console,
+ e_input, e_log, g_window, g_net, g_console,
g_map, g_game, g_sound, g_gui, g_menu, g_options, g_language, g_basic, r_game,
wadreader, g_system, utils, hashtable;
diff --git a/src/game/g_options.pas b/src/game/g_options.pas
index ace71914663e7a139ae5f705149984909cec83cc..6fb6434d399b85f71e8daeeae50a2dc368c95514 100644 (file)
--- a/src/game/g_options.pas
+++ b/src/game/g_options.pas
implementation
uses
- {$INCLUDE ../nogl/noGLuses.inc}
{$IFDEF USE_SDL2}
SDL2,
{$ENDIF}
diff --git a/src/game/g_panel.pas b/src/game/g_panel.pas
index 7d2752cffaa1a85f5194584273e2f34ed39a4ebe..734e4cf01f9bd9d98ed95efef057bd66109e7845 100644 (file)
--- a/src/game/g_panel.pas
+++ b/src/game/g_panel.pas
implementation
uses
- {$INCLUDE ../nogl/noGLuses.inc}
e_texture, g_basic, g_map, g_game, g_gfx, g_weapons, g_triggers, g_items,
g_console, g_language, g_monsters, g_player, g_grid, e_log, geom, utils, xstreams;
diff --git a/src/game/g_player.pas b/src/game/g_player.pas
index f31bceed0487a08e2d101ef3c8f633b05a0fb60d..c082c00a0e0adf18ae28137c580db6bc60d8273a 100644 (file)
--- a/src/game/g_player.pas
+++ b/src/game/g_player.pas
implementation
uses
-{$INCLUDE ../nogl/noGLuses.inc}
{$IFDEF ENABLE_HOLMES}
g_holmes,
{$ENDIF}
index f91620eac842e0b6a9d1c4a9857015fad79f27f1..40a3489a1fd7781ae530c2c5d39546a8fa5e0037 100644 (file)
interface
uses
- {$IFDEF USE_MEMPOOL}mempool,{$ENDIF}
MAPDEF, g_textures, g_basic, g_weapons, e_graphics, utils, g_gfx,
ImagingTypes, Imaging, ImagingUtility;
implementation
uses
- {$INCLUDE ../nogl/noGLuses.inc}
g_main, g_sound, g_console, SysUtils, g_player, CONFIG,
e_sound, g_options, g_map, Math, e_log, wadreader;
index 6b01c06f17717f5da54bff9f796cb9edb84dcbef..55e77cd8a7cc86c03bd34cc3bd5b79a4c7c98833 100644 (file)
--- a/src/game/g_saveload.pas
+++ b/src/game/g_saveload.pas
interface
uses
- SysUtils, Classes,
- e_graphics, g_phys, g_textures;
+ SysUtils, Classes, g_phys, g_textures;
function g_GetSaveName (n: Integer; out valid: Boolean): AnsiString;
index 2509650d413b5ccc9af45f390ad91339bd4a30ad..557ad14bde89c1f9fdb9c108c3b133f1e7021a01 100644 (file)
--- a/src/game/g_triggers.pas
+++ b/src/game/g_triggers.pas
uses
SysUtils, Variants, Classes,
- MAPDEF, e_graphics, g_basic, g_sound,
+ MAPDEF, g_basic, g_sound,
xdynrec, hashtable, exoma;
type
diff --git a/src/game/g_weapons.pas b/src/game/g_weapons.pas
index 81b3a03ab434389c7912d8a94afda118489c8a72..26b84353c3e22d3282f978bf5546d0fb326d838f 100644 (file)
--- a/src/game/g_weapons.pas
+++ b/src/game/g_weapons.pas
uses
SysUtils, Classes, mempool,
- g_textures, g_basic, e_graphics, g_phys, xprofiler;
+ g_textures, g_basic, g_phys, xprofiler;
type