vb lh sun (#106)

* underwater working pre func_80B858B4 replacement

* underwater item update handled by hookhandlers

* vb lh sun

* remove unused should
This commit is contained in:
briaguya 2024-04-09 23:57:07 -04:00 committed by GitHub
parent fe231147d5
commit bbbd2520b1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 47 additions and 13 deletions

View File

@ -277,6 +277,8 @@ void ItemBHeart_UpdateRandomizedItem(Actor* actor, PlayState* play) {
void ItemEtcetera_DrawRandomizedItem(ItemEtcetera* itemEtcetera, PlayState* play) { void ItemEtcetera_DrawRandomizedItem(ItemEtcetera* itemEtcetera, PlayState* play) {
EnItem00_CustomItemsParticles(&itemEtcetera->actor, play, itemEtcetera->sohItemEntry); EnItem00_CustomItemsParticles(&itemEtcetera->actor, play, itemEtcetera->sohItemEntry);
func_8002EBCC(&itemEtcetera->actor, play, 0);
func_8002ED80(&itemEtcetera->actor, play, 0);
GetItemEntry_Draw(play, itemEtcetera->sohItemEntry); GetItemEntry_Draw(play, itemEtcetera->sohItemEntry);
} }
@ -296,6 +298,44 @@ void ItemEtcetera_func_80B858B4_Randomized(ItemEtcetera* itemEtcetera, PlayState
} }
} }
void ItemEtcetera_func_80B85824_Randomized(ItemEtcetera* itemEtcetera, PlayState* play) {
if ((itemEtcetera->actor.params & 0xFF) != 7) {
return;
}
if (itemEtcetera->actor.xzDistToPlayer < 30.0f &&
fabsf(itemEtcetera->actor.yDistToPlayer) < 50.0f) {
Flags_SetTreasure(play, 0x1F);
Actor_Kill(&itemEtcetera->actor);
}
}
void ItemEtcetera_MoveRandomizedFireArrowDown(ItemEtcetera* itemEtcetera, PlayState* play) {
Actor_UpdateBgCheckInfo(play, &itemEtcetera->actor, 10.0f, 10.0f, 0.0f, 5);
Actor_MoveForward(&itemEtcetera->actor);
if (!(itemEtcetera->actor.bgCheckFlags & 1)) {
ItemEtcetera_SpawnSparkles(itemEtcetera, play);
}
itemEtcetera->actor.shape.rot.y += 0x400;
ItemEtcetera_func_80B85824_Randomized(itemEtcetera, play);
}
void ItemEtcetera_UpdateRandomizedFireArrow(ItemEtcetera* itemEtcetera, PlayState* play) {
if ((play->csCtx.state != CS_STATE_IDLE) && (play->csCtx.npcActions[0] != NULL)) {
if (play->csCtx.npcActions[0]->action == 2) {
itemEtcetera->actor.draw = (ActorFunc)ItemEtcetera_DrawRandomizedItem;
itemEtcetera->actor.gravity = -0.1f;
itemEtcetera->actor.minVelocityY = -4.0f;
itemEtcetera->actionFunc = ItemEtcetera_MoveRandomizedFireArrowDown;
}
} else {
itemEtcetera->actor.gravity = -0.1f;
itemEtcetera->actor.minVelocityY = -4.0f;
itemEtcetera->actionFunc = ItemEtcetera_MoveRandomizedFireArrowDown;
}
}
void EnCow_MoveForRandomizer(EnCow* enCow, PlayState* play) { void EnCow_MoveForRandomizer(EnCow* enCow, PlayState* play) {
bool moved = false; bool moved = false;
@ -991,6 +1031,10 @@ void RandomizerOnActorInitHandler(void* actorRef) {
itemEtcetera->futureActionFunc = (ItemEtceteraActionFunc)ItemEtcetera_func_80B858B4_Randomized; itemEtcetera->futureActionFunc = (ItemEtceteraActionFunc)ItemEtcetera_func_80B858B4_Randomized;
break; break;
} }
case ITEM_ETC_ARROW_FIRE: {
itemEtcetera->futureActionFunc = (ItemEtceteraActionFunc)ItemEtcetera_UpdateRandomizedFireArrow;
break;
}
} }
} }
} }

View File

@ -120,24 +120,13 @@ void func_80B857D0(ItemEtcetera* this, PlayState* play) {
void func_80B85824(ItemEtcetera* this, PlayState* play) { void func_80B85824(ItemEtcetera* this, PlayState* play) {
if (Actor_HasParent(&this->actor, play)) { if (Actor_HasParent(&this->actor, play)) {
if ((this->actor.params & 0xFF) == 7) {
if (IS_RANDO) {
Flags_SetTreasure(play, 0x1F);
}
}
if ((this->actor.params & 0xFF) == 1) { if ((this->actor.params & 0xFF) == 1) {
Flags_SetEventChkInf(EVENTCHKINF_OBTAINED_RUTOS_LETTER); Flags_SetEventChkInf(EVENTCHKINF_OBTAINED_RUTOS_LETTER);
Flags_SetSwitch(play, 0xB); Flags_SetSwitch(play, 0xB);
} }
Actor_Kill(&this->actor); Actor_Kill(&this->actor);
} else { } else {
if (!IS_RANDO) { Actor_OfferGetItem(&this->actor, play, this->getItemId, 30.0f, 50.0f);
Actor_OfferGetItem(&this->actor, play, this->getItemId, 30.0f, 50.0f);
} else {
GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(RC_LH_SUN, GI_ARROW_FIRE);
GiveItemEntryFromActor(&this->actor, play, getItemEntry, 30.0f, 50.0f);
}
} }
} }
@ -233,7 +222,6 @@ void ItemEtcetera_DrawThroughLens(Actor* thisx, PlayState* play) {
void ItemEtcetera_Draw(Actor* thisx, PlayState* play) { void ItemEtcetera_Draw(Actor* thisx, PlayState* play) {
ItemEtcetera* this = (ItemEtcetera*)thisx; ItemEtcetera* this = (ItemEtcetera*)thisx;
s32 type = this->actor.params & 0xFF;
func_8002EBCC(&this->actor, play, 0); func_8002EBCC(&this->actor, play, 0);
func_8002ED80(&this->actor, play, 0); func_8002ED80(&this->actor, play, 0);

View File

@ -38,4 +38,6 @@ typedef enum {
/* 0x0D */ ITEM_ETC_KEY_SMALL_CHEST_GAME /* 0x0D */ ITEM_ETC_KEY_SMALL_CHEST_GAME
} ItemEtceteraType; } ItemEtceteraType;
void ItemEtcetera_SpawnSparkles(ItemEtcetera* ItemEtcetera, PlayState* play);
#endif #endif