inject: fix non-oneshot music triggers (#940)

Added an injection function to support converting triggers to one shot.
Added injections for each level identified as needing trigger updates.

Resolves #939.
This commit is contained in:
lahm86 2023-08-24 18:03:08 +01:00 committed by GitHub
parent 96822a13c0
commit e88e6980e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 88 additions and 0 deletions

View file

@ -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

View file

@ -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)

View file

@ -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": [

View file

@ -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",
],

BIN
bin/data/atlantis_fd.bin Normal file

Binary file not shown.

BIN
bin/data/cat_fd.bin Normal file

Binary file not shown.

BIN
bin/data/caves_fd.bin Normal file

Binary file not shown.

BIN
bin/data/egypt_fd.bin Normal file

Binary file not shown.

BIN
bin/data/folly_fd.bin Normal file

Binary file not shown.

BIN
bin/data/hive_fd.bin Normal file

Binary file not shown.

BIN
bin/data/mines_fd.bin Normal file

Binary file not shown.

BIN
bin/data/obelisk_fd.bin Normal file

Binary file not shown.

Binary file not shown.

BIN
bin/data/qualopec_fd.bin Normal file

Binary file not shown.

BIN
bin/data/sanctuary_fd.bin Normal file

Binary file not shown.

BIN
bin/data/stronghold_fd.bin Normal file

Binary file not shown.

View file

@ -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;

View file

@ -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)