level: allow empty SFX data while reading

This allows reading levels that contain no SFX data.

Resolves #2460.
This commit is contained in:
lahm86 2025-02-08 17:24:33 +00:00
parent 0d4d0f3535
commit efe124c60e
5 changed files with 4 additions and 10 deletions

View file

@ -34,6 +34,7 @@
- fixed the teleporting command sometimes putting Lara in invalid flipmap rooms (#2370)
- fixed teleporting to an item on a ledge sometimes pushing Lara to the room below (#2372)
- fixed secret and enemy speech not playing if the sound effects are missing from the level file (#2458)
- fixed being unable to load a level that contains no sound effect data (#2460)
- fixed input controller remaps not being saved across game relaunches (#2422, regression from 4.6)
- fixed the upside-down camera fix to no longer limit Lara's vision (#2276, regression from 4.2)
- fixed being unable to load some old custom levels that contain certain (invalid) floor data (#2114, regression from 4.3)

View file

@ -585,6 +585,7 @@ Not all options are turned on by default. Refer to `TR1X_ConfigTool.exe` for det
- **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
- fixed being unable to load a level that contains no sound effect data
#### Mods
- added developer console (accessible with `/`, see [COMMANDS.md](COMMANDS.md) for details)

View file

@ -35,6 +35,7 @@
- fixed the teleporting command sometimes putting Lara in invalid flipmap rooms (#2370)
- fixed teleporting to an item on a ledge sometimes pushing Lara to the room below (#2372)
- fixed the game crashing if a cinematic is triggered but the level contains no cinematic frames (#2413)
- fixed being unable to load a level that contains no sound effect data (#2460)
- fixed Lara activating triggers one frame too early (#2205, regression from 0.7)
- fixed savegame incompatibility with OG (#2271, regression from 0.8)
- fixed stopwatch showing wrong UI in some circumstances (#2221, regression from 0.8)

View file

@ -136,6 +136,7 @@ game with new enhancements and features.
- fixed wrong default music volume (being very loud on some setups)
- fixed flare sound effects not always playing when Lara is in shallow water
- fixed music not playing if triggered while the game is muted, but the volume is then increased
- fixed being unable to load a level that contains no sound effect data
#### Mods
- added developer console (accessible with `/`, see [COMMANDS.md](COMMANDS.md) for details)

View file

@ -841,10 +841,6 @@ void Level_ReadSamples(
const int32_t num_sample_infos = VFile_ReadS32(file);
info->samples.info_count = num_sample_infos;
LOG_INFO("sample infos: %d", num_sample_infos);
if (num_sample_infos == 0) {
goto finish;
}
Sound_InitialiseSampleInfos(num_sample_infos + extra_sfx_count);
for (int32_t i = 0; i < num_sample_infos; i++) {
SAMPLE_INFO *const sample_info = Sound_GetSampleInfoByIdx(i);
@ -858,9 +854,6 @@ void Level_ReadSamples(
const int32_t data_size = VFile_ReadS32(file);
info->samples.data_size = data_size;
LOG_INFO("%d sample data size", data_size);
if (data_size == 0) {
Shell_ExitSystem("No Sample Data");
}
info->samples.data =
GameBuf_Alloc(data_size + extra_data_size, GBUF_SAMPLES);
@ -870,9 +863,6 @@ void Level_ReadSamples(
const int32_t num_offsets = VFile_ReadS32(file);
LOG_INFO("samples: %d", num_offsets);
info->samples.offset_count = num_offsets;
if (num_offsets == 0) {
goto finish;
}
info->samples.offsets =
Memory_Alloc(sizeof(int32_t) * (num_offsets + extra_offset_count));