Misc Collision (#51)

* Initial Commit - Starting to translate from TP

* Collision Updates

* Actor Collision -> dBgW (DZB Collision)

* bg .text splits complete

* fix errors

* file organization

* missed files

* progress

* weee

* most of cM3dG

* Revert mAng change

* Progress

* Progress -> Need to update from main

* Fixup Merge

* d_bg_s symbols....

* TList Changes

* oops

* d_bg_s large progress

* d_bg_s_acch majority done

* d_bg_s_chk OK

* d_bg_s_gnd_chk OK

* d_bg_s_grp_pass_chk OK

* d_bg_lin_chk OK

* d_bg_s_poly_pass_chk OK

* d_bg_s_roof_chk and d_bg_s_sph_chk OK

* d_bg_s_spl_grp_chk OK

* d_bg_s_wtr_chk OK

* d_bg_w started

* d_bg_w_base OK

* name d_bg_w_kcol symbols

* d_bg_w_sv split/started

* most of d_bg_w_time

* stopping d_bg_w_kcol for now

* d_bg_w_sv OK

* work on d_bg_w_time

* revert TList to take offset arg

* fixup some compiler warnings

* set c_bg_w OK

* Update rel_sieve.py

* Remove TList Macros

* Bomb Header started
This commit is contained in:
Elijah Thomas
2024-10-16 09:00:47 -04:00
committed by GitHub
parent ec4d28cd25
commit b5aa43ff37
145 changed files with 10710 additions and 1571 deletions
@@ -2,7 +2,7 @@ _prolog = .text:0x00000000; // type:function size:0x2C scope:global
_epilog = .text:0x00000030; // type:function size:0x2C scope:global
_unresolved = .text:0x00000060; // type:function size:0x4 scope:global
dAcObambooIsland_c_classInit__Fv = .text:0x00000070; // type:function size:0x7C
interactCallback__18dAcObambooIsland_cFPvP9dAcBase_cP12dAcObjBase_c = .text:0x000000F0; // type:function size:0x7C
rideCallback__18dAcObambooIsland_cFP4dBgWP12dAcObjBase_cP12dAcObjBase_c = .text:0x000000F0; // type:function size:0x7C
createHeap__18dAcObambooIsland_cFv = .text:0x00000170; // type:function size:0x134
create__18dAcObambooIsland_cFv = .text:0x000002B0; // type:function size:0xE8
doDelete__18dAcObambooIsland_cFv = .text:0x000003A0; // type:function size:0x8
+160 -9
View File
@@ -893,7 +893,30 @@ libms/msgfile.c:
.data start:0x80547278 end:0x80547288
.sdata start:0x80574028 end:0x80574048
toBeSorted/cc/d_cc_d.cpp:
d/col/c/c_bg_s_chk.cpp:
.text start:0x80327140 end:0x8032721C
.data start:0x80547388 end:0x80547394
d/col/c/c_bg_s_gnd_chk.cpp:
.text start:0x80327220 end:0x8032734C
.data start:0x80547398 end:0x805473A4
d/col/c/c_bg_s_lin_chk.cpp:
.text start:0x80327350 end:0x80327504
.data start:0x805473A8 end:0x805473B8
d/col/c/c_bg_s_poly_info.cpp:
.text start:0x80327510 end:0x8032766C
d/col/c/c_bg_s_shdw_draw.cpp:
.text start:0x80327670 end:0x80328064
.data start:0x805473B8 end:0x805473C4
d/col/c/c_bg_w.cpp:
.text start:0x80328070 end:0x80328114
.data start:0x805473C8 end:0x805473D4
d/col/c/c_cc_d.cpp:
.text start:0x80328120 end:0x8032BC78
.ctors start:0x804DB8F8 end:0x804DB8FC
.rodata start:0x804F0AF0 end:0x804F0B80
@@ -901,20 +924,148 @@ toBeSorted/cc/d_cc_d.cpp:
.sdata2 start:0x8057CF98 end:0x8057CFBC
.bss start:0x805D0128 end:0x805D0134
toBeSorted/cc/d_cc_unknown.cpp:
.text start:0x8032BEC0 end:0x8032BF00
.data start:0x80547668 end:0x80547678
d/col/c/c_m2d.cpp:
.text start:0x8032BC80 end:0x8032BEB8
toBeSorted/cc/d_cc_m3d.cpp:
.text start:0x8032BF00 end:0x80337B58
d/col/c/c_m3d.cpp:
.text start:0x8032BEC0 end:0x80337B58
.data start:0x80547668 end:0x80547674
toBeSorted/cc/d_cc_m3d_g_cyl.cpp:
d/col/c/c_m3d_g_aab.cpp:
.text start:0x80337B60 end:0x80337E94
.sdata2 start:0x8057D030 end:0x8057D038
d/col/c/c_m3d_g_cps.cpp:
.text start:0x80337EA0 end:0x80338018
.sdata2 start:0x8057D038 end:0x8057D03C
d/col/c/c_m3d_g_cyl.cpp:
.text start:0x80338020 end:0x80338348
.sdata2 start:0x8057D040 end:0x8057D044
toBeSorted/cc/d_cc_m3d_g_sph.cpp:
d/col/c/c_m3d_g_lin.cpp:
.text start:0x80338350 end:0x8033842C
d/col/c/c_m3d_g_pla.cpp:
.text start:0x80338430 end:0x80338678
d/col/c/c_m3d_g_sph.cpp:
.text start:0x80338680 end:0x803388D8
.sdata2 start:0x8057D050 end:0x8057D058
toBeSorted/cc/d_cc_shape_colliders.cpp:
d/col/c/c_m3d_g_tri.cpp:
.text start:0x803388E0 end:0x80338940
d/col/c/c_m3d_g_unk.cpp:
.text start:0x80338940 end:0x80338F4C
.sdata2 start:0x8057D058 end:0x8057D060
d/col/c/c_partition.cpp:
.text start:0x80338F50 end:0x80339BAC
.ctors start:0x804DB8FC end:0x804DB900
.data start:0x80547688 end:0x80547694
d/col/bg/d_bg_pc.cpp:
.text start:0x80339BB0 end:0x80339BC8
d/col/bg/d_bg_plc.cpp:
.text start:0x80339BD0 end:0x80339BF8
d/col/bg/d_bg_s.cpp:
.text start:0x80339C00 end:0x8033F14C
.rodata start:0x804F0C00 end:0x804F0D00
.data start:0x80547698 end:0x805477C0
.sdata start:0x80574060 end:0x80574070
.sdata2 start:0x8057D068 end:0x8057D0FC
d/col/bg/d_bg_s_acch.cpp:
.text start:0x8033F150 end:0x803412F8
.data start:0x805477C0 end:0x80547868
.sdata2 start:0x8057D100 end:0x8057D13C
d/col/bg/d_bg_s_chk.cpp:
.text start:0x80341300 end:0x80341488
.data start:0x80547868 end:0x80547898
d/col/bg/d_bg_s_gnd_chk.cpp:
.text start:0x80341490 end:0x80341D68
.ctors start:0x804DB900 end:0x804DB904
.data start:0x80547898 end:0x80547994
.sbss start:0x80575CF8 end:0x80575CFC
.sdata2 start:0x8057D140 end:0x8057D144
.bss start:0x805D01C8 end:0x805D0268
d/col/bg/d_bg_s_grp_pass_chk.cpp:
.text start:0x80341D70 end:0x80341E18
.data start:0x80547998 end:0x805479A4
d/col/bg/d_bg_s_lin_chk.cpp:
.text start:0x80341E20 end:0x80342C98
.ctors start:0x804DB904 end:0x804DB908
.data start:0x805479A8 end:0x80547B88
.sdata2 start:0x8057D148 end:0x8057D150
.bss start:0x805D0268 end:0x805D03B8
d/col/bg/d_bg_s_poly_pass_chk.cpp:
.text start:0x80342CA0 end:0x80342D68
.data start:0x80547B88 end:0x80547B94
d/col/bg/d_bg_s_roof_chk.cpp:
.text start:0x80342D70 end:0x803431A8
.ctors start:0x804DB908 end:0x804DB90C
.data start:0x80547B98 end:0x80547C28
.sbss start:0x80575D00 end:0x80575D04
.sdata2 start:0x8057D150 end:0x8057D158
.bss start:0x805D03B8 end:0x805D0458
d/col/bg/d_bg_s_sph_chk.cpp:
.text start:0x803431B0 end:0x80343428
.data start:0x80547C28 end:0x80547C88
.sdata2 start:0x8057D158 end:0x8057D15C
d/col/bg/d_bg_s_spl_grp_chk.cpp:
.text start:0x80343430 end:0x803435C8
.data start:0x80547C88 end:0x80547CB8
.sdata2 start:0x8057D160 end:0x8057D16C
d/col/bg/d_bg_s_wtr_chk.cpp:
.text start:0x803435D0 end:0x80343818
.ctors start:0x804DB90C end:0x804DB910
.data start:0x80547CB8 end:0x80547CE8
.sbss start:0x80575D08 end:0x80575D0C
.bss start:0x805D0458 end:0x805D0500
d/col/bg/d_bg_w.cpp:
.text start:0x80343820 end:0x8034A94C
.ctors start:0x804DB910 end:0x804DB914
.data start:0x80547CE8 end:0x80547F10
.sbss start:0x80575D10 end:0x80575D20
.sdata2 start:0x8057D170 end:0x8057D1AC
.bss start:0x805D0500 end:0x805D0A50
d/col/bg/d_bg_w_base.cpp:
.text start:0x8034A950 end:0x8034AF48
.data start:0x80547F10 end:0x80548018
d/col/bg/d_bg_w_kcol.cpp:
.text start:0x8034AF50 end:0x80352138
.data start:0x80548018 end:0x80548120
.sdata start:0x80574070 end:0x80574088
.sdata2 start:0x8057D1B0 end:0x8057D228
.bss start:0x805D0A50 end:0x805D0F90
d/col/bg/d_bg_w_sv.cpp:
.text start:0x80352140 end:0x80352920
.data start:0x80548120 end:0x80548234
.sdata2 start:0x8057D228 end:0x8057D230
d/col/bg/d_bg_w_time.cpp:
.text start:0x80352920 end:0x80353B44
.data start:0x80548238 end:0x80548340
.sdata2 start:0x8057D230 end:0x8057D240
.bss start:0x805D0F90 end:0x805D0FB4
d/col/cc/d_cc_shape_colliders.cpp:
.text start:0x80353B50 end:0x80354298
.data start:0x80548340 end:0x80548580
+848 -847
View File
File diff suppressed because it is too large Load Diff
+47 -5
View File
@@ -363,11 +363,6 @@ config.libs = [
Object(Matching, "toBeSorted/counters/slingshot_seed_counter.cpp"),
Object(Matching, "toBeSorted/counters/key_piece_counter.cpp"),
Object(Matching, "toBeSorted/counters/extra_wallet_counter.cpp"),
Object(NonMatching, "toBeSorted/cc/d_cc_d.cpp"),
Object(NonMatching, "toBeSorted/cc/d_cc_m3d.cpp"),
Object(NonMatching, "toBeSorted/cc/d_cc_m3d_g_cyl.cpp"),
Object(NonMatching, "toBeSorted/cc/d_cc_m3d_g_sph.cpp"),
Object(Matching, "toBeSorted/cc/d_cc_shape_colliders.cpp"),
Object(NonMatching, "d/lyt/d_structd.cpp"),
Object(NonMatching, "d/lyt/d2d.cpp"),
Object(NonMatching, "d/lyt/d_textbox.cpp"),
@@ -387,6 +382,53 @@ config.libs = [
Object(Matching, "DynamicLink.cpp"),
],
},
{
"lib": "collision",
"mw_version": "Wii/1.5",
"cflags": cflags_framework + ["-str reuse,readonly"],
"progress_category": "game",
"host": False,
"objects": [
Object(Matching, "d/col/c/c_bg_s_chk.cpp"),
Object(Matching, "d/col/c/c_bg_s_gnd_chk.cpp"),
Object(Matching, "d/col/c/c_bg_s_lin_chk.cpp"),
Object(Matching, "d/col/c/c_bg_s_poly_info.cpp"),
Object(NonMatching, "d/col/c/c_bg_s_shdw_draw.cpp"),
Object(Matching, "d/col/c/c_bg_w.cpp"),
Object(NonMatching, "d/col/c/c_cc_d.cpp"),
Object(NonMatching, "d/col/c/c_m2d.cpp"),
Object(NonMatching, "d/col/c/c_m3d.cpp"),
Object(Matching, "d/col/c/c_m3d_g_aab.cpp"),
Object(NonMatching, "d/col/c/c_m3d_g_cir.cpp"),
Object(Matching, "d/col/c/c_m3d_g_cps.cpp"),
Object(Matching, "d/col/c/c_m3d_g_cyl.cpp"),
Object(Matching, "d/col/c/c_m3d_g_lin.cpp"),
Object(NonMatching, "d/col/c/c_m3d_g_pla.cpp"),
Object(Matching, "d/col/c/c_m3d_g_sph.cpp"),
Object(Matching, "d/col/c/c_m3d_g_tri.cpp"),
Object(Matching, "d/col/c/c_m3d_g_unk.cpp"),
Object(NonMatching, "d/col/c/c_partition.cpp"),
Object(Matching, "d/col/bg/d_bg_pc.cpp"),
Object(Matching, "d/col/bg/d_bg_plc.cpp"),
Object(NonMatching, "d/col/bg/d_bg_s.cpp"),
Object(NonMatching, "d/col/bg/d_bg_s_acch.cpp"),
Object(Matching, "d/col/bg/d_bg_s_chk.cpp"),
Object(Matching, "d/col/bg/d_bg_s_gnd_chk.cpp"),
Object(Matching, "d/col/bg/d_bg_s_grp_pass_chk.cpp"),
Object(Matching, "d/col/bg/d_bg_s_lin_chk.cpp"),
Object(Matching, "d/col/bg/d_bg_s_poly_pass_chk.cpp"),
Object(Matching, "d/col/bg/d_bg_s_roof_chk.cpp"),
Object(Matching, "d/col/bg/d_bg_s_sph_chk.cpp"),
Object(Matching, "d/col/bg/d_bg_s_spl_grp_chk.cpp"),
Object(Matching, "d/col/bg/d_bg_s_wtr_chk.cpp"),
Object(NonMatching, "d/col/bg/d_bg_w.cpp"),
Object(Matching, "d/col/bg/d_bg_w_base.cpp"),
Object(NonMatching, "d/col/bg/d_bg_w_kcol.cpp"),
Object(Matching, "d/col/bg/d_bg_w_sv.cpp"),
Object(NonMatching, "d/col/bg/d_bg_w_time.cpp"),
Object(Matching, "d/col/cc/d_cc_shape_colliders.cpp"),
],
},
{
"lib": "clib",
"mw_version": "Wii/1.6",
+37 -19
View File
@@ -22,8 +22,7 @@ struct SoundInfo {
dAcBase_c *actor;
SoundSource *sound_source;
mVec3_c *obj_pos;
SoundInfo *next;
SoundInfo *prev;
TListNode<SoundInfo> mLink;
};
/**
@@ -59,6 +58,9 @@ public:
T *get() {
return static_cast<T *>(p_owner);
}
const T *get() const {
return static_cast<const T *>(p_owner);
}
};
// Ghidra: ActorBase
@@ -68,7 +70,7 @@ class dAcBase_c : public dBase_c {
public:
/* 0x68 */ mHeapAllocator_c heap_allocator;
/* 0x84 */ ObjInfo *obj_info;
/* 0x88 */ TList<SoundInfo, 0xC> sound_list;
/* 0x88 */ TList<SoundInfo, offsetof(SoundInfo, mLink)> sound_list;
/* 0x94 */ SoundSource *sound_source;
/* 0x98 */ mVec3_c *obj_pos;
/* 0x9C */ mVec3_c pos_copy;
@@ -80,7 +82,7 @@ public:
/* 0xB6 */ u8 subtype;
/* 0xB8 */ mAng3_c rotation;
/* 0xC0 */ mVec3_c position;
/* 0xCC */ mVec3_c scale;
/* 0xCC */ mVec3_c mScale;
/* 0xD8 */ u32 actor_properties;
/* 0xDC */ dAcRef_c<dAcBase_c> actor_node;
/* 0xE8 */ u32 field_0xe8;
@@ -118,7 +120,7 @@ public:
position = r;
}
void SetScale(const mVec3_c &r) {
scale = r;
mScale = r;
}
void SetRotation(const mAng3_c &r) {
rotation = r;
@@ -127,13 +129,17 @@ public:
void copyPosition() {
pos_copy = position;
}
const mVec3_c &GetPostion() const {
return position;
}
void copyRotation() {
rot_copy = rotation;
}
mVec3_c &GetPostion() {
return position;
}
mAng3_c &GetRotation() {
return rotation;
}
mVec3_c GetPostionDifference(const dAcBase_c &other) {
return position - other.position;
}
@@ -151,10 +157,16 @@ public:
return roomid;
}
bool ChkProperty_0x40000000() const {
return actor_properties & 0x40000000;
}
public:
// funcs found in TU
/* 8002c650 */ static void setTempCreateParams(mVec3_c *pos, mAng3_c *rot, mVec3_c *scale, s32 roomId, u32 params2,
dAcBase_c *parent, u8 subtype, s16 unkFlag, u8 viewClipIdx, ObjInfo *objInfo);
/* 8002c650 */ static void setTempCreateParams(
mVec3_c *pos, mAng3_c *rot, mVec3_c *scale, s32 roomId, u32 params2, dAcBase_c *parent, u8 subtype, s16 unkFlag,
u8 viewClipIdx, ObjInfo *objInfo
);
/* 8002c690 */ SoundSource *FUN_8002c690();
/* 8002c710 */ int initAllocatorWork1Heap(int size, char *name, int align);
@@ -177,11 +189,13 @@ public:
// returns true if under the distThresh, False if not. the actual distance is returned in outDist
/* 8002d1d0 */ bool getDistanceToActor(dAcBase_c *actor, f32 distThresh, f32 *outDist);
// same concept as above
/* 8002d290 */ bool getDistanceAndAngleToActor(dAcBase_c *actor, f32 distThresh, s16 yAngle, s16 xAngle,
f32 *outDist, s16 *outDiffAngleY, s16 *outDiffAngleX);
/* 8002d290 */ bool getDistanceAndAngleToActor(
dAcBase_c *actor, f32 distThresh, s16 yAngle, s16 xAngle, f32 *outDist, s16 *outDiffAngleY, s16 *outDiffAngleX
);
/* 8002d3e0 */ bool isWithinPlayerRadius(f32 radius) const;
/* 8002d440 */ bool getDistanceAndAngleToPlayer(f32 distThresh, s16 yAngle, s16 xAngle, f32 *outDist,
s16 *outDiffAngleY, s16 *outDiffAngleX);
/* 8002d440 */ bool getDistanceAndAngleToPlayer(
f32 distThresh, s16 yAngle, s16 xAngle, f32 *outDist, s16 *outDiffAngleY, s16 *outDiffAngleX
);
/* 8002d470 */ f32 getDistToPlayer();
/* 8002d4a0 */ f32 getSquareDistToPlayer();
/* 8002d4b0 */ void updateRoomId(f32 yOffs);
@@ -213,11 +227,15 @@ public:
/* 8002d940 */ void changeLoadedEntitiesWithSet();
/* 8002d960 */ void changeLoadedEntitiesNoSet();
/* 8002d980 */ dAcBase_c *createActor(ProfileName actorId, u32 params1, mVec3_c *pos, mAng3_c *rot, mVec3_c *scale,
u32 params2, s32 roomId, dBase_c *ref);
/* 8002d980 */ dAcBase_c *createActor(
ProfileName actorId, u32 params1, mVec3_c *pos, mAng3_c *rot, mVec3_c *scale, u32 params2, s32 roomId,
dBase_c *ref
);
/* 8002da80 */ dAcBase_c *createActorStage(ProfileName actorId, u32 params1, mVec3_c *pos, mAng3_c *rot,
mVec3_c *scale, u32 params2, s32 roomId, dBase_c *ref);
/* 8002da80 */ dAcBase_c *createActorStage(
ProfileName actorId, u32 params1, mVec3_c *pos, mAng3_c *rot, mVec3_c *scale, u32 params2, s32 roomId,
dBase_c *ref
);
/* 8002dc20 */ void FUN_8002dc20(s16 *, s16 *);
/* 8002dc50 */ void incrementKillCounter();
+50
View File
@@ -0,0 +1,50 @@
#ifndef D_A_BOMB_H
#define D_A_BOMB_H
#include "d/a/obj/d_a_obj_base.h"
#include <d/col/bg/d_bg_s_acch.h>
#include <d/col/bg/d_bg_s_lin_chk.h>
#include <d/col/cc/d_cc_shape_colliders.h>
#include <m/m3d/m_smdl.h>
#include <s/s_State.hpp>
#include <s/s_StateMgr.hpp>
#include <toBeSorted/effects_struct.h>
class dAcBomb_c : public dAcObjBase_c {
public:
dAcBomb_c();
virtual ~dAcBomb_c();
/* vt 0x08 */ virtual int create() override;
/* vt 0x14 */ virtual int doDelete() override;
/* vt 0x2C */ virtual int draw() override;
/* vt 0x44 */ virtual bool createHeap() override;
/* vt 0x54 */ virtual int actorExecute() override;
/* vt 0x5C */ virtual void unkVirtFunc_0x5C() override;
/* vt 0x68 */ virtual void *getCurrentEventActor() override;
/* vt 0x6C */ virtual void unkVirtFunc_0x6C() override;
STATE_FUNC_DECLARE(dAcBomb_c, Wait);
STATE_FUNC_DECLARE(dAcBomb_c, FlowerWait);
STATE_FUNC_DECLARE(dAcBomb_c, Explode);
STATE_FUNC_DECLARE(dAcBomb_c, Carry);
STATE_FUNC_DECLARE(dAcBomb_c, WindCarry);
private:
/* 0x330 */ nw4r::g3d::ResFile mBrres;
/* 0x334 */ m3d::smdl_c mMdl;
/* 0x350 */ u8 _0[0x358 - 0x350];
/* 0x358 */ dBgS_BombAcch mAcch;
/* 0x708 */ dBgS_AcchCir mAcchCir;
/* 0x764 */ dCcD_Sph mCcDSph;
/* 0x8B4 */ mMtx_c mMtx;
/* 0x8E4 */ dBgS_BombLinChk mLinChk;
/* 0x97C */ u8 _1[0x9D4 - 0x97C];
/* 0x9D4 */ EffectsStruct mEffect1;
/* 0xA08 */ EffectsStruct mEffect2;
/* 0xA3C */ u8 _2[0xA9C - 0xA3C];
/* 0xA9C */ STATE_MGR_DECLARE(dAcBomb_c);
};
#endif
+46
View File
@@ -1,7 +1,49 @@
#include <d/a/obj/d_a_obj_base.h>
class dAcPy_c : public dAcObjBase_c {
// See Below for some info
// https://github.com/lepelog/skywardsword-tools/wiki/Player-Actor
public:
// These Flags are named under general guesses. Very likely may need some changes
// Correspond to mActionFlags
enum dAcPy_FLG0 {
FLG0_ON_FOOT = 0x80000000,
FLG0_USE_ITEM_0 = 0x40000000,
FLG0_USE_ITEM_1 = 0x20000000,
FLG0_UNK_GEN_MOVE = 0x10000000,
FLG0_ATTACK_MOVE = 0x8000000,
FLG0_USE_ITEM_2 = 0x4000000,
FLG0_RECOVER_ELEC = 0x2000000,
FLG0_CRAWLING = 0x1000000,
FLG0_TIGHT_ROPE = 0x800000,
FLG0_SWING_ROPE = 0x400000,
FLG0_PUSHPULL = 0x200000,
FLG0_UNK_100000 = 0x100000,
FLG0_UNK_80000 = 0x80000,
FLG0_IN_WATER = 0x40000,
FLG0_ON_LADDDER = 0x20000,
FLG0_ON_VINES = 0x10000,
FLG0_UNK_0x8000 = 0x8000,
FLG0_UNK_0x4000 = 0x4000,
FLG0_INTERATION = 0x2000,
FLG0_BASIC_ACTION = 0x1000,
FLG0_HANGING_ITEM = 0x800,
FLG0_EXTERN_CONTROL = 0x400,
FLG0_ATTACK_RELATED = 0x200,
FLG0_UNK_0x100 = 0x100,
FLG0_UNK_0x80 = 0x80,
FLG0_HANGING_LEDGE = 0x40,
FLG0_UNK_0x20 = 0x20,
FLG0_UNK_0x10 = 0x10,
FLG0_DAMAGED = 0x8,
FLG0_UNK_0x4 = 0x4,
FLG0_IN_AIR = 0x2,
FLG0_STATIONARY = 0x1,
FLG0_FLY = FLG0_TIGHT_ROPE | FLG0_SWING_ROPE | FLG0_IN_WATER | FLG0_ON_LADDDER | FLG0_ON_VINES |
FLG0_HANGING_ITEM | FLG0_HANGING_LEDGE | FLG0_UNK_0x10 | FLG0_IN_AIR,
};
dAcPy_c();
virtual ~dAcPy_c();
@@ -190,5 +232,9 @@ public:
return (someFlags_0x350 & mask) != 0;
}
bool CheckPlayerFly() const {
return mActionFlags & FLG0_FLY;
}
static dAcPy_c *LINK;
};
+2 -2
View File
@@ -24,13 +24,13 @@ public:
bool attachObject(dAcObjBase_c *obj);
f32 getAttachRadius() {
return scale.x * scaleX;
return mScale.x * scaleX;
}
f32 getAttachRadiusSquare() {
return getAttachRadius() * getAttachRadius();
}
f32 getAttachHeight() {
return scale.y * scaleY;
return mScale.y * scaleY;
}
static const f32 scaleX;
+2 -2
View File
@@ -2,12 +2,12 @@
#define D_A_OBJ_APPEAR_BRIDGE_H
#include <d/a/obj/d_a_obj_base.h>
#include <d/col/bg/d_bg_w.h>
#include <m/m3d/m_anmmatclr.h>
#include <m/m3d/m_anmtexsrt.h>
#include <m/m3d/m_smdl.h>
#include <s/s_State.hpp>
#include <s/s_StateMgr.hpp>
#include <toBeSorted/actor_collision.h>
#include <toBeSorted/actor_event.h>
#include <toBeSorted/stage_render_stuff.h>
@@ -32,7 +32,7 @@ private:
m3d::smdl_c mModel;
m3d::anmTexSrt_c mSrtAnm;
m3d::anmMatClr_c mClrAnm;
ActorCollision mCollision;
dBgW mCollision;
STATE_MGR_DECLARE(dAcOappearBridge_c);
ActorEventRelated mActorEvent;
+3 -3
View File
@@ -2,8 +2,8 @@
#define D_A_OBJ_BAMBOO_ISLAND_H
#include <d/a/obj/d_a_obj_base.h>
#include <d/col/bg/d_bg_w.h>
#include <m/m3d/m_smdl.h>
#include <toBeSorted/actor_collision.h>
class dAcObambooIsland_c : public dAcObjBase_c {
public:
@@ -19,11 +19,11 @@ private:
static const f32 unusedFloat1;
static const f32 unusedFloat2;
static void interactCallback(void *unknown, dAcBase_c *actor, dAcObjBase_c *interactor);
static void rideCallback(dBgW *unknown, dAcObjBase_c *actor, dAcObjBase_c *interactor);
m3d::smdl_c mModels[2];
nw4r::g3d::ResFile mBrres;
ActorCollision mCollision;
dBgW mCollision;
};
#endif
+89 -46
View File
@@ -2,14 +2,14 @@
#define D_A_OBJ_BASE_H
#include "d/a/d_a_base.h"
#include "d/col/cc/d_cc_d.h"
#include "m/m3d/m_shadow.h"
#include "m/m3d/m_smdl.h"
#include "m/m_angle.h"
#include "m/m_mtx.h"
#include "m/m3d/m_smdl.h"
#include "m/m3d/m_shadow.h"
#include "m/m_vec.h"
#include "m/types_m.h"
#include "nw4r/g3d/g3d_resfile.h"
#include "toBeSorted/cc/d_cc_d.h"
// Size: 0xA8
struct ActorCarryStruct {
@@ -33,45 +33,61 @@ struct ActorCarryStruct {
}
};
// Ghidra has it as `unk_ActorObjectBase`
struct LightingInfo {
/* 0x00 */ u8 mField_0x00[0x60 - 0x00];
/* 0x60 */ u8 mLightingCode;
/* 0x61 */ u8 mField_0x61[0x70 - 0x61];
};
// Ghidra: ActorObjectBase
// size: 0x330
// vtable: 0x805015b8
// non-official name
class dAcObjBase_c : public dAcBase_c {
public:
// Data Members
f32 yoffset;
char _0[4];
f32 unkfloat;
char _1[12];
u16 targetFiTextId;
u8 unkByteTargetFiRelated;
mVec3_c poscopy1;
mVec3_c poscopy2;
mVec3_c poscopy3;
mAng3_c rotcopy1;
f32 forwardSpeed;
f32 forwardAccel;
f32 forwardMaxSpeed;
mVec3_c velocity;
/* 0x15C */ mMtx_c worldMatrix;
nw4r::math::AABB boundingBox;
/* 0x0FC */ f32 yoffset;
/* 0x100 */ char _0[4];
/* 0x104 */ f32 unkfloat;
/* 0x108 */ char _1[12];
/* 0x114 */ u16 targetFiTextId;
/* 0x116 */ u8 unkByteTargetFiRelated;
/* 0x118 */ mVec3_c mOldPosition;
/* 0x124 */ mVec3_c poscopy2;
/* 0x130 */ mVec3_c poscopy3;
/* 0x13C */ mAng3_c angle;
/* 0x144 */ f32 forwardSpeed;
/* 0x148 */ f32 forwardAccel;
/* 0x14C */ f32 forwardMaxSpeed;
/* 0x150 */ mVec3_c velocity;
/* 0x15C */ mMtx_c mWorldMtx;
/* 0x18C */ nw4r::math::AABB boundingBox;
/* 0x1A4 */ f32 mCullingDistance;
/* 0x1A8 */ f32 field_0x1A8;
/* 0x1AC */ u32 mObjectActorFlags;
u8 unk_0x1B0[0x1C0 - 0x1B0];
/* 0x1B0 */ u8 unk_0x1B0[0x1C0 - 0x1B0];
/* 0x1C0 */ UnkCCDStruct mCCdStruct;
mVec3_c mStartingPos;
mAng3_c mStartingRot;
/* 0x1FC */ mVec3_c mStartingPos;
/* 0x208 */ mAng3_c mStartingRot;
/* 0x210 */ ActorCarryStruct mActorCarryInfo;
u8 unk_0x1EC[0x330 - 0x2B8];
/* 0x2B8 */ u32 mField_0x2B8;
/* 0x2BC */ LightingInfo mLightingInfo;
/* 0x32C */ u32 mField_0x32C;
public:
mVec3_c &GetOldPosition() {
return mOldPosition;
}
mVec3_c &GetVelocity() {
return velocity;
}
mAng3_c &GetAngle() {
return angle;
}
// could be their own thing?
/* 8002de40 */ static void *getOarcFile(const char *oarcName, const char *fileName);
/* 8002de60 */ static void *getOarcSubEntry(const char *oarcName, const char *fileName);
@@ -94,12 +110,16 @@ public:
/* 8002ea20 */ virtual bool drop();
public:
/* 8002e630 */ static dAcObjBase_c *create(fProfile::PROFILE_NAME_e actorId, s8 roomId, u32 params1, mVec3_c *pos,
mAng3_c *rot, mVec3_c *scale, u32 params2);
/* 8002e6d0 */ static dAcObjBase_c *create(char *name, u32 roomId, u32 params1, mVec3_c *pos, mAng3_c *rot,
mVec3_c *scale, u32 params2, u16 id, s8 viewclipId);
/* 8002e770 */ static dAcObjBase_c *findObject(fProfile::PROFILE_NAME_e actorId, fLiNdBa_c *refList,
dAcObjBase_c *parent);
/* 8002e630 */ static dAcObjBase_c *create(
fProfile::PROFILE_NAME_e actorId, s8 roomId, u32 params1, mVec3_c *pos, mAng3_c *rot, mVec3_c *scale,
u32 params2
);
/* 8002e6d0 */ static dAcObjBase_c *create(
char *name, u32 roomId, u32 params1, mVec3_c *pos, mAng3_c *rot, mVec3_c *scale, u32 params2, u16 id,
s8 viewclipId
);
/* 8002e770 */ static dAcObjBase_c *
findObject(fProfile::PROFILE_NAME_e actorId, fLiNdBa_c *refList, dAcObjBase_c *parent);
/* 8002e7f0 */ static dAcObjBase_c *getNextObject(fLiNdBa_c *ref, dAcObjBase_c *parent);
/* 8002e850 */ bool isPlayer();
/* 8002e870 */ void calcVelocity(mVec3_c &pos, f32 speed);
@@ -115,23 +135,36 @@ public:
// Disabling make Lava and other objects Disappear
/* 8002ecd0 */ void drawModel2();
/* 8002ed20 */ void fn_8002ed20();
/* 8002edb0 */ void fn_8002edb0(m3d::mShadowCircle_c& shadow, m3d::smdl_c& smdl, const mQuat_c *rot, s32, s32, f32);
/* 8002ee40 */ void drawShadow(m3d::mShadowCircle_c& shadow, void*, const mMtx_c &mtx, const mQuat_c *rot, s32, s32, s32, s32, s32, f32);
/* 8002ef40 */ void createChildAttached(fProfile::PROFILE_NAME_e actorId, u32 params1, mVec3_c *pos, mAng3_c *rot,
mVec3_c *scale, u32 params2, u32 roomId);
/* 8002ef40 */ void createChildNonAttached(fProfile::PROFILE_NAME_e actorId, u32 params1, mVec3_c *pos,
mAng3_c *rot, mVec3_c *scale, u32 params2, u32 roomId);
/* 8002edb0 */ void fn_8002edb0(m3d::mShadowCircle_c &shadow, m3d::smdl_c &smdl, const mQuat_c *rot, s32, s32, f32);
/* 8002ee40 */ void drawShadow(
m3d::mShadowCircle_c &shadow, void *, const mMtx_c &mtx, const mQuat_c *rot, s32, s32, s32, s32, s32, f32
);
/* 8002ef40 */ void createChildAttached(
fProfile::PROFILE_NAME_e actorId, u32 params1, mVec3_c *pos, mAng3_c *rot, mVec3_c *scale, u32 params2,
u32 roomId
);
/* 8002ef40 */ void createChildNonAttached(
fProfile::PROFILE_NAME_e actorId, u32 params1, mVec3_c *pos, mAng3_c *rot, mVec3_c *scale, u32 params2,
u32 roomId
);
/* 8002efa0 */ void fn_8002efa0();
/* 8002eff0 */ bool fn_8002eff0(f32 *, s16 *, UnkCollider *, f32 *, f32 *);
/* 8002f190 */ void createChildAttached2(fProfile::PROFILE_NAME_e actorId, u32 params1, mVec3_c *pos, mAng3_c *rot,
mVec3_c *scale, u32 params2, u32 roomId);
/* 8002f190 */ void createChildAttached2(
fProfile::PROFILE_NAME_e actorId, u32 params1, mVec3_c *pos, mAng3_c *rot, mVec3_c *scale, u32 params2,
u32 roomId
);
// These may not belong here
/* 8002f1c0 */ static dAcBase_c *createActorUnkGroup3(fProfile::PROFILE_NAME_e actorId, u32 roomId, u32 params1,
mVec3_c *pos, mAng3_c *rot, mVec3_c *scale, u32 params2);
/* 8002f260 */ static dAcBase_c *createActorUnkGroup3(char *name, u32 roomId, u32 params1, mVec3_c *pos,
mAng3_c *rot, mVec3_c *scale, u32 params2, u16 id, u8 viewclipId);
/* 8002f1c0 */ static dAcBase_c *createActorUnkGroup3(
fProfile::PROFILE_NAME_e actorId, u32 roomId, u32 params1, mVec3_c *pos, mAng3_c *rot, mVec3_c *scale,
u32 params2
);
/* 8002f260 */ static dAcBase_c *createActorUnkGroup3(
char *name, u32 roomId, u32 params1, mVec3_c *pos, mAng3_c *rot, mVec3_c *scale, u32 params2, u16 id,
u8 viewclipId
);
protected:
// TODO May be cM3dGAab (has a very similar set func)
inline void setBoundingBox(mVec3_c min, mVec3_c max) {
boundingBox.min = min;
boundingBox.max = max;
@@ -139,8 +172,18 @@ protected:
};
// Actors' createHeap functions often have patterns that can be matched with this macro
#define TRY_CREATE(thing) do { bool result = (thing); if (!result) return result; } while (0)
#define TRY_CREATE(thing) \
do { \
bool result = (thing); \
if (!result) \
return result; \
} while (0)
// Use this in actors' createHeap functions
#define CREATE_ALLOCATOR(className) do { if (!initAllocatorWork1Heap(-1, #className "::m_allocator", 0x20)) { return FAILED; } } while (0)
#define CREATE_ALLOCATOR(className) \
do { \
if (!initAllocatorWork1Heap(-1, #className "::m_allocator", 0x20)) { \
return FAILED; \
} \
} while (0)
#endif
+1 -2
View File
@@ -2,13 +2,12 @@
#define D_A_O_SPIKE_H
#include <d/a/obj/d_a_obj_base.h>
#include <d/col/cc/d_cc_shape_colliders.h>
#include <m/m3d/m_smdl.h>
#include <m/m_vec.h>
#include <nw4r/g3d/g3d_resfile.h>
#include <s/s_State.hpp>
#include <s/s_StateID.hpp>
#include <toBeSorted/cc/d_cc_shape_colliders.h>
class dAcOspike_c : public dAcObjBase_c {
public:
+4 -5
View File
@@ -2,13 +2,12 @@
#define D_A_OBJ_SWITCH_H
#include <d/a/obj/d_a_obj_base.h>
#include <d/col/bg/d_bg_w.h>
#include <m/m3d/m_mdl.h>
#include <s/s_State.hpp>
#include <s/s_StateMgr.hpp>
#include <toBeSorted/actor_collision.h>
#include <toBeSorted/time_area_mgr.h>
// OBJ_VSD?
class dAcOScatterSand_tmp : public dAcObjBase_c {
public:
@@ -18,7 +17,7 @@ public:
/* 0x6E4 */ bool field_0x6E4;
inline f32 getSomeScale() {
return scale.y * 41.65f / 100.0f;
return mScale.y * 41.65f / 100.0f;
}
};
@@ -62,11 +61,11 @@ public:
STATE_FUNC_DECLARE(dAcOsw_c, Off);
STATE_FUNC_DECLARE(dAcOsw_c, None);
static void interactCallback(void *unknown, dAcBase_c *actor, dAcObjBase_c *interactor);
static void rideCallback(dBgW *unknown, dAcObjBase_c *actor, dAcObjBase_c *interactor);
private:
/* 0x330 */ m3d::mdl_c mModel;
/* 0x354 */ ActorCollision mCollision;
/* 0x354 */ dBgW mCollision;
/* 0x564 */ STATE_MGR_DECLARE(dAcOsw_c);
/* 0x5A0 */ TimeAreaStruct field_0x5A0;
/* 0x5AC */ dAcRef_c<dAcOScatterSand_tmp> mObjRef;
+1 -2
View File
@@ -3,12 +3,11 @@
#include <c/c_math.h>
#include <d/a/obj/d_a_obj_base.h>
#include <d/col/cc/d_cc_shape_colliders.h>
#include <m/m3d/m_smdl.h>
#include <nw4r/g3d/g3d_resfile.h>
#include <s/s_State.hpp>
#include <s/s_StateMgr.hpp>
#include <toBeSorted/cc/d_cc_shape_colliders.h>
class dAcOtoD3StoneFigure_c : public dAcObjBase_c {
public:
+1 -1
View File
@@ -3,11 +3,11 @@
#include <c/c_math.h>
#include <d/a/obj/d_a_obj_base.h>
#include <d/col/cc/d_cc_shape_colliders.h>
#include <m/m3d/m_anmtexsrt.h>
#include <m/m3d/m_smdl.h>
#include <m/m_angle.h>
#include <nw4r/g3d/g3d_resfile.h>
#include <toBeSorted/cc/d_cc_shape_colliders.h>
#include <toBeSorted/effects_struct.h>
class dAcOtriforce_c : public dAcObjBase_c {
+156
View File
@@ -0,0 +1,156 @@
#ifndef D_BG_PC_H
#define D_BG_PC_H
#include <common.h>
struct sBgPc { // Size: 0x14
/* 0x00 */ u32 code0;
/* 0x04 */ u32 code1;
/* 0x08 */ u32 code2; // Always 0xFFFF_FF00
/* 0x0C */ u32 code3; // Only 0x0000_03FF used
/* 0x10 */ u32 code4; // Always 0x0000_0000
};
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_SLINGSHOT_THRU = 0x40000,
/* 0x00080000 */ CODE_BEETLE_THRU = 0x80000,
/* 0x00100000 */ CODE_CLAWSHOT_THRU = 0x100000,
/* 0x00200000 */ CODE_TARGET_THRU = 0x200000,
/* 0x00400000 */ CODE_SHDW_THRU = 0x400000,
/* 0x00800000 */ CODE_BOMB_THRU = 0x800000,
/* 0x01000000 */ CODE_WHIP_THRU = 0x1000000,
/* 0x40000000 */ CODE_UNDERWATER_ROOF = 0x40000000,
/* 0x80000000 */ CODE_UNUSED_8000_0000 = 0x80000000,
};
class dBgPc {
public:
void setCode(sBgPc &);
bool getWtr() const;
u32 getObjThrough() {
return m_code.code0 & CODE_OBJ_THRU;
}
u32 getCamThrough() {
return m_code.code0 & CODE_CAM_THRU;
}
u32 getLinkThrough() {
return m_code.code0 & CODE_LINK_THRU;
}
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 getClawshotThrough() const {
return m_code.code0 & CODE_CLAWSHOT_THRU;
}
u32 getSlingshotThrough() const {
return m_code.code0 & CODE_SLINGSHOT_THRU;
}
u32 getBeetleThrough() const {
return m_code.code0 & CODE_BEETLE_THRU;
}
bool getTargetThrough() const {
return m_code.code0 & CODE_TARGET_THRU;
}
bool getShdwThrough() const {
return m_code.code0 & CODE_SHDW_THRU;
}
u32 getBombThrough() const {
return m_code.code0 & CODE_BOMB_THRU;
}
u32 getWhipThrough() const {
return m_code.code0 & CODE_WHIP_THRU;
}
u32 getUnderwaterRoof() const {
return m_code.code0 & CODE_UNDERWATER_ROOF;
}
bool getCode0_0x80000000() const {
return m_code.code0 & CODE_UNUSED_8000_0000;
}
s32 getWallCode() const {
return m_code.code1 >> 0x8 & 0xF;
}
u32 getCode1_0x02000000() const {
return m_code.code1 & 0x02000000;
}
u32 getCode1_0x04000000() const {
return m_code.code1 & 0x04000000;
}
u32 getCode1_0x08000000() const {
return m_code.code1 & 0x08000000;
}
u32 getGroundCode() const {
return m_code.code1 >> 20 & 0x1F;
}
u32 getLightingCode() const {
return m_code.code1 >> 28;
}
u32 getSpecialCode() const {
return m_code.code3 & 0x1F;
}
u32 getAtt0Code() const {
return m_code.code3 >> 5 & 0x3F;
}
u32 getAtt1Code() const {
return m_code.code1 >> 17 & 0x7;
}
u8 getGrpRoomIdx() const {
return m_code.code0 & 0x3F;
}
u8 getExitId() const {
return m_code.code0 >> 6;
}
u32 getCode0_0x30000000() const {
return m_code.code0 >> 0x1C & 3;
}
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;
}
/* 0x0 */ sBgPc m_code;
};
#endif
+38
View File
@@ -0,0 +1,38 @@
#ifndef D_BG_PLC_H
#define D_BG_PLC_H
#include "d/col/bg/d_bg_pc.h"
enum {
ZELDA_CODE_SIZE = 0x14
};
struct PLC {
/* 0x0 */ u32 magic;
/* 0x4 */ u16 m_code_size;
/* 0x6 */ u16 m_num;
/* 0x8 */ sBgPc field_0x8[0];
};
class dBgPlc {
public:
dBgPlc() : mBase(nullptr) {}
void setBase(void *);
const sBgPc *getCode(int idx) const {
sBgPc *rv = mBase->field_0x8;
rv += idx;
return rv;
}
const dBgPc *GetDBgPc(int idx) const {
return (const dBgPc *)getCode(idx);
}
u32 getGrpCode(int idx) const;
private:
/* 0x00 */ PLC *mBase;
};
#endif
+281
View File
@@ -0,0 +1,281 @@
#ifndef D_BG_S_H
#define D_BG_S_H
#include "common.h"
#include "d/a/d_a_base.h"
#include "d/a/obj/d_a_obj_base.h"
#include "d/a/obj/d_a_obj_bg.h"
#include "d/col/bg/d_bg_w.h"
#include "d/col/bg/d_bg_w_base.h"
#include "d/col/bg/d_bg_w_kcol.h"
#include "egg/gfx/eggCpuTexture.h"
#include "toBeSorted/tlist.h"
class dBgW;
class cBgS_ChkElm {
public:
/* 0x00 */ dBgW_Base *mpBgW;
/* 0x04 */ dAcRef_c<dAcObjBase_c> mObj;
/* 0x10 vtable */
public:
cBgS_ChkElm();
virtual ~cBgS_ChkElm();
void Init();
void Release();
void Regist2(dBgW_Base *, dAcObjBase_c *);
bool ChkUsed() const {
if (mpBgW == nullptr) {
return false;
}
const dAcObjBase_c *pObj = mObj.get();
return !(pObj && pObj->ChkProperty_0x40000000());
}
// ??? Template seems bad
template <class T>
bool CheckAll(const T *other) const {
bool check = ChkUsed();
if (check) {
const cPartition &part = mpBgW->GetPartition();
if ((part.mX & other->mPartition.mX) && (part.mZ & other->mPartition.mZ) &&
(part.mY & other->mPartition.mY)) {
check = true;
} else {
check = false;
}
}
if (check) {
check = !other->ChkSameActorPid(mObj.get());
}
if (check) {
check = !(other->mField_0x0C & mpBgW->GetField_0x20());
}
if (check) {
check = (other->mField_0x0E & mpBgW->GetField_0x22());
}
return check;
}
};
class cBgS {
public:
/* 0x0000 */ cBgS_ChkElm mChkElem[BG_ID_MAX];
/* 0x2EE0 */ s32 mSetCounter;
/* 0x2EE4 vtable */
virtual ~cBgS();
virtual void Ct();
virtual void Dt();
/* 0x2EE8 */ dBgWKCol *mpBgKCol;
/* 0x2EEC */ dAcRef_c<dAcObg_c> mAcOBg;
public:
cBgS();
static void fn_80339de0(dBgW_Base *);
bool Regist(dBgW_Base *, dAcObjBase_c *);
bool Release(dBgW_Base *);
static void ConvDzb(void *);
bool LineCross(cBgS_LinChk *);
f32 GroundCross(cBgS_GndChk *);
void ShdwDraw(cBgS_ShdwDraw *);
void fn_8033a1e0();
bool RegistKCol(dBgWKCol *, dAcObg_c *);
bool ReleaseKCol(dBgWKCol *);
const dAcObjBase_c *GetActorPointer(int) const;
dBgW_Base *GetBgWBasePointer(cBgS_PolyInfo const &) const;
bool ChkPolySafe(cBgS_PolyInfo const &) const;
s32 GetGrpRoomId(cBgS_PolyInfo const &) const;
bool GetTriPla(cBgS_PolyInfo const &, cM3dGPla *) const;
bool GetTriPnt(cBgS_PolyInfo const &, mVec3_c *, mVec3_c *, mVec3_c *) const;
u32 GetGrpInf(cBgS_PolyInfo const &) const;
const dAcObjBase_c *GetActorPointer(const cBgS_PolyInfo &info) const;
}; // Size: 0x2EFC
class dBgS_Acch;
u8 dKy_pol_sound_get(cBgS_PolyInfo const *param_0);
struct dMapGradation {
dMapGradation()
: mHasDifferingGrad(false), mGradHigh(0.0f), mGradLow(0.0f), mHasGradation(false), mColorR(0), mColorG(0),
mColorB(0), mColorA(0) {}
/* 0x00 */ bool mHasDifferingGrad;
/* 0x04 */ f32 mGradHigh;
/* 0x08 */ f32 mGradLow;
/* 0x0C */ bool mHasGradation;
/* 0x0D */ u8 mColorR;
/* 0x0E */ u8 mColorG;
/* 0x0F */ u8 mColorB;
/* 0x10 */ u8 mColorA;
};
struct MapSrollText_t {
/* 0x00 */ u8 _0[0x0E - 0x00];
/* 0x0E */ s16 mField_0x0E;
/* 0x10 */ s16 mField_0x10;
/* 0x12 */ u8 _1[0x1C - 0x12];
};
struct MapLineSegment {
MapLineSegment();
virtual ~MapLineSegment();
virtual void Draw(int, mMtx_c *, bool, int);
void fn_8033e9a0();
void Dt();
void fn_8033e9c0();
void Append();
void Remove();
/* 0x4 */ bool bShow;
/* 0x8 */ TListNode<MapLineSegment> mLink;
};
class dBgS : public cBgS {
private:
static dBgS *spInstance;
static const void *spSolidMatTex[31];
static const void *spScrollMapTex[5];
typedef TList<MapLineSegment, offsetof(MapLineSegment, mLink)> MapLineList;
public:
/* 0x2EF8 */ EGG::CpuTexture *mMapTexture;
/* 0x2EFC */ dBgW_Base *mColllisionTbl[BG_ID_MAX];
/* 0x385C */ s32 mColllisionTblLen;
/* 0x3860 */ bool mInSkyKeep;
/* 0x3864 */ s32 mField_0x3864[5];
/* 0x3878 */ s32 mField_0x3878[5];
/* 0x388C */ MapLineList mList_0x388C;
/* 0x3894 */ dMapGradation mMapGradation;
dBgS();
~dBgS();
void Ct();
void Dt();
void ClrMoveFlag();
void Move();
void Regist(dBgW_Base *, int);
static dBgS *GetInstance();
bool Regist(dBgW_Base *, dAcObjBase_c *); // Registers Actor to Bg
bool RegistBg(dBgW_Base *, dAcObjBase_c *); // Registers Bg
bool UnRegist(dBgW_Base *);
bool ChkMoveBG(cBgS_PolyInfo const &, bool);
u32 ChkShadowThrough(cBgS_PolyInfo const &);
int GetSpecialCode(cBgS_PolyInfo const &);
s32 GetWallCode(cBgS_PolyInfo const &);
// s32 GetExitId(cBgS_PolyInfo const &);
static int GetMapCode(int, int, bool);
int GetPolyMaterial(cBgS_PolyInfo const &);
int GetPolyAtt0(cBgS_PolyInfo const &);
int GetPolyAtt1(cBgS_PolyInfo const &);
int GetLightingCode(cBgS_PolyInfo const &);
int GetGroundCode(cBgS_PolyInfo const &);
int GetCode1_0x02000000(cBgS_PolyInfo const &);
s32 GetRoomCamId(cBgS_PolyInfo const &);
s32 GetRoomId(cBgS_PolyInfo const &);
bool GetPolyObjectThrough(cBgS_PolyInfo const &);
bool GetPolyCameraThrough(cBgS_PolyInfo const &);
bool GetPolyShadowThrough(cBgS_PolyInfo const &);
bool GetPolyLinkThrough(cBgS_PolyInfo const &);
bool GetPolyArrowThrough(cBgS_PolyInfo const &);
bool GetPolyBombThrough(cBgS_PolyInfo const &);
bool GetPolyBeetleThrough(cBgS_PolyInfo const &);
bool GetPolyClawshotThrough(cBgS_PolyInfo const &);
bool GetPolyThrough_Code1_0x04000000(cBgS_PolyInfo const &);
bool GetPolyThrough_Code1_0x08000000(cBgS_PolyInfo const &);
bool GetPolyWhipThrough(cBgS_PolyInfo const &);
bool GetPolySlingshotThrough(cBgS_PolyInfo const &);
void WallCorrect(dBgS_Acch *, bool);
f32 RoofChk(dBgS_RoofChk *);
bool SplGrpChk(dBgS_SplGrpChk *);
bool SphChk(dBgS_SphChk *, void *);
// void MoveBgCrrPos(
// cBgS_PolyInfo const &, bool param_1, mVec3_c *i_pos, mAng3_c *i_angle, mAng3_c *i_shapeAngle,
// bool param_5, bool param_6
// );
// MoveBgTransPos(cBgS_PolyInfo const &i_poly, bool param_1, mVec3_c *i_pos, mAng3_c *i_angle, mAng3_c
// *i_shapeAngle)
// u32 GetUnderwaterRoofCode(cBgS_PolyInfo const &);
// s32 GetCamMoveBG(cBgS_PolyInfo const &);
// s32 GetRoomPathId(cBgS_PolyInfo const &);
// s32 GetRoomPathPntNo(cBgS_PolyInfo const &);
// int GetGrpSoundId(cBgS_PolyInfo const &);
// u32 ChkGrpInf(cBgS_PolyInfo const &, u32);
// bool GetPolyAttackThrough(cBgS_PolyInfo const &);
// u32 ChkPolyHSStick(cBgS_PolyInfo const &);
// void WallCorrectSort(dBgS_Acch *);
// void MoveBgMatrixCrrPos(cBgS_PolyInfo const &, bool, mVec3_c *, mAng3_c *, mAng3_c *);
void MoveBgCrrPos(cBgS_PolyInfo const &, bool, mVec3_c *, mAng3_c *, mAng3_c *, bool, bool);
void MoveBgTransPos(cBgS_PolyInfo const &, bool, mVec3_c *, mAng3_c *, mAng3_c *);
void RideCallBack(cBgS_PolyInfo const &, dAcObjBase_c *);
void ArrowStickCallBack(cBgS_PolyInfo const &, dAcObjBase_c *, mVec3_c &);
bool UnkCallback(cBgS_PolyInfo const &, dAcObjBase_c *);
dAcObjBase_c *PushPullCallBack(cBgS_PolyInfo const &, dAcObjBase_c *, dBgW_Base::PushPullLabel);
void UpdateScrollTex();
void SetupMapGX(mMtx_c *);
void SetupMapMaterial(int matIdx, bool, s32 roomId);
UNKTYPE *GetMapAccessor();
void DrawMap(u8 roomId, mMtx_c *, bool bColor, int);
void SetupScrollGX();
void SetupScrollMaterial(int matIdx, s32, bool);
void DrawMapScroll(u8 roomId, mMtx_c *, bool bColor, int);
void DrawSkyKeepMap(mMtx_c *, int);
bool ConfigureMapTexture(EGG::Heap *);
void InitMapParts();
void AppendMapSegment(MapLineSegment *);
void RemoveMapSegment(MapLineSegment *);
void DrawMapSegments(int, mMtx_c *, bool, int);
void ClearMapSegments();
void SetLightingCode(dAcObjBase_c *, const cBgS_PolyInfo &);
f32 SetLightingCode(dAcObjBase_c *, f32);
int GetLightingCode(const mVec3_c *);
bool GetPolyPreventObjOnly(const cBgS_PolyInfo &);
bool GetMapGradationColor(GXColor *);
bool WaterChk(dBgS_SplGrpChk *chk) {
return SplGrpChk(chk);
}
};
void dBgS_MoveBGProc_Trans(
dBgW *i_bgw, void *i_actor_ptr, cBgS_PolyInfo const &i_poly, bool param_3, mVec3_c *i_pos, mAng3_c *i_angle,
mAng3_c *i_shapeAngle
);
void dBgS_MoveBGProc_Typical(
dBgW *param_0, void *param_1, cBgS_PolyInfo const &param_2, bool param_3, mVec3_c *param_4, mAng3_c *param_5,
mAng3_c *param_6
);
void dBgS_MoveBGProc_RotY(
dBgW *param_0, void *param_1, cBgS_PolyInfo const &param_2, bool param_3, mVec3_c *param_4, mAng3_c *param_5,
mAng3_c *param_6
);
void dBgS_MoveBGProc_TypicalRotY(
dBgW *param_0, void *param_1, cBgS_PolyInfo const &param_2, bool param_3, mVec3_c *param_4, mAng3_c *param_5,
mAng3_c *param_6
);
bool dBgS_CheckBWallPoly(cBgS_PolyInfo const &);
bool dBgS_CheckBGroundPoly(cBgS_PolyInfo const &);
bool dBgS_CheckBRoofPoly(cBgS_PolyInfo const &);
f32 dBgS_GetNY(cBgS_PolyInfo const &poly);
mVec3_c dBgS_GetN(cBgS_PolyInfo const &);
#endif /* D_BG_D_BG_S_H */
+553
View File
@@ -0,0 +1,553 @@
#ifndef D_BG_S_ACCH_H
#define D_BG_S_ACCH_H
#include "d/a/obj/d_a_obj_base.h"
#include "d/col/bg/d_bg_s_gnd_chk.h"
#include "d/col/bg/d_bg_s_roof_chk.h"
#include "d/col/bg/d_bg_s_sph_chk.h"
#include "d/col/bg/d_bg_s_wtr_chk.h"
#include "d/col/c/c_m3d_g_cir.h"
#include "d/col/c/c_m3d_g_cyl.h"
#include "d/col/c/c_m3d_g_lin.h"
#include "d/col/c/c_m3d_g_pla.h"
class dBgS_AcchCir : public cBgS_PolyInfo {
private:
/* 0x2C */ cM3dGCir m_cir;
/* 0x40 */ f32 mWallRR;
/* 0x44 */ f32 mField_0x44;
/* 0x48 */ f32 mWallH;
/* 0x4C */ f32 mWallR;
/* 0x50 */ f32 mWallHDirect;
/* 0x54 */ s16 mWallAngleY;
/* 0x56 */ u8 mFlags;
public:
enum {
/* 0x02 */ WALL_HIT = 2,
/* 0x04 */ WALL_H_DIRECT = 4,
/* 0x08 */ UNK_0x8 = 8,
/* 0x10 */ UNK_0x10 = 0x10,
};
dBgS_AcchCir();
virtual ~dBgS_AcchCir();
bool ChkWallHit() const;
void ClrWallHit() {
mFlags &= ~WALL_HIT;
}
void SetWallR(f32);
void CalcWallRR();
void SetWall(f32, f32);
void SetWallHDirect(f32 f) {
mFlags |= WALL_H_DIRECT;
mWallHDirect = f;
}
f32 GetWallH() {
return mWallH;
}
f32 GetWallR() {
return mWallR;
}
void SetWallH(f32 h) {
mWallH = h;
}
void ClrWallHDirect() {
mFlags &= ~WALL_H_DIRECT;
}
// bool ChkWallHit() {
// return mFlags & WALL_HIT;
// }
bool ChkUnk0x8() {
return mFlags & UNK_0x8;
}
bool ChkUnk0x10() {
return mFlags & UNK_0x10;
}
s16 GetWallAngleY() {
return mWallAngleY;
}
bool ChkWallHDirect() {
return mFlags & WALL_H_DIRECT;
}
f32 GetWallHDirect() {
return mWallHDirect;
}
f32 GetWallRR() {
return mWallRR;
}
void SetWallHit() {
mFlags |= WALL_HIT;
}
void SetUnk0x8() {
mFlags |= UNK_0x8;
}
void SetUnk0x10() {
mFlags |= UNK_0x10;
}
void SetWallAngleY(s16 i_angle) {
mWallAngleY = i_angle;
}
cM3dGCir *GetCirP() {
return &m_cir;
}
void SetCir(mVec3_c &pos) {
m_cir.Set(pos.x, pos.z, pos.y + GetWallH(), mWallR);
}
};
// TODO: Needs to be relocated when Known
struct dBgS_Acch_0x1A8 {
u8 mField_0x00;
mVec3_c mField_0x04;
mVec3_c mField_0x10;
dBgS_Acch_0x1A8();
void Init();
void CalcPos(mVec3_c *);
};
class dBgS;
class dBgS_Acch : public cBgS_Chk, public dBgS_Chk {
public:
enum {
/* 0x 0000 0001 */ ACCH_FLAG_0x1 = (1 << 0),
/* 0x 0000 0002 */ GRND_NONE = (1 << 1),
/* 0x 0000 0004 */ WALL_NONE = (1 << 2),
/* 0x 0000 0008 */ ROOF_NONE = (1 << 3),
/* 0x 0000 0010 */ WALL_HIT = (1 << 4),
/* 0x 0000 0020 */ GROUND_HIT = (1 << 5),
/* 0x 0000 0040 */ GROUND_FIND = (1 << 6),
/* 0x 0000 0080 */ GROUND_LANDING = (1 << 7),
/* 0x 0000 0100 */ GROUND_AWAY = (1 << 8),
/* 0x 0000 0200 */ ROOF_HIT = (1 << 9),
/* 0x 0000 0400 */ WATER_NONE = (1 << 10),
/* 0x 0000 0800 */ WATER_HIT = (1 << 11),
/* 0x 0000 1000 */ WATER_IN = (1 << 12),
/* 0x 0000 2000 */ LINE_CHECK = (1 << 13),
/* 0x 0000 4000 */ LINE_CHECK_NONE = (1 << 14),
/* 0x 0000 8000 */ CLR_SPEED_Y = (1 << 15),
/* 0x 0001 0000 */ LINE_CHECK_HIT = (1 << 16),
/* 0x 0002 0000 */ ACCH_FLAG_0x20000 = (1 << 17),
/* 0x 0010 0000 */ MOVE_BG_ONLY = (1 << 20),
/* 0x 0020 0000 */ GND_THIN_CELLING_OFF = (1 << 21),
/* 0x 0040 0000 */ WALL_SORT = (1 << 22),
/* 0x 0080 0000 */ LINE_DOWN = (1 << 23),
/* 0x 0200 0000 */ ACCH_FLAG_0x2000000 = (1 << 25),
/* 0x 0400 0000 */ ACCH_FLAG_0x4000000 = (1 << 26),
/* 0x 0800 0000 */ ACCH_FLAG_0x8000000 = (1 << 27),
/* 0x 1000 0000 */ ACCH_FLAG_0x10000000 = (1 << 28),
/* 0x 2000 0000 */ ACCH_FLAG_0x20000000 = (1 << 29),
/* 0x 8000 0000 */ ACCH_FLAG_0x80000000 = (1 << 31),
};
dBgS_Acch();
void Init() {
mField_0x394 = 0;
ClrGroundAway();
ClrWallHit();
ClrGroundLanding();
i_ClrGroundHit();
int i = 0;
do {
mpAcchCir[i].ClrWallHit();
mpAcchCir[i].ClearPi();
mpAcchCir[i].ClrWallHDirect();
++i;
} while (i < mTblSize);
}
void Set(mVec3_c *, mVec3_c *, dAcObjBase_c *, int, dBgS_AcchCir *, mVec3_c *, mAng3_c *, mAng3_c *);
void Set(dAcObjBase_c *, int, dBgS_AcchCir *);
bool fn_8033f5b0(mVec3_c *, mVec3_c *, f32);
void LineCheck(dBgS &);
void SphCheck();
void GroundCheckInit(dBgS &) {
if (!(mFlags & GRND_NONE)) {
mGroundHeight = -1e9f;
mGnd.SetExtChk(*this);
if (i_ChkGroundHit()) {
Set_0x4000000();
} else {
Clr_0x4000000();
}
}
}
void GroundCheck(dBgS &, bool);
void RoofCheck(dBgS &);
void GroundRoofProc(dBgS &, bool);
void CrrPos(dBgS &);
f32 GetWallAllR();
void SetWallCir();
void CalcWallBmdCyl();
void SetGroundUpY(f32);
bool fn_80340ca0(cBgS_PolyInfo &info) const;
void Draw(dBgS &); // Name Assumed, no info
void SetMoveBGOnly();
void ClrMoveBGOnly();
bool ChkGndHit() const;
bool ChkRoofHit() const;
bool ChkWallHit(int *) const;
void SetGndThinCellingOff();
void ClrGndThinCellingOff();
void Set_0x2000000();
void Clr_0x2000000();
void OnWallSort();
dBgS_AcchCir &GetCir(int idx);
void fn_80340f70(const mVec3_c *);
void fn_80341000();
f32 GetWallAllLowH(); // is inline
f32 GetWallAllLowH_R(); // is inline
f32 GetWallAddY(Vec &);
void SetNowActorInfo(int, void *, unsigned int);
void SetWallPolyIndex(int, int);
void CalcMovePosWork();
void CalcWallRR();
bool ChkGndThinCellingOff();
bool ChkWallSort();
bool ChkLineDown();
void ClrGroundHit();
virtual ~dBgS_Acch();
f32 GetSpeedY() {
if (mpSpeed) {
return mpSpeed->y;
}
return 0.0f;
}
mVec3_c *GetPos() {
return mpPos;
}
mVec3_c *GetOldPos() {
return mpOldPos;
}
f32 GetGroundH() const {
return mGroundHeight;
}
f32 GetRoofHeight() const {
return mRoofHeight;
}
int GetTblSize() {
return mTblSize;
}
void SetLin() {
mLine.SetStartEnd(*mpOldPos, *mpPos);
}
bool ChkGroundFind() {
return mFlags & GROUND_FIND;
}
bool ChkGroundHit() {
return mFlags & GROUND_HIT;
}
bool ChkGroundLanding() {
return mFlags & GROUND_LANDING;
}
void ClrGroundLanding() {
mFlags &= ~GROUND_LANDING;
}
void ClrGroundAway() {
mFlags &= ~GROUND_AWAY;
}
void ClrWallHit() {
mFlags &= ~WALL_HIT;
}
void SetRoofNone() {
mFlags |= ROOF_NONE;
}
void SetRoofHit() {
mFlags |= ROOF_HIT;
}
void SetWaterNone() {
mFlags |= WATER_NONE;
}
bool ChkWallHit() {
return mFlags & WALL_HIT;
}
void OffLineCheckHit() {
mFlags &= ~LINE_CHECK_HIT;
}
void OffLineCheck() {
mFlags &= ~LINE_CHECK;
}
bool ChkLineCheckNone() {
return mFlags & LINE_CHECK_NONE;
}
bool ChkLineCheck() {
return mFlags & LINE_CHECK;
}
bool Chk_0x4000000() const {
return mFlags & ACCH_FLAG_0x4000000;
}
void Set_0x4000000() {
mFlags |= ACCH_FLAG_0x4000000;
}
void Clr_0x4000000() {
mFlags &= ~ACCH_FLAG_0x4000000;
}
void Clr_0x10000000() {
mFlags &= ~ACCH_FLAG_0x10000000;
}
void Set_0x10000000() {
mFlags |= ACCH_FLAG_0x10000000;
}
bool Chk_0x10000000() {
return mFlags & ACCH_FLAG_0x10000000;
}
void Clr_0x80000000() {
mFlags &= ~ACCH_FLAG_0x80000000;
}
void Set_0x80000000() {
mFlags |= ACCH_FLAG_0x80000000;
}
bool Chk_0x80000000() {
return mFlags & ACCH_FLAG_0x80000000;
}
void Clr_0x8000000() {
mFlags &= ~ACCH_FLAG_0x8000000;
}
void Set_0x8000000() {
mFlags |= ACCH_FLAG_0x8000000;
}
bool Chk_0x8000000() {
return mFlags & ACCH_FLAG_0x8000000;
}
void ClrRoofHit() {
mFlags &= ~ROOF_HIT;
}
void ClrWaterHit() {
mFlags &= ~WATER_HIT;
}
void SetWaterHit() {
mFlags |= WATER_HIT;
}
void ClrWaterIn() {
mFlags &= ~WATER_IN;
}
void SetWaterIn() {
mFlags |= WATER_IN;
}
const u32 MaskWaterIn() {
return mFlags & WATER_IN;
}
const bool ChkWaterIn() {
return MaskWaterIn();
}
void ClrGroundFind() {
mFlags &= ~GROUND_FIND;
}
u32 MaskRoofHit() {
return mFlags & ROOF_HIT;
}
bool ChkRoofHit() {
return MaskRoofHit();
}
void OffClrSpeedY() {
mFlags |= CLR_SPEED_Y;
}
bool ChkClrSpeedY() {
return !(mFlags & CLR_SPEED_Y);
}
void SetGroundFind() {
mFlags |= GROUND_FIND;
}
void SetGroundHit() {
mFlags |= GROUND_HIT;
}
void SetGroundLanding() {
mFlags |= GROUND_LANDING;
}
void SetGroundAway() {
mFlags |= GROUND_AWAY;
}
const u32 MaskWaterHit() {
return mFlags & WATER_HIT;
}
const bool ChkWaterHit() {
return MaskWaterHit();
}
void ClrWaterNone() {
mFlags &= ~WATER_NONE;
}
// void SetWaterCheckOffset(f32 offset) {
// m_wtr_chk_offset = offset;
// }
void OnLineCheck() {
mFlags |= LINE_CHECK;
}
void ClrRoofNone() {
mFlags &= ~ROOF_NONE;
}
bool CheckGroundHitPlus() {
return mFlags & ACCH_FLAG_0x4000000;
}
// void SetRoofCrrHeight(f32 height) {
// m_roof_crr_height = height;
// }
// void SetWtrChkMode(int mode) {
// m_wtr_mode = mode;
// }
void SetGrndNone() {
mFlags |= GRND_NONE;
}
void ClrGrndNone() {
mFlags &= ~GRND_NONE;
}
bool ChkMoveBGOnly() const {
return mFlags & MOVE_BG_ONLY;
}
void SetWallHit() {
mFlags |= WALL_HIT;
}
void ClrWallNone() {
mFlags &= ~WALL_NONE;
}
void OnLineCheckNone() {
mFlags |= LINE_CHECK_NONE;
}
void OffLineCheckNone() {
mFlags &= ~LINE_CHECK_NONE;
}
void SetWallNone() {
mFlags |= WALL_NONE;
}
void OnLineCheckHit() {
mFlags |= LINE_CHECK_HIT;
}
cM3dGCyl *GetWallBmdCylP() {
return &mWallCyl;
}
dAcObjBase_c *GetMyObj() {
return mpMyObj;
}
cM3dGCir *GetWallCirP(int index) {
// JUT_ASSERT(index <= mTblSize);
return mpAcchCir[index].GetCirP();
}
f32 GetWallH(int i_no) {
return mpAcchCir[i_no].GetWallH();
}
f32 GetWallR(int i_no) {
return mpAcchCir[i_no].GetWallR();
}
bool ChkWallHDirect(int i_no) {
return mpAcchCir[i_no].ChkWallHDirect();
}
f32 GetWallHDirect(int i_no) {
return mpAcchCir[i_no].GetWallHDirect();
}
void SetWallHDirect(int i_no, f32 f) {
mpAcchCir[i_no].SetWallHDirect(f);
}
f32 GetWallRR(int i_no) {
return mpAcchCir[i_no].GetWallRR();
}
void SetWallCirHit(int i_no) {
mpAcchCir[i_no].SetWallHit();
}
void SetWallAngleY(int i_no, s16 i_angle) {
mpAcchCir[i_no].SetWallAngleY(i_angle);
}
bool ChkCirUnk0x8(int i_no) {
return mpAcchCir[i_no].ChkUnk0x8();
}
bool ChkCirUnk0x10(int i_no) {
return mpAcchCir[i_no].ChkUnk0x10();
}
f32 GetCx() const {
return mpPos->x;
}
f32 GetCz() const {
return mpPos->z;
}
// inline dupe
void i_ClrGroundHit() {
mFlags &= ~GROUND_HIT;
}
bool i_ChkGroundHit() const {
return mFlags & GROUND_HIT;
}
public:
/* 0x040 */ u32 mFlags;
/* 0x044 */ mVec3_c *mpPos;
/* 0x048 */ mVec3_c *mpOldPos;
/* 0x04C */ mVec3_c mSpeed;
/* 0x058 */ mVec3_c *mpSpeed;
/* 0x05C */ mAng3_c *mpAngle;
/* 0x060 */ mAng3_c *mpShapeAngle;
/* 0x064 */ cM3dGLin mLine;
/* 0x07C */ cM3dGCyl mWallCyl;
/* 0x090 */ int mBgIndex;
/* 0x094 */ void *mField_0x094;
/* 0x098 */ u32 mField_0x098;
/* 0x09C */ dAcObjBase_c *mpMyObj;
/* 0x0A0 */ int mTblSize;
/* 0x0A4 */ dBgS_AcchCir *mpAcchCir;
/* 0x0A8 */ f32 mField_0x0A8;
/* 0x0AC */ f32 mField_0x0AC;
/* 0x0B0 */ f32 mGroundHeight;
/* 0x0B4 */ f32 mField_0x0B4;
/* 0x0B8 */ cM3dGPla mPlane_0x0B8;
/* 0x0C8 */ f32 mField_0x0C8;
/* 0x0CC */ f32 mField_0x0CC;
/* 0x0D0 */ f32 mRoofHeight;
/* 0x0D4 */ f32 mField_0x0D4;
/* 0x0D8 */ f32 mField_0x0D8;
/* 0x0DC */ cBgS_PolyInfo *mpOutPolyInfo;
/* 0x0E0 */ f32 mRoofH_0x0E0;
/* 0x0E4 */ f32 mGroundH_0x0E4;
/* 0x0E8 */ f32 mField_0x0E8;
/* 0x0EC */ dBgS_SphChk mSph;
/* 0x1A8 */ dBgS_Acch_0x1A8 mField_0x1A8;
/* 0x1C4 */ u8 _0[0x1D0 - 0x1C4];
/* 0x1D0 */ f32 mField_0x1D0;
/* 0x1D4 */ dBgS_GndChk mGnd;
/* 0x264 */ dBgS_RoofChk mRoof;
/* 0x2F4 */ f32 mField_0x2F4;
/* 0x2F8 */ dBgS_WtrChk mWtr;
/* 0x390 */ u8 mField_0x390;
/* 0x394 */ s32 mField_0x394;
/* 0x398 */ mVec3_c mField_0x398;
/* 0x3A4 */ mVec3_c mField_0x3A4;
};
class dBgS_ObjAcch : public dBgS_Acch {
public:
dBgS_ObjAcch();
virtual ~dBgS_ObjAcch();
};
class dBgS_LinkAcch : public dBgS_Acch {
public:
dBgS_LinkAcch();
virtual ~dBgS_LinkAcch();
};
class dBgS_BombAcch : public dBgS_Acch {
public:
dBgS_BombAcch();
virtual ~dBgS_BombAcch();
};
#endif
+20
View File
@@ -0,0 +1,20 @@
#ifndef D_BG_S_CAPT_POLY_H
#define D_BG_S_CAPT_POLY_H
#include "d/col/bg/d_bg_s_chk.h"
struct dBgS_CaptPoly;
typedef void (*CaptPolyCallback)(dBgS_CaptPoly &, cBgD_Vtx_t *, u16, u16, u16, cM3dGPla *);
struct dBgS_CaptPoly : public cBgS_Chk, public dBgS_Chk {
public:
cM3dGAab *GetBndP() {
return &mBnd;
}
/* 0x40 */ cM3dGAab mBnd;
/* 0x58 */ UNKWORD mField_0x58;
/* 0x5C */ CaptPolyCallback mCallback;
};
#endif
+19
View File
@@ -0,0 +1,19 @@
#ifndef D_BG_S_CHK_H
#define D_BG_S_CHK_H
// Include order matters here
// clang-format off
#include "d/col/bg/d_bg_s_poly_pass_chk.h"
#include "d/col/bg/d_bg_s_grp_pass_chk.h"
// clang-format on
class dBgS_Chk : public dBgS_PolyPassChk, public dBgS_GrpPassChk {
public:
dBgS_Chk();
cBgS_GrpPassChk *GetGrpPassChkInfo();
cBgS_PolyPassChk *GetPolyPassChkInfo();
virtual ~dBgS_Chk();
};
#endif
+84
View File
@@ -0,0 +1,84 @@
#ifndef D_BG_S_GND_CHK_H
#define D_BG_S_GND_CHK_H
#include "d/col/bg/d_bg_s_chk.h"
#include "d/col/c/c_bg_s_gnd_chk.h"
#include "d/col/c/c_m3d_g_pla.h"
class dBgS_GndChk : public cBgS_GndChk, public dBgS_Chk {
public:
dBgS_GndChk();
virtual ~dBgS_GndChk();
void Set(const mVec3_c *pos, u32 *id);
};
class dBgS_LinkGndChk : public dBgS_GndChk {
public:
dBgS_LinkGndChk();
virtual ~dBgS_LinkGndChk();
};
class dBgS_ObjGndChk : public dBgS_GndChk {
public:
dBgS_ObjGndChk();
virtual ~dBgS_ObjGndChk();
static dBgS_ObjGndChk &GetInstance() {
return sInstance;
}
static f32 GetGroundHeight() {
return sGroundHeight;
}
static void ClearInstance();
static bool CheckPos(const mVec3_c *);
static int GetMaterial();
static int GetPolyAtt1();
static bool GetTriPlane(cM3dGPla *);
static s32 GetRoomID();
static bool ChkMoveBG();
static int GetLightingCode();
static int GetSpecialCode();
private:
static dBgS_ObjGndChk sInstance;
static f32 sGroundHeight;
};
class dBgS_ObjGndChk_Wtr : public dBgS_ObjGndChk {
public:
dBgS_ObjGndChk_Wtr();
virtual ~dBgS_ObjGndChk_Wtr();
};
class dBgS_ObjGndChk_Spl : public dBgS_ObjGndChk {
public:
dBgS_ObjGndChk_Spl();
virtual ~dBgS_ObjGndChk_Spl();
};
class dBgS_ObjGndChk_All : public dBgS_ObjGndChk {
public:
virtual ~dBgS_ObjGndChk_All();
dBgS_ObjGndChk_All();
};
class dBgS_CamGndChk : public dBgS_GndChk {
public:
dBgS_CamGndChk();
virtual ~dBgS_CamGndChk();
};
class dBgS_CamGndChk_Wtr : public dBgS_CamGndChk {
public:
dBgS_CamGndChk_Wtr();
virtual ~dBgS_CamGndChk_Wtr();
};
#endif
+46
View File
@@ -0,0 +1,46 @@
#ifndef D_BG_S_GRP_PASS_CHK_H
#define D_BG_S_GRP_PASS_CHK_H
#include "d/col/c/c_bg_s_chk.h"
class dBgS_GrpPassChk : public cBgS_GrpPassChk {
public:
enum {
/* 0x1 */ NORMAL_GRP = 1,
/* 0x2 */ WATER_GRP,
/* 0x3 */ FULL_GRP
};
dBgS_GrpPassChk();
virtual ~dBgS_GrpPassChk();
void OnWaterGrp() {
mGrp |= WATER_GRP;
}
void OnSpl() {
mGrp |= WATER_GRP;
}
void OnNormalGrp() {
mGrp |= NORMAL_GRP;
}
void OffNormalGrp() {
mGrp &= ~NORMAL_GRP;
}
void OffFullGrp() {
mGrp &= ~FULL_GRP;
}
void OnAll() {
mGrp |= FULL_GRP;
}
u32 MaskNormalGrp() const {
return mGrp & 1;
}
u32 MaskWaterGrp() const {
return mGrp & 2;
}
private:
/* 0x4 */ u32 mGrp;
};
#endif
+126
View File
@@ -0,0 +1,126 @@
#ifndef D_BG_S_LIN_CHK_H
#define D_BG_S_LIN_CHK_H
#include "d/col/bg/d_bg_s_chk.h"
#include "d/col/c/c_bg_s_lin_chk.h"
#include "d/col/c/c_m3d_g_pla.h"
#include "m/m_angle.h"
class dAcObjBase_c;
class dBgS_LinChk : public cBgS_LinChk, public dBgS_Chk {
public:
dBgS_LinChk();
void Set(mVec3_c const *pStart, mVec3_c const *pEnd, dAcObjBase_c const *pObj);
virtual ~dBgS_LinChk();
/* 0x00 cBgS_LinChk */;
/* 0x58 dBgS_Chk */;
};
class dBgS_CamLinChk : public dBgS_LinChk {
public:
dBgS_CamLinChk();
virtual ~dBgS_CamLinChk();
};
class dBgS_CamLinChk_NorWtr : public dBgS_CamLinChk {
public:
dBgS_CamLinChk_NorWtr();
virtual ~dBgS_CamLinChk_NorWtr();
};
class dBgS_ObjLinChk : public dBgS_LinChk {
public:
dBgS_ObjLinChk();
virtual ~dBgS_ObjLinChk();
virtual void SetEnd(const mVec3_c *) override;
static dBgS_ObjLinChk &GetInstance() {
return sInstance;
}
static void ClearInstance();
static bool LineCross(mVec3_c const *pStart, mVec3_c const *pEnd, dAcObjBase_c const *pObj);
static mAng GetAngle();
static bool GetTriPla(cM3dGPla *);
static int GetMaterial();
static bool ChkMoveBG();
static bool ChkGround();
static bool ChkWall();
static bool ChkRoof();
private:
static dBgS_ObjLinChk sInstance;
};
class dBgS_LinkLinChk : public dBgS_LinChk {
public:
dBgS_LinkLinChk();
virtual ~dBgS_LinkLinChk();
};
class dBgS_BombLinChk : public dBgS_LinChk {
public:
dBgS_BombLinChk();
virtual ~dBgS_BombLinChk();
};
class dBgS_ArrowLinChk : public dBgS_LinChk {
public:
dBgS_ArrowLinChk();
virtual ~dBgS_ArrowLinChk();
};
class dBgS_BeetleLinChk : public dBgS_LinChk {
public:
dBgS_BeetleLinChk();
virtual ~dBgS_BeetleLinChk();
};
class dBgS_ClawshotLinChk : public dBgS_LinChk {
public:
dBgS_ClawshotLinChk();
virtual ~dBgS_ClawshotLinChk();
};
class dBgS_GustBellowsLinChk : public dBgS_LinChk {
public:
dBgS_GustBellowsLinChk();
virtual ~dBgS_GustBellowsLinChk();
};
class dBgS_WhipLinChk : public dBgS_LinChk {
public:
dBgS_WhipLinChk();
virtual ~dBgS_WhipLinChk();
};
class dBgS_WtrLinChk : public dBgS_LinChk {
public:
dBgS_WtrLinChk();
virtual ~dBgS_WtrLinChk();
virtual void SetEnd(const mVec3_c *) override;
static dBgS_WtrLinChk &GetInstance() {
return sInstance;
}
static void ClearInstance();
static bool SetIsWater(mVec3_c const *pStart, mVec3_c const *pEnd, dAcObjBase_c const *pObj);
private:
static dBgS_WtrLinChk sInstance;
};
#endif
+133
View File
@@ -0,0 +1,133 @@
#ifndef D_BG_S_POLY_PASS_CHK_H
#define D_BG_S_POLY_PASS_CHK_H
class cBgS_PolyPassChk {
public:
cBgS_PolyPassChk();
virtual ~cBgS_PolyPassChk();
};
class dBgS_PolyPassChk : public cBgS_PolyPassChk {
public:
dBgS_PolyPassChk();
virtual ~dBgS_PolyPassChk();
bool ChkObj() {
return mObject;
}
bool ChkCam() {
return mCamera;
}
bool ChkLink() {
return mLink;
}
bool ChkArrow() {
return mArrow;
}
bool ChkBomb() {
return mBomb;
}
bool ChkWhip() {
return mWhip;
}
bool ChkBeetle() {
return mBeetle;
}
bool ChkClawshot() {
return mClawshot;
}
bool ChkUnderwaterRoof() {
return mUnderwaterRoof;
}
bool Chk0xD() {
return mBellows;
}
bool Chk0xE() {
return mField_0xE;
}
void ClrObj() {
mObject = false;
}
void ClrCam() {
mCamera = false;
}
void ClrLink() {
mLink = false;
}
void ClrArrow() {
mArrow = false;
}
void ClrBomb() {
mBomb = false;
}
void ClrWhip() {
mWhip = false;
}
void ClrBeetle() {
mBeetle = false;
}
void ClrClawshot() {
mClawshot = false;
}
void ClrUnderwaterRoof() {
mUnderwaterRoof = false;
}
void ClrBellows() {
mBellows = false;
}
void Clr0xE() {
mField_0xE = false;
}
void SetObj() {
mObject = true;
}
void SetCam() {
mCamera = true;
}
void SetLink() {
mLink = true;
}
void SetArrow() {
mArrow = true;
}
void SetBomb() {
mBomb = true;
}
void SetWhip() {
mWhip = true;
}
void SetBeetle() {
mBeetle = true;
}
void SetClawshot() {
mClawshot = true;
}
void SetUnderwaterRoof() {
mUnderwaterRoof = true;
}
void SetBellows() {
mBellows = true;
}
void Set0xE() {
mField_0xE = true;
}
void SetPassChkInfo(dBgS_PolyPassChk &chk);
private:
/* 0x4 */ bool mObject;
/* 0x5 */ bool mCamera;
/* 0x6 */ bool mLink;
/* 0x7 */ bool mArrow;
/* 0x8 */ bool mBomb;
/* 0x9 */ bool mWhip;
/* 0xA */ bool mBeetle;
/* 0xB */ bool mClawshot;
/* 0xC */ bool mUnderwaterRoof;
/* 0xD */ bool mBellows;
/* 0xE */ bool mField_0xE;
};
#endif
+70
View File
@@ -0,0 +1,70 @@
#ifndef D_BG_S_ROOF_CHK_H
#define D_BG_S_ROOF_CHK_H
#include "d/col/bg/d_bg_s_chk.h"
#include "d/col/c/c_bg_s_poly_info.h"
#include "m/m_vec.h"
class dBgS_RoofChk : public cBgS_PolyInfo, public cBgS_Chk, public dBgS_Chk {
public:
/* 0x6C */ mVec3_c mPos;
/* 0x78 */ f32 mNowY;
/* 0x7C */ u8 mField_0x7C;
/* 0x80 */ mVec3_c mPosCopy;
dBgS_RoofChk();
virtual ~dBgS_RoofChk();
void Init() {
SetNowY(1000000000.0f);
ClearPi();
}
void SetPos(mVec3_c const *);
void SetNowY(f32 y) {
mNowY = y;
}
void i_SetPos(mVec3_c const &pos) {
mPos = pos;
}
f32 GetNowY() {
return mNowY;
}
mVec3_c *GetPosP() {
return &mPos;
}
void CopyPos() {
mPosCopy = mPos;
}
};
class dBgS_ObjRoofChk : public dBgS_RoofChk {
public:
dBgS_ObjRoofChk();
virtual ~dBgS_ObjRoofChk();
static dBgS_ObjRoofChk &GetInstance() {
return sInstance;
}
static f32 GetRoofHeight() {
return sRoofHeight;
}
static void ClearInstance();
static bool CheckPos(const mVec3_c *);
private:
static dBgS_ObjRoofChk sInstance;
static f32 sRoofHeight;
};
class dBgS_LinkRoofChk : public dBgS_RoofChk {
public:
dBgS_LinkRoofChk();
virtual ~dBgS_LinkRoofChk();
};
#endif
+39
View File
@@ -0,0 +1,39 @@
#ifndef D_BG_S_SPH_CHK_H
#define D_BG_S_SPH_CHK_H
#include "d/col/bg/d_bg_s_chk.h"
#include "d/col/c/c_bg_s_poly_info.h"
#include "d/col/c/c_m3d_g_sph.h"
struct cBgD_Vtx_t;
class dBgS_SphChk;
typedef void *(*SphChk_Callback)(dBgS_SphChk *, cBgD_Vtx_t *, int, int, int, cM3dGPla *, void *);
class dBgS_SphChk : public cM3dGSph, public cBgS_PolyInfo, public cBgS_Chk, public dBgS_Chk {
public:
/* 0x80 */ f32 mField_0x80;
/* 0x84 */ mVec3_c mField_0x84;
/* 0x90 */ cM3dGAab mAabb;
/* 0xA8 */ u32 mField_0xA8;
/* 0xAC */ void *mField_0xAC;
/* 0xB0 */ u32 mField_0xB0;
/* 0xB4 */ SphChk_Callback mCallback;
void SetInfo(int i, void *pV, int a) {
mField_0xA8 = i;
mField_0xAC = pV;
mField_0xB0 = a;
}
dBgS_SphChk();
virtual ~dBgS_SphChk();
};
class dBgS_CamSphChk : public dBgS_SphChk {
public:
dBgS_CamSphChk();
virtual ~dBgS_CamSphChk();
};
#endif
+72
View File
@@ -0,0 +1,72 @@
#ifndef D_BG_S_SPL_GRP_CHK_H
#define D_BG_S_SPL_GRP_CHK_H
#include "d/col/bg/d_bg_s_chk.h"
#include "d/col/c/c_bg_s_poly_info.h"
#include "m/m_vec.h"
class dBgS_SplGrpChk : public cBgS_PolyInfo, public cBgS_Chk, public dBgS_Chk {
public:
/* 0x6C */ mVec3_c mGnd;
/* 0x78 */ f32 mRoof;
/* 0x7C */ f32 mHeight;
/* 0x80 */ f32 mGroundH;
/* 0x84 */ u32 mFlags;
/* 0x88 */ mVec3_c mGroundCopy;
enum {
/* 0x1 */ FIND = 1,
/* 0x2 */ IN = 2,
/* 0x4 */ MOVE_BG_ONLY = 4
};
void Set(mVec3_c &, f32);
dBgS_SplGrpChk();
void Init() {
OffIn();
OffFind();
mGroundH = -1000000000.0f;
SetHeight(mGnd.y);
ClearPi();
}
virtual ~dBgS_SplGrpChk();
void OffFind() {
mFlags &= ~FIND;
}
void OffIn() {
mFlags &= ~IN;
}
void OffMoveBGOnly() {
mFlags &= ~MOVE_BG_ONLY;
}
void OnMoveBGOnly() {
mFlags |= MOVE_BG_ONLY;
}
void OnFind() {
mFlags |= FIND;
}
bool ChkMoveBGOnly() {
return mFlags & MOVE_BG_ONLY;
}
void SetHeight(f32 height) {
mHeight = height;
}
f32 GetHeight() {
return mHeight;
}
mVec3_c &GetPosP() {
return mGnd;
}
f32 GetRoof() const {
return mRoof;
}
void CopyGnd() {
mGroundCopy = mGnd;
}
};
#endif
+28
View File
@@ -0,0 +1,28 @@
#ifndef D_BG_S_WTR_CHK_H
#define D_BG_S_WTR_CHK_H
#include "d/col/bg/d_bg_s_spl_grp_chk.h"
class dBgS_WtrChk : public dBgS_SplGrpChk {
public:
dBgS_WtrChk();
virtual ~dBgS_WtrChk();
static dBgS_WtrChk &GetInstance() {
return sInstance;
}
static f32 GetWaterHeight() {
return sWaterHeight;
}
static void ClearInstance();
static bool CheckPos(const mVec3_c *, bool, f32, f32);
static int GetMaterial();
private:
static dBgS_WtrChk sInstance;
static f32 sWaterHeight;
};
#endif
+403
View File
@@ -0,0 +1,403 @@
#ifndef D_BG_W_H
#define D_BG_W_H
#include <common.h>
#include <d/col/bg/d_bg_plc.h>
#include <d/col/bg/d_bg_w_base.h>
#include <d/col/c/c_m3d_g_aab.h>
#include <m/m_math.h>
#include <rvl/MTX.h>
class cBgS_GrpPassChk;
class cBgS_PolyPassChk;
class fBase_c;
struct cBgD_Vtx_t;
struct dBgS_CaptPoly;
class cBgW_TriElm : public cM3dGPla {
public:
};
struct _RwgElm_t {
u16 mNext;
};
class cBgW_RwgElm : public _RwgElm_t {
public:
cBgW_RwgElm() {}
};
class cBgW_NodeTree : public cM3dGAab {};
class cBgW_GrpElm {
public:
cM3dGAab mAab;
};
// Odd
struct _BlkElm_t {
/* 0x0 */ u16 mRoofIdx;
/* 0x2 */ u16 mWallIdx;
/* 0x4 */ u16 mGndIdx;
};
class cBgW_BlkElm : public _BlkElm_t {
public:
cBgW_BlkElm() {}
}; // Size: 0x6
struct cBgD_Tri_t {
/* 0x0 */ u16 mVtxIdx0;
/* 0x2 */ u16 mVtxIdx1;
/* 0x4 */ u16 mVtxIdx2;
/* 0x6 */ u16 mId;
/* 0x8 */ u16 mGrp;
}; // Size: 0xA
struct cBgD_Ti_t {
/* 0x0 */ u32 m_info0;
/* 0x4 */ u32 m_info1;
/* 0x8 */ u32 m_info2;
/* 0xC */ u32 m_passFlag;
};
class cBgD_Blk_t {
public:
/* 0x0 */ u16 field_0x0;
cBgD_Blk_t();
};
struct cBgD_Tree_t {
/* 0x0 */ u16 mFlag;
/* 0x2 */ u16 m_parent_id;
/* 0x4 */ u16 mId[8];
}; // Size: 0x14
struct cBgD_Grp_t {
/* 0x00 */ char *mpName;
/* 0x04 */ mVec3_c mScale;
/* 0x10 */ mAng3_c mRotation;
/* 0x18 */ mVec3_c mTranslation;
/* 0x24 */ u16 mParent;
/* 0x26 */ u16 mNextSibling;
/* 0x28 */ u16 mFirstChild;
/* 0x2A */ u16 mRoomId;
/* 0x2C */ u16 mFirstVtxIdx;
/* 0x2E */ u16 mTreeIdx;
/* 0x30 */ u32 mInfo;
}; // Size: 0x34
struct cBgD_t {
/* 0x00 */ int mVtxNum; // vertex num
/* 0x04 */ cBgD_Vtx_t *mVtxTbl; // vertex table
/* 0x08 */ int mTriNum; // triangle num
/* 0x0C */ cBgD_Tri_t *mTriTbl; // triangle table
/* 0x10 */ int mBlkNum;
/* 0x14 */ cBgD_Blk_t *mBlkTbl;
/* 0x18 */ int mTreeNum;
/* 0x1C */ cBgD_Tree_t *mTreeTbl;
/* 0x20 */ int mGrpNum;
/* 0x24 */ cBgD_Grp_t *mGrpTbl;
/* 0x28 */ int mTiNum;
/* 0x2C */ cBgD_Ti_t *mTiTbl;
/* 0x30 */ u32 mFlags;
};
class cBgW : public dBgW_Base {
public:
enum Flags_e {
MOVE_BG_e = 0x1,
NO_CALC_VTX_e = 0x2,
NO_VTX_TBL_e = 0x10,
GLOBAL_e = 0x20,
CBGW_UNK_FLAG_40 = 0x40,
LOCK_e = 0x80,
ROOF_REGIST_e = 0x200,
};
cBgW();
void FreeArea();
u32 GetOldInvMtx(mMtx_c *m);
void UpdateMtx();
void GlobalVtx();
bool SetVtx();
bool SetTri();
void BlckConnect(u16 *, int *, int);
void MakeBlckTransMinMax(mVec3_c *, mVec3_c *);
void MakeBlckMinMax(int, mVec3_c *, mVec3_c *);
void MakeBlckBnd(int, mVec3_c *, mVec3_c *);
void MakeNodeTreeRp(int);
void MakeNodeTreeGrpRp(int);
void MakeNodeTree();
bool Set(cBgD_t *pDzb, PLC *pPlc, u32 flags, mMtx_c *pMdlMtx, mVec3_c *pScale);
void LineCheckGrpRp(cBgS_LinChk *, int);
void LineCheckRp(cBgS_LinChk *, int);
void RwgLineCheck(int, cBgS_LinChk *);
void GroundCrossGrpRp(cBgS_GndChk *, int);
void GroundCrossRp(cBgS_GndChk *, int);
void RwgGroundCheckCommon(f32, u16, cBgS_GndChk *) {
// Is Inlined
}
void RwgGroundCheckGnd(u16, cBgS_GndChk *);
void RwgGroundCheckWall(u16, cBgS_GndChk *);
void Lock();
void CopyOldMtx();
void Move();
void ShdwDrawGrpRp(cBgS_ShdwDraw *, int);
void ShdwDrawRp(cBgS_ShdwDraw *, int);
void RwgShdwDraw(int, cBgS_ShdwDraw *);
void GetTriPla(int idx, cM3dGPla *);
void GetTrans(mVec3_c *) const;
int GetPolyInfId(int) const;
u32 GetPolyInf0(int, u32, u32) const;
u32 GetMaskPolyInf0_NoShift(int, u32) const;
u32 GetPolyInf1(int, u32, u32) const;
u32 GetMaskPolyInf1_NoShift(int, u32) const;
u32 GetPolyInf2(int, u32, u32) const;
int GetTriGrp(int) const;
/* vt at 0x08 */
/* 0x008 */ virtual ~cBgW();
/* 0x00C */ virtual bool ChkMemoryError() override;
/* 0x014 */ virtual void GetTopUnder(f32 *pOutTop, f32 *pOutUnder) const override;
/* 0x018 */ virtual bool ChkNotReady() const override;
/* 0x01C */ virtual bool ChkLock() const override;
/* 0x020 */ virtual bool ChkMoveBg() const override;
/* 0x024 */ virtual u32 ChkMoveFlag() const override = 0;
/* 0x028 */ virtual void GetTriPla(cBgS_PolyInfo const &, cM3dGPla *) const override;
/* 0x02C */ virtual bool GetTriPnt(cBgS_PolyInfo const &, mVec3_c *, mVec3_c *, mVec3_c *) const override;
/* 0x030 */ virtual const cM3dGAab *GetBnd() const override;
/* 0x034 */ virtual u32 GetGrpInf(cBgS_PolyInfo const &) const override;
/* 0x038 */ virtual void OffMoveFlag() override = 0;
/* 0x03C */ virtual void vt_0x3C() override = 0;
/* 0x040 */ virtual bool LineCheck(cBgS_LinChk *) override;
/* 0x044 */ virtual bool GroundCross(cBgS_GndChk *) override;
/* 0x048 */ virtual void ShdwDraw(cBgS_ShdwDraw *) override;
/* 0x04C */ virtual void CaptPoly(dBgS_CaptPoly &) override = 0;
/* 0x050 */ virtual bool WallCorrect(dBgS_Acch *) override = 0;
/* 0x054 */ virtual bool WallCorrectSort(dBgS_Acch *) override = 0;
/* 0x058 */ virtual bool RoofChk(dBgS_RoofChk *) override = 0;
/* 0x05C */ virtual bool SplGrpChk(dBgS_SplGrpChk *) override = 0;
/* 0x060 */ virtual bool SphChk(dBgS_SphChk *, void *) override = 0;
/* 0x064 */ virtual s32 GetGrpRoomIndex(cBgS_PolyInfo const &) const override = 0;
/* 0x068 */ virtual s32 GetExitId(cBgS_PolyInfo const &) override = 0;
/* 0x06C */ virtual s32 GetZTargetThrough(cBgS_PolyInfo const &) override = 0;
/* 0x070 */ virtual int GetSpecialCode(cBgS_PolyInfo const &) override = 0;
/* 0x074 */ virtual int GetSpecialCode(int) override = 0;
/* 0x078 */ virtual int GetCode0_0x30000000(cBgS_PolyInfo const &) override = 0;
/* 0x07C */ virtual u32 GetPolyObjThrough(int) override = 0;
/* 0x080 */ virtual u32 GetPolyCamThrough(int) override = 0;
/* 0x084 */ virtual u32 GetPolyLinkThrough(int) override = 0;
/* 0x088 */ virtual u32 GetPolyArrowThrough(int) override = 0;
/* 0x08C */ virtual u32 GetPolySlingshotThrough(int) override = 0;
/* 0x090 */ virtual u32 GetPolyBeetleThrough(int) override = 0;
/* 0x094 */ virtual u32 GetPolyClawshotThrough(int) override = 0;
/* 0x098 */ virtual u32 GetPolyBombThrough(int) override = 0;
/* 0x09C */ virtual u32 GetPolyWhipThrough(int) override = 0;
/* 0x0A0 */ virtual u32 GetShdwThrough(int) override = 0;
/* 0x0A4 */ virtual u32 GetUnderwaterRoofCode(int) override = 0;
/* 0x0A8 */ virtual int GetCode0_0x80000000(cBgS_PolyInfo const &) override = 0;
/* 0x0AC */ virtual int GetLinkNo(cBgS_PolyInfo const &) override = 0;
/* 0x0B0 */ virtual s32 GetWallCode(cBgS_PolyInfo const &) override = 0;
/* 0x0B4 */ virtual int GetPolyAtt0Material(cBgS_PolyInfo const &) override = 0;
/* 0x0B8 */ virtual int GetPolyAtt0(cBgS_PolyInfo const &) override;
/* 0x0Bc */ virtual int GetPolyAtt1(cBgS_PolyInfo const &) override = 0;
/* 0x0C0 */ virtual int GetGroundCode(cBgS_PolyInfo const &) override = 0;
/* 0x0C4 */ virtual u32 GetCode1_0x02000000(int) override = 0;
/* 0x0C8 */ virtual u32 GetCode1_0x04000000(int) override = 0;
/* 0x0CC */ virtual u32 GetCode1_0x08000000(int) override = 0;
/* 0x0D0 */ virtual u32 GetLightingCode(cBgS_PolyInfo const &) override = 0;
/* 0x0D4 */ virtual s32 GetCamMoveBG(cBgS_PolyInfo const &) override = 0;
/* 0x0D8 */ virtual s32 GetRoomCamId(cBgS_PolyInfo const &) override = 0;
/* 0x0DC */ virtual s32 GetRoomPathId(cBgS_PolyInfo const &) override = 0;
/* 0x0E0 */ virtual s32 GetRoomPathPntNo(cBgS_PolyInfo const &) override = 0;
/* 0x0E4 */ virtual void CrrPos(cBgS_PolyInfo const &, void *, bool, mVec3_c *, mAng3_c *, mAng3_c *) override = 0;
/* 0x0E8 */ virtual void
TransPos(cBgS_PolyInfo const &, void *, bool, mVec3_c *, mAng3_c *, mAng3_c *) override = 0;
/* 0x0EC */ virtual void
MatrixCrrPos(cBgS_PolyInfo const &, void *, bool, mVec3_c *, mAng3_c *, mAng3_c *) override = 0;
/* 0x100 */ virtual bool GetIsDraw(int) override = 0;
/* 0x104 */ virtual void DrawOnMap(int, bool) override = 0;
/* 0x108 */ virtual void CalcPlane();
/* 0x10C */ virtual void ClassifyPlane();
// MtxP GetBaseMtxP() { return pm_base; }
bool ChkNoCalcVtx() {
return mFlags & NO_CALC_VTX_e;
}
void SetNoCalcVtx() {
mFlags |= NO_CALC_VTX_e;
}
void ClrNoCalcVtx() {
mFlags &= ~NO_CALC_VTX_e;
}
void SetLock() {
mFlags |= LOCK_e;
}
cBgD_Vtx_t *GetVtxTbl() const {
return mpVtxTbl;
}
int GetVtxNum() const {
return mpBgd->mVtxNum;
}
bool ChkRoofRegist() {
return mFlags & ROOF_REGIST_e;
}
public:
/* 0x12C */ mMtx_c *mpMdlMtx; // Model Matrix
/* 0x130 */ mMtx_c mInvMtx;
/* 0x160 */ mMtx_c mMtx;
/* 0x190 */ mMtx_c mMtxUnk;
/* 0x1C0 */ mVec3_c mTransVel;
/* 0x1CC */ mVec3_c *mpScale;
/* 0x1D0 */ u16 mFlags;
/* 0x1D2 */ u16 mRootGroupIdx;
/* 0x1D4 */ cBgW_TriElm *mpTri;
/* 0x1D8 */ cBgW_RwgElm *mpRwg;
/* 0x1DC */ cBgD_Vtx_t *mpVtxTbl;
/* 0x1E0 */ cBgD_t *mpBgd;
/* 0x1E4 */ cBgW_BlkElm *mpBlk;
/* 0x1E8 */ cBgW_GrpElm *mpGrp;
/* 0x1EC */ cBgW_NodeTree *mpNodeTree;
/* 0x1F0 */ dBgPlc mpPolyCodes;
/* 0x1F4 */ bool mNeedsFullTransform;
static bool sLineCheck;
static bool sGndCheck;
static bool sWallCheck;
static bool sRoofCheck;
static bool sSplGrpCheck;
static bool sSphCheck;
};
class dBgW;
class dAcObjBase_c;
typedef void (*dBgW_RideCallback)(dBgW *, dAcObjBase_c *, dAcObjBase_c *);
typedef void (*dBgW_ArrowStickCallback)(dBgW *, dAcObjBase_c *, dAcObjBase_c *, mVec3_c &);
typedef bool (*dBgW_UnkCallback)(dBgW *, dAcObjBase_c *, dAcObjBase_c *);
typedef void (*dBgW_CrrFunc)(dBgW *, void *, cBgS_PolyInfo const &, bool, mVec3_c *, mAng3_c *, mAng3_c *);
class dBgW : public cBgW {
public:
dBgW();
void Move();
void positionWallCorrect(dBgS_Acch *, f32, cM3dGPla &, mVec3_c *pUpperPos, f32);
void RwgWallCorrect(dBgS_Acch *, u16);
void WallCorrectRp(dBgS_Acch *, int);
void WallCorrectGrpRp(dBgS_Acch *, int);
void RwgWallCorrectSort(dBgS_Acch *, u16);
void WallCorrectRpSort(dBgS_Acch *, int);
void WallCorrectGrpRpSort(dBgS_Acch *, int);
void RwgRoofChk(u16, dBgS_RoofChk *, f32);
void RwgRoofChkRoof(u16, dBgS_RoofChk *);
void RwgRoofChkWall(u16, dBgS_RoofChk *);
void RoofChkRp(dBgS_RoofChk *, int);
void RoofChkGrpRp(dBgS_RoofChk *, int);
void RwgSplGrpChk(u16, dBgS_SplGrpChk *);
void SplGrpChkRp(dBgS_SplGrpChk *, int);
void SplGrpChkGrpRp(dBgS_SplGrpChk *, int);
void RwgCaptPoly(u16, dBgS_CaptPoly &);
void CaptPolyRp(dBgS_CaptPoly &, int);
void CaptPolyGrpRp(dBgS_CaptPoly &, int);
void RwgSphChk(u16, dBgS_SphChk *, void *);
void SphChkRp(dBgS_SphChk *, void *, int);
void SphChkGrpRp(dBgS_SphChk *, void *, int);
bool GetMapCode(int polyIdx, int *pOut);
/* vt at 0x08 */
/* 0x008 */ virtual ~dBgW();
/* 0x024 */ virtual u32 ChkMoveFlag() const override;
/* 0x038 */ virtual void OffMoveFlag() override;
/* 0x03C */ virtual void vt_0x3C() override;
/* 0x04C */ virtual void CaptPoly(dBgS_CaptPoly &) override;
/* 0x050 */ virtual bool WallCorrect(dBgS_Acch *) override;
/* 0x054 */ virtual bool WallCorrectSort(dBgS_Acch *) override;
/* 0x058 */ virtual bool RoofChk(dBgS_RoofChk *) override;
/* 0x05C */ virtual bool SplGrpChk(dBgS_SplGrpChk *) override;
/* 0x060 */ virtual bool SphChk(dBgS_SphChk *, void *) override;
/* 0x064 */ virtual s32 GetGrpRoomIndex(cBgS_PolyInfo const &) const override;
/* 0x068 */ virtual s32 GetExitId(cBgS_PolyInfo const &) override;
/* 0x06C */ virtual s32 GetZTargetThrough(cBgS_PolyInfo const &) override;
/* 0x070 */ virtual int GetSpecialCode(cBgS_PolyInfo const &) override;
/* 0x074 */ virtual int GetSpecialCode(int) override;
/* 0x078 */ virtual int GetCode0_0x30000000(cBgS_PolyInfo const &) override;
/* 0x07C */ virtual u32 GetPolyObjThrough(int) override;
/* 0x080 */ virtual u32 GetPolyCamThrough(int) override;
/* 0x084 */ virtual u32 GetPolyLinkThrough(int) override;
/* 0x088 */ virtual u32 GetPolyArrowThrough(int) override;
/* 0x08C */ virtual u32 GetPolySlingshotThrough(int) override;
/* 0x090 */ virtual u32 GetPolyBeetleThrough(int) override;
/* 0x094 */ virtual u32 GetPolyClawshotThrough(int) override;
/* 0x098 */ virtual u32 GetPolyBombThrough(int) override;
/* 0x09C */ virtual u32 GetPolyWhipThrough(int) override;
/* 0x0A0 */ virtual u32 GetShdwThrough(int) override;
/* 0x0A4 */ virtual u32 GetUnderwaterRoofCode(int) override;
/* 0x0A8 */ virtual int GetCode0_0x80000000(cBgS_PolyInfo const &) override;
/* 0x0AC */ virtual int GetLinkNo(cBgS_PolyInfo const &) override;
/* 0x0B0 */ virtual s32 GetWallCode(cBgS_PolyInfo const &) override;
/* 0x0B4 */ virtual int GetPolyAtt0Material(cBgS_PolyInfo const &) override;
/* 0x0B8 */ virtual int GetPolyAtt0(cBgS_PolyInfo const &) override;
/* 0x0Bc */ virtual int GetPolyAtt1(cBgS_PolyInfo const &) override;
/* 0x0C0 */ virtual int GetGroundCode(cBgS_PolyInfo const &) override;
/* 0x0C4 */ virtual u32 GetCode1_0x02000000(int) override;
/* 0x0C8 */ virtual u32 GetCode1_0x04000000(int) override;
/* 0x0CC */ virtual u32 GetCode1_0x08000000(int) override;
/* 0x0D0 */ virtual u32 GetLightingCode(cBgS_PolyInfo const &) override;
/* 0x0D4 */ virtual s32 GetCamMoveBG(cBgS_PolyInfo const &) override;
/* 0x0D8 */ virtual s32 GetRoomCamId(cBgS_PolyInfo const &) override;
/* 0x0DC */ virtual s32 GetRoomPathId(cBgS_PolyInfo const &) override;
/* 0x0E0 */ virtual s32 GetRoomPathPntNo(cBgS_PolyInfo const &) override;
/* 0x0E4 */ virtual void CrrPos(cBgS_PolyInfo const &, void *, bool, mVec3_c *, mAng3_c *, mAng3_c *) override;
/* 0x0E8 */ virtual void TransPos(cBgS_PolyInfo const &, void *, bool, mVec3_c *, mAng3_c *, mAng3_c *) override;
/* 0x0EC */ virtual void
MatrixCrrPos(cBgS_PolyInfo const &, void *, bool, mVec3_c *, mAng3_c *, mAng3_c *) override;
/* 0x0F0 */ virtual void CallRideCallback(dAcObjBase_c *, dAcObjBase_c *) override;
/* 0x0F4 */ virtual void CallArrowStickCallback(dAcObjBase_c *, dAcObjBase_c *, mVec3_c &) override;
/* 0x0F8 */ virtual bool CallUnkCallback(dAcObjBase_c *, dAcObjBase_c *) override;
/* 0x0FC */ virtual bool UpdateDraw(mAllocator_c *) override;
/* 0x100 */ virtual bool GetIsDraw(int) override;
/* 0x104 */ virtual void DrawOnMap(int, bool) override;
/* 0x110 */ virtual u32 GetWallAtt(int);
void SetCrrFunc(dBgW_CrrFunc func) {
mpCrrFunc = func;
}
void SetRideCallback(dBgW_RideCallback func) {
mpRide_cb = func;
}
void OnMoveFlag() {
mFlags |= 1;
}
private:
/* 0x1F8 */ u32 mField_0x1F8;
/* 0x1FC */ dBgW_CrrFunc mpCrrFunc;
/* 0x200 */ dBgW_RideCallback mpRide_cb;
/* 0x204 */ dBgW_ArrowStickCallback mpArrowStick_cb;
/* 0x208 */ dBgW_UnkCallback mpUnk_cb;
/* 0x20C */ u8 mFlags;
static mVec3_c sWallCorrectPos;
};
#endif
+225
View File
@@ -0,0 +1,225 @@
#ifndef D_BG_W_BASE_H
#define D_BG_W_BASE_H
#include "d/a/d_a_base.h"
#include "d/col/c/c_bg_s_poly_info.h"
#include "d/col/c/c_bg_w.h"
#include "d/col/c/c_m3d_g_aab.h"
#include "d/col/c/c_m3d_g_pla.h"
#include "d/col/c/c_partition.h"
#include "m/m_allocator.h"
#include "m/m_math.h"
class cBgS_GndChk;
class cBgS_LinChk;
class cBgS_ShdwDraw;
class dBgS_Acch;
struct dBgS_CaptPoly;
class dBgS_RoofChk;
class dBgS_SphChk;
class dBgS_SplGrpChk;
class dAcObjBase_c;
// TODO
class dBgW_Base_0x18 {
public:
/* 0x00 */ u8 field_0x00;
dBgW_Base_0x18();
/* vt at 0x04 */
virtual ~dBgW_Base_0x18();
};
// TODO
class dBgW_Base_MapRelated {
public:
void Clear() {
mpIdx = nullptr;
mCount = 0;
}
/* 0x0 */ int *mpIdx;
/* 0x4 */ int mCount;
};
class dBgW_Base : public cBgW_BgId {
public:
enum PushPullLabel {
PPLABEL_NONE = 0,
PPLABEL_PUSH = 1,
PPLABEL_PULL = 2,
PPLABEL_4 = 4,
PPLABEL_HEAVY = 8,
};
enum PRIORITY {
PRIORITY_0,
};
typedef dAcObjBase_c *(*PushPull_CallBack)(dAcObjBase_c *, dAcObjBase_c *, dBgW_Base::PushPullLabel);
dBgW_Base();
void ClrDBgWBase();
void CalcDiffShapeAngleY(s16);
bool InitMapStuff(mAllocator_c *pAllocator);
bool fn_8034AD70() const;
bool fn_8034ADA0() const;
void RegistBg(int id);
void UnRegistBg();
bool ChkReady() const;
void Set0x2F(u8);
/* vt at 0x08 */
/* 0x008 */ virtual ~dBgW_Base();
/* 0x00C */ virtual bool ChkMemoryError();
/* 0x010 */ virtual void SetOldShapeAngleY(s16);
/* 0x014 */ virtual void GetTopUnder(f32 *pOutTop, f32 *pOutUnder) const = 0; // ?
/* 0x018 */ virtual bool ChkNotReady() const = 0;
/* 0x01C */ virtual bool ChkLock() const = 0;
/* 0x020 */ virtual bool ChkMoveBg() const = 0;
/* 0x024 */ virtual u32 ChkMoveFlag() const = 0;
/* 0x028 */ virtual void GetTriPla(cBgS_PolyInfo const &, cM3dGPla *) const = 0;
/* 0x02C */ virtual bool GetTriPnt(cBgS_PolyInfo const &, mVec3_c *, mVec3_c *, mVec3_c *) const = 0;
/* 0x030 */ virtual const cM3dGAab *GetBnd() const = 0;
/* 0x034 */ virtual u32 GetGrpInf(cBgS_PolyInfo const &) const = 0;
/* 0x038 */ virtual void OffMoveFlag() = 0;
/* 0x03C */ virtual void vt_0x3C() = 0;
/* 0x040 */ virtual bool LineCheck(cBgS_LinChk *) = 0;
/* 0x044 */ virtual bool GroundCross(cBgS_GndChk *) = 0;
/* 0x048 */ virtual void ShdwDraw(cBgS_ShdwDraw *) = 0;
/* 0x04C */ virtual void CaptPoly(dBgS_CaptPoly &) = 0;
/* 0x050 */ virtual bool WallCorrect(dBgS_Acch *) = 0;
/* 0x054 */ virtual bool WallCorrectSort(dBgS_Acch *) = 0;
/* 0x058 */ virtual bool RoofChk(dBgS_RoofChk *) = 0;
/* 0x05C */ virtual bool SplGrpChk(dBgS_SplGrpChk *) = 0;
/* 0x060 */ virtual bool SphChk(dBgS_SphChk *, void *) = 0;
/* 0x064 */ virtual s32 GetGrpRoomIndex(cBgS_PolyInfo const &) const = 0;
/* 0x068 */ virtual s32 GetExitId(cBgS_PolyInfo const &) = 0;
/* 0x06C */ virtual s32 GetZTargetThrough(cBgS_PolyInfo const &) = 0;
/* 0x070 */ virtual int GetSpecialCode(cBgS_PolyInfo const &) = 0;
/* 0x074 */ virtual int GetSpecialCode(int) = 0;
/* 0x078 */ virtual int GetCode0_0x30000000(cBgS_PolyInfo const &) = 0;
/* 0x07C */ virtual u32 GetPolyObjThrough(int) = 0;
/* 0x080 */ virtual u32 GetPolyCamThrough(int) = 0;
/* 0x084 */ virtual u32 GetPolyLinkThrough(int) = 0;
/* 0x088 */ virtual u32 GetPolyArrowThrough(int) = 0;
/* 0x08C */ virtual u32 GetPolySlingshotThrough(int) = 0;
/* 0x090 */ virtual u32 GetPolyBeetleThrough(int) = 0;
/* 0x094 */ virtual u32 GetPolyClawshotThrough(int) = 0;
/* 0x098 */ virtual u32 GetPolyBombThrough(int) = 0;
/* 0x09C */ virtual u32 GetPolyWhipThrough(int) = 0;
/* 0x0A0 */ virtual u32 GetShdwThrough(int) = 0;
/* 0x0A4 */ virtual u32 GetUnderwaterRoofCode(int) = 0;
/* 0x0A8 */ virtual int GetCode0_0x80000000(cBgS_PolyInfo const &) = 0;
/* 0x0AC */ virtual int GetLinkNo(cBgS_PolyInfo const &) = 0;
/* 0x0B0 */ virtual s32 GetWallCode(cBgS_PolyInfo const &) = 0;
/* 0x0B4 */ virtual int GetPolyAtt0Material(cBgS_PolyInfo const &) = 0;
/* 0x0B8 */ virtual int GetPolyAtt0(cBgS_PolyInfo const &) = 0;
/* 0x0Bc */ virtual int GetPolyAtt1(cBgS_PolyInfo const &) = 0;
/* 0x0C0 */ virtual int GetGroundCode(cBgS_PolyInfo const &) = 0;
/* 0x0C4 */ virtual u32 GetCode1_0x02000000(int) = 0;
/* 0x0C8 */ virtual u32 GetCode1_0x04000000(int) = 0;
/* 0x0CC */ virtual u32 GetCode1_0x08000000(int) = 0;
/* 0x0D0 */ virtual u32 GetLightingCode(cBgS_PolyInfo const &) = 0;
/* 0x0D4 */ virtual s32 GetCamMoveBG(cBgS_PolyInfo const &) = 0;
/* 0x0D8 */ virtual s32 GetRoomCamId(cBgS_PolyInfo const &) = 0;
/* 0x0DC */ virtual s32 GetRoomPathId(cBgS_PolyInfo const &) = 0;
/* 0x0E0 */ virtual s32 GetRoomPathPntNo(cBgS_PolyInfo const &) = 0;
/* 0x0E4 */ virtual void CrrPos(cBgS_PolyInfo const &, void *, bool, mVec3_c *, mAng3_c *, mAng3_c *) = 0;
/* 0x0E8 */ virtual void TransPos(cBgS_PolyInfo const &, void *, bool, mVec3_c *, mAng3_c *, mAng3_c *) = 0;
/* 0x0EC */ virtual void MatrixCrrPos(cBgS_PolyInfo const &, void *, bool, mVec3_c *, mAng3_c *, mAng3_c *) = 0;
/* 0x0F0 */ virtual void CallRideCallback(dAcObjBase_c *, dAcObjBase_c *);
/* 0x0F4 */ virtual void CallArrowStickCallback(dAcObjBase_c *, dAcObjBase_c *, mVec3_c &);
/* 0x0F8 */ virtual bool CallUnkCallback(dAcObjBase_c *, dAcObjBase_c *);
/* 0x0FC */ virtual bool UpdateDraw(mAllocator_c *);
/* 0x100 */ virtual bool GetIsDraw(int) = 0;
/* 0x104 */ virtual void DrawOnMap(int, bool) = 0;
u16 GetRegistId() const {
return mRegistId;
}
PushPull_CallBack GetPushPullCallback() const {
return mpPushPull_cb;
}
s16 GetDiffShapeAngleY() {
return mDiffShapeAngleY;
}
int GetRoomId() {
return mRoomId;
}
void ClearMap() {
for (int i = 0; i < 31; i++) {
mMapRelated[i].Clear();
}
}
void ClearMapCount() {
for (int i = 0; i < 31; i++) {
mMapRelated[i].mCount = 0;
}
}
void SetMapCount(int c) {
for (int i = 0; i < 31; i++) {
mMapRelated[i].mCount = c;
}
}
void SetPushPullCallback(PushPull_CallBack i_callBack) {
mpPushPull_cb = i_callBack;
}
void SetRoomId(int id) {
mRoomId = id;
}
bool ChkPriority(int prio) {
return mPriority == prio;
}
void SetPriority(PRIORITY priority) {
mPriority = priority;
}
void OnStickWall() {
field_0x24 |= 1;
}
void OnStickRoof() {
field_0x24 |= 2;
}
cPartition &GetPartition() {
return mPartitionInfo;
}
u16 GetField_0x20() const {
return field_0x20;
}
u16 GetField_0x22() const {
return field_0x22;
}
bool ChkStickWall() const {
return field_0x24 & 1;
}
bool ChkStickRoof() const {
return field_0x24 & 2;
}
bool Chk0x24_0x20() const {
return field_0x24 & 0x20;
}
// private:
/* 0x08 */ cPartition mPartitionInfo;
/* 0x18 */ dBgW_Base_0x18 mField_0x18;
/* 0x20 */ u16 field_0x20;
/* 0x22 */ u16 field_0x22;
/* 0x24 */ u16 field_0x24;
/* 0x26 */ s16 mOldShapeAngleY;
/* 0x28 */ s16 mDiffShapeAngleY;
/* 0x2A */ u16 mRegistId;
/* 0x2C */ u8 mPriority;
/* 0x2D */ u8 mRoomId;
/* 0x2E */ u8 field_0x2E;
/* 0x2F */ s8 field_0x2F;
/* 0x30 */ PushPull_CallBack mpPushPull_cb;
/* 0x34 */ dBgW_Base_MapRelated mMapRelated[31];
}; // Size: 0x12C
#endif
+174
View File
@@ -0,0 +1,174 @@
#ifndef D_BG_W_KCOL_H
#define D_BG_W_KCOL_H
#include "d/col/bg/d_bg_plc.h"
#include "d/col/bg/d_bg_w_base.h"
#include "d/col/c/c_bg_s_chk.h"
#include "d/col/c/c_m3d_g_aab.h"
class cBgS_GrpPassChk;
class cBgS_PolyPassChk;
struct dBgPc;
struct dBgS_CaptPoly;
struct KC_PrismData {
/* 0x0 */ f32 mHeight;
/* 0x4 */ u16 mPosIdx;
/* 0x6 */ u16 mFaceNrmIdx;
/* 0x8 */ u16 mEdgeNrmIdx1;
/* 0xA */ u16 mEdgeNrmIdx2;
/* 0xC */ u16 mEdgeNrmIdx3;
/* 0xE */ u16 mAttribute;
}; // Size: 0x10
struct pkcdata {
/* 0x00 */ mVec3_c *mpPositionData;
/* 0x04 */ mVec3_c *mpNormalData;
/* 0x08 */ KC_PrismData *mpPrismData;
/* 0x0C */ u32 *mpBlockData;
/* 0x10 */ u8 field_0x10[4];
/* 0x14 */ mVec3_c mAreaMinPos;
/* 0x20 */ u32 mAreaWidthMaskX;
/* 0x24 */ u32 mAreaWidthMaskY;
/* 0x28 */ u32 mAreaWidthMaskZ;
/* 0x2C */ u32 mShiftBlockWidth;
/* 0x30 */ u32 mShiftY;
/* 0x34 */ u32 mShiftZ;
};
struct KCol_Header {
/* 0x0 */ u32 pos_data_offset;
/* 0x4 */ u32 nrm_data_offset;
/* 0x8 */ u32 prism_data_offset;
/* 0xC */ u32 block_data_offset;
};
// Made up?
struct KC_Tri {
mVec3_c mA;
mVec3_c mB;
mVec3_c mC;
};
class dBgWKCol : public dBgW_Base {
public:
dBgWKCol();
static void initKCollision(void *);
void Set(void *pprism, void *plc);
void GetTriNrm(KC_PrismData *, mVec3_c **) const;
cM3dGPla GetTriPla(int) const;
bool GetTriPnt(KC_PrismData const *, mVec3_c *, mVec3_c *, mVec3_c *) const;
bool GetTriPnt(int, mVec3_c *, mVec3_c *, mVec3_c *) const;
void GetPolyCode(int, dBgPc *) const;
// These two functions are similar, first one checks roof, second doesnt. Idk a good name
static bool ChkPolyThrough(int id, dBgPc *, cBgS_Chk *);
static bool ChkPolyThroughGnd(int id, dBgPc *, cBgS_Chk *);
bool ChkShdwDrawThrough(dBgPc *);
int GetMapCode(KC_PrismData *prism, int *pOut);
void DrawMapSection(int, f32, f32, f32);
int GetPrismIdx(const KC_PrismData *);
/* vt at 0x08 */
/* 0x008 */ virtual ~dBgWKCol() override;
/* 0x014 */ virtual void GetTopUnder(f32 *pOutTop, f32 *pOutUnder) const override;
/* 0x018 */ virtual bool ChkNotReady() const override;
/* 0x01C */ virtual bool ChkLock() const override;
/* 0x020 */ virtual bool ChkMoveBg() const override;
/* 0x024 */ virtual u32 ChkMoveFlag() const override;
/* 0x028 */ virtual void GetTriPla(cBgS_PolyInfo const &, cM3dGPla *) const override;
/* 0x02C */ virtual bool GetTriPnt(cBgS_PolyInfo const &, mVec3_c *, mVec3_c *, mVec3_c *) const override;
/* 0x030 */ virtual const cM3dGAab *GetBnd() const override;
/* 0x034 */ virtual u32 GetGrpInf(cBgS_PolyInfo const &) const override;
/* 0x038 */ virtual void OffMoveFlag() override;
/* 0x03C */ virtual void vt_0x3C() override;
/* 0x040 */ virtual bool LineCheck(cBgS_LinChk *) override;
/* 0x044 */ virtual bool GroundCross(cBgS_GndChk *) override;
/* 0x048 */ virtual void ShdwDraw(cBgS_ShdwDraw *) override;
/* 0x04C */ virtual void CaptPoly(dBgS_CaptPoly &) override;
/* 0x050 */ virtual bool WallCorrect(dBgS_Acch *) override;
/* 0x054 */ virtual bool WallCorrectSort(dBgS_Acch *) override;
/* 0x058 */ virtual bool RoofChk(dBgS_RoofChk *) override;
/* 0x05C */ virtual bool SplGrpChk(dBgS_SplGrpChk *) override;
/* 0x060 */ virtual bool SphChk(dBgS_SphChk *, void *) override;
/* 0x064 */ virtual s32 GetGrpRoomIndex(cBgS_PolyInfo const &) const override;
/* 0x068 */ virtual s32 GetExitId(cBgS_PolyInfo const &) override;
/* 0x06C */ virtual s32 GetZTargetThrough(cBgS_PolyInfo const &) override;
/* 0x070 */ virtual int GetSpecialCode(cBgS_PolyInfo const &) override;
/* 0x074 */ virtual int GetSpecialCode(int) override;
/* 0x078 */ virtual int GetCode0_0x30000000(cBgS_PolyInfo const &) override;
/* 0x07C */ virtual u32 GetPolyObjThrough(int) override;
/* 0x080 */ virtual u32 GetPolyCamThrough(int) override;
/* 0x084 */ virtual u32 GetPolyLinkThrough(int) override;
/* 0x088 */ virtual u32 GetPolyArrowThrough(int) override;
/* 0x08C */ virtual u32 GetPolySlingshotThrough(int) override;
/* 0x090 */ virtual u32 GetPolyBeetleThrough(int) override;
/* 0x094 */ virtual u32 GetPolyClawshotThrough(int) override;
/* 0x098 */ virtual u32 GetPolyBombThrough(int) override;
/* 0x09C */ virtual u32 GetPolyWhipThrough(int) override;
/* 0x0A0 */ virtual u32 GetShdwThrough(int) override;
/* 0x0A4 */ virtual u32 GetUnderwaterRoofCode(int) override;
/* 0x0A8 */ virtual int GetCode0_0x80000000(cBgS_PolyInfo const &) override;
/* 0x0AC */ virtual int GetLinkNo(cBgS_PolyInfo const &) override;
/* 0x0B0 */ virtual s32 GetWallCode(cBgS_PolyInfo const &) override;
/* 0x0B4 */ virtual int GetPolyAtt0Material(cBgS_PolyInfo const &) override;
/* 0x0B8 */ virtual int GetPolyAtt0(cBgS_PolyInfo const &) override;
/* 0x0Bc */ virtual int GetPolyAtt1(cBgS_PolyInfo const &) override;
/* 0x0C0 */ virtual int GetGroundCode(cBgS_PolyInfo const &) override;
/* 0x0C4 */ virtual u32 GetCode1_0x02000000(int) override;
/* 0x0C8 */ virtual u32 GetCode1_0x04000000(int) override;
/* 0x0CC */ virtual u32 GetCode1_0x08000000(int) override;
/* 0x0D0 */ virtual u32 GetLightingCode(cBgS_PolyInfo const &) override;
/* 0x0D4 */ virtual s32 GetCamMoveBG(cBgS_PolyInfo const &) override;
/* 0x0D8 */ virtual s32 GetRoomCamId(cBgS_PolyInfo const &) override;
/* 0x0DC */ virtual s32 GetRoomPathId(cBgS_PolyInfo const &) override;
/* 0x0E0 */ virtual s32 GetRoomPathPntNo(cBgS_PolyInfo const &) override;
/* 0x0E4 */ virtual void CrrPos(cBgS_PolyInfo const &, void *, bool, mVec3_c *, mAng3_c *, mAng3_c *) override;
/* 0x0E8 */ virtual void TransPos(cBgS_PolyInfo const &, void *, bool, mVec3_c *, mAng3_c *, mAng3_c *) override;
/* 0x0EC */ virtual void
MatrixCrrPos(cBgS_PolyInfo const &, void *, bool, mVec3_c *, mAng3_c *, mAng3_c *) override;
/* 0x0FC */ virtual bool UpdateDraw(mAllocator_c *) override;
/* 0x100 */ virtual bool GetIsDraw(int) override;
/* 0x104 */ virtual void DrawOnMap(int, bool) override;
KC_PrismData *GetPrismData(int poly_index) const {
return &mpKCHead->mpPrismData[poly_index];
}
mVec3_c *GetTriPos(const KC_PrismData *pd) const {
return &mpKCHead->mpPositionData[pd->mPosIdx];
}
mVec3_c *GetTriNrm(const KC_PrismData *pd) const {
return &mpKCHead->mpNormalData[pd->mFaceNrmIdx];
}
mVec3_c *GetEdgeNrm1(const KC_PrismData *pd) const {
return &mpKCHead->mpNormalData[pd->mEdgeNrmIdx1];
}
mVec3_c *GetEdgeNrm2(const KC_PrismData *pd) const {
return &mpKCHead->mpNormalData[pd->mEdgeNrmIdx2];
}
mVec3_c *GetEdgeNrm3(const KC_PrismData *pd) const {
return &mpKCHead->mpNormalData[pd->mEdgeNrmIdx3];
}
const dBgPc *GetPolyCode(int polyIdx) const {
return mCode.GetDBgPc(mpKCHead->mpPrismData[polyIdx].mAttribute);
}
KC_Tri *GetTri(int idx) {
return &mpTri[idx];
}
private:
/* 0x12C */ pkcdata *mpKCHead;
/* 0x130 */ dBgPlc mCode;
/* 0x134 */ cM3dGAab mBnd;
/* 0x14C */ u32 mNumPrism;
/* 0x150 */ u32 mAreaWidthMaskX;
/* 0x154 */ u32 mAreaWidthMaskY;
/* 0x158 */ u32 mAreaWidthMaskZ;
/* 0x15C */ KC_Tri *mpTri;
};
#endif /* D_BG_D_BG_W_KCOL_H */
+30
View File
@@ -0,0 +1,30 @@
#ifndef D_BG_W_SV_H
#define D_BG_W_SV_H
#include "d/col/bg/d_bg_w.h"
class dBgWSv : public dBgW {
public:
dBgWSv();
bool Set(cBgD_t *pDzb, PLC *pPlc, u32 p3, bool p4);
void CopyBackVtx();
bool CrrPosWork(mVec3_c *, int, int, int);
bool TransPosWork(mVec3_c *, int, int, int);
void ApplyMtx(mMtx_c *);
void SetTriHeight(int, f32);
nw4r::math::VEC3 *GetTri(int);
virtual ~dBgWSv();
/* 0x0E4 */ virtual void CrrPos(cBgS_PolyInfo const &, void *, bool, mVec3_c *, mAng3_c *, mAng3_c *) override;
/* 0x0E8 */ virtual void TransPos(cBgS_PolyInfo const &, void *, bool, mVec3_c *, mAng3_c *, mAng3_c *) override;
/* 0x0EC */ virtual void
MatrixCrrPos(cBgS_PolyInfo const &, void *, bool, mVec3_c *, mAng3_c *, mAng3_c *) override;
private:
/* 0x210 */ nw4r::math::VEC3 *mpVtx;
/* 0x214 */ u32 mField_0x214;
};
#endif
+82
View File
@@ -0,0 +1,82 @@
#ifndef D_BG_W_TIME_H
#define D_BG_W_TIME_H
#include "d/col/bg/d_bg_w_base.h"
#include "d/col/c/c_bg_s_chk.h"
#include "d/col/c/c_m3d_g_cyl.h"
class dBgWTime : public dBgW_Base {
public:
dBgWTime();
bool fn_803537a0(mVec3_c *, cBgS_Chk *);
void fn_80353a00(cBgS_PolyInfo *, mVec3_c *);
/* vt at 0x08 */
/* 0x008 */ virtual ~dBgWTime();
/* 0x014 */ virtual void GetTopUnder(f32 *pOutTop, f32 *pOutUnder) const override;
/* 0x018 */ virtual bool ChkNotReady() const override;
/* 0x01C */ virtual bool ChkLock() const override;
/* 0x020 */ virtual bool ChkMoveBg() const override;
/* 0x024 */ virtual u32 ChkMoveFlag() const override;
/* 0x028 */ virtual void GetTriPla(cBgS_PolyInfo const &, cM3dGPla *) const;
/* 0x02C */ virtual bool GetTriPnt(cBgS_PolyInfo const &, mVec3_c *, mVec3_c *, mVec3_c *) const override;
/* 0x030 */ virtual const cM3dGAab *GetBnd() const override;
/* 0x034 */ virtual u32 GetGrpInf(cBgS_PolyInfo const &) const override;
/* 0x038 */ virtual void OffMoveFlag() override;
/* 0x03C */ virtual void vt_0x3C() override;
/* 0x040 */ virtual bool LineCheck(cBgS_LinChk *) override;
/* 0x044 */ virtual bool GroundCross(cBgS_GndChk *) override;
/* 0x048 */ virtual void ShdwDraw(cBgS_ShdwDraw *) override;
/* 0x04C */ virtual void CaptPoly(dBgS_CaptPoly &) override;
/* 0x050 */ virtual bool WallCorrect(dBgS_Acch *) override;
/* 0x054 */ virtual bool WallCorrectSort(dBgS_Acch *) override;
/* 0x058 */ virtual bool RoofChk(dBgS_RoofChk *) override;
/* 0x05C */ virtual bool SplGrpChk(dBgS_SplGrpChk *) override;
/* 0x060 */ virtual bool SphChk(dBgS_SphChk *, void *) override;
/* 0x064 */ virtual s32 GetGrpRoomIndex(cBgS_PolyInfo const &) const override;
/* 0x068 */ virtual s32 GetExitId(cBgS_PolyInfo const &) override;
/* 0x06C */ virtual s32 GetZTargetThrough(cBgS_PolyInfo const &) override;
/* 0x070 */ virtual int GetSpecialCode(cBgS_PolyInfo const &) override;
/* 0x074 */ virtual int GetSpecialCode(int) override;
/* 0x078 */ virtual int GetCode0_0x30000000(cBgS_PolyInfo const &) override;
/* 0x07C */ virtual u32 GetPolyObjThrough(int) override;
/* 0x080 */ virtual u32 GetPolyCamThrough(int) override;
/* 0x084 */ virtual u32 GetPolyLinkThrough(int) override;
/* 0x088 */ virtual u32 GetPolyArrowThrough(int) override;
/* 0x08C */ virtual u32 GetPolySlingshotThrough(int) override;
/* 0x090 */ virtual u32 GetPolyBeetleThrough(int) override;
/* 0x094 */ virtual u32 GetPolyClawshotThrough(int) override;
/* 0x098 */ virtual u32 GetPolyBombThrough(int) override;
/* 0x09C */ virtual u32 GetPolyWhipThrough(int) override;
/* 0x0A0 */ virtual u32 GetShdwThrough(int) override;
/* 0x0A4 */ virtual u32 GetUnderwaterRoofCode(int) override;
/* 0x0A8 */ virtual int GetCode0_0x80000000(cBgS_PolyInfo const &) override;
/* 0x0AC */ virtual int GetLinkNo(cBgS_PolyInfo const &) override;
/* 0x0B0 */ virtual s32 GetWallCode(cBgS_PolyInfo const &) override;
/* 0x0B4 */ virtual int GetPolyAtt0Material(cBgS_PolyInfo const &) override;
/* 0x0B8 */ virtual int GetPolyAtt0(cBgS_PolyInfo const &) override;
/* 0x0Bc */ virtual int GetPolyAtt1(cBgS_PolyInfo const &) override;
/* 0x0C0 */ virtual int GetGroundCode(cBgS_PolyInfo const &) override;
/* 0x0C4 */ virtual u32 GetCode1_0x02000000(int) override;
/* 0x0C8 */ virtual u32 GetCode1_0x04000000(int) override;
/* 0x0CC */ virtual u32 GetCode1_0x08000000(int) override;
/* 0x0D0 */ virtual u32 GetLightingCode(cBgS_PolyInfo const &) override;
/* 0x0D4 */ virtual s32 GetCamMoveBG(cBgS_PolyInfo const &) override;
/* 0x0D8 */ virtual s32 GetRoomCamId(cBgS_PolyInfo const &) override;
/* 0x0DC */ virtual s32 GetRoomPathId(cBgS_PolyInfo const &) override;
/* 0x0E0 */ virtual s32 GetRoomPathPntNo(cBgS_PolyInfo const &) override;
/* 0x0E4 */ virtual void CrrPos(cBgS_PolyInfo const &, void *, bool, mVec3_c *, mAng3_c *, mAng3_c *) override;
/* 0x0E8 */ virtual void TransPos(cBgS_PolyInfo const &, void *, bool, mVec3_c *, mAng3_c *, mAng3_c *) override;
/* 0x0EC */ virtual void
MatrixCrrPos(cBgS_PolyInfo const &, void *, bool, mVec3_c *, mAng3_c *, mAng3_c *) override;
/* 0x100 */ virtual bool GetIsDraw(int) override;
/* 0x104 */ virtual void DrawOnMap(int, bool) override;
/* 0x12C */ cM3dGCyl mCyl;
/* 0x140 */ cM3dGAab mBnd;
static cBgD_Vtx_t sVtx[3];
};
#endif
+74
View File
@@ -0,0 +1,74 @@
#ifndef C_BG_S_CHK_H
#define C_BG_S_CHK_H
#include "d/col/bg/d_bg_w_base.h"
#include "d/col/c/c_partition.h"
#include "f/f_base.h"
#include "rvl/MTX.h"
struct cBgD_Vtx_t : public nw4r::math::VEC3 {};
class cBgS_GrpPassChk {
public:
cBgS_GrpPassChk();
virtual ~cBgS_GrpPassChk();
};
class cBgS_PolyPassChk;
class cBgS_Chk {
public:
/* 0x00 */ cBgS_PolyPassChk *mPolyPassChk;
/* 0x04 */ cBgS_GrpPassChk *mGrpPassChk;
/* 0x08 */ u32 mActorId;
/* 0x0C */ u16 mField_0x0C;
/* 0x0E */ u16 mField_0x0E;
/* 0x10 */ u8 mField_0x10;
/* 0x14 */ cPartition mPartition;
/* 0x24 */ // __vtable__
public:
cBgS_Chk();
virtual ~cBgS_Chk();
void SetActorID(u32 *);
void SetPolyPassChk(cBgS_PolyPassChk *p_chk) {
mPolyPassChk = p_chk;
}
void SetGrpPassChk(cBgS_GrpPassChk *p_chk) {
mGrpPassChk = p_chk;
}
cBgS_PolyPassChk *GetPolyPassChk() const {
return mPolyPassChk;
}
cBgS_GrpPassChk *GetGrpPassChk() const {
return mGrpPassChk;
}
int ChkSameActorPid(const fBase_c *pActor) const {
int id = pActor ? pActor->unique_ID : 0;
if (id == 0 || mActorId == 0 || mField_0x10 == 0) {
return false;
}
return mActorId == id ? 1 : 0;
}
bool ChkField_0xC(const dBgW_Base *pBg) const {
return mField_0x0C & pBg->GetField_0x20();
}
bool ChkField_0xE(const dBgW_Base *pBg) const {
return mField_0x0E & pBg->GetField_0x22();
}
void SetExtChk(const cBgS_Chk &other) {
mPolyPassChk = other.mPolyPassChk;
mGrpPassChk = other.mGrpPassChk;
mActorId = other.mActorId;
mField_0x10 = other.mField_0x10;
mField_0x0C = other.mField_0x0C;
mField_0x0E = other.mField_0x0E;
}
};
#endif
+41
View File
@@ -0,0 +1,41 @@
#ifndef C_BG_S_GND_CHK_H
#define C_BG_S_GND_CHK_H
#include "d/col/c/c_bg_s_chk.h"
#include "d/col/c/c_bg_s_poly_info.h"
#include "m/m_vec.h"
class cBgS_GndChk : public cBgS_Chk, public cBgS_PolyInfo {
public:
/* 0x54 */ mVec3_c mPos;
/* 0x60 */ f32 mNowY;
/* 0x64 */ u8 unk0x64[0x68 - 0x64];
/* 0x68 */ mVec3_c mField_0x68;
/* 0x74 */ u8 mField_0x74;
cBgS_GndChk();
virtual ~cBgS_GndChk();
void SetPos(mVec3_c const &);
void SetPos(mVec3_c const *);
f32 GetNowY() const {
return mNowY;
}
void SetNowY(f32 y) {
mNowY = y;
}
const mVec3_c &GetPointP() {
return mPos;
}
void SetField_0x68(const mVec3_c &other) {
mField_0x68 = other;
}
// u32 GetWallPrecheck() const {
// return mWallPrecheck;
// }
// void OffWall() {
// mFlags &= ~2;
// }
};
#endif
+65
View File
@@ -0,0 +1,65 @@
#ifndef C_BG_S_LIN_CHK_H
#define C_BG_S_LIN_CHK_H
#include "d/col/c/c_bg_s_chk.h"
#include "d/col/c/c_bg_s_poly_info.h"
#include "d/col/c/c_m3d_g_lin.h"
class cBgS_LinChk : public cBgS_Chk, public cBgS_PolyInfo {
public:
/* 0x54 */ cM3dGLin mLin;
/* 0x6C */ mVec3_c mField_0x6C;
/* 0x78 */ bool mFrontFlag;
/* 0x79 */ bool mBackFlag;
/* 0x7A */ bool mHit;
/* 0x7B */ bool mPreRoofChk;
/* 0x7C */ bool mPreWallChk;
/* 0x7D */ bool mPreGroundChk;
cBgS_LinChk();
virtual ~cBgS_LinChk();
virtual void SetEnd(const mVec3_c *);
void Ct();
void Set2(const mVec3_c &, const mVec3_c &, u32);
bool ChkHit() const {
return mHit;
}
void ClrHit() {
mHit = false;
}
void SetHit() {
mHit = true;
}
bool ChkBackFlag() const {
return mBackFlag;
}
void OnBackFlag() {
mBackFlag = true;
}
bool ChkFrontFlag() const {
return mFrontFlag;
}
void OnFrontFlag() {
mFrontFlag = true;
}
bool GetPreWallChk() const {
return mPreWallChk;
}
bool GetPreGroundChk() const {
return mPreGroundChk;
}
bool GetPreRoofChk() const {
return mPreRoofChk;
}
const mVec3_c &GetLinStart() const {
return mLin.mStart;
}
const mVec3_c &GetLinEnd() const {
return mLin.mEnd;
}
};
#endif
+62
View File
@@ -0,0 +1,62 @@
#ifndef C_BG_S_POLY_INFO_H
#define C_BG_S_POLY_INFO_H
#include "common.h"
#include "d/col/c/c_bg_w.h"
#include "d/col/c/c_m3d_g_pla.h"
#include "m/m_vec.h"
class cBgS_PolyInfo {
private:
/* 0x00 */ int mPolyIndex;
/* 0x04 */ int mBgIndex;
/* 0x08 */ void *unk_0x04; // Collision Pointer?
/* 0x0C */ int mActorPId; // Matched the Unique Actor Id
/* 0x10 */ cM3dGPla mPla;
/* 0x20 */ mVec3_c mField_0x20;
public:
cBgS_PolyInfo() {
ClearPi();
}
bool ChkSetInfo() const;
void SetPolyInfo(const cBgS_PolyInfo &);
bool ChkSafe(const void *, s32) const;
void SetPolyIndex(int idx) {
mPolyIndex = idx;
}
bool ChkBgIndex() const;
mAng GetAngle(mAng) const;
void SetActorInfo(int bgIndex, void *pData, u32 actor_pid) {
mBgIndex = bgIndex;
unk_0x04 = pData;
mActorPId = actor_pid;
}
void ClearPi() {
mPolyIndex = 0xFFFF;
mBgIndex = BG_ID_MAX;
unk_0x04 = nullptr;
mActorPId = 0;
}
u32 GetPolyIndex() const {
return mPolyIndex;
}
u32 GetBgIndex() const {
return mBgIndex;
}
const cM3dGPla &GetPlane() const {
return mPla;
}
cM3dGPla *GetPlaneP() {
return &mPla;
}
const mVec3_c &GetField0x20() const {
return mField_0x20;
}
};
#endif
+33
View File
@@ -0,0 +1,33 @@
#ifndef C_BG_S_SHDW_DRAW_H
#define C_BG_S_SHDW_DRAW_H
#include "common.h"
#include "d/col/c/c_bg_s_chk.h"
#include "d/col/c/c_m3d_g_lin.h"
#include "d/col/c/c_m3d_g_pla.h"
#include "d/col/c/c_m3d_g_tri.h"
#include "m/m_vec.h"
class cBgS_ShdwDraw;
typedef void (*cBgS_ShdwDraw_Callback)(cBgS_ShdwDraw *, const mVec3_c &, const mVec3_c &, const mVec3_c &, const cM3dGTri &);
class cBgS_ShdwDraw : public cBgS_Chk {
public:
/* 0x28 */ cM3dGAab mBnd;
/* 0x40 */ cM3dGPla *mpPla;
/* 0x44 */ cBgS_ShdwDraw_Callback mpCallback;
cBgS_ShdwDraw();
virtual ~cBgS_ShdwDraw();
void Set(const mVec3_c &, const mVec3_c &);
void SetCallback(cBgS_ShdwDraw_Callback);
void SetP(cM3dGPla *);
void Calc(cM3dGTri *, mVec3_c *, mVec3_c *, mVec3_c *);
cM3dGAab *GetBndP() {
return &mBnd;
}
};
#endif
+62
View File
@@ -0,0 +1,62 @@
#ifndef C_BG_W_H
#define C_BG_W_H
#include "common.h"
enum {
BG_ID_MAX = 600
};
class cBgW_BgId {
private:
/* 0x0 */ s16 m_id;
/* 0x4 vtable */
public:
cBgW_BgId();
void Ct() {
m_id = BG_ID_MAX;
};
void Regist(int);
void Release();
bool ChkUsed() const;
virtual ~cBgW_BgId();
s16 GetId() const {
return m_id;
}
};
// Defines are required for these checks to not inline some float comp bool things
#if 1
#define cBgW_CheckBGround(f) (f > 0.5f)
#define cBgW_CheckBRoof(f) (f < (-4.0f / 5.0f))
inline bool cBgW_CheckBWall(f32 a1) {
if (!cBgW_CheckBGround(a1) && !cBgW_CheckBRoof(a1)) {
return true;
}
return false;
}
#else
inline bool cBgW_CheckBGround(f32 f) {
return f > 0.5f;
}
inline bool cBgW_CheckBRoof(f32 a1) {
return a1 <= (-4.0f / 5.0f);
}
inline bool cBgW_CheckBWall(f32 a1) {
if (!cBgW_CheckBGround(a1) && !cBgW_CheckBRoof(a1)) {
return true;
}
return false;
}
#endif
#endif
+4
View File
@@ -0,0 +1,4 @@
#ifndef C_CC_D_H
#define C_CC_D_H
#endif
+60
View File
@@ -0,0 +1,60 @@
#ifndef C_CC_S_H
#define C_CC_S_H
#include "d/col/c/c_cc_d.h"
enum WeightType {
WeightType_0 = 0,
WeightType_1 = 1,
WeightType_2 = 2,
};
// class cCcS {
// public:
// /* 0x0000 */ cCcD_Obj *mpObjAt[0x100];
// /* 0x0400 */ cCcD_Obj *mpObjTg[0x300];
// /* 0x1000 */ cCcD_Obj *mpObjCo[0x100];
// /* 0x1400 */ cCcD_Obj *mpObj[0x500];
// /* 0x2800 */ u16 mObjAtCount;
// /* 0x2802 */ u16 mObjTgCount;
// /* 0x2804 */ u16 mObjCoCount;
// /* 0x2806 */ u16 mObjCount;
// /* 0x2808 */ cCcD_DivideArea mDivideArea;
// /* 0x2848 vtable */
// /* 80264A6C */ cCcS();
// /* 80264A94 */ void Ct();
// /* 80264B60 */ void Dt();
// /* 80264B80 */ WeightType GetWt(u8) const;
// /* 80264BA8 */ void Set(cCcD_Obj *);
// /* 80264C5C */ void ClrCoHitInf();
// /* 80264CF0 */ void ClrTgHitInf();
// /* 80264D90 */ void ClrAtHitInf();
// /* 80264E2C */ bool ChkNoHitAtTg(cCcD_Obj *, cCcD_Obj *);
// /* 80264F40 */ void ChkAtTg();
// /* 8026515C */ bool ChkNoHitCo(cCcD_Obj *, cCcD_Obj *);
// /* 80265230 */ void ChkCo();
// /* 802653A0 vt[2] */ virtual void CalcTgPlusDmg(cCcD_Obj *, cCcD_Obj *, cCcD_Stts *, cCcD_Stts *);
// /* 802653C8 */ void SetAtTgCommonHitInf(cCcD_Obj *, cCcD_Obj *, cXyz *);
// /* 802655E4 */ void SetCoCommonHitInf(cCcD_Obj *, cXyz *, cCcD_Obj *, cXyz *, f32);
// /* 80265750 vt[3]*/ virtual void SetPosCorrect(cCcD_Obj *, cXyz *, cCcD_Obj *, cXyz *, f32);
// /* 80265BB4 */ void CalcArea();
// /* 80265CCC */ void Move();
// /* 80265D30 */ void DrawClear();
// /* 80265DF8 vt[4] */ virtual void
// SetCoGObjInf(bool, bool, cCcD_GObjInf *, cCcD_GObjInf *, cCcD_Stts *, cCcD_Stts *, cCcD_GStts *, cCcD_GStts *);
// /* 80265DFC vt[5] */ virtual void
// SetAtTgGObjInf(bool, bool, cCcD_Obj *, cCcD_Obj *, cCcD_GObjInf *, cCcD_GObjInf *, cCcD_Stts *, cCcD_Stts *,
// cCcD_GStts *, cCcD_GStts *, cXyz *);
// /* 80265E00 vt[6] */ virtual bool
// ChkNoHitGAtTg(cCcD_GObjInf const *, cCcD_GObjInf const *, cCcD_GStts *, cCcD_GStts *);
// /* 80265E08 vt[7] */ virtual bool
// ChkAtTgHitAfterCross(bool, bool, cCcD_GObjInf const *, cCcD_GObjInf const *, cCcD_Stts *, cCcD_Stts *, cCcD_GStts *,
// cCcD_GStts *);
// /* 80265E10 vt[8] */ virtual bool ChkNoHitGCo(cCcD_Obj *, cCcD_Obj *);
// /* 80030BDC vt[9] */ virtual ~cCcS() {}
// /* 80265E18 vt[10] */ virtual void MoveAfterCheck();
// /* 80265DF4 vt[11] */ virtual void SetCoGCorrectProc(cCcD_Obj *, cCcD_Obj *);
// }; // Size = 0x284C
#endif /* C_CC_S_H */
+8
View File
@@ -0,0 +1,8 @@
#ifndef C_M2D_H
#define C_M2D_H
struct cM2dGCir;
void cM2d_CrossCirLin(cM2dGCir &, float, float, float, float, float *, float *);
#endif
+106
View File
@@ -0,0 +1,106 @@
#ifndef C_M3D_H
#define C_M3D_H
#include "nw4r/math.h"
#include <common.h>
#include <math.h>
class cM3dGAab;
class cM3dGCps;
class cM3dGCyl;
class cM3dGLin;
class cM3dGPla;
class cM3dGSph;
class cM3dGTri;
class cM3dGUnk;
class mAng3_c;
struct cM3d_Range;
struct nw4r::math::VEC3;
extern const f32 G_CM3D_F_ABS_MIN;
bool cM3d_Len2dSqPntAndSegLine(f32, f32, f32, f32, f32, f32, f32 *, f32 *, f32 *);
bool cM3d_Len3dSqPntAndSegLine(const cM3dGLin *, const nw4r::math::VEC3 *, nw4r::math::VEC3 *, f32 *, f32 *);
f32 cM3d_SignedLenPlaAndPos(const cM3dGPla *, const nw4r::math::VEC3 *);
void cM3d_CalcPla(const nw4r::math::VEC3 *, const nw4r::math::VEC3 *, const nw4r::math::VEC3 *, nw4r::math::VEC3 *, f32 *);
int cM3d_Check_LinLin(const cM3dGLin *, const cM3dGLin *, f32 *, f32 *);
bool cM3d_Cross_LinPla(const cM3dGLin *, const cM3dGPla *, nw4r::math::VEC3 *, bool, bool);
bool cM3d_Cross_MinMaxBoxLine(const nw4r::math::VEC3 *, const nw4r::math::VEC3 *, const nw4r::math::VEC3 *, const nw4r::math::VEC3 *);
bool cM3d_InclusionCheckPosIn3PosBox3d(
const nw4r::math::VEC3 *, const nw4r::math::VEC3 *, const nw4r::math::VEC3 *, const nw4r::math::VEC3 *, f32
);
bool cM3d_CrossX_Tri(const cM3dGTri *, const nw4r::math::VEC3 *, f32);
bool cM3d_CrossX_Tri(const cM3dGTri *, const nw4r::math::VEC3 *);
bool cM3d_CrossY_Tri(const cM3dGTri *, const nw4r::math::VEC3 *);
bool cM3d_CrossY_Tri_Front(const nw4r::math::VEC3 &, const nw4r::math::VEC3 &, const nw4r::math::VEC3 &, const nw4r::math::VEC3 *);
bool cM3d_CrossY_Tri(const cM3dGTri *, const nw4r::math::VEC3 *, f32 *);
bool cM3d_CrossY_Tri(const cM3dGTri *, const nw4r::math::VEC3 *, f32);
bool cM3d_CrossY_Tri(const cM3dGTri *, const nw4r::math::VEC3 *, const cM3d_Range *, f32 *);
bool cM3d_CrossZ_Tri(const cM3dGTri *, const nw4r::math::VEC3 *, f32);
bool cM3d_CrossZ_Tri(const cM3dGTri *, const nw4r::math::VEC3 *);
bool cM3d_CrossZ_Tri(const cM3dGTri *, const nw4r::math::VEC3 *, f32 *);
bool cM3d_Cross_LinTri(const cM3dGLin *, const cM3dGTri *, nw4r::math::VEC3 *, bool, bool);
bool cM3d_Cross_LinTri(
const cM3dGLin *, const nw4r::math::VEC3 *, const nw4r::math::VEC3 *, const nw4r::math::VEC3 *, const cM3dGPla *,
nw4r::math::VEC3 *, bool, bool
);
bool cM3d_Cross_LinTri_Easy(const cM3dGTri *, const nw4r::math::VEC3 *);
bool cM3d_Cross_SphPnt(const cM3dGSph *, const nw4r::math::VEC3 *);
bool cM3d_Cross_LinSph(const cM3dGLin *, const cM3dGSph *, nw4r::math::VEC3 *);
bool cM3d_Cross_LinSph_CrossPos(const cM3dGSph &, const cM3dGLin &, nw4r::math::VEC3 *, nw4r::math::VEC3 *);
bool cM3d_Cross_CylSph(const cM3dGCyl *, const cM3dGSph *, f32 *);
bool cM3d_Cross_CylSph(const cM3dGCyl *, const cM3dGSph *, nw4r::math::VEC3 *, f32 *);
bool cM3d_Cross_SphSph(const cM3dGSph *, const cM3dGSph *, f32 *);
bool cM3d_Cross_SphSph(const cM3dGSph *, const cM3dGSph *, f32 *, f32 *);
bool cM3d_Cross_SphSph(const cM3dGSph *, const cM3dGSph *, nw4r::math::VEC3 *);
void cM3d_CalcSphVsTriCrossPoint(const cM3dGSph *, const cM3dGTri *, nw4r::math::VEC3 *);
bool cM3d_Cross_SphTri(const cM3dGSph *, const cM3dGTri *, nw4r::math::VEC3 *, f32 *, nw4r::math::VEC3 *);
bool cM3d_Cross_CylCyl(const cM3dGCyl *, const cM3dGCyl *, f32 *);
bool cM3d_Cross_CylCyl(const cM3dGCyl *, const cM3dGCyl *, nw4r::math::VEC3 *);
bool cM3d_Cross_CylTri(const cM3dGCyl *, const cM3dGTri *, nw4r::math::VEC3 *);
int cM3d_Cross_CylLin(const cM3dGCyl *, const cM3dGLin *, nw4r::math::VEC3 *, nw4r::math::VEC3 *);
int cM3d_Cross_CylPntPnt(const cM3dGCyl *, const nw4r::math::VEC3 *, const nw4r::math::VEC3 *, nw4r::math::VEC3 *, nw4r::math::VEC3 *);
bool cM3d_Cross_CylPnt(const cM3dGCyl *, const nw4r::math::VEC3 *);
bool cM3d_Cross_CpsSph_CrossPos(const cM3dGCps &, const cM3dGSph &, const nw4r::math::VEC3 &, nw4r::math::VEC3 *);
bool cM3d_Cross_CpsSph(const cM3dGCps &, const cM3dGSph &, nw4r::math::VEC3 *);
bool cM3d_Cross_TriTri(const cM3dGTri &, const cM3dGTri &, nw4r::math::VEC3 *);
bool cM3d_Cross_CpsTri(const cM3dGCps &, cM3dGTri, nw4r::math::VEC3 *);
void cM3d_CalcVecZAngle(const nw4r::math::VEC3 &, mAng3_c *);
void cM3d_PlaneCrossLineProcWork(f32, f32, f32, f32, f32, f32, f32, f32 *, f32 *);
int cM3d_2PlaneCrossLine(const cM3dGPla &, const cM3dGPla &, cM3dGLin *);
bool cM3d_3PlaneCrossPos(const cM3dGPla &, const cM3dGPla &, const cM3dGPla &, nw4r::math::VEC3 *);
f32 cM3d_lineVsPosSuisenCross(const cM3dGLin *, const nw4r::math::VEC3 *, nw4r::math::VEC3 *);
f32 cM3d_lineVsPosSuisenCross(const nw4r::math::VEC3 &, const nw4r::math::VEC3 &, const nw4r::math::VEC3 &, nw4r::math::VEC3 *);
bool fn_803354e0(cM3dGUnk *, cM3dGUnk *, nw4r::math::VEC3 *);
bool fn_80336110(cM3dGCyl *, cM3dGUnk *, nw4r::math::VEC3 *);
bool fn_803364e0(cM3dGCyl *, cM3dGUnk *, f32 *);
bool fn_80336d90(cM3dGCps *, cM3dGUnk *, nw4r::math::VEC3 *);
bool fn_80337690(cM3dGUnk *, cM3dGSph *, nw4r::math::VEC3 *);
bool fn_80337780(cM3dGUnk *, cM3dGSph *, f32 *);
inline bool cM3d_IsZero(f32 f) {
return fabsf(f) < G_CM3D_F_ABS_MIN;
}
// this is the inline cM3d_IsZero but inverted. Sometimes this will get a match where the regular cM3d_IsZero inline
// won't
inline bool cM3d_IsZero_inverted(f32 param_0) {
return !(fabsf(param_0) < G_CM3D_F_ABS_MIN);
}
inline void
cM3d_InDivPos1(const nw4r::math::VEC3 *pVecA, const nw4r::math::VEC3 *pVecB, f32 pF, nw4r::math::VEC3 *pOut) {
nw4r::math::VEC3 tmp;
VEC3Scale(&tmp, pVecB, pF);
VEC3Add(pOut, &tmp, pVecA);
}
inline void
cM3d_InDivPos2(const nw4r::math::VEC3 *pVecA, const nw4r::math::VEC3 *pVecB, f32 pF, nw4r::math::VEC3 *pOut) {
nw4r::math::VEC3 tmp;
VEC3Sub(&tmp, pVecB, pVecA);
cM3d_InDivPos1(pVecA, &tmp, pF, pOut);
}
#endif
+87
View File
@@ -0,0 +1,87 @@
#ifndef C_M3D_G_AAB_H
#define C_M3D_G_AAB_H
#include "d/col/c/c_m3d.h"
#include "d/col/c/c_m3d_g_lin.h"
#include "d/col/c/c_m3d_g_sph.h"
#include <common.h>
// Axis aligned bounding box
class cM3dGAab {
private:
public:
/* 0x00 */ mVec3_c mMin;
/* 0x0C */ mVec3_c mMax;
void SetBounds(const mVec3_c &, const mVec3_c &);
void Set(const mVec3_c &min, const mVec3_c &max) {
mMin = min;
mMax = max;
}
bool CrossY(const mVec3_c &) const;
bool UnderPlaneYUnder(f32) const;
bool TopPlaneYUnder(f32) const;
void SetMinMax(const cM3dGAab &);
void SetMin(const mVec3_c &min);
void SetMax(const mVec3_c &max);
void CalcCenter(mVec3_c &) const;
void PlusR(f32);
void Clamp(const mVec3_c &, mVec3_c &) const;
void Set(const cM3dGSph &);
bool Cross(const mVec3_c &) const;
void SetMinMax(const mVec3_c &minMax) {
SetMin(minMax);
SetMax(minMax);
}
void ClearForMinMax(void) {
mMin.z = 1000000000.0f;
mMin.y = 1000000000.0f;
mMin.x = 1000000000.0f;
mMax.z = -1000000000.0f;
mMax.y = -1000000000.0f;
mMax.x = -1000000000.0f;
}
const mVec3_c *GetMaxP(void) const {
return &mMax;
}
const mVec3_c *GetMinP(void) const {
return &mMin;
}
const f32 GetMaxX(void) const {
return mMax.x;
}
const f32 GetMaxY(void) const {
return mMax.y;
}
const f32 GetMaxZ(void) const {
return mMax.z;
}
const f32 GetMinX(void) const {
return mMin.x;
}
const f32 GetMinY(void) const {
return mMin.y;
}
const f32 GetMinZ(void) const {
return mMin.z;
}
bool Cross(const cM3dGLin *pLin) {
return cM3d_Cross_MinMaxBoxLine(mMin, mMax, pLin->mStart, pLin->mEnd);
}
// bool Cross(const cM3dGAab *param_1) {
// return cM3d_Cross_AabAab(this, param_1);
// }
// bool Cross(const cM3dGCyl *param_1) {
// return cM3d_Cross_AabCyl(this, param_1);
// }
// bool Cross(const cM3dGSph *param_1) {
// return cM3d_Cross_AabSph(this, param_1);
// }
};
#endif /* C_M3D_G_AAB_H */
+35
View File
@@ -0,0 +1,35 @@
#ifndef C_M3D_G_CIR_H
#define C_M3D_G_CIR_H
#include "common.h"
class cM2dGCir {
public:
f32 mPosX;
f32 mPosY;
f32 mRadius;
f32 GetCx() const {
return mPosX;
}
f32 GetCy() const {
return mPosY;
}
f32 GetR() const {
return mRadius;
}
cM2dGCir() {}
virtual ~cM2dGCir() {}
};
class cM3dGCir : public cM2dGCir {
f32 mPosZ;
public:
cM3dGCir() {}
virtual ~cM3dGCir(){};
void Set(f32, f32, f32, f32);
};
#endif
+38
View File
@@ -0,0 +1,38 @@
#ifndef C_M3D_G_CPS_H
#define C_M3D_G_CPS_H
#include "d/col/c/c_m3d.h"
#include "d/col/c/c_m3d_g_lin.h"
#include "d/col/c/c_m3d_g_unk.h"
#include "m/m_vec.h"
class cM3dGCps : public cM3dGLin {
public:
/* 0x18 */ f32 mRadius;
/* 0x1C */ f32 mField_0x1C;
/* 0x20 */ u8 mField_0x20;
/* 0x24 */ u32 mFlags;
cM3dGCps();
void Set(const mVec3_c &, const mVec3_c &, f32);
void SetR(f32 r);
void Set_0x1C(f32);
bool fn_80337f30(cM3dGUnk *, mVec3_c *);
bool fn_80337f40(const mVec3_c &) const;
f32 GetR() const {
return mRadius;
}
// bool Cross(cM3dGCps const *other, mVec3_c *xyz) const {
// return cM3d_Cross_CpsCps(*this, *other, xyz);
// }
// bool Cross(const cM3dGCyl *cyl, mVec3_c *xyz) const {
// return cM3d_Cross_CpsCyl(*this, *cyl, xyz);
// }
// bool Cross(const cM3dGSph *sph, mVec3_c *xyz) const {
// return cM3d_Cross_CpsSph(*this, *sph, xyz);
// }
};
#endif
+30
View File
@@ -0,0 +1,30 @@
#ifndef C_M3D_G_CYL_H
#define C_M3D_G_CYL_H
#include <d/col/c/c_m3d_g_unk.h>
#include <m/m_vec.h>
class cM3dGCyl {
public:
/* 0x00 */ mVec3_c mCenter;
/* 0x0C */ f32 mRadius;
/* 0x10 */ f32 mHeight;
cM3dGCyl() {}
void Set(const mVec3_c &, f32, f32);
void SetC(const mVec3_c &, f32 radius, f32 height);
void SetC(const mVec3_c &);
void SetH(f32);
void SetR(f32);
bool fn_803380e0(cM3dGUnk *, mVec3_c *);
bool fn_803380f0(cM3dGUnk *, f32 *);
bool Cross(const mVec3_c &) const;
void Clamp(const mVec3_c &, mVec3_c &) const;
const mVec3_c &GetC() const {
return mCenter;
}
};
#endif
+67
View File
@@ -0,0 +1,67 @@
#ifndef C_M3D_G_LIN_H
#define C_M3D_G_LIN_H
#include <common.h>
#include <m/m_vec.h>
class cM3dGLin {
public:
typedef nw4r::math::VEC3 VEC3;
typedef EGG::Vector3f Vector3f;
/* 0x00 */ mVec3_c mStart;
/* 0x0C */ mVec3_c mEnd;
cM3dGLin() {}
void SetStartEnd(const VEC3 &, const VEC3 &);
void SetStartEnd(const mVec3_c *, const mVec3_c *);
void Set(const mVec3_c &start, const mVec3_c &end) {
mStart = start;
mEnd = end;
}
void CalcPos(mVec3_c *, f32) const;
void CalcVec(Vec *pOut) const {
PSVECSubtract(mEnd, mStart, pOut);
}
void SetStart(const mVec3_c &);
void SetEnd(const mVec3_c *pEnd) {
mEnd = *pEnd;
}
nw4r::math::VEC3 &GetStart() {
return mStart;
}
const nw4r::math::VEC3 &GetStart() const {
return mStart;
}
nw4r::math::VEC3 *GetStartP(void) {
return &mStart;
}
const nw4r::math::VEC3 *GetStartP(void) const {
return &mStart;
}
nw4r::math::VEC3 &GetEnd() {
return mEnd;
}
const nw4r::math::VEC3 &GetEnd() const {
return mEnd;
}
nw4r::math::VEC3 *GetEndP(void) {
return &mEnd;
}
const nw4r::math::VEC3 *GetEndP(void) const {
return &mEnd;
}
};
#endif /* C_M3D_G_LIN_H */
+58
View File
@@ -0,0 +1,58 @@
#ifndef C_M3D_G_PLA_H
#define C_M3D_G_PLA_H
#include "c/c_math.h"
#include "d/col/c/c_m3d.h"
#include "m/m_vec.h"
// Plane with a normal
class cM3dGPla {
public:
/* 0x00 */ mVec3_c mNormal;
/* 0x0C */ f32 mD;
cM3dGPla() {}
cM3dGPla(const mVec3_c *v, f32 f) {
mNormal = *v;
f = mD;
}
bool CrossInfLin(const mVec3_c &, const mVec3_c &, mVec3_c &) const;
bool getCrossYLessD(const mVec3_c &, f32 *) const;
mAng GetAngle(mAng) const;
mAng GetNegativeAngle(mAng) const;
// Unused
// void SetupNP0(const mVec3_c &, const mVec3_c &);
// void SetupNP(const mVec3_c &, const mVec3_c &);
// bool getCrossY(const mVec3_c &, f32 *) const;
// void Set(const cM3dGPla *);
f32 getPlaneFunc(const mVec3_c &pnt) const {
return mD + VEC3Dot(mNormal, pnt);
}
mVec3_c *GetNP() {
return &mNormal;
}
const mVec3_c *GetNP() const {
return &mNormal;
}
f32 GetD() const {
return mD;
}
void SetupFrom3Vtx(const nw4r::math::VEC3 *v1, const nw4r::math::VEC3 *v2, const nw4r::math::VEC3 *v3) {
cM3d_CalcPla(v1, v2, v3, &mNormal, &mD);
}
f32 getCrossY_NonIsZero(const mVec3_c *param_1) {
return ((-mNormal.x * param_1->x - mNormal.z * param_1->z) - mD) / mNormal.y;
}
s32 GetAngleY() const {
return cM::atan2s(mNormal.x, mNormal.z);
}
f32 GetXZDist() const {
return EGG::Math<f32>::sqrt(mNormal.x * mNormal.x + mNormal.z * mNormal.z);
}
};
#endif
+38
View File
@@ -0,0 +1,38 @@
#ifndef C_M3D_G_SPH_H
#define C_M3D_G_SPH_H
#include "d/col/c/c_m3d_g_tri.h"
#include "m/m_vec.h"
class cM3dGSph {
public:
/* 0x00 */ mVec3_c mCenter;
/* 0x0C */ f32 mRadius;
/* 0x10 */ f32 mRatio;
cM3dGSph();
void SetC(const mVec3_c *);
void Set(const mVec3_c *, f32);
void SetR(f32);
void SetC(f32, f32, f32);
f32 GetYDist(f32) const;
bool Cross(const cM3dGTri *, f32 *, mVec3_c *);
void Clamp(const mVec3_c &, mVec3_c &) const;
bool fn_80338750(cM3dGUnk *, mVec3_c *);
bool fn_80338760(cM3dGUnk *, f32 *);
void SetRatio(f32);
const mVec3_c &GetC() const {
return mCenter;
}
const f32 &GetR() const {
return mRadius;
}
}; // Size = 0x14
#endif
+25
View File
@@ -0,0 +1,25 @@
#ifndef C_M3D_G_TRI_H
#define C_M3D_G_TRI_H
#include "common.h"
#include "d/col/c/c_m3d_g_pla.h"
class cM3dGTri : public cM3dGPla {
typedef nw4r::math::VEC3 VecType;
public:
/* 0x10 */ VecType mA;
/* 0x1C */ VecType mB;
/* 0x28 */ VecType mC;
cM3dGTri() {}
void SetPos(const VecType *, const VecType *, const VecType *);
void SetBg(const VecType *, const VecType *, const VecType *, const cM3dGPla *pla);
bool cross(const cM3dGLin *lin, VecType *xyz, bool param_2, bool param_3) const {
return cM3d_Cross_LinTri(lin, this, xyz, param_2, param_3);
}
};
#endif
+52
View File
@@ -0,0 +1,52 @@
#ifndef C_M3D_G_UNK_H
#define C_M3D_G_UNK_H
#include "d/col/c/c_m3d_g_cps.h"
#include "d/col/c/c_m3d_g_cyl.h"
#include "d/col/c/c_m3d_g_pla.h"
#include "d/col/c/c_m3d_g_sph.h"
#include "m/m_mtx.h"
#include "m/m_vec.h"
#include <common.h>
class cM3dGUnk {
public:
/* 0x00 */ mMtx_c mMtx;
/* 0x30 */ mMtx_c mInvMtx;
/* 0x60 */ mVec3_c mMin;
/* 0x6C */ mVec3_c mMax;
/* 0x78 */ mVec3_c mField_0x78;
/* 0x84 */ mVec3_c mField_0x84;
/* 0x90 */ mVec3_c mField_0x90;
/* 0x9C */ mVec3_c mField_0x9C;
/* 0xA8 */ mVec3_c mField_0xA8;
/* 0xB4 */ u32 mField_0xB4;
/* 0xB8 */ mVec3_c mVirtCenter;
/* 0xC4 */ f32 mField_0xC4;
cM3dGUnk();
/* vt at 0xC8*/
virtual ~cM3dGUnk() {}
void Set(const mVec3_c &, const mVec3_c &);
void Update();
void GetStartEnd(mVec3_c &, mVec3_c &);
void fn_80338c30(cM3dGCps *, mVec3_c *);
bool fn_80338c40(cM3dGUnk *, mVec3_c *);
bool fn_80338ca0(/* TODO */);
bool fn_80338cb0(cM3dGCyl *, mVec3_c *);
bool fn_80338cc0(cM3dGCyl *, f32 *);
bool fn_80338cd0(cM3dGSph *, mVec3_c *);
bool fn_80338ce0(cM3dGSph *, f32 *);
void Set(const mMtx_c &);
void Set(const mVec3_c &, const mAng &);
bool Cross(const mVec3_c &);
void Clamp(const mVec3_c &, mVec3_c &);
void fn_80338f30(f32, f32);
};
#endif
+36
View File
@@ -0,0 +1,36 @@
#ifndef C_PARTITION_H
#define C_PARTITION_H
/**
* File Made Up.
* Some Mask/Quick index into the collision octree
*/
#include "common.h"
#include "d/col/c/c_m3d_g_aab.h"
class cPartition {
public:
// static u32 sShift;
// static u32 sMask;
/* 0x0 */ u32 mX;
/* 0x4 */ u32 mY;
/* 0x8 */ u32 mZ;
cPartition();
// vt at 0xC
virtual ~cPartition();
void Calc(mVec3_c *pPos);
void fn_803391f0(const cM3dGAab *);
void fn_80339740(mVec3_c *, f32);
void fn_803399b0(mVec3_c *);
static void fn_80338fb0();
static bool fn_80339070(const cM3dGAab *);
};
#endif
@@ -1,13 +1,16 @@
#ifndef TOSORT_D_CC_D_H
#define TOSORT_D_CC_D_H
#ifndef D_CC_D_H
#define D_CC_D_H
#include <d/a/d_a_base.h>
#include <d/col/c/c_m3d_g_aab.h>
#include <d/col/c/c_m3d_g_cps.h>
#include <d/col/c/c_m3d_g_cyl.h>
#include <d/col/c/c_m3d_g_sph.h>
#include <d/col/c/c_m3d_g_unk.h>
#include <f/f_base_id.h>
#include <m/m_mtx.h>
#include <m/m_vec.h>
#include <nw4r/math/math_types.h>
#include <toBeSorted/cc/d_cc_m3d_g_cyl.h>
#include <toBeSorted/cc/d_cc_m3d_g_sph.h>
// Largely modeled off
// https://github.com/zeldaret/tp/blob/main/include/SSystem/SComponent/c_cc_d.h
@@ -28,18 +31,7 @@ public:
// bool Chk(dCcD_DivideInfo const &) const;
}; // Size = 0x10
// This Aabb type really could be anything
struct Aabb {
mVec3_c mMin;
mVec3_c mMax;
void Set(mVec3_c const &a, mVec3_c const &b) {
mMin = a;
mMax = b;
}
}; // Size = 0x18
class dCcD_DivideArea : public Aabb {
class dCcD_DivideArea : public cM3dGAab {
private:
/* 0x18 */ bool mXDiffIsZero;
/* 0x1C */ f32 mScaledXDiff;
@@ -55,9 +47,9 @@ public:
/* vt at 0x3C */
dCcD_DivideArea();
virtual ~dCcD_DivideArea();
/* 803281c0 */ void SetArea(Aabb const &);
/* 803282d0 */ void CalcDivideInfo(dCcD_DivideInfo *, Aabb const &, u32);
/* 80328470 */ void CalcDivideInfoOverArea(dCcD_DivideInfo *, Aabb const &);
/* 803281c0 */ void SetArea(cM3dGAab const &);
/* 803282d0 */ void CalcDivideInfo(dCcD_DivideInfo *, cM3dGAab const &, u32);
/* 80328470 */ void CalcDivideInfoOverArea(dCcD_DivideInfo *, cM3dGAab const &);
}; // Size = 0x40
class dCcD_GAtTgCoCommonBase {
@@ -328,24 +320,6 @@ struct dCcD_SrcSphAttr {
/* 0x00 */ f32 mRadius;
}; // Size = 0x4
class cM3dGAabb {
public:
/* 0x00 */ mMtx_c mMtx1;
/* 0x30 */ mMtx_c mMtx2;
/* 0x60 */ mVec3_c mMin;
/* 0x6C */ mVec3_c mMax;
/* 0x78 */ u8 field_0x78[0xB8 - 0x78];
/* 0xB8 */ mVec3_c mVirtualCenter;
/* 0xC4 */ u32 field_0xC4;
cM3dGAabb();
/* vt 0xC8 */
virtual ~cM3dGAabb() {}
void setWithYRot(const mVec3_c &translation, const mAng &rot);
void setMinMax(const mVec3_c &min, const mVec3_c &max);
};
struct dCcD_SrcAabbAttr {
/* 0x00 */ f32 minX, minY, minZ, maxX, maxY, maxZ;
}; // Size = 0x18
@@ -354,12 +328,7 @@ struct dCcD_SrcUnk1Attr {};
class cM3dGUnk1 {
public:
/* 0x00 */ mVec3_c field_0x00;
/* 0x0C */ mVec3_c field_0x0C;
/* 0x18 */ f32 field_0x18;
/* 0x1C */ f32 field_0x1C;
/* 0x20 */ u8 field_0x20;
/* 0x24 */ u32 field_0x24;
/* 0x00 */ cM3dGCps mCps;
/* 0x28 */ mVec3_c mVirtualCenter;
cM3dGUnk1();
};
@@ -427,7 +396,7 @@ public:
};
// Aabb
class dCcD_ShapeAttr5 : public dCcD_ShapeAttr, public cM3dGAabb {
class dCcD_ShapeAttr5 : public dCcD_ShapeAttr, public cM3dGUnk {
public:
dCcD_ShapeAttr5();
@@ -1,7 +1,7 @@
#ifndef TOSORT_D_CC_MGR_H
#define TOSORT_D_CC_MGR_H
#include <toBeSorted/cc/d_cc_d.h>
#include <d/col/cc/d_cc_d.h>
class ColliderManager {
public:
@@ -1,8 +1,8 @@
#ifndef D_CC_SHAPE_COLLIDERS_H
#define D_CC_SHAPE_COLLIDERS_H
#include <d/col/cc/d_cc_d.h>
#include <m/m_vec.h>
#include <toBeSorted/cc/d_cc_d.h>
struct dCcD_SrcUnk {
/* 0x00 */ dCcD_SrcGObjInf mObjInf;
+3
View File
@@ -9,6 +9,9 @@
// non-official but likely name
class dBase_c : public fBase_c {
public:
enum BaseProperties_e {
BASE_PROP_0x4 = 0x4,
};
/* 0x64 */ u32 baseProperties; // field from profile init
public:
/* 80050800 */ dBase_c();
+4 -5
View File
@@ -8,10 +8,9 @@
namespace d2d {
struct dLytStructD_Base {
dLytStructD_Base()
: field_0x0C(0), field_0x10(0), field_0x14(0), field_0x015(0), field_0x016(0) {}
dLytStructD_Base() : field_0x0C(0), field_0x10(0), field_0x14(0), field_0x015(0), field_0x016(0) {}
virtual ~dLytStructD_Base();
TListNode mNode;
TListNode<dLytStructD_Base> mLink;
u32 field_0x0C;
u32 field_0x10;
u16 field_0x14;
@@ -50,8 +49,8 @@ public:
void removeFromList2(dLytStructD *other);
private:
TList<dLytStructD, 4> mList1;
TList<dLytStructD, 4> mList2;
TList<dLytStructD, offsetof(dLytStructD, mLink)> mList2;
TList<dLytStructD, offsetof(dLytStructD, mLink)> mList1;
bool field_0x18;
};
+5 -1
View File
@@ -1,6 +1,10 @@
#ifndef EGG_CPU_TEXTURE_H
#define EGG_CPU_TEXTURE_H
namespace EGG {} // namespace EGG
namespace EGG {
class CpuTexture {};
} // namespace EGG
#endif
+20 -5
View File
@@ -12,8 +12,10 @@
#include "f/f_list_mg.h"
#include "f/f_manager.h"
#include "f/f_profile.h"
#include <common.h>
// Ghidra: fBase
// size: 0x64
// official name
@@ -50,15 +52,28 @@ public:
ACTOR,
STAGE,
};
enum MAIN_STATE_e { CANCELED, ERROR, SUCCESS, WAITING };
enum MAIN_STATE_e {
CANCELED,
ERROR,
SUCCESS,
WAITING
};
enum PACK_RESULT_e {
NOT_READY,
SUCCEEDED,
FAILED,
};
enum PROC_DISABLE_e { ROOT_DISABLE_EXECUTE = 1, DISABLE_EXECUTE = 2, ROOT_DISABLE_DRAW = 4, DISABLE_DRAW = 8 };
enum PROC_DISABLE_e {
ROOT_DISABLE_EXECUTE = 1,
DISABLE_EXECUTE = 2,
ROOT_DISABLE_DRAW = 4,
DISABLE_DRAW = 8
};
int getID() const {
return unique_ID;
}
// Inlines
bool isProcControlFlag(u8 flag) const {
return (proc_control & flag) != 0;
}
@@ -105,8 +120,8 @@ public: // vtable 0x60
/* 0x48 | 802E1480 */ virtual ~fBase_c();
public:
/* 802e1500 */ int commonPack(int (fBase_c::*doFunc)(), int (fBase_c::*preFunc)(),
void (fBase_c::*postFunc)(MAIN_STATE_e));
/* 802e1500 */ int
commonPack(int (fBase_c::*doFunc)(), int (fBase_c::*preFunc)(), void (fBase_c::*postFunc)(MAIN_STATE_e));
/* 802e1680 */ int createPack();
/* 802e1860 */ int deletePack();
/* 802e1960 */ int executePack();
+9 -2
View File
@@ -8,16 +8,23 @@ struct mAng {
mAng() {}
mAng(s16 s) : mVal(s) {}
mAng(const mAng &other) : mVal(other.mVal) {}
operator s16() const {
return mVal;
}
mAng &operator+=(const mAng &other) {
mVal += other.mVal;
return *this;
}
s32 step(s16 target, s32 steps, s16 max, s16 min);
inline f32 sin() const {
f32 sin() const {
return nw4r::math::SinIdx(*this);
}
inline f32 cos() const {
f32 cos() const {
return nw4r::math::CosIdx(*this);
}
+28 -19
View File
@@ -5,9 +5,12 @@
#include "egg/math/eggMatrix.h"
#include "m/m_angle.h"
#include "m/m_vec.h"
#include "nw4r/nw4r_types.h"
#include <common.h>
#pragma push
#pragma warning off(10402)
class mMtx_c {
@@ -16,8 +19,7 @@ class mMtx_c {
public:
mMtx_c(){};
/* 802f1660 */ mMtx_c(f32 xx, f32 xy, f32 xz, f32 xw, f32 yx, f32 yy, f32 yz, f32 yw, f32 zx, f32 zy, f32 zz,
f32 zw);
mMtx_c(f32 xx, f32 xy, f32 xz, f32 xw, f32 yx, f32 yy, f32 yz, f32 yw, f32 zx, f32 zy, f32 zz, f32 zw);
// not sure if this breaks anything but we need a matrix type
// with an inline copy assignment operator
@@ -39,29 +41,36 @@ public:
return &nw4rm;
}
/* 802f16b0 */ void XrotS(const mAng &angle); ///< Generates a rotation matrix for the X axis with the given angle.
/* 802f1770 */ void XrotM(const mAng &angle); ///< Rotates the matrix on the X axis by the given angle.
/* 802f17c0 */ void YrotS(const mAng &angle); ///< Generates a rotation matrix for the Y axis with the given angle.
/* 802f1880 */ void YrotM(const mAng &angle); ///< Rotates the matrix on the Y axis by the given angle.
/* 802f18d0 */ void ZrotS(const mAng &angle); ///< Generates a rotation matrix for the Z axis with the given angle.
/* 802f1990 */ void ZrotM(const mAng &angle); ///< Rotates the matrix on the Z axis by the given angle.
void XrotS(const mAng &angle); ///< Generates a rotation matrix for the X axis with the given angle.
void XrotM(const mAng &angle); ///< Rotates the matrix on the X axis by the given angle.
void YrotS(const mAng &angle); ///< Generates a rotation matrix for the Y axis with the given angle.
void YrotM(const mAng &angle); ///< Rotates the matrix on the Y axis by the given angle.
void ZrotS(const mAng &angle); ///< Generates a rotation matrix for the Z axis with the given angle.
void ZrotM(const mAng &angle); ///< Rotates the matrix on the Z axis by the given angle.
/* 802f19e0 */ void ZXYrotS(mAng xRot, mAng yRot,
mAng zRot); ///< Generates the matrix on the Y, X and Z axes by the given angles.
/* 802f1a40 */ void ZXYrotM(mAng xRot, mAng yRot,
mAng zRot); ///< Rotates the matrix on the Y, X and Z axes by the given angles.
/* 802f1aa0 */ void XYZrotS(mAng xRot, mAng yRot,
mAng zRot); ///< Generates the matrix on the Z, Y and X axes by the given angles.
/* 802f1b00 */ void XYZrotM(mAng xRot, mAng yRot,
mAng zRot); ///< Rotates the matrix on the Z, Y and X axes by the given angles.
void ZXYrotS(mAng xRot, mAng yRot,
mAng zRot); ///< Generates the matrix on the Y, X and Z axes by the given angles.
void ZXYrotM(mAng xRot, mAng yRot,
mAng zRot); ///< Rotates the matrix on the Y, X and Z axes by the given angles.
void XYZrotS(mAng xRot, mAng yRot,
mAng zRot); ///< Generates the matrix on the Z, Y and X axes by the given angles.
/* 802f1b60 */ void toRot(mAng3_c &out) const; ///< Converts the matrix to a rotation vector.
void XYZrotM(mAng xRot, mAng yRot,
mAng zRot); ///< Rotates the matrix on the Z, Y and X axes by the given angles.
void toRot(mAng3_c &out) const; ///< Converts the matrix to a rotation vector.
void multVecZero(nw4r::math::VEC3 &out) const; ///< Converts the matrix to a vector.
void zero(); ///< Zeroes out the matrix.
/* 802f1c40 */ void rot(int, int); // does some werrd operation to rotate the matrix
/* 802f1e60 */ bool quatRelated();
void rot(int, int); // does some werrd operation to rotate the matrix
bool quatRelated();
void SetTranslation(const mVec3_c &t) {
m[0][3] = t.x;
m[1][3] = t.y;
m[2][3] = t.z;
}
public:
union {
+56 -3
View File
@@ -2,15 +2,16 @@
#define M_VEC_H
#include "egg/math/eggVector.h"
#include "rvl/MTX.h"
#include "m/m_angle.h"
#include "rvl/MTX.h"
#include <common.h>
class mVec3_c : public EGG::Vector3f {
public:
/// @brief Constructs an empty vector.
/* 80009ee0 */ mVec3_c() {}
/* 80007460 */ ~mVec3_c() {}
mVec3_c() {}
~mVec3_c() {}
/// @brief Constructs a vector from a float array.
mVec3_c(const f32 *p) {
@@ -27,11 +28,33 @@ public:
set(fx, fy, fz);
}
// ?? Sometimes Works
void copyFrom(const Vec *pV) {
set(pV->x, pV->y, pV->z);
}
/// @brief Assignment operator
mVec3_c &operator=(const mVec3_c &r) {
set(r.x, r.y, r.z);
return *this;
}
/// @brief Assignment operator
mVec3_c &operator=(const EGG::Vector3f &r) {
x = r.x;
y = r.y;
z = r.z;
return *this;
}
/// @brief Assignment operator
mVec3_c &operator=(const nw4r::math::VEC3 &r) {
x = r.x;
y = r.y;
z = r.z;
return *this;
}
/// @brief Constructs a new vector from an existing vector from the MTX library.
mVec3_c(const Vec &v) {
x = v.x;
@@ -46,6 +69,13 @@ public:
z = v.z;
}
/// @brief Constructs a new vector from an existing vector from the EGG library.
mVec3_c(const EGG::Vector3f &v) {
x = v.x;
y = v.y;
z = v.z;
}
/// @brief Float cast operator.
operator f32 *() {
return &x;
@@ -66,6 +96,7 @@ public:
return *(Vec *)&x;
}
/// @brief Vector3f cast operator.
operator EGG::Vector3f *() {
return (EGG::Vector3f *)&x;
}
@@ -85,6 +116,14 @@ public:
return (const nw4r::math::VEC3 *)&x;
}
/// @brief Augmented subtraction operator.
mVec3_c &operator+=(const mVec3_c &v) {
x += v.x;
y += v.y;
z += v.z;
return *this;
}
/// @brief Augmented subtraction operator.
mVec3_c &operator-=(const mVec3_c &v) {
x -= v.x;
@@ -111,6 +150,20 @@ public:
return *this;
}
mVec3_c &operator-=(f32 f) {
x -= f;
y -= f;
z -= f;
return *this;
}
mVec3_c &operator+=(f32 f) {
x += f;
y += f;
z += f;
return *this;
}
/// @brief Negative operator.
mVec3_c operator-() const {
return mVec3_c(-x, -y, -z);
+1 -1
View File
@@ -67,7 +67,7 @@ inline f32 FModf(f32 x, f32 *y) {
}
inline f32 FSqrt(f32 x) {
if (x < 0.0f) {
if (x <= 0.0f) {
return 0.0f;
}
+1 -1
View File
@@ -21,7 +21,7 @@ void PSMTXCopy(const Mtx, Mtx);
void PSMTXConcat(const Mtx, const Mtx, Mtx);
void PSMTXConcatArray(const Mtx, const Mtx, Mtx, u32);
void PSMTXTranspose(const Mtx, Mtx);
void PSMTXInverse(const Mtx, Mtx);
bool PSMTXInverse(const Mtx, Mtx);
void PSMTXInvXpose(const Mtx, Mtx);
void PSMTXRotRad(Mtx, f32, char);
void PSMTXRotTrig(Mtx, f32, f32, char);
-38
View File
@@ -1,38 +0,0 @@
#ifndef ACTOR_COLLISION_H
#define ACTOR_COLLISION_H
#include <d/a/obj/d_a_obj_base.h>
#include <m/m_vec.h>
#include <m/m_mtx.h>
class ActorCollision {
public:
ActorCollision();
~ActorCollision();
void* create(void *dzbData, void *plcData, bool b, const mMtx_c &mtx, const mVec3_c &vec);
void* create(void *dzbData, void *plcData, bool b, const mMtx_c &mtx, const mVec3_c &vec, void *callback) {
void* result = create(dzbData, plcData, b, mtx, vec);
multMatrix = callback;
return result;
}
void init();
void execute();
u8 field_0x00[0x1FC - 0x000];
/* 0x1FC */ void *multMatrix;
/* 0x200 */ void *interactFunc;
/* 0x204 */ u8 field_0x204[0x210 - 0x204];
};
class CollisionCheckContext {
public:
static CollisionCheckContext* get();
void registerActorBgCollision(ActorCollision&, dAcObjBase_c*);
void destroyActorBgCollision(ActorCollision&);
};
#endif
@@ -10,7 +10,6 @@ public:
OarcManager();
virtual ~OarcManager();
static OarcManager *sInstance;
static bool create(EGG::Heap *heap);
@@ -31,6 +30,7 @@ public:
void *getDzbFromArc(const char *oarcName, const char *fileName);
void *getPlcFromArc(const char *oarcName, const char *fileName);
void *getSubEntryData(const char *oarcName, const char *fileName);
private:
dRawArcTable_c mArcTable;
};
-7
View File
@@ -1,7 +0,0 @@
#ifndef TOSORT_D_CC_M3D_H
#define TOSORT_D_CC_M3D_H
#endif
-24
View File
@@ -1,24 +0,0 @@
#ifndef TO_SORT_D_CC_M3D_G_CYL_H
#define TO_SORT_D_CC_M3D_G_CYL_H
#include <m/m_vec.h>
class cM3dGCyl {
public:
/* 0x00 */ mVec3_c mCenter;
/* 0x0C */ f32 mRadius;
/* 0x10 */ f32 mHeight;
cM3dGCyl() {}
void setC(const mVec3_c &, f32 radius, f32 height);
void setC(const mVec3_c &);
void setH(f32);
void setR(f32);
const mVec3_c &GetC() const {
return mCenter;
}
}; // Size = 0x14
#endif
-23
View File
@@ -1,23 +0,0 @@
#ifndef TO_SORT_D_CC_M3D_G_SPH_H
#define TO_SORT_D_CC_M3D_G_SPH_H
#include <m/m_vec.h>
class cM3dGSph {
public:
/* 0x00 */ mVec3_c mCenter;
/* 0x0C */ f32 mRadius;
/* 0x10 */ f32 field_0x10;
cM3dGSph();
void setR(f32);
void set(const mVec3_c &, f32);
void setC(const mVec3_c &);
void setC(f32, f32, f32);
const mVec3_c &GetC() const {
return mCenter;
}
}; // Size = 0x14
#endif
+4 -3
View File
@@ -7,7 +7,7 @@
class DowsingTarget {
public:
TListNode mLink; // 0x00
TListNode<DowsingTarget> mLink; // 0x00
private:
dAcBase_c *mpActor; // 0x08
u8 mDowsingSlot; // 0x0C
@@ -58,8 +58,9 @@ public:
static bool hasDowsingInSlot(int slot);
static DowsingTarget *getDowsingInfo(const mVec3_c &playerPosition, const mVec3_c &dowsingDirection, f32 *, f32 *,
f32 *intensity, int slot);
static DowsingTarget *getDowsingInfo(
const mVec3_c &playerPosition, const mVec3_c &dowsingDirection, f32 *, f32 *, f32 *intensity, int slot
);
static void init();
static void execute();
+48 -49
View File
@@ -7,123 +7,122 @@
// * Entirely in headers
// * Swapped node and count members
// Used in DowsingTarget, maybe also in dAcBase_c.soundStuff
// It's not immediately clear whether this stores pointers to nodes
// or pointers to objects. DowsingTarget's node offset is 0, so there's
// no observable difference, but the SoundSource stuff makes it
// look like it stores object pointers
template <typename T>
class TListNode {
public:
TListNode() : mpPrev(nullptr), mpNext(nullptr) {}
void *GetNext() const {
T *GetNext() const {
return mpNext;
}
void *GetPrev() const {
T *GetPrev() const {
return mpPrev;
}
void *mpPrev;
void *mpNext;
T *mpPrev;
T *mpNext;
};
template <typename T, int offset>
class TList {
public:
typedef TListNode<T> TNode;
class Iterator {
public:
Iterator() : mNode(NULL) {}
Iterator(TListNode *node) : mNode(node) {}
Iterator() : pVal(NULL) {}
Iterator(T *p_val) : pVal(p_val) {}
Iterator &operator++() {
mNode = GetNodeFromPointer(mNode->GetNext());
pVal = GetNodeFromPtr(pVal)->GetNext();
return *this;
}
Iterator &operator--() {
mNode = mNode->GetPrev();
pVal = GetNodeFromPtr(pVal)->GetPrev();
return *this;
}
T *operator->() const {
return GetPointerFromNode(mNode);
return pVal;
}
T &operator*() {
return *this->operator->();
}
friend bool operator==(Iterator lhs, Iterator rhs) {
return lhs.mNode == rhs.mNode;
friend bool operator==(const Iterator &lhs, const Iterator &rhs) {
return lhs.pVal == rhs.pVal;
}
friend bool operator!=(Iterator lhs, Iterator rhs) {
return !(lhs.mNode == rhs.mNode);
friend bool operator!=(const Iterator &lhs, const Iterator &rhs) {
return !(lhs.pVal == rhs.pVal);
}
private:
TListNode *mNode; // at 0x0
T *pVal; // at 0x0
};
TList() {
this->mNode.mpNext = GetPointerFromNode(&mNode);
this->mNode.mpPrev = GetPointerFromNode(&mNode);
mStartEnd.mpNext = GetPtrFromNode(&mStartEnd);
mStartEnd.mpPrev = GetPtrFromNode(&mStartEnd);
mCount = 0;
}
Iterator GetBeginIter() {
return GetNodeFromPointer(&mNode) != mNode.GetNext() ? Iterator(GetNodeFromPointer(mNode.GetNext())) :
Iterator(&mNode);
if (GetEndIter() != Iterator(mStartEnd.GetNext())) {
return Iterator(mStartEnd.GetNext());
} else {
return GetEndIter();
}
}
Iterator GetEndIter() {
return Iterator(&mNode);
return Iterator(GetPtrFromNode(&mStartEnd));
}
static TListNode *GetNodeFromPointer(void *p) {
return reinterpret_cast<TListNode *>(reinterpret_cast<char *>(p) + offset);
static TNode *GetNodeFromPtr(T *pT) {
return (TNode *)((u8 *)pT + offset);
}
static T *GetPointerFromNode(TListNode *node) {
return reinterpret_cast<T *>(reinterpret_cast<char *>(node) - offset);
static T *GetPtrFromNode(TNode *pN) {
return (T *)((u8 *)pN - offset);
}
void insert(T *value) {
TListNode *node = GetNodeFromPointer(value);
if (GetPointerFromNode(&mNode) == this->mNode.mpNext) {
node->mpNext = GetPointerFromNode(&mNode);
node->mpPrev = GetPointerFromNode(&mNode);
this->mNode.mpNext = value;
this->mNode.mpPrev = value;
TNode *node = GetNodeFromPtr(value);
if (GetPtrFromNode(&mStartEnd) == mStartEnd.mpNext) {
node->mpNext = GetPtrFromNode(&mStartEnd);
node->mpPrev = GetPtrFromNode(&mStartEnd);
mStartEnd.mpNext = value;
mStartEnd.mpPrev = value;
mCount++;
} else {
node->mpPrev = this->mNode.mpPrev;
node->mpNext = GetPointerFromNode(&mNode);
GetNodeFromPointer(this->mNode.mpPrev)->mpNext = value;
this->mNode.mpPrev = value;
node->mpPrev = mStartEnd.mpPrev;
node->mpNext = GetPtrFromNode(&mStartEnd);
GetNodeFromPtr(mStartEnd.mpPrev)->mpNext = value;
mStartEnd.mpPrev = value;
mCount++;
}
}
void remove(T *value) {
TListNode *node = GetNodeFromPointer(value);
TNode *node = GetNodeFromPtr(value);
T *next = reinterpret_cast<T *>(node->mpNext);
if (GetPointerFromNode(&mNode) == node->mpPrev) {
this->mNode.mpNext = next;
if (GetPtrFromNode(&mStartEnd) == node->mpPrev) {
this->mStartEnd.mpNext = next;
} else {
GetNodeFromPointer(node->mpPrev)->mpNext = next;
GetNodeFromPtr(node->mpPrev)->mpNext = next;
}
if (GetPointerFromNode(&mNode) == node->mpNext) {
this->mNode.mpPrev = node->mpPrev;
if (GetPtrFromNode(&mStartEnd) == node->mpNext) {
this->mStartEnd.mpPrev = node->mpPrev;
} else {
GetNodeFromPointer(node->mpNext)->mpPrev = node->mpPrev;
GetNodeFromPtr(node->mpNext)->mpPrev = node->mpPrev;
}
node->mpPrev = nullptr;
node->mpNext = nullptr;
mCount--;
}
TListNode mNode;
TNode mStartEnd;
s32 mCount;
};
+4 -7
View File
@@ -1,5 +1,6 @@
#include <d/a/d_a_t_wood_area.h>
#include <d/a/d_a_player.h>
#include <d/a/d_a_t_wood_area.h>
const f32 dAcTWoodArea_c::scaleX = 100.0f;
const f32 dAcTWoodArea_c::scaleY = 100.0f;
@@ -11,18 +12,14 @@ STATE_DEFINE(dAcTWoodArea_c, Wait);
int dAcTWoodArea_c::actorCreate() {
mStateMgr.changeState(StateID_Init);
PSMTXTrans(worldMatrix.m, position.x, position.y, position.z);
PSMTXTrans(mWorldMtx.m, position.x, position.y, position.z);
boundingBox.min = mVec3_c(-0.0f, -0.0f, -0.0f);
boundingBox.max = mVec3_c(0.0f, 0.0f, 0.0f);
return SUCCEEDED;
}
static const ProfileName FILTER_PROFILE[] = {
fProfile::OBJ_FRUIT,
fProfile::ITEM,
fProfile::NPC_KYUI_THIRD,
fProfile::OBJ_IVY_ROPE,
fProfile::NPC_SORAJIMA_BOY,
fProfile::OBJ_FRUIT, fProfile::ITEM, fProfile::NPC_KYUI_THIRD, fProfile::OBJ_IVY_ROPE, fProfile::NPC_SORAJIMA_BOY,
};
int dAcTWoodArea_c::actorPostCreate() {
+10 -19
View File
@@ -27,23 +27,14 @@ int dAcEhb_leaf_c::create() {
someRot = rotation.y.mVal;
switch (getParam1()) {
case 0:
case 7:
mType = 0;
break;
case 1:
mType = 1;
break;
case 2:
mType = 2;
break;
case 3:
case 4:
case 5:
rotation.z = -0x8000;
break;
default:
break;
case 0:
case 7: mType = 0; break;
case 1: mType = 1; break;
case 2: mType = 2; break;
case 3:
case 4:
case 5: rotation.z = -0x8000; break;
default: break;
}
if (mType == 0) {
@@ -85,9 +76,9 @@ int dAcEhb_leaf_c::actorExecute() {
if (mType != 0) {
Mtx m;
PSMTXScale(m, mTimeAreaStruct.field_0x00, mTimeAreaStruct.field_0x00, mTimeAreaStruct.field_0x00);
PSMTXConcat(worldMatrix.m, m, worldMatrix.m);
PSMTXConcat(mWorldMtx.m, m, mWorldMtx.m);
}
mModel.getModel().setLocalMtx(worldMatrix);
mModel.getModel().setLocalMtx(mWorldMtx);
mModel.getModel().calc(false);
someRot++;
+9 -8
View File
@@ -1,5 +1,6 @@
#include <d/a/d_a_player.h>
#include <d/a/obj/d_a_obj_appear_bridge.h>
#include <d/col/bg/d_bg_s.h>
#include <toBeSorted/area_utils.h>
SPECIAL_ACTOR_PROFILE(OBJ_APPEAR_BRIDGE, dAcOappearBridge_c, fProfile::OBJ_APPEAR_BRIDGE, 0x01FC, 0, 6);
@@ -21,18 +22,18 @@ bool dAcOappearBridge_c::createHeap() {
TRY_CREATE(mSrtAnm.create(mdl, srt, &heap_allocator, nullptr, 1));
nw4r::g3d::ResAnmClr clr = mResFile.GetResAnmClr("TongueStage");
TRY_CREATE(mClrAnm.create(mdl, clr, &heap_allocator, nullptr, 1));
void *dzb = getOarcFile("TongueStage", "dzb/TongueStage.dzb");
void *plc = getOarcFile("TongueStage", "dat/TongueStage.plc");
cBgD_t *dzb = (cBgD_t *)getOarcFile("TongueStage", "dzb/TongueStage.dzb");
PLC *plc = (PLC *)getOarcFile("TongueStage", "dat/TongueStage.plc");
updateMatrix();
mModel.setLocalMtx(worldMatrix);
TRY_CREATE(mCollision.create(dzb, plc, true, worldMatrix, scale) == nullptr);
mCollision.init();
mModel.setLocalMtx(mWorldMtx);
TRY_CREATE(!mCollision.Set(dzb, plc, 1, &mWorldMtx, &mScale));
mCollision.Lock();
return true;
}
int dAcOappearBridge_c::create() {
CREATE_ALLOCATOR(dAcOappearBridge_c);
CollisionCheckContext::get()->registerActorBgCollision(mCollision, this);
dBgS::GetInstance()->Regist(&mCollision, this);
mAreaIdx = params & 0xFF;
mEventId = (params >> 8) & 0xFF;
mSoundPosition = position + positionOffset;
@@ -65,7 +66,7 @@ int dAcOappearBridge_c::draw() {
}
void dAcOappearBridge_c::initializeState_Wait() {
CollisionCheckContext::get()->destroyActorBgCollision(mCollision);
dBgS::GetInstance()->Release(&mCollision);
}
void dAcOappearBridge_c::executeState_Wait() {
if (checkPosInArea(mAreaIdx, roomid, dAcPy_c::LINK->position, nullptr)) {
@@ -89,7 +90,7 @@ void dAcOappearBridge_c::finalizeState_Wait() {
void dAcOappearBridge_c::initializeState_Appear() {
mSrtAnm.setRate(sMovementRate, 0);
mClrAnm.setRate(sMovementRate, 0);
CollisionCheckContext::get()->registerActorBgCollision(mCollision, this);
dBgS::GetInstance()->Regist(&mCollision, this);
playSound(0xAA4);
}
void dAcOappearBridge_c::executeState_Appear() {
+11 -10
View File
@@ -1,17 +1,18 @@
#include <d/a/obj/d_a_obj_bamboo_island.h>
#include <d/col/bg/d_bg_s.h>
#include <toBeSorted/item_story_flag_manager.h>
const f32 dAcObambooIsland_c::unusedFloat1 = 100000.0f;
const f32 dAcObambooIsland_c::unusedFloat2 = 0.0f;
static const char *const sBambooIslandNames[] = {
"IslBamb",
"IslBamb_s",
"IslBamb",
"IslBamb_s",
};
SPECIAL_ACTOR_PROFILE(OBJ_BAMBOO_ISLAND, dAcObambooIsland_c, fProfile::OBJ_BAMBOO_ISLAND, 0x01F9, 0, 3);
void dAcObambooIsland_c::interactCallback(void *unknown, dAcBase_c *actor, dAcObjBase_c *interactor) {
void dAcObambooIsland_c::rideCallback(dBgW *unknown, dAcObjBase_c *actor, dAcObjBase_c *interactor) {
if (interactor->isActorPlayer() && actor != nullptr && StoryFlagManager::sInstance->getCounterOrFlag(284) == 0) {
StoryFlagManager::sInstance->setFlag(284);
}
@@ -25,26 +26,26 @@ bool dAcObambooIsland_c::createHeap() {
nw4r::g3d::ResMdl mdl = mBrres.GetResMdl(sBambooIslandNames[i]);
TRY_CREATE(mModels[i].create(mdl, &heap_allocator, 0x120));
}
void *dzb = getOarcFile("IslBamb", "dzb/IslBamb.dzb");
void *plc = getOarcFile("IslBamb", "dat/IslBamb.plc");
cBgD_t *dzb = (cBgD_t *)getOarcFile("IslBamb", "dzb/IslBamb.dzb");
PLC *plc = (PLC *)getOarcFile("IslBamb", "dat/IslBamb.plc");
updateMatrix();
for (int i = 0; i < 2; i++) {
mModels[i].setLocalMtx(worldMatrix);
mModels[i].setLocalMtx(mWorldMtx);
}
TRY_CREATE(mCollision.create(dzb, plc, true, worldMatrix, scale) == nullptr);
mCollision.init();
TRY_CREATE(!mCollision.Set(dzb, plc, 1, &mWorldMtx, &mScale));
mCollision.Lock();
return true;
}
int dAcObambooIsland_c::create() {
CREATE_ALLOCATOR(dAcObambooIsland_c);
CollisionCheckContext::get()->registerActorBgCollision(mCollision, this);
dBgS::GetInstance()->Regist(&mCollision, this);
mModels[0].setPriorityDraw(0x1C, 9);
mModels[1].setPriorityDraw(0x22, 9);
setBoundingBox(mVec3_c(-2400.0f, -1600.0f, -2300.0f), mVec3_c(2400.0f, 3900.0f, 2400.0f));
mCullingDistance = 500000.0f;
mCollision.interactFunc = interactCallback;
mCollision.SetRideCallback(rideCallback);
return SUCCEEDED;
}
+2 -5
View File
@@ -37,10 +37,7 @@ int dAcOJunkRep_c::create() {
mStateMgr.changeState(StateID_Wait);
setBoundingBox(
mVec3_c(-30.0f, -0.0f, -20.0f),
mVec3_c(30.0f, 120.0f, 20.0f)
);
setBoundingBox(mVec3_c(-30.0f, -0.0f, -20.0f), mVec3_c(30.0f, 120.0f, 20.0f));
return SUCCEEDED;
}
@@ -52,7 +49,7 @@ int dAcOJunkRep_c::doDelete() {
int dAcOJunkRep_c::actorExecute() {
mStateMgr.executeState();
updateMatrix();
mpModelToUse->setLocalMtx(worldMatrix);
mpModelToUse->setLocalMtx(mWorldMtx);
return SUCCEEDED;
}
+1 -1
View File
@@ -34,7 +34,7 @@ int dAcOlavaF200_c::create() {
updateMatrix();
for (int i = 0; i < 2; i++) {
mModels[i].setLocalMtx(worldMatrix);
mModels[i].setLocalMtx(mWorldMtx);
}
mModels[0].setPriorityDraw(0x1C, 9);
+17 -17
View File
@@ -30,7 +30,7 @@ int dAcOmoleSoil_c::create() {
CREATE_ALLOCATOR(dAcOmoleSoil_c);
mScale = sHalfScale;
scale.set(sHalfScale, sHalfScale, sHalfScale);
dAcBase_c::mScale.set(sHalfScale, sHalfScale, sHalfScale);
mStateMgr.changeState(StateID_Wait);
setBoundingBox(mVec3_c(-100.0f, -0.0f, -100.0f), mVec3_c(100.0f, 100.0f, 100.0f));
@@ -43,25 +43,25 @@ int dAcOmoleSoil_c::doDelete() {
int dAcOmoleSoil_c::actorExecute() {
switch (getNextState()) {
case 1:
if (!mStateMgr.isState(StateID_Appear)) {
mStateMgr.changeState(StateID_Appear);
}
break;
case 2:
if (!mStateMgr.isState(StateID_DisAppear)) {
mStateMgr.changeState(StateID_DisAppear);
}
break;
case 3:
if (!mStateMgr.isState(StateID_Appear)) {
mStateMgr.changeState(StateID_Appear);
}
break;
case 1:
if (!mStateMgr.isState(StateID_Appear)) {
mStateMgr.changeState(StateID_Appear);
}
break;
case 2:
if (!mStateMgr.isState(StateID_DisAppear)) {
mStateMgr.changeState(StateID_DisAppear);
}
break;
case 3:
if (!mStateMgr.isState(StateID_Appear)) {
mStateMgr.changeState(StateID_Appear);
}
break;
}
mStateMgr.executeState();
updateMatrix();
mModel.setLocalMtx(worldMatrix);
mModel.setLocalMtx(mWorldMtx);
return SUCCEEDED;
}
+2 -2
View File
@@ -52,8 +52,8 @@ int dAcOPoolCock_c::actorExecute() {
updateMatrix();
mMtx_c mdl1Transform;
mMtx_c mdl2Transform;
mdl1Transform = worldMatrix;
mdl2Transform = worldMatrix;
mdl1Transform = mWorldMtx;
mdl2Transform = mWorldMtx;
mMtx_c tmp1;
mMtx_c tmp2;
+2 -2
View File
@@ -23,7 +23,7 @@ int dAcOPumpkinLeaf_c::create() {
mStateMgr.changeState(StateID_Wait);
setBoundingBox(mVec3_c(-50.0f, -10.0f, -50.0f), mVec3_c(50.0f, 50.0f, 50.0f));
dAcObjBase_c::create(
"PmpknBd", getRoomId(), 0, &position, &rotation, &scale, getParams2_ignoreLower(), -1, viewclip_index
"PmpknBd", getRoomId(), 0, &position, &rotation, &mScale, getParams2_ignoreLower(), -1, viewclip_index
);
return SUCCEEDED;
}
@@ -33,7 +33,7 @@ int dAcOPumpkinLeaf_c::doDelete() {
}
int dAcOPumpkinLeaf_c::actorExecute() {
mModel.setLocalMtx(worldMatrix);
mModel.setLocalMtx(mWorldMtx);
return SUCCEEDED;
}
+4 -4
View File
@@ -1,5 +1,5 @@
#include <d/a/obj/d_a_obj_ring.h>
#include <d/a/d_a_player.h>
#include <d/a/obj/d_a_obj_ring.h>
SPECIAL_ACTOR_PROFILE(OBJ_RING, dAcOring_c, fProfile::OBJ_RING, 0x00f2, 0, 0x103);
@@ -20,8 +20,8 @@ int dAcOring_c::create() {
setBoundingBox(mVec3_c(-100.0f, -100.0f, -100.0f), mVec3_c(100.0f, 100.0f, 100.0f));
updateMatrix();
mModel.setScale(scale);
mModel.setLocalMtx(worldMatrix);
mModel.setScale(mScale);
mModel.setLocalMtx(mWorldMtx);
forwardAccel = -5.0f;
forwardMaxSpeed = -40.0f;
field_0x38C = dAcPy_c::LINK->position.y;
@@ -39,7 +39,7 @@ int dAcOring_c::actorExecute() {
position += velocity;
position += mCCdStruct.posIncrements;
updateMatrix();
mModel.setLocalMtx(worldMatrix);
mModel.setLocalMtx(mWorldMtx);
return SUCCEEDED;
}
+5 -5
View File
@@ -1,13 +1,13 @@
#include <d/a/obj/d_a_obj_smoke.h>
static const char *const sSmokeNames1[] = {
"SmokeF200",
"SmokeF202",
"SmokeF200",
"SmokeF202",
};
static const char *const sSmokeNames2[] = {
"SmokeF200",
"SmokeF202",
"SmokeF200",
"SmokeF202",
};
SPECIAL_ACTOR_PROFILE(OBJ_SMOKE, dAcOsmoke_c, fProfile::OBJ_SMOKE, 0x01DB, 0, 4);
@@ -29,7 +29,7 @@ int dAcOsmoke_c::create() {
mModel.setAnm(mTexAnm);
updateMatrix();
mModel.setLocalMtx(worldMatrix);
mModel.setLocalMtx(mWorldMtx);
mStateMgr.changeState(StateID_Wait);
mModel.setPriorityDraw(0x1C, 9);
setBoundingBox(mVec3_c(-0.0f, -0.0f, -0.0f), mVec3_c(0.0f, 0.0f, 0.0f));
+5 -5
View File
@@ -1,5 +1,5 @@
#include <d/a/obj/d_a_obj_spike.h>
#include <toBeSorted/cc/d_cc_mgr.h>
#include <d/col/cc/d_cc_mgr.h>
SPECIAL_ACTOR_PROFILE(OBJ_SPIKE, dAcOspike_c, fProfile::OBJ_SPIKE, 0x1D9, 0, 2);
@@ -33,9 +33,9 @@ int dAcOspike_c::create() {
mCollision.initUnk(mCCdStruct);
updateMatrix();
mMdl.setLocalMtx(worldMatrix);
mMdl.setLocalMtx(mWorldMtx);
mVec3_c tmp;
PSMTXMultVecSR(worldMatrix.m, mVec3_c::Ex, tmp);
PSMTXMultVecSR(mWorldMtx.m, mVec3_c::Ex, tmp);
mCollision.setAtVec(tmp);
mMtx_c mtx;
@@ -61,7 +61,7 @@ int dAcOspike_c::create() {
tmp3.z = copy;
}
mCollision.setMinMax(tmp2, tmp3);
mCollision.Set(tmp2, tmp3);
mStateMgr.changeState(StateID_Wait);
setBoundingBox(mVec3_c(-10.0f, -250.0f, -480.0f), mVec3_c(80.0f, 260.0f, 490.0f));
return SUCCEEDED;
@@ -73,7 +73,7 @@ int dAcOspike_c::doDelete() {
int dAcOspike_c::actorExecute() {
mStateMgr.executeState();
mCollision.setWithYRot(position, rotation.y);
mCollision.Set(position, rotation.y);
ColliderManager::getColliderManager()->addCollider(&mCollision);
return 1;
}
+1 -1
View File
@@ -28,7 +28,7 @@ int dAcOstageCover_c::doDelete() {
int dAcOstageCover_c::actorExecute() {
mStateMgr.executeState();
updateMatrix();
mModel.setLocalMtx(worldMatrix);
mModel.setLocalMtx(mWorldMtx);
return SUCCEEDED;
}
+1 -1
View File
@@ -38,7 +38,7 @@ int dAcOsunLight_c::actorExecute() {
mTexAnm.play();
}
updateMatrix();
mModel.setLocalMtx(worldMatrix);
mModel.setLocalMtx(mWorldMtx);
return SUCCEEDED;
}
@@ -1,6 +1,6 @@
#include <d/a/obj/d_a_obj_toD3_stone_figure.h>
#include <d/col/cc/d_cc_mgr.h>
#include <toBeSorted/attention.h>
#include <toBeSorted/cc/d_cc_mgr.h>
#include <toBeSorted/event.h>
#include <toBeSorted/event_manager.h>
#include <toBeSorted/item_story_flag_manager.h>
@@ -39,14 +39,14 @@ int dAcOtoD3StoneFigure_c::create() {
return FAILED;
}
mMdl.setLocalMtx(worldMatrix);
mMdl.setLocalMtx(mWorldMtx);
mCCdStruct.setField0x38ToMagicValue();
mCollision.init(sCcSrc);
mCollision.initUnk(mCCdStruct);
int zero = 0;
mCollision.setC(position);
mCollision.setR(dAcOtoD3StoneFigure_c::sRadius + zero);
mCollision.setH(dAcOtoD3StoneFigure_c::sHeight + zero);
mCollision.SetC(position);
mCollision.SetR(dAcOtoD3StoneFigure_c::sRadius + zero);
mCollision.SetH(dAcOtoD3StoneFigure_c::sHeight + zero);
ColliderManager::getColliderManager()->addCollider(&mCollision);
// mCollision.clearCoFlag();
mCollision.setTgCoFlag(1);
@@ -96,7 +96,7 @@ void dAcOtoD3StoneFigure_c::initializeState_OneEye() {
if (ScGame::currentSpawnInfo.night == 1) {
rotation.y.mVal += -0x8000;
updateMatrix();
mMdl.setLocalMtx(worldMatrix);
mMdl.setLocalMtx(mWorldMtx);
}
}
+10 -10
View File
@@ -1,7 +1,7 @@
#include <c/c_math.h>
#include <d/a/obj/d_a_obj_triforce.h>
#include <d/col/cc/d_cc_mgr.h>
#include <m/m_vec.h>
#include <toBeSorted/cc/d_cc_mgr.h>
SPECIAL_ACTOR_PROFILE(OBJ_TRIFORCE, dAcOtriforce_c, fProfile::OBJ_TRIFORCE, 0x15D, 0, 4);
@@ -42,10 +42,10 @@ int dAcOtriforce_c::create() {
mEffects.init(this);
mCollision.setSomeDefendValue(0x2000);
updateMatrix();
scale.x = sScale;
scale.y = sScale;
scale.z = sScale;
mMdl.setLocalMtx(worldMatrix);
mScale.x = sScale;
mScale.y = sScale;
mScale.z = sScale;
mMdl.setLocalMtx(mWorldMtx);
return SUCCEEDED;
}
@@ -62,16 +62,16 @@ int dAcOtriforce_c::actorExecute() {
position = mStartingPos + offset;
mStartingOffset.mVal += 0x16C;
mCollision.setC(position.x, position.y + 90.0f + zero, position.z);
mCollision.SetC(position.x, position.y + 90.0f + zero, position.z);
ColliderManager::getColliderManager()->addCollider(&mCollision);
updateMatrix();
Mtx m;
PSMTXScale(m, scale.x, scale.y, scale.z);
PSMTXConcat(worldMatrix.m, m, worldMatrix.m);
mMdl.setLocalMtx(worldMatrix);
PSMTXScale(m, mScale.x, mScale.y, mScale.z);
PSMTXConcat(mWorldMtx.m, m, mWorldMtx.m);
mMdl.setLocalMtx(mWorldMtx);
mAnm.play();
fn_80029AE0(&mEffects, PARTICLE_RESOURCE_ID_MAPPING_967_, &worldMatrix, nullptr, nullptr);
fn_80029AE0(&mEffects, PARTICLE_RESOURCE_ID_MAPPING_967_, &mWorldMtx, nullptr, nullptr);
return 1;
}
+5 -4
View File
@@ -52,7 +52,8 @@ void dTgFairy_c::createFairies() {
mVec3_c v = calcLocation(f);
v2 = v;
dAcObjFairy_c *ac = static_cast<dAcObjFairy_c *>(
dAcObjBase_c::create("Fairy", roomid, fairyParams1, &v2, nullptr, nullptr, -1, -1, viewclip_index));
dAcObjBase_c::create("Fairy", roomid, fairyParams1, &v2, nullptr, nullptr, -1, -1, viewclip_index)
);
if (ac != nullptr) {
mpFairyRefs[i].link(ac);
}
@@ -62,9 +63,9 @@ void dTgFairy_c::createFairies() {
mVec3_c dTgFairy_c::calcLocation(const f32 &offset) {
mVec3_c v;
v.y = scale.y * 0.5f;
v.x = scale.x * calcRnd(0.5f, offset);
v.z = scale.z * calcRnd(0.5f, offset);
v.y = mScale.y * 0.5f;
v.x = mScale.x * calcRnd(0.5f, offset);
v.z = mScale.z * calcRnd(0.5f, offset);
v.rotY(rotation.y);
return position + v;
}
+4 -5
View File
@@ -1,7 +1,7 @@
#include <d/t/d_t_genki_dws_tgt.h>
#include <toBeSorted/item_story_flag_manager.h>
#include <toBeSorted/room_manager.h>
#include <toBeSorted/sceneflag_manager.h>
#include <toBeSorted/item_story_flag_manager.h>
#include <toBeSorted/scgame.h>
SPECIAL_ACTOR_PROFILE(TAG_GENKI_DOWSING_TARGET, dTgGenkiDwsTgt_c, fProfile::TAG_GENKI_DOWSING_TARGET, 0x02A5, 0, 0);
@@ -22,7 +22,6 @@ int dTgGenkiDwsTgt_c::create() {
return FAILED;
}
int roomId_tmp = roomid;
if (addActorToRoom(-1)) {
roomid = roomId_tmp;
@@ -30,9 +29,9 @@ int dTgGenkiDwsTgt_c::create() {
} else {
return FAILED;
}
scale.x = 1.0f;
scale.y = 1.0f;
scale.z = 1.0f;
mScale.x = 1.0f;
mScale.y = 1.0f;
mScale.z = 1.0f;
static mVec3_c offset(0.0f, 25.0f, 0.0f);
mDowsingTarget.initialize(DowsingTarget::SLOT_CRYSTAL, 0, &offset, 1.0f);
+4 -4
View File
@@ -29,10 +29,10 @@ int dTgHolyWater_c::draw() {
}
bool dTgHolyWater_c::isLinkNearby() {
mVec3_c diff = dAcPy_c::LINK->position - (position + mVec3_c::Ey * scale.y * 0.5f);
diff.x /= scale.x;
diff.y /= scale.y;
diff.z /= scale.z;
mVec3_c diff = dAcPy_c::LINK->position - (position + mVec3_c::Ey * mScale.y * 0.5f);
diff.x /= mScale.x;
diff.y /= mScale.y;
diff.z /= mScale.z;
return diff.x <= 0.5f && diff.x >= -0.5f && diff.y <= 0.5f && diff.y >= -0.5f && diff.z <= 0.5f && diff.z >= -0.5f;
}
+1 -1
View File
@@ -8,7 +8,7 @@ const f32 dTgNoEffectArea_c::sFloat1 = 100.0f;
const f32 dTgNoEffectArea_c::sFloat2 = 100.0f;
int dTgNoEffectArea_c::create() {
scale *= 0.01f;
mScale *= 0.01f;
PSMTXTrans(mMtx, position.x, position.y, position.z);
mMtx.YrotM(rotation.y);
PSMTXInverse(mMtx, mMtx);
+30 -41
View File
@@ -1,5 +1,6 @@
#include <d/a/obj/d_a_obj_base.h>
#include <d/a/d_a_player.h>
#include <d/a/obj/d_a_obj_base.h>
#include <d/col/c/c_m3d_g_cps.h>
#include <d/t/d_t_sound_area.h>
#include <d/t/d_t_sound_area_mgr.h>
#include <rvl/MTX.h>
@@ -12,20 +13,18 @@ void float_ordering() {
}
int dTgSndAr_c::create() {
scale *= 0.01f;
mScale *= 0.01f;
if (dTgSndMg_c::sInstance == nullptr) {
dAcObjBase_c::createActorUnkGroup3(fProfile::SOUND_AREA_MGR, roomid, 0, nullptr, nullptr, nullptr, -1);
}
switch (getTypeFromParams()) {
case 0:
PSMTXTrans(mtx.m, position.x, position.y, position.z);
mtx.YrotM(rotation.y);
PSMTXInverse(mtx.m, mtx.m);
break;
case 3:
mRail.init(params >> 8 & 0xFF, roomid, 0);
break;
case 0:
PSMTXTrans(mtx.m, position.x, position.y, position.z);
mtx.YrotM(rotation.y);
PSMTXInverse(mtx.m, mtx.m);
break;
case 3: mRail.init(params >> 8 & 0xFF, roomid, 0); break;
}
fBase_c *base = nullptr;
@@ -72,14 +71,10 @@ int dTgSndAr_c::draw() {
bool dTgSndAr_c::checkPosInArea(mVec3_c &pos) {
switch (getTypeFromParams()) {
case 0:
return checkAlg0(pos);
case 1:
return checkAlg1(pos);
case 2:
return checkAlg2(pos);
case 3:
return checkAlg3(pos);
case 0: return checkAlg0(pos);
case 1: return checkAlg1(pos);
case 2: return checkAlg2(pos);
case 3: return checkAlg3(pos);
}
return false;
@@ -93,15 +88,15 @@ inline bool inRange(f32 val, f32 tolerance) {
bool dTgSndAr_c::checkAlg0(const mVec3_c &pos) {
mVec3_c c2 = pos;
PSMTXMultVec(mtx.m, c2, c2);
f32 sxLower = -50.0f * scale.x;
f32 sxUpper = 50.0f * scale.x;
f32 sxLower = -50.0f * mScale.x;
f32 sxUpper = 50.0f * mScale.x;
f32 syLower = 0.0f;
f32 syUpper = 100.0f * scale.y;
f32 szLower = -50.0f * scale.z;
f32 szUpper = 50.0f * scale.z;
f32 syUpper = 100.0f * mScale.y;
f32 szLower = -50.0f * mScale.z;
f32 szUpper = 50.0f * mScale.z;
if (sxLower <= c2.x && c2.x <= sxUpper && syLower <= c2.y && c2.y <= syUpper && szLower <= c2.z &&
c2.z <= szUpper) {
c2.z <= szUpper) {
return true;
}
return false;
@@ -109,18 +104,18 @@ bool dTgSndAr_c::checkAlg0(const mVec3_c &pos) {
// Sphere
bool dTgSndAr_c::checkAlg1(const mVec3_c &pos) {
f32 tgtDist = scale.x * 100.0f;
f32 tgtDist = mScale.x * 100.0f;
f32 tgtDist2 = tgtDist * tgtDist;
return PSVECSquareDistance(position, pos) < tgtDist2;
}
// Cylinder
bool dTgSndAr_c::checkAlg2(const mVec3_c &pos) {
if (pos.y < position.y || pos.y > (position.y + 100.0f * scale.y)) {
if (pos.y < position.y || pos.y > (position.y + 100.0f * mScale.y)) {
return false;
}
f32 radius = scale.x * 100.0f;
f32 radius = mScale.x * 100.0f;
mVec3_c diff = pos - position;
f32 dist = diff.x * diff.x + diff.z * diff.z;
@@ -138,38 +133,32 @@ struct UnkStruct {
/* 0x24 */ u32 field_0x24;
};
extern "C" void fn_80337EA0(UnkStruct *);
extern "C" void fn_80337EF0(UnkStruct *, mVec3_c &, mVec3_c &, f32);
extern "C" int cM3d_Len3dSqPntAndSegLine(UnkStruct *, Vec &, Vec *, f32 *, f32 *);
// Capsule
bool dTgSndAr_c::checkAlg3(const mVec3_c &pos) {
Vec q;
mVec3_c q;
f32 radius = scale.x * 100.0f;
f32 radius = mScale.x * 100.0f;
radius = radius * radius;
Vec a = pos;
UnkStruct unk;
fn_80337EA0(&unk);
nw4r::math::VEC3 a = pos;
cM3dGCps unk;
// Line between b and c
mVec3_c b = *mRail.getPntPosForIndex(0);
mVec3_c c = *mRail.getPntPosForIndex(1);
fn_80337EF0(&unk, b, c, scale.x * 100.0f);
unk.Set(b, c, mScale.x * 100.0f);
f32 d;
if (cM3d_Len3dSqPntAndSegLine(&unk, a, &q, &d, nullptr)) {
if (cM3d_Len3dSqPntAndSegLine(&unk, &a, &q, &d, nullptr)) {
// At the cylindrical part of the capsule, just check the distance to
// the line
return d < radius;
} else {
// Otherwise check if we are within the spheres around the endpoints
f32 distSq = PSVECSquareDistance(unk.vec, pos);
f32 distSq = PSVECSquareDistance(unk.GetStart(), pos);
if (distSq < radius) {
return true;
} else {
distSq = PSVECSquareDistance(unk.vec2, pos);
distSq = PSVECSquareDistance(unk.GetEnd(), pos);
return distSq < radius;
}
}
+1 -1
View File
@@ -16,7 +16,7 @@ int dTgTouchTag::create() {
mActivatorIndex = !(getActivatorIndex() == 0xF) ? getActivatorIndex() : 0;
mZoneFlag = getZoneFlag();
mChkFlag = getChkFlag();
matrixCreateFromPosRotYScale(mAreaOfEffect, position, rotation.y, scale, nullptr, 0.0f);
matrixCreateFromPosRotYScale(mAreaOfEffect, position, rotation.y, mScale, nullptr, 0.0f);
mStateMgr.changeState(StateID_Wait);
return SUCCEEDED;
}
+3 -3
View File
@@ -47,7 +47,7 @@ void dTgTumbleWeed_c::executeState_AreaOut() {
return;
}
}
if (isWithinPlayerRadius(scale.x)) {
if (isWithinPlayerRadius(mScale.x)) {
mStateMgr.changeState(StateID_AreaIn);
}
}
@@ -68,7 +68,7 @@ void dTgTumbleWeed_c::executeState_AreaIn() {
return;
}
}
if (!isWithinPlayerRadius(scale.x)) {
if (!isWithinPlayerRadius(mScale.x)) {
mStateMgr.changeState(StateID_AreaOut);
}
}
@@ -84,7 +84,7 @@ void dTgTumbleWeed_c::initializeState_Wind() {
}
void dTgTumbleWeed_c::executeState_Wind() {
if (isWithinPlayerRadius(scale.x)) {
if (isWithinPlayerRadius(mScale.x)) {
mStateMgr.changeState(StateID_AreaIn);
} else {
mStateMgr.changeState(StateID_AreaOut);
+33 -21
View File
@@ -1,6 +1,7 @@
#include "d/a/d_a_base.h"
#include "d/a/obj/d_a_obj_base.h"
#include "d/a/d_a_player.h"
#include "d/a/obj/d_a_obj_base.h"
#include "f/f_list_nd.h"
#include "m/m_vec.h"
#include "toBeSorted/event.h"
@@ -57,7 +58,7 @@ dAcBase_c::dAcBase_c()
if (s_Create_Scale) {
SetScale(*s_Create_Scale);
} else {
scale.set(1.0f, 1.0f, 1.0f);
mScale.set(1.0f, 1.0f, 1.0f);
}
if (s_Create_Parent != nullptr) {
@@ -77,8 +78,10 @@ dAcBase_c::dAcBase_c()
dAcBase_c::~dAcBase_c() {}
void dAcBase_c::setTempCreateParams(mVec3_c *pos, mAng3_c *rot, mVec3_c *scale, s32 roomId, u32 params2,
dAcBase_c *parent, u8 subtype, s16 unkFlag, u8 viewClipIdx, ObjInfo *objInfo) {
void dAcBase_c::setTempCreateParams(
mVec3_c *pos, mAng3_c *rot, mVec3_c *scale, s32 roomId, u32 params2, dAcBase_c *parent, u8 subtype, s16 unkFlag,
u8 viewClipIdx, ObjInfo *objInfo
) {
s_Create_Position = pos;
s_Create_Rotation = rot;
s_Create_Scale = scale;
@@ -239,8 +242,9 @@ u32 dAcBase_c::itemDroppingAndGivingRelated(mVec3_c *spawnPos, int subtype) {
params2 = param2Copy | 0xFF000000;
// mAng3_c rot = {};
s16 rot = 0;
return SpecialItemDropMgr::giveSpecialDropItem(SpecialItemDropMgr::sInstance, param2Copy >> 0x18, roomid, spawnPos,
subtype, &rot, -1);
return SpecialItemDropMgr::giveSpecialDropItem(
SpecialItemDropMgr::sInstance, param2Copy >> 0x18, roomid, spawnPos, subtype, &rot, -1
);
}
// 8002cf90
@@ -356,8 +360,9 @@ s32 doAbs(s16 val) {
}
// Similar weirdness as the above function. Also, r29->31 are initted in the wrong order?
// 8002d290
bool dAcBase_c::getDistanceAndAngleToActor(dAcBase_c *actor, f32 distThresh, s16 yAngle, s16 xAngle, f32 *outDist,
s16 *outDiffAngleY, s16 *outDiffAngleX) {
bool dAcBase_c::getDistanceAndAngleToActor(
dAcBase_c *actor, f32 distThresh, s16 yAngle, s16 xAngle, f32 *outDist, s16 *outDiffAngleY, s16 *outDiffAngleX
) {
f32 distSquared = 3.402823e+38f;
s16 angleToActorY, angleToActorX;
bool isWithinRange = false;
@@ -371,7 +376,7 @@ bool dAcBase_c::getDistanceAndAngleToActor(dAcBase_c *actor, f32 distThresh, s16
angleToActorX = targetAngleX(&position, &actor->position);
if ((distSquared <= distThresh * distThresh) && (doAbs(s32(rotation.y.mVal - angleToActorY)) <= yAngle) &&
(doAbs(s32(rotation.x.mVal - angleToActorX)) <= xAngle)) {
(doAbs(s32(rotation.x.mVal - angleToActorX)) <= xAngle)) {
isWithinRange = true;
}
}
@@ -398,8 +403,9 @@ bool dAcBase_c::isWithinPlayerRadius(f32 radius) const {
}
// 8002d440
bool dAcBase_c::getDistanceAndAngleToPlayer(f32 distThresh, s16 yAngle, s16 xAngle, f32 *outDist, s16 *outDiffAngleY,
s16 *outDiffAngleX) {
bool dAcBase_c::getDistanceAndAngleToPlayer(
f32 distThresh, s16 yAngle, s16 xAngle, f32 *outDist, s16 *outDiffAngleY, s16 *outDiffAngleX
) {
return getDistanceAndAngleToActor(dAcPy_c::LINK, distThresh, yAngle, xAngle, outDist, outDiffAngleY, outDiffAngleX);
}
@@ -483,8 +489,10 @@ void dAcBase_c::changeLoadedEntitiesNoSet() {
// spawns GroupType2 (ACTOR)
// 8002d980
dAcBase_c *dAcBase_c::createActor(ProfileName actorId, u32 actorParams1, mVec3_c *actorPosition, mAng3_c *actorRotation,
mVec3_c *actorScale, u32 actorParams2, s32 actorRoomid, dBase_c *actorRef) {
dAcBase_c *dAcBase_c::createActor(
ProfileName actorId, u32 actorParams1, mVec3_c *actorPosition, mAng3_c *actorRotation, mVec3_c *actorScale,
u32 actorParams2, s32 actorRoomid, dBase_c *actorRef
) {
if (actorPosition == nullptr) {
actorPosition = &position;
}
@@ -494,7 +502,7 @@ dAcBase_c *dAcBase_c::createActor(ProfileName actorId, u32 actorParams1, mVec3_c
}
if (actorScale == nullptr) {
actorScale = &scale;
actorScale = &mScale;
}
if (actorRoomid == 63) {
@@ -503,16 +511,19 @@ dAcBase_c *dAcBase_c::createActor(ProfileName actorId, u32 actorParams1, mVec3_c
u32 newParams2 = actorParams2 != 0 ? getParams2_ignoreLower() : -1;
setTempCreateParams(actorPosition, actorRotation, actorScale, actorRoomid, newParams2, (dAcBase_c *)actorRef, 0, -1,
0xFF, nullptr);
setTempCreateParams(
actorPosition, actorRotation, actorScale, actorRoomid, newParams2, (dAcBase_c *)actorRef, 0, -1, 0xFF, nullptr
);
dBase_c *room = RoomManager::getRoom(roomid);
return (dAcBase_c *)dBase_c::createBase(actorId, room, actorParams1, ACTOR);
}
// spawns GroupType2 (STAGE)
// 8002da80
dAcBase_c *dAcBase_c::createActorStage(ProfileName actorId, u32 actorParams1, mVec3_c *actorPosition,
mAng3_c *actorRotation, mVec3_c *actorScale, u32 actorParams2, s32 actorRoomid, dBase_c *actorRef) {
dAcBase_c *dAcBase_c::createActorStage(
ProfileName actorId, u32 actorParams1, mVec3_c *actorPosition, mAng3_c *actorRotation, mVec3_c *actorScale,
u32 actorParams2, s32 actorRoomid, dBase_c *actorRef
) {
if (actorPosition == nullptr) {
actorPosition = &position;
}
@@ -522,7 +533,7 @@ dAcBase_c *dAcBase_c::createActorStage(ProfileName actorId, u32 actorParams1, mV
}
if (actorScale == nullptr) {
actorScale = &scale;
actorScale = &mScale;
}
if (actorRoomid == 63) {
@@ -531,8 +542,9 @@ dAcBase_c *dAcBase_c::createActorStage(ProfileName actorId, u32 actorParams1, mV
u32 newParams2 = actorParams2 != 0 ? getParams2_ignoreLower() : -1;
setTempCreateParams(actorPosition, actorRotation, actorScale, actorRoomid, newParams2, (dAcBase_c *)actorRef, 0, -1,
0xFF, nullptr);
setTempCreateParams(
actorPosition, actorRotation, actorScale, actorRoomid, newParams2, (dAcBase_c *)actorRef, 0, -1, 0xFF, nullptr
);
dBase_c *room = RoomManager::getRoom(roomid);
return (dAcBase_c *)dBase_c::createBase(actorId, room, actorParams1, STAGE);
}
+2 -3
View File
@@ -1,7 +1,6 @@
#include <d/a/d_a_player.h>
#include <d/a/obj/d_a_obj_fairy.h>
SPECIAL_ACTOR_PROFILE(OBJ_FAIRY, dAcObjFairy_c, fProfile::OBJ_FAIRY, 0x166, 0, 2);
STATE_DEFINE(dAcObjFairy_c, Wait);
@@ -52,7 +51,7 @@ int dAcObjFairy_c::draw() {
if (!isCuring()) {
static mQuat_c rot(0.0f, 0.0f, 0.0f, 10.0f);
drawShadow(mShadow, nullptr, worldMatrix, &rot, -1, -1, -1, -1, -1, position.y - field_0x4B0);
drawShadow(mShadow, nullptr, mWorldMtx, &rot, -1, -1, -1, -1, -1, position.y - field_0x4B0);
}
}
@@ -116,7 +115,7 @@ bool dAcObjFairy_c::shouldAvoidLink() const {
bool dAcObjFairy_c::isCuring() const {
return mStateMgr.isState(StateID_CureStart) || mStateMgr.isState(StateID_Cure) ||
mStateMgr.isState(StateID_CureEnd);
mStateMgr.isState(StateID_CureEnd);
}
bool dAcObjFairy_c::canTargetWithBugNet() const {
+38 -36
View File
@@ -1,6 +1,8 @@
#include <c/c_math.h>
#include <d/a/d_a_player.h>
#include <d/a/obj/d_a_obj_switch.h>
#include <d/col/bg/d_bg_s.h>
#include <d/col/bg/d_bg_w.h>
#include <s/s_Math.h>
#include <toBeSorted/sceneflag_manager.h>
@@ -27,10 +29,10 @@ void dAcOswMdlCallback_c::timingB(u32 nodeId, nw4r::g3d::WorldMtxManip *manip, n
static bool isPushableBlock(dAcBase_c *actor) {
return actor->isActorPlayer() || actor->profile_name == fProfile::OBJ_PUSH_BLOCK ||
actor->profile_name == fProfile::OBJ_KIBAKO;
actor->profile_name == fProfile::OBJ_KIBAKO;
}
void dAcOsw_c::interactCallback(void *unknown, dAcBase_c *actor, dAcObjBase_c *interactor) {
void dAcOsw_c::rideCallback(dBgW *unknown, dAcObjBase_c *actor, dAcObjBase_c *interactor) {
if (!isPushableBlock(interactor)) {
return;
}
@@ -38,20 +40,19 @@ void dAcOsw_c::interactCallback(void *unknown, dAcBase_c *actor, dAcObjBase_c *i
dAcOsw_c *sw = static_cast<dAcOsw_c *>(actor);
// halp
if (!(link == nullptr ||
((link->mActionFlags & 0x40000) == 0 &&
(((link->someFlags_0x340 & 0x800000) == 0 ||
if (!(link == nullptr || ((link->mActionFlags & 0x40000) == 0 &&
(((link->someFlags_0x340 & 0x800000) == 0 ||
((link->getCurrentCarriedActor() != nullptr &&
link->getCurrentCarriedActor()->mActorCarryInfo.testCarryFlag(0x04)))))))) {
link->getCurrentCarriedActor()->mActorCarryInfo.testCarryFlag(0x04)))))))) {
return;
}
if (interactor->mActorCarryInfo.isCarried != 1) {
if (link == nullptr || (link->mActionFlags & 0xC70852) == 0) {
if (!sw->someInteractCheck(link != nullptr)) {
bool needsOnFlag = sw->mOnSceneFlag < 0xFF &&
!SceneflagManager::sInstance->checkBoolFlag(sw->roomid, sw->mOnSceneFlag);
!SceneflagManager::sInstance->checkBoolFlag(sw->roomid, sw->mOnSceneFlag);
if (!needsOnFlag && sw->mObjRef.get() == nullptr && link != nullptr && sw->field_0x5F1 == 0 &&
sw->mStateMgr.isState(StateID_On)) {
sw->mStateMgr.isState(StateID_On)) {
link->field_0x360 |= 0x8000;
}
}
@@ -60,31 +61,32 @@ void dAcOsw_c::interactCallback(void *unknown, dAcBase_c *actor, dAcObjBase_c *i
}
}
extern "C" void fn_8033CE10();
bool dAcOsw_c::createHeap() {
nw4r::g3d::ResFile resFile = getOarcResFile(SWITCH_TYPES[mSwitchType]);
nw4r::g3d::ResMdl resMdl = resFile.GetResMdl(SWITCH_TYPES[mSwitchType]);
TRY_CREATE(mModel.create(resMdl, &heap_allocator, 0x20, 1, nullptr));
field_0x5E8 = scale.x *
(resMdl.GetResNode("base").mNode.ref().FLOAT_0x50 - resMdl.GetResNode("base").mNode.ref().FLOAT_0x44);
void *dbzData = getOarcDZB(SWITCH_TYPES[mSwitchType], SWITCH_TYPES[mSwitchType]);
void *plcData = getOarcPLC(SWITCH_TYPES[mSwitchType], SWITCH_TYPES[mSwitchType]);
scale.set(1.0f, 0.8f, 1.0f);
field_0x5E8 = mScale.x *
(resMdl.GetResNode("base").mNode.ref().FLOAT_0x50 - resMdl.GetResNode("base").mNode.ref().FLOAT_0x44);
cBgD_t *dbzData = (cBgD_t *)getOarcDZB(SWITCH_TYPES[mSwitchType], SWITCH_TYPES[mSwitchType]);
PLC *plcData = (PLC *)getOarcPLC(SWITCH_TYPES[mSwitchType], SWITCH_TYPES[mSwitchType]);
mScale.set(1.0f, 0.8f, 1.0f);
updateMatrix();
field_0x5B8.set(worldMatrix);
mModel.setLocalMtx(worldMatrix);
return !mCollision.create(dbzData, plcData, true, field_0x5B8, scale, fn_8033CE10);
field_0x5B8.set(mWorldMtx);
mModel.setLocalMtx(mWorldMtx);
bool set = mCollision.Set(dbzData, plcData, 1, &field_0x5B8, &mScale);
mCollision.SetCrrFunc(dBgS_MoveBGProc_TypicalRotY);
return !set;
}
int dAcOsw_c::actorCreate() {
mSwitchType = params & 0xF;
mOnSceneFlag = (params >> 0xE);
CREATE_ALLOCATOR(dAcOsw_c);
mCollision.interactFunc = interactCallback;
mCollision.SetRideCallback(rideCallback);
mModel.setCallback(&mButtonCtrl);
CollisionCheckContext::get()->registerActorBgCollision(mCollision, this);
dBgS::GetInstance()->Regist(&mCollision, this);
mOffSceneFlag = (params >> 0x4);
mCanBeSeen = ((params >> 0xC) & 3) == 0;
nw4r::g3d::ResMdl resMdl = mModel.getResMdl();
@@ -107,10 +109,10 @@ int dAcOsw_c::actorPostCreate() {
field_0x5A0.check(roomid, position, 0, 30.0f, 0.1f);
if (field_0x5A0.field_0x00 <= 0.0f) {
mHidden = true;
scale.set(0.0f, 0.0f, 0.0f);
mScale.set(0.0f, 0.0f, 0.0f);
} else {
mShown = true;
scale.set(1.0f, 1.0f, 1.0f);
mScale.set(1.0f, 1.0f, 1.0f);
}
}
@@ -124,7 +126,7 @@ int dAcOsw_c::actorPostCreate() {
}
}
} while (parent != nullptr);
mModel.setScale(scale);
mModel.setScale(mScale);
return SUCCEEDED;
}
@@ -148,7 +150,7 @@ int dAcOsw_c::actorExecute() {
if (mCanBeSeen) {
field_0x5A0.check(roomid, position, 0, 30.0f, 0.1f);
if (field_0x5A0.field_0x00 <= 0.0f) {
if (scale.x >= 1.0f) {
if (mScale.x >= 1.0f) {
if (!mHidden) {
fn_800298B0(PARTICLE_RESOURCE_ID_MAPPING_754_, &position, &rotation, 0, 0, 0, 0, 0);
playSound(0xC0B);
@@ -157,11 +159,11 @@ int dAcOsw_c::actorExecute() {
} else {
mHidden = false;
}
sLib::chase(&scale.x, 0.0f, 0.07f);
scale.y = scale.x;
scale.z = scale.x;
sLib::chase(&mScale.x, 0.0f, 0.07f);
mScale.y = mScale.x;
mScale.z = mScale.x;
} else {
if (scale.x <= 0.0f) {
if (mScale.x <= 0.0f) {
if (!mShown) {
fn_800298B0(PARTICLE_RESOURCE_ID_MAPPING_754_, &position, &rotation, 0, 0, 0, 0, 0);
playSound(0xC0A);
@@ -170,20 +172,20 @@ int dAcOsw_c::actorExecute() {
} else {
mShown = false;
}
sLib::chase(&scale.x, 1.0f, 0.07f);
scale.z = scale.x;
sLib::chase(&mScale.x, 1.0f, 0.07f);
mScale.z = mScale.x;
}
}
updateMatrix();
field_0x5B8.set(worldMatrix);
field_0x5B8.set(mWorldMtx);
mMtx_c tmp;
PSMTXTrans(tmp, 0.0f, mButtonCtrl.mElevation, 0.0f);
PSMTXConcat(field_0x5B8, tmp, field_0x5B8);
mModel.setScale(scale);
mModel.setLocalMtx(worldMatrix);
mModel.setScale(mScale);
mModel.setLocalMtx(mWorldMtx);
mModel.calc(false);
mCollision.execute();
mCollision.Move();
field_0x5F3 = 0;
mActivatedByPlayer = 0;
field_0x5F2 = field_0x5F1;
@@ -212,7 +214,7 @@ void dAcOsw_c::initializeState_OnWait() {
}
}
void dAcOsw_c::executeState_OnWait() {
sLib::chase(&scale.y, 0.8f, 0.12f);
sLib::chase(&mScale.y, 0.8f, 0.12f);
if (field_0x5F1 != 0) {
field_0x5F3 = 1;
}
@@ -282,7 +284,7 @@ void dAcOsw_c::executeState_Off() {
void dAcOsw_c::finalizeState_Off() {}
void dAcOsw_c::initializeState_None() {
scale.y = 0.8f;
mScale.y = 0.8f;
mButtonCtrl.mElevation = -20.0f;
}
void dAcOsw_c::executeState_None() {}
+5
View File
@@ -0,0 +1,5 @@
#include "d/col/bg/d_bg_pc.h"
bool dBgPc::getWtr() const {
return (m_code.code3 & 0x1F) == 0xC;
}

Some files were not shown because too many files have changed in this diff Show More