diff --git a/CHANGELOG.md b/CHANGELOG.md index f414b7482..7e153f10c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ - fixed jump-twist animations at times being interrupted (#932, regression from 2.15.1) - fixed walk-run-jump at times breaking when TR2 jumping is enabled (OG bug in TR2+) (#934) - fixed the reset and unbind progress bars in the controls menu for non-default bar scaling (#930) +- fixed original data issues where music triggers are not set as one shot (#939) - improve spanish localization and added translation for rotated pickups ## [2.15.3](https://github.com/rr-/Tomb1Main/compare/2.15.2...2.15.3) - 2023-08-15 diff --git a/README.md b/README.md index 7417cc36d..6f3b09413 100644 --- a/README.md +++ b/README.md @@ -376,6 +376,19 @@ Not all options are turned on by default. Refer to `Tomb1Main_ConfigTool.exe` fo - fixed underwater ambient sound effect not playing - fixed sound effects playing rapidly in sound menu if input held down - fixed sounds stopping instead of pausing when using the inventory or pausing +- fixed the following music triggers: + - **Caves**: converted track 9 in room 34 to one shot + - **Tomb of Qualopec**: converted track 17 in room 25 to one shot + - **St. Francis' Folly**: converted track 7 in room 18 to one shot + - **Obelisk of Khamoon**: converted track 3 in room 12 and track 4 in room 32 to one shot + - **Sanctuary of the Scion**: converted track 10 in room 0 to one shot + - **Natla's Mines**: converted track 3 in room 86 to one shot + - **Atlantis**: converted track 8 in room 59 to one shot + - **The Great Pyramid**: converted track 8 in room 36 to one shot + - **Return to Egypt**: converted track 19 in room 0, track 14 in room 15, track 15 in room 19, track 16 in room 22, track 6 in room 61, and track 11 in room 93 to one shot + - **Temple of the Cat**: converted track 12 in room 14, track 7 in room 98, and track 20 in room 100 to one shot + - **Atlantean Stronghold**: converted track 20 in room 4, track 19 in room 13, track 11 in room 17, track 15 in room 20, and track 12 in room 25 to one shot + - **The Hive**: converted track 9 in room 8, track 6 in room 18, track 12 in room 30, track 18 in room 31, track 3 in room 32, and track 20 in room 35 to one shot #### Mods - added ability to adjust Lara's starting health (easy no damage mod) diff --git a/bin/cfg/Tomb1Main_gameflow.json5 b/bin/cfg/Tomb1Main_gameflow.json5 index 9669d3e49..5ce5010b1 100644 --- a/bin/cfg/Tomb1Main_gameflow.json5 +++ b/bin/cfg/Tomb1Main_gameflow.json5 @@ -107,6 +107,7 @@ "type": "normal", "music": 57, "injections": [ + "data/caves_fd.bin", "data/caves_itemrots.bin", "data/caves_textures.bin", ], @@ -176,6 +177,7 @@ "music": 57, "injections": [ "data/larson_textures.bin", + "data/qualopec_fd.bin", "data/qualopec_itemrots.bin", "data/qualopec_textures.bin", ], @@ -195,6 +197,7 @@ "type": "normal", "music": 59, "injections": [ + "data/folly_fd.bin", "data/folly_itemrots.bin", "data/folly_textures.bin", ], @@ -336,6 +339,7 @@ "type": "normal", "music": 59, "injections": [ + "data/obelisk_fd.bin", "data/obelisk_itemrots.bin", ], "sequence": [ @@ -361,6 +365,7 @@ "type": "normal", "music": 59, "injections": [ + "data/sanctuary_fd.bin", "data/sanctuary_itemrots.bin", "data/sanctuary_textures.bin", ], @@ -387,6 +392,7 @@ "injections": [ "data/cowboy_textures.bin", "data/kold_textures.bin", + "data/mines_fd.bin", "data/mines_itemrots.bin", "data/mines_textures.bin", "data/skateboardkid_textures.bin" @@ -414,6 +420,7 @@ "type": "normal", "music": 60, "injections": [ + "data/atlantis_fd.bin", "data/atlantis_textures.bin", ], "sequence": [ diff --git a/bin/cfg/Tomb1Main_gameflow_ub.json5 b/bin/cfg/Tomb1Main_gameflow_ub.json5 index fb408bac3..328a2db1b 100644 --- a/bin/cfg/Tomb1Main_gameflow_ub.json5 +++ b/bin/cfg/Tomb1Main_gameflow_ub.json5 @@ -26,6 +26,7 @@ "type": "normal", "music": 59, "injections": [ + "data/egypt_fd.bin", "data/egypt_textures.bin", ], "sequence": [ @@ -46,6 +47,7 @@ "type": "normal", "music": 59, "injections": [ + "data/cat_fd.bin", "data/cat_itemrots.bin", "data/cat_textures.bin", ], @@ -67,6 +69,7 @@ "type": "normal", "music": 60, "injections": [ + "data/stronghold_fd.bin", "data/stronghold_itemrots.bin", "data/stronghold_textures.bin", ], @@ -88,6 +91,7 @@ "type": "normal", "music": 60, "injections": [ + "data/hive_fd.bin", "data/hive_itemrots.bin", "data/hive_textures.bin", ], diff --git a/bin/data/atlantis_fd.bin b/bin/data/atlantis_fd.bin new file mode 100644 index 000000000..102ca410e Binary files /dev/null and b/bin/data/atlantis_fd.bin differ diff --git a/bin/data/cat_fd.bin b/bin/data/cat_fd.bin new file mode 100644 index 000000000..7b4c3195c Binary files /dev/null and b/bin/data/cat_fd.bin differ diff --git a/bin/data/caves_fd.bin b/bin/data/caves_fd.bin new file mode 100644 index 000000000..98ed59ac4 Binary files /dev/null and b/bin/data/caves_fd.bin differ diff --git a/bin/data/egypt_fd.bin b/bin/data/egypt_fd.bin new file mode 100644 index 000000000..41f3d70e0 Binary files /dev/null and b/bin/data/egypt_fd.bin differ diff --git a/bin/data/folly_fd.bin b/bin/data/folly_fd.bin new file mode 100644 index 000000000..de3de9c38 Binary files /dev/null and b/bin/data/folly_fd.bin differ diff --git a/bin/data/hive_fd.bin b/bin/data/hive_fd.bin new file mode 100644 index 000000000..77861debe Binary files /dev/null and b/bin/data/hive_fd.bin differ diff --git a/bin/data/mines_fd.bin b/bin/data/mines_fd.bin new file mode 100644 index 000000000..f468029c7 Binary files /dev/null and b/bin/data/mines_fd.bin differ diff --git a/bin/data/obelisk_fd.bin b/bin/data/obelisk_fd.bin new file mode 100644 index 000000000..74de5ee45 Binary files /dev/null and b/bin/data/obelisk_fd.bin differ diff --git a/bin/data/pyramid_fd.bin b/bin/data/pyramid_fd.bin index 8b39f667a..daf0b6c42 100644 Binary files a/bin/data/pyramid_fd.bin and b/bin/data/pyramid_fd.bin differ diff --git a/bin/data/qualopec_fd.bin b/bin/data/qualopec_fd.bin new file mode 100644 index 000000000..858fdc996 Binary files /dev/null and b/bin/data/qualopec_fd.bin differ diff --git a/bin/data/sanctuary_fd.bin b/bin/data/sanctuary_fd.bin new file mode 100644 index 000000000..13b4db85d Binary files /dev/null and b/bin/data/sanctuary_fd.bin differ diff --git a/bin/data/stronghold_fd.bin b/bin/data/stronghold_fd.bin new file mode 100644 index 000000000..662a188b0 Binary files /dev/null and b/bin/data/stronghold_fd.bin differ diff --git a/src/game/inject.c b/src/game/inject.c index 17ef3ab39..cb06ce164 100644 --- a/src/game/inject.c +++ b/src/game/inject.c @@ -78,6 +78,7 @@ typedef struct MESH_EDIT { typedef enum FLOOR_EDIT_TYPE { FET_TRIGGER_PARAM = 0, + FET_MUSIC_ONESHOT = 1, } FLOOR_EDIT_TYPE; typedef enum ROOM_MESH_EDIT_TYPE { @@ -122,6 +123,7 @@ static void Inject_TextureOverwrites( static void Inject_FloorDataEdits(INJECTION *injection); static void Inject_TriggerParameterChange( INJECTION *injection, FLOOR_INFO *floor); +static void Inject_SetMusicOneShot(FLOOR_INFO *floor); static void Inject_RoomMeshEdits(INJECTION *injection); static void Inject_TextureRoomFace(INJECTION *injection); @@ -993,6 +995,9 @@ static void Inject_FloorDataEdits(INJECTION *injection) case FET_TRIGGER_PARAM: Inject_TriggerParameterChange(injection, floor); break; + case FET_MUSIC_ONESHOT: + Inject_SetMusicOneShot(floor); + break; default: LOG_WARNING("Unknown floor data edit type: %d", edit_type); break; @@ -1076,6 +1081,63 @@ static void Inject_TriggerParameterChange( } } +static void Inject_SetMusicOneShot(FLOOR_INFO *floor) +{ + if (!floor) { + return; + } + + uint16_t fd_index = floor->index; + if (!fd_index) { + return; + } + + while (1) { + uint16_t data = g_FloorData[fd_index++]; + switch (data & DATA_TYPE) { + case FT_DOOR: + case FT_ROOF: + case FT_TILT: + fd_index++; + break; + + case FT_LAVA: + break; + + case FT_TRIGGER: { + uint16_t trig_type = TRIG_TYPE(data); + int16_t *flags = &g_FloorData[fd_index++]; + + if (trig_type == TT_SWITCH || trig_type == TT_KEY + || trig_type == TT_PICKUP) { + fd_index++; // skip entity reference + } + + while (1) { + int16_t *command = &g_FloorData[fd_index++]; + if (TRIG_BITS(*command) == TO_CD) { + *flags |= IF_ONESHOT; + return; + } + + if (TRIG_BITS(*command) == TO_CAMERA) { + fd_index++; // skip camera setup + } + + if (*command & END_BIT) { + break; + } + } + return; + } + } + + if (data & END_BIT) { + break; + } + } +} + uint32_t Inject_GetExtraRoomMeshSize(int32_t room_index) { uint32_t size = 0; diff --git a/src/global/const.h b/src/global/const.h index 083e2e1bb..a3c1b73d8 100644 --- a/src/global/const.h +++ b/src/global/const.h @@ -178,6 +178,7 @@ #define DATA_TYPE 0x00FF #define VALUE_BITS 0x03FF #define TRIG_BITS(T) ((T & 0x3C00) >> 10) +#define TRIG_TYPE(T) ((T & 0x3F00) >> 8) #define MIN_SQUARE SQUARE(WALL_L / 4) // = 65536 #define GROUND_SHIFT (STEP_L)