Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Installer/Changes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Tomb Editor:
* Added Flyby Timeline control to edit and preview flyby sequences.
* Added "Preview flyby sequence" and "Preview camera" context menus for cameras.
* Added On Pickup, On Vehicle Enter and On Vehicle Exit global events in the global event set editor.
* Added support for room reverb in TRX.

WadTool:
* Added missing TR2 henchman death sound (ID 838) and appropriate TR2 -> TEN conversion.
Expand Down
20 changes: 20 additions & 0 deletions TombLib/TombLib/LevelData/Compilers/Trx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ private IEnumerable<TrxSectorEdit> GenerateTrxSectorEdits()
{
foreach (var (teRoom, trRoom) in _tempRooms)
{
if (GetRoomPropertyEntry(teRoom, trRoom) is TRXRoomPropertyEntry roomEntry)
{
yield return roomEntry;
}

for (ushort x = 1; x < teRoom.NumXSectors - 1; x++)
{
for (ushort z = 1; z < teRoom.NumZSectors - 1; z++)
Expand All @@ -65,6 +70,21 @@ private IEnumerable<TrxSectorEdit> GenerateTrxSectorEdits()
}
}

private TRXRoomPropertyEntry GetRoomPropertyEntry(Room teRoom, tr_room trRoom)
{
if (teRoom.Properties.Reverberation == 0)
{
return null;
}

return new()
{
RoomIndex = (short)_roomRemapping[teRoom],
Flags = trRoom.Flags,
ReverbInfo = teRoom.Properties.Reverberation,
};
}

private TrxSectorOverwrite GetSectorOverwrite(Room teRoom, tr_room trRoom, ushort x, ushort z)
{
var teSector = teRoom.Sectors[x, z];
Expand Down
16 changes: 15 additions & 1 deletion TombLib/TombLib/LevelData/Compilers/Util/TrxInjector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace TombLib.LevelData.Compilers.Util;
public static class TrxInjector
{
private const uint _magic = 'T' | 'R' << 8 | 'X' << 16 | 'J' << 24;
private const uint _version = 6;
private const uint _version = 8;
private const uint _injectionType = 0; // Implies no link to a TRX config option

public static void Serialize(TrxInjectionData data, BinaryWriterEx outWriter)
Expand Down Expand Up @@ -239,6 +239,20 @@ protected override void SerializeImpl(BinaryWriterEx writer)
}
}

public class TRXRoomPropertyEntry : TrxSectorEdit
{
public override int Command => 5;

public short Flags { get; set; }
public byte ReverbInfo { get; set; }

protected override void SerializeImpl(BinaryWriterEx writer)
{
writer.Write(Flags);
writer.Write(ReverbInfo);
}
}

public class TrxTextureOverwrite
{
public ushort Page { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion TombLib/TombLib/LevelData/Enumerations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public static bool SupportsFontAndSkySettings(this Game ver)
=> ver.Native() >= Game.TR4;

public static bool SupportsReverberation(this Game ver)
=> ver.Native() >= Game.TR3;
=> ver >= Game.TR3;

public static bool SupportsLensflare(this Game ver)
=> ver.Native() >= Game.TR4;
Expand Down