diff --git a/src/game/g_basic.pas b/src/game/g_basic.pas
index f6653a3126574ff91eb115f2af3dda260595b8e1..22e318ab4a442a24e36759d25e764053a2011e03 100644 (file)
--- a/src/game/g_basic.pas
+++ b/src/game/g_basic.pas
-(* Copyright (C) DooM 2D:Forever Developers
+(* Copyright (C) Doom 2D: Forever Developers
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * the Free Software Foundation, version 3 of the License ONLY.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
interface
uses
interface
uses
- wadreader, g_phys;
+ utils, g_phys;
const
GAME_VERSION = '0.667';
const
GAME_VERSION = '0.667';
+ GAME_BUILDDATE = {$I %DATE%};
+ GAME_BUILDTIME = {$I %TIME%};
UID_GAME = 1;
UID_PLAYER = 2;
UID_MONSTER = 3;
UID_GAME = 1;
UID_PLAYER = 2;
UID_MONSTER = 3;
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 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): SArray;
-procedure Sort(var a: SArray);
+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;
function InWArray(a: Word; arr: WArray): Boolean;
function Sscanf(const s: string; const fmt: string;
const Pointers: array of Pointer): Integer;
function InDWArray(a: DWORD; arr: DWArray): Boolean;
function InWArray(a: Word; arr: WArray): Boolean;
-function InSArray(a: string; arr: SArray): Boolean;
+function InSArray(a: string; arr: SSArray): Boolean;
function GetPos(UID: Word; o: PObj): Boolean;
function GetPos(UID: Word; o: PObj): Boolean;
-function parse(s: string): SArray;
-function parse2(s: string; delim: Char): SArray;
+function parse(s: string): SSArray;
+function parse2(s: string; delim: Char): SSArray;
function g_GetFileTime(fileName: String): Integer;
function g_SetFileTime(fileName: String; time: Integer): Boolean;
function g_GetFileTime(fileName: String): Integer;
function g_SetFileTime(fileName: String; time: Integer): Boolean;
-procedure SortSArray(var S: SArray);
+procedure SortSArray(var S: SSArray);
function b_Text_Format(S: string): string;
function b_Text_Unformat(S: string): string;
function b_Text_Format(S: string): string;
function b_Text_Unformat(S: string): string;
-
+function b_Text_Wrap(S: string; LineLen: Integer): string;
+function b_Text_LineCount(S: string): Integer;
var
gmon_dbg_los_enabled: Boolean = true;
var
gmon_dbg_los_enabled: Boolean = true;
end;
end;
end;
end;
-{function GetLines(Text: string; MaxChars: Word): SArray;
+{function GetLines(Text: string; MaxChars: Word): SSArray;
var
a: Integer;
b: array of string;
var
a: Integer;
b: array of string;
end;
end;}
end;
end;}
-function GetLines(Text: string; FontID: DWORD; MaxWidth: Word): SArray;
+function GetLines(Text: string; FontID: DWORD; MaxWidth: Word): SSArray;
function TextLen(Text: string): Word;
var
function TextLen(Text: string): Word;
var
b: array of string;
str: string;
begin
b: array of string;
str: string;
begin
+{
SetLength(Result, 0);
SetLength(b, 0);
SetLength(Result, 0);
SetLength(b, 0);
if TextLen(str) > MaxWidth then
begin // Òåêóùàÿ ñòðîêà ñëèøêîì äëèííàÿ => ðàçáèâàåì
if TextLen(str) > MaxWidth then
begin // Òåêóùàÿ ñòðîêà ñëèøêîì äëèííàÿ => ðàçáèâàåì
- while str <> '' do
+ while (str[0] <> #0) and (str <> '') do
begin
SetLength(Result, Length(Result)+1);
begin
SetLength(Result, Length(Result)+1);
Result[High(Result)] := str;
end;
end;
Result[High(Result)] := str;
end;
end;
+}
+ Result := nil
end;
end;
-procedure Sort(var a: SArray);
+procedure Sort(var a: SSArray);
var
i, j: Integer;
s: string;
var
i, j: Integer;
s: string;
end;
end;
end;
end;
-function InSArray(a: string; arr: SArray): Boolean;
+function InSArray(a: string; arr: SSArray): Boolean;
var
b: Integer;
begin
var
b: Integer;
begin
Result := True;
end;
Result := True;
end;
-function parse(s: String): SArray;
+function parse(s: String): SSArray;
var
a: Integer;
begin
var
a: Integer;
begin
end;
end;
end;
end;
-function parse2(s: string; delim: Char): SArray;
+function parse2(s: string; delim: Char): SSArray;
var
a: Integer;
begin
var
a: Integer;
begin
CloseFile(F);
end;
CloseFile(F);
end;
-procedure SortSArray(var S: SArray);
+procedure SortSArray(var S: SSArray);
var
b: Boolean;
i: Integer;
var
b: Boolean;
i: Integer;
end;
end;
end;
end;
+function b_Text_Wrap(S: string; LineLen: Integer): string;
+begin
+ Result := WrapText(S, ''#10, [#10, ' ', '-'], LineLen);
+end;
+
+function b_Text_LineCount(S: string): Integer;
+var
+ I: Integer;
+begin
+ Result := IfThen(S = '', 0, 1);
+ for I := 1 to High(S) do
+ if S[I] = #10 then
+ Inc(Result);
+end;
+
end.
end.