summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 36fb407)
raw | patch | inline | side by side (parent: 36fb407)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Tue, 8 Jun 2021 08:00:30 +0000 (11:00 +0300) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Tue, 29 Jun 2021 09:51:11 +0000 (12:51 +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 7df493fe4f248a8fe57ac8fb11da55c9713227b4..d58e487a8d9edb6b0c97a12ee3ff90eb0695a628 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 i, j, len, lines: Integer;
-
- function GetLine (j, i: Integer): String;
- begin
- result := Copy(text, j, i - j + 1);
- end;
-
- function GetWidth (j, i: Integer): Integer;
- var w, h: Word;
- begin
- e_CharFont_GetSize(FontID, GetLine(j, i), w, h);
- result := w
- end;
-
-begin
- result := nil; lines := 0;
- j := 1; i := 1; len := Length(Text);
- // e_LogWritefln('GetLines @%s len=%s [%s]', [MaxWidth, len, Text]);
- while j <= len do
- begin
- (* --- Get longest possible sequence --- *)
- while (i + 1 <= len) and (GetWidth(j, i + 1) <= MaxWidth) do Inc(i);
- (* --- Do not include part of word --- *)
- if (i < len) and (text[i] <> ' ') then
- while (i >= j) and (text[i] <> ' ') do Dec(i);
- (* --- Do not include spaces --- *)
- while (i >= j) and (text[i] = ' ') do Dec(i);
- (* --- Add line --- *)
- SetLength(result, lines + 1);
- result[lines] := GetLine(j, i);
- // e_LogWritefln(' -> (%s:%s::%s) [%s]', [j, i, GetWidth(j, i), result[lines]]);
- Inc(lines);
- (* --- Skip spaces --- *)
- while (i <= len) and (text[i] = ' ') do Inc(i);
- j := i + 2;
- 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 7329f52a8cc2df7c39bf01193bcdb8849d554442..3ab72ed3526569938e387df6d6999539d7231804 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, 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 i, j, len, lines: Integer;
+
+ function GetLine (j, i: Integer): String;
+ begin
+ result := Copy(text, j, i - j + 1);
+ end;
+
+ function GetWidth (j, i: Integer): Integer;
+ var w, h: Word;
+ begin
+ e_CharFont_GetSize(FontID, GetLine(j, i), w, h);
+ result := w
+ end;
+
+begin
+ result := nil; lines := 0;
+ j := 1; i := 1; len := Length(Text);
+ // e_LogWritefln('GetLines @%s len=%s [%s]', [MaxWidth, len, Text]);
+ while j <= len do
+ begin
+ (* --- Get longest possible sequence --- *)
+ while (i + 1 <= len) and (GetWidth(j, i + 1) <= MaxWidth) do Inc(i);
+ (* --- Do not include part of word --- *)
+ if (i < len) and (text[i] <> ' ') then
+ while (i >= j) and (text[i] <> ' ') do Dec(i);
+ (* --- Do not include spaces --- *)
+ while (i >= j) and (text[i] = ' ') do Dec(i);
+ (* --- Add line --- *)
+ SetLength(result, lines + 1);
+ result[lines] := GetLine(j, i);
+ // e_LogWritefln(' -> (%s:%s::%s) [%s]', [j, i, GetWidth(j, i), result[lines]]);
+ Inc(lines);
+ (* --- Skip spaces --- *)
+ while (i <= len) and (text[i] = ' ') do Inc(i);
+ j := i + 2;
+ 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 67814ad7384504c366566a89c87d2949848a544f..0e8b8af32e69477a562231fcb7edf33f091740f1 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 d9c62c9efb78ea8821016e803d929bfac3e7a4c2..fb2729b52140edaa31de46eeae41285450032d01 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 c29bb4da0a1c1bb8032142f5c9ee42f77954770f..20eb21084930e03da229494e0af8d1406e9a85cb 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 07d162215fce4f2297fcb95b2db58b771f672e54..854a15c512c5d4b089440b34a8d54bef1cb14684 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_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 0237b44006d832d6ae5e614656da7db76f291149..dbef49896b1ec861c0c73a276da5dc8e7558b329 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 80fcbfc50dfd6520c42267454f7dce596895b309..eb1a79a8db17dd725634f3e4f8ae28319a6e2493 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 779a9a151238f73afceb3c1d8e91df2cb3494ed2..f89aa9f3de7f89d23c63367c846260100139e9a3 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 c94282d7b9c3ee1c71a89316b26324b1031f3370..21c580375a533aa95e6f2dc6b8e9e0791bb52c27 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