mirror of
https://github.com/dpethes/rerogue.git
synced 2025-06-07 18:58:32 +02:00
hmt parser: split into main program & parsing unit
--HG-- rename : hmt_parser/hmt_parser.lpr => hmt_parser/hmt_parser.pas
This commit is contained in:
parent
d65a060e5e
commit
b670be61fe
@ -5,6 +5,7 @@
|
|||||||
<PathDelim Value="\"/>
|
<PathDelim Value="\"/>
|
||||||
<General>
|
<General>
|
||||||
<Flags>
|
<Flags>
|
||||||
|
<SaveOnlyProjectUnits Value="True"/>
|
||||||
<MainUnitHasCreateFormStatements Value="False"/>
|
<MainUnitHasCreateFormStatements Value="False"/>
|
||||||
<MainUnitHasTitleStatement Value="False"/>
|
<MainUnitHasTitleStatement Value="False"/>
|
||||||
</Flags>
|
</Flags>
|
||||||
@ -31,12 +32,17 @@
|
|||||||
<FormatVersion Value="1"/>
|
<FormatVersion Value="1"/>
|
||||||
</local>
|
</local>
|
||||||
</RunParams>
|
</RunParams>
|
||||||
<Units Count="1">
|
<Units Count="2">
|
||||||
<Unit0>
|
<Unit0>
|
||||||
<Filename Value="hmt_parser.lpr"/>
|
<Filename Value="main.pas"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
<UnitName Value="parse_hmt"/>
|
||||||
|
</Unit0>
|
||||||
|
<Unit1>
|
||||||
|
<Filename Value="hmt_parser.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="hmt_parser"/>
|
<UnitName Value="hmt_parser"/>
|
||||||
</Unit0>
|
</Unit1>
|
||||||
</Units>
|
</Units>
|
||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
<CompilerOptions>
|
<CompilerOptions>
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
program hmt_parser;
|
unit hmt_parser;
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes;
|
sysutils, Classes;
|
||||||
|
|
||||||
type
|
type
|
||||||
THmtMaterial = record
|
THmtMaterial = record
|
||||||
@ -25,6 +28,10 @@ type
|
|||||||
textures: array of THmtTexture;
|
textures: array of THmtTexture;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure ParseHmtFile(const fname: string);
|
||||||
|
|
||||||
|
//**************************************************************************************************
|
||||||
|
implementation
|
||||||
|
|
||||||
function NameToString(name: array of byte): string;
|
function NameToString(name: array of byte): string;
|
||||||
var
|
var
|
||||||
@ -82,7 +89,7 @@ begin
|
|||||||
//read textures
|
//read textures
|
||||||
if hmt.texture_count = 0 then
|
if hmt.texture_count = 0 then
|
||||||
exit;
|
exit;
|
||||||
f.Seek(hmt.texture_offset + sizeof(hmt.texture_count), TSeekOrigin.soBeginning);
|
f.Seek(hmt.texture_offset + sizeof(hmt.texture_count), fsFromCurrent);
|
||||||
SetLength(hmt.textures, hmt.texture_count);
|
SetLength(hmt.textures, hmt.texture_count);
|
||||||
for i := 0 to hmt.texture_count - 1 do begin
|
for i := 0 to hmt.texture_count - 1 do begin
|
||||||
tex.data_offset := f.ReadDWord;
|
tex.data_offset := f.ReadDWord;
|
||||||
@ -92,22 +99,5 @@ begin
|
|||||||
f.Free;
|
f.Free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
var
|
|
||||||
fname: string;
|
|
||||||
|
|
||||||
begin
|
|
||||||
if ParamCount < 1 then begin
|
|
||||||
writeln ('no input file specified');
|
|
||||||
exit;
|
|
||||||
end;
|
|
||||||
|
|
||||||
fname := ParamStr(1);
|
|
||||||
writeln('parsing file: ', fname);
|
|
||||||
try
|
|
||||||
ParseHmtFile(fname);
|
|
||||||
except
|
|
||||||
writeln('parsing failed!');
|
|
||||||
end;
|
|
||||||
writeln('done.');
|
|
||||||
end.
|
end.
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user