Skip to content

Commit

Permalink
keep music when collecting secrets (closes #17)
Browse files Browse the repository at this point in the history
  • Loading branch information
rr- committed Mar 14, 2021
1 parent 87f472d commit 4847d82
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ Not all options are turned on by default. Refer to `Tomb1Main.json5` for details
- fixed a crash when Lara is on fire and goes too far away from where she caught fire
- fixed settings not being saved when exiting the game with Alt+F4
- fixed settings not persisting chosen layout (default vs. user keys)
- fixed the sound of collecting a secret killing music

## Decompilation progress

Expand Down
3 changes: 3 additions & 0 deletions Tomb1Main.json5
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@
// for longer than 1 frame.
"fix_fmv_esc_key": true,

// Fixes the sound of collecting a secret resetting the active music track.
"fix_secrets_killing_music": true,

// The desired field of view in degrees, which overrides the hardcoded
// default. The default values are 80 (horizontal) and 65 (vertical).
"fov_value": 65,
Expand Down
1 change: 1 addition & 0 deletions src/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ int8_t T1MReadConfigFromJson(const char *cfg_data)
READ_BOOL(fix_pyramid_secret_trigger, 1);
READ_BOOL(fix_illegal_gun_equip, 1);
READ_BOOL(fix_fmv_esc_key, 1);
READ_BOOL(fix_secrets_killing_music, 1);
READ_INTEGER(fov_value, 65);
READ_BOOL(fov_vertical, 1);
READ_BOOL(disable_demo, 0);
Expand Down
1 change: 1 addition & 0 deletions src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ struct {
int8_t fix_pyramid_secret_trigger;
int8_t fix_illegal_gun_equip;
int8_t fix_fmv_esc_key;
int8_t fix_secrets_killing_music;
int32_t fov_value;
int8_t fov_vertical;
int8_t disable_demo;
Expand Down
7 changes: 7 additions & 0 deletions src/specific/sndpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "game/sound.h"
#include "game/vars.h"

#include "config.h"
#include "util.h"

#include <windows.h>
Expand All @@ -18,6 +19,12 @@ void S_CDVolume(int16_t volume)
int32_t S_CDPlay(int16_t track)
{
TRACE("%d", track);

if (T1MConfig.fix_secrets_killing_music && track == 13) {
SoundEffect(SFX_SECRET, NULL, SPM_ALWAYS);
return 1;
}

if (track == 0) {
CDStop();
return 0;
Expand Down
1 change: 1 addition & 0 deletions test/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ void test_empty_config()
ASSERT_INT_EQUAL(T1MConfig.fix_pyramid_secret_trigger, 1);
ASSERT_INT_EQUAL(T1MConfig.fix_illegal_gun_equip, 1);
ASSERT_INT_EQUAL(T1MConfig.fix_fmv_esc_key, 1);
ASSERT_INT_EQUAL(T1MConfig.fix_secrets_killing_music, 1);
ASSERT_INT_EQUAL(T1MConfig.fov_value, 65);
ASSERT_INT_EQUAL(T1MConfig.fov_vertical, 1);
ASSERT_INT_EQUAL(T1MConfig.disable_demo, 0);
Expand Down

0 comments on commit 4847d82

Please sign in to comment.