Skip to content

Commit

Permalink
More d_a_item funcs (#20)
Browse files Browse the repository at this point in the history
* More d_a_item funcs

* Fix create and floats
  • Loading branch information
LagoLunatic authored Sep 12, 2023
1 parent dc8d4d3 commit 7287bab
Show file tree
Hide file tree
Showing 13 changed files with 361 additions and 82 deletions.
10 changes: 9 additions & 1 deletion include/SSystem/SComponent/c_cc_d.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,15 @@ class cCcD_AabAttr;
class cCcD_CylAttr;
class cCcD_SphAttr;

enum cCcD_ObjAtType {};
enum cCcD_ObjAtType {
/* 0x00000002 */ AT_TYPE_SWORD = (1 << 1),
/* 0x00000020 */ AT_TYPE_BOMB = (1 << 5),
/* 0x00000040 */ AT_TYPE_BOOMERANG = (1 << 6),
/* 0x00004000 */ AT_TYPE_NORMAL_ARROW = (1 << 14),
/* 0x00040000 */ AT_TYPE_FIRE_ARROW = (1 << 18),
/* 0x00080000 */ AT_TYPE_ICE_ARROW = (1 << 19),
/* 0x00100000 */ AT_TYPE_LIGHT_ARROW = (1 << 20),
};

class cCcD_ShapeAttr {
public:
Expand Down
31 changes: 27 additions & 4 deletions include/d/actor/d_a_item.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define D_A_ITEM_H

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

class daItem_c : public daItemBase_c {
public:
Expand All @@ -28,7 +29,7 @@ class daItem_c : public daItemBase_c {
void itemDefaultRotateY();
bool checkItemDisappear();
void setItemTimer(int);
bool checkPlayerGet();
BOOL checkPlayerGet();
void itemActionForRupee();
void itemActionForHeart();
void itemActionForKey();
Expand All @@ -45,14 +46,36 @@ class daItem_c : public daItemBase_c {
void mode_water();
void initAction();
s32 _daItem_isdelete();

s32 checkControl();
s32 startControl();
s32 endControl();
s32 checkLock();
s32 setLock();
s32 releaseLock();
s32 checkActionNow();

public:
u8 temp1[0x20];
/* 0x648 */ s32 mSwitchId;
/* 0x64C */ s32 mActivationSwitch;
/* 0x650 */ f32 field3_0x650;
/* 0x654 */ u8 field4_0x654[0x658 - 0x654];
/* 0x658 */ s16 mItemTimer;
/* 0x65A */ s16 field7_0x65a;
/* 0x65C */ s16 field8_0x65c;
/* 0x65E */ u8 field10_0x65e[0x667 - 0x65E];
/* 0x667 */ u8 mUnknownParam;
/* 0x668 */ u8 mItemAction;
/* 0x669 */ u8 mStatusFlags;
/* 0x66A */ u8 mMode;
/* 0x66B */ u8 mCurAction;
u8 temp2[0x54];
/* 0x66B */ u8 mCurState;
/* 0x66C */ u8 field23_0x66c[0x6BC - 0x66C];
// /* 0x674 */ dPa_rippleEcallBack mPtclRippleCb;
// /* 0x688 */ dPa_followEcallBack mPtclFollowCb;
// /* 0x69C */ dPa_smokeEcallBack mPtclSmokeCb;
/* 0x6BC */ JPABaseEmitter* mpParticleEmitter;
};

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

#endif /* D_A_ITEM_H */
30 changes: 16 additions & 14 deletions include/d/actor/d_a_itembase.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

#include "f_op/f_op_actor.h"
#include "SSystem/SComponent/c_phase.h"
#include "d/d_bg_s.h"
#include "d/d_bg_s_acch.h"
#include "d/d_cc_d.h"

class mDoExt_btkAnm;
class mDoExt_brkAnm;
Expand All @@ -15,17 +18,22 @@ struct daItemBase_c_m_data {
/* 0x0C */ float mScaleAnimSpeed;
/* 0x10 */ float field4_0x10;
/* 0x14 */ short field5_0x14;
/* 0x16 */ short field6_0x16;
/* 0x16 */ short mDuration;
/* 0x18 */ short field7_0x18;
/* 0x1A */ u8 field8_0x1a;
/* 0x1B */ u8 field9_0x1b;
/* 0x1C */ short mNumFramesPerFullSpin;
u8 temp1[0x26];
u8 temp1[0x1A];
/* 0x38 */ f32 mPickedUpInitialSpeedY;
/* 0x3C */ f32 mPickedUpGravity;
/* 0x40 */ short field45_0x40;
/* 0x42 */ short field47_0x42;
u8 temp2[0x4];
/* 0x48 */ float mVelocityScale;
};

STATIC_ASSERT(sizeof(daItemBase_c_m_data) == 0x4C);

struct daItemBase_c : public fopAc_ac_c {
public:
s32 DeleteBase(const char*);
Expand All @@ -46,12 +54,10 @@ struct daItemBase_c : public fopAc_ac_c {
void hide();
void show();
void changeDraw();
void chkDraw();
bool chkDraw();
void dead();
void chkDead();
void setLoadError();
void CheckItemCreateHeap(fopAc_ac_c*);
void CheckFieldItemCreateHeap(fopAc_ac_c*);

daItemBase_c_m_data* getData();

Expand All @@ -66,15 +72,11 @@ struct daItemBase_c : public fopAc_ac_c {
/* 0x2B0 */ mDoExt_brkAnm* mBrkAnm1;
/* 0x2B4 */ mDoExt_brkAnm* mBrkAnm2;
/* 0x2B8 */ mDoExt_bckAnm* mBckAnm;
// /* 0x2BC */ dBgS_Acch mAcch;
// /* 0x480 */ dBgS_AcchCir mAcchCir;
// /* 0x4C0 */ dCcD_Stts mStts;
// /* 0x4FC */ dCcD_Cyl mCyl;
// /* 0x62C */ undefined field14_0x62c;
// /* 0x62D */ undefined field15_0x62d;
// /* 0x62E */ undefined field16_0x62e;
// /* 0x62F */ undefined field17_0x62f;
u8 temp[0x374];
/* 0x2BC */ dBgS_Acch mAcch;
/* 0x480 */ dBgS_AcchCir mAcchCir;
/* 0x4C0 */ dCcD_Stts mStts;
/* 0x4FC */ dCcD_Cyl mCyl;
/* 0x62C */ u8 field14_0x62c[0x630 - 0x62C];
/* 0x630 */ int mPickupFlag;
/* 0x634 */ int field19_0x634;
/* 0x638 */ short field20_0x638;
Expand Down
2 changes: 1 addition & 1 deletion include/d/actor/d_a_itembase_static.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ void dead();
void chkDead();
void setLoadError();
void CheckItemCreateHeap(fopAc_ac_c*);
void CheckFieldItemCreateHeap(fopAc_ac_c*);
s32 CheckFieldItemCreateHeap(fopAc_ac_c*);

#endif /* D_A_ITEMBASE_STATIC_H */
16 changes: 16 additions & 0 deletions include/d/d_com_inf_game.h
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,14 @@ inline BOOL dComIfGs_isSwitch(s32 i_no, s32 i_roomNo) {
return g_dComIfG_gameInfo.save.isSwitch(i_no, i_roomNo);
}

inline void dComIfGs_onItem(int bitNo, int roomNo) {
g_dComIfG_gameInfo.save.onItem(bitNo, roomNo);
}

inline bool dComIfGs_isItem(int bitNo, int roomNo) {
return g_dComIfG_gameInfo.save.isItem(bitNo, roomNo);
}

/**
* === PLAY ===
*/
Expand Down Expand Up @@ -507,6 +515,10 @@ inline dBgS* dComIfG_Bgsp() {
return &g_dComIfG_gameInfo.play.mBgS;
}

inline dCcS* dComIfG_Ccsp() {
return &g_dComIfG_gameInfo.play.mCcS;
}

inline daShip_c* dComIfGp_getShipActor() {
return (daShip_c*)g_dComIfG_gameInfo.play.getPlayerPtr(2);
}
Expand All @@ -519,6 +531,10 @@ inline dStage_stageDt_c& dComIfGp_getStage() {
return g_dComIfG_gameInfo.play.getStage();
}

inline daPy_py_c* daPy_getPlayerActorClass() {
return (daPy_py_c*)dComIfGp_getPlayer(0);
}

inline daPy_lk_c* daPy_getPlayerLinkActorClass() {
return (daPy_lk_c*)g_dComIfG_gameInfo.play.getPlayerPtr(0);
}
Expand Down
2 changes: 2 additions & 0 deletions include/d/d_item.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef D_ITEM_H
#define D_ITEM_H

#include "dolphin/types.h"

void execItemGet(u8 itemNo);
BOOL checkItemGet(u8 itemNo, BOOL defaultVal);
void item_func_heart();
Expand Down
33 changes: 31 additions & 2 deletions include/d/d_item_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,29 @@ struct dItem_data_item_resource {

STATIC_ASSERT(sizeof(dItem_data_item_resource) == 0x24);

struct dItem_data_field_item_res {
/* 0x00 */ char * mModelArcName;
/* 0x04 */ short mModelFileId;
/* 0x06 */ short mBtkAnmResIdx1;
/* 0x08 */ short mBtkAnmResIdx2;
/* 0x0A */ short mBrkAnmResIdx1;
/* 0x0C */ short mBrkAnmResIdx2;
/* 0x0E */ short mBckAnmResIdx;
/* 0x10 */ u8 mTevRegAnimFrameIndex;
/* 0x11 */ u8 field8_0x11;
/* 0x12 */ u8 field9_0x12;
/* 0x13 */ u8 field10_0x13;
/* 0x14 */ u8 field11_0x14;
/* 0x15 */ u8 field12_0x15;
/* 0x16 */ u8 field13_0x16;
/* 0x17 */ u8 field14_0x17;
/* 0x18 */ u16 mHeapSize;
/* 0x1A */ u8 field16_0x1a;
/* 0x1B */ u8 field17_0x1b;
};

STATIC_ASSERT(sizeof(dItem_data_field_item_res) == 0x1C);

struct dItem_data_item_info {
/* 0x00 */ u8 mMaybeShadowRelated;
/* 0x01 */ u8 mCollisionH; // Cylinder Height
Expand All @@ -293,8 +316,14 @@ STATIC_ASSERT(sizeof(dItem_data_item_info) == 0x4);

class dItem_data {
public:
static dItem_data_item_resource item_resource[0x100];
static dItem_data_item_info item_info[0x100];
static dItem_data_item_resource item_resource[0x100];
static dItem_data_field_item_res field_item_res[0x100];
static dItem_data_item_info item_info[0x100];

static bool checkAppearEffect(u8 itemNo);
static s16 getAppearEffect(u8 itemNo);
static bool checkSpecialEffect(u8 itemNo);
static u16 getSpecialEffect(u8 itemNo);
};

#endif /* D_ITEM_DATA_H */
Loading

0 comments on commit 7287bab

Please sign in to comment.