diff --git a/config/SOUE01/rels/d_a_birdNP/symbols.txt b/config/SOUE01/rels/d_a_birdNP/symbols.txt index 47d12cac..1b9b48bb 100644 --- a/config/SOUE01/rels/d_a_birdNP/symbols.txt +++ b/config/SOUE01/rels/d_a_birdNP/symbols.txt @@ -91,7 +91,7 @@ fn_129_8390 = .text:0x00008390; // type:function size:0x374 fn_129_8710 = .text:0x00008710; // type:function size:0x29C fn_129_89B0 = .text:0x000089B0; // type:function size:0x3C4 fn_129_8D80 = .text:0x00008D80; // type:function size:0x4C -speedUpAccel__FR7mVec3_c = .text:0x00008DD0; // type:function size:0xB8 +accelerateTowards__7dBird_cFR7mVec3_c = .text:0x00008DD0; // type:function size:0xB8 fn_129_8E90 = .text:0x00008E90; // type:function size:0x2B4 changesRot = .text:0x00009150; // type:function size:0x74 fn_129_91D0 = .text:0x000091D0; // type:function size:0x374 @@ -252,7 +252,7 @@ lbl_129_data_B50 = .data:0x00000B50; // type:object size:0xC data:string lbl_129_data_B5C = .data:0x00000B5C; // type:object size:0xC __global_destructor_chain = .bss:0x00000000; // type:object size:0x4 scope:global lbl_129_bss_8 = .bss:0x00000008; // type:object size:0x14 data:4byte -LOFTWING_POINTER = .bss:0x0000001C; // type:object size:0x94 data:4byte +spInstance__7dBird_c = .bss:0x0000001C; // type:object size:0x94 data:4byte AcBird__STATE_MOVE = .bss:0x000000B0; // type:object size:0x40 data:4byte AcBird__STATE_HIDE = .bss:0x000000F0; // type:object size:0x40 data:4byte AcBird__STATE_RIDE_DEMO = .bss:0x00000130; // type:object size:0xC0 data:4byte diff --git a/include/d/a/d_a_bird.h b/include/d/a/d_a_bird.h index dcc03a6d..05450e45 100644 --- a/include/d/a/d_a_bird.h +++ b/include/d/a/d_a_bird.h @@ -27,7 +27,7 @@ public: STATE_FUNC_DECLARE(dBird_c, MiniGameLevelUpDemo); // fn_129_8DD0, only referenced by d_a_obj_bird_sp - void speedUpAccel(mVec3_c ¶m); + void accelerateTowards(mVec3_c &targetDirection); s16 getNumDashes() const { return mNumDashes; diff --git a/include/d/col/c/c_cc_d.h b/include/d/col/c/c_cc_d.h index 574e6b8a..d3a0cf5a 100644 --- a/include/d/col/c/c_cc_d.h +++ b/include/d/col/c/c_cc_d.h @@ -360,10 +360,6 @@ enum dCcD_ObjAtType { /* 0x 0200 0000 */ AT_TYPE_0x2000000 = (1 << 25), /* 0x 0400 0000 */ AT_TYPE_KOLOKTOS_SWORD = (1 << 26), /* 0x 0800 0000 */ AT_TYPE_0x8000000 = (1 << 27), - /* 0x 1000 0000 */ AT_TYPE_0x10000000 = (1 << 28), - /* 0x 2000 0000 */ AT_TYPE_0x20000000 = (1 << 29), - /* 0x 4000 0000 */ AT_TYPE_0x40000000 = (1 << 30), - /* 0x 8000 0000 */ AT_TYPE_0x80000000 = (1 << 31), /* 0x 0148 8200 */ AT_TYPE_COMMON0 = AT_TYPE_BUGNET | AT_TYPE_BEETLE | AT_TYPE_0x80000 | AT_TYPE_0x8000 | AT_TYPE_WIND, }; diff --git a/src/REL/d/a/d_a_bird.cpp b/src/REL/d/a/d_a_bird.cpp index 7344c800..581a8ad9 100644 --- a/src/REL/d/a/d_a_bird.cpp +++ b/src/REL/d/a/d_a_bird.cpp @@ -66,4 +66,4 @@ void dBird_c::initializeState_MiniGameLevelUpDemo() {} void dBird_c::executeState_MiniGameLevelUpDemo() {} void dBird_c::finalizeState_MiniGameLevelUpDemo() {} -void speedUpAccel(mVec3_c ¶m) {} +void dBird_c::accelerateTowards(mVec3_c &targetDirection) {} diff --git a/src/REL/d/a/obj/d_a_obj_bird_sp.cpp b/src/REL/d/a/obj/d_a_obj_bird_sp.cpp index 7d6ab62f..6d8301b5 100644 --- a/src/REL/d/a/obj/d_a_obj_bird_sp.cpp +++ b/src/REL/d/a/obj/d_a_obj_bird_sp.cpp @@ -1,6 +1,7 @@ #include "d/a/obj/d_a_obj_bird_sp.h" #include "d/a/d_a_bird.h" +#include "d/col/c/c_cc_d.h" #include "d/col/cc/d_cc_s.h" #include "f/f_base.h" #include "f/f_profile_name.h" @@ -10,35 +11,8 @@ dCcD_SrcSph dAcObjBirdSp_c::sCcSrc = { /* mObjInf */ { /* mObjAt */ {0, 2, {0, 0, 0}, 0, 0, 0, 0, 0, 0}, - /* mObjTg */ {(AT_TYPE_0x1 | - AT_TYPE_SWORD | - AT_TYPE_0x4 | - AT_TYPE_PHYSICS | - AT_TYPE_0x10 | - AT_TYPE_BOMB | - AT_TYPE_0x40 | - AT_TYPE_SLINGSHOT | - AT_TYPE_0x100 | - AT_TYPE_WIND | - AT_TYPE_DAMAGE | - AT_TYPE_WHIP | - AT_TYPE_0x1000 | - AT_TYPE_ARROW | - AT_TYPE_CLAWSHOT | - AT_TYPE_BELLOWS | - AT_TYPE_0x20000 | - AT_TYPE_0x40000 | - AT_TYPE_BUBBLE | - AT_TYPE_0x200000 | - AT_TYPE_0x800000 | - AT_TYPE_0x2000000 | - AT_TYPE_KOLOKTOS_SWORD | - AT_TYPE_0x8000000 | - AT_TYPE_0x10000000 | - AT_TYPE_0x20000000 | - AT_TYPE_0x40000000 | - AT_TYPE_0x80000000 - ), 0x00000105, {0, 00, 0x407}, 0, 0}, + // AT_TYPE_COMMON0 - AT_TYPE_WIND + /* mObjTg */ {~(AT_TYPE_BUGNET | AT_TYPE_BEETLE | AT_TYPE_0x80000 | AT_TYPE_0x8000), 0x00000105, {0, 00, 0x407}, 0, 0}, /* mObjCo */ {0x00004029}}, /* mSphInf */ {1000.0f} }; @@ -70,28 +44,21 @@ int dAcObjBirdSp_c::actorExecute() { matrix.ZXYrotS(rotation); PSMTXMultVec(matrix.m, posChange, posChange); - // Current most accurate solution - if ((position.z - dBird_c::getInstance()->position.z) * posChange.z + - (position.y - dBird_c::getInstance()->position.y) * posChange.y + - (position.x - dBird_c::getInstance()->position.x) * posChange.x < - 0) { + f32 angle = (position - dBird_c::getInstance()->position).dot(posChange); + if (angle < 0.0f) { posChange = -posChange; } - // !! I think the error occurs down here, and the if statement i think matches as good as i can get it to - // First attempt - /* posChange = (posChange * 1000 + position) - dBird_c::getInstance()->position; */ - // Current most accurate solution - posChange.x = (posChange.x * 1000.0f + position.x) - dBird_c::getInstance()->position.x; - posChange.y = (posChange.y * 1000.0f + position.y) - dBird_c::getInstance()->position.y; - posChange.z = (posChange.z * 1000.0f + position.z) - dBird_c::getInstance()->position.z; - dBird_c::getInstance()->speedUpAccel(posChange); + posChange *= 1000.0f; + posChange += position; + posChange -= dBird_c::getInstance()->position; + dBird_c::getInstance()->accelerateTowards(posChange); } mCollider.SetC(position); dCcS::GetInstance()->Set(&mCollider); - PSMTXTrans(mWorldMtx.m, position.x, position.y, position.z); - mWorldMtx.ZXYrotM((mAng3_c &)position); + mWorldMtx.transS(position.x, position.y, position.z); + mWorldMtx.ZXYrotM(rotation); return SUCCEEDED; }