Merge pull request #189 from Seba244c/d_a_obj_bird_sp

d_a_obj_bird_sp Implementation
This commit is contained in:
robojumper
2025-05-28 19:15:24 +02:00
committed by GitHub
7 changed files with 95 additions and 10 deletions
+2 -2
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
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
@@ -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
lbl_241_rodata_0 = .rodata:0x00000000; // type:object size:0x18 scope:local 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
+1 -1
View File
@@ -1957,7 +1957,7 @@ config.libs = [
Rel(
NonMatching, "d_a_obj_bigbomb_flower", "REL/d/a/obj/d_a_obj_bigbomb_flower.cpp"
),
Rel(NonMatching, "d_a_obj_bird_sp", "REL/d/a/obj/d_a_obj_bird_sp.cpp"),
Rel(Matching, "d_a_obj_bird_sp", "REL/d/a/obj/d_a_obj_bird_sp.cpp"),
Rel(Matching, "d_a_obj_bird_statue", "REL/d/a/obj/d_a_obj_bird_statue.cpp"),
Rel(NonMatching, "d_a_obj_blade", "REL/d/a/obj/d_a_obj_blade.cpp"),
Rel(NonMatching, "d_a_obj_blast_rock", "REL/d/a/obj/d_a_obj_blast_rock.cpp"),
+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 accelerateTowards(mVec3_c &targetDirection);
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 dBird_c::accelerateTowards(mVec3_c &targetDirection) {}
+65
View File
@@ -1,3 +1,68 @@
#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"
#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},
// 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}
};
// 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);
f32 angle = (position - dBird_c::getInstance()->position).dot(posChange);
if (angle < 0.0f) {
posChange = -posChange;
}
posChange *= 1000.0f;
posChange += position;
posChange -= dBird_c::getInstance()->position;
dBird_c::getInstance()->accelerateTowards(posChange);
}
mCollider.SetC(position);
dCcS::GetInstance()->Set(&mCollider);
mWorldMtx.transS(position.x, position.y, position.z);
mWorldMtx.ZXYrotM(rotation);
return SUCCEEDED;
}
int dAcObjBirdSp_c::draw() {
return SUCCEEDED;
}