mirror of
https://github.com/dpethes/rerogue.git
synced 2025-06-07 18:58:32 +02:00
add command-line HOB parsing program, dump face data
This commit is contained in:
parent
af115a26f4
commit
387734e68f
72
hob_parser/hob_parser.lpi
Normal file
72
hob_parser/hob_parser.lpi
Normal file
@ -0,0 +1,72 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="9"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<Flags>
|
||||
<MainUnitHasCreateFormStatements Value="False"/>
|
||||
<MainUnitHasTitleStatement Value="False"/>
|
||||
</Flags>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<MainUnit Value="0"/>
|
||||
<Title Value="hob_parser"/>
|
||||
<UseAppBundle Value="False"/>
|
||||
<ResourceType Value="res"/>
|
||||
</General>
|
||||
<i18n>
|
||||
<EnableI18N LFM="False"/>
|
||||
</i18n>
|
||||
<VersionInfo>
|
||||
<StringTable ProductVersion=""/>
|
||||
</VersionInfo>
|
||||
<BuildModes Count="1">
|
||||
<Item1 Name="Default" Default="True"/>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<local>
|
||||
<FormatVersion Value="1"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<Units Count="1">
|
||||
<Unit0>
|
||||
<Filename Value="main.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="parse_hob"/>
|
||||
</Unit0>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="hob_parser"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<Other>
|
||||
<CompilerMessages>
|
||||
<MsgFileName Value=""/>
|
||||
</CompilerMessages>
|
||||
<CompilerPath Value="$(CompPath)"/>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions Count="3">
|
||||
<Item1>
|
||||
<Name Value="EAbort"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<Name Value="ECodetoolError"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<Name Value="EFOpenError"/>
|
||||
</Item3>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
</CONFIG>
|
@ -43,16 +43,24 @@ begin
|
||||
face.b2 := f.ReadByte; //51/71
|
||||
face.b3 := f.ReadByte; //0C
|
||||
face.bsize := f.ReadByte * 4; //block size: A = 40B, 9 = 36
|
||||
f.ReadWord; //?
|
||||
f.ReadWord; //increasing after 4 faces?
|
||||
|
||||
write(face.dw1:8, face.b1:3, face.b2:3, face.b3:3, face.bsize:3);
|
||||
write(f.ReadWord:4);
|
||||
write(f.ReadWord:4);
|
||||
// f.ReadWord; //?
|
||||
// f.ReadWord; //increasing after 4 faces?
|
||||
//12B
|
||||
for k := 0 to 3 do
|
||||
for k := 0 to 3 do begin
|
||||
face.indices[k] := f.ReadWord;
|
||||
write(face.indices[k]:4, '-');
|
||||
end;
|
||||
//20B
|
||||
for k := 0 to face.bsize - 20 - 1 do
|
||||
f.ReadByte;
|
||||
for k := 0 to face.bsize - 20 - 1 do begin
|
||||
write(f.ReadByte:3, ',');
|
||||
end;
|
||||
|
||||
hob.faces[i] := face;
|
||||
writeln;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -68,11 +76,13 @@ begin
|
||||
f.LoadFromFile(fname);
|
||||
|
||||
//faces
|
||||
f.Seek(756, fsFromBeginning); //faceblock start
|
||||
f.Seek(428, fsFromBeginning); //faceblock start
|
||||
{
|
||||
428 - 1ky.hob
|
||||
1604 - hvyshut
|
||||
prbdroid: 756
|
||||
wmvwng: 1648
|
||||
xwing: 18304
|
||||
}
|
||||
hob.face_block_offset := f.ReadDWord; //filepos + 4
|
||||
hob.face_count := f.ReadDWord; //face count
|
||||
|
21
hob_parser/main.pas
Normal file
21
hob_parser/main.pas
Normal file
@ -0,0 +1,21 @@
|
||||
program parse_hob;
|
||||
|
||||
uses
|
||||
sysutils, hob_parser;
|
||||
|
||||
var
|
||||
fname: string;
|
||||
hob: THobFile;
|
||||
|
||||
begin
|
||||
if ParamCount < 1 then begin
|
||||
writeln ('no input file specified');
|
||||
exit;
|
||||
end;
|
||||
|
||||
fname := ParamStr(1);
|
||||
writeln('parsing file: ', fname);
|
||||
hob := ParseHobFile(fname);
|
||||
writeln('done.');
|
||||
end.
|
||||
|
Loading…
x
Reference in New Issue
Block a user