Skip to content

Commit

Permalink
Merge pull request #5 from MelonSpeedruns/testing-out-item-replacemen…
Browse files Browse the repository at this point in the history
…t-melon

Item cutscenes always play now
  • Loading branch information
briaguya-ai authored May 28, 2022
2 parents 801dc04 + f76363f commit 84911ee
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion soh/soh.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -1241,4 +1241,4 @@
<ItemGroup>
<None Include="include\macro.inc" />
</ItemGroup>
</Project>
</Project>
2 changes: 2 additions & 0 deletions soh/soh/Enhancements/randomizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -842,6 +842,8 @@ RandomizerCheck Randomizer::GetCheckFromSceneAndParams(s16 sceneNum, s16 actorPa
}
case 96:
switch(actorParams) {
case 6:
return DMT_FREESTANDING_POH;
case 23201:
return DMT_CHEST;
}
Expand Down
9 changes: 9 additions & 0 deletions soh/src/code/z_en_item00.c
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,11 @@ void EnItem00_SetupAction(EnItem00* this, EnItem00ActionFunc actionFunc) {
this->actionFunc = actionFunc;
}

s32 Item00_GetRandomizedItemId(EnItem00* this, s16 sceneNum, s16 actorParams) {
s32 itemId = GetItemFromSceneAndParams(sceneNum, this->actor.params, this->getItemId);
return itemId;
}

void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) {
EnItem00* this = (EnItem00*)thisx;
s32 pad;
Expand Down Expand Up @@ -690,6 +695,7 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) {
}

if ((getItemId != GI_NONE) && !Actor_HasParent(&this->actor, globalCtx)) {
getItemId = Item00_GetRandomizedItemId(this, globalCtx->sceneNum, this->actor.params);
func_8002F554(&this->actor, globalCtx, getItemId);
}

Expand Down Expand Up @@ -1049,6 +1055,9 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
params = &this->actor.params;

if ((getItemId != GI_NONE) && !Actor_HasParent(&this->actor, globalCtx)) {
if (gSaveContext.n64ddFlag) {
getItemId = Item00_GetRandomizedItemId(this, globalCtx->sceneNum, this->actor.params);
}
func_8002F554(&this->actor, globalCtx, getItemId);
}

Expand Down
3 changes: 2 additions & 1 deletion soh/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,8 @@ void func_80ABA9B8(EnNiwLady* this, GlobalContext* globalCtx) {
case 0:
Message_CloseTextbox(globalCtx);
this->actor.parent = NULL;
func_8002F434(&this->actor, globalCtx, GI_POCKET_EGG, 200.0f, 100.0f);
func_8002F434(&this->actor, globalCtx, NiwLady_GetRandomizedItemId(this, GI_POCKET_EGG), 200.0f,
100.0f);
this->actionFunc = func_80ABAC00;
break;
case 1:
Expand Down
2 changes: 1 addition & 1 deletion soh/src/overlays/actors/ovl_player_actor/z_player.c
Original file line number Diff line number Diff line change
Expand Up @@ -6155,7 +6155,7 @@ s32 func_8083E5A8(Player* this, GlobalContext* globalCtx) {

iREG(67) = false;

if ((Item_CheckObtainability(giEntry->itemId) == ITEM_NONE) || (globalCtx->sceneNum == SCENE_BOWLING)) {
if ((Item_CheckObtainability(giEntry->itemId) == ITEM_NONE) || (globalCtx->sceneNum == SCENE_BOWLING) || gSaveContext.n64ddFlag) {
func_808323B4(globalCtx, this);
func_8083AE40(this, giEntry->objectId);

Expand Down

0 comments on commit 84911ee

Please sign in to comment.