mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-12-22 08:08:53 -05:00
vb underwater item (#104)
* underwater working pre func_80B858B4 replacement * underwater item update handled by hookhandlers * remove commented out code * remove unused should
This commit is contained in:
parent
36a462d667
commit
fe231147d5
@ -25,6 +25,7 @@ extern "C" {
|
||||
#include "src/overlays/actors/ovl_En_Fr/z_en_fr.h"
|
||||
#include "src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.h"
|
||||
#include "src/overlays/actors/ovl_En_Sth/z_en_sth.h"
|
||||
#include "src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.h"
|
||||
#include "adult_trade_shuffle.h"
|
||||
extern SaveContext gSaveContext;
|
||||
extern PlayState* gPlayState;
|
||||
@ -274,6 +275,27 @@ void ItemBHeart_UpdateRandomizedItem(Actor* actor, PlayState* play) {
|
||||
}
|
||||
}
|
||||
|
||||
void ItemEtcetera_DrawRandomizedItem(ItemEtcetera* itemEtcetera, PlayState* play) {
|
||||
EnItem00_CustomItemsParticles(&itemEtcetera->actor, play, itemEtcetera->sohItemEntry);
|
||||
GetItemEntry_Draw(play, itemEtcetera->sohItemEntry);
|
||||
}
|
||||
|
||||
void ItemEtcetera_func_80B858B4_Randomized(ItemEtcetera* itemEtcetera, PlayState* play) {
|
||||
if (itemEtcetera->actor.xzDistToPlayer < 30.0f &&
|
||||
fabsf(itemEtcetera->actor.yDistToPlayer) < 50.0f) {
|
||||
if ((itemEtcetera->actor.params & 0xFF) == 1) {
|
||||
Flags_SetEventChkInf(EVENTCHKINF_OBTAINED_RUTOS_LETTER);
|
||||
Flags_SetSwitch(play, 0xB);
|
||||
}
|
||||
|
||||
Actor_Kill(&itemEtcetera->actor);
|
||||
} else {
|
||||
if ((play->gameplayFrames & 0xD) == 0) {
|
||||
EffectSsBubble_Spawn(play, &itemEtcetera->actor.world.pos, 0.0f, 0.0f, 10.0f, 0.13f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EnCow_MoveForRandomizer(EnCow* enCow, PlayState* play) {
|
||||
bool moved = false;
|
||||
|
||||
@ -954,6 +976,23 @@ void RandomizerOnActorInitHandler(void* actorRef) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (actor->id == ACTOR_ITEM_ETCETERA) {
|
||||
ItemEtcetera* itemEtcetera = static_cast<ItemEtcetera*>(actorRef);
|
||||
RandomizerCheck rc = OTRGlobals::Instance->gRandomizer->GetCheckFromActor(itemEtcetera->actor.id, gPlayState->sceneNum, itemEtcetera->actor.params);
|
||||
if (rc != RC_UNKNOWN_CHECK) {
|
||||
itemEtcetera->sohItemEntry = Rando::Context::GetInstance()->GetFinalGIEntry(rc, true, (GetItemID)Rando::StaticData::GetLocation(rc)->GetVanillaItem());
|
||||
itemEtcetera->drawFunc = (ActorFunc)ItemEtcetera_DrawRandomizedItem;
|
||||
}
|
||||
|
||||
int32_t type = itemEtcetera->actor.params & 0xFF;
|
||||
switch (type) {
|
||||
case ITEM_ETC_LETTER: {
|
||||
itemEtcetera->futureActionFunc = (ItemEtceteraActionFunc)ItemEtcetera_func_80B858B4_Randomized;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RandomizerRegisterHooks() {
|
||||
|
@ -83,8 +83,7 @@ void ItemEtcetera_Init(Actor* thisx, PlayState* play) {
|
||||
case ITEM_ETC_LETTER:
|
||||
Actor_SetScale(&this->actor, 0.5f);
|
||||
this->futureActionFunc = func_80B858B4;
|
||||
if ((Flags_GetEventChkInf(EVENTCHKINF_OBTAINED_RUTOS_LETTER) && !IS_RANDO) ||
|
||||
(IS_RANDO && Flags_GetTreasure(play, 0x1E))) {
|
||||
if (Flags_GetEventChkInf(EVENTCHKINF_OBTAINED_RUTOS_LETTER)) {
|
||||
Actor_Kill(&this->actor);
|
||||
}
|
||||
break;
|
||||
@ -147,21 +146,11 @@ void func_80B858B4(ItemEtcetera* this, PlayState* play) {
|
||||
if ((this->actor.params & 0xFF) == 1) {
|
||||
Flags_SetEventChkInf(EVENTCHKINF_OBTAINED_RUTOS_LETTER);
|
||||
Flags_SetSwitch(play, 0xB);
|
||||
|
||||
if (IS_RANDO) {
|
||||
Flags_SetTreasure(play, 0x1E);
|
||||
}
|
||||
}
|
||||
|
||||
Actor_Kill(&this->actor);
|
||||
} else {
|
||||
if (0) {} // Necessary to match
|
||||
|
||||
if (!IS_RANDO) {
|
||||
Actor_OfferGetItem(&this->actor, play, this->getItemId, 30.0f, 50.0f);
|
||||
} else {
|
||||
GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(RC_LH_UNDERWATER_ITEM, GI_LETTER_RUTO);
|
||||
GiveItemEntryFromActor(&this->actor, play, getItemEntry, 30.0f, 50.0f);
|
||||
}
|
||||
Actor_OfferGetItem(&this->actor, play, this->getItemId, 30.0f, 50.0f);
|
||||
|
||||
if ((play->gameplayFrames & 0xD) == 0) {
|
||||
EffectSsBubble_Spawn(play, &this->actor.world.pos, 0.0f, 0.0f, 10.0f, 0.13f);
|
||||
@ -246,24 +235,6 @@ void ItemEtcetera_Draw(Actor* thisx, PlayState* play) {
|
||||
ItemEtcetera* this = (ItemEtcetera*)thisx;
|
||||
s32 type = this->actor.params & 0xFF;
|
||||
|
||||
if (IS_RANDO) {
|
||||
GetItemEntry randoGetItem = (GetItemEntry)GET_ITEM_NONE;
|
||||
if (type == ITEM_ETC_ARROW_FIRE) {
|
||||
randoGetItem = Randomizer_GetItemFromKnownCheck(RC_LH_SUN, GI_ARROW_FIRE);
|
||||
} else if (type == ITEM_ETC_LETTER) {
|
||||
randoGetItem = Randomizer_GetItemFromKnownCheck(RC_LH_UNDERWATER_ITEM, GI_LETTER_RUTO);
|
||||
}
|
||||
|
||||
EnItem00_CustomItemsParticles(&this->actor, play, randoGetItem);
|
||||
|
||||
if (randoGetItem.itemId != ITEM_NONE) {
|
||||
func_8002EBCC(&this->actor, play, 0);
|
||||
func_8002ED80(&this->actor, play, 0);
|
||||
GetItemEntry_Draw(play, randoGetItem);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
func_8002EBCC(&this->actor, play, 0);
|
||||
func_8002ED80(&this->actor, play, 0);
|
||||
GetItem_Draw(play, this->giDrawId);
|
||||
|
@ -16,6 +16,9 @@ typedef struct ItemEtcetera {
|
||||
/* 0x0154 */ u8 objBankIndex;
|
||||
/* 0x0158 */ ActorFunc drawFunc;
|
||||
/* 0x015C */ ItemEtceteraActionFunc actionFunc;
|
||||
// #region SOH [Randomizer] Caching the get item entry for the draw function for performance
|
||||
/* */ GetItemEntry sohItemEntry;
|
||||
// #endregion
|
||||
} ItemEtcetera; // size = 0x0160
|
||||
|
||||
typedef enum {
|
||||
|
Loading…
Reference in New Issue
Block a user