malon wip + zelda done + impa done + anju fix

This commit is contained in:
MelonSpeedruns 2022-05-30 22:09:48 -04:00
commit 72ef5de447
9 changed files with 89 additions and 46 deletions

View file

@ -447,7 +447,6 @@ s8 func_8002F368(GlobalContext* globalCtx);
void Actor_GetScreenPos(GlobalContext* globalCtx, Actor* actor, s16* x, s16* y);
u32 Actor_HasParent(Actor* actor, GlobalContext* globalCtx);
s32 func_8002F434(Actor* actor, GlobalContext* globalCtx, s32 getItemId, f32 xzRange, f32 yRange);
s32 GiveItem_Impa(Actor* actor, GlobalContext* globalCtx, s32 getItemId, f32 xzRange, f32 yRange);
void func_8002F554(Actor* actor, GlobalContext* globalCtx, s32 getItemId);
void func_8002F580(Actor* actor, GlobalContext* globalCtx);
u32 Actor_HasNoParent(Actor* actor, GlobalContext* globalCtx);

View file

@ -179,7 +179,7 @@ typedef struct {
/* 0x1420 */ s16 worldMapArea;
/* 0x1422 */ s16 sunsSongState; // controls the effects of suns song
/* 0x1424 */ s16 healthAccumulator;
ItemLocation itemLocations[266];
ItemLocation itemLocations[268];
Sprite seedIcons[5];
} SaveContext; // size = 0x1428

View file

@ -275,6 +275,7 @@ typedef enum {
GANONS_CASTLE_SPIRIT_TRIAL_CRYSTAL_SWITCH_CHEST,
GANONS_CASTLE_SPIRIT_TRIAL_INVISIBLE_CHEST,
GANONS_TOWER_BOSS_KEY_CHEST,
HC_ZELDAS_LETTER,
UNKNOWN_CHECK
} RandomizerCheck;

View file

@ -197,6 +197,7 @@ std::unordered_map<std::string, RandomizerCheck> SpoilerfileCheckNameToEnum = {
{"GF Chest", GF_CHEST},
{"GF HBA 1000 Points", GF_HBA_1000_POINTS},
{"GF HBA 1500 Points", GF_HBA_1500_POINTS},
{"HC Zeldas Letter", HC_ZELDAS_LETTER},
{"Wasteland Chest", WASTELAND_CHEST},
{"Colossus Great Fairy Reward", COLOSSUS_GREAT_FAIRY_REWARD},
{"Colossus Freestanding PoH", COLOSSUS_FREESTANDING_POH},
@ -1095,6 +1096,7 @@ GetItemID Randomizer::GetItemFromGet(RandomizerGet randoGet, GetItemID ogItemId)
return GI_REQUIEM_OF_SPIRIT;
case PRELUDE_OF_LIGHT:
return GI_PRELUDE_OF_LIGHT;
default:
return ogItemId;
}

View file

@ -1947,35 +1947,6 @@ s32 func_8002F434(Actor* actor, GlobalContext* globalCtx, s32 getItemId, f32 xzR
return false;
}
s32 GiveItem_Impa(Actor* actor, GlobalContext* globalCtx, s32 getItemId, f32 xzRange, f32 yRange) {
Player* player = GET_PLAYER(globalCtx);
if (!(player->stateFlags1 & 0x3C7080) && Player_GetExplosiveHeld(player) < 0) {
if ((((player->heldActor != NULL) || (actor == player->targetActor)) && (getItemId > GI_NONE) &&
(getItemId < GI_MAX)) ||
(!(player->stateFlags1 & 0x20000800))) {
f32 playerPosX = player->actor.world.pos.x;
f32 thisPosX = actor->world.pos.x;
if ((thisPosX - (kREG(17) + 130.0f) < playerPosX) && (!Gameplay_InCsMode(globalCtx))) {
s16 yawDiff = actor->yawTowardsPlayer - player->actor.shape.rot.y;
s32 absYawDiff = ABS(yawDiff);
if ((getItemId != GI_NONE) || (player->getItemDirection < absYawDiff)) {
player->getItemId = getItemId;
player->interactRangeActor = actor;
player->getItemDirection = absYawDiff;
return true;
}
} else {
return false;
}
}
}
return false;
}
void func_8002F554(Actor* actor, GlobalContext* globalCtx, s32 getItemId) {
func_8002F434(actor, globalCtx, getItemId, 50.0f, 10.0f);
}

View file

@ -899,18 +899,22 @@ void func_80986BF8(DemoIm* this, GlobalContext* globalCtx) {
}
u8 successImpa;
void GivePlayerRandoRewardImpa(Actor* actor, GlobalContext* globalCtx, RandomizerCheck check) {
GetItemID getItemId = GetRandomizedItemIdFromKnownCheck(check, GI_NONE);
void GivePlayerRandoRewardImpa(Actor* impa, GlobalContext* globalCtx, RandomizerCheck check) {
if (!Player_InBlockingCsMode(globalCtx, GET_PLAYER(globalCtx))) {
if (successImpa == 0) {
GetItemID getItemId = GetRandomizedItemIdFromKnownCheck(check, GI_LETTER_ZELDA);
if (successImpa && !Player_InBlockingCsMode(globalCtx, GET_PLAYER(globalCtx))) {
if (func_8002F434(impa, globalCtx, getItemId, 100.0f, 50.0f) == true) {
successImpa = 1;
}
} else if (successImpa == 1) {
gSaveContext.eventChkInf[5] |= 0x200;
globalCtx->sceneLoadFlag = 0x14;
globalCtx->fadeTransition = 7;
globalCtx->fadeTransition = 3;
gSaveContext.nextTransition = 3;
globalCtx->nextEntranceIndex = 0x0594;
gSaveContext.nextCutsceneIndex = 0;
} else if (!successImpa) {
successImpa = GiveItem_Impa(&actor, globalCtx, getItemId, 10000.0f, 100.0f);
}
}
}

View file

@ -271,6 +271,10 @@ void EnMa1_Init(Actor* thisx, GlobalContext* globalCtx) {
Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);
CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(22), &sColChkInfoInit);
if (gSaveContext.n64ddFlag) {
gSaveContext.infTable[8] |= 0x800;
}
if (!func_80AA08C4(this, globalCtx)) {
Actor_Kill(&this->actor);
return;
@ -324,9 +328,15 @@ void func_80AA0EA0(EnMa1* this, GlobalContext* globalCtx) {
this->actor.parent = NULL;
this->actionFunc = func_80AA0EFC;
} else {
if (gSaveContext.n64ddFlag) {
GetItemID getItemId = GetRandomizedItemIdFromKnownCheck(HC_GREAT_FAIRY_REWARD, GI_LETTER_ZELDA);
func_8002F434(&this->actor, globalCtx, getItemId, 120.0f, 10.0f);
} else {
func_8002F434(&this->actor, globalCtx, GI_WEIRD_EGG, 120.0f, 10.0f);
}
}
}
void func_80AA0EFC(EnMa1* this, GlobalContext* globalCtx) {
if (this->unk_1E8.unk_00 == 3) {
@ -337,6 +347,22 @@ void func_80AA0EFC(EnMa1* this, GlobalContext* globalCtx) {
}
}
u8 malonSuccess;
void GivePlayerRandoRewardMalon(EnMa1* zelda, GlobalContext* globalCtx, RandomizerCheck check) {
if (!Player_InBlockingCsMode(globalCtx, GET_PLAYER(globalCtx))) {
if (malonSuccess == 0) {
GetItemID getItemId = GetRandomizedItemIdFromKnownCheck(check, GI_LETTER_ZELDA);
if (func_8002F434(&zelda->actor, globalCtx, getItemId, 100.0f, 50.0f) == true) {
malonSuccess = 1;
}
} else if (malonSuccess == 1) {
gSaveContext.unk_13EE = 0x32;
gSaveContext.eventChkInf[4] |= 1;
}
}
}
void func_80AA0F44(EnMa1* this, GlobalContext* globalCtx) {
Player* player = GET_PLAYER(globalCtx);
@ -394,6 +420,13 @@ void func_80AA1150(EnMa1* this, GlobalContext* globalCtx) {
}
}
/*
if (gSaveContext.n64ddFlag) {
GivePlayerRandoRewardMalon(this, globalCtx, HC_ZELDAS_LETTER);
return;
}
*/
void EnMa1_DoNothing(EnMa1* this, GlobalContext* globalCtx) {
}

View file

@ -305,7 +305,7 @@ void func_80ABA654(EnNiwLady* this, GlobalContext* globalCtx) {
this->actor.parent = NULL;
if (gSaveContext.n64ddFlag) {
s32 itemId = GetRandomizedItemIdFromKnownCheck(GI_BOTTLE, KAK_ANJU_AS_CHILD);
s32 itemId = GetRandomizedItemIdFromKnownCheck(KAK_ANJU_AS_CHILD, GI_BOTTLE);
func_8002F434(&this->actor, globalCtx, itemId, 100.0f, 50.0f);
} else {
this->getItemId = GI_BOTTLE;
@ -395,7 +395,7 @@ void func_80ABA9B8(EnNiwLady* this, GlobalContext* globalCtx) {
this->actor.parent = NULL;
if (gSaveContext.n64ddFlag) {
s32 itemId = GetRandomizedItemIdFromKnownCheck(GI_POCKET_EGG, KAK_ANJU_AS_ADULT);
s32 itemId = GetRandomizedItemIdFromKnownCheck(KAK_ANJU_AS_ADULT, GI_POCKET_EGG);
func_8002F434(&this->actor, globalCtx, itemId, 200.0f, 100.0f);
} else {
func_8002F434(&this->actor, globalCtx, GI_POCKET_EGG, 200.0f, 100.0f);
@ -455,7 +455,7 @@ void func_80ABAC00(EnNiwLady* this, GlobalContext* globalCtx) {
getItemId = !(gSaveContext.itemGetInf[2] & 0x1000) ? GI_POCKET_EGG : GI_COJIRO;
if (gSaveContext.n64ddFlag && getItemId == GI_POCKET_EGG) {
getItemId = GetRandomizedItemIdFromKnownCheck(GI_POCKET_EGG, KAK_ANJU_AS_ADULT);
getItemId = GetRandomizedItemIdFromKnownCheck(KAK_ANJU_AS_ADULT, GI_POCKET_EGG);
}
}
func_8002F434(&this->actor, globalCtx, getItemId, 200.0f, 100.0f);

View file

@ -227,10 +227,29 @@ u16 EnZl4_GetText(GlobalContext* globalCtx, Actor* thisx) {
return ret;
}
u8 zeldaSuccess;
void GivePlayerRandoRewardZeldaChild(EnZl4* zelda, GlobalContext* globalCtx, RandomizerCheck check) {
if (!Player_InBlockingCsMode(globalCtx, GET_PLAYER(globalCtx))) {
if (zeldaSuccess == 0) {
GetItemID getItemId = GetRandomizedItemIdFromKnownCheck(check, GI_LETTER_ZELDA);
if (func_8002F434(&zelda->actor, globalCtx, getItemId, 100.0f, 50.0f) == true) {
zeldaSuccess = 1;
}
} else if (zeldaSuccess == 1) {
gSaveContext.unk_13EE = 0x32;
gSaveContext.eventChkInf[4] |= 1;
}
}
}
s16 func_80B5B9B0(GlobalContext* globalCtx, Actor* thisx) {
EnZl4* this = (EnZl4*)thisx;
if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) {
return false;
}
return true;
}
@ -372,6 +391,12 @@ void EnZl4_Init(Actor* thisx, GlobalContext* globalCtx) {
this->actor.textId = -1;
this->eyeExpression = this->mouthExpression = ZL4_MOUTH_NEUTRAL;
if (gSaveContext.n64ddFlag) {
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_0);
this->actionFunc = EnZl4_Idle;
return;
}
if (gSaveContext.sceneSetupIndex >= 4) {
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_0);
this->actionFunc = EnZl4_TheEnd;
@ -389,6 +414,7 @@ void EnZl4_Init(Actor* thisx, GlobalContext* globalCtx) {
this->csState = ZL4_CS_LEGEND;
this->talkState = 0;
}
this->actionFunc = EnZl4_Cutscene;
}
}
@ -434,6 +460,7 @@ s32 EnZl4_CsWaitForPlayer(EnZl4* this, GlobalContext* globalCtx) {
return false;
}
}
playerx->world.pos = this->actor.world.pos;
rotY = this->actor.shape.rot.y;
playerx->world.pos.x += 56.0f * Math_SinS(rotY);
@ -1196,7 +1223,13 @@ void EnZl4_Cutscene(EnZl4* this, GlobalContext* globalCtx) {
void EnZl4_Idle(EnZl4* this, GlobalContext* globalCtx) {
func_800343CC(globalCtx, &this->actor, &this->unk_1E0.unk_00, this->collider.dim.radius + 60.0f, EnZl4_GetText,
func_80B5B9B0);
func_80B5BB78(this, globalCtx);
if (gSaveContext.n64ddFlag) {
GivePlayerRandoRewardZeldaChild(this, globalCtx, HC_ZELDAS_LETTER);
return;
}
}
void EnZl4_TheEnd(EnZl4* this, GlobalContext* globalCtx) {