From 9843fc692291bf7532d0b26430d306e2dc47098d Mon Sep 17 00:00:00 2001 From: robojumper Date: Sun, 3 May 2026 20:56:05 +0200 Subject: [PATCH] Item progress --- config/SOUE01/symbols.txt | 224 ++-- include/d/a/d_a_base.h | 1 - include/d/a/d_a_item.h | 211 +++- include/d/a/d_a_itembase.h | 2 +- include/d/a/obj/d_a_obj_warp.h | 9 +- include/d/d_pouch.h | 3 + include/d/t/d_t_minigame_insect_capture.h | 8 + include/d/t/d_t_siren.h | 11 +- src/d/a/d_a_item.cpp | 1128 +++++++++++++++++++-- src/d/d_message.cpp | 2 +- 10 files changed, 1386 insertions(+), 213 deletions(-) diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index 2a135743..e0a3f829 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -2471,7 +2471,7 @@ fn_8005BBB0 = .text:0x8005BBB0; // type:function size:0xC fairyHeal__17daPlayerActBase_cFP11dAcOFairy_c = .text:0x8005BBC0; // type:function size:0xC turnSoupCold = .text:0x8005BBD0; // type:function size:0x8 addExtraHearts = .text:0x8005BBE0; // type:function size:0x74 -AcItem__healLink = .text:0x8005BC60; // type:function size:0x18 +healLink__9dAcItem_cFUlb = .text:0x8005BC60; // type:function size:0x18 getCurrentHealthCapacity__7dAcPy_cFv = .text:0x8005BC80; // type:function size:0x54 addDigInteractionTarget__7dAcPy_cFP9dAcBase_cf = .text:0x8005BCE0; // type:function size:0xC fn_8005BCF0 = .text:0x8005BCF0; // type:function size:0x30 @@ -10067,7 +10067,7 @@ drawPopups__16dLytMapMarkers_cFv = .text:0x80189B90; // type:function size:0x27C resetPopups__16dLytMapMarkers_cFv = .text:0x80189E10; // type:function size:0xF4 loadPopups__16dLytMapMarkers_cFv = .text:0x80189F10; // type:function size:0x8C getPouchSlotCount__Fb = .text:0x80189FA0; // type:function size:0x6C -isPouchItem = .text:0x8018A010; // type:function size:0x88 +isAnyPouchItem__9dAcItem_cF7ITEM_ID = .text:0x8018A010; // type:function size:0x88 isItemShield__Fl = .text:0x8018A0A0; // type:function size:0x18 isItemExtraAmmo__Fl = .text:0x8018A0C0; // type:function size:0x18 fn_8018A0E0 = .text:0x8018A0E0; // type:function size:0x20 @@ -10080,9 +10080,9 @@ isItemAnyRevitalizingPotion = .text:0x8018A280; // type:function size:0x28 isItemInBottle2 = .text:0x8018A2B0; // type:function size:0x68 getAdditionalInfoForPouchItem = .text:0x8018A320; // type:function size:0x4 getAdditionalInfoForPouchItem2 = .text:0x8018A330; // type:function size:0xC0 -setPouchSlotToValueWithExtraInfo = .text:0x8018A3F0; // type:function size:0x130 +collectPouchItemIntoSlot__FlUsUlb = .text:0x8018A3F0; // type:function size:0x130 tryCollectPouchItemInPouch = .text:0x8018A520; // type:function size:0x60 -collectPouchItem = .text:0x8018A580; // type:function size:0xD0 +collectPouchItem__FUs = .text:0x8018A580; // type:function size:0xD0 adventurePouchFindItemSlot__F7ITEM_ID = .text:0x8018A650; // type:function size:0x84 adventurePouchCountItem__F7ITEM_ID = .text:0x8018A6E0; // type:function size:0x74 convertLytPouchSlot__Fl = .text:0x8018A760; // type:function size:0x1C @@ -10480,7 +10480,7 @@ fn_801961F0 = .text:0x801961F0; // type:function size:0x220 fn_80196410 = .text:0x80196410; // type:function size:0x64 fn_80196480 = .text:0x80196480; // type:function size:0x10 fn_80196490 = .text:0x80196490; // type:function size:0x44 -TgInsectCaptureMinigame__addToCollectedBugs = .text:0x801964E0; // type:function size:0x6C +recordCollectedInsect__26dTgMinigameInsectCapture_cFll = .text:0x801964E0; // type:function size:0x6C TgInsectCaptureMinigame__getBugIndex = .text:0x80196550; // type:function size:0x44 TgStream__initList = .text:0x801965A0; // type:function size:0x50 TgStream__dtorList = .text:0x801965F0; // type:function size:0x58 @@ -13276,11 +13276,11 @@ fn_80246890 = .text:0x80246890; // type:function size:0x4 fn_802468A0 = .text:0x802468A0; // type:function size:0x4 fn_802468B0 = .text:0x802468B0; // type:function size:0xA8 ActorLink__sinit = .text:0x80246960; // type:function size:0x898 -fn_80247200 = .text:0x80247200; // type:function size:0x18 -AcItem__getItemTypeMaybeMaybeFromId = .text:0x80247220; // type:function size:0x54 -AcItem__getItemAnimType = .text:0x80247280; // type:function size:0x44 -AcItem__getHeartContainerHeartIncrease = .text:0x802472D0; // type:function size:0x8 -AcItem__getCompletedHeatpieceHeartIncrease = .text:0x802472E0; // type:function size:0x8 +isValidItemTypeIdx__13dAcItemBase_cFi = .text:0x80247200; // type:function size:0x18 +getItemTypeFromId__13dAcItemBase_cFUsPUl = .text:0x80247220; // type:function size:0x54 +getItemAnimType__13dAcItemBase_cFUsPUl = .text:0x80247280; // type:function size:0x44 +getHeartContainerHeartIncrease__13dAcItemBase_cFv = .text:0x802472D0; // type:function size:0x8 +getCompletedHeartPieceHeartIncrease__13dAcItemBase_cFv = .text:0x802472E0; // type:function size:0x8 getTearIdx__13dAcItemBase_cFi = .text:0x802472F0; // type:function size:0x24 getFlagIdxForTear__13dAcItemBase_cFiPUl = .text:0x80247320; // type:function size:0x60 getTearBit__13dAcItemBase_cFi = .text:0x80247380; // type:function size:0x34 @@ -13289,7 +13289,7 @@ getTrialIndex2 = .text:0x80247470; // type:function size:0xA8 fn_80247520 = .text:0x80247520; // type:function size:0xC fn_80247530 = .text:0x80247530; // type:function size:0xC fn_80247540 = .text:0x80247540; // type:function size:0x78 -AcItem__doFullHeal = .text:0x802475C0; // type:function size:0x28 +doFullHeal__9dAcItem_cFv = .text:0x802475C0; // type:function size:0x28 AcItem__isHeart = .text:0x802475F0; // type:function size:0x10 AcItem__isRupoor = .text:0x80247600; // type:function size:0x10 isItemBottleWithGlitteringSpores = .text:0x80247610; // type:function size:0x10 @@ -13322,7 +13322,7 @@ AcItem__isBluebirdFeather = .text:0x802477B0; // type:function size:0x10 AcItem__isGoldenSkull = .text:0x802477C0; // type:function size:0x10 AcItem__isGoddessPlume = .text:0x802477D0; // type:function size:0x10 isItemRevitalizingPotionPlusPlus = .text:0x802477E0; // type:function size:0x10 -isUpgradedPotionItem = .text:0x802477F0; // type:function size:0xC8 +isUpgradedPotion__9dAcItem_cF7ITEM_ID = .text:0x802477F0; // type:function size:0xC8 fn_802478C0 = .text:0x802478C0; // type:function size:0x68 AcItem__isItemFromMittsOrSword = .text:0x80247930; // type:function size:0x20 fn_80247950 = .text:0x80247950; // type:function size:0x28 @@ -13334,9 +13334,9 @@ fn_80247BB0 = .text:0x80247BB0; // type:function size:0x10C m3d__smdl_c__getNodePos = .text:0x80247CC0; // type:function size:0x58 fn_80247D20 = .text:0x80247D20; // type:function size:0x14C fn_80247E70 = .text:0x80247E70; // type:function size:0x50 -increment = .text:0x80247EC0; // type:function size:0x28 +increment__FPUl = .text:0x80247EC0; // type:function size:0x28 fn_80247EF0 = .text:0x80247EF0; // type:function size:0xA4 -getItemId__13dAcItemBase_cFv = .text:0x80247FA0; // type:function size:0x8 +getItemId__13dAcItemBase_cCFv = .text:0x80247FA0; // type:function size:0x8 fn_80247FB0 = .text:0x80247FB0; // type:function size:0x8 dAcItem_c_classInit__Fv = .text:0x80247FC0; // type:function size:0x30 AcItem__dontForceDemo = .text:0x80247FF0; // type:function size:0x8 @@ -13400,18 +13400,18 @@ createHeap__9dAcItem_cFv = .text:0x8024A470; // type:function size:0x75C create__9dAcItem_cFv = .text:0x8024ABD0; // type:function size:0x2888 changeState__77sStateMgr_c<9dAcItem_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>FRC12sStateIDIf_c = .text:0x8024D460; // type:function size:0x10 getStateID__77sStateMgr_c<9dAcItem_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x8024D470; // type:function size:0x10 -AcItem__destroy = .text:0x8024D480; // type:function size:0xEC -AcItem__update = .text:0x8024D570; // type:function size:0x66C +doDelete__9dAcItem_cFv = .text:0x8024D480; // type:function size:0xEC +actorExecute__9dAcItem_cFv = .text:0x8024D570; // type:function size:0x66C executeState__77sStateMgr_c<9dAcItem_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x8024DBE0; // type:function size:0x10 -AcItem__draw = .text:0x8024DBF0; // type:function size:0x304 -setNumberOfItems = .text:0x8024DF00; // type:function size:0x8 +draw__9dAcItem_cFv = .text:0x8024DBF0; // type:function size:0x304 +setSpawnQuantity__9dAcItem_cFl = .text:0x8024DF00; // type:function size:0x8 setFreestandingYOffset__9dAcItem_cFf = .text:0x8024DF10; // type:function size:0x8 -AcItem__setFramesInAir = .text:0x8024DF20; // type:function size:0x8 -fn_8024DF30 = .text:0x8024DF30; // type:function size:0x8 +setFramesInAir__9dAcItem_cFUl = .text:0x8024DF20; // type:function size:0x8 +setItemFlags__9dAcItem_cFUl = .text:0x8024DF30; // type:function size:0x8 isItemDropFromEnemy__9dAcItem_cCFv = .text:0x8024DF40; // type:function size:0x24 -resetNumberOfItems = .text:0x8024DF70; // type:function size:0xC -AcItem__resetFramesInAir = .text:0x8024DF80; // type:function size:0x8 -AcItem__incrementFramesInAir = .text:0x8024DF90; // type:function size:0x44 +unsetSpawnQuantity__9dAcItem_cFv = .text:0x8024DF70; // type:function size:0xC +unsetFramesInAir__9dAcItem_cFv = .text:0x8024DF80; // type:function size:0x8 +incrementFramesInAir__9dAcItem_cFv = .text:0x8024DF90; // type:function size:0x44 initializeState_Wait__9dAcItem_cFv = .text:0x8024DFE0; // type:function size:0xA8 executeState_Wait__9dAcItem_cFv = .text:0x8024E090; // type:function size:0x10AC finalizeState_Wait__9dAcItem_cFv = .text:0x8024F140; // type:function size:0x7C @@ -13489,19 +13489,19 @@ AcItem__is_Larvae_Ore_JellyBlob_Claw_Horn_EvilCryst_OrnSkull_GoldSkull = .text:0 AcItem__isBug = .text:0x80250D50; // type:function size:0x7C isTreasure2__9dAcItem_cF7ITEM_ID = .text:0x80250DD0; // type:function size:0x138 isTreasure__9dAcItem_cF7ITEM_ID = .text:0x80250F10; // type:function size:0x88 -isHeart2__9dAcItem_cCFv = .text:0x80250FA0; // type:function size:0x34 +isHeartV__9dAcItem_cCFv = .text:0x80250FA0; // type:function size:0x34 isSingleArrow__9dAcItem_cCFv = .text:0x80250FE0; // type:function size:0x8 isArrowBundle__9dAcItem_cCFv = .text:0x80250FF0; // type:function size:0x8 isSilverRupee__9dAcItem_cCFv = .text:0x80251000; // type:function size:0x8 isGoldRupee__9dAcItem_cCFv = .text:0x80251010; // type:function size:0x8 AcItem__isKeyPiece2 = .text:0x80251020; // type:function size:0x8 -isItem10DekuSeeds = .text:0x80251030; // type:function size:0x8 +is10DekuSeeds__9dAcItem_cCFv = .text:0x80251030; // type:function size:0x8 isHeartPiece__9dAcItem_cCFv = .text:0x80251040; // type:function size:0x8 AcItem__isItemBirdStatuette = .text:0x80251050; // type:function size:0x8 -AcItem__isLifeTreeFruit = .text:0x80251060; // type:function size:0x8 -AcItem__isItemAnyRupee = .text:0x80251070; // type:function size:0x34 +isLifeTreeFruit__9dAcItem_cCFv = .text:0x80251060; // type:function size:0x8 +isAnyRupeeV__9dAcItem_cCFv = .text:0x80251070; // type:function size:0x34 isAnyTear__9dAcItem_cCFv = .text:0x802510B0; // type:function size:0x8 -AcItem__isBombRefill = .text:0x802510C0; // type:function size:0x8 +isAnyBombs__9dAcItem_cCFv = .text:0x802510C0; // type:function size:0x8 isTriforce__9dAcItem_cCFv = .text:0x802510D0; // type:function size:0x8 fn_802510E0 = .text:0x802510E0; // type:function size:0x44 fn_80251130 = .text:0x80251130; // type:function size:0x44 @@ -13534,8 +13534,8 @@ fn_80251620 = .text:0x80251620; // type:function size:0x8 AcItem__getPickupDemoScale = .text:0x80251630; // type:function size:0x64 AcItem__getFreestandingModelScale3 = .text:0x802516A0; // type:function size:0x4 AcItem__getPickupBeetleScale = .text:0x802516B0; // type:function size:0x6C -AcItem__getCurrentModelScale = .text:0x80251720; // type:function size:0x94 -AcItem__getCurrentModelScale2 = .text:0x802517C0; // type:function size:0x48 +getCurrentModelScale__9dAcItem_cFPf = .text:0x80251720; // type:function size:0x94 +getCurrentScale__9dAcItem_cFv = .text:0x802517C0; // type:function size:0x48 fn_80251810 = .text:0x80251810; // type:function size:0xA8 fn_802518C0 = .text:0x802518C0; // type:function size:0x78 fn_80251940 = .text:0x80251940; // type:function size:0xA8 @@ -13544,109 +13544,109 @@ AcItem__getPositionOffset = .text:0x80251A90; // type:function size:0x5C fn_80251AF0 = .text:0x80251AF0; // type:function size:0x78 checkFlag__9dAcItem_cFUl = .text:0x80251B70; // type:function size:0x128 setFlag__9dAcItem_cFl = .text:0x80251CA0; // type:function size:0xC0 -AcItem__checkFlagForItem = .text:0x80251D60; // type:function size:0x34 +checkFlagV__9dAcItem_cCFv = .text:0x80251D60; // type:function size:0x34 AcItem__checkItemFlag = .text:0x80251DA0; // type:function size:0x48 hasAnyFairy__9dAcItem_cFv = .text:0x80251DF0; // type:function size:0x50 setItemflag = .text:0x80251E40; // type:function size:0x1C getRupeeCounter = .text:0x80251E60; // type:function size:0x8 getRupeeCounter__9dAcItem_cFv = .text:0x80251E70; // type:function size:0x4 fn_80251E80 = .text:0x80251E80; // type:function size:0xC -addRupees__9dAcItem_cFl = .text:0x80251E90; // type:function size:0x18 +increaseRupeeCounter__9dAcItem_cFl = .text:0x80251E90; // type:function size:0x18 getCurrentWalletCapacity = .text:0x80251EB0; // type:function size:0x8 getCurrentWalletCapacity__9dAcItem_cFv = .text:0x80251EC0; // type:function size:0x4 -AcItem__getCurrentArrowCount = .text:0x80251ED0; // type:function size:0x8 +getBowArrowCount__9dAcItem_cFv = .text:0x80251ED0; // type:function size:0x8 getTotalArrowCount__9dAcItem_cFv = .text:0x80251EE0; // type:function size:0x38 -changeArrowCounter = .text:0x80251F20; // type:function size:0xC -AddOrRemoveArrows = .text:0x80251F30; // type:function size:0x9C -AcItem__getMaxNumberOfArrows = .text:0x80251FD0; // type:function size:0x8 +increaseArrowCounter__9dAcItem_cFl = .text:0x80251F20; // type:function size:0xC +increaseArrowAndPouchCounter__9dAcItem_cFl = .text:0x80251F30; // type:function size:0x9C +getBowArrowCapacity__9dAcItem_cFv = .text:0x80251FD0; // type:function size:0x8 getTotalArrowCapacity__9dAcItem_cFv = .text:0x80251FE0; // type:function size:0x38 getBombsCounter = .text:0x80252020; // type:function size:0x8 getTotalBombCount__9dAcItem_cFv = .text:0x80252030; // type:function size:0x38 changeBombCounter = .text:0x80252070; // type:function size:0xC -changeBombCounterAndPouch = .text:0x80252080; // type:function size:0x9C +increaseBombAndPouchCounter__9dAcItem_cFl = .text:0x80252080; // type:function size:0x9C getMaxStandardBombCapacity = .text:0x80252120; // type:function size:0x8 getTotalBombCapacity__9dAcItem_cFv = .text:0x80252130; // type:function size:0x38 getCurrentTearCount = .text:0x80252170; // type:function size:0x8 AcItem__incrementTearCount = .text:0x80252180; // type:function size:0xC getMaxTearCount = .text:0x80252190; // type:function size:0x8 -AcItem__getCurrentSlingshotSeedCount = .text:0x802521A0; // type:function size:0x8 +getSlingshotSeedCount__9dAcItem_cFv = .text:0x802521A0; // type:function size:0x8 getTotalSeedCount__9dAcItem_cFv = .text:0x802521B0; // type:function size:0x38 -AcItem__changeSlingshotSeedCount = .text:0x802521F0; // type:function size:0xC -addDekuSeeds = .text:0x80252200; // type:function size:0x9C -AcItem__getMaxNumberOfSlingshotSeeds = .text:0x802522A0; // type:function size:0x8 +increaseDekuSeedCounter__9dAcItem_cFl = .text:0x802521F0; // type:function size:0xC +increaseDekuSeedAndPouchCounter__9dAcItem_cFl = .text:0x80252200; // type:function size:0x9C +getSlingshotSeedCapacity__9dAcItem_cFv = .text:0x802522A0; // type:function size:0x8 getTotalSeedCapacity__9dAcItem_cFv = .text:0x802522B0; // type:function size:0x38 getKeyPieceCount__9dAcItem_cFv = .text:0x802522F0; // type:function size:0x8 -increaseKeyPieceCounter = .text:0x80252300; // type:function size:0xC +increaseKeyPieceCounter__9dAcItem_cFl = .text:0x80252300; // type:function size:0xC getSmallKeyCount__9dAcItem_cFv = .text:0x80252310; // type:function size:0x8 -increaseSmallKeyCounter = .text:0x80252320; // type:function size:0xC +increaseSmallKeyCounter__9dAcItem_cFl = .text:0x80252320; // type:function size:0xC getAdditionalPouchSlotCounter = .text:0x80252330; // type:function size:0x8 -addToAdditionalAdventurePouchCounter = .text:0x80252340; // type:function size:0xC -AcItem__getNumOfRemainingHeartPiecesForHeart = .text:0x80252350; // type:function size:0x8 -addToHeartPieceCounter = .text:0x80252360; // type:function size:0xC +increaseExtraPouchCounter__9dAcItem_cFl = .text:0x80252340; // type:function size:0xC +getNumRemainingHeartPiecesForNextHeart__9dAcItem_cFv = .text:0x80252350; // type:function size:0x8 +increaseHeartPieceCounter__9dAcItem_cFl = .text:0x80252360; // type:function size:0xC getHeartContainerHealthCount__9dAcItem_cFv = .text:0x80252370; // type:function size:0x8 -addToHeartPieceCounter2 = .text:0x80252380; // type:function size:0xC +increaseTotalHeartPieceCounter__9dAcItem_cFl = .text:0x80252380; // type:function size:0xC getFaronGrasshopperCount = .text:0x80252390; // type:function size:0x8 -increaseFaronGrasshopperCounter = .text:0x802523A0; // type:function size:0xC +increaseFaronGrasshopperCounter__9dAcItem_cFl = .text:0x802523A0; // type:function size:0xC getWoodlandRhinoBeetleCount = .text:0x802523B0; // type:function size:0x8 -increaseRhinoBeetleCounter = .text:0x802523C0; // type:function size:0xC +increaseWoodlandRhinoBeetleCounter__9dAcItem_cFl = .text:0x802523C0; // type:function size:0xC getDekuHornetCount = .text:0x802523D0; // type:function size:0x8 -increaseDekuHornetCounter = .text:0x802523E0; // type:function size:0xC +increaseDekuHornetCounter__9dAcItem_cFl = .text:0x802523E0; // type:function size:0xC getSkyloftMantisCount = .text:0x802523F0; // type:function size:0x8 -increaseMantisCounter = .text:0x80252400; // type:function size:0xC +increaseSkyloftMantisCounter__9dAcItem_cFl = .text:0x80252400; // type:function size:0xC getVolcanicLadybugCount = .text:0x80252410; // type:function size:0x8 -increaseLadybugCounter = .text:0x80252420; // type:function size:0xC +increaseVolcanicLadybugCounter__9dAcItem_cFl = .text:0x80252420; // type:function size:0xC getBlessedButterflyCount = .text:0x80252430; // type:function size:0x8 -increaseButterflyCounter = .text:0x80252440; // type:function size:0xC +increaseBlessedButterflyCounter__9dAcItem_cFl = .text:0x80252440; // type:function size:0xC getLanayruAntCount = .text:0x80252450; // type:function size:0x8 -increaseAntCounter = .text:0x80252460; // type:function size:0xC +increaseLanayruAntCounter__9dAcItem_cFl = .text:0x80252460; // type:function size:0xC getSandCicadaCount = .text:0x80252470; // type:function size:0x8 -increaseCicadaCounter = .text:0x80252480; // type:function size:0xC +increaseSandCicadaCounter__9dAcItem_cFl = .text:0x80252480; // type:function size:0xC getGerudoDragonflyCount = .text:0x80252490; // type:function size:0x8 -increaseDragonflyCounter = .text:0x802524A0; // type:function size:0xC +increaseGerudoDragonflyCounter__9dAcItem_cFl = .text:0x802524A0; // type:function size:0xC getEldinRollerCount = .text:0x802524B0; // type:function size:0x8 -increaseEldinRollerCounter = .text:0x802524C0; // type:function size:0xC +increaseEldinRollerCounter__9dAcItem_cFl = .text:0x802524C0; // type:function size:0xC getSkyStagBeetleCount = .text:0x802524D0; // type:function size:0x8 -increaseSkyStagBeetleCounter = .text:0x802524E0; // type:function size:0xC +increaseSkyStagBeetleCounter__9dAcItem_cFl = .text:0x802524E0; // type:function size:0xC getStarryFireFlyCount = .text:0x802524F0; // type:function size:0x8 -increaseStarryFireflyCounter = .text:0x80252500; // type:function size:0xC +increaseStarryFireflyCounter__9dAcItem_cFl = .text:0x80252500; // type:function size:0xC getHornetlarvaeCount = .text:0x80252510; // type:function size:0x8 -increaseHornetLarvaeCounter = .text:0x80252520; // type:function size:0xC +increaseHornetLarvaeCounter__9dAcItem_cFl = .text:0x80252520; // type:function size:0xC getBirdFeatherCount = .text:0x80252530; // type:function size:0x8 -increaseBirdFeatherCounter = .text:0x80252540; // type:function size:0xC +increaseBirdFeatherCounter__9dAcItem_cFl = .text:0x80252540; // type:function size:0xC getTumbleweedCount = .text:0x80252550; // type:function size:0x8 -increaseTumbleweedCounter = .text:0x80252560; // type:function size:0xC +increaseTumbleWeedCounter__9dAcItem_cFl = .text:0x80252560; // type:function size:0xC getLizardTailCount = .text:0x80252570; // type:function size:0x8 -increaseLizardTailCounter = .text:0x80252580; // type:function size:0xC +increaseLizardTailCounter__9dAcItem_cFl = .text:0x80252580; // type:function size:0xC getEldinOreCount = .text:0x80252590; // type:function size:0x8 -increaseEldinOreCounter = .text:0x802525A0; // type:function size:0xC +increaseEldinOreCounter__9dAcItem_cFl = .text:0x802525A0; // type:function size:0xC getAncientFlowerCount = .text:0x802525B0; // type:function size:0x8 -increaseAncientFlowerCounter = .text:0x802525C0; // type:function size:0xC +increaseAncientFlowerCounter__9dAcItem_cFl = .text:0x802525C0; // type:function size:0xC getAmberRelicCount = .text:0x802525D0; // type:function size:0x8 -increaseAmberRelicCounter = .text:0x802525E0; // type:function size:0xC +increaseAmberRelicCounter__9dAcItem_cFl = .text:0x802525E0; // type:function size:0xC getDuskRelicCount = .text:0x802525F0; // type:function size:0x8 -increaseDuskRelicCounter = .text:0x80252600; // type:function size:0xC +increaseDuskRelicCounter__9dAcItem_cFl = .text:0x80252600; // type:function size:0xC getJellyBlobCount = .text:0x80252610; // type:function size:0x8 -increaseJellyBlobCounter = .text:0x80252620; // type:function size:0xC +increaseJellyBlobCounter__9dAcItem_cFl = .text:0x80252620; // type:function size:0xC getMonsterClawCount = .text:0x80252630; // type:function size:0x8 -increaseMonsterClawCounter = .text:0x80252640; // type:function size:0xC +increaseMonsterClawCounter__9dAcItem_cFl = .text:0x80252640; // type:function size:0xC getMonsterHornCount = .text:0x80252650; // type:function size:0x8 -increaseMonsterHornCounter = .text:0x80252660; // type:function size:0xC +increaseMonsterHornCounter__9dAcItem_cFl = .text:0x80252660; // type:function size:0xC getOrnamentalSkullCount = .text:0x80252670; // type:function size:0x8 -increaseSkullCounter = .text:0x80252680; // type:function size:0xC +increaseSkullCounter__9dAcItem_cFl = .text:0x80252680; // type:function size:0xC getEvilCrystalCount = .text:0x80252690; // type:function size:0x8 -increaseEviLCrystalCounter = .text:0x802526A0; // type:function size:0xC +increaseEvilCrystalCounter__9dAcItem_cFl = .text:0x802526A0; // type:function size:0xC getBlueBirdFeatherCount = .text:0x802526B0; // type:function size:0x8 -increaseBlueBirdFeatherCounter = .text:0x802526C0; // type:function size:0xC +increaseBlueBirdFeatherCounter__9dAcItem_cFl = .text:0x802526C0; // type:function size:0xC getGoldenSkullCount = .text:0x802526D0; // type:function size:0x8 -increaseGoldenSkullCounter = .text:0x802526E0; // type:function size:0xC +increaseGoldenSkullCounter__9dAcItem_cFl = .text:0x802526E0; // type:function size:0xC getGoddesPlumeCount = .text:0x802526F0; // type:function size:0x8 -increaseGoddessPlumeCounter = .text:0x80252700; // type:function size:0xC +increaseGoddessPlumeCounter__9dAcItem_cFl = .text:0x80252700; // type:function size:0xC getGratitudeCrystalCount__9dAcItem_cFv = .text:0x80252710; // type:function size:0x8 -increaseGratitudeCrystalCounter = .text:0x80252720; // type:function size:0xC +increaseGratitudeCrystalCounter__9dAcItem_cFl = .text:0x80252720; // type:function size:0xC ActorLink__hasLifeTreeSeeding = .text:0x80252730; // type:function size:0x38 -AcItem__giveLifeTreeSeedling = .text:0x80252770; // type:function size:0x94 +setLifeTreeSeedlingFlag__9dAcItem_cFl = .text:0x80252770; // type:function size:0x94 getExtraWalletCount__9dAcItem_cFv = .text:0x80252810; // type:function size:0x8 -increaseExtraWalletCounter = .text:0x80252820; // type:function size:0xC +increaseExtraWalletCounter__9dAcItem_cFl = .text:0x80252820; // type:function size:0xC getTotalRequiredKeyPieceCount__9dAcItem_cFv = .text:0x80252830; // type:function size:0x8 hasAllKeyPieces = .text:0x80252840; // type:function size:0x44 AcItem__getDefaultOffset = .text:0x80252890; // type:function size:0xC @@ -13658,8 +13658,8 @@ fn_802528E0 = .text:0x802528E0; // type:function size:0xC fn_802528F0 = .text:0x802528F0; // type:function size:0x6C unsetHaveNoGravity__9dAcItem_cFv = .text:0x80252960; // type:function size:0xC getItemRotateAngle = .text:0x80252970; // type:function size:0x24 -getLightFruitTime = .text:0x802529A0; // type:function size:0x8 -shouldBlinkBeforeDespawn = .text:0x802529B0; // type:function size:0x30 +getLightFruitTime__9dAcItem_cFv = .text:0x802529A0; // type:function size:0x8 +isBlinkBeforeDespawnShown__9dAcItem_cFl = .text:0x802529B0; // type:function size:0x30 AcItem__canBeLinkedToWoodTag = .text:0x802529E0; // type:function size:0x4 AcItem__doDrop = .text:0x802529F0; // type:function size:0x24 fn_80252A20 = .text:0x80252A20; // type:function size:0x8 @@ -13667,7 +13667,7 @@ fn_80252A30 = .text:0x80252A30; // type:function size:0x4 ActorLink__getItemGetBottlePouchSlot = .text:0x80252A40; // type:function size:0x8 fn_80252A50 = .text:0x80252A50; // type:function size:0xC fn_80252A60 = .text:0x80252A60; // type:function size:0xC -AcItem__shouldNotShowModel = .text:0x80252A70; // type:function size:0xC +isMdlHidden__9dAcItem_cCFv = .text:0x80252A70; // type:function size:0xC fn_80252A80 = .text:0x80252A80; // type:function size:0xC fn_80252A90 = .text:0x80252A90; // type:function size:0xC fn_80252AA0 = .text:0x80252AA0; // type:function size:0xC @@ -13679,7 +13679,7 @@ AcItem__setFinalDeterminedItemId = .text:0x80252C70; // type:function size:0x8 getItemInitStructForItem = .text:0x80252C80; // type:function size:0x5C getItemInitStruct__9dAcItem_cCFv = .text:0x80252CE0; // type:function size:0x8 getItemFlagStruct__13dAcItemBase_cFUs = .text:0x80252CF0; // type:function size:0x54 -AcItem__setFlagForItem = .text:0x80252D50; // type:function size:0x34 +setFlagV__9dAcItem_cFv = .text:0x80252D50; // type:function size:0x34 AcItem__checkFlagForItem2 = .text:0x80252D90; // type:function size:0x34 AcItem__setItemFlagBasedOnId = .text:0x80252DD0; // type:function size:0x34 AcItem__getTreasureShift = .text:0x80252E10; // type:function size:0x48 @@ -13690,9 +13690,9 @@ fn_80252F80 = .text:0x80252F80; // type:function size:0x88 fn_80253010 = .text:0x80253010; // type:function size:0x88 fn_802530A0 = .text:0x802530A0; // type:function size:0xFC applyBoundingBox__9dAcItem_cFv = .text:0x802531A0; // type:function size:0x28 -AcItem__performCollection1&2 = .text:0x802531D0; // type:function size:0x34 -AcItem__performCollection1 = .text:0x80253210; // type:function size:0x7E4 -AcItem__performCollection2 = .text:0x80253A00; // type:function size:0x350 +performCollection__9dAcItem_cFv = .text:0x802531D0; // type:function size:0x34 +performCollectionPart1__9dAcItem_cFv = .text:0x80253210; // type:function size:0x7E4 +performCollectionPart2__9dAcItem_cFv = .text:0x80253A00; // type:function size:0x350 fn_80253D50 = .text:0x80253D50; // type:function size:0xC8 fn_80253E20 = .text:0x80253E20; // type:function size:0xC fn_80253E30 = .text:0x80253E30; // type:function size:0x15C @@ -13703,7 +13703,7 @@ AcItem__decideOnGetOrForcedGet = .text:0x80254260; // type:function size:0x80 fn_802542E0 = .text:0x802542E0; // type:function size:0xA4 AcItem__checkAbovePosition = .text:0x80254390; // type:function size:0x78 fn_80254410 = .text:0x80254410; // type:function size:0x34 -AcItem__updateLightingMaybe = .text:0x80254450; // type:function size:0x134 +updateLightingMaybe__9dAcItem_cFv = .text:0x80254450; // type:function size:0x134 fn_80254590 = .text:0x80254590; // type:function size:0xF0 fn_80254680 = .text:0x80254680; // type:function size:0x20 fn_802546A0 = .text:0x802546A0; // type:function size:0x64 @@ -13900,26 +13900,26 @@ isBabyRattle__9dAcItem_cCFv = .text:0x80256C30; // type:function size:0x8 isEldinOre__9dAcItem_cCFv = .text:0x80256C40; // type:function size:0x8 isJellyBlob__9dAcItem_cCFv = .text:0x80256C50; // type:function size:0x8 isAnyRupee__9dAcItem_cCFv = .text:0x80256C60; // type:function size:0x8 -AcItem__isSingleArrowOrBundle = .text:0x80256C70; // type:function size:0x20 +isAnyArrow__9dAcItem_cCFv = .text:0x80256C70; // type:function size:0x20 isInsect__9dAcItem_cCFv = .text:0x80256C90; // type:function size:0x8 isUnkTreasureGroup1__9dAcItem_cCFv = .text:0x80256CA0; // type:function size:0x8 isTreasure3__9dAcItem_cCFv = .text:0x80256CB0; // type:function size:0x8 -AcItem__isKeyPiece3 = .text:0x80256CC0; // type:function size:0x34 -AcItem__is5GratitudeCrystals2 = .text:0x80256D00; // type:function size:0x34 -AcItem__isItemSingleGratitudeCrystal = .text:0x80256D40; // type:function size:0x34 -AcItem__isFairy = .text:0x80256D80; // type:function size:0x34 -AcItem__isBottleFairy = .text:0x80256DC0; // type:function size:0x34 -AcItem__isStarryFirefly3 = .text:0x80256E00; // type:function size:0x34 -AcItem__isTreasureItem = .text:0x80256E40; // type:function size:0x34 +isKeyPieceV__9dAcItem_cCFv = .text:0x80256CC0; // type:function size:0x34 +is5GratitudeCrystals__9dAcItem_cCFv = .text:0x80256D00; // type:function size:0x34 +isGratitudeCrystal__9dAcItem_cCFv = .text:0x80256D40; // type:function size:0x34 +isFairyV__9dAcItem_cCFv = .text:0x80256D80; // type:function size:0x34 +isBottleFairyV__9dAcItem_cCFv = .text:0x80256DC0; // type:function size:0x34 +isStarryFireflyV__9dAcItem_cCFv = .text:0x80256E00; // type:function size:0x34 +isTreasureV__9dAcItem_cCFv = .text:0x80256E40; // type:function size:0x34 fn_80256E80 = .text:0x80256E80; // type:function size:0x68 -AcItem__setSceneflagForItem = .text:0x80256EF0; // type:function size:0x28 +setSceneFlag__9dAcItem_cFv = .text:0x80256EF0; // type:function size:0x28 fn_80256F20 = .text:0x80256F20; // type:function size:0x564 AcItem__setGrabbableByBeetle = .text:0x80257490; // type:function size:0x10 fn_802574A0 = .text:0x802574A0; // type:function size:0x6C -AcItem__setDungeonflagForTear = .text:0x80257510; // type:function size:0x4C +setDungeonFlag__9dAcItem_cFv = .text:0x80257510; // type:function size:0x4C fn_80257560 = .text:0x80257560; // type:function size:0x1A4 fn_80257710 = .text:0x80257710; // type:function size:0x5C -isFirstBitParams2NotSet = .text:0x80257770; // type:function size:0x28 +isFirstBitParams2NotSet__9dAcItem_cFv = .text:0x80257770; // type:function size:0x28 fn_802577A0 = .text:0x802577A0; // type:function size:0x18 fn_802577C0 = .text:0x802577C0; // type:function size:0x8 fn_802577D0 = .text:0x802577D0; // type:function size:0x8 @@ -13928,10 +13928,10 @@ fn_802577F0 = .text:0x802577F0; // type:function size:0x8 fn_80257800 = .text:0x80257800; // type:function size:0x6C fn_80257870 = .text:0x80257870; // type:function size:0x15C fn_802579D0 = .text:0x802579D0; // type:function size:0x40 -fn_80257A10 = .text:0x80257A10; // type:function size:0x68 -fn_80257A80 = .text:0x80257A80; // type:function size:0x3C -fn_80257AC0 = .text:0x80257AC0; // type:function size:0x44 -fn_80257B10 = .text:0x80257B10; // type:function size:0x10 +fn_80257A10__13dAcItem_0xB3CFP9dAcItem_c = .text:0x80257A10; // type:function size:0x68 +fn_80257A80__13dAcItem_0xB3CFv = .text:0x80257A80; // type:function size:0x3C +fn_80257AC0__13dAcItem_0xB3CFv = .text:0x80257AC0; // type:function size:0x44 +fn_80257B10__13dAcItem_0xB3CFv = .text:0x80257B10; // type:function size:0x10 fn_80257B20 = .text:0x80257B20; // type:function size:0x4 fn_80257B30 = .text:0x80257B30; // type:function size:0x4 fn_80257B40 = .text:0x80257B40; // type:function size:0x8 @@ -13964,10 +13964,10 @@ finalizeState__23sFStateID_c<9dAcItem_c>CFR9dAcItem_c = .text:0x80257E50; // typ executeState__23sFStateID_c<9dAcItem_c>CFR9dAcItem_c = .text:0x80257E80; // type:function size:0x30 initializeState__23sFStateID_c<9dAcItem_c>CFR9dAcItem_c = .text:0x80257EB0; // type:function size:0x30 __sinit_\d_a_item_cpp = .text:0x80257EE0; // type:function size:0xDD0 scope:local -fn_80258CB0 = .text:0x80258CB0; // type:function size:0x1C -fn_80258CD0 = .text:0x80258CD0; // type:function size:0x40 -fn_80258D10 = .text:0x80258D10; // type:function size:0x1C -fn_80258D30 = .text:0x80258D30; // type:function size:0x40 +__arraydtor$27711 = .text:0x80258CB0; // type:function size:0x1C +__dt__9TearIdIdxFv = .text:0x80258CD0; // type:function size:0x40 +__arraydtor$28351 = .text:0x80258D10; // type:function size:0x1C +__dt__20TearEffectColorThingFv = .text:0x80258D30; // type:function size:0x40 __dt__23sFStateID_c<9dAcItem_c>Fv = .text:0x80258D70; // type:function size:0x58 isSameName__23sFStateID_c<9dAcItem_c>CFPCc = .text:0x80258DD0; // type:function size:0x88 dAcBomb_c_classInit__Fv = .text:0x80258E60; // type:function size:0x134 @@ -36252,7 +36252,7 @@ lbl_80533278 = .data:0x80533278; // type:object size:0x10 data:string lbl_80533288 = .data:0x80533288; // type:object size:0x13 data:string lbl_8053329C = .data:0x8053329C; // type:object size:0x14 data:string lbl_805332B0 = .data:0x805332B0; // type:object size:0xC data:string -AcItem__TearGetDemoThings = .data:0x805332C0; // type:object size:0x40 +sTearIdxes = .data:0x805332C0; // type:object size:0x40 lbl_80533300 = .data:0x80533300; // type:object size:0xE data:string lbl_80533310 = .data:0x80533310; // type:object size:0x11 data:string g_profile_ITEM = .data:0x80533328; // type:object size:0x10 @@ -36266,7 +36266,7 @@ lbl_80533D70 = .data:0x80533D70; // type:object size:0xC data:4byte jumptable_80533D7C = .data:0x80533D7C; // type:object size:0x90 scope:local lbl_80533E0C = .data:0x80533E0C; // type:object size:0xF data:string jumptable_80533E1C = .data:0x80533E1C; // type:object size:0x90 scope:local -lbl_80533EAC = .data:0x80533EAC; // type:object size:0x34 +lbl_80533EB0 = .data:0x80533EB0; // type:object size:0x30 __vt__9dAcItem_c = .data:0x80533EE0; // type:object size:0x98 __vt__47sFStateMgr_c<9dAcItem_c,20sStateMethodUsr_FI_c> = .data:0x80533F78; // type:object size:0x30 __vt__77sStateMgr_c<9dAcItem_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c> = .data:0x80533FA8; // type:object size:0x30 @@ -41222,7 +41222,7 @@ lbl_8057396C = .sdata:0x8057396C; // type:object size:0x5 data:string lbl_80573974 = .sdata:0x80573974; // type:object size:0x5 data:string lbl_8057397C = .sdata:0x8057397C; // type:object size:0x5 data:string lbl_80573984 = .sdata:0x80573984; // type:object size:0x5 data:string -ITEM_GET_BOTTLE_POUCH_SLOT = .sdata:0x8057398C; // type:object size:0x4 data:4byte +sGetItemPouchSlot__9dAcItem_c = .sdata:0x8057398C; // type:object size:0x4 data:4byte lbl_80573990 = .sdata:0x80573990; // type:object size:0x6 data:string lbl_80573998 = .sdata:0x80573998; // type:object size:0x5 data:string lbl_805739A0 = .sdata:0x805739A0; // type:object size:0x5 data:string @@ -42589,7 +42589,7 @@ lbl_805758B8 = .sbss:0x805758B8; // type:object size:0x4 align:4 data:float lbl_805758BC = .sbss:0x805758BC; // type:object size:0x4 align:4 data:float sItemList__9dAcItem_c = .sbss:0x805758C0; // type:object size:0x8 data:4byte lbl_805758C8 = .sbss:0x805758C8; // type:object size:0x8 data:4byte -NUMBER_OF_ITEMS = .sbss:0x805758D0; // type:object size:0x4 data:4byte +sGetItemQuantity__9dAcItem_c = .sbss:0x805758D0; // type:object size:0x4 data:4byte sIsPerformingInitialCollection__9dAcItem_c = .sbss:0x805758D4; // type:object size:0x1 data:byte TREASURE_TEMP_COLLECT = .sbss:0x805758D8; // type:object size:0x4 data:4byte sCollectionCurrentCount__9dAcItem_c = .sbss:0x805758DC; // type:object size:0x4 data:4byte @@ -52262,7 +52262,7 @@ AcSalbageNpc__STATE_CARRIED = .bss:0x805B2334; // type:object size:0xF4 data:4by lbl_805B2428 = .bss:0x805B2428; // type:object size:0x10 lbl_805B2438 = .bss:0x805B2438; // type:object size:0x6C align:4 data:float lbl_805B24A4 = .bss:0x805B24A4; // type:object size:0xC -TgInsectCaptureMinigame__ACTOR_REF = .bss:0x805B24B0; // type:object size:0x10 data:4byte +sInstance__26dTgMinigameInsectCapture_c = .bss:0x805B24B0; // type:object size:0x10 data:4byte lbl_805B24C0 = .bss:0x805B24C0; // type:object size:0x20 lbl_805B24E0 = .bss:0x805B24E0; // type:object size:0x10 StageMgr__STATE_READ_STAGE_RES = .bss:0x805B24F0; // type:object size:0x40 data:4byte @@ -52362,8 +52362,8 @@ AcItem__DEFAULT_OFFSET = .bss:0x805B4548; // type:object size:0xC align:4 data:f AcItem__ZERO_OFFSET = .bss:0x805B4554; // type:object size:0xC align:4 data:float lbl_805B4560 = .bss:0x805B4560; // type:object size:0xC align:4 data:float lbl_805B456C = .bss:0x805B456C; // type:object size:0x18 align:4 data:float -START_OF_ITEM_LIST = .bss:0x805B4584; // type:object size:0x18 data:4byte -END_OF_ITEM_LIST = .bss:0x805B459C; // type:object size:0x1C data:4byte +sItemListHead__9dAcItem_c = .bss:0x805B4584; // type:object size:0x18 data:4byte +sItemListTail__9dAcItem_c = .bss:0x805B459C; // type:object size:0x1C data:4byte AcItem__STATE_WAIT = .bss:0x805B45B8; // type:object size:0x40 data:4byte AcItem__STATE_CARRY = .bss:0x805B45F8; // type:object size:0x40 data:4byte AcItem__STATE_GET_BEETLE = .bss:0x805B4638; // type:object size:0x40 data:4byte diff --git a/include/d/a/d_a_base.h b/include/d/a/d_a_base.h index 5bfb0c53..f063e4e2 100644 --- a/include/d/a/d_a_base.h +++ b/include/d/a/d_a_base.h @@ -238,7 +238,6 @@ public: void setParams2Upper_ignoreLower(u32 val); int getParams2UpperByte(); void setParams2UpperByte(u32 val); - bool isFirstBitParams2NotSet(); static u32 buildParams2(u32 lower, u32 upper); u32 getParams2Lower() const; u32 getFirstBitParams2() const; diff --git a/include/d/a/d_a_item.h b/include/d/a/d_a_item.h index 98952d59..7928765a 100644 --- a/include/d/a/d_a_item.h +++ b/include/d/a/d_a_item.h @@ -18,7 +18,9 @@ #include "toBeSorted/actor_event.h" #include "toBeSorted/d_emitter.h" #include "toBeSorted/dowsing_target.h" -#include "toBeSorted/item_mdl.h" + +class dItemMdl_c; +class dAcItem_c; class dAcItem_0xB34 { public: @@ -52,6 +54,12 @@ public: virtual void vt_0x14() = 0; virtual void vt_0x18() = 0; + void fn_802579D0(); + bool fn_80257A10(dAcItem_c*); + bool fn_80257A80(); + void fn_80257AC0(); + bool fn_80257B10(); + protected: /* 0x04 */ u8 _0x04[0x08 - 0x04]; }; @@ -95,8 +103,11 @@ public: dAcItem_c(); virtual ~dAcItem_c(); - virtual int create() override; virtual bool createHeap() override; + virtual int create() override; + virtual int doDelete() override; + virtual int actorExecute() override; + virtual int draw() override; virtual u16 getItemIdFromParams() override; virtual void setItemId(u16 id); @@ -136,11 +147,15 @@ public: static s32 getTotalBombCount(); static s32 getTotalArrowCount(); + static s32 getBowArrowCount(); static s32 getTotalSeedCount(); + static s32 getSlingshotSeedCount(); static s32 getTotalBombCapacity(); - static s32 getTotalSeedCapacity(); + static s32 getBowArrowCapacity(); static s32 getTotalArrowCapacity(); + static s32 getTotalSeedCapacity(); + static s32 getSlingshotSeedCapacity(); static s32 getRupeeCounter(); static u32 getCurrentWalletCapacity(); @@ -161,10 +176,13 @@ public: static bool isTreasure2(ITEM_ID item); static bool isTreasure(ITEM_ID item); static bool isTear(ITEM_ID item); + static bool isAnyPouchItem(ITEM_ID item); + static bool isUpgradedPotion(ITEM_ID item); bool isLightFruit() const; bool isSingleArrow() const; bool isArrowBundle() const; + bool isAnyArrow() const; bool isTriforce() const; bool isGratitudeCrystal() const; bool is5GratitudeCrystals() const; @@ -183,10 +201,26 @@ public: bool isHeartPiece() const; bool isTreasure3() const; bool isInsect() const; - bool isHeart2() const; bool isAnyRupee() const; bool isAnyTear() const; bool isBabyRattle() const; + bool is10DekuSeeds() const; + bool isAnyBombs() const; + bool isLifeTreeFruit() const; + bool isBirdStatuette() const; + + // These go through the vtable to retrieve the item id. Can't think of a better name for now + bool isKeyPieceV() const; + bool isHeartV() const; + bool isTreasureV() const; + bool isGratitudeCrystalV() const; + bool is5GratitudeCrystalsV() const; + bool isFairyV() const; + bool isBottleFairyV() const; + bool isStarryFireflyV() const; + bool isAnyRupeeV() const; + + static void increaseRupeeCounter(s32 by); u32 getParams2Lower_shift1_0x7() const; @@ -194,8 +228,6 @@ public: static void itemGetEventStart(dAcBase_c *); static void itemGetEventEnd(dAcBase_c *); - static void addRupees(s32 amount); - static bool hasAnyFairy(); enum Trial_e { @@ -240,6 +272,8 @@ private: static s32 sGetItemQuantity; static const mVec3_c sFreestandingDowsingOffset; + static const mVec3_c sScale1Maybe; + static const mVec3_c sScale2Maybe; typedef bool (dAcItem_c::*sStaticPtmf)(); static const sStaticPtmf sStaticPtmfs[]; @@ -249,10 +283,103 @@ private: static const ItemInitStruct *getItemInitStructForId(u16 itemId); const ItemInitStruct *getItemInitStruct() const; + + static void setTreasureTempCollect(u16 id); + static void setSpawnQuantity(s32 quantity); + static void unsetSpawnQuantity(); + + void setObtainedItemId(u32, bool); + bool checkItemFlagV() const; + void setItemFlagV(); + bool checkFlagV() const; + void setFlagV(); + void setSceneFlag(); + void setDungeonFlag(); + + static void increaseKeyPieceCounter(s32 by); + static void increaseHeartPieceCounter(s32 by); + static void increaseTotalHeartPieceCounter(s32 by); + static void increaseFaronGrasshopperCounter(s32 by); + static s32 getFaronGrasshooperCounter(); + static void increaseWoodlandRhinoBeetleCounter(s32 by); + static s32 getWoodlandRhinoBeetleCounter(); + static void increaseDekuHornetCounter(s32 by); + static s32 getDekuHornetCounter(); + static void increaseSkyloftMantisCounter(s32 by); + static s32 getSkyloftMantisCounter(); + static void increaseVolcanicLadybugCounter(s32 by); + static s32 getVolcanicLadybugCounter(); + static void increaseBlessedButterflyCounter(s32 by); + static s32 getBlessedButterflyCounter(); + static void increaseLanayruAntCounter(s32 by); + static s32 getLanayruAntCounter(); + static void increaseSandCicadaCounter(s32 by); + static s32 getSandCicadaCounter(); + static void increaseGerudoDragonflyCounter(s32 by); + static s32 getGerudoDragonflyCounter(); + static void increaseEldinRollerCounter(s32 by); + static s32 getEldinRollerCounter(); + static void increaseSkyStagBeetleCounter(s32 by); + static s32 getSkyStagBeetleCounter(); + static void increaseStarryFireflyCounter(s32 by); + static s32 getStarryFireflyCounter(); + static void increaseHornetLarvaeCounter(s32 by); + static s32 getHornetLarvaeCounter(); + static void increaseBirdFeatherCounter(s32 by); + static s32 getBirdFeatherCounter(); + static void increaseTumbleWeedCounter(s32 by); + static s32 getTumbleWeedCounter(); + static void increaseLizardTailCounter(s32 by); + static s32 getLizardTailCounter(); + static void increaseEldinOreCounter(s32 by); + static s32 getEldinOreCounter(); + static void increaseAncientFlowerCounter(s32 by); + static s32 getAncientFlowerCounter(); + static void increaseAmberRelicCounter(s32 by); + static s32 getAmberRelicCounter(); + static void increaseDuskRelicCounter(s32 by); + static s32 getDuskRelicCounter(); + static void increaseJellyBlobCounter(s32 by); + static s32 getJellyBlobCounter(); + static void increaseMonsterClawCounter(s32 by); + static s32 getMonsterClawCounter(); + static void increaseMonsterHornCounter(s32 by); + static s32 getMonsterHornCounter(); + static void increaseSkullCounter(s32 by); + static s32 getSkullCounter(); + static void increaseEvilCrystalCounter(s32 by); + static s32 getEvilCrystalCounter(); + static void increaseBlueBirdFeatherCounter(s32 by); + static s32 getBlueBirdFeatherCounter(); + static void increaseGoldenSkullCounter(s32 by); + static s32 getGoldenSkullCounter(); + static void increaseGoddessPlumeCounter(s32 by); + static s32 getGoddessPlumeCounter(); + static void increaseGratitudeCrystalCounter(s32 by); + static s32 getGratitudeCrystalCounter(); + static void increaseExtraWalletCounter(s32 by); + static s32 getExtraWalletCounter(); + static void increaseSmallKeyCounter(s32 by); + static void increaseArrowCounter(s32 by); + static void increaseDekuSeedCounter(s32 by); + static void increaseArrowAndPouchCounter(s32 by); + static void increaseBombAndPouchCounter(s32 by); + static void increaseDekuSeedAndPouchCounter(s32 by); + static void increaseExtraPouchCounter(s32 by); + + static void increaseHealthCapacity(s32 by); + static void setLifeTreeSeedlingFlag(s32 by); + + static s32 getLightFruitTime(); + static s32 getNumRemainingHeartPiecesForNextHeart(); + static void doFullHeal(); + static void restoreStamina(); + bool isItemDropFromEnemy() const; static u16 determineActualItemIdFromItem(u16); u16 getItemId2() const; static s32 getSubtypeFromParam(u32 params); + bool isFirstBitParams2NotSet(); void setupUnkColliderFlags2(); static bool hitCallback(dAcObjBase_c *i_actorA, cCcD_Obj *i_objInfA, dAcObjBase_c *i_actorB, cCcD_Obj *i_objInfB); void fn_80253F90(bool); @@ -265,11 +392,15 @@ private: void applyBoundingBox(); s32 getTearIdx(); void setFreestandingYOffset(f32); - void fn_8024DF30(u32 flags); + void setFramesInAir(u32 numFrames); + void unsetFramesInAir(); + void incrementFramesInAir(); + void setItemFlags(u32 flags); bool fn_80255CF0(); bool fn_802574A0(); void addToGetQueue(); + void removeFromGetQueue(); static bool fn_8024A230(); void unsetHaveNoGravity(); void fn_80252A80(); @@ -281,9 +412,56 @@ private: bool fn_80255C50(u32 specialCode); bool fn_80255CA0(u32 specialCode); void getCurrentModelScale(f32 *scale); + f32 getCurrentScale(); + void fn_802518C0(mVec3_c *out); void makeLinkLookTowardItem(); void fn_80254CA0(); + void fn_802546A0(); + void fn_80254710(); + void fn_80254790(); + + bool checkAbovePosition(); + + bool isMdlHidden() const; + static bool isBlinkBeforeDespawnShown(s32 timer); + + void performCollection(); + void performCollectionPart1(); + void performCollectionPart2(); + + void fn_80254BC0(); + void fn_80255B10(); + void updateLightingMaybe(); + + void fn_80253E20(); + void fn_80254BA0(); + + void setNotWaiting(); + void fn_802548A0(); + void decideOnGetOrForcedGet(); + + void fn_80256710(mVec3_c &); + void fn_80257560(const mVec3_c &); + void fn_80254D10(); + bool fn_80254D70(); + void fn_802542E0(); + + static bool fn_80247BB0(); + bool checkShouldDemo(); + bool fn_80254EC0(); + void addGetEvent(); + void fn_80254590(mVec3_c &); + void fn_80254680(); + void fn_80254810(); + static s16 getItemRotateAngle(); + + static void getItemGetEventName(u16 id, char *const *name); + + // Could also return vector + static void fn_80247540(mVec3_c &); + void fn_80247560(const mVec3_c &); + // static PTMF callbacks bool fn_80248020(); bool fn_80248010(); @@ -314,7 +492,7 @@ private: f32 getTreasure3Scale(); f32 getInsectScale(); f32 getDefaultScale(); - + f32 getHighValueRupeePickupScale(); f32 getDefaultPickupScale(); @@ -487,6 +665,9 @@ private: f32 fn_802577C0(); f32 fn_802577D0(); + void fn_80255E80(); + void fn_80255F40(); + /* 0x334 */ dItemMdl_c *mpMdl; /* 0x338 */ dShadowCircle_c mShdw; /* 0x340 */ mVec3_c field_0x340; @@ -542,7 +723,7 @@ private: /* 0xC78 */ f32 (dAcItem_c::*mFnGetHitKnockback3)(); /* 0xC84 */ f32 (dAcItem_c::*mFnGetHitKnockbackRand3)(); /* 0xC90 */ f32 (dAcItem_c::*mFn_0xC90)(); - /* 0xC9C */ UNKTYPE (dAcItem_c::*mFunc_0xC9C)(UNKTYPE); + /* 0xC9C */ void (dAcItem_c::*mFn_0xC9C)(); /* 0xCA8 */ void (dAcItem_c::*mFnSetBoundingBox)(); /* 0xCB4 */ f32 (dAcItem_c::*mFn_0xCB4)(void); /* 0xCC0 */ dAcRef_c mItemQueuePrev; @@ -556,18 +737,22 @@ private: /* 0xCF0 */ u8 _CF0[0xD00 - 0xCF0]; /* 0xD00 */ f32 field_0xD00; /* 0xD04 */ f32 field_0xD04; - /* 0xD08 */ u8 _D08[0xD14 - 0xD08]; + /* 0xD08 */ u8 _D08[0xD0C - 0xD08]; + /* 0xD0C */ f32 field_0xD0C; + /* 0xD10 */ u8 _D10[0xD14 - 0xD10]; /* 0xD14 */ f32 mFreestandingOffsetH; /* 0xD18 */ f32 field_0xD18; /* 0xD1C */ s32 mGetItemPouchSlot; /* 0xD20 */ s32 field_0xD20; /* 0xD24 */ u8 _D24[0xD2C - 0xD24]; /* 0xD2C */ u32 mFramesInAir; - /* 0xD30 */ s32 mItemQuantity; + /* 0xD30 */ u32 mItemQuantity; /* 0xD34 */ u32 mItemFlags; - /* 0xD38 */ mAng3_c field_0xD38; + /* 0xD38 */ s16 field_0xD38; + /* 0xD3A */ s16 field_0xD3A; + /* 0xD3C */ s16 field_0xD3C; /* 0xD3E */ u16 field_0xD3E; - /* 0xD40 */ mAng mMdlRotY; + /* 0xD40 */ s16 mMdlRotY; /* 0xD42 */ s16 field_0xD42; /* 0xD44 */ u16 mRealItemId; /* 0xD46 */ u16 mDespawnTimer; diff --git a/include/d/a/d_a_itembase.h b/include/d/a/d_a_itembase.h index 23f64926..d0f29f23 100644 --- a/include/d/a/d_a_itembase.h +++ b/include/d/a/d_a_itembase.h @@ -243,7 +243,7 @@ class dAcItemBase_c : public dAcObjBase_c { public: dAcItemBase_c() {} virtual ~dAcItemBase_c() {} - virtual u16 getItemId(); + virtual u16 getItemId() const; virtual u16 getItemIdFromParams() = 0; static bool isValidItemTypeIdx(int itemId); diff --git a/include/d/a/obj/d_a_obj_warp.h b/include/d/a/obj/d_a_obj_warp.h index 33bb80de..ccba8330 100644 --- a/include/d/a/obj/d_a_obj_warp.h +++ b/include/d/a/obj/d_a_obj_warp.h @@ -63,9 +63,16 @@ public: || isLanayruTrialAndCompleted() || isHyliaTrialAndCompleted(); } + + void onCollectFirstTear() { + mFirstTearCollected = true; + } + private: - /* 0x330 */ u8 field_0x330[0xC66-0x330]; + /* 0x330 */ u8 field_0x330[0xC66 - 0x330]; /* 0xC66 */ u8 mTrialIndexBitmask; + /* 0xC67 */ u8 field_0xC67[0xC8D - 0xC67]; + /* 0xC8D */ bool mFirstTearCollected; /* 0x??? */ STATE_MGR_DECLARE(dAcOWarp_c); }; diff --git a/include/d/d_pouch.h b/include/d/d_pouch.h index 6ef2f808..3b3ae555 100644 --- a/include/d/d_pouch.h +++ b/include/d/d_pouch.h @@ -29,4 +29,7 @@ void sortStock(); u16 itemCheckFindItemSlot(ITEM_ID item); +void collectPouchItem(u16 id); +void collectPouchItemIntoSlot(s32 slot, u16 id, u32, bool); + #endif diff --git a/include/d/t/d_t_minigame_insect_capture.h b/include/d/t/d_t_minigame_insect_capture.h index c905809e..a634ce63 100644 --- a/include/d/t/d_t_minigame_insect_capture.h +++ b/include/d/t/d_t_minigame_insect_capture.h @@ -1,6 +1,7 @@ #ifndef D_T_MINIGAME_INSECT_CAPTURE_H #define D_T_MINIGAME_INSECT_CAPTURE_H +#include "d/a/d_a_base.h" #include "d/t/d_tg.h" class dTgMinigameInsectCapture_c : public dTg_c { @@ -8,7 +9,14 @@ public: dTgMinigameInsectCapture_c(); virtual ~dTgMinigameInsectCapture_c(); + static dTgMinigameInsectCapture_c *GetInstance() { + return sInstance.get(); + } + + void recordCollectedInsect(s32 id, s32 count); + private: + static dAcRef_c sInstance; }; #endif diff --git a/include/d/t/d_t_siren.h b/include/d/t/d_t_siren.h index 77456fa7..9cda9b7e 100644 --- a/include/d/t/d_t_siren.h +++ b/include/d/t/d_t_siren.h @@ -31,12 +31,21 @@ public: return sInstance->_hasCollectedAllTears(); } + static void setLightFruitTime(u16 time) { + if (sInstance == nullptr) { + return; + } + sInstance->mPillarTime = time; + } + private: bool outOfTime() const; bool _hasCollectedAllTears(); static dTgSiren_c *sInstance; - /* 0x0FC */ u8 _0x0FC[0x2C0 - 0x0FC]; + /* 0x0FC */ u8 _0x0FC[0x140 - 0x0FC]; + /* 0x140 */ u32 mPillarTime; + /* 0x144 */ u8 _0x144[0x2C0 - 0x144]; /* 0x2C0 */ Timekeeper mTimekeeper; }; diff --git a/src/d/a/d_a_item.cpp b/src/d/a/d_a_item.cpp index 4301c64a..ec833cfb 100644 --- a/src/d/a/d_a_item.cpp +++ b/src/d/a/d_a_item.cpp @@ -4,34 +4,36 @@ #include "common.h" #include "d/a/d_a_itembase.h" #include "d/a/d_a_player.h" +#include "d/a/npc/d_a_npc_talk_kensei.h" +#include "d/a/obj/d_a_obj_boomerang.h" +#include "d/a/obj/d_a_obj_warp.h" #include "d/col/bg/d_bg_s.h" -#include "d/col/bg/d_bg_s_gnd_chk.h" -#include "d/col/bg/d_bg_s_roof_chk.h" #include "d/col/cc/d_cc_d.h" #include "d/col/cc/d_cc_s.h" #include "d/d_camera.h" #include "d/d_linkage.h" +#include "d/d_player.h" #include "d/d_pouch.h" #include "d/d_sc_game.h" #include "d/flag/dungeonflag_manager.h" +#include "d/flag/itemflag_manager.h" #include "d/flag/sceneflag_manager.h" #include "d/flag/storyflag_manager.h" #include "d/snd/d_snd_small_effect_mgr.h" #include "d/snd/d_snd_wzsound.h" #include "d/t/d_t_force_get_flag.h" -#include "f/f_list_mg.h" -#include "f/f_profile_name.h" +#include "d/t/d_t_minigame_insect_capture.h" +#include "d/t/d_t_siren.h" #include "m/m_vec.h" -#include "s/s_Math.h" -#include "toBeSorted/d_emitter.h" -#include "toBeSorted/dowsing_target.h" #include "toBeSorted/event_manager.h" #include "toBeSorted/file_manager.h" +#include "toBeSorted/item_mdl.h" #include "toBeSorted/item_mdl_item.h" #include "toBeSorted/item_mdl_light_fruit.h" #include "toBeSorted/item_mdl_misc.h" #include "toBeSorted/item_mdl_rupee.h" #include "toBeSorted/item_mdl_stamina_fruit.h" +#include "toBeSorted/minigame_mgr.h" const ItemFlagStruct dAcItemBase_c::sDefaultFlagStruct = {0x28, 0x3C, 0x1E, 0xFF, 0x0000, 0x02, 0x01}; const ItemFlagStruct dAcItemBase_c::sItemFlagStructs[167] = { @@ -263,30 +265,6 @@ static const dCcD_SrcCyl sSrcCyl = { {40.0f, 60.0f} }; -static const char *const sResNodeName = "Set"; -/* static */ extern const char *const sDefaultGetItem = "DefaultGetItem"; -/* static */ extern const char *const sItemGetGorgeous = "ItemGetGorgeous"; -/* static */ extern const char *const sItemGetDefaultTbox = "ItemGetDefaultTBox"; -/* static */ extern const char *const sItemGetGorgeousTbox = "ItemGetGorgeousTBox"; -/* static */ extern const char *const sItemGetBird = "ItemGetBird"; - -struct TearIdIdx { - s32 idx; - u16 itemId; - u32 _0x04; - u32 _0x08; -}; - -/* static */ extern "C" TearIdIdx sTearIdxes[] = { - {0, ITEM_FARORE_TEAR}, - {1, ITEM_DIN_TEAR}, - {2, ITEM_NAYRU_TEAR}, - {3, ITEM_SACRED_TEAR}, -}; - -/* static */ extern const char *const sGetFairyBody = "GetFairy_body"; -/* static */ extern const char *const sBottleFairy_body = "BottleFairy_body"; - bool dAcItemBase_c::isValidItemTypeIdx(int itemId) { return itemId < ARRAY_LENGTH(sItemTypeFlags); } @@ -347,7 +325,16 @@ bool dAcItemBase_c::setDungeonFlagForTear(int tearNum) { return true; } -u16 dAcItemBase_c::getItemId() { +// This might be a cM::calcTimer thing... +bool increment(u32 *value) { + if (*value < UINT32_MAX) { + (*value)++; + return true; + } + return false; +} + +u16 dAcItemBase_c::getItemId() const { return mId; } @@ -370,11 +357,58 @@ u16 getIndex(u16 itemId) { // } // } -fLiMgBa_c dAcItem_c::sItemList; - -SPECIAL_ACTOR_PROFILE(ITEM, dAcItem_c, fProfile::ITEM, 0x2B, 0, 2); +static const char *const sResNodeName = "Set"; +/* static */ extern const char *const sDefaultGetItem = "DefaultGetItem"; +/* static */ extern const char *const sItemGetGorgeous = "ItemGetGorgeous"; +/* static */ extern const char *const sItemGetDefaultTbox = "ItemGetDefaultTBox"; +/* static */ extern const char *const sItemGetGorgeousTbox = "ItemGetGorgeousTBox"; +/* static */ extern const char *const sItemGetBird = "ItemGetBird"; const mVec3_c dAcItem_c::sFreestandingDowsingOffset(0.0f, 25.0f, 0.0f); +const mVec3_c dAcItem_c::sScale1Maybe(1.0f, 1.0f, 1.0f); +const mVec3_c dAcItem_c::sScale2Maybe(1.75f, 1.75f, 1.75f); + +struct TearIdIdx { + s32 idx; + u16 itemId; + mColor color1; + mColor color2; +}; + +/* static */ extern "C" TearIdIdx sTearIdxes[] = { + {0, ITEM_FARORE_TEAR, mColor(0x00, 0x80, 0x30, 0xFF), mColor(0xFF, 0xFF, 0xFF, 0xFF)}, + {1, ITEM_DIN_TEAR, mColor(0xFF, 0x64, 0x80, 0xFF), mColor(0xFF, 0xFF, 0xFF, 0xFF)}, + {2, ITEM_NAYRU_TEAR, mColor(0x80, 0x80, 0x00, 0xFF), mColor(0xFF, 0xFF, 0xFF, 0xFF)}, + {3, ITEM_SACRED_TEAR, mColor(0x00, 0x64, 0xC8, 0xFF), mColor(0xFF, 0xFF, 0xFF, 0xFF)}, +}; + +struct TearEffectColorThing { + mColor color1; + mColor color2; + mColor color3; + mColor color4; + mColor color5; + mColor color6; +}; + +extern "C" TearEffectColorThing sTearEffectColors[] = { + {mColor(0x80, 0xFF, 0x80, 0xFF), mColor(0x00, 0xFF, 0x40, 0xFF), mColor(0xC8, 0xFF, 0xC8, 0xFF), + mColor(0x40, 0xFF, 0x40, 0xFF), mColor(0x40, 0xFF, 0x60, 0xFF), mColor(0x00, 0xFF, 0x40, 0xFF)}, + + {mColor(0xFF, 0x80, 0xA0, 0xFF), mColor(0xFF, 0x40, 0x80, 0xFF), mColor(0xFF, 0xC8, 0xC8, 0xFF), + mColor(0xFF, 0x40, 0x80, 0xFF), mColor(0xFF, 0x60, 0x80, 0xFF), mColor(0xFF, 0x00, 0x40, 0xFF)}, + + {mColor(0xFF, 0xFF, 0x80, 0xFF), mColor(0xFF, 0xFF, 0x00, 0xFF), mColor(0xFF, 0xFF, 0xC8, 0xFF), + mColor(0xFF, 0xFF, 0x40, 0xFF), mColor(0xFF, 0xFF, 0xFF, 0xFF), mColor(0xFF, 0xFF, 0xFF, 0xFF)}, + + {mColor(0x80, 0xFF, 0xFF, 0xFF), mColor(0x00, 0x80, 0xFF, 0xFF), mColor(0xC8, 0xC8, 0xFF, 0xFF), + mColor(0x40, 0xA0, 0xFF, 0xFF), mColor(0xFF, 0xFF, 0xFF, 0xFF), mColor(0xFF, 0xFF, 0xFF, 0xFF)}, +}; + +/* static */ extern const char *const sGetFairyBody = "GetFairy_body"; +/* static */ extern const char *const sBottleFairy_body = "BottleFairy_body"; + +SPECIAL_ACTOR_PROFILE(ITEM, dAcItem_c, fProfile::ITEM, 0x2B, 0, 2); const dAcItem_c::sStaticPtmf dAcItem_c::sStaticPtmfs[] = { &dAcItem_c::fn_80248020, nullptr, @@ -385,6 +419,10 @@ const dAcItem_c::sStaticPtmf dAcItem_c::sStaticPtmfs[] = { &dAcItem_c::fn_80255BD0, &dAcItem_c::fn_80255C40, }; +fLiMgBa_c dAcItem_c::sItemList; +dAcRef_c dAcItem_c::sItemListHead; +dAcRef_c dAcItem_c::sItemListTail; + dAcItem_c::dAcItem_c() : mStateMgr(*this), mEff_0x8F4(this), @@ -584,7 +622,7 @@ int dAcItem_c::create() { default: return FAILED; } - if (isHeart2()) { + if (isHeartV()) { mFunc_0xB58 = &dAcItem_c::fn_802555F0; } else { mFunc_0xB58 = &dAcItem_c::fn_802555D0; @@ -592,7 +630,7 @@ int dAcItem_c::create() { if (isAnyRupee()) { mFnBounce = &dAcItem_c::bounceRupee; - } else if (isHeart2()) { + } else if (isHeartV()) { mFnBounce = &dAcItem_c::bounceNone; } else { mFnBounce = &dAcItem_c::bounceNormal; @@ -661,7 +699,7 @@ int dAcItem_c::create() { mCyl.SetTg_0x4C(0x6CC0); } else if (isBabyRattle()) { mCyl.SetTg_0x4C(0x6480); - } else if (!isAnyRupee() && !isHeart2() && mId != ITEM_STAMINA_FRUIT) { + } else if (!isAnyRupee() && !isHeartV() && mId != ITEM_STAMINA_FRUIT) { mCyl.SetTg_0x4C(0x6480); } @@ -669,7 +707,7 @@ int dAcItem_c::create() { mCyl.SetTgInfo_0x1(0x13); } else if (isHeartPiece()) { mCyl.SetTgInfo_0x1(0x15); - } else if (!isAnyRupee() && !isHeart2() && mId != ITEM_STAMINA_FRUIT) { + } else if (!isAnyRupee() && !isHeartV() && mId != ITEM_STAMINA_FRUIT) { mCyl.SetTgInfo_0x1(0x13); } @@ -927,7 +965,7 @@ int dAcItem_c::create() { default: mFnGetHitKnockbackRand3 = nullptr; break; } - if (isHeart2()) { + if (isHeartV()) { mFn_0xCB4 = &dAcItem_c::fn_802577C0; } else { mFn_0xCB4 = &dAcItem_c::fn_802577D0; @@ -935,11 +973,11 @@ int dAcItem_c::create() { if (mbNoDespawn) { dBgS::GetInstance()->SetLightingCode(this, 10.0f); - } else if (isHeart2()) { + } else if (isHeartV()) { mLinkage.bushTpFunc(mObjAcch); } - if (isHeart2()) { + if (isHeartV()) { field_0xD20 = 6; } @@ -1006,7 +1044,7 @@ int dAcItem_c::create() { } if (EventManager::isInEvent() && EventManager::isCurrentEvent("GetGenkiItem")) { - fn_8024DF30(mItemFlags | 0x20); + setItemFlags(mItemFlags | 0x20); } // okay @@ -1019,7 +1057,7 @@ int dAcItem_c::create() { } if (is) { // Skyview Temple - Heart Piece behind bars in main room - fn_8024DF30(mItemFlags | 0x80); + setItemFlags(mItemFlags | 0x80); } field_0xD48 = cM::rndInt(0x10000); @@ -1031,10 +1069,251 @@ int dAcItem_c::create() { return SUCCEEDED; } -void dAcItem_c::initializeState_Wait() {} +int dAcItem_c::doDelete() { + sItemList.remove(&this->mNode); + dAcItem_c *prev = mItemQueuePrev.get(); + dAcItem_c *next = mItemQueueNext.get(); + + if (prev == nullptr) { + if (next == nullptr) { + if (this == sItemListHead.get()) { + sItemListHead.unlink(); + } + if (this == sItemListTail.get()) { + sItemListTail.unlink(); + } + } else { + sItemListHead.link(next); + next->mItemQueuePrev.unlink(); + } + } else if (next == nullptr) { + sItemListTail.link(prev); + prev->mItemQueueNext.unlink(); + } else { + prev->mItemQueueNext.link(next); + next->mItemQueuePrev.link(prev); + } + + return SUCCEEDED; +} + +int dAcItem_c::actorExecute() { + if (!checkActorProperty(AC_PROP_0x10000000)) { + if (mId == ITEM_STAMINA_FRUIT) { + if (isFirstBitParams2NotSet() && !fn_802577A0()) { + field_0xCD8 = 0.0f; + } else { + field_0xCD8 = 1.0f; + } + } else if (isLightFruit()) { + if ((this->*mFnAction4)()) { + field_0xCD8 = 1.0f; + } else { + field_0xCD8 = 0.0f; + } + } + + dAcOScatterSand *ac = + static_cast(fManager_c::searchBaseByProfName(fProfile::OBJ_VSD, nullptr)); + bool keepGoing = true; + while (keepGoing && ac != nullptr) { + if (mPosition.squareDistance(ac->mPosition) < 90000.0f) { + mCoveredSand.link(ac); + keepGoing = false; + } else { + ac = static_cast(fManager_c::searchBaseByProfName(fProfile::OBJ_VSD, ac)); + } + } + } + + if (field_0xD4C < 0xFF) { + field_0xD4C++; + } + + fn_80254BC0(); + fn_80255B10(); + + field_0xD5C = 0; + field_0xD66 = 0; + + mStateMgr.executeState(); + + updateLightingMaybe(); + if (mDespawnTimer == 0) { + deleteRequest(); + return SUCCEEDED; + } + + if ((mItemFlags & 0x8) != 0) { + deleteRequest(); + return SUCCEEDED; + } + + mRotation.y += field_0xD38; + f32 scaleF = getCurrentScale(); + mScale.set(scaleF, scaleF, scaleF); + mVec3_c tmp1; + fn_802518C0(&tmp1); + mPositionCopy2.set(tmp1); + mVec3_c tmp2; + fn_802518C0(&tmp2); + mPositionCopy3.set(tmp2); + + mLinkage.fn_800511E0(this); + + if (!checkObjectProperty(OBJ_PROP_0x200)) { + mMtx_c mtx = mWorldMtx; + mtx.YrotM(mMdlRotY); + mtx.ZrotM(field_0xD42); + + if (isGratitudeCrystal() || isUnkTreasureGroup1()) { + if (mStateMgr.isState(StateID_Wait) || mStateMgr.isState(StateID_Carry)) { + f32 off = mFreestandingOffsetH; + f32 sc = getCurrentScale(); + mtx.m[1][3] += sc * off; + } + } else if (isInsect()) { + if (mStateMgr.isState(StateID_Get)) { + mtx.YrotM(-0x2000); + } + } + + mpMdl->setLocalMtx(mtx); + mpMdl->setScale(mScale); + + if (isFairyV() || isBottleFairyV()) { + m3d::smdl_c *mdl = mpMdl->getMdl(); + if (mdl != nullptr) { + mdl->calc(false); + } + } + } + + field_0xD51 = 0; + mCyl.ClrTgHit(); + mCyl.ClrCoHit(); + field_0xD65 = 0; + if ((isAnyRupeeV() || mId == ITEM_STAMINA_FRUIT) && field_0xD66 && mObjAcch.ChkGroundLanding()) { + dJEffManager_c::spawnGroundEffect(mPosition, mPolyAttr0, mPolyAttr1, field_0x1B4, 1, 0.7f, field_0x1B0); + } + + if (isStarryFireflyV() && !checkObjectProperty(OBJ_PROP_0x200)) { + fn_802546A0(); + } + + if (isFairyV() && !checkObjectProperty(OBJ_PROP_0x200)) { + fn_80254710(); + } + + if (isBottleFairyV() && !checkObjectProperty(OBJ_PROP_0x200)) { + fn_80254790(); + } + + if (checkAbovePosition()) { + mItemFlags |= 0x10; + f32 f = mPosition.y - dBgS_ObjGndChk::GetGroundHeight(); + field_0xD18 = f < 0.0f ? 0.0f : f; + } else { + mItemFlags &= ~0x10; + } + + applyBoundingBox(); + + bool tmp = 0.0f < field_0xD04; + if (tmp || mStateMgr.isState(StateID_WaitGetDemo) || mStateMgr.isState(StateID_Get) || + mStateMgr.isState(StateID_GetBeetle)) { + setActorProperty(AC_PROP_0x4); + } else { + unsetActorProperty(AC_PROP_0x4); + } + + return SUCCEEDED; +} + +int dAcItem_c::draw() { + if (mMdlScaleType == 2 || 0.0f < field_0xCD8) { + bool shouldDraw = true; + if (isMdlHidden()) { + shouldDraw = false; + } else if ((mStateMgr.isState(StateID_Wait) || mStateMgr.isState(StateID_Carry)) && mbIsWaiting) { + shouldDraw = isBlinkBeforeDespawnShown(mDespawnTimer); + } + if (shouldDraw) { + mpMdl->draw(); + } + + if (mLinkage.checkConnection(dLinkage_c::CONNECTION_9) || + (mId == ITEM_STAMINA_FRUIT && getParams2Lower_shift1_0x7()) || isLightFruit() || (mItemFlags & 0x10) == 0) { + /* nothing */ + } else if (mMdlScaleType == 2) { + mQuat_c v(mVec3_c(0.0f, 0.0f, 0.0f), getItemFlagStruct(getItemId())->field_0x02); + drawShadow(mShdw, nullptr, mWorldMtx, &v, -1, -1, -1, -1, -1, field_0xD18); + } else { + mQuat_c v( + mVec3_c(0.0f, field_0xCD8 * 0.5f * getItemFlagStruct(getItemId())->field_0x01, 0.0f), + field_0xCD8 * getItemFlagStruct(getItemId())->field_0x02 + ); + drawShadow(mShdw, nullptr, mWorldMtx, &v, -1, -1, -1, -1, -1, field_0xD18); + } + } + return SUCCEEDED; +} + +void dAcItem_c::setSpawnQuantity(s32 quantity) { + sGetItemQuantity = quantity; +} + +void dAcItem_c::setFreestandingYOffset(f32 off) { + mFreestandingOffsetH = off; +} + +void dAcItem_c::setFramesInAir(u32 numFrames) { + mFramesInAir = numFrames; +} + +void dAcItem_c::setItemFlags(u32 flags) { + mItemFlags = flags; +} + +bool dAcItem_c::isItemDropFromEnemy() const { + return mObjID != 0xFFFF; +} + +void dAcItem_c::unsetSpawnQuantity() { + sGetItemQuantity = 0; +} + +void dAcItem_c::unsetFramesInAir() { + setFramesInAir(0); +} + +void dAcItem_c::incrementFramesInAir() { + u32 v = mFramesInAir; + increment(&v); + setFramesInAir(v); +} + +void dAcItem_c::initializeState_Wait() { + if (mbNoGravity) { + setActorProperty(AC_PROP_0x1); + mSpeed = 0.0f; + mVelocity.y = 0.0f; + } + mpMdl->vt_0x10(dItemMdl_c::ITEM_MDL_UNK0x14_1); + field_0xD5B = 0; + field_0xD38 = field_0xD3A = field_0xD3C = 0; + fn_80253E20(); + if (mbNoGravity) { + mObjAcch.SetMoveBGOnly(); + } + mMdlScaleType = 0; + field_0xD00 = 0.0f; + mYOffset = 0.0f; +} + void dAcItem_c::executeState_Wait() { bool isFixedPosition; - + bool tmp = false; mVec3_c topPos = getPosition() + mVec3_c::Ey * mCyl.GetH(); bool chk = dBgS_ObjRoofChk::CheckPos(&getPosition()); @@ -1194,9 +1473,9 @@ void dAcItem_c::executeState_Wait() { if (mId == ITEM_STAMINA_FRUIT) { if (isFirstBitParams2NotSet() && !fn_802577A0()) { - sLib::chase(&field_0xCD8, 1.0f, 0.05f); - } else { sLib::chase(&field_0xCD8, 0.0f, 0.05f); + } else { + sLib::chase(&field_0xCD8, 1.0f, 0.05f); } } else if (isLightFruit()) { if ((this->*mFnAction4)()) { @@ -1209,8 +1488,8 @@ void dAcItem_c::executeState_Wait() { bool tgHitArrow = tgHit && mCyl.ChkTgAtHitType(AT_TYPE_ARROW); bool tgHitClawshot = tgHit && mCyl.ChkTgAtHitType(AT_TYPE_CLAWSHOT); if (mbNoGravity && tgHit && - ((isAnyRupee() && tgHitArrow) || (isHeart2() && mCyl.ChkTgAtHitType(AT_TYPE_BELLOWS)) || - ((isAnyRupee() || isHeart2()) && + ((isAnyRupee() && tgHitArrow) || (isHeartV() && mCyl.ChkTgAtHitType(AT_TYPE_BELLOWS)) || + ((isAnyRupee() || isHeartV()) && (mCyl.ChkTgAtHitType(AT_TYPE_SLINGSHOT) || mCyl.ChkTgAtHitType(AT_TYPE_CLAWSHOT))) || mCyl.ChkTgAtHitType(AT_TYPE_BOMB) || mCyl.ChkTgAtHitType(AT_TYPE_0x800000))) { unsetHaveNoGravity(); @@ -1261,7 +1540,7 @@ void dAcItem_c::executeState_Wait() { case 1: mAcceleration = (this->*mFnGetRupeeGravity)(); break; case 2: mAcceleration = (this->*mFnGetGravity1)(); break; } - } else if (isHeart2()) { + } else if (isHeartV()) { if (field_0xD52) { if (mFnGetHeartGravity != nullptr) { mAcceleration = (this->*mFnGetHeartGravity)(); @@ -1331,20 +1610,19 @@ void dAcItem_c::executeState_Wait() { /* This Function keeps Triforce postion locked 8024edbc */ if (isTriforce()) { - // TODO f32 factor = field_0xD48.sin(); mPosition = mPositionCopy + mVec3_c::Ey * (factor * 16.0f); field_0xD48.mVal += 182; } - if ((mItemFlags & 0x4) != 0 && 3000.0f < mPositionCopy.y - mPosition.y) { + if ((mItemFlags & 0x4) != 0 && 3000.0f < mPositionCopy.y - mPosition.y) { mItemFlags |= 0x8; } if ((mItemFlags & 0x8) == 0) { (this->*mFnAction3)(); - if (isAnyRupee() && field_0xD38.y > 0) { - holdSoundWithIntParam(SE_O_RUPEE_ROULETTE, field_0xD38.y); + if (isAnyRupee() && field_0xD3A > 0) { + holdSoundWithIntParam(SE_O_RUPEE_ROULETTE, field_0xD3A); } if (!field_0xD51) { @@ -1377,7 +1655,9 @@ void dAcItem_c::executeState_Wait() { dir *= -40.0f; // TODO - for some reason the argument vector is at an entirely wrong stack position... // Fixing this wil probably fix the rest of the stack position issues in this function. - mEff_0x928.holdEffect(PARTICLE_RESOURCE_ID_MAPPING_821_, offsetPos + dir, nullptr, &scale, nullptr, nullptr); + mEff_0x928.holdEffect( + PARTICLE_RESOURCE_ID_MAPPING_821_, offsetPos + dir, nullptr, &scale, nullptr, nullptr + ); } makeLinkLookTowardItem(); if (!mbNoDespawn && !isItemSmallKeyOrHeartPieceOrStaminaFruit()) { @@ -1385,50 +1665,459 @@ void dAcItem_c::executeState_Wait() { } } } -void dAcItem_c::finalizeState_Wait() {} -void dAcItem_c::initializeState_Carry() {} -void dAcItem_c::executeState_Carry() {} -void dAcItem_c::finalizeState_Carry() {} +void dAcItem_c::finalizeState_Wait() { + unsetActorProperty(AC_PROP_0x1); + mObjAcch.SetRoofNone(); + mObjAcch.Clr_0x2000000(); + field_0xD00 = 0.0f; + mYOffset = 0.0f; + if (isTriforce() && mEff_0x928.hasEmitters()) { + mEff_0x928.remove(true); + } +} + +void dAcItem_c::initializeState_Carry() { + mpMdl->vt_0x10(dItemMdl_c::ITEM_MDL_UNK0x14_1); + mSpeed = 0.0f; + mVelocity.y = 0.0f; + unsetHaveNoGravity(); + field_0xD38 = field_0xD3A = field_0xD3C = 0; + mCyl.OnTgSet(); + mCyl.ClrCoSet(); + fn_80254BA0(); + field_0xD4A = 0; + mMdlScaleType = 0; +} + +void dAcItem_c::executeState_Carry() { + if (!mbNoDespawn && !isItemSmallKeyOrHeartPieceOrStaminaFruit() && !mbIsWaiting && + mLinkage.checkConnection(dLinkage_c::CONNECTION_8)) { + fn_80254CA0(); + } + tickDespawnTimer(); + if (mDespawnTimer == 0) { + return; + } + + if (fn_802574A0()) { + // TODO weird double load + dAcPy_c *link = dAcPy_c::GetLinkM(); + if (!link->vt_0x1C0()) { + addToGetQueue(); + if (link->ifHasHealthAndSomethingElse() && this == sItemListHead.get() && + FileManager::sInstance->getCurrentHealth() != 0) { + mStateMgr.changeState(StateID_Get); + } else { + mStateMgr.changeState(StateID_WaitGet); + } + } else { + mStateMgr.changeState(StateID_GetBeetle); + } + } else if (!mLinkage.checkState(dLinkage_c::STATE_ACTIVE)) { + mStateMgr.changeState(StateID_Wait); + } else if (mLinkage.checkConnection(dLinkage_c::CONNECTION_9) && mCyl.ChkTgHit() && + !mCyl.ChkTgAtHitType(AT_TYPE_WHIP)) { + mLinkage.fn_80050EA0(this); + mStateMgr.changeState(StateID_Wait); + } else { + fn_80256E80(); + if (mLinkage.checkConnection(dLinkage_c::CONNECTION_9) || mLinkage.checkConnection(dLinkage_c::CONNECTION_8)) { + mCyl.SetC(mPosition); + dCcS::GetInstance()->Set(&mCyl); + } + + if (mLinkage.checkConnection(dLinkage_c::CONNECTION_7)) { + makeLinkLookTowardItem(); + } + } +} + +void dAcItem_c::finalizeState_Carry() { + setupUnkColliderFlags2(); +} + +void dAcItem_c::initializeState_GetBeetle() { + mpMdl->vt_0x10(dItemMdl_c::ITEM_MDL_UNK0x14_1); + setNotWaiting(); + field_0xD38 = field_0xD3A = field_0xD3C = 0; + field_0xD0C = 0.0f; + if (isAnyRupee()) { + dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_BE_GET_RUPEE); + } else if (isHeartV()) { + dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_BE_GET_HART); + } else if (isSmallKey()) { + dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_BE_GET_KEY); + } else if (mId == ITEM_STAMINA_FRUIT) { + dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_BE_GET_REFRESH_FRUIT); + } else if (isUnkTreasureGroup1()) { + dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_BE_GET_MATERIAL); + } else { + dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_BE_GET_CONSUMP_ITEM); + } + + addToGetQueue(); + mMdlScaleType = 3; + fn_802548A0(); +} + +void dAcItem_c::executeState_GetBeetle() { + // TODO weird double load + dAcPy_c *link = dAcPy_c::GetLinkM(); + if (link == nullptr) { + return; + } + dAcBoomerang_c *beetlePtr = (dAcBoomerang_c *)link->vt_0x1C0(); + if (beetlePtr == nullptr) { + if (link->ifHasHealthAndSomethingElse() && this == sItemListHead.get() && + FileManager::sInstance->getCurrentHealth() != 0) { + decideOnGetOrForcedGet(); + } else { + mStateMgr.changeState(StateID_WaitGet); + } + } else if (37.6f - field_0xD0C < 1.6f) { + // TODO what are these numbers + mStateMgr.changeState(StateID_WaitGet); + } else { + mVec3_c v(0.0f, 5.0f, 0.0f); + // This + is weird... inline? + v.rotY(+beetlePtr->mRotation.y); + mPosition = beetlePtr->mPosition + v; + mPosition.y += field_0xD0C; + fn_80255E80(); + sLib::addCalcScaledDiff(&field_0xD0C, 37.6f, 0.1f, 10000.0f); + } +} -void dAcItem_c::initializeState_GetBeetle() {} -void dAcItem_c::executeState_GetBeetle() {} void dAcItem_c::finalizeState_GetBeetle() {} -void dAcItem_c::initializeState_WaitGet() {} -void dAcItem_c::executeState_WaitGet() {} -void dAcItem_c::finalizeState_WaitGet() {} +void dAcItem_c::initializeState_WaitGet() { + field_0xD64 = 0; + setObjectProperty(OBJ_PROP_0x200); + // TODO double load + dAcPy_c *link = dAcPy_c::GetLinkM(); + if (link != nullptr) { + mPosition.set(link->getPosition()); + } + mMdlScaleType = 1; + fn_802548A0(); +} -void dAcItem_c::initializeState_Get() {} -void dAcItem_c::executeState_Get() {} -void dAcItem_c::finalizeState_Get() {} +void dAcItem_c::executeState_WaitGet() { + // TODO double load + dAcPy_c *link = dAcPy_c::GetLinkM(); + if (link != nullptr) { + if (link->ifHasHealthAndSomethingElse()) { + field_0xD64 = true; + } + if (field_0xD64 && this == sItemListHead.get() && FileManager::GetInstance()->getCurrentHealth() != 0) { + decideOnGetOrForcedGet(); + } + } +} + +void dAcItem_c::finalizeState_WaitGet() { + unsetObjectProperty(OBJ_PROP_0x200); +} + +void dAcItem_c::initializeState_Get() { + mpMdl->vt_0x10(dItemMdl_c::ITEM_MDL_UNK0x14_1); + performCollection(); + if (isAnyTear()) { + mVec3_c tmp; + fn_80256710(tmp); + fn_80257560(tmp); + } + fn_80254D10(); + fn_80254D70(); + setNotWaiting(); + field_0xD38 = field_0xD3A = field_0xD3C = 0; + field_0xD4D = false; + mMdlScaleType = 1; + fn_802548A0(); +} + +void dAcItem_c::executeState_Get() { + if (!fn_80254D70()) { + fn_802542E0(); + } else { + // @bug always true + if (field_0xD4D < 0xFFFF) { + field_0xD4D++; + } + if (field_0xD4D > 12) { + removeFromGetQueue(); + } + } +} + +void dAcItem_c::finalizeState_Get() { + removeFromGetQueue(); +} + +void dAcItem_c::initializeState_WaitGetDemo() { + mpMdl->vt_0x10(dItemMdl_c::ITEM_MDL_UNK0x14_2); + setObjectProperty(OBJ_PROP_0x200); + setNotWaiting(); + field_0xD38 = field_0xD3A = field_0xD3C = 0; + mMdlScaleType = 2; + fn_802548A0(); + unsetFramesInAir(); +} + +void dAcItem_c::executeState_WaitGetDemo() { + s32 which = 0; + if (EventManager::isInEvent()) { + which = 2; + } else if (fn_80247BB0()) { + which = 2; + } else if ((isInsect() || isTreasure3()) && checkTreasureTempCollect(getItemId())) { + which = 2; + } else if (checkShouldDemo() && fn_80254EC0()) { + which = 1; + } else if (mFramesInAir > 10) { + which = 2; + } + + switch (which) { + case 1: addGetEvent(); break; + case 2: + unsetObjectProperty(OBJ_PROP_0x200); + mStateMgr.changeState(StateID_Get); + break; + } + unsetFramesInAir(); +} -void dAcItem_c::initializeState_WaitGetDemo() {} -void dAcItem_c::executeState_WaitGetDemo() {} void dAcItem_c::finalizeState_WaitGetDemo() {} -void dAcItem_c::initializeState_WaitForcedGetDemo() {} -void dAcItem_c::executeState_WaitForcedGetDemo() {} +void dAcItem_c::initializeState_WaitForcedGetDemo() { + mpMdl->vt_0x10(dItemMdl_c::ITEM_MDL_UNK0x14_2); + setObjectProperty(OBJ_PROP_0x200); + setNotWaiting(); + field_0xD38 = field_0xD3A = field_0xD3C = 0; + mMdlScaleType = 2; + fn_802548A0(); +} + +void dAcItem_c::executeState_WaitForcedGetDemo() { + if (isAnyTear() && mFramesInAir < 10) { + incrementFramesInAir(); + if (mFramesInAir == 10) { + fn_80257560(mPosition); + } + } + addGetEvent(); +} + void dAcItem_c::finalizeState_WaitForcedGetDemo() {} -void dAcItem_c::initializeState_GetDemo() {} -void dAcItem_c::executeState_GetDemo() {} -void dAcItem_c::finalizeState_GetDemo() {} +void dAcItem_c::initializeState_GetDemo() { + mpMdl->vt_0x10(dItemMdl_c::ITEM_MDL_UNK0x14_2); + switch (getItemId()) { + case ITEM_FARON_GRASSHOPPER: sCollectionCurrentCount = getFaronGrasshooperCounter(); break; + case ITEM_WOODLAND_RHINO_BEETLE: sCollectionCurrentCount = getWoodlandRhinoBeetleCounter(); break; + case ITEM_DEKU_HORNET: sCollectionCurrentCount = getDekuHornetCounter(); break; + case ITEM_SKYLOFT_MANTIS: sCollectionCurrentCount = getSkyloftMantisCounter(); break; + case ITEM_VOLCANIC_LADYBUG: sCollectionCurrentCount = getVolcanicLadybugCounter(); break; + case ITEM_BLESSED_BUTTERFLY: sCollectionCurrentCount = getBlessedButterflyCounter(); break; + case ITEM_LANAYRU_ANT: sCollectionCurrentCount = getLanayruAntCounter(); break; + case ITEM_SAND_CICADA: sCollectionCurrentCount = getSandCicadaCounter(); break; + case ITEM_GERUDO_DRAGONFLY: sCollectionCurrentCount = getGerudoDragonflyCounter(); break; + case ITEM_ELDIN_ROLLER: sCollectionCurrentCount = getEldinRollerCounter(); break; + case ITEM_SKY_STAG_BEETLE: sCollectionCurrentCount = getSkyStagBeetleCounter(); break; + case ITEM_STARRY_FIREFLY: sCollectionCurrentCount = getStarryFireflyCounter(); break; + case ITEM_HORNET_LARVAE: sCollectionCurrentCount = getHornetLarvaeCounter(); break; + case ITEM_BIRD_FEATHER: sCollectionCurrentCount = getBirdFeatherCounter(); break; + case ITEM_TUMBLE_WEED: sCollectionCurrentCount = getTumbleWeedCounter(); break; + case ITEM_LIZARD_TAIL: sCollectionCurrentCount = getLizardTailCounter(); break; + case ITEM_ELDIN_ORE: sCollectionCurrentCount = getEldinOreCounter(); break; + case ITEM_ANCIENT_FLOWER: sCollectionCurrentCount = getAncientFlowerCounter(); break; + case ITEM_AMBER_RELIC: sCollectionCurrentCount = getAmberRelicCounter(); break; + case ITEM_DUSK_RELIC: sCollectionCurrentCount = getDuskRelicCounter(); break; + case ITEM_JELLY_BLOB: sCollectionCurrentCount = getJellyBlobCounter(); break; + case ITEM_MONSTER_CLAW: sCollectionCurrentCount = getMonsterClawCounter(); break; + case ITEM_MONSTER_HORN: sCollectionCurrentCount = getMonsterHornCounter(); break; + case ITEM_ORNAMENTAL_SKULL: sCollectionCurrentCount = getSkullCounter(); break; + case ITEM_EVIL_CRYSTAL: sCollectionCurrentCount = getEvilCrystalCounter(); break; + case ITEM_BLUE_BIRD_FEATHER: sCollectionCurrentCount = getBlueBirdFeatherCounter(); break; + case ITEM_GOLDEN_SKULL: sCollectionCurrentCount = getGoldenSkullCounter(); break; + case ITEM_GODDESS_PLUME: sCollectionCurrentCount = getGoddessPlumeCounter(); break; + } + + performCollectionPart1(); + if (checkItemFlagV()) { + if (isAnyTear()) { + dAcOWarp_c *warp = static_cast(fManager_c::searchBaseByProfName(fProfile::OBJ_WARP)); + if (warp != nullptr) { + warp->onCollectFirstTear(); + } + } + } else { + bool doCollect = true; + if (ITEM_FARON_GRASSHOPPER <= mId && mId <= ITEM_STARRY_FIREFLY && + MinigameManager::isInMinigameState(MinigameManager::INSECT_CAPTURE)) { + doCollect = false; + } + if (doCollect) { + setItemFlagV(); + } + } + + setTreasureTempCollect(getItemId()); + setNotWaiting(); + field_0xD38 = field_0xD3A = field_0xD3C = 0; + mMdlRotY = 0; + setObjectProperty(OBJ_PROP_0x200); + mMdlScaleType = 2; + if (isBirdStatuette()) { + mFn_0xC9C = &dAcItem_c::fn_80255F40; + } else { + mFn_0xC9C = &dAcItem_c::fn_80255E80; + } +} + +void dAcItem_c::executeState_GetDemo() { + switch (mEventRelated.getCurrentEventCommand()) { + case 'act0': mEventRelated.advanceNext(); break; + case 'wait': mEventRelated.advanceNext(); break; + case 'halo': { + mVec3_c efPos; + fn_80254590(efPos); + mVec3_c diff = dScGame_c::getCamera()->getPosition() - mPosition; + // TODO close but an extsh is missing + mAng3_c rot((s32)-diff.atan2sY_XZ(), (s32)diff.atan2sX_Z(), 0); + u32 alpha = 0xFF; + if (dScGame_c::currentSpawnInfo.getTrial() == SpawnInfo::TRIAL) { + alpha = 0x80; + } + mEff_0x95C.holdEffect(PARTICLE_RESOURCE_ID_MAPPING_82_, efPos, &rot, nullptr, nullptr, nullptr); + mEff_0x95C.setGlobalAlpha(alpha); + mEventRelated.advanceNext(); + break; + } + case '????': break; + default: mEventRelated.advanceNext(); break; + } + + if (!checkObjectProperty(OBJ_PROP_0x200)) { + mPosition = getLinkPtr()->vt_0x1A4(); + if (isUpgradedPotion((ITEM_ID)getItemId())) { + fn_80254680(); + } else if (isAnyTear()) { + fn_80254810(); + } + mbShowItemLighting = true; + field_0x340 = mPosition; + (this->*mFn_0xC9C)(); + if (!isGratitudeCrystal() && !is5GratitudeCrystals()) { + mMdlRotY += getItemRotateAngle(); + } + field_0xD42 = mAng::d2s_c(0.0f); + + // TODO - ... + } + makeLinkLookTowardItem(); +} + +void dAcItem_c::finalizeState_GetDemo() { + mMdlRotY = 0; + field_0xD42 = 0; + performCollectionPart2(); + mbShowItemLighting = false; + if (mEff_0x95C.hasEmitters()) { + mEff_0x95C.remove(true); + } + if (isAnyTear() && mEff_0xA60.hasEmitters()) { + mEff_0xA60.remove(true); + } +} + +void dAcItem_c::initializeState_WaitTBoxGetDemo() { + mpMdl->vt_0x10(dItemMdl_c::ITEM_MDL_UNK0x14_2); + setNotWaiting(); + field_0xD38 = field_0xD3A = field_0xD3C = 0; + setObjectProperty(OBJ_PROP_0x200); + mMdlScaleType = 2; + fn_802548A0(); +} + +void dAcItem_c::executeState_WaitTBoxGetDemo() { + const char *name; + getItemGetEventName(getItemId(), &name); + Event ev(name, 1, 0x100001, (void *)itemGetEventStart, (void *)itemGetEventEnd); + EventManager::alsoSetAsCurrentEvent(this, &ev, nullptr); +} -void dAcItem_c::initializeState_WaitTBoxGetDemo() {} -void dAcItem_c::executeState_WaitTBoxGetDemo() {} void dAcItem_c::finalizeState_WaitTBoxGetDemo() {} -void dAcItem_c::initializeState_ResurgeWait() {} -void dAcItem_c::executeState_ResurgeWait() {} +void dAcItem_c::initializeState_ResurgeWait() { + mpMdl->vt_0x10(dItemMdl_c::ITEM_MDL_UNK0x14_1); + // TODO FPR swap + mPosition = mPositionCopy; + mRotation = mRotationCopy; + field_0xB3C->fn_802579D0(); + setNotWaiting(); + // TODO ??? + mbNoGravity = mbNoDespawn; + field_0xD38 = field_0xD3A = field_0xD3C = 0; + mMdlScaleType = 0; + field_0xCD8 = 0.0f; +} + +void dAcItem_c::executeState_ResurgeWait() { + if (field_0xB3C->fn_80257A10(this)) { + if (!field_0xB3C->fn_80257B10()) { + field_0xB3C->fn_80257AC0(); + if (field_0xB3C->fn_80257B10()) { + if (mId == ITEM_STAMINA_FRUIT) { + startSound(SE_O_REFRESH_FRUIT_SPROUT); + } + mStateMgr.changeState(StateID_Wait); + } + } + } else { + field_0xB3C->fn_80257A80(); + } +} + void dAcItem_c::finalizeState_ResurgeWait() {} -void dAcItem_c::initializeState_WaitTurnOff() {} -void dAcItem_c::executeState_WaitTurnOff() {} +void dAcItem_c::initializeState_WaitTurnOff() { + setNotWaiting(); + setObjectProperty(OBJ_PROP_0x200); + mSpeed = 0.0f; + mVelocity.set(0.0f, 0.0f, 0.0f); + field_0xD38 = field_0xD3A = field_0xD3C = 0; + mMdlScaleType = 2; +} + +void dAcItem_c::executeState_WaitTurnOff() { + if (field_0xD04 <= 0.0f) { + deleteRequest(); + } +} + void dAcItem_c::finalizeState_WaitTurnOff() {} -void dAcItem_c::initializeState_WaitSacredDewGetEffect() {} -void dAcItem_c::executeState_WaitSacredDewGetEffect() {} +void dAcItem_c::initializeState_WaitSacredDewGetEffect() { + setNotWaiting(); + setObjectProperty(OBJ_PROP_0x200); + mSpeed = 0.0f; + mVelocity.set(0.0f, 0.0f, 0.0f); + field_0xD38 = field_0xD3A = field_0xD3C = 0; + mMdlScaleType = 2; +} + +void dAcItem_c::executeState_WaitSacredDewGetEffect() { + if (!EventManager::isInEvent()) { + mVec3_c tmp; + fn_80247540(tmp); + fn_80247560(tmp); + mStateMgr.changeState(StateID_WaitTurnOff); + } +} + void dAcItem_c::finalizeState_WaitSacredDewGetEffect() {} STATE_DEFINE(dAcItem_c, Wait); @@ -1443,3 +2132,276 @@ STATE_DEFINE(dAcItem_c, WaitTBoxGetDemo); STATE_DEFINE(dAcItem_c, ResurgeWait); STATE_DEFINE(dAcItem_c, WaitTurnOff); STATE_DEFINE(dAcItem_c, WaitSacredDewGetEffect); + +void dAcItem_c::itemGetEventStart(dAcBase_c *arg) { + // TODO + dAcItem_c *item = static_cast(arg); + item->mStateMgr.changeState(StateID_GetDemo); + item->setObtainedItemId(item->getItemId(), true); + if (item->mId == ITEM_DUNGEON_MAP_FI && ItemflagManager::sInstance->getItemCounterOrFlag(0x32) == 0) { + Event ev("fays_map_guide", 100, 0x100001, nullptr, nullptr); + EventManager::changeOwnEvent(item, dAcNpcTalkKensei_c::GetInstance(), &ev, 0); + } +} + +void dAcItem_c::applyBoundingBox() { + (this->*mFnSetBoundingBox)(); +} + +void dAcItem_c::performCollection() { + performCollectionPart1(); + performCollectionPart2(); +} + +void dAcItem_c::performCollectionPart1() { + u16 id = getItemId(); + if (isKeyPieceV()) { + increaseKeyPieceCounter(1); + } else if (isLightFruit()) { + dTgSiren_c::setLightFruitTime(getLightFruitTime()); + } else if (isHeartPiece()) { + increaseHeartPieceCounter(1); + increaseTotalHeartPieceCounter(1); + } else { + f32 count; + switch (id) { + case ITEM_FARON_GRASSHOPPER: + if (!MinigameManager::isInMinigameState(MinigameManager::INSECT_CAPTURE)) { + increaseFaronGrasshopperCounter(mItemQuantity != 0 ? mItemQuantity : 1); + } + break; + case ITEM_WOODLAND_RHINO_BEETLE: + if (!MinigameManager::isInMinigameState(MinigameManager::INSECT_CAPTURE)) { + increaseWoodlandRhinoBeetleCounter(mItemQuantity != 0 ? mItemQuantity : 1); + } + break; + case ITEM_DEKU_HORNET: + if (!MinigameManager::isInMinigameState(MinigameManager::INSECT_CAPTURE)) { + increaseDekuHornetCounter(mItemQuantity != 0 ? mItemQuantity : 1); + } + break; + case ITEM_SKYLOFT_MANTIS: + if (!MinigameManager::isInMinigameState(MinigameManager::INSECT_CAPTURE)) { + increaseSkyloftMantisCounter(mItemQuantity != 0 ? mItemQuantity : 1); + } + break; + case ITEM_VOLCANIC_LADYBUG: + if (!MinigameManager::isInMinigameState(MinigameManager::INSECT_CAPTURE)) { + increaseVolcanicLadybugCounter(mItemQuantity != 0 ? mItemQuantity : 1); + } + break; + case ITEM_BLESSED_BUTTERFLY: + if (!MinigameManager::isInMinigameState(MinigameManager::INSECT_CAPTURE)) { + increaseBlessedButterflyCounter(mItemQuantity != 0 ? mItemQuantity : 1); + } + break; + case ITEM_LANAYRU_ANT: + if (!MinigameManager::isInMinigameState(MinigameManager::INSECT_CAPTURE)) { + increaseLanayruAntCounter(mItemQuantity != 0 ? mItemQuantity : 1); + } + break; + case ITEM_SAND_CICADA: + if (!MinigameManager::isInMinigameState(MinigameManager::INSECT_CAPTURE)) { + increaseSandCicadaCounter(mItemQuantity != 0 ? mItemQuantity : 1); + } + break; + case ITEM_GERUDO_DRAGONFLY: + if (!MinigameManager::isInMinigameState(MinigameManager::INSECT_CAPTURE)) { + increaseGerudoDragonflyCounter(mItemQuantity != 0 ? mItemQuantity : 1); + } + break; + case ITEM_ELDIN_ROLLER: + if (!MinigameManager::isInMinigameState(MinigameManager::INSECT_CAPTURE)) { + increaseEldinRollerCounter(mItemQuantity != 0 ? mItemQuantity : 1); + } + break; + case ITEM_SKY_STAG_BEETLE: + if (!MinigameManager::isInMinigameState(MinigameManager::INSECT_CAPTURE)) { + increaseSkyStagBeetleCounter(mItemQuantity != 0 ? mItemQuantity : 1); + } + break; + case ITEM_STARRY_FIREFLY: + if (!MinigameManager::isInMinigameState(MinigameManager::INSECT_CAPTURE)) { + increaseStarryFireflyCounter(mItemQuantity != 0 ? mItemQuantity : 1); + } + break; + case ITEM_HORNET_LARVAE: increaseHornetLarvaeCounter(1); break; + case ITEM_BIRD_FEATHER: + // ??? + count = mItemQuantity != 0 ? mItemQuantity : 1; + increaseBirdFeatherCounter(0.0f < count ? count : 1.0f); + break; + case ITEM_TUMBLE_WEED: increaseTumbleWeedCounter(1); break; + case ITEM_LIZARD_TAIL: increaseLizardTailCounter(1); break; + case ITEM_ELDIN_ORE: increaseEldinOreCounter(1); break; + case ITEM_ANCIENT_FLOWER: increaseAncientFlowerCounter(1); break; + case ITEM_AMBER_RELIC: increaseAmberRelicCounter(1); break; + case ITEM_DUSK_RELIC: increaseDuskRelicCounter(1); break; + case ITEM_JELLY_BLOB: increaseJellyBlobCounter(1); break; + case ITEM_MONSTER_CLAW: increaseMonsterClawCounter(1); break; + case ITEM_MONSTER_HORN: increaseMonsterHornCounter(1); break; + case ITEM_ORNAMENTAL_SKULL: increaseSkullCounter(1); break; + case ITEM_EVIL_CRYSTAL: increaseEvilCrystalCounter(1); break; + case ITEM_BLUE_BIRD_FEATHER: + // ??? + count = mItemQuantity != 0 ? mItemQuantity : 1; + increaseBlueBirdFeatherCounter(0.0f < count ? count : 1.0f); + break; + case ITEM_GOLDEN_SKULL: increaseGoldenSkullCounter(1); break; + case ITEM_GODDESS_PLUME: increaseGoddessPlumeCounter(1); break; + default: { + if (isTriforce()) { + doFullHeal(); + } else if (isGratitudeCrystal()) { + increaseGratitudeCrystalCounter(1); + } else if (is5GratitudeCrystals()) { + increaseGratitudeCrystalCounter(5); + } else if (id == ITEM_EXTRA_WALLET) { + increaseExtraWalletCounter(1); + } + break; + } + } + } + + if (mStateMgr.isState(StateID_GetDemo)) { + sIsPerformingInitialCollection = !checkFlagV(); + } + + bool doCollect = true; + if (ITEM_FARON_GRASSHOPPER <= mId && mId <= ITEM_STARRY_FIREFLY && + MinigameManager::isInMinigameState(MinigameManager::INSECT_CAPTURE)) { + doCollect = false; + } + if (doCollect) { + setFlagV(); + } + setSceneFlag(); + setDungeonFlag(); + + if (getSubtypeFromParam(mParams) == 7) { + return; + } + + if (isGreenRupee()) { + dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_GET_RUPEE_GREEN); + } else if (isBlueRupee()) { + dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_GET_RUPEE_BLUE); + } else if (isRedRupee()) { + dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_GET_RUPEE_RED); + } else if (isSilverRupee()) { + dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_GET_RUPEE_SILVER); + } else if (isGoldRupee()) { + dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_GET_RUPEE_BLUE); + } else if (isRupoor()) { + dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_GET_RUPEE_BABA); + } else if (isHeartV()) { + dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_HEART_PIECE_GET); + } else if (isAnyTear()) { + dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_SIREN_GET_SHINE_DEW); + } else if (mId == ITEM_STAMINA_FRUIT) { + dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_GET_REFRESH_FRUIT); + } else if (isLightFruit()) { + dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_SIREN_GET_HOLY_FRUIT); + } else if (mId == ITEM_5_DEKU_SEEDS || is10DekuSeeds()) { + dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_CONSUMP_ITEM_GET); + } else if (isAnyArrow()) { + dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_CONSUMP_ITEM_GET); + } else if (isAnyBombs()) { + dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_CONSUMP_ITEM_GET); + } else if (isInsect()) { + dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_GET_MATERIAL); + } else if (isTreasureV()) { + dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_GET_MATERIAL); + } else if (is5GratitudeCrystals() || isGratitudeCrystal()) { + if ((mItemFlags & 0x20) == 0) { + dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_GET_SOURCE_OUTWELL); + } + } else if (isBabyRattle()) { + dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_GET_GARAGARA); + } else if (isLifeTreeFruit()) { + dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_GET_LIFE_FRUIT); + } else if (mId == ITEM_HEART_CONTAINER) { + dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_GET_HEART_CONTAINER); + } else if (isTriforce()) { + dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_GET_TRIFORCE); + } +} + +void dAcItem_c::performCollectionPart2() { + u16 id = getItemId(); + if (id == ITEM_SMALL_KEY) { + increaseSmallKeyCounter(1); + } else if (id == ITEM_GREEN_RUPEE) { + if (!MinigameManager::isInMinigameState(MinigameManager::THRILL_DIGGER)) { + increaseRupeeCounter(1); + } + } else if (id == ITEM_BLUE_RUPEE) { + if (!MinigameManager::isInMinigameState(MinigameManager::THRILL_DIGGER)) { + increaseRupeeCounter(5); + } + } else if (id == ITEM_RED_RUPEE) { + if (!MinigameManager::isInMinigameState(MinigameManager::THRILL_DIGGER)) { + increaseRupeeCounter(20); + } + } else if (isHeartV()) { + healLink(4, true); + } else if (id == ITEM_SINGLE_ARROW) { + increaseArrowAndPouchCounter(1); + } else if (id == ITEM_BUNDLE_ARROWS) { + increaseArrowAndPouchCounter(10); + } else if (id == ITEM_SILVER_RUPEE) { + if (!MinigameManager::isInMinigameState(MinigameManager::THRILL_DIGGER)) { + increaseRupeeCounter(100); + } + } else if (id == ITEM_GOLD_RUPEE) { + if (!MinigameManager::isInMinigameState(MinigameManager::THRILL_DIGGER)) { + increaseRupeeCounter(300); + } + } else if (id == ITEM_RUPOOR) { + if (!MinigameManager::isInMinigameState(MinigameManager::THRILL_DIGGER)) { + increaseRupeeCounter(-10); + } + } else if (id == ITEM_5_BOMBS) { + increaseBombAndPouchCounter(5); + } else if (id == ITEM_10_BOMBS) { + increaseBombAndPouchCounter(10); + } else if (mId == ITEM_STAMINA_FRUIT) { + restoreStamina(); + } else if (id == ITEM_5_DEKU_SEEDS) { + increaseDekuSeedAndPouchCounter(5); + } else if (is10DekuSeeds()) { + increaseDekuSeedAndPouchCounter(10); + } else if (id == ITEM_POUCH_EXPANSION) { + increaseExtraPouchCounter(1); + } else if (id == ITEM_HEART_CONTAINER) { + increaseHealthCapacity(getHeartContainerHeartIncrease()); + doFullHeal(); + } else if (isHeartPiece()) { + if (getNumRemainingHeartPiecesForNextHeart() == 0) { + increaseHealthCapacity(getCompletedHeartPieceHeartIncrease()); + } + doFullHeal(); + } else if (id == ITEM_LIFE_TREE_SEED) { + setLifeTreeSeedlingFlag(1); + } else if (id == ITEM_BOW || id == ITEM_IRON_BOW || id == ITEM_SACRED_BOW) { + if (!checkFlagV()) { + increaseArrowCounter(getBowArrowCapacity() - getBowArrowCount()); + } + } else if (id == ITEM_SLINGSHOT || id == ITEM_MIGHTY_SCATTERSHOT) { + if (!checkFlagV()) { + increaseDekuSeedCounter(getSlingshotSeedCapacity() - getSlingshotSeedCount()); + } + } else if (isAnyPouchItem((ITEM_ID)id)) { + if (mGetItemPouchSlot == -1) { + collectPouchItem(id); + } else { + collectPouchItemIntoSlot(mGetItemPouchSlot, id, -1, false); + } + } + + if (MinigameManager::isInMinigameState(MinigameManager::INSECT_CAPTURE) && + dTgMinigameInsectCapture_c::GetInstance() != nullptr) { + dTgMinigameInsectCapture_c::GetInstance()->recordCollectedInsect(mId, mItemQuantity != 0 ? mItemQuantity : 1); + } +} diff --git a/src/d/d_message.cpp b/src/d/d_message.cpp index c19a805e..5a1e703e 100644 --- a/src/d/d_message.cpp +++ b/src/d/d_message.cpp @@ -335,7 +335,7 @@ bool dFlow_c::handleEventInternal(const MsbFlowInfo *element) { if (dMessage_c::getInstance()->getField_0x2FC() != -1) { dMessage_c::getInstance()->setField_0x2FC(0x3C); } - dAcItem_c::addRupees(params1n2); + dAcItem_c::increaseRupeeCounter(params1n2); if ((s32)params1n2 > 0) { dLytMeter_c::setRupyField_0x8AD(1); }