starting to organize and progress on dAcBase_c

This commit is contained in:
Elijah Thomas
2023-08-12 10:47:25 -04:00
parent de8b60021c
commit 683dc91a53
27 changed files with 536 additions and 183 deletions
+1 -1
View File
@@ -19,7 +19,7 @@ struct Vec3s
s16 x, y, z;
};
struct ObjInfoPtr {
struct ObjInfo {
/* 0x00 */ char* name;
/* 0x04 */ u16 obj_id;
/* 0x06 */ u16 obj_id2;
+64 -15
View File
@@ -4,20 +4,50 @@
#include <d/d_heap.h>
#include <m/m_allocator.h>
#include <UnknownTypeBelongings.h>
#include <m/types_m.h>
// #include <m/types_m.h>
#include <m/m_angle.h>
#include <m/m_vec.h>
#include <toBeSorted/room_manager.h>
class dAcBase_c;
struct SoundInfo {
dAcBase_c* actor;
void* obj_sound;
mVec3_c* obj_pos;
SoundInfo* next;
SoundInfo* prev;
};
// Ghidra: ActorBase
// size: 0xFC
// non-official name
class dAcBase_c : public dBase_c {
public:
/* 0x68 */ mHeapAllocator_c mHeapAllocator; // mHeapAlloctor
/* 0x84 */ ObjInfoPtr* objInfo; //
/* 0x88 */ int field_0x88;
/* 0x8C */ int field_0x8C;
/* 0x90 */ int field_0x90;
/* 0x94 */ void* soundRelated;
/* 0x68 */ mHeapAllocator_c heap_allocator;
/* 0x84 */ ObjInfo* obj_info;
/* 0x88 */ void* sound_info_tail;
/* 0x8c */ SoundInfo* sound_info_next;
/* 0x90 */ int count;
/* 0x94 */ void* obj_sound;
/* 0x9C */ mVec3_c* obj_pos;
/* 0x9c */ mVec3_c pos_copy;
/* 0xa8 */ u32 params2;
/* 0xAC */ mAng3_c rot_copy;
/* 0xB2 */ u16 obj_id; // enemydefeat flag / id on obj-map
/* 0xB4 */ u8 room_id_copy;
/* 0xB5 */ u8 viewclip_index;
/* 0xB6 */ u8 subtype;
/* 0xB8 */ mAng3_c rotation;
/* 0xC0 */ mVec3_c position;
/* 0xCC */ mVec3_c scale;
/* 0xD8 */ u32 actor_properties;
/* 0xDC */ fLiNdBa_c actor_node;
/* 0xE8 */ u32 field_0xe8;
/* 0xEC */ u8 roomid;
/* 0xED */ u8 actor_subtype;
/* 0xF0 */ u32 field_0xF0;
/* 0xF4 */ char someStr[4];
/* 0xF8 */ char field_0xf8[0xfc - 0xf8];
protected:
/* 80501544 */ // vtable
/* 0x08 | 8002c880 */ virtual int create();
@@ -29,7 +59,7 @@ protected:
/* 0x44 | 8002c3a0 */ virtual bool createHeap();
/* 0x48 | 8002c590 */ virtual ~dAcBase_c();
/* 0x4C | 8002c860 */ virtual int actorCreate(); // name is assumed
/* 0x50 | 8002c870 */ virtual int actorReCreate(); // name is assumed
/* 0x50 | 8002c870 */ virtual int actorPostCreate(); // name is assumed
/* 0x54 | 8002cca0 */ virtual int actorExecute(); // name is assumed
/* 0x58 | 8002ccb0 */ virtual int actorExecuteInEvent(); // name is assumed
/* 0x5C | 8002ce90 */ virtual void unkVirtFunc_0x5C();
@@ -42,13 +72,32 @@ protected:
public:
/* 8002c3b0 */ dAcBase_c();
void setPostion(mVec3_c* r) {
position.set(r->x, r->y, r->z);
}
void setScale(f32 x, f32 y, f32 z) {
scale.set(x, y, z);
}
void setScale(mVec3_c* r) {
scale.set(r->x, r->y, r->z);
}
void setRotation(mAng3_c* r) {
rotation = *r;
}
void copyPosition() {
pos_copy = position;
}
void copyRotation() {
rot_copy = rotation;
}
public:
// funcs found in TU
/* 8002c650 */ static void setTempCreateParams( \
Vec3f* pos, Vec3s* rot, Vec3f* scale, \
mVec3_c* pos, mAng3_c* rot, mVec3_c* scale, \
s32 roomId, u32 params2, dAcBase_c* parent, \
u8 subtype, s16 unkFlag, u8 viewClipIdx,\
ObjInfoPtr* objInfo );
ObjInfo* objInfo );
/* 8002c690 */ void* FUN_8002c690();
/* 8002c710 */ int initAllocatorWork1Heap(int size, char* name, int align);
@@ -98,7 +147,7 @@ public:
/* 8002d880 */ void FUN_8002d880();
// End Sound Effect Related
/* 8002d890 */ void FUN_8002d890();
/* 8002d920 */ void setActorRef(dBase_c&);
/* 8002d920 */ void setActorRef(dBase_c*);
// next three funcs are related
/* 8002d930 */ void setUnkFlag();
/* 8002d940 */ void FUN_8002d940();
@@ -124,10 +173,10 @@ public:
/* 80571924 */ static u32 s_Create_Params2;
/* 80571928 */ static u16 s_Create_UnkFlags;
/* 8057192A */ static u8 s_Create_ViewClipIdx;
/* 80575080 */ static Vec3f* s_Create_Position;
/* 80575084 */ static Vec3s* s_Create_Rotation;
/* 80575088 */ static Vec3f* s_Create_Scale;
/* 80575080 */ static mVec3_c* s_Create_Position;
/* 80575084 */ static mAng3_c* s_Create_Rotation;
/* 80575088 */ static mVec3_c* s_Create_Scale;
/* 8057508C */ static dAcBase_c* s_Create_Parent;
/* 80575090 */ static ObjInfoPtr* s_Create_ObjInfo;
/* 80575090 */ static ObjInfo* s_Create_ObjInfo;
/* 80575094 */ static u8 s_Create_Subtype;
};
+1 -1
View File
@@ -1,7 +1,7 @@
#pragma once
#include <f/f_base.h>
#include <c/c_owner_set.h>
// #include <c/c_owner_set.h>
// Ghidra: dBase_c
// size: 0x68
View File
+1
View File
@@ -82,6 +82,7 @@ public:
/* 802e1f90 */ fBase_c *getConnectParent() const;
/* 802e1fb0 */ fBase_c *getConnectChild() const;
/* 802e1fd0 */ fBase_c *getConnectBrNext() const;
/* 802e2090 */ bool setConnectChild(fBase_c* child);
/* 802e2420 */ void runCreate();
/* 802e24a0 */ fBase_c *getChildProcessCreateState() const;
/* 802e2510 */ bool checkChildProcessCreateState() const;
+1 -1
View File
@@ -7,10 +7,10 @@
class fBase_c;
// Ghidra: Used to be ActorReference
class fLiNdBa_c : public cListNd_c {
public:
fLiNdBa_c() : p_owner(nullptr) {}
fLiNdBa_c(fBase_c *owner) : p_owner(owner) {}
inline fLiNdBa_c *getPrev() const {
+25
View File
@@ -0,0 +1,25 @@
#pragma once
#include <lib/egg/egg_types.h>
#include <lib/egg/core/eggHeap.h>
namespace EGG {
class IAudioMgr {
public:
struct Arg {
/* 0x00 */ EGG::Heap* heap;
/* 0x04 */ char* soundFileName;
/* 0x08 */ int sndThreadPriority;
/* 0x0c */ int sndThreadStackSize;
/* 0x10 */ int dvdThreadPriority;
/* 0x14 */ int dvdThreadStackSize;
/* 0x18 */ u32 blocks;
/* 0x1c */ u8 field_0x1C;
};
};
class SimpleAudioMgr : public IAudioMgr, public SoundHeapMgr, public ArcPlayer {
};
}
+74 -74
View File
@@ -8,86 +8,86 @@
namespace EGG
{
// gfx
struct CapTexture;
struct CpuTexture;
struct DrawGX;
struct DrawPathBase;
struct DrawPathBloom;
struct DrawPathDOF;
struct DrawPathHDR;
struct DrawPathLightMap;
struct DrawPathShadowVolume;
struct Fog;
struct FogManager;
struct G3DUtility;
struct GfxEngine;
struct GXUtility;
struct IDrawGX;
struct IScnProc;
struct IScnProcModel;
struct LightObj;
struct LightManager;
struct LightTexture;
struct LightTextureManager;
struct ModelBoundingInfo;
struct ModelEx;
struct ModelSnapshot;
struct PostEffectBase;
struct PostEffectBlur;
struct PostEffectBlurGather;
struct PostEffectHDR;
struct PostEffectSimple;
struct ResTIMG;
struct ScnRenderer;
struct ScnRootEx;
struct Screen;
struct ScreenEffectBase;
struct ShadowTextureManager;
struct ShadowTexture;
struct StateGX;
struct StateGX;
struct TextureBuffer;
class CapTexture;
class CpuTexture;
class DrawGX;
class DrawPathBase;
class DrawPathBloom;
class DrawPathDOF;
class DrawPathHDR;
class DrawPathLightMap;
class DrawPathShadowVolume;
class Fog;
class FogManager;
class G3DUtility;
class GfxEngine;
class GXUtility;
class IDrawGX;
class IScnProc;
class IScnProcModel;
class LightObj;
class LightManager;
class LightTexture;
class LightTextureManager;
class ModelBoundingInfo;
class ModelEx;
class ModelSnapshot;
class PostEffectBase;
class PostEffectBlur;
class PostEffectBlurGather;
class PostEffectHDR;
class PostEffectSimple;
class ResTIMG;
class ScnRenderer;
class ScnRootEx;
class Screen;
class ScreenEffectBase;
class ShadowTextureManager;
class ShadowTexture;
class StateGX;
class StateGX;
class TextureBuffer;
// math
template <typename T> struct Math;
struct Matrix33f;
struct Matrix34f;
struct Matrix44f;
struct Quatf;
struct Vector2f;
struct Vector3f;
template <typename T> class Math;
class Matrix33f;
class Matrix34f;
class Matrix44f;
class Quatf;
class Vector2f;
class Vector3f;
// core
struct Allocator;
struct Archive;
struct AsyncDisplay;
template <typename T> struct IBinary;
template <typename T> struct TBitFlag;
struct CntFile;
struct ColorFader;
struct Decomp;
struct Display;
struct Disposer;
struct DvdFile;
struct DvdRipper;
struct ExpHeap;
struct Fader;
struct FrmHeap;
struct Heap;
struct Scene;
struct SceneManager;
struct Thread;
struct Video;
struct Xfb;
struct XfbManager;
class Allocator;
class Archive;
class AsyncDisplay;
template <typename T> class IBinary;
template <typename T> class TBitFlag;
class CntFile;
class ColorFader;
class Decomp;
class Display;
class Disposer;
class DvdFile;
class DvdRipper;
class ExpHeap;
class Fader;
class FrmHeap;
class Heap;
class Scene;
class SceneManager;
class Thread;
class Video;
class Xfb;
class XfbManager;
// audio
struct ArcPlayer;
struct IAudioMgr;
struct SimpleAudioMgr;
struct SoundHeapMgr;
class ArcPlayer;
class IAudioMgr;
class SimpleAudioMgr;
class SoundHeapMgr;
// util
struct Exception;
struct MsgRes;
class Exception;
class MsgRes;
} // namespace EGG
+15
View File
@@ -0,0 +1,15 @@
#pragma once
#include <lib/nw4r/nw4r_types.h>
namespace nw4r
{
namespace math
{
class VEC3 {
public:
f32 x,y,z;
};
} // namespace math
} // namespace nw4r
+6 -6
View File
@@ -43,12 +43,12 @@ namespace nw4r
namespace math
{
struct VEC2;
struct VEC3;
struct MTX33;
struct MTX34;
struct AABB;
struct FRUSTUM;
class VEC2;
class VEC3;
class MTX33;
class MTX34;
class AABB;
class FRUSTUM;
}
namespace snd
+23
View File
@@ -0,0 +1,23 @@
#pragma once
#include <lib/nw4r/nw4r_types.h>
namespace nw4r
{
namespace snd
{
class SoundSystem {
public:
struct SoundSystemParam {
int soundThreadPriority;
int soundThreadStackSize;
int dvdThreadPriority;
int dvdThreadStackSize;
};
};
} // namespace snd
} // namespace nw4r
+7
View File
@@ -3,9 +3,16 @@
#include <types.h>
struct mAng {
public:
s16 val;
};
class mAng3_c {
public:
s16 x,y,z;
void set(s16 fx, s16 fy, s16 fz) {
x = fx;
y = fy;
z = fz;
}
};
+85
View File
@@ -0,0 +1,85 @@
#pragma once
#include <types.h>
#include <lib/rvl/MTX.h>
#include <lib/nw4r/math/vec.h>
class mVec3_c {
public:
f32 x;
f32 y;
f32 z;
/// @brief Constructs an empty vector.
mVec3_c() {}
/// @brief Constructs a vector from a float array.
mVec3_c(const f32 *p) { x = p[0]; y = p[1]; z = p[2]; }
/// @brief Constructs a vector from three floating point values.
mVec3_c(f32 fx, f32 fy, f32 fz) { x = fx; y = fy; z = fz; }
void set(f32 fx, f32 fy, f32 fz) { x = fx; y = fy; z = fz; }
mVec3_c& operator=(mVec3_c& 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; y = v.y; z = v.z; }
/// @brief Constructs a new vector from an existing vector from the nw4r::math library.
mVec3_c(const nw4r::math::VEC3 &v) { x = v.x; y = v.y; z = v.z; }
/// @brief Float cast operator.
operator f32*() { return &x; }
/// @brief Const float cast operator.
operator const f32*() const { return &x; }
/// @brief Vec cast operator.
operator Vec*() { return (Vec*)&x; }
/// @brief Const Vec cast operator.
operator const Vec*() const { return (const Vec*)&x; }
/// @brief nw4r::math::VEC3 cast operator.
operator nw4r::math::VEC3*() { return (nw4r::math::VEC3*)&x; }
/// @brief Const nw4r::math::VEC3 cast operator.
operator const nw4r::math::VEC3*() const { return (const nw4r::math::VEC3*)&x; }
/// @brief Augmented addition 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; y -= v.y; z -= v.z; return *this; }
/// @brief Augmented scalar product operator.
mVec3_c &operator*=(f32 f) { x *= f; y *= f; z *= f; return *this; }
/// @brief Augmented scalar division operator.
mVec3_c &operator/=(f32 f) { return operator*=(1.0f / f); }
/// @brief Positive operator.
mVec3_c operator+() const { return *this; }
/// @brief Negative operator.
mVec3_c operator-() const { return mVec3_c(-x, -y, -z); }
/// @brief Addition operator.
mVec3_c operator+(const mVec3_c &v) const { return mVec3_c(x + v.x, y + v.y, z + v.z); }
/// @brief Subtraction operator.
mVec3_c operator-(const mVec3_c &v) const { return mVec3_c(x - v.x, y - v.y, z - v.z); }
/// @brief Scalar product operator.
mVec3_c operator*(f32 f) const { return mVec3_c(f * x, f * y, f * z); }
/// @brief Scalar division operator.
mVec3_c operator/(f32 f) const { f32 r = 1.0f / f; return operator*(r); }
/// @brief Equality operator.
bool operator==(const mVec3_c &v) const { return x == v.x && y == v.y && z == v.z; }
/// @brief Inequality operator.
bool operator!=(const mVec3_c &v) const { return x != v.x || y != v.y || z != v.z; }
};
+11
View File
@@ -0,0 +1,11 @@
#pragma once
#include <types.h>
#include <lib/egg/audio/eggAudioMgr.h>
// Size: 0x6d0
class SndAudioMgr : public EGG::SimpleAudioMgr {
public:
};
+31
View File
@@ -0,0 +1,31 @@
#pragma once
#include <types.h>
#include <d/d_base.h>
#define MAX_ROOM_NUMBER 64
class dRoom;
class RoomTable {
RoomTable();
virtual ~RoomTable();
dRoom* rooms[MAX_ROOM_NUMBER-1];
};
// OBJ NAME: STAGE
// Ghidra: RoomManager
// size: 0x239c
// vtable: 8052dff4
class RoomManager : public dBase_c {
public:
/* 0068 */ char field_0x68[0x7C - 0x68];
/* 007C */ RoomTable rooms;
/* 017c */ char fader[0x1a0 - 0x17c]; // size unk
/* 01a0 */ char mapRelated[0x39c - 0x1a0]; // size unk
/* 039c */ u32 loaded_entities[2047];
/* 2398 */ u8 curr_room_id;
public:
/* 80575760 */ static RoomManager* m_Instance;
public:
/* 801b42b0 */ static dBase_c* getRoom(int roomid);
};
+22 -44
View File
@@ -85,49 +85,27 @@ public:
// it could also potentially be a static function
// ----------------------------------------------------------
public:
// 0x800099b0
u16* getStoryFlags0();
// 0x800099c0
u16* getStoryFlags1();
// 0x800099d0
u16* getItemFlags0();
// 0x800099e0
u16* getItemFlags1();
// 0x800099F0
u16* getDungeonFlags0();
// 0x80009A00
u16* getDungeonFlags1();
// 0x80009A10
u16* getSceneFlags0();
// 0x80009A20
u16* getSceneFlags1();
// 0x80009A30
u16* getTboxFlags0();
// 0x80009A40
u16* getTboxFlags1();
// 0x80009A50
u16* getTempFlags0();
// 0x80009A60
u16* getTempFlags1();
// 0x80009A70
u16* getZoneFlags0();
// 0x80009A80
u16* getZoneFlags1();
// 0x80009A90
u16* getUnkFlags0();
// 0x80009AA0
u16* getUnkFlags1();
// 0x80009AB0
s16* getPlayerName(); // UTF16-BE
// 0x80009AC0
void setAreaT1(char* name);
// 0x80009BE0
s8* getAreaT1();
// 0x80009BF0
void setAreaT2(char* name);
// lbl_80009D10
s8* getAreaT2();
// lbl_80009D20
s8* getAreaT3();
/* 800099b0 */ u16* getStoryFlags0();
/* 800099c0 */ u16* getStoryFlags1();
/* 800099d0 */ u16* getItemFlags0();
/* 800099e0 */ u16* getItemFlags1();
/* 800099F0 */ u16* getDungeonFlags0();
/* 80009A00 */ u16* getDungeonFlags1();
/* 80009A10 */ u16* getSceneFlags0();
/* 80009A20 */ u16* getSceneFlags1();
/* 80009A30 */ u16* getTboxFlags0();
/* 80009A40 */ u16* getTboxFlags1();
/* 80009A50 */ u16* getTempFlags0();
/* 80009A60 */ u16* getTempFlags1();
/* 80009A70 */ u16* getZoneFlags0();
/* 80009A80 */ u16* getZoneFlags1();
/* 80009A90 */ u16* getUnkFlags0();
/* 80009AA0 */ u16* getUnkFlags1();
/* 80009AB0 */ s16* getPlayerName(); // UTF16-BE
/* 80009AC0 */ void setAreaT1(char* name);
/* 80009BE0 */ s8* getAreaT1();
/* 80009BF0 */ void setAreaT2(char* name);
/* 80009D10 */ s8* getAreaT2();
/* 80009D20 */ s8* getAreaT3();
};
+14 -1
View File
@@ -1,5 +1,8 @@
#pragma once
#define TYPES_H
#include <lib/rvl/macros.h>
typedef signed char s8;
typedef signed short s16;
typedef signed int s32;
@@ -32,7 +35,17 @@ typedef double f64;
typedef volatile f32 vf32;
typedef volatile f64 vf64;
#define nullptr 0
// Necesary for CW
#if __cplusplus < 201103L && !defined(_WIN32)
#define override
#define noexcept
#define nullptr NULL
#endif
#ifndef NULL
#define NULL 0
#endif
#define nullptr NULL
// taken from mkw
#ifdef __cplusplus