Skip to content

Commit

Permalink
Full camera animation block support
Browse files Browse the repository at this point in the history
  • Loading branch information
Torphedo committed Jul 19, 2022
1 parent dea37fa commit cd502d6
Showing 1 changed file with 88 additions and 34 deletions.
122 changes: 88 additions & 34 deletions templates/EsperALR.bt
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,21 @@ struct File_ALR
int Magic<bgcolor=cLtGray>;
int Size<bgcolor=cBlue>;
int InfoSectionsCount<bgcolor=cLtGray>;
struct InfoSection2
{
int Flags2<bgcolor=cYellow>; // (?) Example from pc00a.alr: 0x01 00 04 00
int DataSec_Start<bgcolor=cGreen>;
int Unk<bgcolor=cLtRed>;
int Unk<bgcolor=cLtRed>;
int UnkZ<bgcolor=cLtRed>;
int StaticID<bgcolor=cPurple>;
int Unk<bgcolor=cLtRed>;
} Subsection[InfoSectionsCount];

// Prevents warnings if the array size will be 0.
if (InfoSectionsCount != 0)
{
struct InfoSection2
{
int Flags2<bgcolor=cYellow>; // (?) Example from pc00a.alr: 0x01 00 04 00
int DataSec_Start<bgcolor=cGreen>;
int Unk<bgcolor=cLtRed>;
int Unk<bgcolor=cLtRed>;
int UnkZ<bgcolor=cLtRed>;
int StaticID<bgcolor=cPurple>;
int Unk<bgcolor=cLtRed>;
} Subsection[InfoSectionsCount];
}
} Subfile;
}

Expand Down Expand Up @@ -84,33 +89,24 @@ struct File_ALR
{
struct Block0xD
{
int Magic<bgcolor=cLtGray>; // 0D 00 00 00
int SectorSize<bgcolor=cBlue>;
int Pad;
int Magic<bgcolor=cLtGray>; // 0D 00 00 00
int SectorSize<bgcolor=cBlue>;
int Pad;
} Subfile;
}

if (ReadByte() == 3 || ReadByte() == 5)
if (ReadByte() == 0xA)
{
struct Block0x3
{
int Magic<bgcolor=cLtGray>; // 03 00 00 00
int Size<bgcolor=cBlue>;
int Unk1<bgcolor=cRed>; // Seems to always be 00 00 20 42
int Flags<bgcolor=cYellow>; // (?) Example from pc00a.alr: 06 00 08 00
int Unk2<bgcolor=cRed>;
int Unk3<bgcolor=cRed>; // UNK2 and UNK3 sometimes match each other in value. When they don't, UNK3 is always 0
int UnkZero1<bgcolor=cRed>;
int Flags<bgcolor=cYellow>; // Example from pc00a.alr: 00 02 0C 00

// 0x[SIZE-0x24] DATA
// 0x24 = 36
local int DataSize = Size - 32;
char DataSector[DataSize]<bgcolor=cGreen>;
} Subfile;
}
struct Block0xA
{
int Magic<bgcolor=cLtGray>; // 0A 00 00 00
int SectorSize<bgcolor=cBlue>;
char Unknown[28]<bgcolor=cRed>;
char pad[12];
} Subfile;
}

if (ReadByte() == 0x10)
if (ReadByte() == 0x10)
{
struct Block0x10
{
Expand All @@ -135,6 +131,53 @@ struct File_ALR
} TGA[TGA_Num];
} Subfile;
}

// These blocks are only found in st##cam.alr files
// in the Map folder. They control the camera animation
// for stage intros.
if (ReadByte() == 0x7)
{
struct Block0x7
{
int Magic<bgcolor=cLtGray>; // 07 00 00 00
int SectorSize<bgcolor=cBlue>;
int Unknown[3]<bgcolor=cRed>;
int unk;
double pad;
struct AnimFrames
{
float FrameNum<bgcolor=cWhite>;
float CoordinateX<bgcolor=cRed>;
float CoordinateY<bgcolor=cGreen>;
float CoordinateZ<bgcolor=cBlue>;
} animation[(SectorSize - 32)/16];
} Subfile;
}

if (ReadByte() == 3 || ReadByte() == 5)
{
struct Block0x3
{
int Magic<bgcolor=cLtGray>; // 03 00 00 00
int Size<bgcolor=cBlue>;
int Unk1<bgcolor=cRed>; // Seems to always be 00 00 20 42
int Flags<bgcolor=cYellow>; // (?) Example from pc00a.alr: 06 00 08 00
int Unk2<bgcolor=cRed>;
int Unk3<bgcolor=cRed>; // UNK2 and UNK3 sometimes match each other in value. When they don't, UNK3 is always 0
int UnkZero1<bgcolor=cRed>;
int Flags<bgcolor=cYellow>; // Example from pc00a.alr: 00 02 0C 00

// 0x[SIZE-0x24] DATA
// 0x24 = 36
local int VertCount = 0;
while (VertCount < (Size - 32)/8)
{
float UnkNum<bgcolor=cYellow>;
float Float<bgcolor=cGreen>;
VertCount++;
};
} Subfile;
}

if (ReadByte() == 2)
{
Expand Down Expand Up @@ -193,11 +236,22 @@ struct File_ALR
}
} Subfile;
}

if (FEof() == 1)
{
// Checks if we're at the end of the file
break;
}

if (ReadByte() != 0x00 && ReadByte() != 0x01 && ReadByte() != 0x02 && ReadByte() != 0x03 && ReadByte() !=0x05 && ReadByte() != 0x0D && ReadByte() && ReadByte() != 0x0D && ReadByte() != 0x10 && ReadByte() != 0x13 && ReadByte() != 0x14 && ReadByte() != 0x15 && ReadByte() != 0x16)
if (ReadByte() != 0x00 && ReadByte() != 0x01 && ReadByte() != 0x02 && ReadByte() != 0x03 && ReadByte() !=0x05 && ReadByte() != 0x7 && ReadByte() != 0x0A && ReadByte() && ReadByte() != 0x0D && ReadByte() != 0x10 && ReadByte() != 0x13 && ReadByte() != 0x14 && ReadByte() != 0x15 && ReadByte() != 0x16)
{
break;
}
}
char Whitespace[header.WhitespaceEndAddress - (FTell())]<bgcolor=cGray>;

if (FEof() != 1)
{
// Checks if we're at the end of the file
char Whitespace[header.WhitespaceEndAddress - (FTell())]<bgcolor=cGray>;
}
} file;

0 comments on commit cd502d6

Please sign in to comment.