2
0
mirror of https://github.com/dpethes/rerogue.git synced 2025-06-07 18:58:32 +02:00

fix some datatype mismatches in parsers to run properly in debug mode

This commit is contained in:
dpethes 2018-01-15 21:06:02 +01:00
parent 252d93702a
commit de4de4db13
3 changed files with 14 additions and 15 deletions

View File

@ -125,14 +125,6 @@
</Checks> </Checks>
<VerifyObjMethodCallValidity Value="True"/> <VerifyObjMethodCallValidity Value="True"/>
</CodeGeneration> </CodeGeneration>
<Linking>
<Debugging>
<DebugInfoType Value="dsDwarf2Set"/>
<UseHeaptrc Value="True"/>
<TrashVariables Value="True"/>
<UseExternalDbgSyms Value="True"/>
</Debugging>
</Linking>
</CompilerOptions> </CompilerOptions>
<Debugging> <Debugging>
<Exceptions Count="2"> <Exceptions Count="2">

View File

@ -58,7 +58,7 @@ var
image: TRSImage; image: TRSImage;
buf: array[0..27] of byte; buf: array[0..27] of byte;
description: TImageDescription; description: TImageDescription;
color_rgba: integer; color_rgba: longword;
pos: int64; pos: int64;
u0, u1, bits_per_sample: byte; u0, u1, bits_per_sample: byte;
begin begin
@ -73,7 +73,7 @@ begin
bits_per_sample := f.ReadByte; bits_per_sample := f.ReadByte;
image.type_ := f.ReadByte; image.type_ := f.ReadByte;
u1 := f.ReadByte; u1 := f.ReadByte;
color_rgba := f.ReadDWord; color_rgba := f.ReadDWord; //unused?
pos := f.Position; pos := f.Position;
f.Seek(tex.name_offset, TSeekOrigin.soBeginning); f.Seek(tex.name_offset, TSeekOrigin.soBeginning);
@ -85,9 +85,16 @@ begin
image.sampleBits := description.sample_bits; image.sampleBits := description.sample_bits;
image.paletteEntries := description.palette_entries; image.paletteEntries := description.palette_entries;
image.width := tex.width; image.width := tex.width;
//if (image.width and 1) > 1 then image.width += 1;
image.height := tex.height; image.height := tex.height;
//fix stride in some images?
//if (image.width and 1) > 1 then image.width += 1;
//if (image.type_ = 4) and (image.sampleBits = 4) then
// if (image.width and 1) = 1 then begin
// image.width += 1;
// writeln('fix width');
// end;
writeln('name: ', tex.name_string); writeln('name: ', tex.name_string);
writeln('size: ', tex.width, 'x', tex.height); writeln('size: ', tex.width, 'x', tex.height);
writeln('subtype: ', image.type_); writeln('subtype: ', image.type_);

View File

@ -8,7 +8,7 @@ uses
type type
TRGBA = record TRGBA = record
color: integer; color: longword;
end; end;
TTexCoord = record TTexCoord = record
@ -95,7 +95,7 @@ var
face: THobFace; face: THobFace;
zero: integer; zero: integer;
file_pos: integer; file_pos: integer;
color: integer; color: longword;
begin begin
zero := f.ReadQWord; zero := f.ReadQWord;
if (zero <> 0) then if (zero <> 0) then
@ -152,8 +152,8 @@ begin
//uv coords //uv coords
if face.flags and FACE_UV > 0 then begin if face.flags and FACE_UV > 0 then begin
for k := 0 to face.ftype - 1 do begin for k := 0 to face.ftype - 1 do begin
face.tex_coords[k].u := f.ReadWord; face.tex_coords[k].u := smallint(f.ReadWord);
face.tex_coords[k].v := f.ReadWord; face.tex_coords[k].v := smallint(f.ReadWord);
end; end;
end; end;