mirror of
https://github.com/zeldaret/ss
synced 2026-06-04 18:58:45 -04:00
dAcTbox_c::create structurally matching
This commit is contained in:
+29
-29
@@ -2119,13 +2119,13 @@ fn_80051C00 = .text:0x80051C00; // type:function size:0x4C
|
||||
InitColliderAndAddToFront = .text:0x80051C50; // type:function size:0x5C
|
||||
fn_80051CB0 = .text:0x80051CB0; // type:function size:0x5C
|
||||
InitCollider2AndAddToFront = .text:0x80051D10; // type:function size:0x5C
|
||||
fn_80051D70 = .text:0x80051D70; // type:function size:0x5C
|
||||
addCc__16TboxAndMoreUnkCCFR10dAcTboxCcDRC11dCcD_SrcUnk = .text:0x80051D70; // type:function size:0x5C
|
||||
fn_80051DD0 = .text:0x80051DD0; // type:function size:0x64
|
||||
fn_80051E40 = .text:0x80051E40; // type:function size:0x64
|
||||
ColliderManager__staticAddCollider = .text:0x80051EB0; // type:function size:0x34
|
||||
ColliderLinkedList__registerColliders = .text:0x80051EF0; // type:function size:0x10
|
||||
fn_80051F00 = .text:0x80051F00; // type:function size:0x8
|
||||
fn_80051F10 = .text:0x80051F10; // type:function size:0x10
|
||||
setMtx__16TboxAndMoreUnkCCFRC6mMtx_c = .text:0x80051F10; // type:function size:0x10
|
||||
ColliderLinkedList__search = .text:0x80051F20; // type:function size:0x74
|
||||
fn_80051FA0 = .text:0x80051FA0; // type:function size:0x1C
|
||||
fn_80051FC0 = .text:0x80051FC0; // type:function size:0x10
|
||||
@@ -13466,7 +13466,7 @@ AcItem__isSingleArrow = .text:0x802509A0; // type:function size:0x10
|
||||
isItem5Bombs = .text:0x802509B0; // type:function size:0x10
|
||||
isItem10Bombs = .text:0x802509C0; // type:function size:0x10
|
||||
isItemBundleOfArrows = .text:0x802509D0; // type:function size:0x10
|
||||
AcItem__isKeyPiece = .text:0x802509E0; // type:function size:0x10
|
||||
isKeyPiece__9dAcItem_cF7ITEM_ID = .text:0x802509E0; // type:function size:0x10
|
||||
isItem5GratitudeCrystals = .text:0x802509F0; // type:function size:0x10
|
||||
AcItem__isFaroreTear = .text:0x80250A00; // type:function size:0x10
|
||||
AcItem__IsDinTear = .text:0x80250A10; // type:function size:0x10
|
||||
@@ -13492,7 +13492,7 @@ AcItem__isTear2 = .text:0x80250C10; // type:function size:0x78
|
||||
AcItem__is_Larvae_Ore_JellyBlob_Claw_Horn_EvilCryst_OrnSkull_GoldSkull = .text:0x80250C90; // type:function size:0xB8
|
||||
AcItem__isBug = .text:0x80250D50; // type:function size:0x7C
|
||||
AcItem__isTreasure = .text:0x80250DD0; // type:function size:0x138
|
||||
AcItem__isTreasure2 = .text:0x80250F10; // type:function size:0x88
|
||||
isTreasure__9dAcItem_cF7ITEM_ID = .text:0x80250F10; // type:function size:0x88
|
||||
AcItem__isItemHeart = .text:0x80250FA0; // type:function size:0x34
|
||||
isSingleArrow = .text:0x80250FE0; // type:function size:0x8
|
||||
isBundleOrArrows = .text:0x80250FF0; // type:function size:0x8
|
||||
@@ -14240,7 +14240,7 @@ dAcTbox_c_classInit__Fv = .text:0x802685A0; // type:function size:0x30
|
||||
fn_802685D0 = .text:0x802685D0; // type:function size:0x68
|
||||
fn_80268640 = .text:0x80268640; // type:function size:0x4
|
||||
fn_80268650 = .text:0x80268650; // type:function size:0x8
|
||||
fn_80268660 = .text:0x80268660; // type:function size:0x20
|
||||
fn_80268660__9dAcTbox_cFi = .text:0x80268660; // type:function size:0x20
|
||||
hasCollectedAllTears2 = .text:0x80268680; // type:function size:0x1C
|
||||
fn_802686A0 = .text:0x802686A0; // type:function size:0x50
|
||||
fn_802686F0 = .text:0x802686F0; // type:function size:0x5C
|
||||
@@ -14252,7 +14252,7 @@ __dt__77sStateMgr_c<9dAcTbox_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDC
|
||||
__dt__47sFStateMgr_c<9dAcTbox_c,20sStateMethodUsr_FI_c>Fv = .text:0x80268C50; // type:function size:0xA4
|
||||
__dt__9dAcTbox_cFv = .text:0x80268D00; // type:function size:0x250
|
||||
createHeap__9dAcTbox_cFv = .text:0x80268F50; // type:function size:0x54C
|
||||
AcTbox__init = .text:0x802694A0; // type:function size:0xA00
|
||||
create__9dAcTbox_cFv = .text:0x802694A0; // type:function size:0xA00
|
||||
AcTbox__destroy = .text:0x80269EA0; // type:function size:0xB4
|
||||
AcTbox__update = .text:0x80269F60; // type:function size:0x690
|
||||
getStateID__77sStateMgr_c<9dAcTbox_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x8026A5F0; // type:function size:0x10
|
||||
@@ -14264,11 +14264,11 @@ AcTbox__setActionState = .text:0x8026B0C0; // type:function size:0x224
|
||||
AcTbox__isValidSubtype = .text:0x8026B2F0; // type:function size:0x20
|
||||
fn_8026B310 = .text:0x8026B310; // type:function size:0x8
|
||||
fn_8026B320 = .text:0x8026B320; // type:function size:0x8
|
||||
AcTbox__setItemId = .text:0x8026B330; // type:function size:0x8
|
||||
setDoObstructionCheckTrue = .text:0x8026B340; // type:function size:0xC
|
||||
AcTbox__isActualVisibleBox = .text:0x8026B350; // type:function size:0xC
|
||||
getRotX_shift9_0x1 = .text:0x8026B360; // type:function size:0xC
|
||||
fn_8026B370 = .text:0x8026B370; // type:function size:0xC
|
||||
setItemId__9dAcTbox_cCFUs = .text:0x8026B330; // type:function size:0x8
|
||||
setDoObstructionCheck__9dAcTbox_cFv = .text:0x8026B340; // type:function size:0xC
|
||||
isActualVisibleBox__9dAcTbox_cCFv = .text:0x8026B350; // type:function size:0xC
|
||||
noObstructionCheck__9dAcTbox_cCFv = .text:0x8026B360; // type:function size:0xC
|
||||
fn_8026B370__9dAcTbox_cCFv = .text:0x8026B370; // type:function size:0xC
|
||||
fn_8026B380 = .text:0x8026B380; // type:function size:0x3C
|
||||
fn_8026B3C0 = .text:0x8026B3C0; // type:function size:0x20
|
||||
initializeState_DugOut__9dAcTbox_cFv = .text:0x8026B3E0; // type:function size:0x11C
|
||||
@@ -14322,20 +14322,20 @@ AcTbox__setShouldCloseFlag = .text:0x8026D350; // type:function size:0xC
|
||||
AcTbox__unsetShouldCloseFlag = .text:0x8026D360; // type:function size:0xC
|
||||
fn_8026D370 = .text:0x8026D370; // type:function size:0x4C
|
||||
fn_8026D3C0 = .text:0x8026D3C0; // type:function size:0xD4
|
||||
AcTbox__setChestflag = .text:0x8026D4A0; // type:function size:0x10
|
||||
setChestFlag__9dAcTbox_cFv = .text:0x8026D4A0; // type:function size:0x10
|
||||
AcTbox__setTboxFlag = .text:0x8026D4B0; // type:function size:0x18
|
||||
checkTBoxFlagMaybe = .text:0x8026D4D0; // type:function size:0x4C
|
||||
checkTboxFlag__9dAcTbox_cCFv = .text:0x8026D4D0; // type:function size:0x4C
|
||||
fn_8026D520 = .text:0x8026D520; // type:function size:0x18
|
||||
fn_8026D540 = .text:0x8026D540; // type:function size:0x14
|
||||
fn_8026D560 = .text:0x8026D560; // type:function size:0x94
|
||||
fn_8026D600 = .text:0x8026D600; // type:function size:0x68
|
||||
fn_8026D670 = .text:0x8026D670; // type:function size:0x8
|
||||
fn_8026D560__9dAcTbox_cCFv = .text:0x8026D560; // type:function size:0x94
|
||||
getSomeCounter__9dAcTbox_cCFPUl = .text:0x8026D600; // type:function size:0x68
|
||||
fn_8026D670__9dAcTbox_cCFv = .text:0x8026D670; // type:function size:0x8
|
||||
fn_8026D680 = .text:0x8026D680; // type:function size:0x10
|
||||
ActorObjectBase__setActorCollision = .text:0x8026D690; // type:function size:0xB8
|
||||
AcTbox__initializeDowsingTarget = .text:0x8026D750; // type:function size:0x14
|
||||
AcTbox__isItemRupee = .text:0x8026D770; // type:function size:0x8
|
||||
AcTbox__initDowsingTarget = .text:0x8026D780; // type:function size:0x50
|
||||
AcTbox__initDowsingTargetCube = .text:0x8026D7D0; // type:function size:0x44
|
||||
isItemRupee__9dAcTbox_cCFv = .text:0x8026D770; // type:function size:0x8
|
||||
initDowsingTarget__9dAcTbox_cFQ213DowsingTarget11DowsingSlot = .text:0x8026D780; // type:function size:0x50
|
||||
initDowsingTargetCube__9dAcTbox_cFv = .text:0x8026D7D0; // type:function size:0x44
|
||||
noRegisterDowsing = .text:0x8026D820; // type:function size:0x4
|
||||
registersKeyPieceDowsing = .text:0x8026D830; // type:function size:0x68
|
||||
registerRupeeOrTreasureDowsing = .text:0x8026D8A0; // type:function size:0x48
|
||||
@@ -40234,16 +40234,16 @@ lbl_80575900 = .sbss:0x80575900; // type:object size:0x8 data:byte
|
||||
@GUARD@draw__13dAcObjFairy_cFv@rot = .sbss:0x80575908; // type:object size:0x8 data:byte
|
||||
sTboxActorList__9dAcTbox_c = .sbss:0x80575910; // type:object size:0x8 data:4byte
|
||||
CURRENT_OBTAINING_ITEM_OARC_NAME = .sbss:0x80575918; // type:object size:0x4 data:4byte
|
||||
lbl_8057591C = .sbss:0x8057591C; // type:object size:0x1 data:byte
|
||||
lbl_8057591D = .sbss:0x8057591D; // type:object size:0x1 data:byte
|
||||
lbl_8057591E = .sbss:0x8057591E; // type:object size:0x1 data:byte
|
||||
lbl_8057591F = .sbss:0x8057591F; // type:object size:0x1 data:byte
|
||||
lbl_80575920 = .sbss:0x80575920; // type:object size:0x1 data:byte
|
||||
lbl_80575921 = .sbss:0x80575921; // type:object size:0x1 data:byte
|
||||
lbl_80575922 = .sbss:0x80575922; // type:object size:0x1 data:byte
|
||||
lbl_80575923 = .sbss:0x80575923; // type:object size:0x1 data:byte
|
||||
lbl_80575924 = .sbss:0x80575924; // type:object size:0x1 data:byte
|
||||
lbl_80575925 = .sbss:0x80575925; // type:object size:0x1 data:byte
|
||||
@GUARD@create__9dAcTbox_cFv@s1 = .sbss:0x8057591C; // type:object size:0x1 data:byte
|
||||
@GUARD@create__9dAcTbox_cFv@s2@0 = .sbss:0x8057591D; // type:object size:0x1 data:byte
|
||||
@GUARD@create__9dAcTbox_cFv@bbLo@3 = .sbss:0x8057591E; // type:object size:0x1 data:byte
|
||||
@GUARD@create__9dAcTbox_cFv@bbUp@4 = .sbss:0x8057591F; // type:object size:0x1 data:byte
|
||||
@GUARD@create__9dAcTbox_cFv@bbLo@5 = .sbss:0x80575920; // type:object size:0x1 data:byte
|
||||
@GUARD@create__9dAcTbox_cFv@bbUp@6 = .sbss:0x80575921; // type:object size:0x1 data:byte
|
||||
@GUARD@create__9dAcTbox_cFv@bbLo@7 = .sbss:0x80575922; // type:object size:0x1 data:byte
|
||||
@GUARD@create__9dAcTbox_cFv@bbUp@8 = .sbss:0x80575923; // type:object size:0x1 data:byte
|
||||
@GUARD@create__9dAcTbox_cFv@bbLo@9 = .sbss:0x80575924; // type:object size:0x1 data:byte
|
||||
@GUARD@create__9dAcTbox_cFv@bbUp@10 = .sbss:0x80575925; // type:object size:0x1 data:byte
|
||||
lbl_80575926 = .sbss:0x80575926; // type:object size:0x1 data:byte
|
||||
lbl_80575927 = .sbss:0x80575927; // type:object size:0x1 data:byte
|
||||
lbl_80575928 = .sbss:0x80575928; // type:object size:0x8 data:byte
|
||||
|
||||
@@ -55,6 +55,9 @@ public:
|
||||
static int getTotalArrowCount();
|
||||
static int getTotalSeedCount();
|
||||
|
||||
static bool isKeyPiece(ITEM_ID item);
|
||||
static bool isTreasure(ITEM_ID item);
|
||||
|
||||
private:
|
||||
/* 0x334 */ UNKTYPE *mpMdl; // Model has its own handling system
|
||||
/* 0x338 */ dShadowCircle_c mShdw;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef D_A_OBJ_TBOX_H
|
||||
#define D_A_OBJ_TBOX_H
|
||||
|
||||
#include "common.h"
|
||||
#include "d/a/d_a_base.h"
|
||||
#include "d/a/d_a_item.h"
|
||||
#include "d/a/obj/d_a_obj_base.h"
|
||||
@@ -14,6 +15,7 @@
|
||||
#include "m/m3d/m_anmtexsrt.h"
|
||||
#include "m/m3d/m_smdl.h"
|
||||
#include "m/m_vec.h"
|
||||
#include "nw4r/ut/ut_Color.h"
|
||||
#include "s/s_State.hpp"
|
||||
#include "toBeSorted/actor_event.h"
|
||||
#include "toBeSorted/dowsing_target.h"
|
||||
@@ -37,14 +39,29 @@ public:
|
||||
struct TboxAndMoreUnkCC {
|
||||
cListMg_c mList;
|
||||
virtual ~TboxAndMoreUnkCC();
|
||||
|
||||
void addCc(dAcTboxCcD &ccD, const dCcD_SrcUnk &src);
|
||||
void SetStts(cCcD_Stts &stts);
|
||||
};
|
||||
|
||||
class dAcTbox_c : public dAcObjBase_c {
|
||||
public:
|
||||
enum TboxVariant_e {
|
||||
NORMAL,
|
||||
SMALL,
|
||||
BOSS,
|
||||
GODDESS,
|
||||
};
|
||||
|
||||
dAcTbox_c();
|
||||
virtual ~dAcTbox_c();
|
||||
|
||||
virtual bool createHeap() override;
|
||||
virtual int create() override;
|
||||
virtual int doDelete() override;
|
||||
virtual int actorExecute() override;
|
||||
virtual int actorExecuteInEvent() override;
|
||||
virtual int draw() override;
|
||||
|
||||
STATE_FUNC_DECLARE(dAcTbox_c, DugOut);
|
||||
STATE_FUNC_DECLARE(dAcTbox_c, WaitAppear);
|
||||
@@ -63,9 +80,31 @@ public:
|
||||
private:
|
||||
bool initBgW(dBgW &bg, const char *arcName, const char *ccName);
|
||||
bool isNotSmall() const;
|
||||
void setItemId(u16 item) const;
|
||||
void setChestFlag();
|
||||
void setDoObstructionCheck();
|
||||
int isActualVisibleBox() const;
|
||||
void fn_8026B380(mVec3_c &outResult) const;
|
||||
const mVec3_c &fn_8026B3C0() const;
|
||||
|
||||
bool noObstructionCheck() const;
|
||||
int fn_8026B370() const;
|
||||
bool fn_8026D670() const;
|
||||
bool getSomeCounter(u32 *outIndex) const;
|
||||
bool checkTboxFlag() const;
|
||||
bool fn_8026D560() const;
|
||||
bool isItemRupee() const;
|
||||
void initDowsingTarget(DowsingTarget::DowsingSlot slot);
|
||||
void initDowsingTargetCube();
|
||||
|
||||
void registerRupeeOrTreasureDowsing();
|
||||
void registerKeyPieceDowsing();
|
||||
void unregisterDowsing();
|
||||
void noRegisterDowsing();
|
||||
void noUnregisterDowsing();
|
||||
|
||||
static bool fn_80268660(int arg);
|
||||
|
||||
/* 0x0330 */ m3d::mdlAnmChr mMdl1;
|
||||
/* 0x0398 */ m3d::smdl_c mOpenFxMdl;
|
||||
/* 0x03B4 */ m3d::anmMatClr_c mAnmMatClr1;
|
||||
@@ -78,11 +117,9 @@ private:
|
||||
/* 0x04D4 */ dShadowCircle_c mShadowCircle;
|
||||
|
||||
// Could be part of an aggregate structure
|
||||
s32 field_0x4DC;
|
||||
s32 field_0x4E0;
|
||||
s32 field_0x4E4;
|
||||
s32 field_0x4E8;
|
||||
s32 field_0x4EC;
|
||||
mVec3_c field_0x4DC;
|
||||
nw4r::ut::Color field_0x4E8;
|
||||
f32 field_0x4EC;
|
||||
s32 field_0x4F0;
|
||||
s32 field_0x4F4;
|
||||
|
||||
@@ -98,10 +135,47 @@ private:
|
||||
/* 0x1144 */ dAcRef_c<dAcItem_c> mItemRef;
|
||||
/* 0x1150 */ DowsingTarget mDowsingTarget1;
|
||||
/* 0x1170 */ DowsingTarget mDowsingTarget2;
|
||||
/* 0x1190 */ void (dAcTbox_c::*mRegisterDowsingTarget)();
|
||||
/* 0x119C */ void (dAcTbox_c::*mUnregisterDowsingTarget)();
|
||||
|
||||
/* 0x11A8 */ u8 field_0x11A8[0x11D8 - 0x11A8];
|
||||
|
||||
/* 0x11D8 */ mVec3_c field_0x11D8;
|
||||
|
||||
/* 0x11E4 */ u8 field_0x11E4[0x11EC - 0x11E4];
|
||||
|
||||
/* 0x11EC */ f32 field_0x11EC;
|
||||
/* 0x11F0 */ UNKWORD field_0x11F0;
|
||||
|
||||
/* 0x11F4 */ u8 field_0x11F4[0x11FC - 0x11F4];
|
||||
|
||||
/* 0x11FC */ UNKWORD field_0x11FC;
|
||||
|
||||
/* 0x1200 */ u16 mItemId;
|
||||
|
||||
/* 0x1202 */ u8 field_0x1202[0x1204 - 0x1202];
|
||||
|
||||
/* 0x1204 */ bool mHasBeenOpened;
|
||||
/* 0x1209 */ u8 mVariant;
|
||||
/* 0x1205 */ u8 mSpawnSceneFlag;
|
||||
/* 0x1206 */ u8 mSetSceneFlag; // set when?
|
||||
|
||||
/* 0x1207 */ u8 field_0x1207;
|
||||
|
||||
/* 0x1208 */ u8 field_0x1208;
|
||||
/* 0x1209 */ u8 mVariant;
|
||||
/* 0x120A */ u8 field_0x120A;
|
||||
|
||||
/* 0x120B */ u8 field_0x120B[0x120D - 0x120B];
|
||||
|
||||
/* 0x120D */ u8 field_0x120D;
|
||||
|
||||
/* 0x120E */ u8 field_0x120E;
|
||||
|
||||
/* 0x120F */ bool field_0x120F;
|
||||
/* 0x1210 */ bool field_0x1210;
|
||||
/* 0x1211 */ bool mDoObstructedCheck;
|
||||
|
||||
static const cCcD_SrcGObj sColSrc;
|
||||
static fLiMgBa_c sTboxActorList;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
#include "d/a/obj/d_a_obj_tbox.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "d/a/d_a_item.h"
|
||||
#include "d/a/d_a_itembase.h"
|
||||
#include "d/col/cc/d_cc_d.h"
|
||||
#include "d/flag/sceneflag_manager.h"
|
||||
#include "d/flag/storyflag_manager.h"
|
||||
#include "m/m3d/m_fanm.h"
|
||||
#include "m/m_mtx.h"
|
||||
#include "m/m_vec.h"
|
||||
#include "nw4r/g3d/g3d_resanmchr.h"
|
||||
@@ -60,6 +65,33 @@ extern "C" char *const sOpenEventNames[] = {
|
||||
"TreasureBoxOpen",
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
// TODO just copied from somewhere
|
||||
const cCcD_SrcGObj dAcTbox_c::sColSrc = {
|
||||
/* mObjAt */ {0, 0, {0, 0, 0}, 0, 0, 0, 0, 0, 0},
|
||||
/* mObjTg */ {~(AT_TYPE_BUGNET | AT_TYPE_BEETLE | AT_TYPE_0x80000 | AT_TYPE_0x8000 | AT_TYPE_WIND), 0x1080111, {6, 0x407}, 0, 0},
|
||||
/* mObjCo */ {0x0}
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
// TODO enum, item comments
|
||||
static const u8 sItemToTBoxVariant[MAX_ITEM_ID + 1] = {
|
||||
0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 0, 2, 2, 2, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 3, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 3, 3, 3, 3, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
};
|
||||
|
||||
static char *const sMdlNames[] = {
|
||||
"TBoxNormalT",
|
||||
"TBoxSmallT",
|
||||
@@ -90,8 +122,7 @@ static char *const sOpenCcNames[] = {
|
||||
|
||||
dAcTbox_c::dAcTbox_c()
|
||||
: mStateMgr(*this, sStateID::null), mScnCallback(this), mEvent(*this, nullptr), mTboxListNode(this),
|
||||
mDowsingTarget1(this, DowsingTarget::SLOT_NONE), mDowsingTarget2(this, DowsingTarget::SLOT_NONE),
|
||||
field_0x4E8(-1) {
|
||||
mDowsingTarget1(this, DowsingTarget::SLOT_NONE), mDowsingTarget2(this, DowsingTarget::SLOT_NONE) {
|
||||
sTboxActorList.append(&mTboxListNode);
|
||||
unkByteTargetFiRelated = 2;
|
||||
}
|
||||
@@ -117,7 +148,7 @@ bool dAcTbox_c::createHeap() {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mVariant == 3) {
|
||||
if (mVariant == GODDESS) {
|
||||
nw4r::g3d::ResFile res = data;
|
||||
if (!res.mFile.IsValid()) {
|
||||
return false;
|
||||
@@ -145,7 +176,7 @@ bool dAcTbox_c::createHeap() {
|
||||
}
|
||||
mMdl1.getModel().setAnm(mAnmGoddessTexSrt);
|
||||
}
|
||||
} else if (mVariant == 0) {
|
||||
} else if (mVariant == NORMAL) {
|
||||
nw4r::g3d::ResFile res = data;
|
||||
if (!res.mFile.IsValid()) {
|
||||
return false;
|
||||
@@ -224,13 +255,223 @@ bool dAcTbox_c::createHeap() {
|
||||
return true;
|
||||
}
|
||||
|
||||
static u32 sSomeCounters[16] = {};
|
||||
|
||||
int dAcTbox_c::create() {
|
||||
if (!isActualVisibleBox()) {
|
||||
return FAILED;
|
||||
}
|
||||
int roomId_tmp = roomid;
|
||||
if (addActorToRoom(-1)) {
|
||||
roomid = roomId_tmp;
|
||||
changeLoadedEntitiesWithSet();
|
||||
}
|
||||
setItemId((ITEM_ID)(rotation.z & 0x1FF));
|
||||
if (mItemId > MAX_ITEM_ID) {
|
||||
return FAILED;
|
||||
}
|
||||
mVariant = sItemToTBoxVariant[mItemId];
|
||||
if (mVariant == GODDESS) {
|
||||
setItemId((ITEM_ID)(MAX_ITEM_ID - mItemId));
|
||||
}
|
||||
mSpawnSceneFlag = (params >> 0x14) & 0xFF;
|
||||
mSetSceneFlag = rotation.x & 0xFF;
|
||||
setChestFlag();
|
||||
field_0x120F = ((rotation.x >> 8) & 1) == 0;
|
||||
if (!noObstructionCheck()) {
|
||||
setDoObstructionCheck();
|
||||
}
|
||||
field_0x1208 = (rotation.x >> 0xA) & 0xF;
|
||||
switch (fn_8026B370()) {
|
||||
case 0: field_0x120A = 0; break;
|
||||
case 1: field_0x120A = 1; break;
|
||||
case 3: field_0x120A = 3; break;
|
||||
default: field_0x120A = 3; break;
|
||||
}
|
||||
rotation.z = 0;
|
||||
rotation.x = 0;
|
||||
|
||||
// This part of the code checks if there's another chest with similar properties
|
||||
// and only keeps one of them.
|
||||
if (fn_80268660(field_0x1208) && !field_0x1210) {
|
||||
sSomeCounters[field_0x1208]++;
|
||||
field_0x1210 = true;
|
||||
}
|
||||
field_0x120D = 0;
|
||||
if (fn_8026D670()) {
|
||||
u32 counterValue = 0;
|
||||
getSomeCounter(&counterValue);
|
||||
if (counterValue > 1) {
|
||||
bool keepGoing = true;
|
||||
dAcTbox_c *other;
|
||||
dAcObjBase_c *cursor = nullptr;
|
||||
do {
|
||||
cursor = getNextObject(&sTboxActorList, cursor);
|
||||
other = static_cast<dAcTbox_c *>(cursor);
|
||||
if (other != nullptr && this != other && !other->field_0x120D && field_0x1208 == other->field_0x1208) {
|
||||
keepGoing = false;
|
||||
}
|
||||
} while (keepGoing && cursor != nullptr);
|
||||
|
||||
bool b;
|
||||
if (checkTboxFlag()) {
|
||||
b = true;
|
||||
} else if (other->checkTboxFlag()) {
|
||||
b = false;
|
||||
} else {
|
||||
b = fn_8026D560();
|
||||
}
|
||||
|
||||
if (b) {
|
||||
other->deleteRequest();
|
||||
field_0x120D = true;
|
||||
} else {
|
||||
field_0x120D = true;
|
||||
return FAILED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (checkTboxFlag() ||
|
||||
(mSetSceneFlag < 0xFF && SceneflagManager::sInstance->checkBoolFlag(roomid, mSetSceneFlag))) {
|
||||
mHasBeenOpened = true;
|
||||
} else {
|
||||
mHasBeenOpened = false;
|
||||
if (isItemRupee()) {
|
||||
initDowsingTarget(DowsingTarget::SLOT_RUPEE);
|
||||
} else if (dAcItem_c::isKeyPiece((ITEM_ID)mItemId)) {
|
||||
initDowsingTarget(DowsingTarget::SLOT_QUEST);
|
||||
} else if (dAcItem_c::isTreasure((ITEM_ID)mItemId)) {
|
||||
initDowsingTarget(DowsingTarget::SLOT_TREASURE);
|
||||
}
|
||||
|
||||
if (mVariant == GODDESS && StoryflagManager::sInstance->getCounterOrFlag(getParams2Lower())) {
|
||||
initDowsingTargetCube();
|
||||
}
|
||||
}
|
||||
|
||||
if (isItemRupee() || dAcItem_c::isTreasure((ITEM_ID)mItemId)) {
|
||||
mRegisterDowsingTarget = &dAcTbox_c::registerRupeeOrTreasureDowsing;
|
||||
mUnregisterDowsingTarget = &dAcTbox_c::unregisterDowsing;
|
||||
} else if (dAcItem_c::isKeyPiece((ITEM_ID)mItemId)) {
|
||||
mRegisterDowsingTarget = &dAcTbox_c::registerKeyPieceDowsing;
|
||||
mUnregisterDowsingTarget = &dAcTbox_c::noUnregisterDowsing;
|
||||
} else {
|
||||
mRegisterDowsingTarget = &dAcTbox_c::noRegisterDowsing;
|
||||
mUnregisterDowsingTarget = &dAcTbox_c::noUnregisterDowsing;
|
||||
}
|
||||
|
||||
updateMatrix();
|
||||
|
||||
CREATE_ALLOCATOR(dAcTbox_c);
|
||||
|
||||
mStts.SetRank(0xD);
|
||||
static const dCcD_SrcUnk s1 = {
|
||||
sColSrc,
|
||||
{0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f},
|
||||
};
|
||||
mCcD3.Set(s1);
|
||||
mCcD4.SetStts(mStts);
|
||||
static const dCcD_SrcCyl s2 = {
|
||||
sColSrc,
|
||||
{1.0f, 1.0f},
|
||||
};
|
||||
mCcD4.Set(s2);
|
||||
mCcD4.SetStts(mStts);
|
||||
if (mVariant == SMALL) {
|
||||
// clang-format off
|
||||
static const dCcD_SrcUnk s3 = {{
|
||||
/* mObjAt */ {0, 0, {0, 0, 0}, 0, 0, 0, 0, 0, 0},
|
||||
/* mObjTg */ {~(AT_TYPE_BUGNET | AT_TYPE_BEETLE | AT_TYPE_0x80000 | AT_TYPE_0x8000 | AT_TYPE_WIND), 0x1080111, {6, 0x407}, 0, 0},
|
||||
/* mObjCo */ {0x0}},
|
||||
{0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f},
|
||||
};
|
||||
// clang-format on
|
||||
field_0x0D48.addCc(mCcD1, s3);
|
||||
field_0x0D48.addCc(mCcD2, s3);
|
||||
} else {
|
||||
// clang-format off
|
||||
static const dCcD_SrcUnk s4 = {{
|
||||
/* mObjAt */ {0, 0, {0, 0, 0}, 0, 0, 0, 0, 0, 0},
|
||||
/* mObjTg */ {~(AT_TYPE_BUGNET | AT_TYPE_BEETLE | AT_TYPE_0x80000 | AT_TYPE_0x8000 | AT_TYPE_WIND), 0x1080111, {6, 0x407}, 0, 0},
|
||||
/* mObjCo */ {0x0}},
|
||||
{0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f},
|
||||
};
|
||||
// clang-format on
|
||||
field_0x0D48.addCc(mCcD1, s4);
|
||||
field_0x0D48.addCc(mCcD2, s4);
|
||||
}
|
||||
field_0x0D48.SetStts(mStts);
|
||||
// TODO figure out the right fields
|
||||
mCcD1.SetTgType(-1);
|
||||
mCcD2.SetTgType(-1);
|
||||
mMdl1.setAnm(sAnmNames[mVariant], m3d::PLAY_MODE_4);
|
||||
if (mHasBeenOpened == true) {
|
||||
mMdl1.setFrame(mMdl1.getAnm().getEndFrame());
|
||||
} else {
|
||||
mMdl1.setFrame(mMdl1.getAnm().getStartFrame());
|
||||
}
|
||||
mMdl1.getModel().calc(false);
|
||||
mMtx_c nodeMtx;
|
||||
mMdl1.getModel().getNodeWorldMtx(mMdl1.getModel().getNodeID("Cover"), nodeMtx);
|
||||
|
||||
nodeMtx.getTranslation(field_0x11D8);
|
||||
if (mVariant == GODDESS) {
|
||||
if (!mHasBeenOpened && StoryflagManager::sInstance->getCounterOrFlag(getParams2Lower())) {
|
||||
mAnmGoddessPat.setFrame(1.0f, 0);
|
||||
} else {
|
||||
mAnmGoddessPat.setFrame(0.0f, 0);
|
||||
}
|
||||
}
|
||||
|
||||
field_0x11F0 = 0;
|
||||
switch (mVariant) {
|
||||
case NORMAL: {
|
||||
static mVec3_c bbLo = mVec3_c(-65.0f, 0.0f, -100.0f);
|
||||
static mVec3_c bbUp = mVec3_c(65.0f, 150.0f, 45.0f);
|
||||
boundingBox.Set(bbLo, bbUp);
|
||||
} break;
|
||||
case SMALL: {
|
||||
static mVec3_c bbLo = mVec3_c(-38.0f, 0.0f, -70.0f);
|
||||
static mVec3_c bbUp = mVec3_c(38.0f, 110.0f, 35.0f);
|
||||
boundingBox.Set(bbLo, bbUp);
|
||||
} break;
|
||||
case BOSS: {
|
||||
static mVec3_c bbLo = mVec3_c(-90.0f, 0.0f, -140.0f);
|
||||
static mVec3_c bbUp = mVec3_c(90.0f, 170.0f, 60.0f);
|
||||
boundingBox.Set(bbLo, bbUp);
|
||||
} break;
|
||||
case GODDESS: {
|
||||
static mVec3_c bbLo = mVec3_c(-65.0f, 0.0f, -100.0f);
|
||||
static mVec3_c bbUp = mVec3_c(65.0f, 150.0f, 50.0f);
|
||||
boundingBox.Set(bbLo, bbUp);
|
||||
} break;
|
||||
}
|
||||
|
||||
field_0x11EC = 1.0f;
|
||||
field_0x11FC = 0;
|
||||
|
||||
field_0x4E8.r = 0;
|
||||
field_0x4E8.g = 0;
|
||||
field_0x4E8.b = 0;
|
||||
|
||||
field_0x4EC = 0.0f;
|
||||
field_0x4DC = position;
|
||||
field_0x4DC.y += 100.0f;
|
||||
|
||||
return SUCCEEDED;
|
||||
}
|
||||
|
||||
void dAcTbox_c::initializeState_DugOut() {}
|
||||
void dAcTbox_c::executeState_DugOut() {}
|
||||
void dAcTbox_c::finalizeState_DugOut() {}
|
||||
void dAcTbox_c::initializeState_WaitAppear() {}
|
||||
void dAcTbox_c::executeState_WaitAppear() {}
|
||||
void dAcTbox_c::finalizeState_WaitAppear() {}
|
||||
void dAcTbox_c::initializeState_DemoAppear() {}
|
||||
void dAcTbox_c::initializeState_DemoAppear() {
|
||||
// TODO, just referencing this bit of data
|
||||
mMdl1.setAnm(sAppearAnmName, m3d::PLAY_MODE_4);
|
||||
}
|
||||
void dAcTbox_c::executeState_DemoAppear() {}
|
||||
void dAcTbox_c::finalizeState_DemoAppear() {}
|
||||
void dAcTbox_c::initializeState_WaitOpen() {}
|
||||
@@ -265,5 +506,5 @@ void dAcTbox_c::executeState_GoddessWait() {}
|
||||
void dAcTbox_c::finalizeState_GoddessWait() {}
|
||||
|
||||
bool dAcTbox_c::isNotSmall() const {
|
||||
return mVariant != 1;
|
||||
return mVariant != SMALL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user