Merge remote-tracking branch 'hm/develop-khan' into khan-to-dev

This commit is contained in:
briaguya
2023-03-14 00:29:30 -04:00
17 changed files with 84 additions and 69 deletions

View File

@@ -53,7 +53,7 @@ void AudioHeap_ResetLoadStatus(void) {
}
}
for (i = 0; i < MAX_SEQUENCES; i++) {
for (i = 0; i < sequenceMapSize; i++) {
if (gAudioContext.seqLoadStatus[i] != 5) {
gAudioContext.seqLoadStatus[i] = 0;
}

View File

@@ -77,7 +77,8 @@ void* sUnusedHandler = NULL;
s32 gAudioContextInitalized = false;
char* sequenceMap[MAX_SEQUENCES];
char** sequenceMap;
size_t sequenceMapSize;
// A map of authentic sequence IDs to their cache policies, for use with sequence swapping.
u8 seqCachePolicyMap[MAX_AUTHENTIC_SEQID];
char* fontMap[256];
@@ -488,7 +489,7 @@ u8* AudioLoad_GetFontsForSequence(s32 seqId, u32* outNumFonts) {
return NULL;
u16 newSeqId = AudioEditor_GetReplacementSeq(seqId);
if (newSeqId > MAX_SEQUENCES || !sequenceMap[newSeqId]) {
if (newSeqId > sequenceMapSize || !sequenceMap[newSeqId]) {
return NULL;
}
SequenceData sDat = ResourceMgr_LoadSeqByName(sequenceMap[newSeqId]);
@@ -1342,7 +1343,12 @@ void AudioLoad_Init(void* heap, size_t heapSize) {
AudioHeap_ResetStep();
int seqListSize = 0;
int customSeqListSize = 0;
char** seqList = ResourceMgr_ListFiles("audio/sequences*", &seqListSize);
char** customSeqList = ResourceMgr_ListFiles("custom/music/*", &customSeqListSize);
sequenceMapSize = (size_t)(seqListSize + customSeqListSize);
sequenceMap = malloc(sequenceMapSize * sizeof(char*));
gAudioContext.seqLoadStatus = malloc(sequenceMapSize * sizeof(char*));
for (size_t i = 0; i < seqListSize; i++)
{
@@ -1357,9 +1363,7 @@ void AudioLoad_Init(void* heap, size_t heapSize) {
free(seqList);
int customSeqListSize = 0;
int startingSeqNum = MAX_AUTHENTIC_SEQID; // 109 is the highest vanilla sequence
char** customSeqList = ResourceMgr_ListFiles("custom/music/*", &customSeqListSize);
qsort(customSeqList, customSeqListSize, sizeof(char*), strcmp_sort);
for (size_t i = startingSeqNum; i < startingSeqNum + customSeqListSize; i++) {

View File

@@ -3,7 +3,7 @@
#include <libultraship/libultra.h>
#include "global.h"
extern char* sequenceMap[MAX_SEQUENCES];
extern char** sequenceMap;
#define PORTAMENTO_IS_SPECIAL(x) ((x).mode & 0x80)
#define PORTAMENTO_MODE(x) ((x).mode & ~0x80)

View File

@@ -299,9 +299,7 @@ void Sram_InitSave(FileChooseContext* fileChooseCtx) {
gSaveContext.playerName[offset] = Save_GetSaveMetaInfo(fileChooseCtx->buttonIndex)->playerName[offset];
}
if (fileChooseCtx->questType[fileChooseCtx->buttonIndex] == 2 && strnlen(CVarGetString("gSpoilerLog", ""), 1) != 0 &&
!((Save_GetSaveMetaInfo(fileChooseCtx->buttonIndex)->requiresMasterQuest && !ResourceMgr_GameHasMasterQuest()) ||
(Save_GetSaveMetaInfo(fileChooseCtx->buttonIndex)->requiresMasterQuest && !ResourceMgr_GameHasOriginal()))) {
if (fileChooseCtx->questType[fileChooseCtx->buttonIndex] == 2 && strnlen(CVarGetString("gSpoilerLog", ""), 1) != 0) {
// Set N64DD Flags for save file
fileChooseCtx->n64ddFlags[fileChooseCtx->buttonIndex] = 1;
fileChooseCtx->n64ddFlag = 1;

View File

@@ -247,7 +247,7 @@ const ActorInit Boss_Sst_InitVars = {
(ActorFunc)BossSst_Destroy,
(ActorFunc)BossSst_UpdateHand,
(ActorFunc)BossSst_DrawHand,
NULL,
(ActorResetFunc)BossSst_Reset,
};
#include "z_boss_sst_colchk.c"
@@ -3268,4 +3268,13 @@ void BossSst_Reset(void) {
sCutsceneCamera= 0;
sBodyStatic = false;
// Reset death colors
sBodyColor.a = 255;
sBodyColor.r = 255;
sBodyColor.g = 255;
sBodyColor.b = 255;
sStaticColor.a = 255;
sStaticColor.r = 0;
sStaticColor.g = 0;
sStaticColor.b = 0;
}

View File

@@ -475,9 +475,13 @@ void EnClearTag_Update(Actor* thisx, PlayState* play2) {
Math_ApproachS(&this->actor.world.rot.z, 0, 15, this->targetDirection.z);
Math_ApproachF(&this->targetDirection.z, 0x500, 1.0f, 0x100);
// Introduce a range requirement in Enemy Rando so Arwings don't shoot the player from
// across the map. Especially noticeable in big maps like Lake Hylia and Hyrule Field.
uint8_t enemyRandoShootLaser = !CVarGetInteger("gRandomizedEnemies", 0) || this->actor.xzDistToPlayer < 1000.0f;
// Check if the Arwing should fire its laser.
if ((this->frameCounter % 4) == 0 && (Rand_ZeroOne() < 0.75f) &&
(this->state == CLEAR_TAG_STATE_TARGET_LOCKED)) {
(this->state == CLEAR_TAG_STATE_TARGET_LOCKED) && enemyRandoShootLaser) {
this->shouldShootLaser = true;
}
} else {

View File

@@ -103,6 +103,12 @@ void func_80AFB768(EnSi* this, PlayState* play) {
if (gSaveContext.n64ddFlag) {
Randomizer_UpdateSkullReward(this, play);
if (getItemId != RG_ICE_TRAP) {
Randomizer_GiveSkullReward(this, play);
} else {
gSaveContext.pendingIceTrapCount++;
GameInteractor_ExecuteOnItemReceiveHooks(getItem);
}
} else {
Item_Give(play, giveItemId);
}
@@ -117,15 +123,8 @@ void func_80AFB768(EnSi* this, PlayState* play) {
Message_StartTextbox(play, textId, NULL);
if (gSaveContext.n64ddFlag) {
if (getItemId != RG_ICE_TRAP) {
Randomizer_GiveSkullReward(this, play);
Audio_PlayFanfare_Rando(getItem);
} else {
gSaveContext.pendingIceTrapCount++;
GameInteractor_ExecuteOnItemReceiveHooks(getItem);
Audio_PlayFanfare(NA_BGM_SMALL_ITEM_GET);
}
if (gSaveContext.n64ddFlag && getItemId != RG_ICE_TRAP) {
Audio_PlayFanfare_Rando(getItem);
} else {
Audio_PlayFanfare(NA_BGM_SMALL_ITEM_GET);
}
@@ -150,21 +149,20 @@ void func_80AFB89C(EnSi* this, PlayState* play) {
if (!CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_13)) {
if (gSaveContext.n64ddFlag) {
Randomizer_UpdateSkullReward(this, play);
if (getItemId != RG_ICE_TRAP) {
Randomizer_GiveSkullReward(this, play);
} else {
gSaveContext.pendingIceTrapCount++;
GameInteractor_ExecuteOnItemReceiveHooks(getItem);
}
} else {
Item_Give(play, giveItemId);
}
Message_StartTextbox(play, textId, NULL);
if (gSaveContext.n64ddFlag) {
if (getItemId != RG_ICE_TRAP) {
Randomizer_GiveSkullReward(this, play);
Audio_PlayFanfare_Rando(getItem);
} else {
gSaveContext.pendingIceTrapCount++;
GameInteractor_ExecuteOnItemReceiveHooks(getItem);
Audio_PlayFanfare(NA_BGM_SMALL_ITEM_GET);
}
if (gSaveContext.n64ddFlag && getItemId != RG_ICE_TRAP) {
Audio_PlayFanfare_Rando(getItem);
} else {
Audio_PlayFanfare(NA_BGM_SMALL_ITEM_GET);
}