summaryrefslogtreecommitdiff
path: root/soh/src/code
diff options
context:
space:
mode:
Diffstat (limited to 'soh/src/code')
-rw-r--r--soh/src/code/audio_load.c17
-rw-r--r--soh/src/code/z_parameter.c6
2 files changed, 19 insertions, 4 deletions
diff --git a/soh/src/code/audio_load.c b/soh/src/code/audio_load.c
index eb788fd0c..583ce84fe 100644
--- a/soh/src/code/audio_load.c
+++ b/soh/src/code/audio_load.c
@@ -1346,7 +1346,7 @@ void AudioLoad_Init(void* heap, size_t heapSize) {
int customSeqListSize = 0;
char** seqList = ResourceMgr_ListFiles("audio/sequences*", &seqListSize);
char** customSeqList = ResourceMgr_ListFiles("custom/music/*", &customSeqListSize);
- sequenceMapSize = (size_t)(seqListSize + customSeqListSize);
+ sequenceMapSize = (size_t)(AudioCollection_SequenceMapSize() + customSeqListSize);
sequenceMap = malloc(sequenceMapSize * sizeof(char*));
gAudioContext.seqLoadStatus = malloc(sequenceMapSize * sizeof(char*));
@@ -1366,16 +1366,27 @@ void AudioLoad_Init(void* heap, size_t heapSize) {
int startingSeqNum = MAX_AUTHENTIC_SEQID; // 109 is the highest vanilla sequence
qsort(customSeqList, customSeqListSize, sizeof(char*), strcmp_sort);
+ // Because AudioCollection's sequenceMap actually has more than sequences (including instruments from 130-135 and sfx in the 2000s, 6000s, 10000s, 14000s, 18000s, and 26000s),
+ // it's better here to keep track of the next empty seqNum in AudioCollection instead of just skipping past the instruments at 130 with a higher MAX_AUTHENTIC_SEQID,
+ // especially if those others could be added to in the future. However, this really needs to be streamlined with specific ranges in AudioCollection for types, or unifying
+ // AudioCollection and the various maps in here
+ int seqNum = startingSeqNum;
+
for (size_t i = startingSeqNum; i < startingSeqNum + customSeqListSize; i++) {
+ // ensure that what would be the next sequence number is actually unassigned in AudioCollection
+ while (AudioCollection_HasSequenceNum(seqNum)) {
+ seqNum++;
+ }
int j = i - startingSeqNum;
- AudioCollection_AddToCollection(customSeqList[j], i);
+ AudioCollection_AddToCollection(customSeqList[j], seqNum);
SequenceData sDat = ResourceMgr_LoadSeqByName(customSeqList[j]);
- sDat.seqNumber = i;
+ sDat.seqNumber = seqNum;
char* str = malloc(strlen(customSeqList[j]) + 1);
strcpy(str, customSeqList[j]);
sequenceMap[sDat.seqNumber] = str;
+ seqNum++;
}
free(customSeqList);
diff --git a/soh/src/code/z_parameter.c b/soh/src/code/z_parameter.c
index 25f19ad36..b3cece3b5 100644
--- a/soh/src/code/z_parameter.c
+++ b/soh/src/code/z_parameter.c
@@ -3023,7 +3023,11 @@ s32 Health_ChangeBy(PlayState* play, s16 healthChange) {
}
void Rupees_ChangeBy(s16 rupeeChange) {
- gSaveContext.rupeeAccumulator += rupeeChange;
+ if (gPlayState == NULL) {
+ gSaveContext.rupees += rupeeChange;
+ } else {
+ gSaveContext.rupeeAccumulator += rupeeChange;
+ }
if (rupeeChange > 0) {
gSaveContext.sohStats.count[COUNT_RUPEES_COLLECTED] += rupeeChange;