Skip to content

Commit

Permalink
tbox/camera/d_bg_w_kcol work and cleanup (#2262)
Browse files Browse the repository at this point in the history
* some camera/tbox cleanup

* d_bg_w_kcol work

* make item name enum better
  • Loading branch information
TakaRikka authored Dec 10, 2024
1 parent 3fa6b50 commit 8d73439
Show file tree
Hide file tree
Showing 100 changed files with 4,141 additions and 3,938 deletions.
12 changes: 6 additions & 6 deletions include/d/actor/d_a_alink.h
Original file line number Diff line number Diff line change
Expand Up @@ -1321,7 +1321,7 @@ class daAlink_c : public daPy_py_c {
/* 800D0CDC */ virtual ~hsChainShape_c();
}; // Size: 0x10

/* 8009D87C */ bool getE3Zhint();
/* 8009D87C */ static BOOL getE3Zhint();
/* 8009D884 */ static const char* getAlinkArcName();
/* 8009DA60 */ static bool checkStageName(char const*);
/* 8009DA98 */ void tgHitCallback(fopAc_ac_c*, dCcD_GObjInf*, dCcD_GObjInf*);
Expand Down Expand Up @@ -3215,10 +3215,10 @@ class daAlink_c : public daPy_py_c {
return checkHookshotReadyAnime() || checkHookshotShootAnime();
}
BOOL checkBoomerangReadyAnime() const {
return (mEquipItem == BOOMERANG || mEquipItem == noentry71) && checkUpperAnime(0x54);
return (mEquipItem == fpcNm_ITEM_BOOMERANG || mEquipItem == 0x102) && checkUpperAnime(0x54);
}
bool checkDkCaught2Anime() const { return checkUpperAnime(0x262); }
BOOL checkCopyRodThrowAnime() const { return mEquipItem == COPY_ROD && checkUpperAnime(0x53); }
BOOL checkCopyRodThrowAnime() const { return mEquipItem == fpcNm_ITEM_COPY_ROD && checkUpperAnime(0x53); }
BOOL checkCutDashChargeAnime() const { return checkUpperAnime(0x83); }
BOOL checkBoomerangAnimeAndReturnWait() const { return checkBoomerangAnime(); }
BOOL checkTwoHandItemEquipAnime() const { return checkUpperAnime(0x245); }
Expand Down Expand Up @@ -3249,7 +3249,7 @@ class daAlink_c : public daPy_py_c {
bool checkIronBallSwingAnime() const { return checkUpperAnime(0x19B); }
bool checkDashDamageAnime() const { return checkUpperAnime(0xAD); }
bool checkBoomerangCatchAnime() const { return checkUpperAnime(0x52); }
BOOL checkCopyRodReadyAnime() const { return mEquipItem == COPY_ROD && checkUpperAnime(0x54); }
BOOL checkCopyRodReadyAnime() const { return mEquipItem == fpcNm_ITEM_COPY_ROD && checkUpperAnime(0x54); }
BOOL checkCanoeFishingWaitAnime() const { return checkUpperAnime(0x5D) || checkUpperAnime(0x260); }
BOOL checkCopyRodControllAnime() const { return checkUpperAnime(0x202); }
BOOL checkWolfHeadDamageAnime() const { return checkUpperAnime(0x2A7); }
Expand All @@ -3262,7 +3262,7 @@ class daAlink_c : public daPy_py_c {
bool swordButton() { return itemButtonCheck(8); }
daPy_actorKeep_c* getThrowBoomerangAcKeep() { return &mThrowBoomerangAcKeep; }
s32 getStartRoomNo() { return fopAcM_GetParam(this) & 0x3F; }
bool checkFisingRodLure() const { return mEquipItem == noentry73; }
bool checkFisingRodLure() const { return mEquipItem == 0x105; }
BOOL doTrigger() const { return mItemTrigger & BTN_A; }
bool swordTrigger() { return itemTriggerCheck(BTN_B); }
BOOL grassCancelTrigger() { return itemTriggerCheck(BTN_B); }
Expand Down Expand Up @@ -3439,7 +3439,7 @@ class daAlink_c : public daPy_py_c {
void setGrassCancelStatus(u8 param_0) { setBStatus(param_0); }

void seStartSystem(u32 i_seID) { mDoAud_seStart(i_seID, NULL, 0, 0); }
bool checkIronBallEquip() const { return mEquipItem == IRONBALL; }
bool checkIronBallEquip() const { return mEquipItem == fpcNm_ITEM_IRONBALL; }

f32 getAnmSpeedStickRate(f32 param_0, f32 param_1) const {
return param_0 + (field_0x33a8 * (param_1 - param_0));
Expand Down
2 changes: 1 addition & 1 deletion include/d/actor/d_a_midna.h
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ class daMidna_c : public fopAc_ac_c {

void resetRatBody() {}

bool checkFlyWaitAnime() {
bool checkFlyWaitAnime() const {
return mBckHeap[0].getIdx() == 0x1CB || mBckHeap[0].getIdx() == 0x1C7
|| mBckHeap[0].getIdx() == 0x1C8 || mBckHeap[0].getIdx() == 0x1C9;
}
Expand Down
98 changes: 97 additions & 1 deletion include/d/actor/d_a_player.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,103 @@ class daBoomerang_c;
class daPy_demo_c {
public:
enum {
DEMO_LAST_e = 0x5F,
DEMO_UNK_0_e,
DEMO_UNK_1_e,
DEMO_UNK_2_e,
DEMO_UNK_3_e,
DEMO_UNK_4_e,
DEMO_WAIT_TURN_e,
DEMO_UNK_6_e,
DEMO_UNK_7_e,
DEMO_UNK_8_e,
DEMO_UNK_9_e,
DEMO_OPEN_TREASURE_e,
DEMO_GET_ITEM_e,
DEMO_UNEQUIP_e,
DEMO_GRAB_PUT_e,
DEMO_UNK_14_e,
DEMO_UNK_15_e,
DEMO_UNK_16_e,
DEMO_UNK_17_e,
DEMO_UNK_18_e,
DEMO_MONKEY_MOVE_e,
DEMO_LOOK_AROUND_e,
DEMO_UNK_21_e,
DEMO_UNK_22_e,
DEMO_UNK_23_e,
DEMO_UNK_24_e,
DEMO_TURN_BACK_e,
DEMO_UNK_26_e,
DEMO_UNK_27_e,
DEMO_BOOMERANG_CATCH_e,
DEMO_HAWK_CATCH_e,
DEMO_SWORD_UNEQUIP_SP_e,
DEMO_UNK_31_e,
DEMO_PUSH_PULL_WAIT_e,
DEMO_PUSH_MOVE_e,
DEMO_BOSS_ATN_WAIT_e,
DEMO_DOOR_OPEN_e,
DEMO_UNK_36_e,
DEMO_TRADE_ITEM_OUT_e,
DEMO_UNK_38_e,
DEMO_KANDELAAR_SWING_e,
DEMO_FRONT_ROLL_e,
DEMO_CROUCH_e,
DEMO_UNK_42_e,
DEMO_UNK_43_e,
DEMO_UNK_44_e,
DEMO_UNK_45_e,
DEMO_CAUGHT_e,
DEMO_LOOK_UP_e,
DEMO_LOOK_UP_TO_GET_ITEM_e,
DEMO_HAND_PAT_e,
DEMO_WOLF_MIDNA_RIDE_SHOCK_e,
DEMO_SUMOU_SHIKO_e,
DEMO_FOG_DEAD_e,
DEMO_WOLF_SMELL_WAIT_e,
DEMO_UNK_54_e,
DEMO_UNK_55_e,
DEMO_WOLF_CARGO_CARRY_e,
DEMO_METAMORPHOSE_UNK1_e,
DEMO_METAMORPHOSE_UNK2_e,
DEMO_HORSE_GET_KEY_e,
DEMO_NOD_e,
DEMO_GLARE_e,
DEMO_EYE_AWAY_e,
DEMO_GOAT_STOP_READY_e,
DEMO_GET_READY_SIT_e,
DEMO_UNK_65_e,
DEMO_TWGATE_e,
DEMO_FM_CHAIN_STRONG_PULL_e,
DEMO_WOLF_SNOW_ESCAPE_e,
DEMO_ZORA_MOVE_e,
DEMO_METAMORPHOSE_ONLY_UNK1_e,
DEMO_METAMORPHOSE_ONLY_UNK2_e,
DEMO_LOOK_AROUND_TURN_e,
DEMO_UNK_73_e,
DEMO_QUAKE_INIT_e,
DEMO_GUARD_ATTACK_e,
DEMO_SWORD_READY_e,
DEMO_DUNGEON_WARP_e,
DEMO_DUNGEON_WARP_SCENE_START_e,
DEMO_MASTER_SWORD_STICK_e,
DEMO_MASTER_SWORD_PULL_e,
DEMO_CUT_DOWN_e,
DEMO_UNK_82_e,
DEMO_CUT_HEAD_e,
DEMO_UNK_84_e,
DEMO_UNK_85_e,
DEMO_CUT_LARGE_JUMP_e,
DEMO_CUT_FAST_READY_e,
DEMO_COPY_ROD_REVIVE_e,
DEMO_SWORD_PUSH_e,
DEMO_GANON_FINISH_e,
DEMO_UNK_91_e,
DEMO_UNK_92_e,
DEMO_HORSE_LOOK_DOWN_e,
DEMO_UNK_94_e,
DEMO_LAST_e,

DEMO_NEW_ANM0_e = 0x200,
};

Expand Down
2 changes: 1 addition & 1 deletion include/d/actor/d_a_tag_lantern.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class daTag_Lantern_c : public fopAc_ac_c {
BOOL rt = false;

if (fopAcM_searchPlayerDistanceXZ(this) < scale.x && 0.0f <= var_f31 && var_f31 < scale.y) {
rt = dComIfGp_checkItemGet(KANTERA, 1) && dComIfGs_getOil() != 0;
rt = dComIfGp_checkItemGet(fpcNm_ITEM_KANTERA, 1) && dComIfGs_getOil() != 0;
field_0x5f8 = rt == true ? 0 : 1;
} else {
rt = true;
Expand Down
4 changes: 2 additions & 2 deletions include/d/actor/d_a_tbox.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,15 +143,15 @@ class daTbox_c : public daTboxBase_c {
void action() { (this->*mpActionFn)(); }

private:
/* 0x718 */ bool field_0x718;
/* 0x718 */ u8 field_0x718;
/* 0x71C */ request_of_phase_process_class mPhase;
/* 0x724 */ J3DModel* mpModel;
/* 0x728 */ J3DModel* mpSlimeModel;
/* 0x72C */ mDoExt_bckAnm* mpAnm;
/* 0x730 */ J3DModel* mpEffectModel;
/* 0x734 */ mDoExt_brkAnm* mpEffectAnm;
/* 0x738 */ dBgW* mpOpenBgW;
/* 0x73C */ dBgW* mpBgCollider;
/* 0x73C */ dBgW* mpBgCollision;
/* 0x740 */ daTbox_actionFn mpActionFn;
/* 0x74C */ int mStaffId;
/* 0x750 */ f32 field_0x750;
Expand Down
89 changes: 39 additions & 50 deletions include/d/d_bg_pc.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,63 +11,52 @@ struct sBgPc {
/* 0x10 */ u32 code4;
}; // Size: 0x14

enum dBgPc_ECode {
/* 0x00004000 */ CODE_OBJ_THRU = 0x4000,
/* 0x00008000 */ CODE_CAM_THRU = 0x8000,
/* 0x00010000 */ CODE_LINK_THRU = 0x10000,
/* 0x00020000 */ CODE_ARROW_THRU = 0x20000,
/* 0x00040000 */ CODE_HS_STICK = 0x40000,
/* 0x00080000 */ CODE_BOOMERANG_THRU = 0x80000,
/* 0x00100000 */ CODE_ROPE_THRU = 0x100000,
/* 0x00200000 */ CODE_HORSE_NO_ENTRY = 0x200000,
/* 0x00400000 */ CODE_SHDW_THRU = 0x400000,
/* 0x00800000 */ CODE_BOMB_THRU = 0x800000,
/* 0x01000000 */ CODE_IRON_BALL_THRU = 0x1000000,
/* 0x02000000 */ CODE_ATTACK_THRU = 0x2000000,
/* 0x40000000 */ CODE_UNDERWATER_ROOF = 0x40000000,
};
#define BGPC_GET_BITS(code, shift, bits) \
((code >> shift) & ((1 << bits) - 1))

#define BGPC_CHECK_BIT(code, bit) \
(code & (1 << bit))

class dBgPc {
public:
void setCode(sBgPc&);

u8 getExit() const { return BGPC_GET_BITS(m_code.code0, 0, 6); }
u8 getPolyCol() const { return BGPC_GET_BITS(m_code.code0, 6, 8); }
u32 getObjThrough() const { return BGPC_CHECK_BIT(m_code.code0, 14); }
u32 getCamThrough() const { return BGPC_CHECK_BIT(m_code.code0, 15); }
u32 getLinkThrough() const { return BGPC_CHECK_BIT(m_code.code0, 16); }
u32 getArrowThrough() const { return BGPC_CHECK_BIT(m_code.code0, 17); }
u32 getHSStick() const { return BGPC_CHECK_BIT(m_code.code0, 18); }
u32 getBoomerangThrough() const { return BGPC_CHECK_BIT(m_code.code0, 19); }
u32 getRopeThrough() const { return BGPC_CHECK_BIT(m_code.code0, 20); }
u32 getHorseNoEntry() const { return BGPC_CHECK_BIT(m_code.code0, 21) != 0; }
u32 getShdwThrough() const { return BGPC_CHECK_BIT(m_code.code0, 22); }
u32 getBombThrough() const { return BGPC_CHECK_BIT(m_code.code0, 23); }
s32 getSpl() const { return BGPC_GET_BITS(m_code.code0, 24, 4); }
u32 getMagnet() const { return BGPC_GET_BITS(m_code.code0, 28, 2); }
u32 getUnderwaterRoof() const { return BGPC_CHECK_BIT(m_code.code0, 30); }
u32 getMonkeyBars() const { return BGPC_CHECK_BIT(m_code.code0, 31) != 0; }

u8 getLinkNo() const { return BGPC_GET_BITS(m_code.code1, 0, 8); }
s32 getWallCode() const { return BGPC_GET_BITS(m_code.code1, 8, 4); }
u32 getAtt0Code() const { return BGPC_GET_BITS(m_code.code1, 12, 4); }
u32 getAtt1Code() const { return BGPC_GET_BITS(m_code.code1, 16, 3); }
u32 getGroundCode() const { return BGPC_GET_BITS(m_code.code1, 19, 5); }
u32 getIronBallThrough() const { return BGPC_CHECK_BIT(m_code.code1, 24); }
u32 getAttackThrough() const { return BGPC_CHECK_BIT(m_code.code1, 25); }

u32 getHorseNoEntry() const { return m_code.code0 >> 0x15 & 1; }
s32 getSpl() const { return m_code.code0 >> 0x18 & 0xF; }
u32 getMagnet() const { return m_code.code0 >> 0x1C & 0x3; }
u32 getMonkeyBars() const { return m_code.code0 >> 0x1F; }
s32 getWallCode() const { return m_code.code1 >> 0x8 & 0xF; }
u32 getAtt0Code() const { return m_code.code1 >> 0xC & 0xF; }
u32 getAtt1Code() const { return m_code.code1 >> 0x10 & 0x7; }
u32 getGroundCode() const { return m_code.code1 >> 0x13 & 0x1F; }
u32 getObjThrough() const { return m_code.code0 & CODE_OBJ_THRU; }
u32 getCamThrough() const { return m_code.code0 & CODE_CAM_THRU; }
u32 getLinkThrough() const { return m_code.code0 & CODE_LINK_THRU; }
u32 getArrowThrough() const { return m_code.code0 & CODE_ARROW_THRU; }
u32 getHSStick() const { return m_code.code0 & CODE_HS_STICK; }
u32 getBoomerangThrough() const { return m_code.code0 & CODE_BOOMERANG_THRU; }
u32 getRopeThrough() const { return m_code.code0 & CODE_ROPE_THRU; }
u32 getBombThrough() const { return m_code.code0 & CODE_BOMB_THRU; }
u32 getIronBallThrough() const { return m_code.code1 & CODE_IRON_BALL_THRU; }
u32 getShdwThrough() const { return m_code.code0 & CODE_SHDW_THRU; }
u32 getUnderwaterRoof() const { return m_code.code0 & CODE_UNDERWATER_ROOF; }
u32 getAttackThrough() const { return m_code.code1 & CODE_ATTACK_THRU; }
u8 getRoom() const { return m_code.code4 >> 0x14; }
u8 getExit() const { return m_code.code0 & 0x3F; }
u8 getPolyCol() const { return m_code.code0 >> 6; }
u8 getLinkNo() const { return m_code.code1; }
u8 getCamMoveBG() const { return m_code.code2; }
u8 getRoomCam() const { return m_code.code2 >> 8; }
u8 getRoomPath() const { return m_code.code2 >> 0x10; }
u8 getRoomPathPnt() const { return m_code.code2 >> 0x18; }
u8 getRoomInf() const { return m_code.code4; }
u8 getSnd() const { return m_code.code4 >> 0xB; }
u32 maskNrm() { return m_code.code4 & 0x100; }
u8 getCamMoveBG() const { return BGPC_GET_BITS(m_code.code2, 0, 8); }
u8 getRoomCam() const { return BGPC_GET_BITS(m_code.code2, 8, 8); }
u8 getRoomPath() const { return BGPC_GET_BITS(m_code.code2, 16, 8); }
u8 getRoomPathPnt() const { return BGPC_GET_BITS(m_code.code2, 24, 8); }

u8 getRoomInf() const { return BGPC_GET_BITS(m_code.code4, 0, 8); }
u32 maskNrm() { return BGPC_CHECK_BIT(m_code.code4, 8); }
// BUG: Seems like this uses the same mask as maskNrm
u32 getWtr() { return m_code.code4 & 0x100; }
u32 getObjThrough() { return m_code.code0 & 0x4000; }
u32 getCamThrough() { return m_code.code0 & 0x8000; }
u32 getLinkThrough() { return m_code.code0 & 0x10000; }
u32 getWtr() { return BGPC_CHECK_BIT(m_code.code4, 8); }
u8 getSnd() const { return BGPC_GET_BITS(m_code.code4, 11, 8); }
u8 getRoom() const { return BGPC_GET_BITS(m_code.code4, 20, 8); }

/* 0x0 */ sBgPc m_code;
};
Expand Down
18 changes: 8 additions & 10 deletions include/d/d_bg_plc.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,11 @@

#include "d/d_bg_pc.h"

enum {
/* 0x14 */ ZELDA_CODE_SIZE = 0x14
};

struct PLC {
/* 0x0 */ u32 magic;
/* 0x4 */ u16 m_code_size;
/* 0x6 */ u16 m_num;
/* 0x8 */ sBgPc field_0x8[0];
struct sBgPlc {
/* 0x0 */ u32 magic; // "SPLC"
/* 0x4 */ u16 m_code_size; // Should normally always be 0x14
/* 0x6 */ u16 m_num; // Number of sBgPc entries to follow
/* 0x8 */ sBgPc m_code[0]; // m_num size array
};

class dBgPlc {
Expand All @@ -22,8 +18,10 @@ class dBgPlc {
/* 800740C4 */ sBgPc* getCode(int, sBgPc**) const;
/* 800740DC */ u32 getGrpCode(int) const;

static const int ZELDA_CODE_SIZE = sizeof(sBgPc);

private:
/* 0x00 */ PLC* m_base;
/* 0x00 */ sBgPlc* m_base;
};

#endif /* D_BG_D_BG_PLC_H */
Loading

0 comments on commit 8d73439

Please sign in to comment.