Skip to content

Commit

Permalink
Merge pull request #27 from MelonSpeedruns/melon-randomizer
Browse files Browse the repository at this point in the history
lh sun check done
  • Loading branch information
briaguya-ai authored Jun 1, 2022
2 parents 9d9cce9 + e7061c7 commit 9c82eaf
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 7 deletions.
12 changes: 12 additions & 0 deletions soh/soh/Enhancements/randomizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1242,6 +1242,8 @@ GetItemID Randomizer::GetItemFromGet(RandomizerGet randoGet, GetItemID ogItemId)
return GI_BOMBCHUS_5;
case BOMBCHUS_20:
return GI_BOMBCHUS_20;
case POCKET_EGG:
return GI_POCKET_EGG;
case ICE_TRAP:
return GI_ICE_TRAP;
case PIECE_OF_HEART:
Expand Down Expand Up @@ -1538,6 +1540,8 @@ RandomizerCheck Randomizer::GetCheckFromActor(s16 sceneNum, s16 actorId, s16 act
} else {
return KAK_ANJU_AS_CHILD;
}
case 359:
return KAK_MAN_ON_ROOF;
}
case 17:
switch (actorId) {
Expand Down Expand Up @@ -2046,6 +2050,14 @@ RandomizerCheck Randomizer::GetCheckFromActor(s16 sceneNum, s16 actorId, s16 act
return GANONS_TOWER_BOSS_KEY_CHEST;
}
case 87:
switch (actorId) {
case 271:
if (LINK_IS_ADULT) {
return LH_SUN;
} else {
return LH_UNDERWATER_ITEM;
}
}
switch(actorParams) {
case 7686:
return LH_FREESTANDING_POH;
Expand Down
16 changes: 14 additions & 2 deletions soh/src/overlays/actors/ovl_En_Ani/z_en_ani.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,27 @@ void func_809B0558(EnAni* this, GlobalContext* globalCtx) {
}
gSaveContext.itemGetInf[1] |= 0x20;
} else {
func_8002F434(&this->actor, globalCtx, GI_HEART_PIECE, 10000.0f, 200.0f);
if (gSaveContext.n64ddFlag) {
s32 getItemId =
GetRandomizedItemId(GI_HEART_PIECE, this->actor.id, this->actor.params, globalCtx->sceneNum);
func_8002F434(&this->actor, globalCtx, getItemId, 10000.0f, 200.0f);
} else {
func_8002F434(&this->actor, globalCtx, GI_HEART_PIECE, 10000.0f, 200.0f);
}
}
}

void func_809B05F0(EnAni* this, GlobalContext* globalCtx) {
if (Actor_TextboxIsClosing(&this->actor, globalCtx)) {
EnAni_SetupAction(this, func_809B0558);
}
func_8002F434(&this->actor, globalCtx, GI_HEART_PIECE, 10000.0f, 200.0f);

if (gSaveContext.n64ddFlag) {
s32 getItemId = GetRandomizedItemId(GI_HEART_PIECE, this->actor.id, this->actor.params, globalCtx->sceneNum);
func_8002F434(&this->actor, globalCtx, getItemId, 10000.0f, 200.0f);
} else {
func_8002F434(&this->actor, globalCtx, GI_HEART_PIECE, 10000.0f, 200.0f);
}
}

void func_809B064C(EnAni* this, GlobalContext* globalCtx) {
Expand Down
35 changes: 31 additions & 4 deletions soh/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ void ItemEtcetera_Init(Actor* thisx, GlobalContext* globalCtx) {
case ITEM_ETC_LETTER:
Actor_SetScale(&this->actor, 0.5f);
this->futureActionFunc = func_80B858B4;
if (gSaveContext.eventChkInf[3] & 2) {
if ((gSaveContext.eventChkInf[3] & 2 && !gSaveContext.n64ddFlag) ||
(gSaveContext.n64ddFlag && Flags_GetTreasure(globalCtx, 0x1F))) {
Actor_Kill(&this->actor);
}
break;
Expand Down Expand Up @@ -122,10 +123,19 @@ void func_80B85824(ItemEtcetera* this, GlobalContext* globalCtx) {
if ((this->actor.params & 0xFF) == 1) {
gSaveContext.eventChkInf[3] |= 2;
Flags_SetSwitch(globalCtx, 0xB);

if (gSaveContext.n64ddFlag) {
Flags_SetTreasure(globalCtx, 0x1E);
}
}
Actor_Kill(&this->actor);
} else {
func_8002F434(&this->actor, globalCtx, this->getItemId, 30.0f, 50.0f);
if (gSaveContext.n64ddFlag) {
s32 getItemId = GetRandomizedItemId(GI_ARROW_FIRE, this->actor.id, this->actor.params, globalCtx->sceneNum);
func_8002F434(&this->actor, globalCtx, getItemId, 30.0f, 50.0f);
} else {
func_8002F434(&this->actor, globalCtx, this->getItemId, 30.0f, 50.0f);
}
}
}

Expand All @@ -134,11 +144,22 @@ void func_80B858B4(ItemEtcetera* this, GlobalContext* globalCtx) {
if ((this->actor.params & 0xFF) == 1) {
gSaveContext.eventChkInf[3] |= 2;
Flags_SetSwitch(globalCtx, 0xB);

if (gSaveContext.n64ddFlag) {
Flags_SetTreasure(globalCtx, 0x1F);
}
}
Actor_Kill(&this->actor);
} else {
if (0) {} // Necessary to match
func_8002F434(&this->actor, globalCtx, this->getItemId, 30.0f, 50.0f);

if (gSaveContext.n64ddFlag) {
s32 getItemId = GetRandomizedItemId(GI_LETTER_RUTO, this->actor.id, this->actor.params, globalCtx->sceneNum);
func_8002F434(&this->actor, globalCtx, getItemId, 30.0f, 50.0f);
} else {
func_8002F434(&this->actor, globalCtx, this->getItemId, 30.0f, 50.0f);
}

if ((globalCtx->gameplayFrames & 0xD) == 0) {
EffectSsBubble_Spawn(globalCtx, &this->actor.world.pos, 0.0f, 0.0f, 10.0f, 0.13f);
}
Expand Down Expand Up @@ -211,8 +232,14 @@ void ItemEtcetera_DrawThroughLens(Actor* thisx, GlobalContext* globalCtx) {

void ItemEtcetera_Draw(Actor* thisx, GlobalContext* globalCtx) {
ItemEtcetera* this = (ItemEtcetera*)thisx;
s32 type = this->actor.params & 0xFF;

if (gSaveContext.n64ddFlag && (type == ITEM_ETC_ARROW_FIRE || type == ITEM_ETC_LETTER)) {
this->giDrawId = GetItemModelFromId(
GetRandomizedItemId(this->getItemId, this->actor.id, this->actor.params, globalCtx->sceneNum));
}

func_8002EBCC(&this->actor, globalCtx, 0);
func_8002ED80(&this->actor, globalCtx, 0);
GetItem_Draw(globalCtx, this->giDrawId);
}
}
3 changes: 2 additions & 1 deletion soh/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ void ShotSun_UpdateHyliaSun(ShotSun* this, GlobalContext* globalCtx) {
if (this->collider.base.acFlags & AC_HIT) {
func_80078884(NA_SE_SY_CORRECT_CHIME);
osSyncPrintf(VT_FGCOL(CYAN) "SHOT_SUN HIT!!!!!!!\n" VT_RST);
if (INV_CONTENT(ITEM_ARROW_FIRE) == ITEM_NONE) {
if ((INV_CONTENT(ITEM_ARROW_FIRE) == ITEM_NONE && !gSaveContext.n64ddFlag) ||
!Flags_GetTreasure(globalCtx, 0x1F)) {
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_ITEM_ETCETERA, 700.0f, -800.0f, 7261.0f, 0, 0, 0, 7);
globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(gLakeHyliaFireArrowsCS);
if (1) {}
Expand Down

0 comments on commit 9c82eaf

Please sign in to comment.