d_a_obj_bird_sp Almost implemented, mismatched update function

This commit is contained in:
Sebastian Snoer
2025-05-27 17:56:56 +02:00
parent 5105ef985b
commit 4a0dfc55cc
6 changed files with 97 additions and 7 deletions
+1 -1
View File
@@ -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
fn_129_8DD0 = .text:0x00008DD0; // type:function size:0xB8
speedUpAccel__FR7mVec3_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
@@ -2,15 +2,15 @@ _prolog = .text:0x00000000; // type:function size:0x2C scope:global
_epilog = .text:0x00000030; // type:function size:0x2C scope:global
_unresolved = .text:0x00000060; // type:function size:0x4 scope:global
dAcObjBirdSp_c_classInit__Fv = .text:0x00000070; // type:function size:0x54
fn_241_D0 = .text:0x000000D0; // type:function size:0x8
AcObjBirdSp__init = .text:0x000000E0; // type:function size:0xC4
AcObjBirdSp__update = .text:0x000001B0; // type:function size:0x230
fn_241_3E0 = .text:0x000003E0; // type:function size:0x8
createHeap__14dAcObjBirdSp_cFv = .text:0x000000D0; // type:function size:0x8
create__14dAcObjBirdSp_cFv = .text:0x000000E0; // type:function size:0xC4
actorExecute__14dAcObjBirdSp_cFv = .text:0x000001B0; // type:function size:0x230
draw__14dAcObjBirdSp_cFv = .text:0x000003E0; // type:function size:0x8
__dt__14dAcObjBirdSp_cFv = .text:0x000003F0; // type:function size:0x68
_ctors = .ctors:0x00000000; // type:label scope:global
_dtors = .dtors:0x00000000; // type:label scope:global
lbl_241_rodata_0 = .rodata:0x00000000; // type:object size:0x18 data:float
AcObjBirdSp__colliderInit = .data:0x00000000; // type:object size:0x30
g_profile_OBJ_BIRD_SP_UP = .data:0x00000030; // type:object size:0x10
lbl_241_data_40 = .data:0x00000040; // type:object size:0x20
AcObjBirdSp__vtable = .data:0x00000060; // type:object size:0x80
@14827 = .data:0x00000040; // type:object size:0x20 scope:local
__vt__14dAcObjBirdSp_c = .data:0x00000060; // type:object size:0x80
+8
View File
@@ -26,11 +26,19 @@ public:
STATE_FUNC_DECLARE(dBird_c, MiniGameEnd);
STATE_FUNC_DECLARE(dBird_c, MiniGameLevelUpDemo);
// fn_129_8DD0, only referenced by d_a_obj_bird_sp
void speedUpAccel(mVec3_c &param);
s16 getNumDashes() const {
return mNumDashes;
}
static dBird_c *getInstance() {
return spInstance;
}
private:
static dBird_c *spInstance;
/* 0x??? */ STATE_MGR_DECLARE(dBird_c);
u8 _0x36C[0xF8E - 0x36C];
/* 0xF8E */ s16 mNumDashes;
+8
View File
@@ -2,13 +2,21 @@
#define D_A_OBJ_BIRD_SP_H
#include "d/a/obj/d_a_obj_base.h"
#include "d/col/cc/d_cc_d.h"
class dAcObjBirdSp_c : public dAcObjBase_c {
public:
dAcObjBirdSp_c() {}
virtual ~dAcObjBirdSp_c() {}
virtual bool createHeap() override;
virtual int create() override;
virtual int actorExecute() override;
virtual int draw() override;
private:
static dCcD_SrcSph sCcSrc;
/* 0x330 */ dCcD_Sph mCollider;
};
#endif
+4
View File
@@ -18,6 +18,8 @@ STATE_DEFINE(dBird_c, MiniGameMove);
STATE_DEFINE(dBird_c, MiniGameEnd);
STATE_DEFINE(dBird_c, MiniGameLevelUpDemo);
dBird_c *dBird_c::spInstance;
void dBird_c::initializeState_Wait() {}
void dBird_c::executeState_Wait() {}
void dBird_c::finalizeState_Wait() {}
@@ -63,3 +65,5 @@ void dBird_c::finalizeState_MiniGameEnd() {}
void dBird_c::initializeState_MiniGameLevelUpDemo() {}
void dBird_c::executeState_MiniGameLevelUpDemo() {}
void dBird_c::finalizeState_MiniGameLevelUpDemo() {}
void speedUpAccel(mVec3_c &param) {}
+70
View File
@@ -1,3 +1,73 @@
#include "d/a/obj/d_a_obj_bird_sp.h"
#include "d/a/d_a_bird.h"
#include "d/col/cc/d_cc_s.h"
#include "f/f_base.h"
#include "f/f_profile_name.h"
#include "m/m_mtx.h"
// clang-format off
dCcD_SrcSph dAcObjBirdSp_c::sCcSrc = {
/* mObjInf */ {
/* mObjAt */ {0, 2, {0, 0, 0}, 0, 0, 0, 0, 0, 0},
/* mObjTg */ {0xfeb77fff, 0x00000105, {0, 00, 0x407}, 0, 0},
/* mObjCo */ {0x00004029}},
/* mSphInf */ {1000.0f}
};
// clang-format on
SPECIAL_ACTOR_PROFILE(OBJ_BIRD_SP_UP, dAcObjBirdSp_c, fProfile::OBJ_BIRD_SP_UP, 0x260, 0, 1);
bool dAcObjBirdSp_c::createHeap() {
return SUCCEEDED;
}
int dAcObjBirdSp_c::create() {
CREATE_ALLOCATOR(dAcObjBirdSp_c);
boundingBox.Set(mVec3_c(-2000, -2000, -2000), mVec3_c(2000, 2000, 2000));
mCollider.Set(sCcSrc);
mCollider.SetStts(mStts);
mCollider.SetR(mScale.x * 1000.0f);
return SUCCEEDED;
}
int dAcObjBirdSp_c::actorExecute() {
/* if its colliding with Bird or Player */
if (mCollider.ChkCoHit() && mCollider.GetCoActor() != nullptr &&
(mCollider.GetCoActor()->profile_name == fProfile::BIRD ||
mCollider.GetCoActor()->profile_name == fProfile::PLAYER)) {
mVec3_c posChange(0, -0.2, 1.0);
mMtx_c matrix;
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) {
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);
}
mCollider.SetC(position);
dCcS::GetInstance()->Set(&mCollider);
PSMTXTrans(mWorldMtx.m, position.x, position.y, position.z);
mWorldMtx.ZXYrotM((mAng3_c &)position);
return SUCCEEDED;
}
int dAcObjBirdSp_c::draw() {
return SUCCEEDED;
}