Skip to content

Commit

Permalink
Add support for TR3 ECTS levels (#1370)
Browse files Browse the repository at this point in the history
Handle difference between ECTS TR3 levels and regular ones.
Thanks @Trxyebeep
#174
  • Loading branch information
chreden authored Mar 10, 2025
1 parent f32e0d9 commit 41ac7a5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion trlevel/Level.h
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ namespace trlevel
void generate_mesh_tr3_psx(tr_mesh& mesh, std::basic_ispanstream<uint8_t>& stream);

PlatformAndVersion _platform_and_version;
uint32_t _raw_version;
uint32_t _raw_version{ 0u };

std::vector<tr_colour> _palette;
std::vector<tr_colour4> _palette16;
Expand Down
1 change: 1 addition & 0 deletions trlevel/LevelVersion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ namespace trlevel
case 0x38:
return { .platform = Platform::PC, .version = LevelVersion::Tomb3 };
case 0xc8:
case 0xcb: //TR3 PSX ECTS Demos
return { .platform = Platform::PSX, .version = LevelVersion::Tomb3 };
case 0x54:
return { .platform = Platform::PC, .version = LevelVersion::Tomb4 };
Expand Down
7 changes: 6 additions & 1 deletion trlevel/Level_tr3_psx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,9 @@ namespace trlevel
{
auto sound_offsets = read_vector<uint32_t, uint32_t>(file);
auto sound_data = read_vector<uint32_t, byte>(file);
const bool ects = _raw_version == -53;

for (int i = 0; i < 13; ++i)
for (int i = 0; i < (ects ? 10 : 13); ++i)
{
int size = read<int>(file);
if (size != 0)
Expand All @@ -231,6 +232,10 @@ namespace trlevel
int size2 = read<int>(file);
skip(file, size2);
}
else if (ects)
{
skip(file, 4);
}
}

_rooms = read_rooms<uint16_t>(activity, file, callbacks, load_tr3_psx_room);
Expand Down

0 comments on commit 41ac7a5

Please sign in to comment.