Merge pull request #334 from lepelog/bee

Bee
This commit is contained in:
robojumper
2026-07-26 19:08:51 +02:00
committed by GitHub
12 changed files with 911 additions and 38 deletions
+1 -1
View File
@@ -72,7 +72,7 @@ public:
enum AcProperties_e {
AC_PROP_0x1 = (1 << 0),
AC_PROP_0x2 = (1 << 1),
AC_PROP_0x4 = (1 << 2),
AC_PROP_0x4 = (1 << 2), // when set, also update in event
AC_PROP_0x100 = (1 << 8),
AC_PROP_0x400 = (1 << 10),
AC_PROP_0x800 = (1 << 11),
+6
View File
@@ -45,8 +45,14 @@ public:
STATE_FUNC_DECLARE(dAcEbc_c, AAttack);
STATE_FUNC_DECLARE(dAcEbc_c, ADamage);
u8 getField_0x130D() const {
return field_0x130D;
}
private:
/* 0x??? */ STATE_MGR_DECLARE(dAcEbc_c);
/* 0x??? */ u8 field_unk[0xF59];
/* 0x130D */ u8 field_0x130D;
};
#endif
+78 -1
View File
@@ -1,14 +1,91 @@
#ifndef D_A_NPC_BEE_H
#define D_A_NPC_BEE_H
#include "common.h"
#include "d/a/d_a_base.h"
#include "d/a/e/d_a_en_base.h"
#include "d/a/npc/d_a_npc_honeycomb.h"
#include "d/a/obj/d_a_obj_base.h"
#include "d/col/cc/d_cc_d.h"
#include "d/d_cc.h"
#include "m/m3d/m_proc.h"
#include "m/m_angle.h"
#include "m/m_vec.h"
#include "nw4r/g3d/res/g3d_resfile.h"
class dAcOSpore_c;
class dAcNpcBeeSingleBee {
public:
enum State {
BEE_STATE_DEAD = 0,
BEE_STATE_CHASE = 1,
BEE_STATE_FLY_TO_HIVE = 2,
BEE_STATE_FLY_UP = 3,
BEE_STATE_BLOWN_AWAY = 4,
BEE_STATE_RISE = 5,
BEE_STATE_CRAWL = 0xA,
};
/* 0x000 */ u8 mIndex;
/* 0x001 */ u8 mBeeState; // see State enum
/* 0x002 */ u8 mActionTimer;
/* 0x003 */ bool mIsFlying;
/* 0x004 */ u8 field_0x004; // unused
/* 0x005 */ u8 mSubState;
/* 0x006 */ u8 mDisableAttackTimer;
/* 0x007 */ u8 mSwordDodgeTimer;
/* 0x008 */ bool mHide;
/* 0x009 */ u8 mAttackCooldownTimer;
/* 0x00A */ bool mIsAttacking;
/* 0x00B */ u8 mWallReflectTimer;
/* 0x00C */ s16 mTimer; // only counts up, used for kinda random calculations
/* 0x00E */ s16 mFlyingStatesTimer; // used for vanishing after flying up and something else
/* 0x010 */ f32 mCrawlingSpeed;
/* 0x014 */ f32 mSpeed;
/* 0x018 */ mVec3_c mPos;
/* 0x024 */ mVec3_c field_0x024;
/* 0x030 */ mVec3_c mSwordDodgeOffset;
/* 0x03C */ mVec3_c mOldPos;
/* 0x048 */ mVec3_c field_0x048;
/* 0x054 */ mVec3_c mTargetPos; // Either an absolute target or relative to the attacked actor
/* 0x060 */ mAng3_c mCrawlingRotation;
/* 0x066 */ mAng3_c mModelRotation;
/* 0x06C */ dCcD_Linked_Sph mCollider;
};
class dAcNpcBee_c : public dAcEnBase_c {
public:
dAcNpcBee_c() {}
dAcNpcBee_c() : mRes(nullptr) {}
virtual ~dAcNpcBee_c() {}
virtual bool createHeap() override;
virtual int create() override;
virtual int actorExecute() override;
virtual int draw() override;
virtual int doDelete() override;
u32 updateSwarmBeeColliders();
void actuallyUpdateSwarmBees();
void handleBeeCrawlingOnHive(dAcNpcBeeSingleBee *bee);
void handleBeeFlyingStates(dAcNpcBeeSingleBee *bee);
void handleBeeRising(dAcNpcBeeSingleBee *bee);
s32 beeCheckWallFloorCollision(dAcNpcBeeSingleBee *bee);
void handleBeeBlownAway(dAcNpcBeeSingleBee *bee);
private:
/* 0x0378 */ u8 mSwarmBeeCount;
/* 0x0379 */ u8 mRumbleTimer;
/* 0x037A */ u8 mSceneflag;
/* 0x037C */ s16 mFrameCounter; // used to only search for new targets every 16 frames
/* 0x0380 */ f32 mAttackActorDistFromHome;
/* 0x0384 */ u8 field_0x0384[4]; // unused
/* 0x0388 */ nw4r::g3d::ResFile mRes;
/* 0x038C */ dShpProc1_c mBeeModels[4];
/* 0x045C */ dAcNpcBeeSingleBee mBees[100]; // only 20 slots are used
/* 0xB80C */ dAcRef_c<dAcNpcHc_c> mHiveRef;
/* 0xB818 */ dAcRef_c<dAcObjBase_c> mAttackRef;
/* 0xB824 */ dColliderLinkedList mColliderList;
/* 0xB830 */ mVec3_c mAliveBeePos; // overwritten by all alive bees, so it's the last on in the list
/* 0xB83C */ dAcObjBase_c *mAttackActor;
/* 0xB840 */ dAcOSpore_c *mSporeActor;
};
#endif
+7 -1
View File
@@ -2,13 +2,19 @@
#define D_A_NPC_HONEYCOMB_H
#include "d/a/e/d_a_en_base.h"
#include "m/m_vec.h"
class dAcNpcHc_c : public dAcEnBase_c {
public:
dAcNpcHc_c() {}
virtual ~dAcNpcHc_c() {}
private:
// private:
/* 0x378 */ u8 field_0x378[0x915 - 0x378];
/* 0x915 */ u8 field_0x915;
/* 0x916 */ u8 field_0x916;
/* 0x917 */ u8 field_0x917[0x928 - 0x917];
/* 0x928 */ mVec3_c field_0x928;
};
#endif
@@ -8,6 +8,7 @@ class dAcNpcIcgKobun_c : public dAcNpc_c {
public:
dAcNpcIcgKobun_c() : mStateMgr(*this) {}
virtual ~dAcNpcIcgKobun_c() {}
void fn_66_30C0(u32 itemId);
private:
/* 0x??? */ STATE_MGR_DECLARE(dAcNpcIcgKobun_c);
+11
View File
@@ -1,13 +1,24 @@
#ifndef D_A_O_SPORE_H
#define D_A_O_SPORE_H
#include "common.h"
#include "d/a/obj/d_a_obj_base.h"
#include "f/f_list_mg.h"
class dAcOSpore_c : public dAcObjBase_c {
public:
dAcOSpore_c() {}
virtual ~dAcOSpore_c() {}
static fLiNdBa_c *getListHead();
s32 getSporeType() const {
return mParams & 0xF;
}
bool isGlitteringSpore() const {
return getSporeType() == 1;
}
private:
static fLiMgBa_c sSpores;
};
#endif
+4
View File
@@ -276,6 +276,10 @@ public:
return cM::atan2s(y, absXZ());
}
s32 atan2sXZ_Y() const {
return -atan2sY_XZ();
}
f32 angle(const mVec3_c &other) const {
return EGG::Vector3f::angle(other);
}
+6 -1
View File
@@ -6,13 +6,15 @@
#include "m/m_allocator.h"
#include "m/m_mtx.h"
#include "m/m_vec.h"
#include "nw4r/g3d/res/g3d_resfile.h"
#include "nw4r/g3d/res/g3d_resmat.h"
#include "nw4r/g3d/res/g3d_resmdl.h"
#include "nw4r/g3d/res/g3d_resshp.h"
/** a process for drawing shapes directly */
class dShpProcBase_c : public m3d::proc_c {
public:
dShpProcBase_c(): mLightSetId(1) {}
dShpProcBase_c() : mLightSetId(1) {}
virtual ~dShpProcBase_c() {}
void setResMat(nw4r::g3d::ResMat mat);
@@ -59,6 +61,9 @@ public:
}
bool create(nw4r::g3d::ResMat mat, nw4r::g3d::ResShp shp, s32 count, mHeapAllocator_c *alloc, bool xlu, u32 *pSize);
bool create(nw4r::g3d::ResMdl mdl, s32 count, mHeapAllocator_c *alloc, bool xlu, u32 *pSize) {
return create(mdl.GetResMat(0), mdl.GetResShp(0), count, alloc, xlu, pSize);
}
void draw();
void setTransform(s32 idx, const mMtx_c &transform) {