Skip to content

Commit

Permalink
Merge pull request #80 from LagoLunatic/item
Browse files Browse the repository at this point in the history
d_a_item progress
  • Loading branch information
magcius authored Sep 25, 2023
2 parents 2b617eb + 7c3f492 commit dece2fa
Show file tree
Hide file tree
Showing 15 changed files with 744 additions and 288 deletions.
50 changes: 35 additions & 15 deletions include/d/actor/d_a_item.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,20 @@

#include "d/actor/d_a_itembase.h"
#include "d/d_particle.h"
#include "f_pc/f_pc_manager.h"

class daItem_c : public daItemBase_c {
public:
typedef void (daItem_c::*daItem_c_ModeFunc)();

daItem_c() : mPtclFollowCb(0, 0), mPtclSmokeCb(1) {}

float getYOffset();
void set_mtx();
void set_mtx_base(J3DModel*, cXyz, csXyz);
void CreateInit();
s32 _daItem_create();
s32 _daItem_execute();
BOOL _daItem_execute();
void mode_proc_call();
void execInitNormalDirection();
void execMainNormalDirection();
Expand All @@ -24,12 +27,12 @@ class daItem_c : public daItemBase_c {
void execWaitMain();
void execWaitMainFromBoss();
void scaleAnimFromBossItem();
s32 _daItem_draw();
BOOL _daItem_draw();
void setTevStr();
s32 _daItem_delete();
BOOL _daItem_delete();
void itemGetExecute();
void itemDefaultRotateY();
bool checkItemDisappear();
BOOL checkItemDisappear();
void setItemTimer(int);
BOOL checkPlayerGet();
void itemActionForRupee();
Expand All @@ -40,14 +43,14 @@ class daItem_c : public daItemBase_c {
void itemActionForArrow();
void checkWall();
void set_bound_se();
s32 checkGetItem();
void timeCount();
BOOL checkGetItem();
BOOL timeCount();
void mode_wait_init();
void mode_water_init();
void mode_wait();
void mode_water();
void initAction();
s32 _daItem_isdelete();
BOOL _daItem_isdelete();

s32 checkControl();
s32 startControl();
Expand All @@ -58,29 +61,46 @@ class daItem_c : public daItemBase_c {
s32 checkActionNow();

static dCcD_SrcCyl m_cyl_src;
static s32 m_timer_max;

public:
/* 0x63C */ cXyz mScaleTarget;
/* 0x648 */ s32 mSwitchId;
/* 0x64C */ s32 mActivationSwitch;
/* 0x650 */ f32 field3_0x650;
/* 0x654 */ u8 field4_0x654[0x658 - 0x654];
/* 0x650 */ f32 field_0x650;
/* 0x654 */ s16 field_0x654;
/* 0x656 */ s16 field_0x656;
/* 0x658 */ s16 mItemTimer;
/* 0x65A */ s16 field7_0x65a;
/* 0x65C */ s16 field8_0x65c;
/* 0x65E */ u8 field10_0x65e[0x667 - 0x65E];
/* 0x667 */ u8 mUnknownParam;
/* 0x668 */ u8 mItemAction;
/* 0x65A */ s16 field_0x65a;
/* 0x65C */ s16 field_0x65c;
/* 0x65E */ s16 mExtraZRot;
/* 0x660 */ u8 field_0x660[0x667 - 0x660];
/* 0x667 */ u8 mType;
/* 0x668 */ u8 mAction;
/* 0x669 */ u8 mStatusFlags;
/* 0x66A */ u8 mMode;
/* 0x66B */ u8 mCurState;
/* 0x66C */ u8 field23_0x66c[0x674 - 0x66C];
/* 0x66C */ u8 field_0x66c;
/* 0x66D */ u8 field_0x66D[0x670 - 0x66D];
/* 0x670 */ u32 mDemoItemBsPcId;
/* 0x674 */ dPa_rippleEcallBack mPtclRippleCb;
/* 0x688 */ dPa_followEcallBack mPtclFollowCb;
/* 0x69C */ dPa_smokeEcallBack mPtclSmokeCb;
/* 0x6BC */ JPABaseEmitter* mpParticleEmitter;

// TODO add enums for type, action, state, and status flags
// state 7 is probably "about to start an item get demo"
};

STATIC_ASSERT(sizeof(daItem_c) == 0x6C0);

namespace daItem_prm {
inline u32 getType(daItem_c* item) { return (fpcM_GetParam(item) & 0x03000000) >> 0x18; }
inline u32 getAction(daItem_c* item) { return (fpcM_GetParam(item) & 0xFC000000) >> 0x1A; }
inline u32 getItemNo(daItem_c* item) { return (fpcM_GetParam(item) & 0x000000FF) >> 0x00; }
inline u32 getItemBitNo(daItem_c* item) { return (fpcM_GetParam(item) & 0x0000FF00) >> 0x08; }
inline u32 getSwitchNo(daItem_c* item) { return (item->orig.angle.z & 0x00FF) >> 0; }
inline u32 getSwitchNo2(daItem_c* item) { return (fpcM_GetParam(item) & 0x00FF0000) >> 0x10; }
};

#endif /* D_A_ITEM_H */
33 changes: 17 additions & 16 deletions include/d/actor/d_a_itembase.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,25 @@ class mDoExt_brkAnm;
class mDoExt_bckAnm;

struct daItemBase_c_m_data {
/* 0x00 */ float mFieldItemGravity;
/* 0x04 */ float field1_0x4;
/* 0x08 */ float field2_0x8;
/* 0x0C */ float mScaleAnimSpeed;
/* 0x10 */ float field4_0x10;
/* 0x14 */ short field5_0x14;
/* 0x16 */ short mDuration;
/* 0x18 */ short field7_0x18;
/* 0x1A */ u8 field8_0x1a;
/* 0x1B */ u8 field9_0x1b;
/* 0x1C */ short mNumFramesPerFullSpin;
u8 temp1[0x1A];
/* 0x00 */ f32 mFieldItemGravity;
/* 0x04 */ f32 field_0x04;
/* 0x08 */ f32 field_0x08;
/* 0x0C */ f32 mScaleAnimSpeed;
/* 0x10 */ f32 field_0x10;
/* 0x14 */ s16 field_0x14;
/* 0x16 */ s16 mDuration;
/* 0x18 */ s16 field_0x18;
/* 0x1A */ u8 field_0x1A[0x1C - 0x1A];
/* 0x1C */ s16 mNumFramesPerFullSpin;
/* 0x1E */ u8 field_0x1E[0x2A - 0x1E];
/* 0x2A */ s16 mHeartMaxRandomZRot;
/* 0x2C */ u8 field_0x2C[0x38 - 0x2C];
/* 0x38 */ f32 mPickedUpInitialSpeedY;
/* 0x3C */ f32 mPickedUpGravity;
/* 0x40 */ short field45_0x40;
/* 0x42 */ short field47_0x42;
u8 temp2[0x4];
/* 0x48 */ float mVelocityScale;
/* 0x40 */ s16 field_0x40;
/* 0x42 */ s16 field_0x42;
/* 0x44 */ void* field_0x44;
/* 0x48 */ f32 mVelocityScale;
};

STATIC_ASSERT(sizeof(daItemBase_c_m_data) == 0x4C);
Expand Down
2 changes: 1 addition & 1 deletion include/d/actor/d_a_player.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class daPy_py_c : public fopAc_ac_c {
void getLeftHandPos() const;
void getRopeJumpLand() const;
void checkRopeForceEnd() const;
cXyz getHeadTopPos() const;
cXyz getHeadTopPos() const { return mHeadTopPos; }
void changePlayer(fopAc_ac_c*);
void objWindHitCheck(dCcD_Cyl*);
void setDoButtonQuake();
Expand Down
12 changes: 6 additions & 6 deletions include/d/d_cc_d.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ struct dCcD_SrcCps {
class dCcD_GStts : public cCcD_GStts {
public:
dCcD_GStts();
virtual ~dCcD_GStts();
virtual ~dCcD_GStts() {}

void Ct();
void Move();
Expand Down Expand Up @@ -108,7 +108,7 @@ class dCcD_Stts : public cCcD_Stts, public dCcD_GStts {
virtual void Ct();
virtual void ClrAt();
virtual void ClrTg();
virtual ~dCcD_Stts();
virtual ~dCcD_Stts() {}

}; // Size = 0x3C

Expand Down Expand Up @@ -140,7 +140,7 @@ class dCcD_GAtTgCoCommonBase {
void SetEffCounterTimer();
void SubtractEffCounter() { mEffCounter -= 1; }
bool ChkEffCounter() { return mEffCounter >= 0; }
virtual ~dCcD_GAtTgCoCommonBase();
virtual ~dCcD_GAtTgCoCommonBase() {}

void ClrEffCounter() { mEffCounter = 0; }
u32 GetGFlag() const { return mGFlag; }
Expand All @@ -161,7 +161,7 @@ class dCcD_GAtTgCoCommonBase {
class dCcD_GObjAt : public dCcD_GAtTgCoCommonBase {
public:
void Set(dCcD_SrcGObjAt const&);
virtual ~dCcD_GObjAt();
virtual ~dCcD_GObjAt() {}
void SetVec(cXyz& vec) { mVec = vec; }
cXyz& GetVec() { return mVec; }
cXyz* GetVecP() { return &mVec; }
Expand Down Expand Up @@ -192,7 +192,7 @@ class dCcD_GObjAt : public dCcD_GAtTgCoCommonBase {
class dCcD_GObjTg : public dCcD_GAtTgCoCommonBase {
public:
void Set(dCcD_SrcGObjTg const&);
virtual ~dCcD_GObjTg();
virtual ~dCcD_GObjTg() {}
void SetSe(u8 se) { mSe = se; }
void SetVec(cXyz& vec) { mVec = vec; }
cXyz& GetVec() { return mVec; }
Expand Down Expand Up @@ -222,7 +222,7 @@ class dCcD_GObjTg : public dCcD_GAtTgCoCommonBase {
// Correction (Co) Collider
class dCcD_GObjCo : public dCcD_GAtTgCoCommonBase {
public:
virtual ~dCcD_GObjCo();
virtual ~dCcD_GObjCo() {}
void Set(dCcD_SrcGObjCo const& pSrc) { dCcD_GAtTgCoCommonBase::Set(pSrc.mBase); }
}; // Size = 0x1C ?

Expand Down
28 changes: 26 additions & 2 deletions include/d/d_com_inf_game.h
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,10 @@ inline void dComIfGs_onSaveTbox(int i_stageNo, int i_no) {
void dComIfGs_onStageTbox(int i_stageNo, int i_no);
BOOL dComIfGs_isStageTbox(int i_stageNo, int i_no);

inline void dComIfGs_onSaveSwitch(int i_stageNo, int i_no) {
g_dComIfG_gameInfo.save.getSavedata().getSave(i_stageNo).getBit().onSwitch(i_no);
}

BOOL dComIfGs_isStageBossEnemy(int i_stageNo);

inline BOOL dComIfGs_isStageBossEnemy() {
Expand Down Expand Up @@ -699,6 +703,22 @@ inline BOOL dComIfGs_isGetItem(int i_field, u8 i_item) {
return g_dComIfG_gameInfo.save.getPlayer().getGetItem().isItem(i_field, i_item);
}

inline BOOL dComIfGs_isGetItemBeast(u8 i_beast) {
return g_dComIfG_gameInfo.save.getPlayer().getGetBagItem().isBeast(i_beast);
}

inline void dComIfGs_onGetItemBeast(u8 i_beast) {
g_dComIfG_gameInfo.save.getPlayer().getGetBagItem().onBeast(i_beast);
}

inline BOOL dComIfGs_isGetItemBait(u8 i_bait) {
return g_dComIfG_gameInfo.save.getPlayer().getGetBagItem().isBait(i_bait);
}

inline void dComIfGs_onGetItemBait(u8 i_bait) {
g_dComIfG_gameInfo.save.getPlayer().getGetBagItem().onBait(i_bait);
}

inline s16 dComIfGs_getWindY() {
return g_dComIfG_gameInfo.save.getPlayer().getPlayerStatusB().getWindY();
}
Expand Down Expand Up @@ -1246,8 +1266,12 @@ inline char* dComIfGp_evmng_getMyStringP(int staffIdx, const char* name) {
return reinterpret_cast<char*>(dComIfGp_getEventManager().getMySubstanceP(staffIdx, name, 4)); //type 4 is string
}

inline BOOL dComIfGp_evmng_startCheck(char* eventID) {
return dComIfGp_getEventManager().startCheckOld(eventID);
inline BOOL dComIfGp_evmng_startCheck(const char* pName) {
return dComIfGp_getEventManager().startCheckOld(pName);
}

inline BOOL dComIfGp_evmng_endCheck(const char* pName) {
return dComIfGp_getEventManager().endCheckOld(pName);
}

inline BOOL dComIfGp_evmng_endCheck(s16 eventID) {
Expand Down
28 changes: 14 additions & 14 deletions include/d/d_item.h
Original file line number Diff line number Diff line change
Expand Up @@ -377,20 +377,20 @@ void item_getcheck_func_lithograph14();
void item_getcheck_func_lithograph15();
void item_getcheck_func_lithograph16();
void getRotenItemNumInBag();
BOOL isDaizaItem(unsigned char);
BOOL isBomb(unsigned char);
void isArrow(unsigned char);
void isEmono(unsigned char);
void isEsa(unsigned char);
void isRupee(unsigned char);
void isLimitedItem(unsigned char);
void isNonSavedEmono(unsigned char);
BOOL isUseClothPacket(unsigned char);
void isTriforce(unsigned char);
void isHeart(unsigned char);
void getItemNoByLife(unsigned char);
BOOL isDaizaItem(u8);
BOOL isBomb(u8);
BOOL isArrow(u8);
BOOL isEmono(u8);
BOOL isEsa(u8);
BOOL isRupee(u8);
BOOL isLimitedItem(u8);
BOOL isNonSavedEmono(u8);
BOOL isUseClothPacket(u8);
BOOL isTriforce(u8);
BOOL isHeart(u8);
void getItemNoByLife(u8);
void check_itemno(int);
void getEmonoItemFromLifeBallTable(unsigned short);
void getItemFromLifeBallTableWithoutEmono(unsigned short);
void getEmonoItemFromLifeBallTable(u16);
void getItemFromLifeBallTableWithoutEmono(u16);

#endif /* D_ITEM_H */
2 changes: 1 addition & 1 deletion include/d/d_item_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ struct dItem_data_item_info {
/* 0x00 */ u8 mShadowSize;
/* 0x01 */ u8 mCollisionH; // Cylinder Height
/* 0x02 */ u8 mCollisionR; // Cylinder Radius
/* 0x03 */ u8 mFlag;
/* 0x03 */ u8 mFlag; // TODO enum
};

STATIC_ASSERT(sizeof(dItem_data_item_info) == 0x4);
Expand Down
2 changes: 1 addition & 1 deletion include/d/d_particle.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class dPa_followEcallBack : public dPa_levelEcallBack {

STATIC_ASSERT(sizeof(dPa_followEcallBack) == 0x14);

class dPa_smokeEcallBack : dPa_followEcallBack {
class dPa_smokeEcallBack : public dPa_followEcallBack {
public:
dPa_smokeEcallBack(u8);
virtual ~dPa_smokeEcallBack();
Expand Down
4 changes: 4 additions & 0 deletions include/f_op/f_op_actor.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,18 +172,22 @@ class JntHit_c;

struct fopAc_cullSizeSphere {
public:
#ifndef __INTELLISENSE__
fopAc_cullSizeSphere() {}
fopAc_cullSizeSphere(cXyz, float);
#endif

/* 0x0 */ Vec mCenter;
/* 0xC */ f32 mRadius;
};

struct fopAc_cullSizeBox {
public:
#ifndef __INTELLISENSE__
fopAc_cullSizeBox() {}
fopAc_cullSizeBox(const fopAc_cullSizeBox&);
fopAc_cullSizeBox(cXyz, cXyz);
#endif

/* 0x0 */ Vec mMin;
/* 0xC */ Vec mMax;
Expand Down
15 changes: 5 additions & 10 deletions include/f_op/f_op_actor_mng.h
Original file line number Diff line number Diff line change
Expand Up @@ -412,23 +412,18 @@ s32 fopAcM_rollPlayerCrash(fopAc_ac_c*, f32, u32);
s32 fopAcM_checkCullingBox(f32[3][4], f32, f32, f32, f32, f32, f32);
s32 fopAcM_cullingCheck(fopAc_ac_c*);
void* event_second_actor(u16);
s32 fopAcM_orderTalkEvent(fopAc_ac_c*, fopAc_ac_c*, u16, u16);
s32 fopAcM_orderTalkItemBtnEvent(u16, fopAc_ac_c*, fopAc_ac_c*, u16, u16);
s32 fopAcM_orderTalkEvent(fopAc_ac_c*, fopAc_ac_c*);
s32 fopAcM_orderSpeakEvent(fopAc_ac_c* i_actor);
s32 fopAcM_orderDoorEvent(fopAc_ac_c*, fopAc_ac_c*, u16, u16);
s32 fopAcM_orderCatchEvent(fopAc_ac_c*, fopAc_ac_c*, u16, u16);
s32 fopAcM_orderOtherEvent(fopAc_ac_c*, char*, u16, u16, u16);
s32 fopAcM_orderOtherEvent(fopAc_ac_c*, fopAc_ac_c*, char*, u16, u16, u16);
s32 fopAcM_orderDoorEvent(fopAc_ac_c*, fopAc_ac_c*);
s32 fopAcM_orderCatchEvent(fopAc_ac_c*, fopAc_ac_c*);
s32 fopAcM_orderOtherEvent2(fopAc_ac_c*, char*, u16, u16);
s32 fopAcM_orderChangeEventId(fopAc_ac_c* i_this, s16 eventIdx, u16 flag, u16 hind);
s32 fopAcM_orderChangeEventId(fopAc_ac_c* i_this, fopAc_ac_c* i_partner, s16 eventIdx, u16 flag, u16 hind);
s32 fopAcM_orderOtherEventId(fopAc_ac_c* actor, s16 eventID, u8 mapToolID, u16 param_3,
u16 priority, u16 flag);
s32 fopAcM_orderMapToolEvent(fopAc_ac_c*, u8, s16, u16, u16, u16);
s32 fopAcM_orderMapToolAutoNextEvent(fopAc_ac_c*, u8, s16, u16, u16, u16);
s32 fopAcM_orderPotentialEvent(fopAc_ac_c*, u16, u16, u16);
s32 fopAcM_orderItemEvent(fopAc_ac_c*, u16, u16);
s32 fopAcM_orderTreasureEvent(fopAc_ac_c*, fopAc_ac_c*, u16, u16);
s32 fopAcM_orderItemEvent(fopAc_ac_c*);
s32 fopAcM_orderTreasureEvent(fopAc_ac_c*, fopAc_ac_c*);
fopAc_ac_c* fopAcM_getTalkEventPartner(fopAc_ac_c*);
fopAc_ac_c* fopAcM_getItemEventPartner(fopAc_ac_c*);
fopAc_ac_c* fopAcM_getEventPartner(fopAc_ac_c*);
Expand Down
2 changes: 1 addition & 1 deletion src/d/actor/d_a_agb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ void daAgb_c::modeLoad() {
(this->*func)();
} else {
mUploadAction = 0;
mEvtInfo.onCondition(1);
mEvtInfo.onCondition(dEvtCnd_CANTALK_e);
mMode = 0;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/d/actor/d_a_arrow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ void daArrow_c::arrowShooting() {
setArrowShootSe();

if (mArrowType == TYPE_LIGHT && !mbShotByZelda) {
if (strcmp(dComIfGp_getStartStageName(), "GanonK") != 0) {
if (strcmp(dComIfGp_getStartStageName(), "GanonK") != 0) {
// Not in Puppet Ganon's boss room.
mCps.SetAtSpl((dCcG_At_Spl)0xB);
}
Expand Down
Loading

0 comments on commit dece2fa

Please sign in to comment.