Skip to content

Commit

Permalink
tr2/data: convert Catacombs music triggers to pads
Browse files Browse the repository at this point in the history
This converts some music triggers at the start of Catacombs to pads to
retain the element of surprise when the yeti spawns.

Resolves #1962.
  • Loading branch information
lahm86 committed Nov 30, 2024
1 parent ae24a69 commit 97ac10f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
Binary file modified data/tr2/ship/data/injections/catacombs_fd.bin
Binary file not shown.
1 change: 1 addition & 0 deletions docs/tr2/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
- fixed one of the collapsible tiles in Opera House room 184 not triggering (#1902)
- fixed being unable to use the drawbridge key in Tibetan Foothills after the flipmap (#1744)
- fixed missing triggers and ladder in Catacombs of the Talion after the flipmap (#1960)
- fixed incorrect music trigger types at the beginning of Catacombs of the Talion (#1962)
- fixed missing death tiles in Temple of Xian room 91 (#1920)
- fixed broken final stats screen in software rendering mode (#1915, regression from 0.6)
- fixed screenshots not capturing level stats (#1925, regression from 0.6)
Expand Down
2 changes: 1 addition & 1 deletion docs/tr2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ decompilation process. We recognize that there is much work to be done.
- **Opera House**: fixed the trigger under item 203 to trigger it rather than item 204
- **Wreck of the Maria Doria**: fixed room 98 not having water
- **Tibetan Foothills**: added missing triggers for the drawbridge in room 96 (after the flipmap)
- **Catacombs of the Talion**: added missing triggers and ladder in room 116 (after the flipmap)
- **Catacombs of the Talion**: changed some music triggers to pads near the first yeti, and added missing triggers and ladder in room 116 (after the flipmap)
- **Ice Palace**: fixed door 143's position to resolve the invisible wall in front of it, and added an extra pickup trigger beside the Gong Hammer in room 29
- **Temple of Xian**: fixed missing death tiles in room 91
- **Floating Islands**: fixed door 72's position to resolve the invisible wall in front of it
Expand Down
18 changes: 18 additions & 0 deletions src/tr2/game/inject.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ typedef enum {
FET_ROOM_SHIFT = 3,
FET_TRIGGER_ITEM = 4,
FET_ROOM_PROPERTIES = 5,
FET_TRIGGER_TYPE = 6,
} FLOOR_EDIT_TYPE;

typedef struct {
Expand All @@ -47,6 +48,8 @@ static int32_t m_DataCounts[IDT_NUMBER_OF] = { 0 };
static void M_LoadFromFile(INJECTION *injection, const char *filename);

static void M_FloorDataEdits(const INJECTION *injection, int32_t data_count);
static void M_TriggerTypeChange(
const INJECTION *injection, const SECTOR *sector);
static void M_TriggerParameterChange(
const INJECTION *injection, const SECTOR *sector);
static void M_SetMusicOneShot(const SECTOR *sector);
Expand Down Expand Up @@ -151,6 +154,9 @@ static void M_FloorDataEdits(
for (int32_t j = 0; j < fd_edit_count; j++) {
const FLOOR_EDIT_TYPE edit_type = VFile_ReadS32(fp);
switch (edit_type) {
case FET_TRIGGER_TYPE:
M_TriggerTypeChange(injection, sector);
break;
case FET_TRIGGER_PARAM:
M_TriggerParameterChange(injection, sector);
break;
Expand Down Expand Up @@ -179,6 +185,18 @@ static void M_FloorDataEdits(
Benchmark_End(benchmark, NULL);
}

static void M_TriggerTypeChange(
const INJECTION *const injection, const SECTOR *const sector)
{
const uint8_t new_type = VFile_ReadU8(injection->fp);

if (sector == NULL || sector->trigger == NULL) {
return;
}

sector->trigger->type = new_type;
}

static void M_TriggerParameterChange(
const INJECTION *const injection, const SECTOR *const sector)
{
Expand Down

0 comments on commit 97ac10f

Please sign in to comment.