diff --git a/.vscode/settings.json b/.vscode/settings.json index af435d1bb98..34e953cfd49 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -36,7 +36,7 @@ "build/**/*.lcf": true, "build/**/*.preplf": true, "build/**/*.d": true, - "build/**/*.s": true, + // "build/**/*.s": true, "build/**/*.map": true, "build/**/*.cpp": true, "build/**/*.ctx": true, diff --git a/config/GZ2E01/rels/d_a_boomerang/symbols.txt b/config/GZ2E01/rels/d_a_boomerang/symbols.txt index 158fd9a459e..1e869c1d515 100644 --- a/config/GZ2E01/rels/d_a_boomerang/symbols.txt +++ b/config/GZ2E01/rels/d_a_boomerang/symbols.txt @@ -163,9 +163,13 @@ __vt__19daBoomerang_sight_c = .data:0x000001E4; // type:object size:0x10 scope:g @1010 = .bss:0x00000038; // type:object size:0x1 scope:local @1009 = .bss:0x0000003C; // type:object size:0x1 scope:local l_HIO = .bss:0x00000040; // type:object size:0x1 scope:global +init$2449 = .bss:0x00000041; // type:object size:0x1 scope:local align:1 effDirection$5075 = .bss:0x00000044; // type:object size:0xC scope:local +init$2452 = .bss:0x00000050; // type:object size:0x1 scope:local align:1 effScale0$5078 = .bss:0x00000054; // type:object size:0xC scope:local +init$2455 = .bss:0x00000060; // type:object size:0x1 scope:local align:1 effScaleSand$5081 = .bss:0x00000064; // type:object size:0xC scope:local +init$2458 = .bss:0x00000070; // type:object size:0x1 scope:local align:1 effScaleGrass$5084 = .bss:0x00000074; // type:object size:0xC scope:local sInstance__40JASGlobalInstance<19JASDefaultBankTable> = .bss:0x00000080; // type:object size:0x4 scope:global sInstance__35JASGlobalInstance<14JASAudioThread> = .bss:0x00000084; // type:object size:0x4 scope:global diff --git a/config/GZ2E01/rels/d_a_horse/symbols.txt b/config/GZ2E01/rels/d_a_horse/symbols.txt index 3c2eb6c338b..8142a966d3b 100644 --- a/config/GZ2E01/rels/d_a_horse/symbols.txt +++ b/config/GZ2E01/rels/d_a_horse/symbols.txt @@ -322,32 +322,44 @@ l_frontFootOffset = .bss:0x00000054; // type:object size:0xC scope:global align: @4180 = .bss:0x00000060; // type:object size:0xC scope:local l_backFootOffset = .bss:0x0000006C; // type:object size:0xC scope:global align:4 data:float @7279 = .bss:0x00000078; // type:object size:0xC scope:local +init$4891 = .bss:0x00000084; // type:object size:0x1 scope:local align:1 localEyePos$7278 = .bss:0x00000088; // type:object size:0xC scope:local @7469 = .bss:0x00000094; // type:object size:0xC scope:local runScale$7468 = .bss:0x000000A4; // type:object size:0xC scope:local @7473 = .bss:0x000000B0; // type:object size:0xC scope:local landScale$7472 = .bss:0x000000C0; // type:object size:0xC scope:local @7477 = .bss:0x000000CC; // type:object size:0xC scope:local +init$5083 = .bss:0x000000D8; // type:object size:0x1 scope:local align:1 grassRunScale$7476 = .bss:0x000000DC; // type:object size:0xC scope:local @7481 = .bss:0x000000E8; // type:object size:0xC scope:local +init$5091 = .bss:0x000000F4; // type:object size:0x1 scope:local align:1 waterDirection$7480 = .bss:0x000000F8; // type:object size:0xC scope:local @8516 = .bss:0x00000104; // type:object size:0xC scope:local +init$6089 = .bss:0x00000110; // type:object size:0x1 scope:local align:1 reinLeftStart$8515 = .bss:0x00000114; // type:object size:0xC scope:local @8520 = .bss:0x00000120; // type:object size:0xC scope:local +init$6093 = .bss:0x0000012C; // type:object size:0x1 scope:local align:1 reinRightStart$8519 = .bss:0x00000130; // type:object size:0xC scope:local @8524 = .bss:0x0000013C; // type:object size:0xC scope:local +init$6097 = .bss:0x00000148; // type:object size:0x1 scope:local align:1 localNeckLeft$8523 = .bss:0x0000014C; // type:object size:0xC scope:local @8528 = .bss:0x00000158; // type:object size:0xC scope:local +init$6101 = .bss:0x00000164; // type:object size:0x1 scope:local align:1 localNeckRight$8527 = .bss:0x00000168; // type:object size:0xC scope:local @8753 = .bss:0x00000174; // type:object size:0xC scope:local +init$6311 = .bss:0x00000180; // type:object size:0x1 scope:local align:1 saddleLeft$8752 = .bss:0x00000184; // type:object size:0xC scope:local @8757 = .bss:0x00000190; // type:object size:0xC scope:local +init$6315 = .bss:0x0000019C; // type:object size:0x1 scope:local align:1 saddleRight$8756 = .bss:0x000001A0; // type:object size:0xC scope:local @8813 = .bss:0x000001AC; // type:object size:0xC scope:local +init$6374 = .bss:0x000001B8; // type:object size:0x1 scope:local align:1 localCenterPos$8812 = .bss:0x000001BC; // type:object size:0xC scope:local @8817 = .bss:0x000001C8; // type:object size:0xC scope:local +init$6378 = .bss:0x000001D4; // type:object size:0x1 scope:local align:1 localFrontPos$8816 = .bss:0x000001D8; // type:object size:0xC scope:local @8821 = .bss:0x000001E4; // type:object size:0xC scope:local +init$6382 = .bss:0x000001F0; // type:object size:0x1 scope:local align:1 localBackPos$8820 = .bss:0x000001F4; // type:object size:0xC scope:local sInstance__40JASGlobalInstance<19JASDefaultBankTable> = .bss:0x00000200; // type:object size:0x4 scope:global sInstance__35JASGlobalInstance<14JASAudioThread> = .bss:0x00000204; // type:object size:0x4 scope:global diff --git a/configure.py b/configure.py index 0d4c8e39efd..58c9ddb4b6d 100755 --- a/configure.py +++ b/configure.py @@ -1614,7 +1614,7 @@ config.libs = [ ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_arrow"), ActorRel(NonMatching, "d_a_boomerang"), ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_crod"), - ActorRel(NonMatching, "d_a_demo00"), + ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_demo00"), ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_disappear"), ActorRel(NonMatching, "d_a_mg_rod"), ActorRel(Equivalent, "d_a_midna"), # weak func order diff --git a/include/JSystem/J3DGraphAnimator/J3DAnimation.h b/include/JSystem/J3DGraphAnimator/J3DAnimation.h index 1003219d241..1ebc3f67c3c 100644 --- a/include/JSystem/J3DGraphAnimator/J3DAnimation.h +++ b/include/JSystem/J3DGraphAnimator/J3DAnimation.h @@ -919,11 +919,12 @@ public: class J3DFrameCtrl { public: enum Attribute_e { - EMode_NONE, - EMode_RESET, - EMode_LOOP, - EMode_REVERSE, - EMode_LOOP_REVERSE, + /* -1 */ EMode_NULL = -1, + /* 0x0 */ EMode_NONE, + /* 0x1 */ EMode_RESET, + /* 0x2 */ EMode_LOOP, + /* 0x3 */ EMode_REVERSE, + /* 0x4 */ EMode_LOOP_REVERSE, }; J3DFrameCtrl() { this->init(0); } diff --git a/include/JSystem/J3DGraphAnimator/J3DJoint.h b/include/JSystem/J3DGraphAnimator/J3DJoint.h index beb4004dcfe..9510ceb4155 100644 --- a/include/JSystem/J3DGraphAnimator/J3DJoint.h +++ b/include/JSystem/J3DGraphAnimator/J3DJoint.h @@ -84,7 +84,7 @@ public: static J3DMtxCalc* mCurrentMtxCalc; - u8 getKind() { return mKind & 15; } + u8 getKind() const { return mKind & 15; } private: friend struct J3DJointFactory; diff --git a/include/JSystem/JStudio/JStudio/functionvalue.h b/include/JSystem/JStudio/JStudio/functionvalue.h index 5e430e199cd..ba881ed2d46 100644 --- a/include/JSystem/JStudio/JStudio/functionvalue.h +++ b/include/JSystem/JStudio/JStudio/functionvalue.h @@ -79,7 +79,7 @@ public: class TFunctionValueAttribute_refer : public JGadget::TVector_pointer { public: - inline TFunctionValueAttribute_refer(); + TFunctionValueAttribute_refer() : JGadget::TVector_pointer(JGadget::TAllocator()) {} ~TFunctionValueAttribute_refer() {} /* 802816E8 */ void refer_initialize(); diff --git a/include/d/actor/d_a_demo00.h b/include/d/actor/d_a_demo00.h index 5a9cc4d21da..e4c40640737 100644 --- a/include/d/actor/d_a_demo00.h +++ b/include/d/actor/d_a_demo00.h @@ -7,13 +7,10 @@ struct demo_s1_ke_s { public: - /* 804A4420 */ ~demo_s1_ke_s(); - /* 804A86B4 */ demo_s1_ke_s(); - /* 0x000 */ cXyz field_0x0[16]; /* 0x0C0 */ cXyz field_0xc0[16]; /* 0x180 */ cXyz field_0x180; -}; +}; // Size: 0x18C class daDemo00_resID_c { public: @@ -28,20 +25,12 @@ public: /* 0x18 */ u32 field_0x18; /* 0x1C */ u32 field_0x1c; /* 0x20 */ u32 field_0x20; -}; - -class daDemo00_model_c { -public: - /* 804A4338 */ void reset(); - - /* 0x00 */ daDemo00_resID_c field_0x0; - /* 0x24 */ daDemo00_resID_c mID; -}; +}; // Size: 0x24 struct daDemo00_bgc_c { /* 0x00 */ dBgS_GndChk mGndChk; /* 0x54 */ f32 field_0x54; -}; +}; // Size: 0x58 struct daDemo00_shadow_c { /* 0x00 */ u32 field_0x0; @@ -49,7 +38,25 @@ struct daDemo00_shadow_c { /* 0x10 */ cXyz field_0x10; /* 0x1C */ f32 field_0x1c; /* 0x20 */ f32 field_0x20; -}; +}; // Size: 0x24 + +class daDemo00_model_c { +public: + /* 804A4338 */ void reset(); + + /* 0x00 */ daDemo00_resID_c mID; + /* 0x24 */ mDoExt_McaMorfSO* mpModelMorf; + /* 0x28 */ J3DModel* field_0x5d4; + /* 0x2C */ mDoExt_invisibleModel* field_0x5d8; + /* 0x30 */ mDoExt_bpkAnm* mpBpkAnm; + /* 0x34 */ mDoExt_btpAnm* mpBtpAnm; + /* 0x38 */ mDoExt_btkAnm* mpBtkAnm; + /* 0x3C */ mDoExt_brkAnm* mpBrkAnm; + /* 0x40 */ daDemo00_shadow_c* mShadow; + /* 0x44 */ J3DDeformData* mDeformData; + /* 0x48 */ mDoExt_blkAnm* mpBlkAnm; + /* 0x4C */ daDemo00_bgc_c* mBgc; +}; // Size: 0x50 /** * @ingroup actors-unsorted @@ -73,34 +80,20 @@ public: /* 804A6F94 */ int draw(); /* 804A7BA8 */ int execute(); - int create() { - dKy_tevstr_init(&tevStr, dComIfGp_roomControl_getStayNo(), 0xFF); - tevStr.field_0x384 = 1; - mSound.init(&eyePos, NULL, 10, 1); - setAction(&daDemo00_c::actStandby); - mModel.field_0x0.reset(); - field_0x6a0 = -1; - return 4; - } + int create(); void setAction(actionFunc action) { field_0x57c = action; } void action(dDemo_actor_c* actor) { (this->*field_0x57c)(actor); } /* 0x0568 */ cXyz field_0x568; /* 0x0574 */ csXyz field_0x574; + #ifdef DEBUG + cXyz debug_field_0x570; + csXyz debug_field_0x57c; + #endif /* 0x057C */ actionFunc field_0x57c; - /* 0x0584 */ daDemo00_model_c mModel; - /* 0x05D0 */ mDoExt_McaMorfSO* mpModelMorf; - /* 0x05D4 */ J3DModel* field_0x5d4; - /* 0x05D8 */ mDoExt_invisibleModel* field_0x5d8; - /* 0x05DC */ mDoExt_bpkAnm* mpBpkAnm; - /* 0x05E0 */ mDoExt_btpAnm* mpBtpAnm; - /* 0x05E4 */ mDoExt_btkAnm* mpBtkAnm; - /* 0x05E8 */ mDoExt_brkAnm* mpBrkAnm; - /* 0x05EC */ daDemo00_shadow_c* mShadow; - /* 0x05F0 */ J3DDeformData* mDeformData; - /* 0x05F4 */ mDoExt_blkAnm* mpBlkAnm; - /* 0x05F8 */ daDemo00_bgc_c* mBgc; + /* 0x0588 */ daDemo00_resID_c field_0x588; + /* 0x05AC */ daDemo00_model_c mModel; /* 0x05FC */ Z2Creature mSound; /* 0x068C */ u32 field_0x68c; /* 0x0690 */ u8 field_0x690[0x694 - 0x690]; @@ -123,9 +116,9 @@ public: /* 0x06AC */ u8 field_0x6ac; /* 0x06AD */ u8 field_0x6ad; /* 0x06AE */ u8 field_0x6ae; - /* 0x06AF */ s8 field_0x6af; - /* 0x06B0 */ s8 field_0x6b0; - /* 0x06B1 */ s8 field_0x6b1; + /* 0x06AF */ u8 field_0x6af; + /* 0x06B0 */ u8 field_0x6b0; + /* 0x06B1 */ u8 field_0x6b1; /* 0x06B2 */ u8 field_0x6b2; /* 0x06B3 */ s8 field_0x6b3; /* 0x06B4 */ s8 field_0x6b4; @@ -143,5 +136,4 @@ public: STATIC_ASSERT(sizeof(daDemo00_c) == 0x292c); - #endif /* D_A_DEMO00_H */ diff --git a/include/d/actor/d_a_horse.h b/include/d/actor/d_a_horse.h index 3bd6f1ef82f..18a65afdcd2 100644 --- a/include/d/actor/d_a_horse.h +++ b/include/d/actor/d_a_horse.h @@ -204,7 +204,7 @@ public: /* 80841084 */ void setBoarHit(fopAc_ac_c*, int); /* 8084116C */ void savePos(); /* 808411D0 */ int callHorseSubstance(cXyz const*); - /* 80841468 */ int setHorsePosAndAngleSubstance(cXyz const*, s16); + /* 80841468 */ void setHorsePosAndAngleSubstance(cXyz const*, s16); /* 808415B4 */ BOOL checkPlayerHeavy(); /* 80841628 */ void setTgCoGrp(u32, u32); /* 80841698 */ void onRideFlgSubstance(); @@ -468,7 +468,7 @@ public: /* 0x18BC */ void (daHorse_c::*m_setReinPosHand)(int); /* 0x18C8 */ void (daHorse_c::*m_setReinPosNormal)(); /* 0x18D4 */ int (daHorse_c::*m_callHorse)(const cXyz*); - /* 0x18E0 */ int (daHorse_c::*m_setHorsePosAngle)(const cXyz* i_pos, s16 i_angle); + /* 0x18E0 */ void (daHorse_c::*m_setHorsePosAngle)(const cXyz* i_pos, s16 i_angle); /* 0x18EC */ void (daHorse_c::*m_onRideFlg)(); /* 0x18F8 */ void (daHorse_c::*m_offRideFlg)(); }; diff --git a/include/d/actor/d_a_npc_shaman.h b/include/d/actor/d_a_npc_shaman.h index 687600325dc..59e60dc41e9 100644 --- a/include/d/actor/d_a_npc_shaman.h +++ b/include/d/actor/d_a_npc_shaman.h @@ -112,9 +112,9 @@ public: static char* mCutNameList[2]; static cutFunc mCutList[2]; - static u16 mEvtBitLabels[6]; - static u16 mTmpBitLabels[6]; - static int mSceneChangeNoTable[48]; + static const u16 mEvtBitLabels[6]; + static const u16 mTmpBitLabels[6]; + static const int mSceneChangeNoTable[48]; static queryFunc mQueries[48]; private: diff --git a/include/d/d_demo.h b/include/d/d_demo.h index 513ffbb2bf2..d01c6a45926 100644 --- a/include/d/d_demo.h +++ b/include/d/d_demo.h @@ -124,7 +124,7 @@ public: void setModel(J3DModel* p_model) { mModel = p_model; } BOOL checkEnable(u16 flag) { return mFlags & flag; } void onEnable(u16 flag) { mFlags |= flag; } - void offEnable(u16 flag) { mFlags &= ~flag; } + void offEnable(u16 flag) { mFlags &= (u16)~flag; } cXyz& getTrans() { return mTrans; } cXyz& getScale() { return mScale; } csXyz& getRatate() { return mRotate; } diff --git a/include/weak_bss_1109_to_1009.h b/include/weak_bss_1109_to_1009.h index 37284302a58..620ac203446 100644 --- a/include/weak_bss_1109_to_1009.h +++ b/include/weak_bss_1109_to_1009.h @@ -1,23 +1,36 @@ #ifndef WEAK_BSS_1109_TO_1009_H #define WEAK_BSS_1109_TO_1009_H -#include "dolphin/types.h" +// Fake header. +// These are some kind of weak objects that get included in the .bss sections of several TUs. +// They each have size 1, and alignment 1 in TWW's debug maps, but alignment 4 in the non-debug maps. +// Their true source is currently unknown, so include this header in TUs that need them to match for now. -static u8 lit_1009[1]; -static u8 lit_1010[1]; -static u8 lit_1012[1]; -static u8 lit_1014[1]; -static u8 lit_1052[1]; -static u8 lit_1053[1]; -static u8 lit_1055[1]; -static u8 lit_1057[1]; -static u8 lit_1094[1]; -static u8 lit_1095[1]; -static u8 lit_1097[1]; -static u8 lit_1099[1]; -static u8 lit_1104[1]; -static u8 lit_1105[1]; -static u8 lit_1107[1]; -static u8 lit_1109[1]; +// A possible origin for one of these could be the constructor of TFunctionValueAttribute_refer in +// functionvalue.h. That constructor includes `JGadget::TAllocator()` in it, which produces +// one weak bss object that has the correct size and alignment. However, we need 16 of them, while +// that only creates one. + +#include "JSystem/JStudio/JStudio/functionvalue.h" // IWYU pragma: keep + +// They each have size 1, and alignment 1 in TWW's debug maps, but alignment 4 in the non-debug maps. +static inline void dummy_bss_1009_to_1109() { + // JGadget::TAllocator(); // @1109 // Already covered by TFunctionValueAttribute_refer's ctor + JGadget::TAllocator(); // @1107 + JGadget::TAllocator(); // @1105 + JGadget::TAllocator(); // @1104 + JGadget::TAllocator(); // @1099 + JGadget::TAllocator(); // @1097 + JGadget::TAllocator(); // @1095 + JGadget::TAllocator(); // @1094 + JGadget::TAllocator(); // @1057 + JGadget::TAllocator(); // @1055 + JGadget::TAllocator(); // @1053 + JGadget::TAllocator(); // @1052 + JGadget::TAllocator(); // @1014 + JGadget::TAllocator(); // @1012 + JGadget::TAllocator(); // @1010 + JGadget::TAllocator(); // @1009 +} #endif // WEAK_BSS_1109_TO_1009_H diff --git a/src/JSystem/JStudio/JStudio/functionvalue.cpp b/src/JSystem/JStudio/JStudio/functionvalue.cpp index f169e00469d..27aa708d252 100644 --- a/src/JSystem/JStudio/JStudio/functionvalue.cpp +++ b/src/JSystem/JStudio/JStudio/functionvalue.cpp @@ -46,9 +46,6 @@ ExtrapolateParameter TFunctionValue::toFunction_outside(int idx) { TFunctionValue::TFunctionValue() {} TFunctionValue::~TFunctionValue() {} -TFunctionValueAttribute_refer::TFunctionValueAttribute_refer() : - JGadget::TVector_pointer(JGadget::TAllocator()) {} - void TFunctionValueAttribute_refer::refer_initialize() { clear(); } diff --git a/src/d/actor/d_a_andsw2.cpp b/src/d/actor/d_a_andsw2.cpp index b726ab3ee3a..cb46c6b3a1e 100644 --- a/src/d/actor/d_a_andsw2.cpp +++ b/src/d/actor/d_a_andsw2.cpp @@ -189,15 +189,17 @@ static int daAndsw2_actionOnAll(daAndsw2_c* i_this) { case 0: case 1: case 5: - case 6: + case 6: { BOOL temp_r0 = i_this->chkAllSw2() != 0; var_r29 = temp_r0; break; + } case 2: - case 3: + case 3: { BOOL temp_r0_2 = i_this->chkSwStatus() != 0; var_r29 = temp_r0_2; break; + } case 4: if (!dComIfGs_isSwitch(i_this->getSwbit(), fopAcM_GetRoomNo(i_this))) { BOOL temp_r0 = i_this->chkSwStatus2() != 0; @@ -302,15 +304,17 @@ static int daAndsw2_actionOff(daAndsw2_c* i_this) { case 0: case 1: case 5: - case 6: + case 6: { BOOL temp_r0 = i_this->chkAllSw2() != 0; var_r29 = temp_r0; break; + } case 2: - case 3: + case 3: { BOOL temp_r0_2 = i_this->chkSwStatus() != 0; var_r29 = temp_r0_2; break; + } case 4: break; } diff --git a/src/d/actor/d_a_bg.cpp b/src/d/actor/d_a_bg.cpp index e566507b5ab..dc836e4af54 100644 --- a/src/d/actor/d_a_bg.cpp +++ b/src/d/actor/d_a_bg.cpp @@ -55,7 +55,7 @@ int daBg_btkAnm_c::create(J3DModelData* i_modelData, J3DAnmTextureSRTKey* i_btk, return 0; } - if (!mpBtk->init(i_modelData, i_btk, i_anmPlay, -1, 1.0f, 0, -1)) { + if (!mpBtk->init(i_modelData, i_btk, i_anmPlay, J3DFrameCtrl::EMode_NULL, 1.0f, 0, -1)) { return 0; } @@ -90,7 +90,7 @@ int daBg_brkAnm_c::create(J3DModelData* i_modelData, J3DAnmTevRegKey* i_brk, int return 0; } - if (!mpBrk->init(i_modelData, i_brk, i_anmPlay, -1, 1.0f, 0, -1)) { + if (!mpBrk->init(i_modelData, i_brk, i_anmPlay, J3DFrameCtrl::EMode_NULL, 1.0f, 0, -1)) { return 0; } diff --git a/src/d/actor/d_a_boomerang.cpp b/src/d/actor/d_a_boomerang.cpp index 41061f37a35..cd147e40c17 100644 --- a/src/d/actor/d_a_boomerang.cpp +++ b/src/d/actor/d_a_boomerang.cpp @@ -117,7 +117,7 @@ static u8 const l_blurTop[12] = { /* 804A2868-804A287A 000018 000C+06 0/0 0/0 0/0 .rodata l_blurRoot */ // unused -static u8 const l_blurRoot[12 + 6] = { +static u8 const l_blurRoot[12] = { 0xC2, 0x20, 0x00, @@ -130,6 +130,10 @@ static u8 const l_blurRoot[12 + 6] = { 0x00, 0x00, 0x00, +}; + +// TODO: what is this? +static const u8 lbl_46_rodata_24[6] = { 0xB4, 0xA0, 0x8C, diff --git a/src/d/actor/d_a_demo00.cpp b/src/d/actor/d_a_demo00.cpp index a3eaed0c682..e9ecc053939 100644 --- a/src/d/actor/d_a_demo00.cpp +++ b/src/d/actor/d_a_demo00.cpp @@ -22,6 +22,29 @@ #include "d/d_debug_viewer.h" #endif +struct UnknownLightData { + u32 field_0x00; + const char* field_0x04; + u32 field_0x08; + u32 field_0x0C; + u32 field_0x10; + u32 field_0x14; +}; // Size: 0x18 + +static UnknownLightData l_lightData = { + 0x01010000, + "V_24_tri_joint", + 0x00010000, + 0x00000000, + 0x00010000, + 0x00000000, +}; + +#ifndef DEBUG +// TODO: what is this? +static const u8 lit_3727[0xC] = {}; +#endif + /* 804A430C-804A4338 0000EC 002C+00 3/3 0/0 0/0 .text reset__16daDemo00_resID_cFv */ void daDemo00_resID_c::reset() { mShapeID = -1; @@ -37,70 +60,83 @@ void daDemo00_resID_c::reset() { /* 804A4338-804A4388 000118 0050+00 1/1 0/0 0/0 .text reset__16daDemo00_model_cFv */ void daDemo00_model_c::reset() { - // NONMATCHING - field_0x0.reset(); - mID.mShapeID = 0; - mID.field_0xc = 0; - mID.field_0x10 = 0; - mID.field_0x14 = 0; - mID.field_0x8 = 0; - mID.field_0x18 = 0; - mID.field_0x1c = 0; - mID.field_0x20 = 0; + mID.reset(); + field_0x5d4 = NULL; + mpBtpAnm = NULL; + mpBtkAnm = NULL; + mpBrkAnm = NULL; + mpBpkAnm = NULL; + mShadow = NULL; + mDeformData = NULL; + mpBlkAnm = NULL; } /* 804A4388-804A4420 000168 0098+00 1/1 0/0 0/0 .text __dt__10daDemo00_cFv */ daDemo00_c::~daDemo00_c() { if (heap != NULL) { - if (mpModelMorf != NULL) { - mpModelMorf->stopZelAnime(); + if (mModel.mpModelMorf != NULL) { + mModel.mpModelMorf->stopZelAnime(); } } } -/* 804A4420-804A449C 000200 007C+00 2/2 0/0 0/0 .text __dt__12demo_s1_ke_sFv */ -demo_s1_ke_s::~demo_s1_ke_s() {} +static void dummy() { + // Fixes weak function order + cM3dGPla plane; + plane.~cM3dGPla(); +} -/* 804A8998-804A8998 000138 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ -static char const* const stringBase_804A8998 = "V_24_tri_joint"; +inline int daDemo00_c::create() { + dKy_tevstr_init(&tevStr, dComIfGp_roomControl_getStayNo(), 0xFF); + tevStr.field_0x384 = 1; + mSound.init(&eyePos, NULL, 10, 1); + setAction(&daDemo00_c::actStandby); + field_0x588.reset(); + field_0x6a0 = -1; + return cPhs_COMPLEATE_e; +} /* 804A4520-804A45A0 000300 0080+00 1/1 0/0 0/0 .text get_foward_angle__FP4cXyzP4cXyzPsPs */ static void get_foward_angle(cXyz* param_1, cXyz* param_2, s16* param_3, s16* param_4) { - // NONMATCHING cXyz sp38; + if (param_1 == NULL || param_2 == NULL || param_3 == NULL || param_4 == NULL) { + JUT_ASSERT(173, FALSE); + } dKyr_get_vectle_calc(param_1, param_2, &sp38); - *param_3 = cM_atan2s(JMAFastSqrt(sp38.x * sp38.x + sp38.z * sp38.z), sp38.y); + f32 f31 = JMAFastSqrt(sp38.x * sp38.x + sp38.z * sp38.z); + *param_3 = cM_atan2s(f31, sp38.y); *param_4 = sp38.atan2sX_Z(); } /* 804A45A0-804A4948 000380 03A8+00 2/2 0/0 0/0 .text setBaseMtx__10daDemo00_cFv */ void daDemo00_c::setBaseMtx() { - // NONMATCHING s16 sVar1, sVar2; cXyz sp38; - BOOL bVar1 = FALSE; + bool bVar1 = FALSE; cM3dGPla plane; if (tevStr.mInitTimer == 1) { field_0x574 = shape_angle; + #ifdef DEBUG + debug_field_0x570 = current.pos; + debug_field_0x57c = shape_angle; + #endif } sp38 = current.pos; if (field_0x6a2 != 0 || mground2 != 0) { cXyz sp44(current.pos.x, current.pos.y + 1000.0f, current.pos.z); - mBgc->mGndChk.SetPos(&sp44); - sp38.y = dComIfG_Bgsp().GroundCross(&mBgc->mGndChk); + mModel.mBgc->mGndChk.SetPos(&sp44); + sp38.y = dComIfG_Bgsp().GroundCross(&mModel.mBgc->mGndChk); } if (field_0x6a4 != 0 && field_0x568.x != 10000000.0f) { - if (current.pos != field_0x568) { - if (current.pos.abs(field_0x568) >= 1.5f) { - get_foward_angle(&field_0x568, ¤t.pos, &sVar1, &sVar2); - shape_angle.x = field_0x574.x = sVar1; - shape_angle.y = field_0x574.y = sVar2; - } + if (current.pos != field_0x568 && current.pos.abs(field_0x568) >= 1.5f) { + get_foward_angle(&field_0x568, ¤t.pos, &sVar1, &sVar2); + shape_angle.x = field_0x574.x = sVar1; + shape_angle.y = field_0x574.y = sVar2; } else { shape_angle.x = field_0x574.x; shape_angle.y = field_0x574.y; @@ -111,7 +147,7 @@ void daDemo00_c::setBaseMtx() { if (mground2 != 0) { if (sp38.y != -G_CM3D_F_INF) { - bVar1 = dComIfG_Bgsp().GetTriPla(mBgc->mGndChk, &plane); + bVar1 = dComIfG_Bgsp().GetTriPla(mModel.mBgc->mGndChk, &plane); } if (bVar1 && cBgW_CheckBGround(plane.mNormal.y)) { @@ -129,56 +165,39 @@ void daDemo00_c::setBaseMtx() { mDoMtx_stack_c::transS(sp38.x, sp38.y, sp38.z); mDoMtx_stack_c::XYZrotM(current.angle.x, current.angle.y, current.angle.z); - field_0x5d4->setBaseTRMtx(mDoMtx_stack_c::get()); - field_0x5d4->setBaseScale(scale); + mModel.field_0x5d4->setBaseTRMtx(mDoMtx_stack_c::get()); + mModel.field_0x5d4->setBaseScale(scale); } /* 804A4948-804A4D48 000728 0400+00 1/1 0/0 0/0 .text setShadowSize__10daDemo00_cFv */ void daDemo00_c::setShadowSize() { - // NONMATCHING - J3DModelData* modelData = field_0x5d4->getModelData(); - cXyz sp98(100000000.0f, 100000000.0f, 100000000.0f); - cXyz spa4(-100000000.0f, -100000000.0f, -100000000.0f); + J3DModelData* modelData = mModel.field_0x5d4->getModelData(); + cXyz min(100000000.0f, 100000000.0f, 100000000.0f); + cXyz max(-100000000.0f, -100000000.0f, -100000000.0f); for (u16 i = 0; i < modelData->getJointNum(); i++) { J3DJoint* jntNodeP = modelData->getJointNodePointer(i); if (jntNodeP->getKind() == 0) { cXyz spb0, spbc; - cMtx_multVec(field_0x5d4->getAnmMtx(i), jntNodeP->getMin(), &spb0); - cMtx_multVec(field_0x5d4->getAnmMtx(i), jntNodeP->getMin(), &spbc); + cMtx_multVec(mModel.field_0x5d4->getAnmMtx(i), jntNodeP->getMin(), &spb0); + cMtx_multVec(mModel.field_0x5d4->getAnmMtx(i), jntNodeP->getMax(), &spbc); - if (spb0.x < sp98.x) { - sp98.x = spb0.x; - } + min.x = spb0.x < min.x ? spb0.x : min.x; + min.y = spb0.y < min.y ? spb0.y : min.y; + min.z = spb0.z < min.z ? spb0.z : min.z; - if (spb0.y < sp98.y) { - sp98.y = spb0.y; - } - - if (spb0.z < sp98.z) { - sp98.z = spb0.z; - } - - if (spa4.x < spbc.x) { - spa4.x = spbc.x; - } - - if (spa4.y < spbc.y) { - spa4.y = spbc.y; - } - - if (spa4.z < spbc.z) { - spa4.z = spbc.z; - } + max.x = spbc.x > max.x ? spbc.x : max.x; + max.y = spbc.y > max.y ? spbc.y : max.y; + max.z = spbc.z > max.z ? spbc.z : max.z; } } - mShadow->field_0x4.x = (spa4.x + sp98.x) * 0.5f; - mShadow->field_0x4.y = (spa4.y + sp98.y) * 0.5f; - mShadow->field_0x4.z = (spa4.z + sp98.z) * 0.5f; - cXyz spc8(spa4 - sp98); - mShadow->field_0x1c = spc8.abs() * 3.0f; - mShadow->field_0x20 = spc8.absXZ() * 0.25f; + mModel.mShadow->field_0x4.x = (max.x + min.x) * 0.5f; + mModel.mShadow->field_0x4.y = (max.y + min.y) * 0.5f; + mModel.mShadow->field_0x4.z = (max.z + min.z) * 0.5f; + cXyz spc8(max - min); + mModel.mShadow->field_0x1c = spc8.abs() * 3.0f; + mModel.mShadow->field_0x20 = spc8.absXZ() * 0.25f; } /* 804A4D48-804A4F54 000B28 020C+00 1/1 0/0 0/0 .text awaCheck__FP8J3DModel */ @@ -221,7 +240,6 @@ static int createHeapCallBack(fopAc_ac_c* a_this) { /* 804A4F74-804A5750 000D54 07DC+00 1/1 0/0 0/0 .text createHeap__10daDemo00_cFv */ int daDemo00_c::createHeap() { - // NONMATCHING if (mModel.mID.mShapeID != -1) { J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectIDRes(dStage_roomControl_c::getDemoArcName(), (u16)mModel.mID.mShapeID); mDoExt_bckAnmRemove(modelData); @@ -229,49 +247,52 @@ int daDemo00_c::createHeap() { if (modelData == NULL) { OS_REPORT("\ngetDemoArcName=[%s]", dStage_roomControl_c::getDemoArcName()); OS_REPORT("\nmModel.mID.mShapeID=[%d]\n", mModel.mID.mShapeID); - JUT_ASSERT(441, modelData != NULL); } + JUT_ASSERT(441, modelData != NULL); s32 uVar1 = 0x11000084; for (int i = 0; i < modelData->getShapeNum(); i++) { - if (modelData->getShapeNodePointer(i)->getTexMtxLoadType() == 0x2000) { + J3DShape* shape = modelData->getShapeNodePointer(i); + if (shape->getTexMtxLoadType() == 0x2000) { field_0x6ad = 1; break; } } if (mModel.mID.field_0xc != -1) { - mpBtpAnm = new mDoExt_btpAnm(); - if (mpBtpAnm == NULL) { + mModel.mpBtpAnm = new mDoExt_btpAnm(); + if (mModel.mpBtpAnm == NULL) { return 0; } J3DAnmTexPattern* i_btk = (J3DAnmTexPattern*)dComIfG_getObjectIDRes(dStage_roomControl_c::getDemoArcName(), (u16)mModel.mID.field_0xc); if (i_btk == NULL) { - OS_REPORT("ESC_WARNING指定btpアニメーションが見つかりません!(%d)\n", mModel.mID.field_0xc); // ESC_WARNING: The specified BTP animation could not be found! (%d) + // ESC_WARNING: The specified BTP animation could not be found! (%d) + OS_REPORT("ESC_WARNING指定btpアニメーションが見つかりません!(%d)\n", mModel.mID.field_0xc); return 1; } - if (mpBtpAnm->init(modelData, i_btk, 1, -1, 1.0f, 0, -1) == 0) { + if (mModel.mpBtpAnm->init(modelData, i_btk, 1, J3DFrameCtrl::EMode_NULL, 1.0f, 0, -1) == 0) { return 0; } - uVar1 = 0x15020084; + uVar1 |= 0x4020000; } if (mModel.mID.field_0x10 != -1) { - mpBtkAnm = new mDoExt_btkAnm(); - if (mpBtkAnm == NULL) { + mModel.mpBtkAnm = new mDoExt_btkAnm(); + if (mModel.mpBtkAnm == NULL) { return 0; } J3DAnmTextureSRTKey* key = (J3DAnmTextureSRTKey*)dComIfG_getObjectIDRes(dStage_roomControl_c::getDemoArcName(), (u16)mModel.mID.field_0x10); if (key == NULL) { - OS_REPORT("ESC_WARNING指定btkアニメーションが見つかりません!(%d)\n", mModel.mID.field_0x10); // ESC_WARNING: The specified btk animation could not be found! (%d) + // ESC_WARNING: The specified btk animation could not be found! (%d) + OS_REPORT("ESC_WARNING指定btkアニメーションが見つかりません!(%d)\n", mModel.mID.field_0x10); return 1; } - if (mpBtkAnm->init(modelData, key, 1, -1, 1.0f, 0, -1) == 0) { + if (mModel.mpBtkAnm->init(modelData, key, 1, J3DFrameCtrl::EMode_NULL, 1.0f, 0, -1) == 0) { return 0; } @@ -283,35 +304,37 @@ int daDemo00_c::createHeap() { } if (mModel.mID.field_0x14 != -1) { - mpBrkAnm = new mDoExt_brkAnm(); - if (mpBrkAnm == NULL) { + mModel.mpBrkAnm = new mDoExt_brkAnm(); + if (mModel.mpBrkAnm == NULL) { return 0; } J3DAnmTevRegKey* regKey = (J3DAnmTevRegKey*)dComIfG_getObjectIDRes(dStage_roomControl_c::getDemoArcName(), (u16)mModel.mID.field_0x14); if (regKey == NULL) { - OS_REPORT("ESC_WARNING指定brkアニメーションが見つかりません!(%d)\n", mModel.mID.field_0x14); // ESC_WARNING: The specified brk animation could not be found! (%d) + // ESC_WARNING: The specified brk animation could not be found! (%d) + OS_REPORT("ESC_WARNING指定brkアニメーションが見つかりません!(%d)\n", mModel.mID.field_0x14); return 1; } - if (mpBrkAnm->init(modelData, regKey, 1, -1, 1.0f, 0, -1) == 0) { + if (mModel.mpBrkAnm->init(modelData, regKey, 1, J3DFrameCtrl::EMode_NULL, 1.0f, 0, -1) == 0) { return 0; } } if (mModel.mID.field_0x8 != -1) { - mpBpkAnm = new mDoExt_bpkAnm(); - if (mpBpkAnm == NULL) { + mModel.mpBpkAnm = new mDoExt_bpkAnm(); + if (mModel.mpBpkAnm == NULL) { return 0; } J3DAnmColor* anm_color = (J3DAnmColor*)dComIfG_getObjectIDRes(dStage_roomControl_c::getDemoArcName(), (u16)mModel.mID.field_0x8); if (anm_color == NULL) { - OS_REPORT("ESC_WARNING指定brkアニメーションが見つかりません!(%d)\n", mModel.mID.field_0x8); // ESC_WARNING: The specified brk animation could not be found! (%d) + // ESC_WARNING: The specified brk animation could not be found! (%d) + OS_REPORT("ESC_WARNING指定brkアニメーションが見つかりません!(%d)\n", mModel.mID.field_0x8); return 1; } - if (mpBpkAnm->init(modelData, anm_color, 1, -1, 1.0f, 0, -1) == 0) { + if (mModel.mpBpkAnm->init(modelData, anm_color, 1, J3DFrameCtrl::EMode_NULL, 1.0f, 0, -1) == 0) { return 0; } @@ -319,14 +342,14 @@ int daDemo00_c::createHeap() { } if (mModel.mID.field_0x4 == -1) { - mpModelMorf = NULL; + mModel.mpModelMorf = NULL; if (field_0x6ad == 0) { - field_0x5d4 = mDoExt_J3DModel__create(modelData, 0x80000, uVar1); + mModel.field_0x5d4 = mDoExt_J3DModel__create(modelData, 0x80000, uVar1); } else { - field_0x5d4 = mDoExt_J3DModel__create(modelData, 0, uVar1); + mModel.field_0x5d4 = mDoExt_J3DModel__create(modelData, 0, uVar1); } - if (field_0x5d4 == NULL) { + if (mModel.field_0x5d4 == NULL) { return 0; } } else { @@ -338,74 +361,78 @@ int daDemo00_c::createHeap() { } if (field_0x6ad == 0) { - mpModelMorf = new mDoExt_McaMorfSO(modelData, NULL, NULL, anm, -1, 1.0f, 0, -1, &mSound, 0x80000, uVar1); + mModel.mpModelMorf = new mDoExt_McaMorfSO(modelData, NULL, NULL, anm, -1, 1.0f, 0, -1, &mSound, 0x80000, uVar1); } else { - mpModelMorf = new mDoExt_McaMorfSO(modelData, NULL, NULL, anm, -1, 1.0f, 0, -1, &mSound, 0, uVar1); + mModel.mpModelMorf = new mDoExt_McaMorfSO(modelData, NULL, NULL, anm, -1, 1.0f, 0, -1, &mSound, 0, uVar1); } - if (mpModelMorf == NULL || mpModelMorf->getModel() == NULL) { + if (mModel.mpModelMorf == NULL || mModel.mpModelMorf->getModel() == NULL) { return 0; } - field_0x5d4 = mpModelMorf->getModel(); + mModel.field_0x5d4 = mModel.mpModelMorf->getModel(); - if (!awaCheck(field_0x5d4)) { + if (!awaCheck(mModel.field_0x5d4)) { return 0; } } if (field_0x6b4 != 0) { - field_0x5d8 = new mDoExt_invisibleModel(); - if (field_0x5d8 == NULL) { + mModel.field_0x5d8 = new mDoExt_invisibleModel(); + if (mModel.field_0x5d8 == NULL) { return 0; } - if (field_0x5d8->create(field_0x5d4, 1) == 0) { + if (mModel.field_0x5d8->create(mModel.field_0x5d4, 1) == 0) { return 0; } } else { - field_0x5d8 = NULL; + mModel.field_0x5d8 = NULL; } mModel.mID.field_0x18 = 1; if (mModel.mID.field_0x18 != -1) { - mShadow = new daDemo00_shadow_c(); - if (mShadow == NULL) { + mModel.mShadow = new daDemo00_shadow_c(); + if (mModel.mShadow == NULL) { return 0; } - field_0x5d4->calc(); + #ifdef DEBUG + mModel.field_0x5d4->getBaseTRMtx()[0][0] = 1.0f; + #endif + mModel.field_0x5d4->calc(); setShadowSize(); } - mBgc = new daDemo00_bgc_c(); - if (mBgc == NULL) { + mModel.mBgc = new daDemo00_bgc_c(); + if (mModel.mBgc == NULL) { return 0; } - mBgc->mGndChk.OffWall(); + mModel.mBgc->mGndChk.OffWall(); if (mModel.mID.field_0x1c != -1) { - mDeformData = (J3DDeformData*)dComIfG_getObjectIDRes(dStage_roomControl_c::getDemoArcName(), (u16)mModel.mID.field_0x1c); - // Should be mModel.mDeformData - JUT_ASSERT(687, mDeformData != NULL); + mModel.mDeformData = (J3DDeformData*)dComIfG_getObjectIDRes(dStage_roomControl_c::getDemoArcName(), (u16)mModel.mID.field_0x1c); + JUT_ASSERT(687, mModel.mDeformData != NULL); if (mModel.mID.field_0x20 != -1) { - mpBlkAnm = new mDoExt_blkAnm(); - if (mpBlkAnm == NULL) { + mModel.mpBlkAnm = new mDoExt_blkAnm(); + if (mModel.mpBlkAnm == NULL) { return 0; } J3DAnmCluster* anm_cluster = (J3DAnmCluster*)dComIfG_getObjectIDRes(dStage_roomControl_c::getDemoArcName(), (u16)mModel.mID.field_0x20); if (anm_cluster == NULL) { - OS_REPORT("ESC_WARNING指定blkアニメーションが見つかりません!(%d)\n", mModel.mID.field_0x20); // ESC_WARNING: Specified blk animation not found! (%d) + // ESC_WARNING: Specified blk animation not found! (%d) + OS_REPORT("ESC_WARNING指定blkアニメーションが見つかりません!(%d)\n", mModel.mID.field_0x20); } else { - if (mpBlkAnm->init(mDeformData, anm_cluster, 1, -1, 1.0f, 0, -1) == 0) { + if (mModel.mpBlkAnm->init(mModel.mDeformData, anm_cluster, 1, J3DFrameCtrl::EMode_NULL, 1.0f, 0, -1) == 0) { return 0; } } } - if (field_0x5d4->setDeformData(mDeformData, 1) != 0) { + s32 ret = mModel.field_0x5d4->setDeformData(mModel.mDeformData, 1); + if (ret != kJ3DError_Success) { return 0; } } @@ -417,13 +444,12 @@ int daDemo00_c::createHeap() { } f32* pfVar1 = field_0x6bc.getSize(0); - for (int i = 0; i < 32; i++) { + for (int i = 0; i < 32; i++, pfVar1++) { if (field_0x6a7 >= 2 && field_0x6a7 <= 4) { *pfVar1 = 5.0f; } else { *pfVar1 = 3.0f; } - pfVar1++; } } @@ -436,20 +462,22 @@ int daDemo00_c::createHeap() { /* 804A5798-804A594C 001578 01B4+00 2/0 0/0 0/0 .text actStandby__10daDemo00_cFP13dDemo_actor_c */ int daDemo00_c::actStandby(dDemo_actor_c* actor) { - // NONMATCHING - if (mModel.field_0x0.mShapeID != -1) { - mModel.mID = mModel.field_0x0; - if (fopAcM_entrySolidHeap(this, createHeapCallBack, 0x9004c5e0)) { + if (field_0x588.mShapeID != -1) { + mModel.mID = field_0x588; + u32 heapSize = 0x4c5e0; + heapSize |= 0x80000000; + heapSize |= 0x10000000; + if (fopAcM_entrySolidHeap(this, createHeapCallBack, heapSize)) { OS_REPORT("汎用くん確保ヒープサイズ %d\n", heap->getHeapSize()); - if (field_0x5d4 != NULL) { + if (mModel.field_0x5d4 != NULL) { dDemo_setDemoData(this, 42, NULL, NULL, 0, NULL, 0, 0); setBaseMtx(); - fopAcM_SetMtx(this, field_0x5d4->getBaseTRMtx()); - actor->setModel(field_0x5d4); + fopAcM_SetMtx(this, mModel.field_0x5d4->getBaseTRMtx()); + actor->setModel(mModel.field_0x5d4); - if (mpModelMorf != NULL) { - actor->setAnmFrameMax(mpModelMorf->getEndFrame()); + if (mModel.mpModelMorf != NULL) { + actor->setAnmFrameMax(mModel.mpModelMorf->getEndFrame()); } } @@ -467,17 +495,16 @@ int daDemo00_c::actStandby(dDemo_actor_c* actor) { /* 804A594C-804A604C 00172C 0700+00 1/0 0/0 0/0 .text actPerformance__10daDemo00_cFP13dDemo_actor_c */ int daDemo00_c::actPerformance(dDemo_actor_c* actor) { - // NONMATCHING f32 fVar1; - int i_attribute; - if (mModel.mID.mShapeID != mModel.field_0x0.mShapeID) { + if (mModel.mID.mShapeID != field_0x588.mShapeID) { mModel.reset(); setAction(&daDemo00_c::actLeaving); - } else if (field_0x5d4 != NULL) { - if (mpModelMorf != NULL && mModel.mID.field_0x4 != mModel.field_0x0.field_0x4) { - J3DAnmTransform* anm = (J3DAnmTransform*)dComIfG_getObjectIDRes(dStage_roomControl_c::getDemoArcName(), (u16)mModel.field_0x0.field_0x4); + } else if (mModel.field_0x5d4 != NULL) { + if (mModel.mpModelMorf != NULL && mModel.mID.field_0x4 != field_0x588.field_0x4) { + J3DAnmTransform* anm = (J3DAnmTransform*)dComIfG_getObjectIDRes(dStage_roomControl_c::getDemoArcName(), (u16)field_0x588.field_0x4); if (anm == NULL) { - OS_REPORT("ESC_WARNING指定bckアニメーションが見つかりません!(%d)\n", mModel.field_0x0.field_0x4); // ESC_WARNING: Specified bck animation not found! (%d) + // ESC_WARNING: Specified bck animation not found! (%d) + OS_REPORT("ESC_WARNING指定bckアニメーションが見つかりません!(%d)\n", field_0x588.field_0x4); return 1; } @@ -485,97 +512,107 @@ int daDemo00_c::actPerformance(dDemo_actor_c* actor) { if (actor->checkEnable(dDemo_actor_c::ENABLE_ANM_TRANSITION_e)) { fVar1 = actor->getAnmTransition(); } - mpModelMorf->setAnm(anm, -1, fVar1, 1.0f, 0.0f, -1.0f); - mModel.mID.field_0x4 = mModel.field_0x0.field_0x4; + mModel.mpModelMorf->setAnm(anm, -1, fVar1, 1.0f, 0.0f, -1.0f); + mModel.mID.field_0x4 = field_0x588.field_0x4; } - if (mModel.mID.field_0xc != mModel.field_0x0.field_0xc) { - J3DAnmTexPattern* anmTexPattern = (J3DAnmTexPattern*)dComIfG_getObjectIDRes(dStage_roomControl_c::getDemoArcName(), (u16)mModel.field_0x0.field_0xc); + if (mModel.mID.field_0xc != field_0x588.field_0xc) { + J3DAnmTexPattern* anmTexPattern = (J3DAnmTexPattern*)dComIfG_getObjectIDRes(dStage_roomControl_c::getDemoArcName(), (u16)field_0x588.field_0xc); if (anmTexPattern == NULL) { - OS_REPORT("ESC_WARNING指定btpアニメーションが見つかりません!(%d)\n", mModel.field_0x0.field_0xc); // ESC_WARNING: The specified btp animation could not be found! (%d) + // ESC_WARNING: The specified btp animation could not be found! (%d) + OS_REPORT("ESC_WARNING指定btpアニメーションが見つかりません!(%d)\n", field_0x588.field_0xc); return 1; } - mpBtpAnm->init(field_0x5d4->getModelData(), anmTexPattern, 1, -1, 1.0f, 0, -1); - mModel.mID.field_0xc = mModel.field_0x0.field_0xc; + mModel.mpBtpAnm->init(mModel.field_0x5d4->getModelData(), anmTexPattern, 1, J3DFrameCtrl::EMode_NULL, 1.0f, 0, -1); + mModel.mID.field_0xc = field_0x588.field_0xc; } - if (mModel.mID.field_0x10 != mModel.field_0x0.field_0x10) { - J3DAnmTextureSRTKey* key = (J3DAnmTextureSRTKey*)dComIfG_getObjectIDRes(dStage_roomControl_c::getDemoArcName(), (u16)mModel.field_0x0.field_0x10); + if (mModel.mID.field_0x10 != field_0x588.field_0x10) { + J3DAnmTextureSRTKey* key = (J3DAnmTextureSRTKey*)dComIfG_getObjectIDRes(dStage_roomControl_c::getDemoArcName(), (u16)field_0x588.field_0x10); if (key == NULL) { - OS_REPORT("ESC_WARNING指定btkアニメーションが見つかりません!(%d)\n", mModel.field_0x0.field_0x10); // ESC_WARNING: The specified btk animation could not be found! (%d) + // ESC_WARNING: The specified btk animation could not be found! (%d) + OS_REPORT("ESC_WARNING指定btkアニメーションが見つかりません!(%d)\n", field_0x588.field_0x10); return 1; } - mpBtkAnm->init(field_0x5d4->getModelData(), key, 1, -1, 1.0f, 0, -1); - mModel.mID.field_0x10 = mModel.field_0x0.field_0x10; + mModel.mpBtkAnm->init(mModel.field_0x5d4->getModelData(), key, 1, J3DFrameCtrl::EMode_NULL, 1.0f, 0, -1); + mModel.mID.field_0x10 = field_0x588.field_0x10; } - if (mModel.mID.field_0x14 != mModel.field_0x0.field_0x14) { - J3DAnmTevRegKey* anmTev = (J3DAnmTevRegKey*)dComIfG_getObjectIDRes(dStage_roomControl_c::getDemoArcName(), (u16)mModel.field_0x0.field_0x14); + if (mModel.mID.field_0x14 != field_0x588.field_0x14) { + J3DAnmTevRegKey* anmTev = (J3DAnmTevRegKey*)dComIfG_getObjectIDRes(dStage_roomControl_c::getDemoArcName(), (u16)field_0x588.field_0x14); if (anmTev == NULL) { - OS_REPORT("ESC_WARNING指定brkアニメーションが見つかりません!(%d)\n", mModel.field_0x0.field_0x14); // ESC_WARNING: The specified brk animation could not be found! (%d) + // ESC_WARNING: The specified brk animation could not be found! (%d) + OS_REPORT("ESC_WARNING指定brkアニメーションが見つかりません!(%d)\n", field_0x588.field_0x14); return 1; } if ((mModel.mID.field_0x14 & 0x10000000) != 0) { - fVar1 = mpBrkAnm->getFrame(); + fVar1 = mModel.mpBrkAnm->getFrame(); } else { fVar1 = 0.0f; } + s16 start = fVar1; + + int attribute; if ((mModel.mID.field_0x14 & 0x10000000) != 0) { - i_attribute = 2; + attribute = J3DFrameCtrl::EMode_LOOP; } else { - i_attribute = -1; + attribute = J3DFrameCtrl::EMode_NULL; } - mpBrkAnm->init(field_0x5d4->getModelData(), anmTev, 1, i_attribute, 1.0f, fVar1, -1); - mModel.mID.field_0x14 = mModel.field_0x0.field_0x14; + mModel.mpBrkAnm->init(mModel.field_0x5d4->getModelData(), anmTev, 1, attribute, 1.0f, start, -1); + mModel.mID.field_0x14 = field_0x588.field_0x14; } - if (mModel.mID.field_0x8 != mModel.field_0x0.field_0x8) { - J3DAnmColor* anm_color = (J3DAnmColor*)dComIfG_getObjectIDRes(dStage_roomControl_c::getDemoArcName(), (u16)mModel.field_0x0.field_0x8); + if (mModel.mID.field_0x8 != field_0x588.field_0x8) { + J3DAnmColor* anm_color = (J3DAnmColor*)dComIfG_getObjectIDRes(dStage_roomControl_c::getDemoArcName(), (u16)field_0x588.field_0x8); if (anm_color == NULL) { - OS_REPORT("ESC_WARNING指定bpkアニメーションが見つかりません!(%d)\n", mModel.field_0x0.field_0x8); // ESC_WARNING: The specified bpk animation could not be found! (%d) + // ESC_WARNING: The specified bpk animation could not be found! (%d) + OS_REPORT("ESC_WARNING指定bpkアニメーションが見つかりません!(%d)\n", field_0x588.field_0x8); return 1; } - if ((mModel.mID.field_0x14 & 0x10000000) != 0) { - fVar1 = mpBpkAnm->getFrame(); + if ((mModel.mID.field_0x8 & 0x10000000) != 0) { + fVar1 = mModel.mpBpkAnm->getFrame(); } else { fVar1 = 0.0f; } - if ((mModel.mID.field_0x14 & 0x10000000) != 0) { - i_attribute = 2; + s16 start = fVar1; + + int attribute; + if ((mModel.mID.field_0x8 & 0x10000000) != 0) { + attribute = J3DFrameCtrl::EMode_LOOP; } else { - i_attribute = -1; + attribute = J3DFrameCtrl::EMode_NULL; } - mpBpkAnm->init(field_0x5d4->getModelData(), anm_color, 1, i_attribute, 1.0f, fVar1, -1); - mModel.mID.field_0x8 = mModel.field_0x0.field_0x8; + mModel.mpBpkAnm->init(mModel.field_0x5d4->getModelData(), anm_color, 1, attribute, 1.0f, start, -1); + mModel.mID.field_0x8 = field_0x588.field_0x8; } - if (mModel.mID.field_0x20 != mModel.field_0x0.field_0x20) { - // Should be mModel.mDeformData and mModel.mBlkAnm - JUT_ASSERT(1049, mDeformData != NULL && mpBlkAnm != NULL); + if (mModel.mID.field_0x20 != field_0x588.field_0x20) { + JUT_ASSERT(1049, mModel.mDeformData != NULL && mModel.mpBlkAnm != NULL); - J3DAnmCluster* anmCluster = (J3DAnmCluster*)dComIfG_getObjectIDRes(dStage_roomControl_c::getDemoArcName(), (u16)mModel.field_0x0.field_0x20); + J3DAnmCluster* anmCluster = (J3DAnmCluster*)dComIfG_getObjectIDRes(dStage_roomControl_c::getDemoArcName(), (u16)field_0x588.field_0x20); if (anmCluster == NULL) { - OS_REPORT("ESC_WARNING指定btpアニメーションが見つかりません!(%d)\n", mModel.field_0x0.field_0x20); // ESC_WARNING: The specified btp animation could not be found! (%d) + // ESC_WARNING: The specified btp animation could not be found! (%d) + OS_REPORT("ESC_WARNING指定btpアニメーションが見つかりません!(%d)\n", field_0x588.field_0x20); return 1; } - mpBlkAnm->init(mDeformData, anmCluster, 1, -1, 1.0f, 0, -1); - mModel.mID.field_0x20 = mModel.field_0x0.field_0x20; + mModel.mpBlkAnm->init(mModel.mDeformData, anmCluster, 1, J3DFrameCtrl::EMode_NULL, 1.0f, 0, -1); + mModel.mID.field_0x20 = field_0x588.field_0x20; } dDemo_setDemoData(this, 0x2A, 0, 0, 0, 0, 0, 0); - if (mBgc != NULL) { + if (mModel.mBgc != NULL) { cXyz sp70(current.pos.x, current.pos.y + 100.0f, current.pos.z); - mBgc->mGndChk.SetPos(&sp70); - mBgc->field_0x54 = dComIfG_Bgsp().GroundCross(&mBgc->mGndChk); + mModel.mBgc->mGndChk.SetPos(&sp70); + mModel.mBgc->field_0x54 = dComIfG_Bgsp().GroundCross(&mModel.mBgc->mGndChk); field_0x6a1 = 1; } @@ -584,104 +621,102 @@ int daDemo00_c::actPerformance(dDemo_actor_c* actor) { if (actor->checkEnable(dDemo_actor_c::ENABLE_ANM_FRAME_e)) { fVar1 = actor->getAnmFrame(); if (fVar1 > 1.0f) { - f32 fVar2 = fVar1 - 1.0f; - if (mpModelMorf != NULL) { - mpModelMorf->setFrameF(fVar1 - 1.0f); - u32 sndId; - if (mBgc != NULL && field_0x6a1 != 0 && fabsf(mBgc->field_0x54 - current.pos.y) < 20.0f) { - sndId = dComIfG_Bgsp().GetMtrlSndId(mBgc->mGndChk); - } else { - sndId = 0; - } - - mpModelMorf->play(sndId, dComIfGp_getReverb(dComIfGp_roomControl_getStayNo())); + fVar1 -= 1.0f; + if (mModel.mpModelMorf != NULL) { + mModel.mpModelMorf->setFrameF(fVar1); + mModel.mpModelMorf->play( + mModel.mBgc != NULL && field_0x6a1 != 0 && fabsf(mModel.mBgc->field_0x54 - current.pos.y) < 20.0f ? + dComIfG_Bgsp().GetMtrlSndId(mModel.mBgc->mGndChk) : + 0, + dComIfGp_getReverb(dComIfGp_roomControl_getStayNo()) + ); } - if (mpBtpAnm != NULL) { - mpBtpAnm->setFrame(fVar2); - mpBtpAnm->play(); + if (mModel.mpBtpAnm != NULL) { + mModel.mpBtpAnm->setFrame(fVar1); + mModel.mpBtpAnm->play(); } - if (mpBtkAnm != NULL) { + if (mModel.mpBtkAnm != NULL) { if ((mModel.mID.field_0x10 & 0x10000000) == 0) { - mpBtkAnm->setFrame(fVar2); + mModel.mpBtkAnm->setFrame(fVar1); } - mpBtkAnm->play(); + mModel.mpBtkAnm->play(); } - if (mpBrkAnm != NULL) { + if (mModel.mpBrkAnm != NULL) { if ((mModel.mID.field_0x14 & 0x10000000) == 0) { - mpBrkAnm->setFrame(fVar2); + mModel.mpBrkAnm->setFrame(fVar1); } - mpBrkAnm->play(); + mModel.mpBrkAnm->play(); } - if (mpBpkAnm != NULL) { + if (mModel.mpBpkAnm != NULL) { if ((mModel.mID.field_0x8 & 0x10000000) == 0) { - mpBpkAnm->setFrame(fVar2); + mModel.mpBpkAnm->setFrame(fVar1); } - mpBpkAnm->play(); + mModel.mpBpkAnm->play(); } - if (mpBlkAnm != NULL) { + if (mModel.mpBlkAnm != NULL) { if ((mModel.mID.field_0x20 & 0x10000000) == 0) { - mpBlkAnm->setFrame(fVar2); + mModel.mpBlkAnm->setFrame(fVar1); } - mpBlkAnm->play(); + mModel.mpBlkAnm->play(); } } else { - if (mpModelMorf != NULL) { - mpModelMorf->setFrameF(fVar1); + if (mModel.mpModelMorf != NULL) { + mModel.mpModelMorf->setFrameF(fVar1); } - if (mpBtpAnm != NULL) { - mpBtpAnm->setFrame(fVar1); + if (mModel.mpBtpAnm != NULL) { + mModel.mpBtpAnm->setFrame(fVar1); } - if (mpBtkAnm != NULL) { + if (mModel.mpBtkAnm != NULL) { if ((mModel.mID.field_0x10 & 0x10000000) == 0) { - mpBtkAnm->setFrame(fVar1); + mModel.mpBtkAnm->setFrame(fVar1); } else { - mpBtkAnm->play(); + mModel.mpBtkAnm->play(); } } - if (mpBrkAnm != NULL) { + if (mModel.mpBrkAnm != NULL) { if ((mModel.mID.field_0x14 & 0x10000000) == 0) { - mpBrkAnm->setFrame(fVar1); + mModel.mpBrkAnm->setFrame(fVar1); } else { - mpBrkAnm->play(); + mModel.mpBrkAnm->play(); } } - if (mpBpkAnm != NULL) { + if (mModel.mpBpkAnm != NULL) { if ((mModel.mID.field_0x8 & 0x10000000) == 0) { - mpBpkAnm->setFrame(fVar1); + mModel.mpBpkAnm->setFrame(fVar1); } else { - mpBpkAnm->play(); + mModel.mpBpkAnm->play(); } } - if (mpBlkAnm != NULL) { + if (mModel.mpBlkAnm != NULL) { if ((mModel.mID.field_0x20 & 0x10000000) == 0) { - mpBlkAnm->setFrame(fVar1); + mModel.mpBlkAnm->setFrame(fVar1); } else { - mpBlkAnm->play(); + mModel.mpBlkAnm->play(); } } } - } else if (mpModelMorf != NULL) { - mpModelMorf->play(0, 0); - } else if (mpBtpAnm != NULL) { - mpBtpAnm->play(); - } else if (mpBtkAnm != NULL) { - mpBtkAnm->play(); - } else if (mpBrkAnm != NULL) { - mpBrkAnm->play(); - } else if (mpBpkAnm != NULL) { - mpBpkAnm->play(); - } else if (mpBlkAnm != NULL) { - mpBlkAnm->play(); + } else if (mModel.mpModelMorf != NULL) { + mModel.mpModelMorf->play(0, 0); + } else if (mModel.mpBtpAnm != NULL) { + mModel.mpBtpAnm->play(); + } else if (mModel.mpBtkAnm != NULL) { + mModel.mpBtkAnm->play(); + } else if (mModel.mpBrkAnm != NULL) { + mModel.mpBrkAnm->play(); + } else if (mModel.mpBpkAnm != NULL) { + mModel.mpBpkAnm->play(); + } else if (mModel.mpBlkAnm != NULL) { + mModel.mpBlkAnm->play(); } if (actor->checkEnable(dDemo_actor_c::ENABLE_SCALE_e)) { @@ -694,9 +729,8 @@ int daDemo00_c::actPerformance(dDemo_actor_c* actor) { /* 804A604C-804A60B0 001E2C 0064+00 1/0 0/0 0/0 .text actLeaving__10daDemo00_cFP13dDemo_actor_c */ int daDemo00_c::actLeaving(dDemo_actor_c* actor) { - // NONMATCHING - if (mpModelMorf != NULL) { - mpModelMorf->stopZelAnime(); + if (mModel.mpModelMorf != NULL) { + mModel.mpModelMorf->stopZelAnime(); } fopAcM_DeleteHeap(this); @@ -704,649 +738,8 @@ int daDemo00_c::actLeaving(dDemo_actor_c* actor) { return 1; } -/* 804A60B0-804A61F0 001E90 0140+00 1/1 0/0 0/0 .text mDad00_changeXluMaterial__FP11J3DMateriali */ -static void mDad00_changeXluMaterial(J3DMaterial* i_material, int param_2) { - // NONMATCHING - static J3DBlendInfo l_blendInfoOPA = { - 0, - 1, - 0, - 3, - }; - static J3DBlendInfo l_blendInfo = { - 1, - 4, - 5, - 3, - }; - static J3DZModeInfo l_zmodeInfoOPA = { - 1, - 3, - 1, - 0, - }; - static J3DZModeInfo l_zmodeInfo = { - 1, - 3, - 0, - 0, - }; - - i_material->change(); - - if (param_2 == 0) { - i_material->setMaterialMode(4); - i_material->getPEBlock()->getBlend()->setBlendInfo(l_blendInfo); - i_material->getPEBlock()->getZMode()->setZModeInfo(l_zmodeInfo); - } else { - i_material->setMaterialMode(1); - i_material->getPEBlock()->getBlend()->setBlendInfo(l_blendInfoOPA); - i_material->getPEBlock()->getZMode()->setZModeInfo(l_zmodeInfoOPA); - } -} - -/* 804A61F0-804A6428 001FD0 0238+00 1/1 0/0 0/0 .text teduna_calc__FP4cXyzP4cXyzP4cXyzsi */ -static void teduna_calc(cXyz* param_1, cXyz* param_2, cXyz* param_3, s16 param_4, int param_5) { - // NONMATCHING - cXyz sp70(*param_1 - *param_2); - f32 fVar1 = 6.0f; - cXyz sp7c, sp88; - - mDoMtx_stack_c::YrotS(param_4); - - if (param_5 == 5) { - sp7c.set(0.0f, -5.0f, 130.0f); - fVar1 = 1.0f; - } else if (param_5 == 5) { - sp7c.set(0.0f, -30.0f, 78.0f); - } else { - sp7c.set(0.0f, -30.0f, 60.0f); - } - - mDoMtx_stack_c::multVec(&sp7c, &sp88); - - for (int i = 0; i < 16; i++) { - *param_3 = *param_1 - (sp70 * (i / 15.0f)); - f32 fVar2 = cM_ssin((i / 15.0f) * 32768.0f); - *param_3 += sp88 * fVar2; - param_3->y += fVar2 * (fVar1 * cM_ssin(g_Counter.mCounter0 * 2500 + i * 1600)); - param_3++; - } -} - -/* 804A8C64-804A8D24 000054 00C0+00 1/3 0/0 0/0 .bss teduna_posL */ -static cXyz teduna_posL[16]; - -/* 804A8D30-804A8DF0 000120 00C0+00 1/3 0/0 0/0 .bss teduna_posR */ -static cXyz teduna_posR[16]; - -/* 804A8DFC-804A8E08 0001EC 000C+00 2/4 0/0 0/0 .bss S_ganon_left_hand_pos */ -static cXyz S_ganon_left_hand_pos; - -/* 804A8E14-804A8E20 000204 000C+00 2/4 0/0 0/0 .bss S_ganon_right_hand_pos */ -static cXyz S_ganon_right_hand_pos; - -/* 804A6428-804A6868 002208 0440+00 1/1 0/0 0/0 .text teduna_draw__FP8J3DModelP19mDoExt_3DlineMat1_cP12dKy_tevstr_ciiii */ -static void teduna_draw(J3DModel* i_model, mDoExt_3DlineMat1_c* param_2, dKy_tevstr_c* param_3, int param_4, int param_5, int param_6, int param_7) { - // NONMATCHING - static GXColor l_color = { - 0x14, 0x0F, 0x00, 0xFF, - }; - - cXyz sp38, sp44, sp50; - s16 sVar1 = 0; - if (param_7 == 4) { - sVar1 = -0x3875; - } else if (param_7 == 5) { - sVar1 = -7000; - } - - MTXCopy(i_model->getAnmMtx(param_6), mDoMtx_stack_c::get()); - - if (param_7 == 5) { - sp38.set(0.0f, 9.0f, 15.0f); - } else if (param_7 == 2 || param_7 == 3 || param_7 == 4) { - sp38.set(107.0f, -32.0f, -68.0f); - } else { - sp38.set(79.0f, -26.0f, -48.0f); - } - - mDoMtx_stack_c::multVec(&sp38, &sp44); - - if (param_7 == 5) { - sp50 = S_ganon_left_hand_pos; - } else { - MTXCopy(i_model->getAnmMtx(param_4), mDoMtx_stack_c::get()); - - if (param_7 == 1) { - sp38.set(61.0f, 18.0f, 0.0f); - } else if (param_7 == 3) { - sp38.set(191.0f, 28.0f, -80.0f); - } else { - sp38.set(0.0f, 0.0f, 0.0f); - } - - mDoMtx_stack_c::multVec(&sp38, &sp50); - } - - teduna_calc(&sp44, &sp50, teduna_posL, sVar1 + cM_atan2s(sp44.x - sp50.x, sp44.z - sp50.z) + 0x6000, param_7); - MTXCopy(i_model->getAnmMtx(param_6), mDoMtx_stack_c::get()); - - if (param_7 == 5) { - sp38.set(0.0f, 9.0f, -15.0f); - } else if (param_7 == 2 || param_7 == 3 || param_7 == 4) { - sp38.set(107.0f, -32.0f, 68.0f); - } else { - sp38.set(79.0f, -26.0f, 48.0f); - } - - mDoMtx_stack_c::multVec(&sp38, &sp44); - - if (param_7 == 5) { - sp50 = S_ganon_right_hand_pos; - } else { - MTXCopy(i_model->getAnmMtx(param_5), mDoMtx_stack_c::get()); - - if (param_7 == 1) { - sp38.set(61.0f, 18.0f, 0.0f); - } else if (param_7 == 4) { - sp38.set(40.0f, -12.0f, 40.0f); - } else { - sp38.set(0.0f, 0.0f, 0.0f); - } - - mDoMtx_stack_c::multVec(&sp38, &sp50); - } - - teduna_calc(&sp44, &sp50, teduna_posR, sVar1 + cM_atan2s(sp44.x - sp50.x, sp44.z - sp50.z) + 0x6000, param_7); - cXyz* pcVar1 = teduna_posL; - cXyz* pcVar2 = param_2->getPos(0); - for (int i = 0; i < 16; i++) { - pcVar2 = pcVar1; - pcVar2++; - pcVar1++; - } - - pcVar1 = teduna_posR; - pcVar2 = param_2->getPos(0); - pcVar2 += 31; - for (int i = 0; i < 16; i++) { - pcVar2 = pcVar1; - pcVar2--; - pcVar1++; - } - - param_2->update(0x20, l_color, param_3); - dComIfGd_set3DlineMat(param_2); -} - -/* 804A6868-804A692C 002648 00C4+00 1/1 0/0 0/0 .text teduna_ganon_hand_set__FP8J3DModelii */ -static void teduna_ganon_hand_set(J3DModel* i_model, int param_2, int param_3) { - // NONMATCHING - cXyz sp20; - - MTXCopy(i_model->getAnmMtx(param_2), mDoMtx_stack_c::get()); - sp20.set(0.0f, 0.0f, 0.0f); - mDoMtx_stack_c::multVec(&sp20, &S_ganon_left_hand_pos); - - MTXCopy(i_model->getAnmMtx(param_3), mDoMtx_stack_c::get()); - sp20.set(0.0f, 0.0f, 0.0f); - mDoMtx_stack_c::multVec(&sp20, &S_ganon_right_hand_pos); -} - -/* 804A692C-804A6C48 00270C 031C+00 1/1 0/0 0/0 .text ke_control__FP10daDemo00_cP12demo_s1_ke_sif */ -static void ke_control(daDemo00_c* i_this, demo_s1_ke_s* param_2, int param_3, f32 param_4) { - // NONMATCHING - cXyz spa4, spb0; - cXyz* pcVar1 = param_2->field_0x0; - cXyz* pcVar2 = param_2->field_0xc0; - - spa4.x = 0.0f; - spa4.y = 0.0f; - spa4.z = param_4; - - cXyz spbc; - s16 sVar1 = cM_rndF2(65536.0f); - f32 fVar1 = 3.0f; - f32 fVar2 = i_this->current.pos.y; - f32 fVar3 = 0.8f; - - if (i_this->field_0x6b3 != 0) { - fVar3 = 0.0f; - } - - for (int i = 0; pcVar1++, pcVar2++, i < 16; i++) { - f32 fVar4 = fVar1 * cM_ssin(sVar1 + i * 7000); - f32 fVar5 = cM_ssin(sVar1 + i * 6000 + 10000); - f32 fVar6 = (16 - i) * 0.1f; - - spbc.x = pcVar2->x + fVar4 + param_2->field_0x180.x * fVar6; - spbc.y = pcVar2->y + param_2->field_0x180.y * fVar6; - spbc.z = pcVar2->z + (fVar1 * fVar5) + param_2->field_0x180.z * fVar6; - fVar6 = spbc.x + (pcVar1->x - pcVar1[-1].x); - fVar5 = spbc.z + (pcVar1->z - pcVar1[-1].z); - fVar4 = pcVar1->y + spbc.y + -12.0f; - - if (fVar4 < fVar2) { - fVar4 = fVar2; - } - - f32 fVar7 = fVar4 - pcVar1[-1].y; - - cMtx_XrotS(*calc_mtx, -cM_atan2s(fVar7, fVar5)); - cMtx_YrotM(*calc_mtx, cM_atan2s(fVar6, JMAFastSqrt(fVar4 * fVar4 + fVar5 * fVar5))); - MtxPosition(&spa4, &spb0); - - pcVar2 = pcVar1; - pcVar1->x = pcVar1[-1].x + spb0.x; - pcVar1->y = pcVar1[-1].y + spb0.y; - pcVar1->z = pcVar1[-1].z + spb0.z; - pcVar2->x = fVar3 * (pcVar1->x - pcVar2->x); - pcVar2->y = fVar3 * (pcVar1->y - pcVar2->y); - pcVar2->z = fVar3 * (pcVar1->x - pcVar2->z); - } - -} - -/* 804A6C48-804A6D20 002A28 00D8+00 1/1 0/0 0/0 .text ke_move__FP10daDemo00_cP19mDoExt_3DlineMat0_cP12demo_s1_ke_sif */ -static void ke_move(daDemo00_c* i_this, mDoExt_3DlineMat0_c* param_2, demo_s1_ke_s* param_3, int param_4, f32 param_5) { - // NONMATCHING - ke_control(i_this, param_3, param_4, param_5); - cXyz* pcVar1 = param_2->getPos(param_4); - f32* pfVar1 = param_2->getSize(param_4); - - for (int i = 0; i < 16; i++) { - *pcVar1 = param_3->field_0x0[i]; - if (i == 14) { - *pfVar1 = 0.6f; - } else if (i < 5) { - *pfVar1 = 3.5f; - } else { - *pfVar1 = cM_rndF2(1.0f) + 1.8f; - } - - pcVar1++; - pfVar1++; - } -} - -/* 804A6D20-804A6F74 002B00 0254+00 1/1 0/0 0/0 .text ke_set__FP10daDemo00_c */ -static void ke_set(daDemo00_c* i_this) { - // NONMATCHING - static s16 ke_za[22] = { - 0xFCE0, 0xFE70, 0, 0x0190, 0x0320, 0xFCE0, 0xFE70, 0, 0x0190, 0x0320, - 0xFCE0, 0xFE70, 0, 0x0190, 0x0320, 0x04B0, 0xFCE0, 0xFE70, 0, - 0x0190, 0x0320, 0x04B0, - }; - - cXyz sp58, sp64; - cM_initRnd2(12, 0x7B, fopAcM_GetID(i_this) * 2 + 0x32); - MTXCopy(i_this->field_0x5d4->getAnmMtx(4), *calc_mtx); - - f32 fVar1, fVar2, fVar3; - for (int i = 0; i < 22; i++) { - MtxPush(); - cMtx_YrotM(*calc_mtx, 0x4000); - cMtx_XrotM(*calc_mtx, (int)cM_rndF2(2000.0f) + 3000); - - if (i < 10) { - cMtx_ZrotM(*calc_mtx, ke_za[i] * 5); - fVar1 = cM_rndF2(2.25f) + 7.5f; - fVar2 = cM_rndF2(10.0f) - 5.0f; - fVar3 = cM_rndF2(20.0f) - 10.0f; - } else { - cMtx_ZrotM(*calc_mtx, ke_za[i] * 5 + 0x8000); - fVar1 = cM_rndF2(3.0f) + 8.0f; - fVar2 = cM_rndF2(20.0f) - 10.0f; - fVar3 = cM_rndF2(30.0f) - 15.0f; - } - - sp58.set(fVar2, 15.0f, fVar3); - MtxPosition(&sp58, &i_this->field_0x6f8[i].field_0x0[i]); - sp58.set(fVar2, 35.0f, fVar3); - MtxPosition(&sp58, &i_this->field_0x6f8[i].field_0x180); - - i_this->field_0x6f8[i].field_0x180 -= i_this->field_0x6f8[i].field_0x0[i]; - - ke_move(i_this, &i_this->field_0x2900, i_this->field_0x6f8, i, fVar1); - MtxPull(); - } -} - -/* 804A6F74-804A6F94 002D54 0020+00 1/0 0/0 0/0 .text daDemo00_Draw__FP10daDemo00_c */ -static int daDemo00_Draw(daDemo00_c* i_this) { - return i_this->draw(); -} - -/* 804A6F94-804A7B88 002D74 0BF4+00 1/1 0/0 0/0 .text draw__10daDemo00_cFv */ -int daDemo00_c::draw() { - // NONMATCHING - if (field_0x5d4 != NULL) { - if (field_0x6ac == 7) { - tevStr.TevColor.a = 0xFF; - } - - g_env_light.settingTevStruct(field_0x6ac, &eyePos, &tevStr); - g_env_light.setLightTevColorType_MAJI(field_0x5d4, &tevStr); - dKy_bg_MAxx_proc(field_0x5d4); - - if (mpBtpAnm != NULL) { - mpBtpAnm->entry(field_0x5d4->getModelData()); - } - - if (mpBtkAnm != NULL) { - mpBtkAnm->entry(field_0x5d4->getModelData()); - } - - if (mpBrkAnm != NULL){ - mpBrkAnm->entry(field_0x5d4->getModelData()); - } - - if (mpBpkAnm != NULL) { - mpBpkAnm->entry(field_0x5d4->getModelData()); - } - - if (mpBlkAnm != NULL) { - mpBlkAnm->entryFrame(); - } - - if (field_0x6a5 != 0) { - J3DModelData* modelData = field_0x5d4->getModelData(); - for (u16 i = 0; i < modelData->getMaterialNum(); i++) { - J3DMaterial* material = modelData->getMaterialNodePointer(i); - - if (field_0x6a5 == 1) { - mDad00_changeXluMaterial(material, 0); - } else { - mDad00_changeXluMaterial(material, 1); - } - } - } - - if (field_0x6a6 == 2) { - dComIfGd_setListDark(); - } else if (field_0x6a6 == 3) { - dComIfGd_setListFilter(); - } - - if (field_0x5d8 != NULL) { - mpModelMorf->calc(); - if (field_0x6b5 != 0) { - field_0x5d8->entryDL(NULL); - } - } else if (field_0x6b5 != 0) { - if (mpModelMorf != NULL) { - mpModelMorf->updateDL(); - } else { - mDoExt_modelUpdateDL(field_0x5d4); - } - } else if (mpModelMorf != NULL) { - mpModelMorf->modelCalc(); - } - - if (field_0x5d4->getSkinDeform() != NULL) { - dComIfGd_setList(); - } - - if (field_0x6a6 == 2 || field_0x6a6 == 3) { - dComIfGd_setList(); - } - - if (field_0x6a7 >= 0) { - if (field_0x6a7 == 0) { - teduna_draw(field_0x5d4, &field_0x6bc, &tevStr, 22, 0x1B, 0x27, field_0x6a7); - } else if (field_0x6a7 == 1) { - teduna_draw(field_0x5d4, &field_0x6bc, &tevStr, 0x2B, 0x2B, 0x27, field_0x6a7); - } else if (field_0x6a7 == 2) { - teduna_draw(field_0x5d4, &field_0x6bc, &tevStr, 0x17, 0x1F, 0x3E, field_0x6a7); - } else if (field_0x6a7 == 3) { - teduna_draw(field_0x5d4, &field_0x6bc, &tevStr, 0x1F, 0x1F, 0x3E, field_0x6a7); - } else if (field_0x6a7 == 4) { - teduna_draw(field_0x5d4, &field_0x6bc, &tevStr, 0x17, 0x17, 0x3E, field_0x6a7); - } else if (field_0x6a7 == 6) { - teduna_ganon_hand_set(field_0x5d4, 0x20, 0x21); - } else if (field_0x6a7 == 7) { - teduna_ganon_hand_set(field_0x5d4, 0x16, 0x17); - } else if (field_0x6a7 == 5) { - teduna_draw(field_0x5d4, &field_0x6bc, &tevStr, 0, 0, 0x13, field_0x6a7); - } else if (field_0x6a7 == 8) { - if ((current.pos - field_0x291c).abs() > 200.0f) { - field_0x6b3 = 5; - for (int i = 0; i < 10; i++) { - ke_set(this); - } - } - - ke_set(this); - GXColor color; - color.r = 0x14; - color.g = 0x14; - color.b = 0x14; - color.a = 0xFF; - - if (field_0x6b5 != 0) { - field_0x2900.update(0x10, color, &tevStr); - dComIfGd_set3DlineMatDark(&field_0x2900); - } - - field_0x291c = current.pos; - if (field_0x6b3 != 0) { - field_0x6b3--; - } - } - } - - if (field_0x6b6 != 0) { - if (field_0x6b6 == 1) { - if (field_0x5d4->getModelData() != NULL) { - if (field_0x5d4->getModelData()->getMaterialNodePointer(9) != NULL) { - if (field_0x5d4->getModelData()->getMaterialNodePointer(9)->getShape() != NULL) { - field_0x5d4->getModelData()->getMaterialNodePointer(9)->getShape()->show(); - } - } - } - } else if (field_0x5d4->getModelData() != NULL) { - if (field_0x5d4->getModelData()->getMaterialNodePointer(9) != NULL) { - if (field_0x5d4->getModelData()->getMaterialNodePointer(9)->getShape() != NULL) { - field_0x5d4->getModelData()->getMaterialNodePointer(9)->getShape()->hide(); - } - } - } - } - - if (mShadow != NULL && field_0x6b7 != 0 && field_0x6b5 != 0 && field_0x6a1 != 0) { - cXyz sp98, spa4, spb0; - - MTXCopy(field_0x5d4->getAnmMtx(0), mDoMtx_stack_c::get()); - spb0.set(0.0f, 0.0f, 0.0f); - mDoMtx_stack_c::multVec(&spb0, &sp98); - mDoLib_project(&sp98, &spa4); - - if (spa4.x >= -700.0f && spa4.x < 1600.0f && spa4.y >= -200.0f && spa4.y < 600.0f) { - if (mModel.mID.field_0x18 == 0 || mModel.mID.field_0x18 == 1) { - cXyz spbc = sp98 + mShadow->field_0x4; - spbc.y = mBgc->field_0x54 + 15.0f; - mShadow->field_0x0 = dComIfGd_setShadow(mShadow->field_0x0, mModel.mID.field_0x18, field_0x5d4, - &spbc, mShadow->field_0x1c, mShadow->field_0x20, sp98.y + 15.0f, sp98.y + 3.0f, - mBgc->mGndChk, &tevStr, 0, 1.0f, dDlst_shadowControl_c::getSimpleTex()); - } else { - cXyz spc8(sp98.x, mBgc->field_0x54, sp98.z); - dComIfGd_setSimpleShadow(&spc8, spc8.y, mShadow->field_0x20, mBgc->mGndChk, 0, 1.0f, dDlst_shadowControl_c::getSimpleTex()); - } - } - } - - if (mpBtpAnm != NULL) { - mpBtpAnm->remove(field_0x5d4->getModelData()); - } - - if (mpBtkAnm != NULL) { - mpBtkAnm->remove(field_0x5d4->getModelData()); - } - - if (mpBrkAnm != NULL) { - mpBrkAnm->remove(field_0x5d4->getModelData()); - } - - if (mpBpkAnm != NULL) { - mpBpkAnm->remove(field_0x5d4->getModelData()); - } - - cXyz spd4, spe0, spec; - - MTXCopy(field_0x5d4->getAnmMtx(0), mDoMtx_stack_c::get()); - spd4.set(0.0f, 0.0f, 0.0f); - mDoMtx_stack_c::multVec(&spd4, &spe0); - eyePos = spe0; - eyePos.y = spe0.y + 50.0f; - - if (field_0x6a8 > 0) { - cXyz spf8, sp104; - dBgS_CamGndChk_Wtr cam_gndchk; - cXyz sp110; - - if ((g_Counter.mCounter0 & 0x1F) == 0) { - spf8 = eyePos; - if (field_0x6a8 == 10) { - sp110.x = 2.0f; - sp110.y = 2.0f; - sp110.z = 2.0f; - } else if (field_0x6a8 == 6) { - cXyz sp11c, sp128, sp134; - - MTXCopy(field_0x5d4->getAnmMtx(7), mDoMtx_stack_c::get()); - sp11c.set(0.0f, 0.0f, 0.0f); - mDoMtx_stack_c::multVec(&sp11c, &sp128); - spf8 = sp128; - sp110.x = 1.0f; - sp110.y = 1.0f; - sp110.z = 1.0f; - } else { - sp110.x = 1.0f; - sp110.y = 1.0f; - sp110.z = 1.0f; - } - - spf8.y += 10000.0f; - cam_gndchk.SetPos(&spf8); - spf8.y = dComIfG_Bgsp().GroundCross(&cam_gndchk); - dComIfGp_particle_setWaterRipple(&field_0x68c, *fopAcM_wt_c::getWaterCheck(), &spf8, - 0.0f, &tevStr, &sp110, fopAcM_GetRoomNo(this)); - } - } - - #ifdef DEBUG - if (field_0x6aa > -1) { - dDbVw_Report(0x32, 0x91, "DEMOTOOL ERR : Model ga arunoni hisyakai sindo meirei!!!!"); - OSReport_Error("\nDEMOTOOL ERR : Model ga arunoni hisyakai sindo meirei!!!!"); - } - - if (field_0x6ab > -1) { - dDbVw_Report(0x32, 0x91, "DEMOTOOL ERR : Model ga arunoni monokuro meirei!!!!"); - OSReport_Error("\nDEMOTOOL ERR : Model ga arunoni monokuro meirei!!!!"); - } - #endif - } - - if (field_0x6a9 >= 1) { - dCam_getBody()->StartBlure(0x19, NULL, 0.85f, 1.0f); - } - - if (field_0x6aa != -1) { - if (field_0x6aa == 1) { - g_env_light.mDemoAttentionPoint = current.pos.x; - - if (g_env_light.mDemoAttentionPoint > 1.0f) { - g_env_light.mDemoAttentionPoint = 1.0f; - } - - if (g_env_light.mDemoAttentionPoint < -1.0f) { - g_env_light.mDemoAttentionPoint = -1.0f; - } - - #ifdef DEBUG - dDbVw_Report(300, 0x19, "DEMO Depth %f", g_env_light.mDemoAttentionPoint); - #endif - } else { - cLib_addCalc(&g_env_light.mDemoAttentionPoint, 0.0f, 0.5f, 0.1f, 0.0001f); - } - } - - if (field_0x6ab >= 0) { - g_env_light.field_0x1278 = current.pos.y / 100.0f; - g_env_light.field_0x12fc = field_0x6ab; - if (g_env_light.field_0x1278 >= 1.0f) { - g_env_light.field_0x1278 = 1.0f; - } - - #ifdef DEBUG - dDbVw_Report(10, 0x17C, "\nbloom pat[%d] ratio[%f]", g_env_light.field_0x1278, field_0x6ab); - #endif - } - - switch (field_0x6b2) { - case 0: - break; - - case 1: - if (g_env_light.mHousiCount < 200) { - g_env_light.mHousiCount += 3; - } - break; - - case 2: - if (g_env_light.mHousiCount > 3) { - g_env_light.mHousiCount -= 3; - } else { - g_env_light.mHousiCount = 0; - } - break; - } - - if (field_0x69c != -1) { - if (field_0x694 != field_0x69c) { - if (field_0x694 < field_0x69c) { - field_0x694++; - } else { - field_0x694--; - } - } - - dKyw_rain_set(field_0x694); - } - - if (field_0x69e != -1) { - if (field_0x698 != field_0x69e) { - if (field_0x698 < field_0x69e) { - field_0x698++; - } else { - field_0x698--; - } - } - - g_env_light.mMoyaMode = 1; - g_env_light.mMoyaCount = field_0x698; - } - - return 1; -} - -/* 804A7B88-804A7BA8 003968 0020+00 1/0 0/0 0/0 .text daDemo00_Execute__FP10daDemo00_c */ -static int daDemo00_Execute(daDemo00_c* i_this) { - return i_this->execute(); -} - -static u8 const l_itemNo[4] = { - 0x29, - 0xFF, - 0xFF, - 0xFF, -}; - /* 804A7BA8-804A84AC 003988 0904+00 7/1 0/0 0/0 .text execute__10daDemo00_cFv */ -int daDemo00_c::execute() { - // NONMATCHING - +inline int daDemo00_c::execute() { field_0x6a1 = 0; dDemo_actor_c* actor = dDemo_c::getActor(demoActorID); @@ -1355,26 +748,27 @@ int daDemo00_c::execute() { OS_REPORT("汎用くん削除!!\n", argument); } else { if (actor->checkEnable(dDemo_actor_c::ENABLE_SHAPE_e)) { - mModel.field_0x0.mShapeID = actor->getShapeId(); + field_0x588.mShapeID = actor->getShapeId(); } if (actor->checkEnable(dDemo_actor_c::ENABLE_ANM_e)) { - mModel.field_0x0.field_0x4 = actor->getAnmId(); + field_0x588.field_0x4 = actor->getAnmId(); } - int piVar1, piVar2, piVar3; - u16 upVar1; - u8 upVar2; + int sp48, sp44, sp40; + u16 sp0E; + u8 sp09; if (actor->checkEnable(dDemo_actor_c::ENABLE_UNK_e)) { - while (actor->getDemoIDData(&piVar1, &piVar2, &piVar3, &upVar1, &upVar2) != 0) { - if (piVar1 == 0) { - switch (piVar3) { - case 0: - u16 uVar1 = upVar1 >> 8; - u32 resID8 = uVar1 & 0xFF; - switch (uVar1) { + dDemo_prm_c* sp3C = actor->getPrm(); + while (actor->getDemoIDData(&sp48, &sp44, &sp40, &sp0E, &sp09) != 0) { + if (sp48 == 0) { + switch (sp40) { + case 0: { + u16 sp0C = (sp0E >> 8) & 0xFF; + u16 resID8 = sp0E & 0xFF; // r29 + switch (sp0C) { case 1: - switch ((u8)upVar1) { + switch (resID8) { case 1: field_0x6b4 = 1; break; @@ -1398,6 +792,9 @@ int daDemo00_c::execute() { case 6: field_0x6a6 = 3; break; + + case 0: + break; } break; @@ -1414,75 +811,73 @@ int daDemo00_c::execute() { OS_REPORT("\nmground2=[%d]", mground2); break; - case 3: + case 3: { + static u8 const l_itemNo[4] = { + 0x29, + 0xFF, + 0xFF, + 0xFF, + }; JUT_ASSERT(1389, resID8 < (sizeof(l_itemNo)/sizeof(u8))); - if (l_itemNo[resID8] != 0xFF) { - execItemGet(l_itemNo[resID8]); + u8 itemNo = l_itemNo[resID8]; + if (itemNo != 0xFF) { + execItemGet(itemNo); } break; - + } case 4: case 5: case 6: - case 7: + case 7: { BOOL bVar1 = FALSE; BOOL bVar2 = FALSE; - if (uVar1 == 5 || uVar1 == 7) { + int sp30 = resID8; + if (sp0C == 5 || sp0C == 7) { bVar1 = TRUE; } - if (uVar1 == 6 || uVar1 == 7) { + if (sp0C == 6 || sp0C == 7) { bVar2 = TRUE; } - u32 uVar2 = resID8; - if (resID8 == 0xFF) { - uVar2 = 0x1A; + if (sp30 == 0xFF) { + sp30 = 0x1A; } - if (bVar1) { - if (!bVar1) { - GXColor fadeInColor; - if (!bVar2) { - fadeInColor = g_blackColor; - } else { - fadeInColor = g_saftyWhiteColor; - } - - mDoGph_gInf_c::fadeIn(1.0f / uVar2, fadeInColor); - } - } else { - GXColor fadeOutColor; - if (!bVar2) { - fadeOutColor = g_blackColor; - } else { - fadeOutColor = g_saftyWhiteColor; - } - - mDoGph_gInf_c::fadeOut(1.0f / uVar2, fadeOutColor); + switch (bVar1) { + case FALSE: + mDoGph_gInf_c::fadeIn(1.0f / sp30, !bVar2 ? g_blackColor : g_saftyWhiteColor); + break; + case TRUE: + mDoGph_gInf_c::fadeOut(1.0f / sp30, !bVar2 ? g_blackColor : g_saftyWhiteColor); + break; } break; + } + case 8: { + u32 sp2C = (resID8 & 0xC0) >> 6; + u32 sp28 = resID8 & 0x3F; - case 8: - u32 uVar4 = upVar1 & 0x3F; - - switch ((upVar1 & 0xC0) >> 6) { + switch (sp2C) { case 0: dComIfGp_getVibration().StopQuake(1); break; case 1: - dComIfGp_getVibration().StartShock(uVar4, 1, cXyz(0.0f, 1.0f, 0.0f)); + dComIfGp_getVibration().StartShock(sp28, 1, cXyz(0.0f, 1.0f, 0.0f)); break; case 2: - dComIfGp_getVibration().StartQuake(uVar4, 1, cXyz(0.0f, 1.0f, 0.0f)); + dComIfGp_getVibration().StartQuake(sp28, 1, cXyz(0.0f, 1.0f, 0.0f)); + break; default: - OS_REPORT("\nデモ汎用君振動設定エラー!!"); // Demo General-Kun Vibration Setting Error!! + // Demo General-Kun Vibration Setting Error!! + OS_REPORT("\nデモ汎用君振動設定エラー!!"); + break; } break; - + } case 9: if (resID8 == 0) { field_0x6a4 = 0; @@ -1491,15 +886,17 @@ int daDemo00_c::execute() { } break; - case 10: - if ((uVar1 & 0xFF) < 0x40) { - dKy_change_colpat(resID8); - OS_REPORT("\nパレット型[%d]へ変更", resID8); + case 10: { + int sp24 = resID8 & 0xFF; + if (sp24 < 0x40) { + dKy_change_colpat(sp24); + OS_REPORT("\nパレット型[%d]へ変更", sp24); } break; - - case 11: - switch (resID8) { + } + case 11: { + u32 sp20 = resID8; + switch (sp20) { case 0: g_env_light.mThunderEff.field_0x2 = 1; break; @@ -1529,9 +926,10 @@ int daDemo00_c::execute() { break; } break; - - case 12: - switch (resID8) { + } + case 12: { + u32 sp1C = resID8; + switch (sp1C) { case 0: field_0x6a7 = 0; break; @@ -1577,13 +975,13 @@ int daDemo00_c::execute() { break; } break; - + } case 13: - field_0x6a9 = upVar1; + field_0x6a9 = resID8; break; case 14: - field_0x6a8 = upVar1; + field_0x6a8 = resID8; break; case 15: @@ -1595,7 +993,7 @@ int daDemo00_c::execute() { break; case 16: - field_0x6ab = upVar1; + field_0x6ab = resID8; break; case 17: @@ -1663,11 +1061,11 @@ int daDemo00_c::execute() { break; case 19: - field_0x6af = upVar1; + field_0x6af = resID8; break; case 20: - field_0x6b0 = upVar1; + field_0x6b0 = resID8; break; case 21: @@ -1675,11 +1073,11 @@ int daDemo00_c::execute() { break; case 22: - field_0x6b5 = upVar1; + field_0x6b5 = resID8; break; case 23: - field_0x6b7 = upVar1; + field_0x6b7 = resID8; break; case 24: @@ -1695,24 +1093,25 @@ int daDemo00_c::execute() { sp9c.y = 1.0f; sp9c.z = 1.0f; field_0x6b9 = 1; - dComIfGp_particle_set((u16)mModel.field_0x0.mShapeID, &sp90, NULL, NULL, &sp9c); - mModel.field_0x0.reset(); - mModel.field_0x0.mShapeID = -1; + dComIfGp_particle_set((u16)field_0x588.mShapeID, &sp90, NULL, NULL, &sp9c); + field_0x588.reset(); + field_0x588.mShapeID = -1; actor->offEnable(16); break; } break; - + } case 1: - dComIfGs_onEventBit(dSv_event_flag_c::saveBitLabels[upVar1]); + dComIfGs_onEventBit((u16)dSv_event_flag_c::saveBitLabels[sp0E]); break; - case 2: - if ((upVar1 & 0xC000) == 0) { - fopAcM_create(PROC_MOVIE_PLAYER, upVar1, NULL, fopAcM_GetRoomNo(this), NULL, NULL, 0xFF); + case 2: { + u16 sp0A = sp0E & 0x3FFF; + if ((sp0E & 0xC000) == 0) { + fopAcM_create(PROC_MOVIE_PLAYER, sp0A, NULL, fopAcM_GetRoomNo(this), NULL, NULL, 0xFF); mDoGph_gInf_c::fadeOut(1.0f); } else { - switch (upVar1) { + switch (sp0A) { case 0: daMP_c::daMP_c_THPPlayerPlay(); break; @@ -1723,52 +1122,52 @@ int daDemo00_c::execute() { } } break; - + } case 3: - dComIfGs_onTmpBit(dSv_event_tmp_flag_c::tempBitLabels[upVar1]); + dComIfGs_onTmpBit((u16)dSv_event_tmp_flag_c::tempBitLabels[sp0E]); break; } } else { - switch (piVar3) { + switch (sp40) { case 1: - mModel.field_0x0.reset(); - mModel.field_0x0.mShapeID = upVar1; + field_0x588.reset(); + field_0x588.mShapeID = sp0E; break; case 2: - mModel.field_0x0.field_0x4 = upVar1; + field_0x588.field_0x4 = sp0E; break; case 3: - if (upVar2 == 0) { - mModel.field_0x0.field_0x10 = upVar1; + if (sp09 == 0) { + field_0x588.field_0x10 = sp0E; } else { - mModel.field_0x0.field_0x10 = upVar1 | 0x10000000; + field_0x588.field_0x10 = sp0E | 0x10000000; } break; case 4: - if (upVar2 == 0) { - mModel.field_0x0.field_0x14 = upVar1; + if (sp09 == 0) { + field_0x588.field_0x14 = sp0E; } else { - mModel.field_0x0.field_0x14 = upVar1 | 0x10000000; + field_0x588.field_0x14 = sp0E | 0x10000000; } break; case 5: - mModel.field_0x0.field_0xc = upVar1; + field_0x588.field_0xc = sp0E; break; case 6: - mModel.field_0x0.field_0x1c = upVar1; + field_0x588.field_0x1c = sp0E; break; case 7: - mModel.field_0x0.field_0x20 = upVar1; + field_0x588.field_0x20 = sp0E; break; case 8: - mModel.field_0x0.field_0x8 = upVar1; + field_0x588.field_0x8 = sp0E; break; } } @@ -1778,16 +1177,25 @@ int daDemo00_c::execute() { } action(actor); + + #if WIDESCREEN_SUPPORT + if (field_0x6b1 != 0) { + mDoGph_gInf_c::onWideZoom(); + } + #endif } if (field_0x6ae != 0) { - f32 cutoff = shape_angle.z / 182.04445f; + f32 cutoff = 90.0f; + cutoff = shape_angle.z / 182.04445f; GXColor color; color.r = scale.x; color.g = scale.y; color.b = scale.z; color.a = 0xFF; - dKy_BossSpotLight_set(¤t.pos, shape_angle.x / 182.04445f, shape_angle.y / 182.04445f - 90.0f, + f32 f30 = shape_angle.x / 182.04445f; + f32 f29 = shape_angle.y / 182.04445f; + dKy_BossSpotLight_set(¤t.pos, f30, f29 - 90.0f, cutoff, &color, gravity, field_0x6b0, field_0x6af); } @@ -1798,6 +1206,652 @@ int daDemo00_c::execute() { return 1; } +/* 804A60B0-804A61F0 001E90 0140+00 1/1 0/0 0/0 .text mDad00_changeXluMaterial__FP11J3DMateriali */ +static void mDad00_changeXluMaterial(J3DMaterial* i_material, int param_2) { + static J3DBlendInfo l_blendInfoOPA = { + 0, + 1, + 0, + 3, + }; + static J3DBlendInfo l_blendInfo = { + 1, + 4, + 5, + 3, + }; + static J3DZModeInfo l_zmodeInfoOPA = { + 1, + 3, + 1, + 0, + }; + static J3DZModeInfo l_zmodeInfo = { + 1, + 3, + 0, + 0, + }; + + i_material->change(); + + if (param_2 == 0) { + i_material->setMaterialMode(4); + J3DTevBlock* tevBlock = i_material->getTevBlock(); + J3DPEBlock* peBlock = i_material->getPEBlock(); + u8 tevStageNum = tevBlock->getTevStageNum(); + peBlock->getBlend()->setBlendInfo(l_blendInfo); + peBlock->getZMode()->setZModeInfo(l_zmodeInfo); + } else { + i_material->setMaterialMode(1); + J3DTevBlock* tevBlock = i_material->getTevBlock(); + J3DPEBlock* peBlock = i_material->getPEBlock(); + u8 tevStageNum = tevBlock->getTevStageNum(); + peBlock->getBlend()->setBlendInfo(l_blendInfoOPA); + peBlock->getZMode()->setZModeInfo(l_zmodeInfoOPA); + } +} + +/* 804A61F0-804A6428 001FD0 0238+00 1/1 0/0 0/0 .text teduna_calc__FP4cXyzP4cXyzP4cXyzsi */ +static void teduna_calc(cXyz* param_1, cXyz* param_2, cXyz* param_3, s16 param_4, int param_5) { + cXyz sp70(*param_1 - *param_2); + f32 f31; + f32 f30 = 6.0f; + cXyz sp7c, sp88; + + mDoMtx_stack_c::YrotS(param_4); + + if (param_5 == 1) { + sp7c.set(0.0f, -5.0f, 130.0f); + f30 = 1.0f; + } else if (param_5 == 5) { + sp7c.set(0.0f, -30.0f, 78.0f); + } else { + sp7c.set(0.0f, -30.0f, 60.0f); + } + + mDoMtx_stack_c::multVec(&sp7c, &sp88); + + for (int i = 0; i < 16; i++, param_3++) { + *param_3 = *param_1 - (sp70 * (i / 15.0f)); + f31 = cM_ssin((i / 15.0f) * 32768.0f); + *param_3 += sp88 * f31; + f32 f29 = f30 * cM_ssin(g_Counter.mCounter0 * 2500 + i * 1600); + param_3->y += f31 * f29; + } +} + +/* 804A8C64-804A8D24 000054 00C0+00 1/3 0/0 0/0 .bss teduna_posL */ +static cXyz teduna_posL[16]; + +/* 804A8D30-804A8DF0 000120 00C0+00 1/3 0/0 0/0 .bss teduna_posR */ +static cXyz teduna_posR[16]; + +/* 804A8DFC-804A8E08 0001EC 000C+00 2/4 0/0 0/0 .bss S_ganon_left_hand_pos */ +static cXyz S_ganon_left_hand_pos; + +/* 804A8E14-804A8E20 000204 000C+00 2/4 0/0 0/0 .bss S_ganon_right_hand_pos */ +static cXyz S_ganon_right_hand_pos; + +/* 804A6428-804A6868 002208 0440+00 1/1 0/0 0/0 .text teduna_draw__FP8J3DModelP19mDoExt_3DlineMat1_cP12dKy_tevstr_ciiii */ +static void teduna_draw(J3DModel* i_model, mDoExt_3DlineMat1_c* param_2, dKy_tevstr_c* param_3, int param_4, int param_5, int param_6, int param_7) { + static GXColor l_color = { + 0x14, 0x0F, 0x00, 0xFF, + }; + + cXyz sp38, sp44, sp50; + s16 sVar1 = 0; + if (param_7 == 4) { + sVar1 = -0x3875; + } else if (param_7 == 5) { + sVar1 = -7000; + } + + MTXCopy(i_model->getAnmMtx(param_6), mDoMtx_stack_c::get()); + + if (param_7 == 5) { + sp38.set(0.0f, 9.0f, 15.0f); + } else if (param_7 == 2 || param_7 == 3 || param_7 == 4) { + sp38.set(107.0f, -32.0f, -68.0f); + } else { + sp38.set(79.0f, -26.0f, -48.0f); + } + + mDoMtx_stack_c::multVec(&sp38, &sp44); + + if (param_7 == 5) { + sp50 = S_ganon_left_hand_pos; + } else { + MTXCopy(i_model->getAnmMtx(param_4), mDoMtx_stack_c::get()); + + if (param_7 == 1) { + sp38.set(61.0f, 18.0f, 0.0f); + } else if (param_7 == 3) { + sp38.set(191.0f, 28.0f, -80.0f); + } else { + sp38.set(0.0f, 0.0f, 0.0f); + } + + mDoMtx_stack_c::multVec(&sp38, &sp50); + } + + teduna_calc(&sp44, &sp50, teduna_posL, (sVar1 + 0x6000) + cM_atan2s(sp44.x - sp50.x, sp44.z - sp50.z), param_7); + MTXCopy(i_model->getAnmMtx(param_6), mDoMtx_stack_c::get()); + + if (param_7 == 5) { + sp38.set(0.0f, 9.0f, -15.0f); + } else if (param_7 == 2 || param_7 == 3 || param_7 == 4) { + sp38.set(107.0f, -32.0f, 68.0f); + } else { + sp38.set(79.0f, -26.0f, 48.0f); + } + + mDoMtx_stack_c::multVec(&sp38, &sp44); + + if (param_7 == 5) { + sp50 = S_ganon_right_hand_pos; + } else { + MTXCopy(i_model->getAnmMtx(param_5), mDoMtx_stack_c::get()); + + if (param_7 == 1) { + sp38.set(61.0f, 18.0f, 0.0f); + } else if (param_7 == 4) { + sp38.set(40.0f, -12.0f, 40.0f); + } else { + sp38.set(0.0f, 0.0f, 0.0f); + } + + mDoMtx_stack_c::multVec(&sp38, &sp50); + } + + teduna_calc(&sp44, &sp50, teduna_posR, cM_atan2s(sp44.x - sp50.x, sp44.z - sp50.z) - (sVar1 + 0x6000), param_7); + cXyz* src = teduna_posL; + cXyz* dst = param_2->getPos(0); + for (int i = 0; i < 16; i++, dst++, src++) { + *dst = *src; + } + src = teduna_posR; + dst = param_2->getPos(0) + 31; + for (int i = 0; i < 16; i++, dst--, src++) { + *dst = *src; + } + + param_2->update(0x20, l_color, param_3); + dComIfGd_set3DlineMat(param_2); +} + +/* 804A6868-804A692C 002648 00C4+00 1/1 0/0 0/0 .text teduna_ganon_hand_set__FP8J3DModelii */ +static void teduna_ganon_hand_set(J3DModel* i_model, int param_2, int param_3) { + cXyz sp20; + + MTXCopy(i_model->getAnmMtx(param_2), mDoMtx_stack_c::get()); + sp20.set(0.0f, 0.0f, 0.0f); + mDoMtx_stack_c::multVec(&sp20, &S_ganon_left_hand_pos); + + MTXCopy(i_model->getAnmMtx(param_3), mDoMtx_stack_c::get()); + sp20.set(0.0f, 0.0f, 0.0f); + mDoMtx_stack_c::multVec(&sp20, &S_ganon_right_hand_pos); +} + +/* 804A692C-804A6C48 00270C 031C+00 1/1 0/0 0/0 .text ke_control__FP10daDemo00_cP12demo_s1_ke_sif */ +static void ke_control(daDemo00_c* i_this, demo_s1_ke_s* param_2, int param_3, f32 param_4) { + param_3; + fopAc_ac_c* actor = i_this; + int i; + cXyz sp4C, sp40; + cXyz* pcVar1 = ¶m_2->field_0x0[1]; + cXyz* pcVar2 = ¶m_2->field_0xc0[1]; + + sp4C.x = 0.0f; + sp4C.y = 0.0f; + sp4C.z = param_4; + + cXyz sp34; + f32 sp28; + f32 sp24; + f32 sp20; + f32 sp1C; + s16 sp14; + s16 sp12; + s16 sp10; + + f32 f30; + f32 f29; + f32 f28; + f32 f27; + f32 f26; + f32 f25; + f32 f31; + + sp24 = -12.0f; + sp10 = cM_rndF2(65536.0f); + f26 = 3.0f; + f25 = actor->current.pos.y; + f31 = 0.8f; + + + if (i_this->field_0x6b3 != 0) { + f31 = 0.0f; + } + + for (i = 1; i < 16; i++, pcVar1++, pcVar2++) { + sp20 = f26 * cM_ssin(sp10 + i * 7000); + sp1C = f26 * cM_ssin(sp10 + 10000 + i * 6000); + f27 = (16 - i) * 0.1f; + + sp34.x = param_2->field_0x180.x * f27 + sp20 + pcVar2->x; + sp34.y = pcVar2->y + param_2->field_0x180.y * f27; + sp34.z = param_2->field_0x180.z * f27 + sp1C + pcVar2->z; + sp28 = sp34.x + (pcVar1->x - pcVar1[-1].x); + f29 = sp34.z + (pcVar1->z - pcVar1[-1].z); + f28 = pcVar1->y + sp34.y + sp24; + + if (f28 < f25) { + f28 = f25; + } + + f30 = f28 - pcVar1[-1].y; + + sp14 = (s16)-cM_atan2s(f30, f29); + sp12 = (s16)cM_atan2s(sp28, JMAFastSqrt(f30 * f30 + f29 * f29)); + cMtx_XrotS(*calc_mtx, sp14); + cMtx_YrotM(*calc_mtx, sp12); + MtxPosition(&sp4C, &sp40); + + *pcVar2 = *pcVar1; + pcVar1->x = pcVar1[-1].x + sp40.x; + pcVar1->y = pcVar1[-1].y + sp40.y; + pcVar1->z = pcVar1[-1].z + sp40.z; + pcVar2->x = f31 * (pcVar1->x - pcVar2->x); + pcVar2->y = f31 * (pcVar1->y - pcVar2->y); + pcVar2->z = f31 * (pcVar1->z - pcVar2->z); + } +} + +/* 804A6C48-804A6D20 002A28 00D8+00 1/1 0/0 0/0 .text ke_move__FP10daDemo00_cP19mDoExt_3DlineMat0_cP12demo_s1_ke_sif */ +static void ke_move(daDemo00_c* i_this, mDoExt_3DlineMat0_c* param_2, demo_s1_ke_s* param_3, int param_4, f32 param_5) { + ke_control(i_this, param_3, param_4, param_5); + cXyz* pcVar1 = param_2->getPos(param_4); + f32* pfVar1 = param_2->getSize(param_4); + + for (int i = 0; i < 16; i++, pcVar1++, pfVar1++) { + *pcVar1 = param_3->field_0x0[i]; + if (i == 14) { + *pfVar1 = 0.6f; + } else if (i < 5) { + *pfVar1 = 3.5f; + } else { + *pfVar1 = cM_rndF2(1.0f) + 1.8f; + } + } +} + +/* 804A6D20-804A6F74 002B00 0254+00 1/1 0/0 0/0 .text ke_set__FP10daDemo00_c */ +static void ke_set(daDemo00_c* i_this) { + static s16 ke_za[22] = { + 0xFCE0, 0xFE70, 0, 0x0190, 0x0320, 0xFCE0, 0xFE70, 0, 0x0190, 0x0320, + 0xFCE0, 0xFE70, 0, 0x0190, 0x0320, 0x04B0, 0xFCE0, 0xFE70, 0, + 0x0190, 0x0320, 0x04B0, + }; + + fopAc_ac_c* actor = i_this; + cXyz sp58, sp64; + cM_initRnd2(12, 0x7B, fopAcM_GetID(actor) * 2 + 0x32); + MTXCopy(i_this->mModel.field_0x5d4->getAnmMtx(4), *calc_mtx); + + f32 fVar1, fVar2, fVar3; + for (int i = 0; i < 22; i++) { + MtxPush(); + cMtx_YrotM(*calc_mtx, 0x4000); + cMtx_XrotM(*calc_mtx, (int)cM_rndF2(2000.0f) + 3000); + + if (i < 10) { + cMtx_ZrotM(*calc_mtx, ke_za[i] * 5); + fVar1 = cM_rndF2(2.25f) + 7.5f; + fVar2 = cM_rndF2(10.0f) - 5.0f; + fVar3 = cM_rndF2(20.0f) - 10.0f; + } else { + cMtx_ZrotM(*calc_mtx, ke_za[i] * 5 + 0x8000); + fVar1 = cM_rndF2(3.0f) + 8.0f; + fVar2 = cM_rndF2(20.0f) - 10.0f; + fVar3 = cM_rndF2(30.0f) - 15.0f; + } + + sp58.set(fVar2, 15.0f, fVar3); + MtxPosition(&sp58, &i_this->field_0x6f8[i].field_0x0[0]); + sp58.set(fVar2, 35.0f, fVar3); + MtxPosition(&sp58, &i_this->field_0x6f8[i].field_0x180); + + i_this->field_0x6f8[i].field_0x180 -= i_this->field_0x6f8[i].field_0x0[0]; + + ke_move(i_this, &i_this->field_0x2900, &i_this->field_0x6f8[i], i, fVar1); + MtxPull(); + } +} + +/* 804A6F74-804A6F94 002D54 0020+00 1/0 0/0 0/0 .text daDemo00_Draw__FP10daDemo00_c */ +static int daDemo00_Draw(daDemo00_c* i_this) { + return i_this->draw(); +} + +/* 804A6F94-804A7B88 002D74 0BF4+00 1/1 0/0 0/0 .text draw__10daDemo00_cFv */ +int daDemo00_c::draw() { + f32 f31 = 15.0f; + if (mModel.field_0x5d4 != NULL) { + if (field_0x6ac == 7) { + tevStr.TevColor.a = 0xFF; + } + + g_env_light.settingTevStruct(field_0x6ac, &eyePos, &tevStr); + g_env_light.setLightTevColorType_MAJI(mModel.field_0x5d4, &tevStr); + dKy_bg_MAxx_proc(mModel.field_0x5d4); + + if (mModel.mpBtpAnm != NULL) { + mModel.mpBtpAnm->entry(mModel.field_0x5d4->getModelData()); + } + + if (mModel.mpBtkAnm != NULL) { + mModel.mpBtkAnm->entry(mModel.field_0x5d4->getModelData()); + } + + if (mModel.mpBrkAnm != NULL){ + mModel.mpBrkAnm->entry(mModel.field_0x5d4->getModelData()); + } + + if (mModel.mpBpkAnm != NULL) { + mModel.mpBpkAnm->entry(mModel.field_0x5d4->getModelData()); + } + + if (mModel.mpBlkAnm != NULL) { + mModel.mpBlkAnm->entryFrame(); + } + + if (field_0x6a5 != 0) { + J3DModelData* modelData = mModel.field_0x5d4->getModelData(); + for (u16 i = 0; i < modelData->getMaterialNum(); i++) { + J3DMaterial* material = modelData->getMaterialNodePointer(i); + + if (field_0x6a5 == 1) { + mDad00_changeXluMaterial(material, 0); + } else { + mDad00_changeXluMaterial(material, 1); + } + } + } + + if (field_0x6a6 == 2) { + dComIfGd_setListDark(); + } else if (field_0x6a6 == 3) { + dComIfGd_setListFilter(); + } + + if (mModel.field_0x5d8 != NULL) { + mModel.mpModelMorf->modelCalc(); + if (field_0x6b5 != 0) { + mModel.field_0x5d8->entryDL(NULL); + } + } else if (field_0x6b5 != 0) { + if (mModel.mpModelMorf != NULL) { + mModel.mpModelMorf->updateDL(); + } else { + mDoExt_modelUpdateDL(mModel.field_0x5d4); + } + } else if (mModel.mpModelMorf != NULL) { + mModel.mpModelMorf->modelCalc(); + } + + if (mModel.field_0x5d4->getSkinDeform() != NULL) { + dComIfGd_setList(); + } + + if (field_0x6a6 == 2 || field_0x6a6 == 3) { + dComIfGd_setList(); + } + + if (field_0x6a7 >= 0) { + if (field_0x6a7 == 0) { + teduna_draw(mModel.field_0x5d4, &field_0x6bc, &tevStr, 22, 0x1B, 0x27, field_0x6a7); + } else if (field_0x6a7 == 1) { + teduna_draw(mModel.field_0x5d4, &field_0x6bc, &tevStr, 0x2B, 0x2B, 0x27, field_0x6a7); + } else if (field_0x6a7 == 2) { + teduna_draw(mModel.field_0x5d4, &field_0x6bc, &tevStr, 0x17, 0x1F, 0x3E, field_0x6a7); + } else if (field_0x6a7 == 3) { + teduna_draw(mModel.field_0x5d4, &field_0x6bc, &tevStr, 0x1F, 0x1F, 0x3E, field_0x6a7); + } else if (field_0x6a7 == 4) { + teduna_draw(mModel.field_0x5d4, &field_0x6bc, &tevStr, 0x17, 0x17, 0x3E, field_0x6a7); + } else if (field_0x6a7 == 6) { + teduna_ganon_hand_set(mModel.field_0x5d4, 0x20, 0x21); + } else if (field_0x6a7 == 7) { + teduna_ganon_hand_set(mModel.field_0x5d4, 0x16, 0x17); + } else if (field_0x6a7 == 5) { + teduna_draw(mModel.field_0x5d4, &field_0x6bc, &tevStr, 0, 0, 0x13, field_0x6a7); + } else if (field_0x6a7 == 8) { + if ((current.pos - field_0x291c).abs() > 200.0f) { + field_0x6b3 = 5; + for (int i = 0; i < 10; i++) { + ke_set(this); + } + } + + ke_set(this); + GXColor color; + color.r = 0x14; + color.g = 0x14; + color.b = 0x14; + color.a = 0xFF; + + if (field_0x6b5 != 0) { + field_0x2900.update(0x10, color, &tevStr); + dComIfGd_set3DlineMatDark(&field_0x2900); + } + + field_0x291c = current.pos; + if (field_0x6b3 != 0) { + field_0x6b3--; + } + } + } + + if (field_0x6b6 != 0) { + if (field_0x6b6 == 1) { + if (mModel.field_0x5d4->getModelData() != NULL) { + if (mModel.field_0x5d4->getModelData()->getMaterialNodePointer(9) != NULL) { + if (mModel.field_0x5d4->getModelData()->getMaterialNodePointer(9)->getShape() != NULL) { + mModel.field_0x5d4->getModelData()->getMaterialNodePointer(9)->getShape()->show(); + } + } + } + } else if (mModel.field_0x5d4->getModelData() != NULL) { + if (mModel.field_0x5d4->getModelData()->getMaterialNodePointer(9) != NULL) { + if (mModel.field_0x5d4->getModelData()->getMaterialNodePointer(9)->getShape() != NULL) { + mModel.field_0x5d4->getModelData()->getMaterialNodePointer(9)->getShape()->hide(); + } + } + } + } + + if (mModel.mShadow != NULL && field_0x6b7 != 0 && field_0x6b5 != 0 && field_0x6a1 != 0) { + cXyz sp98, spa4, spb0; + + MTXCopy(mModel.field_0x5d4->getAnmMtx(0), mDoMtx_stack_c::get()); + spb0.set(0.0f, 0.0f, 0.0f); + mDoMtx_stack_c::multVec(&spb0, &sp98); + mDoLib_project(&sp98, &spa4); + + if (spa4.x >= -700.0f && spa4.x < 1600.0f && spa4.y >= -200.0f && spa4.y < 600.0f) { + if (mModel.mID.field_0x18 == 0 || mModel.mID.field_0x18 == 1) { + cXyz spbc = sp98 + mModel.mShadow->field_0x4; + spbc.y = mModel.mBgc->field_0x54 + f31; + mModel.mShadow->field_0x0 = dComIfGd_setShadow(mModel.mShadow->field_0x0, mModel.mID.field_0x18 == 0 ? 0 : 1, mModel.field_0x5d4, + &spbc, mModel.mShadow->field_0x1c, mModel.mShadow->field_0x20, sp98.y + f31, sp98.y + 3.0f, + mModel.mBgc->mGndChk, &tevStr, 0, 1.0f, dDlst_shadowControl_c::getSimpleTex()); + } else { + cXyz spc8(sp98.x, mModel.mBgc->field_0x54, sp98.z); + dComIfGd_setSimpleShadow(&spc8, spc8.y, mModel.mShadow->field_0x20, mModel.mBgc->mGndChk, 0, 1.0f, dDlst_shadowControl_c::getSimpleTex()); + } + } + } + + if (mModel.mpBtpAnm != NULL) { + mModel.mpBtpAnm->remove(mModel.field_0x5d4->getModelData()); + } + + if (mModel.mpBtkAnm != NULL) { + mModel.mpBtkAnm->remove(mModel.field_0x5d4->getModelData()); + } + + if (mModel.mpBrkAnm != NULL) { + mModel.mpBrkAnm->remove(mModel.field_0x5d4->getModelData()); + } + + if (mModel.mpBpkAnm != NULL) { + mModel.mpBpkAnm->remove(mModel.field_0x5d4->getModelData()); + } + + cXyz spd4, spe0, spec; + + MTXCopy(mModel.field_0x5d4->getAnmMtx(0), mDoMtx_stack_c::get()); + spd4.set(0.0f, 0.0f, 0.0f); + mDoMtx_stack_c::multVec(&spd4, &spe0); + eyePos = spe0; + eyePos.y = spe0.y + 50.0f; + + if (field_0x6a8 > 0) { + cXyz spf8, sp104; + dBgS_CamGndChk_Wtr cam_gndchk; + cXyz sp110; + + if ((g_Counter.mCounter0 & 0x1F) == 0) { + spf8 = eyePos; + if (field_0x6a8 == 10) { + sp110.x = 2.0f; + sp110.y = 2.0f; + sp110.z = 2.0f; + } else if (field_0x6a8 == 6) { + cXyz sp11c, sp128, sp134; + + MTXCopy(mModel.field_0x5d4->getAnmMtx(7), mDoMtx_stack_c::get()); + sp11c.set(0.0f, 0.0f, 0.0f); + mDoMtx_stack_c::multVec(&sp11c, &sp128); + spf8 = sp128; + sp110.x = 1.0f; + sp110.y = 1.0f; + sp110.z = 1.0f; + } else { + sp110.x = 1.0f; + sp110.y = 1.0f; + sp110.z = 1.0f; + } + + spf8.y += 10000.0f; + cam_gndchk.SetPos(&spf8); + spf8.y = dComIfG_Bgsp().GroundCross(&cam_gndchk); + dComIfGp_particle_setWaterRipple(&field_0x68c, *fopAcM_wt_c::getWaterCheck(), &spf8, + 0.0f, &tevStr, &sp110, fopAcM_GetRoomNo(this)); + } + } + + #ifdef DEBUG + if (field_0x6aa > -1) { + dDbVw_Report(0x32, 0x91, "DEMOTOOL ERR : Model ga arunoni hisyakai sindo meirei!!!!"); + OSReport_Error("\nDEMOTOOL ERR : Model ga arunoni hisyakai sindo meirei!!!!"); + } + + if (field_0x6ab > -1) { + dDbVw_Report(0x32, 0x91, "DEMOTOOL ERR : Model ga arunoni monokuro meirei!!!!"); + OSReport_Error("\nDEMOTOOL ERR : Model ga arunoni monokuro meirei!!!!"); + } + #endif + } + + if (field_0x6a9 >= 1) { + dCam_getBody()->StartBlure(0x19, NULL, 0.85f, 1.0f); + } + + if (field_0x6aa != -1) { + if (field_0x6aa == 1) { + g_env_light.mDemoAttentionPoint = current.pos.x; + + if (g_env_light.mDemoAttentionPoint > 1.0f) { + g_env_light.mDemoAttentionPoint = 1.0f; + } + + if (g_env_light.mDemoAttentionPoint < -1.0f) { + g_env_light.mDemoAttentionPoint = -1.0f; + } + + #ifdef DEBUG + dDbVw_Report(300, 0x19, "DEMO Depth %f", g_env_light.mDemoAttentionPoint); + #endif + } else { + cLib_addCalc(&g_env_light.mDemoAttentionPoint, 0.0f, 0.5f, 0.1f, 0.0001f); + } + } + + if (field_0x6ab >= 0) { + g_env_light.field_0x12fc = field_0x6ab; + g_env_light.field_0x1278 = current.pos.y / 100.0f; + if (g_env_light.field_0x1278 >= 1.0f) { + g_env_light.field_0x1278 = 1.0f; + } + + #ifdef DEBUG + dDbVw_Report(10, 0x17C, "\nbloom pat[%d] ratio[%f]", g_env_light.field_0x1278, field_0x6ab); + #endif + } + + switch (field_0x6b2) { + case 0: + break; + + case 1: + if (g_env_light.mHousiCount < 200) { + g_env_light.mHousiCount += 3; + } + break; + + case 2: + if (g_env_light.mHousiCount > 3) { + g_env_light.mHousiCount -= 3; + } else { + g_env_light.mHousiCount = 0; + } + break; + } + + if (field_0x69c != -1) { + if (field_0x694 != field_0x69c) { + if (field_0x694 < field_0x69c) { + field_0x694++; + } else { + field_0x694--; + } + } + + dKyw_rain_set(field_0x694); + } + + if (field_0x69e != -1) { + if (field_0x698 != field_0x69e) { + if (field_0x698 < field_0x69e) { + field_0x698++; + } else { + field_0x698--; + } + } + + g_env_light.mMoyaMode = 1; + g_env_light.mMoyaCount = field_0x698; + } + + return 1; +} + +/* 804A7B88-804A7BA8 003968 0020+00 1/0 0/0 0/0 .text daDemo00_Execute__FP10daDemo00_c */ +static int daDemo00_Execute(daDemo00_c* i_this) { + return i_this->execute(); +} + /* 804A84AC-804A84B4 00428C 0008+00 1/0 0/0 0/0 .text daDemo00_IsDelete__FP10daDemo00_c */ static int daDemo00_IsDelete(daDemo00_c* i_this) { return 1; @@ -1805,47 +1859,46 @@ static int daDemo00_IsDelete(daDemo00_c* i_this) { /* 804A84B4-804A84DC 004294 0028+00 1/0 0/0 0/0 .text daDemo00_Delete__FP10daDemo00_c */ static int daDemo00_Delete(daDemo00_c* i_this) { - fopAcM_GetID(i_this); + fopAcM_RegisterDeleteID(i_this, "Demo00"); i_this->~daDemo00_c(); return 1; } /* 804A84DC-804A86B4 0042BC 01D8+00 1/0 0/0 0/0 .text daDemo00_Create__FP10fopAc_ac_c */ -static int daDemo00_Create(fopAc_ac_c* a_this) { - // NONMATCHING - daDemo00_c* i_this = (daDemo00_c*)a_this; +static int daDemo00_Create(fopAc_ac_c* i_this) { + fopAcM_RegisterCreateID(daDemo00_c, i_this, "Demo00"); fopAcM_ct(a_this, daDemo00_c); - i_this->field_0x6a2 = 0; - i_this->mground2 = 0; - i_this->field_0x6a4 = 0; - i_this->field_0x6b2 = 0; - i_this->field_0x69c = -1; - i_this->field_0x69e = -1; - i_this->field_0x694 = 0; - i_this->field_0x698 = 0; - i_this->field_0x568.x = 10000000.0f; - i_this->field_0x568.y = 10000000.0f; - i_this->field_0x568.z = 10000000.0f; - i_this->field_0x6a5 = 0; - i_this->field_0x6a6 = 0; - i_this->field_0x6a7 = 0xFF; - i_this->field_0x6a8 = -1; - i_this->field_0x6a9 = -1; - i_this->field_0x6aa = 0xFF; - i_this->field_0x6ab = -1; - i_this->field_0x6ac = 0; - i_this->field_0x6ad = 0; - i_this->field_0x6ae = 0; - i_this->field_0x6b8 = 0; - i_this->field_0x6b9 = 0; - i_this->field_0x6af = 3; - i_this->field_0x6b0 = 2; - i_this->field_0x6b4 = 0; - i_this->field_0x6b1 = 0; - i_this->field_0x6b5 = 1; - i_this->field_0x6b6 = 0; - i_this->field_0x6b7 = 1; + a_this->field_0x6a2 = 0; + a_this->mground2 = 0; + a_this->field_0x6a4 = 0; + a_this->field_0x6b2 = 0; + a_this->field_0x69c = -1; + a_this->field_0x69e = -1; + a_this->field_0x694 = 0; + a_this->field_0x698 = 0; + a_this->field_0x568.x = 10000000.0f; + a_this->field_0x568.y = 10000000.0f; + a_this->field_0x568.z = 10000000.0f; + a_this->field_0x6a5 = 0; + a_this->field_0x6a6 = 0; + a_this->field_0x6a7 = 0xFF; + a_this->field_0x6a8 = -1; + a_this->field_0x6a9 = -1; + a_this->field_0x6aa = 0xFF; + a_this->field_0x6ab = -1; + a_this->field_0x6ac = 0; + a_this->field_0x6ad = 0; + a_this->field_0x6ae = 0; + a_this->field_0x6b8 = 0; + a_this->field_0x6b9 = 0; + a_this->field_0x6af = 3; + a_this->field_0x6b0 = 2; + a_this->field_0x6b4 = 0; + a_this->field_0x6b1 = 0; + a_this->field_0x6b5 = 1; + a_this->field_0x6b6 = 0; + a_this->field_0x6b7 = 1; S_ganon_left_hand_pos.x = 0.0f; S_ganon_left_hand_pos.y = 0.0f; S_ganon_left_hand_pos.z = 0.0f; @@ -1853,13 +1906,13 @@ static int daDemo00_Create(fopAc_ac_c* a_this) { S_ganon_right_hand_pos.y = 0.0f; S_ganon_right_hand_pos.z = 0.0f; - return i_this->create(); + return a_this->create(); } -/* 804A86B4-804A871C 004494 0068+00 1/1 0/0 0/0 .text __ct__12demo_s1_ke_sFv */ -demo_s1_ke_s::demo_s1_ke_s() {} - AUDIO_INSTANCES; +class JAUSectionHeap; +template<> +JAUSectionHeap* JASGlobalInstance::sInstance; /* 804A8B94-804A8BB4 -00001 0020+00 1/0 0/0 0/0 .data l_daDemo00_Method */ static actor_method_class l_daDemo00_Method = { diff --git a/src/d/actor/d_a_e_rdb.cpp b/src/d/actor/d_a_e_rdb.cpp index 28cea25602c..b9e5af80e21 100644 --- a/src/d/actor/d_a_e_rdb.cpp +++ b/src/d/actor/d_a_e_rdb.cpp @@ -285,7 +285,6 @@ static int getPolyColor(cBgS_PolyInfo& i_polyInfo, int param_2, _GXColor* p_effP /* 80765B70-80765E70 000B90 0300+00 1/1 0/0 0/0 .text e_rdb_attack__FP11e_rdb_class */ static void e_rdb_attack(e_rdb_class* i_this) { - // NONMATCHING static u16 ap_name[3] = { 0x8A5C, 0x8A5D, @@ -360,7 +359,6 @@ static void e_rdb_attack(e_rdb_class* i_this) { /* 80765E70-80766188 000E90 0318+00 1/1 0/0 0/0 .text e_rdb_spin_attack__FP11e_rdb_class */ static void e_rdb_spin_attack(e_rdb_class* i_this) { - // NONMATCHING static u16 ap_name[2] = { 0x8A5F, 0x8A60, diff --git a/src/d/actor/d_a_e_wb.cpp b/src/d/actor/d_a_e_wb.cpp index 504c007a55b..67f06e1f9b0 100644 --- a/src/d/actor/d_a_e_wb.cpp +++ b/src/d/actor/d_a_e_wb.cpp @@ -1921,7 +1921,7 @@ static void e_wb_b_ikki(e_wb_class* i_this) { i_this->field_0x1690 = 0; } break; - case 4: + case 4: { dVar17 = l_HIO.mSingleRiderSpeed; dVar16 = 5.0f; i_this->mMovementType = 1; @@ -1976,6 +1976,7 @@ static void e_wb_b_ikki(e_wb_class* i_this) { } local_d6 = 0x800; break; + } case 5: if (a_this->speedF > 15.0f) { i_this->mMovementType = 2; @@ -2104,7 +2105,7 @@ static void e_wb_b_ikki2(e_wb_class* i_this) { e_rd_class* rider = (e_rd_class*)fopAcM_SearchByID(i_this->field_0x1434); switch (i_this->mActionMode) { - case -100: + case -100: { int local_a0 = dComIfGp_getEventManager().getMyStaffId("RiderBoss", NULL, 0); if (local_a0 != -1) { dComIfGp_getEventManager().cutEnd(local_a0); @@ -2112,7 +2113,8 @@ static void e_wb_b_ikki2(e_wb_class* i_this) { anm_init(i_this, 0x2a, 10.0f, 2, 1.0f); } break; - case -99: + } + case -99: { a_this->current.angle.y = 0x58f0; turn_speed = 0; local_b6 = 0; @@ -2122,6 +2124,7 @@ static void e_wb_b_ikki2(e_wb_class* i_this) { i_this->mActionMode = -98; } break; + } case -98: turn_speed = 0; break; @@ -3275,7 +3278,7 @@ static s8 e_wb_c_run(e_wb_class* i_this) { i_this->mStatusFlags |= 0x20; // fallthrough - case 1: + case 1: { cXyz target_pos(-62943.0f, -9045.0f, 70997.0f); local_10c = target_pos - a_this->current.pos; s16 target_angle = cM_atan2s(local_10c.x, local_10c.z); @@ -3291,7 +3294,7 @@ static s8 e_wb_c_run(e_wb_class* i_this) { i_this->field_0x17e1 = 1; } break; - + } case 2: if (i_this->field_0x7a6 == 0) { anm_init(i_this, 0x1b, 3.0f, 0, 1.0f); @@ -3326,7 +3329,7 @@ static s8 e_wb_c_run(e_wb_class* i_this) { case 0xc: i_this->mActionMode = 0xd; // fallthrough - case 0xd: + case 0xd: { local_10c = a_this->current.pos; local_10c.y += 500.0f; cStack_118 = coach->eyePos; @@ -3431,7 +3434,7 @@ static s8 e_wb_c_run(e_wb_class* i_this) { i_this->mMovementType = 1; i_this->mPursuitFlag = 1; break; - + } case 0x14: anm_init(i_this, 0x25, 3.0f, 2, 1.0f); i_this->mActionMode = 0x15; @@ -4069,7 +4072,7 @@ static void demo_camera(e_wb_class* i_this) { i_this->field_0x169e = 0; } break; - case 0x19: + case 0x19: { if (!a_this->eventInfo.checkCommandDemoAccrpt()) { fopAcM_orderPotentialEvent(a_this, 2, 0xffff, 0); a_this->eventInfo.onCondition(dEvtCnd_CANDEMO_e); @@ -4089,6 +4092,7 @@ static void demo_camera(e_wb_class* i_this) { } else { i_this->field_0x170c = -200.0f; } + } case 0x1a: mDoMtx_stack_c::YrotS(a_this->shape_angle.y); local_3c.x = i_this->field_0x170c; @@ -4644,7 +4648,7 @@ static void demo_camera(e_wb_class* i_this) { i_this->field_0x16a0 = 0; } break; - case 0x3e: + case 0x3e: { daObjCRVSTEEL_c* crvSteel = (daObjCRVSTEEL_c*)fopAcM_SearchByName(PROC_Obj_CRVSTEEL); if (i_this->field_0x16a0 == 20) { crvSteel->OpenSet(20.0f, 350.0f); @@ -4677,6 +4681,7 @@ static void demo_camera(e_wb_class* i_this) { i_this->field_0x169e = 0x3f; i_this->field_0x16a0 = 0; // fallthrough + } case 0x3f: if (i_this->field_0x16a0 == 40) { rdb->field_0xfe4 = 1; @@ -5916,4 +5921,5 @@ extern actor_process_profile_definition g_profile_E_WB = { AUDIO_INSTANCES; #include "JSystem/JAudio2/JAUSectionHeap.h" +template<> JAUSectionHeap* JASGlobalInstance::sInstance; diff --git a/src/d/actor/d_a_horse.cpp b/src/d/actor/d_a_horse.cpp index d3843f47b89..62c98eead88 100644 --- a/src/d/actor/d_a_horse.cpp +++ b/src/d/actor/d_a_horse.cpp @@ -3365,8 +3365,7 @@ int daHorse_c::callHorseSubstance(cXyz const* i_pos) { /* 80841468-808415B4 009628 014C+00 1/0 0/0 0/0 .text * setHorsePosAndAngleSubstance__9daHorse_cFPC4cXyzs */ -// NONMATCHING - small regalloc, equivalent -int daHorse_c::setHorsePosAndAngleSubstance(cXyz const* param_0, s16 param_1) { +void daHorse_c::setHorsePosAndAngleSubstance(cXyz const* param_0, s16 param_1) { int i, j; cXyz sp10(current.pos); diff --git a/src/d/actor/d_a_npc_gra.cpp b/src/d/actor/d_a_npc_gra.cpp index 9706a38edeb..cf21d735ba1 100644 --- a/src/d/actor/d_a_npc_gra.cpp +++ b/src/d/actor/d_a_npc_gra.cpp @@ -357,7 +357,6 @@ daNpc_grA_c::cut_type daNpc_grA_c::mEvtCutList[] = { /* 809BE94C-809BEB24 0000EC 01D8+00 1/1 0/0 0/0 .text __ct__11daNpc_grA_cFv */ daNpc_grA_c::daNpc_grA_c() : daNpcF_c() { - // NONMATCHING } /* 809BEB64-809BEDA4 000304 0240+00 1/0 0/0 0/0 .text __dt__11daNpc_grA_cFv */ diff --git a/src/d/actor/d_a_npc_shaman.cpp b/src/d/actor/d_a_npc_shaman.cpp index 2739b1de680..15bf6e456e1 100644 --- a/src/d/actor/d_a_npc_shaman.cpp +++ b/src/d/actor/d_a_npc_shaman.cpp @@ -763,7 +763,6 @@ BOOL daNpc_Sha_c::setAction(actionFunc action) { /* 80AE45DC-80AE48D0 0018FC 02F4+00 1/1 0/0 0/0 .text getSceneChangeNoTableIx__11daNpc_Sha_cFv */ int daNpc_Sha_c::getSceneChangeNoTableIx() { - // NONMATCHING int iVar2[48]; BOOL bool_array[48]; int sp_0x40 = 0; @@ -778,7 +777,7 @@ int daNpc_Sha_c::getSceneChangeNoTableIx() { u8 tmp_reg; for (int i = 0; i < 6; i++) { - eventReg = dComIfGs_getEventReg(u16(mEvtBitLabels[i])); + eventReg = dComIfGs_getEventReg((u16)mEvtBitLabels[i]); tmp_reg = 1; for (int j = 0; j < 8; j++) { @@ -799,10 +798,10 @@ int daNpc_Sha_c::getSceneChangeNoTableIx() { for (sp_0x40 = 2; sp_0x40 != 0; sp_0x40--) { for (int idx = 0; idx < 6; idx++) { - tmp_reg = dComIfGs_getTmpReg(mTmpBitLabels[idx]); - eventReg = dComIfGs_getEventReg(u16(mEvtBitLabels[idx])); + tmp_reg = dComIfGs_getTmpReg((u16)mTmpBitLabels[idx]); + eventReg = dComIfGs_getEventReg((u16)mEvtBitLabels[idx]); tmp_reg |= eventReg; - dComIfGs_setTmpReg(mTmpBitLabels[idx], tmp_reg); + dComIfGs_setTmpReg((u16)mTmpBitLabels[idx], tmp_reg); } for (int m = 0; m < 48; m++) { @@ -823,7 +822,7 @@ int daNpc_Sha_c::getSceneChangeNoTableIx() { sp_0x28++; } - eventReg = dComIfGs_getTmpReg(mTmpBitLabels[n]); + eventReg = dComIfGs_getTmpReg((u16)mTmpBitLabels[n]); if ((tmp_reg & eventReg) == 0) { iVar2[sp_0x3c] = sp_0x30; sp_0x3c++; @@ -874,7 +873,7 @@ void daNpc_Sha_c::setTempBit(int i_idx) { u8 reg_r30 = 0; u8 reg_r29 = 0; if (i_idx < 48) { - reg_r30 = dComIfGs_getTmpReg(mTmpBitLabels[i_idx / 8]); + reg_r30 = dComIfGs_getTmpReg((u16)mTmpBitLabels[i_idx / 8]); reg_r29 = 1; if (i_idx % 8 != 0) { @@ -884,7 +883,7 @@ void daNpc_Sha_c::setTempBit(int i_idx) { } reg_r30 |= reg_r29; - dComIfGs_setTmpReg(mTmpBitLabels[i_idx / 8], reg_r30); + dComIfGs_setTmpReg((u16)mTmpBitLabels[i_idx / 8], reg_r30); } } @@ -1161,17 +1160,17 @@ int daNpc_Sha_c::test(void* param_1) { } /* 80AE711C-80AE7128 000404 000C+00 1/1 0/0 0/0 .data mEvtBitLabels__11daNpc_Sha_c */ -u16 daNpc_Sha_c::mEvtBitLabels[6] = { +const u16 daNpc_Sha_c::mEvtBitLabels[6] = { 0xF0FF, 0xEFFF, 0xEEFF, 0xEDFF, 0xECFF, 0xEBFF, }; /* 80AE7128-80AE7134 000410 000C+00 2/2 0/0 0/0 .data mTmpBitLabels__11daNpc_Sha_c */ -u16 daNpc_Sha_c::mTmpBitLabels[6] = { +const u16 daNpc_Sha_c::mTmpBitLabels[6] = { 0xFAFF, 0xF9FF, 0xF8FF, 0xF7FF, 0xF6FF, 0xF5FF, }; /* 80AE7134-80AE71F4 00041C 00C0+00 1/1 0/0 0/0 .data mSceneChangeNoTable__11daNpc_Sha_c */ -int daNpc_Sha_c::mSceneChangeNoTable[48] = { +const int daNpc_Sha_c::mSceneChangeNoTable[48] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xA, 0xB, 0xC, diff --git a/src/d/actor/d_a_obj_brakeeff.cpp b/src/d/actor/d_a_obj_brakeeff.cpp index 41cade46af8..16002a3185f 100644 --- a/src/d/actor/d_a_obj_brakeeff.cpp +++ b/src/d/actor/d_a_obj_brakeeff.cpp @@ -167,7 +167,7 @@ int useHeapInit(fopAc_ac_c* i_this) { J3DAnmTevRegKey* tev_anm = static_cast(dComIfG_getObjectRes("Obj_Bef", bef_brk[a_this->mEffectType])); - if (!a_this->mpBrk->init(a_this->mpModel->getModelData(), tev_anm, 1,0,1.0f,0,-1)) { + if (!a_this->mpBrk->init(a_this->mpModel->getModelData(), tev_anm, 1, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1)) { return 0; } diff --git a/src/d/d_particle.cpp b/src/d/d_particle.cpp index 6ff34964e9e..f9b16713dff 100644 --- a/src/d/d_particle.cpp +++ b/src/d/d_particle.cpp @@ -2109,7 +2109,7 @@ void dPa_light8PcallBack::draw(JPABaseEmitter* param_1, JPABaseParticle* param_2 /* 8004E6A8-8004ED44 048FE8 069C+00 1/0 0/0 0/0 .text * draw__25dPa_gen_b_light8PcallBackFP14JPABaseEmitterP15JPABaseParticle */ -// NONMATCHING regalloc +// NONMATCHING - fpr regalloc void dPa_gen_b_light8PcallBack::draw(JPABaseEmitter* param_1, JPABaseParticle* param_2) { Mtx local_80; JGeometry::TVec3 local_8c; diff --git a/src/m_Do/m_Do_ext.cpp b/src/m_Do/m_Do_ext.cpp index 80d5a346d3b..2981337681c 100644 --- a/src/m_Do/m_Do_ext.cpp +++ b/src/m_Do/m_Do_ext.cpp @@ -775,7 +775,7 @@ static JKRSolidHeap* mDoExt_createSolidHeap(u32 i_size, JKRHeap* i_heap, u32 i_a JKRSolidHeap* createdHeap; if (i_size == 0 || i_size == 0xFFFFFFFF) { - createdHeap = JKRSolidHeap::create(0xFFFFFFFFFF, i_heap, false); + createdHeap = JKRSolidHeap::create(0xFFFFFFFF, i_heap, false); } else { i_size = ALIGN_NEXT(i_size, 0x10); i_size += 0x80;