From 6e58e660d5ea5eaf077ca96c5148a7fb371ab998 Mon Sep 17 00:00:00 2001 From: TakaRikka <38417346+TakaRikka@users.noreply.github.com> Date: Fri, 15 Dec 2023 06:04:05 -0800 Subject: [PATCH] work on link bow, kandelaar, and whistle (#2004) --- include/Z2AudioLib/Z2Creature.h | 1 + include/d/a/d_a_alink.h | 16 +- include/d/a/d_a_player.h | 1 + include/d/com/d_com_inf_game.h | 9 + include/d/d_k_wmark.h | 5 + include/d/event/d_event.h | 1 + include/d/particle/d_particle_copoly.h | 29 +- include/f_op/f_op_kankyo_mng.h | 4 +- include/rel/d/a/d_a_arrow/d_a_arrow.h | 21 +- include/rel/d/a/e/d_a_e_sm2/d_a_e_sm2.h | 81 ++++- include/rel/d/a/npc/d_a_npc_tk/d_a_npc_tk.h | 1 + .../tag/d_a_tag_shop_item/d_a_tag_shop_item.h | 10 +- .../a/tag/d_a_tag_ss_drink/d_a_tag_ss_drink.h | 2 +- rel/d/a/e/d_a_e_sm2/d_a_e_sm2.cpp | 3 +- .../d_a_tag_shop_item/d_a_tag_shop_item.cpp | 155 +++++---- src/d/a/d_a_alink.cpp | 4 +- src/d/a/d_a_alink_bow.inc | 314 +++++++++++++++++- src/d/a/d_a_alink_effect.inc | 62 ++-- src/d/a/d_a_alink_kandelaar.inc | 275 +++++++++++++-- src/d/a/d_a_alink_swim.inc | 4 +- src/d/a/d_a_alink_whistle.inc | 233 +++++++++++-- 21 files changed, 1038 insertions(+), 193 deletions(-) diff --git a/include/Z2AudioLib/Z2Creature.h b/include/Z2AudioLib/Z2Creature.h index 31e26a5d79e..45128bc3b0f 100644 --- a/include/Z2AudioLib/Z2Creature.h +++ b/include/Z2AudioLib/Z2Creature.h @@ -79,6 +79,7 @@ public: u8 getMoveSpeed() const { return mMoveSpeed; } bool isRiding() const { return mRiding; } void i_setLinkState(u8 i_state) { mLinkState = i_state; } + Z2SoundObjSimple& getKantera() { return mKantera; } static Z2CreatureLink* mLinkPtr; diff --git a/include/d/a/d_a_alink.h b/include/d/a/d_a_alink.h index 09549f3264b..f3ef092aea3 100644 --- a/include/d/a/d_a_alink.h +++ b/include/d/a/d_a_alink.h @@ -653,6 +653,7 @@ public: FTANM_UNK_3 = 3, FTANM_UNK_4 = 4, FTANM_UNK_8 = 8, + FTANM_UNK_9 = 9, FTANM_UNK_13 = 0x13, FTANM_UNK_14 = 0x14, FTANM_UNK_27 = 0x27, @@ -1420,7 +1421,7 @@ public: /* 800B26AC */ BOOL midnaTalkTrigger() const; /* 800B26B8 */ BOOL swordSwingTrigger(); /* 800B26DC */ void setItemActionButtonStatus(u8); - /* 800B26FC */ void itemActionTrigger(); + /* 800B26FC */ BOOL itemActionTrigger(); /* 800B271C */ void setStickData(); /* 800B2EA4 */ void setAtnList(); /* 800B3220 */ void setRStatus(u8); @@ -1852,7 +1853,7 @@ public: /* 800DEE1C */ BOOL cancelBowMove(); /* 800DEEDC */ void setBowReadyAnime(); /* 800DEFB8 */ void setBowReloadAnime(); - /* 800DF0BC */ void checkUpperItemActionBow(); + /* 800DF0BC */ BOOL checkUpperItemActionBow(); /* 800DF798 */ void checkUpperItemActionBowFly(); /* 800DF814 */ int checkNextActionBow(); /* 800DFAE8 */ void setBowModel(); @@ -2496,7 +2497,7 @@ public: /* 80110E84 */ void setKandelaarModel(); /* 80110F88 */ void resetOilBottleModel(); /* 80110FE0 */ void commonKandelaarPourInit(); - /* 801110B8 */ void commonKandelaarPour(int); + /* 801110B8 */ int commonKandelaarPour(int); /* 8011130C */ void initKandelaarSwing(); /* 80111440 */ int procKandelaarSwingInit(); /* 801115CC */ int procKandelaarSwing(); @@ -3208,6 +3209,8 @@ public: bool checkFisingRodLure() const { return mEquipItem == noentry73; } BOOL doTrigger() const { return mItemTrigger & BTN_A; } bool swordTrigger() { return itemTriggerCheck(BTN_B); } + BOOL grassCancelTrigger() { return itemTriggerCheck(BTN_B); } + BOOL arrowChangeTrigger() { return itemActionTrigger(); } bool peepSubjectCancelTrigger() { return itemTriggerCheck(0x8); } u32 getStartMode() { return (fopAcM_GetParam(this) >> 0xC) & 0x1F; } inline bool checkInputOnR() const; @@ -3575,8 +3578,7 @@ private: /* 0x02D80 */ int field_0x2d80; /* 0x02D84 */ Z2WolfHowlMgr mZ2WolfHowlMgr; /* 0x02E44 */ dJntCol_c field_0x2e44; - /* 0x02E54 */ dPaPo_c field_0x2e54; - /* 0x02E8C */ u8 field_0x2e8c[0x90]; + /* 0x02E54 */ dPaPoF_c field_0x2e54; /* 0x02F1C */ dPaPo_c* field_0x2f1c; /* 0x02F20 */ dPa_hermiteEcallBack_c field_0x2f20; /* 0x02F38 */ dPa_hermiteEcallBack_c field_0x2f38; @@ -6004,8 +6006,8 @@ public: /* 0x42 */ s16 mColorReg2R; /* 0x44 */ s16 mColorReg2G; /* 0x46 */ s16 mColorReg2B; - /* 0x48 */ u16 mNormalOilLoss; - /* 0x4A */ u16 mShakeOilLoss; + /* 0x48 */ s16 mNormalOilLoss; + /* 0x4A */ s16 mShakeOilLoss; /* 0x4C */ f32 mFlameTrackRate; }; // Size: 0x50 diff --git a/include/d/a/d_a_player.h b/include/d/a/d_a_player.h index 0c1912b0316..7f4d5042a3f 100644 --- a/include/d/a/d_a_player.h +++ b/include/d/a/d_a_player.h @@ -397,6 +397,7 @@ public: enum daPy_RFLG0 { RFLG0_UNK_40000000 = 0x40000000, + RFLG0_UNK_20000000 = 0x20000000, RFLG0_UNK_8000000 = 0x8000000, RFLG0_UNK_4000000 = 0x4000000, RFLG0_UNK_20000 = 0x20000, diff --git a/include/d/com/d_com_inf_game.h b/include/d/com/d_com_inf_game.h index 9daf5f8dfba..bcb1c779337 100644 --- a/include/d/com/d_com_inf_game.h +++ b/include/d/com/d_com_inf_game.h @@ -371,6 +371,7 @@ public: u8& getItemLifeCountType() { return mItemLifeCountType; } u16 getItemNowLife() { return mItemNowLife; } + s32 getItemNowOil() { return mItemNowOil; } s16 getItemPachinkoNumCount() { return mItemPachinkoNumCount; } void clearItemPachinkoNumCount() { mItemPachinkoNumCount = 0; } u8 getNeedLightDropNum() { return mNeedLightDropNum; } @@ -2773,6 +2774,10 @@ inline u16 dComIfGp_getItemNowLife() { return g_dComIfG_gameInfo.play.getItemNowLife(); } +inline s32 dComIfGp_getItemNowOil() { + return g_dComIfG_gameInfo.play.getItemNowOil(); +} + inline int dComIfGp_getMessageCountNumber() { return g_dComIfG_gameInfo.play.getMessageCountNumber(); } @@ -3030,6 +3035,10 @@ inline void dComIfGp_event_onEventFlag(u16 i_flag) { g_dComIfG_gameInfo.play.getEvent().onEventFlag(i_flag); } +inline void dComIfGp_event_onHindFlag(u16 i_flag) { + g_dComIfG_gameInfo.play.getEvent().onHindFlag(i_flag); +} + inline void dComIfGp_evmng_cutEnd(int param_0) { dComIfGp_getPEvtManager()->cutEnd(param_0); } diff --git a/include/d/d_k_wmark.h b/include/d/d_k_wmark.h index 288edd8ce79..a9b89dcb46f 100644 --- a/include/d/d_k_wmark.h +++ b/include/d/d_k_wmark.h @@ -3,6 +3,7 @@ #include "f_op/f_op_kankyo_mng.h" #include "d/kankyo/d_kankyo.h" +#include "d/d_procname.h" class dkWmark_c : public kankyo_class { public: @@ -15,6 +16,10 @@ public: static int m_nowID; + static void setFootMark(cXyz* i_pos, s16 param_1, int param_2) { + fopKyM_create(PROC_WMARK, param_2 | (param_1 << 0x10), i_pos, NULL, NULL); + } + /* 0x0F8 */ JKRSolidHeap* mpHeap; /* 0x0FC */ J3DModel* mpModel; /* 0x100 */ dKy_tevstr_c mTevstr; diff --git a/include/d/event/d_event.h b/include/d/event/d_event.h index 98d1801872c..1d69f8aa87d 100644 --- a/include/d/event/d_event.h +++ b/include/d/event/d_event.h @@ -149,6 +149,7 @@ public: void onEventFlag(u16 flag) { mEventFlag |= flag; } void offEventFlag(u16 flag) { mEventFlag &= ~flag; } u8 getMode() const { return mMode; } + void onHindFlag(u16 flag) { mHindFlag |= flag; } u16 checkHind(u16 flag) { return flag & mHindFlag; } u8 checkCompulsory() { return mCompulsory; } u8 getMapToolId() { return mMapToolId; } diff --git a/include/d/particle/d_particle_copoly.h b/include/d/particle/d_particle_copoly.h index c4a224462ad..4d2af60b3d0 100644 --- a/include/d/particle/d_particle_copoly.h +++ b/include/d/particle/d_particle_copoly.h @@ -16,15 +16,13 @@ public: /* 80050E7C */ void setEffect(u32*, int, dKy_tevstr_c const*, cXyz const*, u32, u32, cXyz const*, csXyz const*, s8, u8*, u8*); /* 80051008 */ int setEffectCenter(dKy_tevstr_c const*, cXyz const*, u32, u32, cXyz const*, - csXyz const*, cXyz const*, s8, f32, f32); + csXyz const*, cXyz const*, s8, f32, f32); /* 8005113C */ void clearID(u32*, u8*); void clearCenterID() { clearID(field_0x8[0], &field_0x36); } void changeWaterOffset(f32 i_offset) { mWaterOffset = i_offset; } void changeRippleOffset(f32 i_offset) { mRippleOffset = i_offset; } - u8 getCenterEffType(int i_idx) const { - return mCenterEffType[i_idx]; - } + u8 getCenterEffType(int i_idx) const { return mCenterEffType[i_idx]; } JPABaseEmitter* getCenterEmitter(int param_0, int param_1) { return dComIfGp_particle_getEmitter(field_0x8[param_0][param_1]); } @@ -42,8 +40,8 @@ public: class dPaPoT_c : public dPaPo_c { public: /* 8005115C */ int setEffectTwo(dKy_tevstr_c const*, cXyz const*, u32, u32, cXyz const*, - cXyz const*, cXyz const*, csXyz const*, cXyz const*, s8, f32, - f32); + cXyz const*, cXyz const*, csXyz const*, cXyz const*, s8, f32, + f32); /* 80051294 */ void clearTwoAllID(); void clearLeftID() { clearID(mLeftEmitter[0], &field_0x7c); } @@ -74,18 +72,14 @@ public: class dPaPoF_c : public dPaPoT_c { public: /* 800512E8 */ int setEffectFour(dKy_tevstr_c const*, cXyz const*, u32, u32, cXyz const*, - cXyz const*, cXyz const*, cXyz const*, cXyz const*, - csXyz const*, cXyz const*, s8, f32, f32); + cXyz const*, cXyz const*, cXyz const*, cXyz const*, + csXyz const*, cXyz const*, s8, f32, f32); /* 80051424 */ void clearFourAllID(); void clearBLeftID() { clearID(mBackLeftEmitter[0], &field_0xc4); } void clearBRightID() { clearID(mBackRightEmitter[0], &field_0xc5); } - u8 getBackRightEffType(int i_idx) const { - return mBackRightEffType[i_idx]; - } - u8 getBackLeftEffType(int i_idx) const { - return mBackLeftEffType[i_idx]; - } + u8 getBackRightEffType(int i_idx) const { return mBackRightEffType[i_idx]; } + u8 getBackLeftEffType(int i_idx) const { return mBackLeftEffType[i_idx]; } JPABaseEmitter* getBackRightEmitter(int param_0, int param_1) { return dComIfGp_particle_getEmitter(mBackRightEmitter[param_0][param_1]); } @@ -96,6 +90,13 @@ public: typedef u8 (dPaPoF_c::*effTypeFunc)(int) const; typedef JPABaseEmitter* (dPaPoF_c::*emitterFunc)(int, int); + u8 getTypeFour(int param_0, int param_1) const { + return (this->*m_typeFourData[param_0])(param_1); + } + JPABaseEmitter* getEmitterFour(int param_0, int param_1, int param_2) { + return (this->*m_emitterFourData[param_0])(param_1, param_2); + } + static effTypeFunc m_typeFourData[]; static emitterFunc m_emitterFourData[]; diff --git a/include/f_op/f_op_kankyo_mng.h b/include/f_op/f_op_kankyo_mng.h index 0e0c01e18e1..0001d715f30 100644 --- a/include/f_op/f_op_kankyo_mng.h +++ b/include/f_op/f_op_kankyo_mng.h @@ -2,8 +2,8 @@ #define F_F_OP_KANKYO_MNG_H_ #include "SSystem/SComponent/c_xyz.h" -#include "f_pc/f_pc_manager.h" #include "f_op/f_op_kankyo.h" +#include "f_pc/f_pc_manager.h" struct fopKyM_prm_class { /* 0x00 */ cXyz mPos; @@ -16,6 +16,8 @@ typedef int (*fopKyM_CreateFunc)(void*); static fopKyM_prm_class* fopKyM_CreateAppend(void); static fopKyM_prm_class* createAppend(int param_1, cXyz* param_2, cXyz* param_3); void fopKyM_Delete(void* param_1); +int fopKyM_create(s16 i_procName, int i_param, cXyz* i_pos, cXyz* i_scale, + fopKyM_CreateFunc i_createFunc); static int fopKyM_Create(s16 param_1, fopKyM_CreateFunc param_2, void* param_3); base_process_class* fopKyM_fastCreate(s16 param_0, int param_1, cXyz* param_2, cXyz* param_3, fopKyM_CreateFunc); diff --git a/include/rel/d/a/d_a_arrow/d_a_arrow.h b/include/rel/d/a/d_a_arrow/d_a_arrow.h index fc8e89753ba..470092a8506 100644 --- a/include/rel/d/a/d_a_arrow/d_a_arrow.h +++ b/include/rel/d/a/d_a_arrow/d_a_arrow.h @@ -46,11 +46,26 @@ public: void setBombArrowExplode() { field_0x950 = 0; } bool checkBombArrow() const { return mIsBombArrow == true; } - static fopAc_ac_c* makeArrow(fopAc_ac_c* i_player, u16 param_1) { + void setShoot() { fopAcM_SetParam(this, 1); } + void setChargeShoot() { fopAcM_SetParam(this, 2); } + + static fopAc_ac_c* makeArrow(fopAc_ac_c* i_actor, u16 param_1) { return (fopAc_ac_c*)fopAcM_fastCreate(PROC_ARROW, param_1 << 8, - &i_player->current.pos, - fopAcM_GetRoomNo(i_player), + &i_actor->current.pos, + fopAcM_GetRoomNo(i_actor), + NULL, + NULL, + -1, + NULL, + NULL); + } + + static fopAc_ac_c* makeSlingStone(fopAc_ac_c* i_actor, cXyz* i_pos) { + return (fopAc_ac_c*)fopAcM_fastCreate(PROC_ARROW, + 0x401, + i_pos, + fopAcM_GetRoomNo(i_actor), NULL, NULL, -1, diff --git a/include/rel/d/a/e/d_a_e_sm2/d_a_e_sm2.h b/include/rel/d/a/e/d_a_e_sm2/d_a_e_sm2.h index 5675c4279a2..ac11866953b 100644 --- a/include/rel/d/a/e/d_a_e_sm2/d_a_e_sm2.h +++ b/include/rel/d/a/e/d_a_e_sm2/d_a_e_sm2.h @@ -1,6 +1,85 @@ #ifndef D_A_E_SM2_H #define D_A_E_SM2_H -#include "dolphin/types.h" +#include "f_op/f_op_actor_mng.h" +#include "d/bg/d_bg_s_acch.h" +#include "d/cc/d_cc_d.h" + +class e_sm2_class : public fopEn_enemy_c { +public: + bool checkYellow() { return field_0x5b7 == 3; } + + /* 0x5AC */ request_of_phase_process_class mPhase; + /* 0x5B4 */ u8 field_0x5b4; + /* 0x5B5 */ u8 field_0x5B5[0x5B7 - 0x5B5]; + /* 0x5B7 */ u8 field_0x5b7; + /* 0x5B8 */ int field_0x5b8; + /* 0x5BC */ mDoExt_McaMorfSO* mpMorf; + /* 0x5C0 */ mDoExt_invisibleModel field_0x5c0; + /* 0x5C8 */ mDoExt_btkAnm* field_0x5c8; + /* 0x5CC */ mDoExt_McaMorfSO* field_0x5cc; + /* 0x5D0 */ mDoExt_invisibleModel field_0x5d0; + /* 0x5D8 */ u8 field_0x5d8; + /* 0x5D9 */ u8 field_0x5D9[0x5DC - 0x5D9]; + /* 0x5DC */ Z2CreatureEnemy mSound; + /* 0x680 */ s16 field_0x680; + /* 0x682 */ s16 mAction; + /* 0x684 */ s16 mMode; + /* 0x686 */ s16 field_0x686; + /* 0x688 */ s16 field_0x688; + /* 0x68A */ u8 field_0x68A[0x68C - 0x68A]; + /* 0x68C */ s16 field_0x68c; + /* 0x68E */ s16 field_0x68e; + /* 0x690 */ s16 mAngleToPlayer; + /* 0x692 */ u8 field_0x692[0x694 - 0x692]; + /* 0x694 */ f32 mDistToPlayer; + /* 0x698 */ u8 field_0x698[0x6A4 - 0x698]; + /* 0x6A4 */ s16 field_0x6a4; + /* 0x6A6 */ s16 field_0x6a6; + /* 0x6A8 */ u8 field_0x6a8; + /* 0x6A9 */ u8 field_0x6a9; + /* 0x6AA */ u8 field_0x6aa; + /* 0x6AB */ u8 field_0x6AB[0x6AC - 0x6AB]; + /* 0x6AC */ f32 field_0x6ac; + /* 0x6B0 */ f32 field_0x6b0; + /* 0x6B4 */ u32 field_0x6b4; + /* 0x6B8 */ f32 field_0x6b8; + /* 0x6BC */ f32 field_0x6bc; + /* 0x6C0 */ f32 field_0x6c0; + /* 0x6C4 */ f32 field_0x6c4; + /* 0x6C8 */ f32 field_0x6c8; + /* 0x6CC */ u8 field_0x6CC[0x6E8 - 0x6CC]; + /* 0x6E8 */ f32 field_0x6e8; + /* 0x6EC */ u8 field_0x6EC[0x708 - 0x6EC]; + /* 0x708 */ cXyz field_0x708[8]; + /* 0x768 */ csXyz field_0x768[8]; + /* 0x798 */ cXyz field_0x798[8]; + /* 0x7F8 */ csXyz field_0x7f8[8]; + /* 0x828 */ s16 field_0x828; + /* 0x82A */ u8 field_0x82A[0x82C - 0x82A]; + /* 0x82C */ f32 field_0x82c; + /* 0x830 */ f32 field_0x830; + /* 0x834 */ f32 mSize; + /* 0x838 */ f32 field_0x838; + /* 0x83C */ u8 field_0x83c; + /* 0x83D */ u8 field_0x83d; + /* 0x83E */ u8 field_0x83e; + /* 0x83F */ u8 field_0x83f; + /* 0x840 */ cXyz field_0x840; + /* 0x84C */ csXyz field_0x84c; + /* 0x852 */ u8 field_0x852[0x854 - 0x852]; + /* 0x854 */ dBgS_AcchCir mAcchCir; + /* 0x894 */ dBgS_ObjAcch mAcch; + /* 0xA6C */ dCcD_Stts mColliderStatus; + /* 0xAA8 */ dCcD_Sph field_0xaa8[4]; + /* 0xF88 */ u8 field_0xf88; + /* 0xF89 */ u8 field_0xF89[0xF8C - 0xF89]; + /* 0xF8C */ dCcU_AtInfo mAtInfo; + /* 0xFB0 */ u8 field_0xFB0[0xFD0 - 0xFB0]; + /* 0xFD0 */ int field_0xfd0; + /* 0xFD4 */ u8 field_0xfd4; + /* 0xFD5 */ u8 field_0xFD5[0xFD8 - 0xFD5]; + /* 0xFD8 */ u32 field_0xfd8; +}; #endif /* D_A_E_SM2_H */ diff --git a/include/rel/d/a/npc/d_a_npc_tk/d_a_npc_tk.h b/include/rel/d/a/npc/d_a_npc_tk/d_a_npc_tk.h index 292665a3e75..7c864ae0469 100644 --- a/include/rel/d/a/npc/d_a_npc_tk/d_a_npc_tk.h +++ b/include/rel/d/a/npc/d_a_npc_tk/d_a_npc_tk.h @@ -63,6 +63,7 @@ public: void setBump() { mFlags |= 4; } void setEventWolf() { mFlags |= 0x80; } + void setEvent() { mFlags |= 0x8; } void setHawkPath(u8 i_pathNo) { if (i_pathNo != 0xFF) { diff --git a/include/rel/d/a/tag/d_a_tag_shop_item/d_a_tag_shop_item.h b/include/rel/d/a/tag/d_a_tag_shop_item/d_a_tag_shop_item.h index 261e5288140..59be67fdf4a 100644 --- a/include/rel/d/a/tag/d_a_tag_shop_item/d_a_tag_shop_item.h +++ b/include/rel/d/a/tag/d_a_tag_shop_item/d_a_tag_shop_item.h @@ -15,14 +15,14 @@ public: /* 80D61044 */ u8 getSwitchBit1(); /* 80D61050 */ u8 getSwitchBit2(); /* 80D6105C */ void initialize(); + /* 80D61168 */ virtual ~daTag_ShopItem_c(); - s32 getProcessID() { return field_0x56c; } - /* 0x56C */ s32 field_0x56c; - /* 0x570 */ s16 field_0x570; + u32 getProcessID() { return mProcessID; } + + /* 0x56C */ u32 mProcessID; + /* 0x570 */ s16 mCreateTimer; /* 0x572 */ u8 field_0x572; - /* 0x573 */ u8 field_0x573; - }; // Size: 0x574 #endif /* D_A_TAG_SHOP_ITEM_H */ diff --git a/include/rel/d/a/tag/d_a_tag_ss_drink/d_a_tag_ss_drink.h b/include/rel/d/a/tag/d_a_tag_ss_drink/d_a_tag_ss_drink.h index 2d05695ef60..0c9c92906b4 100644 --- a/include/rel/d/a/tag/d_a_tag_ss_drink/d_a_tag_ss_drink.h +++ b/include/rel/d/a/tag/d_a_tag_ss_drink/d_a_tag_ss_drink.h @@ -4,7 +4,6 @@ #include "d/a/d_a_obj_ss_base.h" #include "d/com/d_com_inf_game.h" #include "d/msg/d_msg_flow.h" -#include "dolphin/types.h" #include "f_op/f_op_actor_mng.h" class daTag_SSDrink_c; @@ -32,6 +31,7 @@ public: /* 80D63724 */ ~daTag_SSDrink_c(); s32 fopAcM_seenPlayerAngleY() { return fopAcM_seenActorAngleY(this, dComIfGp_getPlayer(0)); } + bool checkShopOil() const { return field_0x5D2 == 4; } /* 0x578 */ dMsgFlow_c field_0x578; /* 0x5C4 */ ProcessFunc mProcessFunc; diff --git a/rel/d/a/e/d_a_e_sm2/d_a_e_sm2.cpp b/rel/d/a/e/d_a_e_sm2/d_a_e_sm2.cpp index ed3598ced88..a95887a1b7a 100644 --- a/rel/d/a/e/d_a_e_sm2/d_a_e_sm2.cpp +++ b/rel/d/a/e/d_a_e_sm2/d_a_e_sm2.cpp @@ -3,7 +3,8 @@ // Translation Unit: d_a_e_sm2 // -#include "rel/d/a/e/d_a_e_sm2/d_a_e_sm2.h" +// #include "rel/d/a/e/d_a_e_sm2/d_a_e_sm2.h" +#include "dolphin/types.h" #include "d/cc/d_cc_d.h" #include "dol2asm.h" diff --git a/rel/d/a/tag/d_a_tag_shop_item/d_a_tag_shop_item.cpp b/rel/d/a/tag/d_a_tag_shop_item/d_a_tag_shop_item.cpp index 6b972852e43..51e64cb288d 100644 --- a/rel/d/a/tag/d_a_tag_shop_item/d_a_tag_shop_item.cpp +++ b/rel/d/a/tag/d_a_tag_shop_item/d_a_tag_shop_item.cpp @@ -11,91 +11,125 @@ int daTag_ShopItem_c::create() { fopAcM_SetupActor(this, daTag_ShopItem_c); initialize(); - field_0x572 = 0; - if (!strcmp("F_SP109", dComIfGp_getStartStageName())) { + field_0x572 = false; + + if (strcmp("F_SP109", dComIfGp_getStartStageName()) == 0) { + // saveBitLabels[64] = Goron Mines completed if (!i_dComIfGs_isEventBit(dSv_event_flag_c::saveBitLabels[64])) { return cPhs_ERROR_e; } - if ((dComIfGs_getTime() >= 90.0f) && (dComIfGs_getTime() < 270.0f)) { + + if (dComIfGs_getTime() >= 90.0f && dComIfGs_getTime() < 270.0f) { return cPhs_ERROR_e; } } - if (getGroupID() == 0x0f) { - field_0x570 = 0x96; - if (getSwitchBit1() != 0xff) { + + if (getGroupID() == 15) { + mCreateTimer = 150; + +#ifdef DEBUG + // "Event Item\n" + OSReport("イベントアイテム\n"); +#endif + + if (getSwitchBit1() != 0xFF) { if (!dComIfGs_isSaveSwitch(getSwitchBit1())) { dComIfGs_onSaveSwitch(getSwitchBit2()); - field_0x572 = 1; - field_0x570 = 0; + field_0x572 = true; + mCreateTimer = 0; +#ifdef DEBUG + // "Before Talk\n" + OSReport("会話前\n"); +#endif + } else { +#ifdef DEBUG + // "After Talk\n" + OSReport("会話後\n"); +#endif } } } else { - field_0x570 = 0; - if (getSwitchBit1() != 0xff) { + mCreateTimer = 0; + + if (getSwitchBit1() != 0xFF) { if (dComIfGs_isSaveSwitch(getSwitchBit1())) { - field_0x570 = 0x96; + mCreateTimer = 150; +#ifdef DEBUG + // "Already Sold\n" + OSReport("もう売れたよ\n"); +#endif } } - if (getSwitchBit2() != 0xff) { + + if (getSwitchBit2() != 0xFF) { if (!dComIfGs_isSaveSwitch(getSwitchBit2())) { - field_0x570 = 0x96; + mCreateTimer = 150; +#ifdef DEBUG + // "Not sold yet\n" + OSReport("まだ売れない\n"); +#endif } } } + return cPhs_COMPLEATE_e; } /* 80D60D78-80D60E04 000278 008C+00 1/1 0/0 0/0 .text Delete__16daTag_ShopItem_cFv */ int daTag_ShopItem_c::Delete() { - if ((field_0x572 != NULL) && (getGroupID() == 0x0f)) { + if (field_0x572 && getGroupID() == 15) { if (dComIfGs_isSaveSwitch(getSwitchBit1())) { dComIfGs_offSaveSwitch(getSwitchBit2()); } } + return 1; } /* 80D60E04-80D61024 000304 0220+00 1/1 0/0 0/0 .text Execute__16daTag_ShopItem_cFv */ int daTag_ShopItem_c::Execute() { - if (field_0x56c == 0xffffffff) { - if (!field_0x570) { - field_0x56c = - fopAcM_create(PROC_ShopItem, getType() & 0xff | getGroupID() << 0x1c, ¤t.pos, - fopAcM_GetRoomNo(this), ¤t.angle, NULL, 0xff); + if (mProcessID == UINT32_MAX) { + if (mCreateTimer == 0) { + mProcessID = + fopAcM_create(PROC_ShopItem, (getType() & 0xFF) | (getGroupID() << 0x1C), + ¤t.pos, fopAcM_GetRoomNo(this), ¤t.angle, NULL, -1); } else { - field_0x570 -= 1; - if (getGroupID() == 0x0f) { + mCreateTimer--; + + if (getGroupID() == 15) { if (field_0x572) { - field_0x570 = 0; + mCreateTimer = 0; } } else { - if (getSwitchBit1() != 0xff && dComIfGs_isSaveSwitch(getSwitchBit1())) { - } else if (getSwitchBit2() == 0xff || dComIfGs_isSaveSwitch(getSwitchBit2())) { - field_0x570 = 0; + if (getSwitchBit1() != 0xFF && dComIfGs_isSaveSwitch(getSwitchBit1())) { + } else if (getSwitchBit2() == 0xFF || dComIfGs_isSaveSwitch(getSwitchBit2())) { + mCreateTimer = 0; } } } } else { - daItemBase_c* mpItemBase = (daItemBase_c*)fopAcM_SearchByID(field_0x56c); - if (mpItemBase) { - if (getGroupID() == 0x0f) { + daItemBase_c* item_actor_p = (daItemBase_c*)fopAcM_SearchByID(mProcessID); + + if (item_actor_p != NULL) { + if (getGroupID() == 15) { if (!field_0x572) { - mpItemBase->hide(); + item_actor_p->hide(); } else { - mpItemBase->show(); + item_actor_p->show(); } } else { - if (getSwitchBit1() != 0xff && dComIfGs_isSaveSwitch(getSwitchBit1())) { - mpItemBase->hide(); - } else if (getSwitchBit2() != 0xff && !dComIfGs_isSaveSwitch(getSwitchBit2())) { - mpItemBase->hide(); + if (getSwitchBit1() != 0xFF && dComIfGs_isSaveSwitch(getSwitchBit1())) { + item_actor_p->hide(); + } else if (getSwitchBit2() != 0xFF && !dComIfGs_isSaveSwitch(getSwitchBit2())) { + item_actor_p->hide(); } else { - mpItemBase->show(); + item_actor_p->show(); } } } } + return 1; } @@ -106,34 +140,33 @@ int daTag_ShopItem_c::Draw() { /* 80D6102C-80D61038 00052C 000C+00 1/1 0/0 0/0 .text getType__16daTag_ShopItem_cFv */ u8 daTag_ShopItem_c::getType() { - return mBase.mParameters & 0xff; + return fopAcM_GetParam(this) & 0xFF; } /* 80D61038-80D61044 000538 000C+00 3/3 0/0 0/0 .text getGroupID__16daTag_ShopItem_cFv */ u8 daTag_ShopItem_c::getGroupID() { - return mBase.mParameters >> 0x1c; + return fopAcM_GetParam(this) >> 0x1C; } -/* 80D61044-80D61050 000544 000C+00 3/3 0/0 1/1 .text getSwitchBit1__16daTag_ShopItem_cFv */ +/* 80D61044-80D61050 000544 000C+00 3/3 0/0 1/1 .text getSwitchBit1__16daTag_ShopItem_cFv + */ u8 daTag_ShopItem_c::getSwitchBit1() { - return orig.angle.z & 0xff; + return orig.angle.z & 0xFF; } -/* 80D61050-80D6105C 000550 000C+00 3/3 0/0 0/0 .text getSwitchBit2__16daTag_ShopItem_cFv */ +/* 80D61050-80D6105C 000550 000C+00 3/3 0/0 0/0 .text getSwitchBit2__16daTag_ShopItem_cFv + */ u8 daTag_ShopItem_c::getSwitchBit2() { - return orig.angle.z >> 8 & 0xff; + return orig.angle.z >> 8 & 0xFF; } /* 80D6105C-80D610E0 00055C 0084+00 1/1 0/0 0/0 .text initialize__16daTag_ShopItem_cFv */ void daTag_ShopItem_c::initialize() { fopAcM_setCullSizeBox(this, -30.0f, -15.0f, -30.0f, 30.0f, 45.0f, 30.0f); - mAttentionInfo.mFlags = NULL; - s16 mAngleY = orig.angle.y; - current.angle.x = 0; - current.angle.y = mAngleY; - current.angle.z = 0; + mAttentionInfo.mFlags = 0; + current.angle.set(0, orig.angle.y, 0); shape_angle = current.angle; - field_0x56c = -1; + mProcessID = -1; } /* 80D610E0-80D61100 0005E0 0020+00 1/0 0/0 0/0 .text daTag_ShopItem_Create__FPv */ @@ -173,18 +206,18 @@ static actor_method_class daTag_ShopItem_MethodTable = { /* 80D61210-80D61240 -00001 0030+00 0/0 0/0 1/0 .data g_profile_TAG_SHOPITM */ extern actor_process_profile_definition g_profile_TAG_SHOPITM = { - fpcLy_CURRENT_e, // mLayerID - 7, // mListID - fpcPi_CURRENT_e, // mListPrio - PROC_TAG_SHOPITM, // mProcName - &g_fpcLf_Method.mBase, // mSubMtd - sizeof(daTag_ShopItem_c), // mSize - 0, // mSizeOther - 0, // mParameters - &g_fopAc_Method.base, // mSubMtd - 75, // mPriority - &daTag_ShopItem_MethodTable, // mSubMtd - 0x64100, // mStatus - 5, // mActorType - fopAc_CULLBOX_CUSTOM_e, // mCullType + fpcLy_CURRENT_e, // mLayerID + 7, // mListID + fpcPi_CURRENT_e, // mListPrio + PROC_TAG_SHOPITM, // mProcName + &g_fpcLf_Method.mBase, // mSubMtd + sizeof(daTag_ShopItem_c), // mSize + 0, // mSizeOther + 0, // mParameters + &g_fopAc_Method.base, // mSubMtd + 75, // mPriority + &daTag_ShopItem_MethodTable, // mSubMtd + 0x64100, // mStatus + 5, // mActorType + fopAc_CULLBOX_CUSTOM_e, // mCullType }; \ No newline at end of file diff --git a/src/d/a/d_a_alink.cpp b/src/d/a/d_a_alink.cpp index a36c492fffc..f9fdb9d2599 100644 --- a/src/d/a/d_a_alink.cpp +++ b/src/d/a/d_a_alink.cpp @@ -15206,8 +15206,8 @@ void daAlink_c::setItemActionButtonStatus(u8 param_0) { } /* 800B26FC-800B271C 0AD03C 0020+00 2/2 0/0 1/1 .text itemActionTrigger__9daAlink_cFv */ -void daAlink_c::itemActionTrigger() { - spActionTrigger(); +BOOL daAlink_c::itemActionTrigger() { + return spActionTrigger(); } /* 800B271C-800B2EA4 0AD05C 0788+00 1/1 0/0 0/0 .text setStickData__9daAlink_cFv */ diff --git a/src/d/a/d_a_alink_bow.inc b/src/d/a/d_a_alink_bow.inc index cd8b3052568..de6af991913 100644 --- a/src/d/a/d_a_alink_bow.inc +++ b/src/d/a/d_a_alink_bow.inc @@ -3,6 +3,8 @@ * Player Bow and Arrow action handling */ +#include "d/a/d_a_alink.h" +#include "d/com/d_com_inf_game.h" #include "rel/d/a/d_a_arrow/d_a_arrow.h" /* 800DE64C-800DE740 0D8F8C 00F4+00 1/1 0/0 2/2 .text getArrowFlyData__9daAlink_cCFPfPfi @@ -59,13 +61,13 @@ BOOL daAlink_c::checkBowAndSlingItem(int i_itemNo) { /* 800DE7D4-800DE884 0D9114 00B0+00 1/1 0/0 0/0 .text setSlingModel__9daAlink_cFv */ void daAlink_c::setSlingModel() { J3DAnmTransform* bck = (J3DAnmTransform*)mAnmHeap9.loadDataIdx(0x1F9); - JKRHeap* heap = setItemHeap(); + JKRHeap* prev_heap = setItemHeap(); J3DModelData* model_data = loadAramBmd(0x319, 0x2C00); mHeldItemModel = initModel(model_data, 0); mItemBck.init(bck, 0, 2, lit_6040, 0, -1, false); - mDoExt_setCurrentHeap(heap); + mDoExt_setCurrentHeap(prev_heap); field_0x2f95 = 5; field_0x2f94 = 103; } @@ -121,8 +123,8 @@ void daAlink_c::makeArrow() { field_0x301e = 0; } - fopAc_ac_c* arrow_actor = daArrow_c::makeArrow(this, field_0x301e); - mItemAcKeep.setData(arrow_actor); + fopAc_ac_c* arrow_p = daArrow_c::makeArrow(this, field_0x301e); + mItemAcKeep.setData(arrow_p); } mItemVar0.field_0x3018 = 0; @@ -130,17 +132,17 @@ void daAlink_c::makeArrow() { /* 800DEAE4-800DEB8C 0D9424 00A8+00 3/3 0/0 0/0 .text deleteArrow__9daAlink_cFv */ void daAlink_c::deleteArrow() { - daArrow_c* arrow = (daArrow_c*)mItemAcKeep.getActor(); + daArrow_c* arrow_p = (daArrow_c*)mItemAcKeep.getActor(); - if (arrow != NULL && fopAcM_GetName(arrow) == PROC_ARROW) { - if (arrow->checkBombArrow() && + if (arrow_p != NULL && fopAcM_GetName(arrow_p) == PROC_ARROW) { + if (arrow_p->checkBombArrow() && (mDamageTimer == daAlinkHIO_damage_c0::m.mInvincibleTime || i_checkModeFlg(8))) { - arrow->setBombArrowExplode(); + arrow_p->setBombArrowExplode(); dComIfGp_addSelectItemNum(mSelectItemId, -1); dComIfGp_setItemArrowNumCount(-1); } else { - fopAcM_delete(arrow); + fopAcM_delete(arrow_p); } mItemAcKeep.clearData(); } @@ -157,6 +159,44 @@ void daAlink_c::setBowOrSlingStatus() { } /* 800DEBC8-800DED88 0D9508 01C0+00 1/1 0/0 0/0 .text changeArrowType__9daAlink_cFv */ +// matches with literals +#ifdef NONMATCHING +void daAlink_c::changeArrowType() { + if (checkCanoeSlider() || (mEquipItem == BOW && field_0x301e == 0) || + (mEquipItem == BOMB_ARROW && field_0x301e == 0 && + dComIfGp_getSelectItemNum(mSelectItemId) == 0) || + (mEquipItem == HAWK_ARROW && i_checkAttentionLock())) + { + return; + } + + setItemActionButtonStatus(0x11); + + if (arrowChangeTrigger()) { + if (mEquipItem == HAWK_ARROW) { + if (i_dComIfGp_checkPlayerStatus0(0, 0x200000)) { + dComIfGp_clearPlayerStatus0(0, 0x200000); + seStartSystem(Z2SE_AL_HAWK_EYE_PUTOFF); + } else { + dComIfGp_setPlayerStatus0(0, 0x200000); + seStartSystem(Z2SE_AL_HAWK_EYE_PUTON); + } + } else { + if (field_0x301e == 1) { + field_0x301e = 0; + } else { + field_0x301e = 1; + } + + if (mItemAcKeep.getActor() != NULL) { + deleteArrow(); + makeArrow(); + setBowReloadAnime(); + } + } + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -165,6 +205,7 @@ asm void daAlink_c::changeArrowType() { #include "asm/d/a/d_a_alink/changeArrowType__9daAlink_cFv.s" } #pragma pop +#endif /* 800DED88-800DEE1C 0D96C8 0094+00 1/1 0/0 0/0 .text cancelBowMoveRideNotAtn__9daAlink_cFv */ BOOL daAlink_c::cancelBowMoveRideNotAtn() { @@ -236,14 +277,194 @@ void daAlink_c::setBowReloadAnime() { } /* 800DF0BC-800DF798 0D99FC 06DC+00 2/2 0/0 0/0 .text checkUpperItemActionBow__9daAlink_cFv */ +// matches with literals +#ifdef NONMATCHING +BOOL daAlink_c::checkUpperItemActionBow() { + daPy_frameCtrl_c* frameCtrl_p = &mUpperFrameCtrl[2]; + + if (mEquipItem == PACHINKO) { + mDoMtx_multVec(getLeftItemMatrix(), &slingLocalPos, &mHeldItemRootPos); + } + + if (checkBowChargeWaitAnime()) { + daArrow_c* arrow_p = (daArrow_c*)mItemAcKeep.getActor(); + + if (mEquipItem != PACHINKO) { + if (field_0x301c > 0) { + field_0x301c--; + + if (field_0x301c <= frameCtrl_p->getEnd() && frameCtrl_p->getFrame() < 0.1f && + frameCtrl_p->getRate() < 0.1f) + { + frameCtrl_p->setRate(1.0f); + } + } else { + i_onResetFlg0(RFLG0_UNK_10); + cancelItemUseQuake(0); + } + } + + if (checkReadyItem()) { + if (mItemVar0.field_0x3018 != 0) { + setUpperAnimeParam(0xC, UPPER_2, &daAlinkHIO_bow_c0::m.mShootAnm); + setFacePriBck(0xE8); + field_0x2f96 = 0; + + u16 var_r29; + if (mEquipItem == PACHINKO) { + var_r29 = 0x1F1; + if (dComIfGs_getPachinkoNum() != 0 && + daArrow_c::makeSlingStone(this, &mHeldItemRootPos) != NULL) + { + dComIfGp_setItemPachinkoNumCount(-1); + } + } else if (field_0x301c != 0) { + var_r29 = 0x43; + } else { + var_r29 = 0x44; + } + + changeItemBck(var_r29, daAlinkHIO_bow_c0::m.mShootAnm.mStartFrame); + mItemVar0.field_0x3018 = 0; + } else if (mEquipItem == PACHINKO) { + if (!itemButton()) { + dComIfGp_getVibration().StartShock(1, 1, cXyz(0.0f, 1.0f, 0.0f)); + seStartOnlyReverb(Z2SE_AL_PACHINKO_SHOT); + mItemVar0.field_0x3018 = 1; + resetFacePriAnime(); + } + } else if (!itemButton()) { + if (arrow_p != NULL) { + u32 sound; + int shock_strength; + + if (field_0x301c != 0) { + arrow_p->setShoot(); + shock_strength = 1; + + if (arrow_p->checkBombArrow()) { + sound = Z2SE_OBJ_ARROWBOMB_SHOT; + } else { + sound = Z2SE_OBJ_ARROW_SHOT_NORMAL; + } + } else { + arrow_p->setChargeShoot(); + shock_strength = 2; + + if (arrow_p->checkBombArrow()) { + sound = Z2SE_OBJ_ARROWBOMB_SHOTGAIN; + } else { + sound = Z2SE_OBJ_ARROW_SHOT_GAIN; + } + } + + dComIfGp_getVibration().StartShock(shock_strength, 1, cXyz(0.0f, 1.0f, 0.0f)); + seStartOnlyReverb(sound); + + if (field_0x301e == 1) { + dComIfGp_addSelectItemNum(mSelectItemId, -1); + } + + dComIfGp_setItemArrowNumCount(-1); + mItemAcKeep.clearData(); + i_onResetFlg0(RFLG0_UNK_20000000); + field_0x30a4 = daAlinkHIO_bow_c0::m.mBombArrowHoldTime; + } else { + seStartOnlyReverb(Z2SE_AL_ARROW_EMPTY); + } + + mItemVar0.field_0x3018 = 1; + resetFacePriAnime(); + + if (mEquipItem == BOW) { + field_0x301e = 0; + } + } else { + changeArrowType(); + } + } + } else if (checkBowReloadAnime()) { + if (checkAnmEnd(frameCtrl_p)) { + setUpperAnimeBaseSpeed(10, 0.0f, -1.0f); + setFacePriTexture(FTANM_UNK_9); + setFacePriBck(0xE6); + + if (mEquipItem != PACHINKO) { + changeItemBck(0x42, 0.0f); + dComIfGp_getVibration().StartQuake(1, 1, cXyz(0.0f, 1.0f, 0.0f)); + i_onNoResetFlg3(FLG3_UNK_4); + } + } + } else if (checkBowWaitAnime()) { + if ((mItemVar0.field_0x3018 == 0 && mFastShotTime != 0) || + (mItemMode == 0 && !itemButton() && mItemVar0.field_0x3018 == 0 && + cancelBowMoveRideNotAtn())) + { + resetUpperAnime(UPPER_2, 3.0f); + dComIfGp_clearPlayerStatus0(0, 0x1040); + return 1; + } + + if (mItemMode == 0 && (itemButton() || mItemVar0.field_0x3018 != 0) && checkReadyItem() && + (field_0x30a4 == 0 || field_0x301e != 1)) + { + setBowReloadAnime(); + + if (mEquipItem == PACHINKO) { + mItemVar0.field_0x3018 = 0; + } else { + makeArrow(); + } + } else if (mEquipItem == HAWK_ARROW) { + changeArrowType(); + } + + if (mItemMode != 0) { + mItemMode--; + } + } else if (checkBowShootAnime()) { + if (mUpperFrameCtrl[2].getFrame() >= 6.0f) { + field_0x2f97 = 5; + } else if (mUpperFrameCtrl[2].getFrame() >= 1.0f) { + field_0x2f96 = 4; + } + + if (checkAnmEnd(&mUpperFrameCtrl[2]) && cancelBowMoveRideNotAtn()) { + resetUpperAnime(UPPER_2, 3.0f); + dComIfGp_clearPlayerStatus0(0, 0x1040); + return 1; + } + + if (checkAnmEnd(&mUpperFrameCtrl[2]) || + (mUpperFrameCtrl[2].getFrame() > daAlinkHIO_bow_c0::m.mShootAnm.mCheckFrame && + itemButton())) + { + setBowReadyAnime(); + } + + if (mItemMode != 0) { + mItemMode--; + } + } + + if (checkBowWaitAnime() || (mEquipItem == PACHINKO && checkBowChargeWaitAnime())) { + field_0x33dc += daAlinkHIO_bow_c0::m.mShootAnm.mSpeed; + } else { + field_0x33dc = mUpperFrameCtrl[2].getFrame(); + } + + return cancelUpperItemReadyAnime(0); +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void daAlink_c::checkUpperItemActionBow() { +asm BOOL daAlink_c::checkUpperItemActionBow() { nofralloc #include "asm/d/a/d_a_alink/checkUpperItemActionBow__9daAlink_cFv.s" } #pragma pop +#endif /* 800DF798-800DF814 0DA0D8 007C+00 1/1 0/0 0/0 .text checkUpperItemActionBowFly__9daAlink_cFv */ void daAlink_c::checkUpperItemActionBowFly() { @@ -257,6 +478,76 @@ void daAlink_c::checkUpperItemActionBowFly() { } /* 800DF814-800DFAE8 0DA154 02D4+00 4/4 0/0 0/0 .text checkNextActionBow__9daAlink_cFv */ +// matches with literals +#ifdef NONMATCHING +int daAlink_c::checkNextActionBow() { + if (mFastShotTime != 0 && checkBowReadyAnime()) { + mFastShotTime--; + } + + BOOL var_r31 = false; + if (!checkBowAnime()) { + setBowReadyAnime(); + setFastShotTimer(); + + if (!i_checkAttentionLock()) { + field_0x2fe4 = shape_angle.y; + } + + mItemMode = 0; + mItemVar0.field_0x3018 = 1; + + if (mEquipItem == HAWK_ARROW) { + var_r31 = true; + mFastShotTime = 0; + } + + if ((!i_checkAttentionLock() && !checkDashAnime()) || i_checkModeFlg(0x400)) { + mFastShotTime = 0; + + if (i_checkAttentionLock() && i_checkModeFlg(0x400)) { + mItemVar0.field_0x3018 = 1; + } else { + mItemVar0.field_0x3018 = 0; + } + + if (!i_checkResetFlg0(RFLG0_UNK_80)) { + mItemMode = 3; + } + } + } + + BOOL rt; + if (!i_checkAttentionLock() && mFastShotTime == 0) { + if (i_checkModeFlg(0x400)) { + if (checkCanoeRide()) { + rt = procCanoeBowSubjectInit(); + } else { + rt = procHorseBowSubjectInit(); + } + } else { + rt = procBowSubjectInit(); + } + } else { + if (i_checkModeFlg(0x400)) { + if (checkCanoeRide()) { + rt = procCanoeBowMoveInit(); + } else { + rt = procHorseBowMoveInit(); + } + } else { + rt = procBowMoveInit(); + } + } + + if (rt && var_r31) { + dComIfGp_setPlayerStatus0(0, 0x200000); + seStartSystem(Z2SE_AL_HAWK_EYE_PUTON); + } + + return rt; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -265,6 +556,7 @@ asm int daAlink_c::checkNextActionBow() { #include "asm/d/a/d_a_alink/checkNextActionBow__9daAlink_cFv.s" } #pragma pop +#endif /* 800DFAE8-800DFBC8 0DA428 00E0+00 1/1 0/0 0/0 .text setBowModel__9daAlink_cFv */ // matches with literals @@ -400,4 +692,4 @@ int daAlink_c::procBowMove() { } return 1; -} \ No newline at end of file +} diff --git a/src/d/a/d_a_alink_effect.inc b/src/d/a/d_a_alink_effect.inc index 0cd47da2de1..3befbadddb4 100644 --- a/src/d/a/d_a_alink_effect.inc +++ b/src/d/a/d_a_alink_effect.inc @@ -3,6 +3,10 @@ * Player Particle Effect handling */ +#include "d/a/d_a_alink.h" +#include "d/com/d_com_inf_game.h" +#include "d/d_k_wmark.h" + /* 80120580-80120634 11AEC0 00B4+00 21/21 0/0 0/0 .text * setEmitter__9daAlink_cFPUlUsPC4cXyzPC5csXyz */ // matches with literal @@ -57,6 +61,24 @@ void daAlink_c::stopDrawParticle(u32 param_0) { } /* 801207BC-80120880 11B0FC 00C4+00 1/0 0/0 0/0 .text setEffectFrontRollParam__9daAlink_cFv */ +// matches with literals +#ifdef NONMATCHING +void daAlink_c::setEffectFrontRollParam() { + int j, i; + + for (i = 0; i < 5; i++) { + for (j = 0; j < 2; j++) { + if (field_0x2e54.getTypeFour(i, j) == 0) { + JPABaseEmitter* emitter_p = field_0x2e54.getEmitterFour(i, j, 0); + + if (emitter_p != NULL) { + emitter_p->setRate(2.0f); + } + } + } + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -65,6 +87,7 @@ asm void daAlink_c::setEffectFrontRollParam() { #include "asm/d/a/d_a_alink/setEffectFrontRollParam__9daAlink_cFv.s" } #pragma pop +#endif /* 80120880-80120B00 11B1C0 0280+00 1/0 0/0 0/0 .text setEffectSlipParam__9daAlink_cFv */ #pragma push @@ -111,14 +134,14 @@ asm void daAlink_c::setEffectSumouParam() { #pragma pop /* 801211C0-80121214 11BB00 0054+00 46/46 0/0 0/0 .text setFootEffectProcType__9daAlink_cFi */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void daAlink_c::setFootEffectProcType(int param_0) { - nofralloc -#include "asm/d/a/d_a_alink/setFootEffectProcType__9daAlink_cFi.s" +void daAlink_c::setFootEffectProcType(int param_0) { + if (param_0 != field_0x2f9f) { + field_0x2e54.clearFourAllID(); + } + + field_0x2f9e = param_0; + field_0x2f9f = field_0x2f9e; } -#pragma pop /* 80121214-80121304 11BB54 00F0+00 1/1 0/0 0/0 .text setWolfFootOn__9daAlink_cFi */ #pragma push @@ -132,14 +155,11 @@ asm void daAlink_c::setWolfFootOn(int param_0) { /* 80121304-80121388 11BC44 0084+00 1/1 0/0 0/0 .text setFootMark__9daAlink_cFP4cXyzUsi */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void daAlink_c::setFootMark(cXyz* param_0, u16 param_1, int param_2) { - nofralloc -#include "asm/d/a/d_a_alink/setFootMark__9daAlink_cFP4cXyzUsi.s" +void daAlink_c::setFootMark(cXyz* i_pos, u16 i_mtxNo, int param_2) { + cXyz sp8; + mDoMtx_multVecSR(mpLinkModel->i_getAnmMtx(i_mtxNo), &cXyz::BaseX, &sp8); + dkWmark_c::setFootMark(i_pos, sp8.atan2sX_Z(), param_2); } -#pragma pop /* 80121388-801221F0 11BCC8 0E68+00 1/1 0/0 0/0 .text setEffect__9daAlink_cFv */ #pragma push @@ -162,14 +182,10 @@ asm void daAlink_c::setSumouEffect() { #pragma pop /* 801225E8-80122654 11CF28 006C+00 1/1 0/0 0/0 .text setWaterfallEffect__9daAlink_cFPC4cXyzPUl */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void daAlink_c::setWaterfallEffect(cXyz const* param_0, u32* param_1) { - nofralloc -#include "asm/d/a/d_a_alink/setWaterfallEffect__9daAlink_cFPC4cXyzPUl.s" +void daAlink_c::setWaterfallEffect(cXyz const* param_0, u32* param_1) { + setEmitter(¶m_1[0], 0x8614, param_0, NULL); + setEmitter(¶m_1[1], 0x8615, param_0, NULL); } -#pragma pop /* 80122654-8012277C 11CF94 0128+00 1/1 0/0 0/0 .text setWaterfallEffect__9daAlink_cFv */ #pragma push @@ -459,8 +475,8 @@ asm void daAlink_c::setBottleEffect() { #pragma pop /* 80124E28-80124EA8 11F768 0080+00 2/2 0/0 0/0 .text clearFirePointDamageEffect__9daAlink_cFi */ -void daAlink_c::clearFirePointDamageEffect(int i) { - firePointEff_c* fire_eff = &field_0x32d8[i]; +void daAlink_c::clearFirePointDamageEffect(int i_effNo) { + firePointEff_c* fire_eff = &field_0x32d8[i_effNo]; if (fire_eff->field_0x0 != 0) { stopDrawParticle(fire_eff->field_0x4); diff --git a/src/d/a/d_a_alink_kandelaar.inc b/src/d/a/d_a_alink_kandelaar.inc index 18cb8e66d59..b5e68b4970a 100644 --- a/src/d/a/d_a_alink_kandelaar.inc +++ b/src/d/a/d_a_alink_kandelaar.inc @@ -3,9 +3,14 @@ * Player Lantern action handling */ +#include "d/a/d_a_alink.h" +#include "d/com/d_com_inf_game.h" +#include "rel/d/a/e/d_a_e_sm2/d_a_e_sm2.h" +#include "rel/d/a/tag/d_a_tag_ss_drink/d_a_tag_ss_drink.h" + /* 80110654-80110668 10AF94 0014+00 1/1 0/0 0/0 .text daAlink_searchTagKandelaar__FP10fopAc_ac_cPv */ -static fopAc_ac_c* daAlink_searchTagKandelaar(fopAc_ac_c* i_actor, void* param_1) { +static fopAc_ac_c* daAlink_searchTagKandelaar(fopAc_ac_c* i_actor, void* i_data) { if (fopAcM_GetName(i_actor) == PROC_TAG_LANTERN) { return i_actor; } @@ -15,12 +20,13 @@ static fopAc_ac_c* daAlink_searchTagKandelaar(fopAc_ac_c* i_actor, void* param_1 /* 80110668-801106E8 10AFA8 0080+00 1/1 0/0 0/0 .text daAlink_searchTagKtOnFire__FP10fopAc_ac_cPv */ -static fopAc_ac_c* daAlink_searchTagKtOnFire(fopAc_ac_c* i_actor, void* param_1) { - daAlink_c* link = daAlink_getAlinkActorClass(); +static fopAc_ac_c* daAlink_searchTagKtOnFire(fopAc_ac_c* i_actor, void* i_data) { + daAlink_c* player_p = daAlink_getAlinkActorClass(); if (fopAcM_GetName(i_actor) == PROC_Tag_KtOnFire && - i_actor->current.pos.abs2(link->current.pos) < lit_26816 && - fopAcM_seenActorAngleY(link, i_actor) < 0x3000) { + i_actor->current.pos.abs2(player_p->current.pos) < lit_26816 && + fopAcM_seenActorAngleY(player_p, i_actor) < 0x3000) + { return i_actor; } @@ -66,7 +72,7 @@ BOOL daAlink_c::checkWaterInKandelaarOffset(f32 param_0) { void daAlink_c::checkWaterInKandelaar(f32 param_0) { if (i_checkNoResetFlg2(FLG2_UNK_1) && checkWaterInKandelaarOffset(param_0)) { if (mEquipItem == KANTERA) { - deleteEquipItem(1, 1); + deleteEquipItem(TRUE, TRUE); } else { offKandelaarModel(); seStartOnlyReverb(Z2SE_AL_ITEM_TAKEOUT); @@ -90,7 +96,9 @@ bool daAlink_c::checkUseKandelaar(int param_0) { /* 801108B4-801108EC 10B1F4 0038+00 1/0 0/0 0/0 .text checkKandelaarSwing__9daAlink_cCFi */ bool daAlink_c::checkKandelaarSwing(int param_0) const { - if ((checkKandelaarSwingAnime() || mProcID == PROC_KANDELAAR_SWING) && (dComIfGs_getOil() != 0 || param_0 == 0)) { + if ((checkKandelaarSwingAnime() || mProcID == PROC_KANDELAAR_SWING) && + (dComIfGs_getOil() != 0 || param_0 == 0)) + { return true; } @@ -110,10 +118,10 @@ asm void daAlink_c::kandelaarModelCallBack() { /* 80110BEC-80110C28 10B52C 003C+00 1/1 0/0 0/0 .text daAlink_kandelaarModelCallBack__FP8J3DJointi */ static int daAlink_kandelaarModelCallBack(J3DJoint* param_0, int param_1) { - daAlink_c* link = (daAlink_c*)j3dSys.getModel()->getUserArea(); + daAlink_c* player_p = (daAlink_c*)j3dSys.getModel()->getUserArea(); if (param_1 == 0) { - link->kandelaarModelCallBack(); + player_p->kandelaarModelCallBack(); } return 1; @@ -122,7 +130,9 @@ static int daAlink_kandelaarModelCallBack(J3DJoint* param_0, int param_1) { /* 80110C28-80110C6C 10B568 0044+00 1/0 0/0 0/0 .text getKandelaarFlamePos__9daAlink_cFv */ cXyz* daAlink_c::getKandelaarFlamePos() { - if ((!i_checkNoResetFlg2((daPy_FLG2)0x20001) && !i_checkEndResetFlg1(ERFLG1_UNK_4)) || i_checkWolf() || !i_checkNoResetFlg1(FLG1_UNK_80)) { + if ((!i_checkNoResetFlg2((daPy_FLG2)0x20001) && !i_checkEndResetFlg1(ERFLG1_UNK_4)) || + i_checkWolf() || !i_checkNoResetFlg1(FLG1_UNK_80)) + { return NULL; } @@ -135,6 +145,52 @@ BOOL daAlink_c::checkKandelaarEquipAnime() const { } /* 80110C94-80110E80 10B5D4 01EC+00 1/1 0/0 0/0 .text preKandelaarDraw__9daAlink_cFv */ +// matches with literals +#ifdef NONMATCHING +void daAlink_c::preKandelaarDraw() { + J3DMaterial* mat_p = mpKanteraGlowModel->getModelData()->getMaterialNodePointer(0); + + J3DGXColorS10 color; + color.r = daAlinkHIO_kandelaar_c0::m.mColorReg1R; + color.g = daAlinkHIO_kandelaar_c0::m.mColorReg1G; + color.b = daAlinkHIO_kandelaar_c0::m.mColorReg1B; + color.a = 255; + mat_p->setTevColor(1, &color); + + color.r = daAlinkHIO_kandelaar_c0::m.mColorReg2R; + color.g = daAlinkHIO_kandelaar_c0::m.mColorReg2G; + color.b = daAlinkHIO_kandelaar_c0::m.mColorReg2B; + mat_p->setTevColor(2, &color); + + cXyz proj; + mDoLib_project(&mKandelaarFlamePos, &proj); + + camera_class* camera_p = dComIfGp_getCamera(0); + f32 var_f3; + if (camera_p != NULL) { + var_f3 = camera_p->mCamera.TrimHeight(); + } else { + var_f3 = 0.0f; + } + + if (proj.x > 0.0f && proj.x < 640.0f && proj.y > var_f3 && proj.y < 456.0f - var_f3) { + dComIfGd_peekZ(proj.x, proj.y, &field_0x32c8); + } else { + field_0x32c8 = 0; + } + + f32 near = dComIfGd_getView()->mNear; + f32 far = dComIfGd_getView()->mFar; + + mDoLib_pos2camera(&mKandelaarFlamePos, &proj); + proj.z += 30.0f; + if (proj.z > -0.01f) { + proj.z = -0.01f; + } + + field_0x344c = ((near + (far * near) / proj.z) / (far - near) + 1.0f) * 1.6777215E7f; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -143,12 +199,38 @@ asm void daAlink_c::preKandelaarDraw() { #include "asm/d/a/d_a_alink/preKandelaarDraw__9daAlink_cFv.s" } #pragma pop +#endif /* 80110E80-80110E84 10B7C0 0004+00 0/0 3/0 0/0 .text * setTevColor__11J3DTevBlockFUlPC13J3DGXColorS10 */ void J3DTevBlock::setTevColor(u32 param_0, J3DGXColorS10 const* param_1) {} /* 80110E84-80110F88 10B7C4 0104+00 4/4 0/0 0/0 .text setKandelaarModel__9daAlink_cFv */ +// matches with literals +#ifdef NONMATCHING +void daAlink_c::setKandelaarModel() { + field_0x2f94 = 0; + + if (!i_checkNoResetFlg2(FLG2_UNK_1)) { + i_onNoResetFlg2(FLG2_UNK_1); + + mDoMtx_multVecZero(mpLinkModel->i_getAnmMtx(field_0x30c0), &mKandelaarFlamePos); + mKandelaarFlamePos.y -= 30.0f; + + field_0x3630 = field_0x3624; + field_0x3624 = mKandelaarFlamePos; + field_0x3618 = cXyz::Zero; + + field_0x32c8 = 0; + field_0x3448 = 0.0f; + field_0x344c = -1.0f; + + mpKanteraGlowModel->setBaseScale(cXyz::Zero); + } + + mZ2Link.setKanteraState(1); +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -157,11 +239,12 @@ asm void daAlink_c::setKandelaarModel() { #include "asm/d/a/d_a_alink/setKandelaarModel__9daAlink_cFv.s" } #pragma pop +#endif /* 80110F88-80110FE0 10B8C8 0058+00 3/3 0/0 0/0 .text resetOilBottleModel__9daAlink_cFv */ void daAlink_c::resetOilBottleModel() { - deleteEquipItem(0, 1); + deleteEquipItem(FALSE, TRUE); if (mProcVar3.field_0x300e.x != 0) { setKandelaarModel(); @@ -172,37 +255,168 @@ void daAlink_c::resetOilBottleModel() { } /* 80110FE0-801110B8 10B920 00D8+00 3/3 0/0 0/0 .text commonKandelaarPourInit__9daAlink_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void daAlink_c::commonKandelaarPourInit() { - nofralloc -#include "asm/d/a/d_a_alink/commonKandelaarPourInit__9daAlink_cFv.s" +void daAlink_c::commonKandelaarPourInit() { + if (i_checkNoResetFlg2(FLG2_UNK_1)) { + mProcVar3.field_0x300e.x = 1; + } else { + mProcVar3.field_0x300e.x = 0; + } + + keepItemData(); + setKandelaarModel(); + setBottleModel(getReadyItem()); + + mProcVar2.field_0x300c = 0; + dComIfGp_setPlayerStatus1(0, 0x2000); + field_0x3194 = 10; + dCam_getBody()->StartEventCamera(0x12, fopAcM_GetID(this), "Type", 1, &field_0x3194, 0); } -#pragma pop /* 801110B8-8011130C 10B9F8 0254+00 3/3 0/0 0/0 .text commonKandelaarPour__9daAlink_cFi */ +// matches with literals +#ifdef NONMATCHING +int daAlink_c::commonKandelaarPour(int param_0) { + simpleAnmPlay(field_0x0718); + simpleAnmPlay(field_0x071c); + + daPy_frameCtrl_c* frameCtrl_p; + u16 current_anm; + if (param_0) { + frameCtrl_p = &mUpperFrameCtrl[2]; + current_anm = mUpperAnmHeap[2].getIdx(); + } else { + frameCtrl_p = &mUnderFrameCtrl[0]; + current_anm = mUnderAnmHeap[0].getIdx(); + } + + i_onNoResetFlg2(FLG2_UNK_10000000); + + if (current_anm == getMainBckData(ANM_OIL_BOTTLE_POUR_START)->m_underID) { + if (checkAnmEnd(frameCtrl_p)) { + if (param_0) { + setUpperAnimeBaseMorf(getMainBckData(ANM_OIL_BOTTLE_POUR)->m_upperID, 0.0f); + } else { + setSingleAnimeBaseMorf(ANM_OIL_BOTTLE_POUR, 0.0f); + } + + dComIfGp_setItemOilCount(dComIfGs_getMaxOil()); + } else if (frameCtrl_p->checkPass(10.0f)) { + field_0x071c->setFrame(0.0f); + mHeldItemModel->getModelData()->entryTexMtxAnimator(field_0x071c); + } + } else if (current_anm == getMainBckData(ANM_OIL_BOTTLE_POUR)->m_underID) { + if (dComIfGp_getItemNowOil() == dComIfGs_getOil()) { + if (mProcVar2.field_0x300c == 0) { + mProcVar2.field_0x300c = 1; + mHeldItemModel->getModelData()->entryTexMtxAnimator(field_0x0720); + } else if (simpleAnmPlay(field_0x0720)) { + if (param_0) { + setUpperAnimeParam(getMainBckData(ANM_OIL_BOTTLE_POUR_END)->m_upperID, UPPER_2, + &daAlinkHIO_kandelaar_c0::m.mEndUnkAnm); + } else { + setSingleAnimeParam(ANM_OIL_BOTTLE_POUR_END, + &daAlinkHIO_kandelaar_c0::m.mEndUnkAnm); + } + + field_0x072c->setFrame(2.0f); + dComIfGs_setEquipBottleItemEmpty(mSelectItemId); + } + } + } else if (checkAnmEnd(frameCtrl_p)) { + if (param_0) { + resetUpperAnime(UPPER_2, 3.0f); + } + + resetOilBottleModel(); + resetSpecialEvent(); + i_offNoResetFlg2(FLG2_UNK_10000000); + return 1; + } + + return 0; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void daAlink_c::commonKandelaarPour(int param_0) { +asm int daAlink_c::commonKandelaarPour(int param_0) { nofralloc #include "asm/d/a/d_a_alink/commonKandelaarPour__9daAlink_cFi.s" } #pragma pop +#endif /* 8011130C-80111440 10BC4C 0134+00 1/1 0/0 0/0 .text initKandelaarSwing__9daAlink_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void daAlink_c::initKandelaarSwing() { - nofralloc -#include "asm/d/a/d_a_alink/initKandelaarSwing__9daAlink_cFv.s" +void daAlink_c::initKandelaarSwing() { + if (mEquipItem == KANTERA) { + if (dComIfGs_getOil() != 0) { + mZ2Link.getKantera().startSound(Z2SE_AL_KANTERA_SWING, 0, mVoiceReverbIntensity); + } else { + mZ2Link.getKantera().startSound(Z2SE_AL_KANTERA_OFF_SWING, 0, mVoiceReverbIntensity); + } + } + + voiceStart(Z2SE_AL_V_SWING_BOTTLE); + field_0xFB8.ResetAtHit(); + + if (!checkEventRun()) { + dComIfGp_setItemOilCount(-daAlinkHIO_kandelaar_c0::m.mShakeOilLoss); + } + + field_0xFB8.OffAtSetBit(); + field_0xFB8.SetR(lit_6895); + field_0xFB8.SetAtType(AT_TYPE_LANTERN_SWING); + field_0xFB8.SetAtHitMark(0); + field_0xFB8.SetAtSe(dCcD_SE_NONE); + field_0xFB8.SetAtAtp(0); + field_0xFB8.SetAtMtrl(1); } -#pragma pop /* 80111440-801115CC 10BD80 018C+00 2/1 0/0 0/0 .text procKandelaarSwingInit__9daAlink_cFv */ +// matches with literals +#ifdef NONMATCHING +int daAlink_c::procKandelaarSwingInit() { + fopAc_ac_c* catch_target_p = i_dComIfGp_att_getCatghTarget(); + if (catch_target_p != NULL) { + s16 name = fopAcM_GetName(catch_target_p); + BOOL is_sm2 = name == PROC_E_SM2; + + if (name == PROC_OBJ_OILTUBO || + (name == PROC_TAG_SSDRINK && + static_cast(catch_target_p)->checkShopOil()) || + (is_sm2 && static_cast(catch_target_p)->checkYellow())) + { + return procBottleSwingInit(catch_target_p, is_sm2); + } + } + + if (!commonProcInitNotSameProc(PROC_KANDELAAR_SWING)) { + return 0; + } + + mNormalSpeed = 0.0f; + current.angle.y = shape_angle.y; + + if ((mLinkAcch.i_ChkGroundHit() && getMoveBGActorName(mLinkAcch.m_gnd, 0) == PROC_OBJ_WEB1) || + (checkStageName("F_SP108") && + fopAcIt_Judge((fopAcIt_JudgeFunc)daAlink_searchTagKtOnFire, NULL) != NULL)) + { + setSingleAnimeParam(ANM_BOTTLE_SWING_DOWN, &daAlinkHIO_bottle_c0::m.mSwingDownAnm); + field_0x3478 = daAlinkHIO_bottle_c0::m.mSwingDownAnm.mCheckFrame; + field_0x347c = 5.0f; + field_0x3480 = 12.0f; + } else { + setSingleAnimeParam(ANM_LANTERN_SWING, &daAlinkHIO_kandelaar_c0::m.mShakeAnm); + field_0x3478 = daAlinkHIO_kandelaar_c0::m.mShakeAnm.mCheckFrame; + field_0x347c = 4.0f; + field_0x3480 = 11.0f; + } + + initKandelaarSwing(); + return 1; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -211,18 +425,19 @@ asm int daAlink_c::procKandelaarSwingInit() { #include "asm/d/a/d_a_alink/procKandelaarSwingInit__9daAlink_cFv.s" } #pragma pop +#endif /* 801115CC-8011167C 10BF0C 00B0+00 1/0 0/0 0/0 .text procKandelaarSwing__9daAlink_cFv */ int daAlink_c::procKandelaarSwing() { - daPy_frameCtrl_c* frameCtrl = mUnderFrameCtrl; + daPy_frameCtrl_c* frameCtrl_p = mUnderFrameCtrl; - if (frameCtrl->checkAnmEnd()) { + if (frameCtrl_p->checkAnmEnd()) { if (mDemo.getDemoMode() == 0x27) { dComIfGp_evmng_cutEnd(field_0x3184); } else { checkNextAction(0); } - } else if (frameCtrl->getFrame() > field_0x3478 && mDemo.getDemoMode() != 0x27) { + } else if (frameCtrl_p->getFrame() > field_0x3478 && mDemo.getDemoMode() != 0x27) { onModeFlg(4); checkNextAction(1); } @@ -251,4 +466,4 @@ int daAlink_c::procKandelaarPourInit() { int daAlink_c::procKandelaarPour() { commonKandelaarPour(0); return 1; -} \ No newline at end of file +} diff --git a/src/d/a/d_a_alink_swim.inc b/src/d/a/d_a_alink_swim.inc index 353d8ace474..2d26c210fc7 100644 --- a/src/d/a/d_a_alink_swim.inc +++ b/src/d/a/d_a_alink_swim.inc @@ -3,6 +3,8 @@ * Player Swim action handling */ +#include "d/a/d_a_alink.h" +#include "d/com/d_com_inf_game.h" #include "f_op/f_op_kankyo_mng.h" /* 80101890-801018E4 0FC1D0 0054+00 6/6 0/0 0/0 .text checkZoraWearMaskDraw__9daAlink_cFv @@ -1091,4 +1093,4 @@ int daAlink_c::procOctaIealSpit() { } return 1; -} \ No newline at end of file +} diff --git a/src/d/a/d_a_alink_whistle.inc b/src/d/a/d_a_alink_whistle.inc index b3c39bf56b2..c30f29c1ae6 100644 --- a/src/d/a/d_a_alink_whistle.inc +++ b/src/d/a/d_a_alink_whistle.inc @@ -3,21 +3,25 @@ * Player Horse / Hawk Grass Whistle action handling */ +#include "d/a/d_a_alink.h" +#include "d/com/d_com_inf_game.h" +#include "d/d_procname.h" +#include "rel/d/a/npc/d_a_npc_tk/d_a_npc_tk.h" #include "rel/d/a/obj/d_a_obj_yobikusa/d_a_obj_yobikusa.h" /* 8011174C-80111770 10C08C 0024+00 1/1 0/0 0/0 .text daAlink_searchWhistle__FP10fopAc_ac_cPv */ -static fopAc_ac_c* daAlink_searchWhistle(fopAc_ac_c* p_actor, void*) { - if (daAlink_getAlinkActorClass()->getGrassHowlEventActor() == fopAcM_GetName(p_actor)) { - return p_actor; +static fopAc_ac_c* daAlink_searchWhistle(fopAc_ac_c* i_actor, void* i_data) { + if (daAlink_getAlinkActorClass()->getGrassHowlEventActor() == fopAcM_GetName(i_actor)) { + return i_actor; } return NULL; } /* 80111770-80111784 10C0B0 0014+00 1/1 0/0 0/0 .text daAlink_searchHawk__FP10fopAc_ac_cPv */ -static fopAc_ac_c* daAlink_searchHawk(fopAc_ac_c* p_actor, void*) { - if (fopAcM_GetName(p_actor) == PROC_NPC_TK) { - return p_actor; +static fopAc_ac_c* daAlink_searchHawk(fopAc_ac_c* i_actor, void* i_data) { + if (fopAcM_GetName(i_actor) == PROC_NPC_TK) { + return i_actor; } return NULL; @@ -26,18 +30,18 @@ static fopAc_ac_c* daAlink_searchHawk(fopAc_ac_c* p_actor, void*) { /* 80111784-8011181C 10C0C4 0098+00 1/1 0/0 0/0 .text setGrassWhistleModel__9daAlink_cFi */ void daAlink_c::setGrassWhistleModel(int modelType) { - static const char* grassWhistleArcName[2] = { + static const char* grassWhistleArcName[] = { "J_Tobi", "J_Umak", }; - JKRHeap* heap = setItemHeap(); + JKRHeap* prev_heap = setItemHeap(); J3DModelData* modeldata = (J3DModelData*)dComIfG_getObjectRes(grassWhistleArcName[modelType], grassWhistleIdx[modelType]); mHeldItemModel = mDoExt_J3DModel__create(modeldata, 0x80000, 0x11000084); - mDoExt_setCurrentHeap(heap); + mDoExt_setCurrentHeap(prev_heap); mEquipItem = 0x104; field_0x2f94 = 2; } @@ -45,11 +49,11 @@ void daAlink_c::setGrassWhistleModel(int modelType) { /* 8011181C-80111894 10C15C 0078+00 1/1 0/0 0/0 .text setHorseWhistleModel__9daAlink_cFv */ void daAlink_c::setHorseWhistleModel() { - JKRHeap* heap = setItemHeap(); + JKRHeap* prev_heap = setItemHeap(); mHeldItemModel = initModel(loadAramBmd(0x31A, 0x3000), 0); - mDoExt_setCurrentHeap(heap); + mDoExt_setCurrentHeap(prev_heap); mEquipItem = HORSE_FLUTE; field_0x2f94 = 2; } @@ -71,14 +75,14 @@ int daAlink_c::procGrassWhistleGetInit() { field_0x2f92 = 0xFE; field_0x280c.setData(field_0x27f4); - daObjYobikusa_c* yobikusa = (daObjYobikusa_c*)field_0x27f4; - mProcVar2.field_0x300c = yobikusa->getType(); - mProcVar3.field_0x300e.x = yobikusa->getPathID(); - mProcVar3.field_0x300e.y = yobikusa->isPlayerCorrect(); - mProcVar3.field_0x300e.z = yobikusa->shape_angle.y + 0x8000; - field_0x37c8.set(yobikusa->current.pos.x + cM_ssin(yobikusa->shape_angle.y) * 50.0f, - yobikusa->current.pos.y + 50.0f, - yobikusa->current.pos.z + cM_scos(yobikusa->shape_angle.y) * 50.0f); + daObjYobikusa_c* yobikusa_p = (daObjYobikusa_c*)field_0x27f4; + mProcVar2.field_0x300c = yobikusa_p->getType(); + mProcVar3.field_0x300e.x = yobikusa_p->getPathID(); + mProcVar3.field_0x300e.y = yobikusa_p->isPlayerCorrect(); + mProcVar3.field_0x300e.z = yobikusa_p->shape_angle.y + 0x8000; + field_0x37c8.set(yobikusa_p->current.pos.x + cM_ssin(yobikusa_p->shape_angle.y) * 50.0f, + yobikusa_p->current.pos.y + 50.0f, + yobikusa_p->current.pos.z + cM_scos(yobikusa_p->shape_angle.y) * 50.0f); voiceStart(Z2SE_AL_V_SWING_BOTTLE); return 1; } @@ -96,13 +100,14 @@ asm int daAlink_c::procGrassWhistleGetInit() { /* 801119D8-80111A9C 10C318 00C4+00 1/0 0/0 0/0 .text procGrassWhistleGet__9daAlink_cFv */ int daAlink_c::procGrassWhistleGet() { - daPy_frameCtrl_c* frameCtrl = mUnderFrameCtrl; - - if (frameCtrl->checkAnmEnd()) { - procGrassWhistleWaitInit(mProcVar2.field_0x300c, mProcVar3.field_0x300e.x, mProcVar3.field_0x300e.y, mProcVar3.field_0x300e.z, &field_0x37c8); - } else if (mEquipItem == NO_ITEM && frameCtrl->getFrame() >= lit_7710) { + daPy_frameCtrl_c* frameCtrl_p = mUnderFrameCtrl; + + if (frameCtrl_p->checkAnmEnd()) { + procGrassWhistleWaitInit(mProcVar2.field_0x300c, mProcVar3.field_0x300e.x, + mProcVar3.field_0x300e.y, mProcVar3.field_0x300e.z, &field_0x37c8); + } else if (mEquipItem == NO_ITEM && frameCtrl_p->getFrame() >= lit_7710) { setGrassWhistleModel(mProcVar2.field_0x300c); - + if (field_0x280c.getActor() != NULL) { fopAcM_setCarryNow(field_0x280c.getActor(), 0); seStartOnlyReverb(Z2SE_AL_PICKUP_GRASS); @@ -114,18 +119,181 @@ int daAlink_c::procGrassWhistleGet() { /* 80111A9C-80111CA4 10C3DC 0208+00 2/2 0/0 0/0 .text * procGrassWhistleWaitInit__9daAlink_cFiiisP4cXyz */ +// matches with literals +#ifdef NONMATCHING +int daAlink_c::procGrassWhistleWaitInit(int param_0, int param_1, int param_2, s16 param_3, + cXyz* param_4) { + u16 var_r6; + if (param_0 == 3) { + var_r6 = 0xFFFF; + } else { + var_r6 = 0xFFF9; + } + + if (!dComIfGp_event_compulsory(this, NULL, var_r6)) { + return checkNextAction(0); + } + + mDemo.i_setSpecialDemoType(); + commonProcInit(PROC_GRASS_WHISTLE_WAIT); + + if (param_0 == 3) { + keepItemData(); + setHorseWhistleModel(); + setSingleAnimeBase(ANM_GRASS_WHISTLE_START); + field_0x3198 = -1; + field_0x32cc = 0x532; + } else { + setSingleAnimeBase(ANM_WAIT); + mKeepItem = NO_ITEM; + + if (param_0 == 0) { + field_0x3198 = 0x100; + field_0x32cc = 0x535; + } else { + field_0x3198 = -1; + field_0x32cc = 0x532; + } + } + + setUpperAnimeBaseMorf(getMainBckData(ANM_GRASS_WHISTLE_START)->m_underID, -1.0f); + setFacePriAnime(ANM_GRASS_WHISTLE_START); + mProcVar2.field_0x300c = param_0; + mProcVar3.field_0x300e.x = param_1; + + dCam_getBody()->StartEventCamera(12, fopAcM_GetID(this), 0); + mProcVar0.field_0x3008 = 0; + mProcVar3.field_0x300e.y = 0; + mProcVar3.field_0x300e.z = 0; + mMsgClassID = -1; + mNormalSpeed = 0.0f; + current.angle.y = shape_angle.y; + field_0x2f98 = 4; + + if (param_2) { + mLinkGndChk.SetPos(param_4); + + f32 gnd_cross = dComIfG_Bgsp().GroundCross(&mLinkGndChk); + if (gnd_cross != -1000000000.0f) { + current.pos.set(param_4->x, gnd_cross, param_4->z); + } + + shape_angle.y = param_3; + current.angle.y = shape_angle.y; + } + + dComIfGp_setPlayerStatus1(0, 0x4000000); + return 1; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off asm int daAlink_c::procGrassWhistleWaitInit(int param_0, int param_1, int param_2, s16 param_3, - cXyz* param_4) { + cXyz* param_4) { nofralloc #include "asm/d/a/d_a_alink/procGrassWhistleWaitInit__9daAlink_cFiiisP4cXyz.s" } #pragma pop +#endif /* 80111CA4-80111FF0 10C5E4 034C+00 1/0 0/0 0/0 .text procGrassWhistleWait__9daAlink_cFv */ +// small regalloc +#ifdef NONMATCHING +int daAlink_c::procGrassWhistleWait() { + if (mProcVar3.field_0x300e.z != 0) { + if (checkEndMessage(field_0x32cc)) { + resetSpecialEvent(); + return procWaitInit(); + } + + return 1; + } + + if (mProcVar0.field_0x3008 < 0) { + mProcVar0.field_0x3008--; + + if (mProcVar0.field_0x3008 == -3) { + return procWaitInit(); + } + } else if (mProcVar0.field_0x3008 != 0) { + mProcVar0.field_0x3008--; + + if (mProcVar0.field_0x3008 == 0) { + daHorse_c* horse_p = i_dComIfGp_getHorseActor(); + daNPC_TK_c* tk_p = (daNPC_TK_c*)fopAcIt_Judge((fopAcIt_JudgeFunc)daAlink_searchWhistle, NULL); + + if (tk_p != NULL) { + fopAcM_OnStatus(tk_p, 0x800); + + if (field_0x3198 == 0x100) { + tk_p->setEvent(); + tk_p->setHawkPath(mProcVar3.field_0x300e.x); + } + + mProcVar0.field_0x3008--; + resetSpecialEvent(); + } else { + int temp_r4; + if ((mProcVar2.field_0x300c == 1 || mProcVar2.field_0x300c == 3) && horse_p != NULL) { + temp_r4 = horse_p->callHorse(¤t.pos); + } else { + temp_r4 = 0; + } + + if (temp_r4 == 1 || temp_r4 == 4 || temp_r4 == 2) { + return procCoHorseCallWaitInit(temp_r4); + } else if (temp_r4 == 3) { + resetSpecialEvent(); + return procWaitInit(); + } + + setFaceBasicTexture(FTANM_UNK_0); + mProcVar3.field_0x300e.z = 1; + return 1; + } + + setGrassCancelStatus(0); + } + } else if (checkAnmEnd(&mUpperFrameCtrl[2])) { + setGrassCancelStatus(0x12); + setDoStatus(0x2C); + + if (mProcVar2.field_0x300c == 3 || doTrigger()) { + setSingleAnimeBaseMorf(ANM_GRASS_WHISTLE_PLAY, 0.0f); + resetUpperAnime(UPPER_2, -1.0f); + dComIfGp_event_onHindFlag(6); + + if (mProcVar2.field_0x300c == 0) { + voiceStart(Z2SE_PLAY_REED_TOBIKUSA); + mProcVar0.field_0x3008 = 100; + + if (i_dComIfGs_isEventBit(dSv_event_flag_c::F_0700) && + i_dComIfGs_isEventBit(dSv_event_flag_c::F_0037)) + { + dComIfGs_onEventBit(dSv_event_flag_c::F_0581); + } + } else { + voiceStart(Z2SE_PLAY_REED_UMAKUSA); + mProcVar0.field_0x3008 = 140; + + if (mProcVar2.field_0x300c == 1) { + dComIfGs_onEventBit(dSv_event_flag_c::F_0580); + } + } + } else if (grassCancelTrigger()) { + resetUpperAnime(UPPER_2, -1.0f); + resetSpecialEvent(); + procWaitInit(); + } + } else { + setGrassCancelStatus(0); + } + + return 1; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -134,6 +302,7 @@ asm int daAlink_c::procGrassWhistleWait() { #include "asm/d/a/d_a_alink/procGrassWhistleWait__9daAlink_cFv.s" } #pragma pop +#endif /* 80111FF0-801120C8 10C930 00D8+00 2/2 0/0 0/0 .text procCoHorseCallWaitInit__9daAlink_cFi */ int daAlink_c::procCoHorseCallWaitInit(int param_0) { @@ -176,7 +345,7 @@ int daAlink_c::procHawkCatchInit() { } setSingleAnimeBase(ANM_HAWK_CATCH); - deleteEquipItem(0, 1); + deleteEquipItem(FALSE, TRUE); return 1; } @@ -199,14 +368,14 @@ int daAlink_c::procHawkSubjectInit() { setSingleAnimeBase(ANM_HAWK_WAIT); - fopAc_ac_c* actor = (fopAc_ac_c*)fopAcIt_Judge((fopAcIt_JudgeFunc)daAlink_searchHawk, NULL); - if (actor != NULL) { - field_0x280c.setData(actor); + fopAc_ac_c* hawk_p = (fopAc_ac_c*)fopAcIt_Judge((fopAcIt_JudgeFunc)daAlink_searchHawk, NULL); + if (hawk_p != NULL) { + field_0x280c.setData(hawk_p); } mProcVar2.field_0x300c = 0; mBodyAngle.y = 0; - deleteEquipItem(0, 1); + deleteEquipItem(FALSE, TRUE); return 1; } @@ -218,4 +387,4 @@ asm int daAlink_c::procHawkSubject() { nofralloc #include "asm/d/a/d_a_alink/procHawkSubject__9daAlink_cFv.s" } -#pragma pop \ No newline at end of file +#pragma pop