ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/oup/current/Global/Functions.pas
(Generate patch)

Comparing oup/current/Global/Functions.pas (file contents):
Revision 112 by alloc, Wed Feb 21 03:28:48 2007 UTC vs.
Revision 113 by alloc, Sun Feb 25 17:20:22 2007 UTC

# Line 5 | Line 5 | interface
5   uses TypeDefs, Classes;
6  
7   function BoolToStr(bool: Boolean): String;
8 function HexToLong(hex: String): LongWord;
8   function Decode_Int(buffer: TByteData): LongWord;
9   function Encode_Int(input: LongWord): TByteData;
10   function Decode_Float(buffer: TByteData): Single;
# Line 13 | Line 12 | function Encode_Float(input: Single): TB
12   function IntToBin(Value: Byte): String;
13   function DataToBin(Data: TByteData): String;
14   function BinToInt(bin: String): Byte;
15 + function MakeDatLink(FileID: Integer): Integer;
16  
17   function StringSmaller(string1, string2: String): Boolean;
18  
# Line 48 | Line 48 | begin
48   end;
49  
50  
51 function HexToLong(hex: String): LongWord;
52
53  function NormalizeHexString(var hex: String): Boolean;
54  var
55    i: Byte;
56  begin
57    Result := True;
58    if hex[1] = '$' then
59    begin
60      for i := 1 to Length(hex) - 1 do
61        hex[i] := hex[i + 1];
62      SetLength(hex, Length(hex) - 1);
63    end;
64    if (hex[1] = '0') and (UpCase(hex[2]) = 'X') then
65    begin
66      for i := 1 to Length(hex) - 2 do
67        hex[i] := hex[i + 2];
68      SetLength(hex, Length(hex) - 2);
69    end;
70    if Length(hex) = 0 then
71      Result := False;
72  end;
73
74 begin
75  if NormalizeHexString(hex) then
76    Result := StrToInt(hex)
77  else
78    Result := 0;
79 end;
80
81
51   function Decode_Int(buffer: TByteData): LongWord;
52   begin
53    Result := buffer[0] + buffer[1] * 256 + buffer[2] * 256 * 256 + buffer[3] * 256 * 256 * 256;
# Line 169 | Line 138 | begin
138   end;
139  
140  
141 + function MakeDatLink(FileID: Integer): Integer;
142 + begin
143 +  Result := FileID * 256 + 1;
144 + end;
145 +
146 +
147  
148   function FormatNumber(Value: LongWord; Width: Byte; leadingzeros: Char): String;
149   begin

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)