DEADSOFTWARE

cleanup: remove unneeded graphics dependencies
[d2df-sdl.git] / src / game / g_basic.pas
index 7df493fe4f248a8fe57ac8fb11da55c9713227b4..d58e487a8d9edb6b0c97a12ee3ff90eb0695a628 100644 (file)
@@ -76,8 +76,6 @@ function Sign(A: Single): ShortInt; overload;
 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;
@@ -101,7 +99,7 @@ implementation
 
 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
@@ -658,62 +656,6 @@ begin
     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