Expand dAcBase work

This commit is contained in:
CovenEsme
2024-05-24 14:37:17 +01:00
parent db430ccc91
commit d9e22fe76d
21 changed files with 882 additions and 187 deletions
+22
View File
@@ -0,0 +1,22 @@
#ifndef EVENT_H
#define EVENT_H
#include <common.h>
class Event {
public:
void *unk;
u32 eventFlags;
s32 roomid;
s32 toolDataid;
char eventName[32];
void *eventZevData;
void *callback1;
void *callback2;
public:
Event(char *eventName, u32 unk, u32 eventFlags, void *callback1, void *callback2);
virtual ~Event();
};
#endif
+1 -1
View File
@@ -163,7 +163,7 @@ public:
/* 8000BA70 */ void setBeaconPos(u32 beaconArea, u32 beaconNum, mVec3_c *pos);
/* 8000BB80 */ mVec3_c *getBeaconPos(u32 beaconArea, u32 beaconNum);
/* 8000BC70 */ void setEnemyKillCount(u32 enemy, u16 killCount);
/* 8000BCE0 */ u16 getEnemyKillCount(u32 enemy);
/* 8000BCE0 */ s16 getEnemyKillCount(u32 enemy);
/* 8000BD60 */ void setHitCountFromEnemy(u32 enemy, u16 hitCount);
/* 8000BDD0 */ u16 getHitCountFromEnemy(u32 enemy);
+79
View File
@@ -0,0 +1,79 @@
#ifndef MISC_FLAG_MANAGERS_H
#define MISC_FLAG_MANAGERS_H
#include <common.h>
#include <toBeSorted/bitwise_flag_helper.h>
#include <toBeSorted/flag_space.h>
class CommittableFlagManager {
public:
bool mNeedsCommit;
virtual void doCommit() = 0;
bool commitIfNecessary();
void setNeedsCommit(bool commit) {
mNeedsCommit = commit;
}
CommittableFlagManager() {
mNeedsCommit = false;
}
CommittableFlagManager(bool commit) {
mNeedsCommit = commit;
}
};
class TBoxFlagManager : public CommittableFlagManager {
public:
FlagSpace mFlagSpace;
u16 mSceneIndex;
BitwiseFlagHelper mFlagHelper;
static u16 sTBoxFlags[2];
static TBoxFlagManager *sInstance;
virtual void doCommit() override;
bool checkUncommittedFlag(u16 flag);
TBoxFlagManager();
virtual ~TBoxFlagManager() {}
void init();
void copyFromSave(s16 sceneIndex);
bool checkFlag(u16 sceneIndex, u16 flag);
virtual u16 getFlagCount() const;
void setFlag(u16 flag);
bool checkUncommittedFlag(u16 sceneIndex, u16 flag);
u16 checkUncommittedFlag2(u16 flag) {
return checkUncommittedFlag(flag);
}
};
// NOTE: Not actually Enemy Defeat.
// This is a little more than that, it keeps track of live objects based on their id as a whole
class EnemyDefeatManager : public CommittableFlagManager {
public:
FlagSpace mFlagSpace;
BitwiseFlagHelper mFlagHelper;
u16 mSceneIndex;
static u16 sEnemyDefeatFlags[4096];
static EnemyDefeatManager *sInstance;
void clearSavedFlags();
bool checkUncommittedFlag(u16 flag);
u16 checkUncommittedFlag2(u16 flag) {
return checkUncommittedFlag(flag);
}
EnemyDefeatManager();
void init();
void copyFromSave(u16 sceneIndex);
void updateFlagIndex(u16 sceneIndex);
void clearAll();
bool checkIsValidFlag(u16 flag);
bool checkFlag(u16 flag);
virtual ~EnemyDefeatManager() {}
virtual u16 getFlagCount() const;
void setFlag(u16 flag);
};
#endif
+79 -7
View File
@@ -3,16 +3,80 @@
#include "d/d_base.h"
#include <common.h>
#include "m/m_allocator.h"
#include "m/types_m.h"
#define MAX_ROOM_NUMBER 64
class dRoom;
class RoomTable {
RoomTable();
virtual ~RoomTable();
class dRoomModel {
char mainModel[28]; // Actually smdl_c
nw4r::math::AABB *roomBounds;
m3d::anmMatClr_c *anmMatClr;
m3d::anmTexPat_c *anmTexPat;
m3d::anmTexSrt_c *anmTexSrt;
m3d::anmVis_c *anmVis;
};
class dRoomCollision {
char todo[352];
};
class dRoom : dBase_c {
public:
mAllocator_c allocator;
nw4r::g3d::ResFile *roomRes;
char unkWithWater[24];
dRoomModel roomModels[8];
dRoomCollision roomCollisions[2];
char stateMgr[60];
char _0[4];
void *SCEN;
void *PLY;
void *CAM;
void *EVNT;
void *PATH;
void *PNT;
void *BPNT;
void *SPTH;
void *_1;
void *_2;
void *AREA;
char _3[4];
short plyCount;
short camCount;
short evntCount;
short pathCount;
short pntCount;
short bpntCount;
short spthCount;
short _4;
short _5;
short areaCount;
char _6[4];
u8 flags;
void *BZS;
s8 roomid;
char _7[3];
bool hasAnmTexPat;
bool didAlreadyInit;
};
class dRoomTable {
/* 801b4670 */ dRoomTable(dRoomTable *roomTable);
virtual ~dRoomTable();
dRoom *rooms[MAX_ROOM_NUMBER - 1];
};
class MapRelated {
public:
mAllocator_c allocator;
char unk[472];
public:
/* 801b4780 */ void init(MapRelated *);
/* 801b4900 */ void fn_801b4900();
};
// OBJ NAME: STAGE
// Ghidra: RoomManager
// size: 0x239c
@@ -20,9 +84,9 @@ class RoomTable {
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
/* 007C */ dRoomTable rooms;
/* 017c */ char fader[0x1a0 - 0x174]; // size unk
/* 01a0 */ MapRelated mapRelated;
/* 039c */ u32 loaded_entities[2047];
/* 2398 */ u8 curr_room_id;
@@ -31,6 +95,14 @@ public:
public:
/* 801b42b0 */ static dBase_c *getRoom(int roomid);
/* 801b42d0 */ static void bindStageResToFile(nw4r::g3d::ResFile *);
/* 801b4320 */ static void bindSkyCmnToResFile(nw4r::g3d::ResFile *);
/* 801b4380 */ static bool getMA0AnmTexSrt(nw4r::g3d::ResAnmTexSrt *, char *);
/* 801b4420 */ static bool getMA0IndirectSrt(nw4r::g3d::ResAnmTexSrt *, char *);
/* 801b44c0 */ static void changeLoadedEntities(RoomManager *mgr, u32 index_shift, bool set);
/* 801b4510 */ static u32 checkRoomFlag(RoomManager *mgr, u32 flag);
/* 801b4550 */ static bool checkEnemyDefeatFlag(RoomManager *mgr, u32 flag);
/* 801b45c0 */ static bool fn_801B45C0(RoomManager *mgr /* plus others */);
};
#endif
+25
View File
@@ -0,0 +1,25 @@
#ifndef SCGAME_H
#define SCGAME_H
#include <common.h>
struct SpawnInfo {
/* 0x00 */ char stageName[32];
/* 0x20 */ s16 transitionFadeFrames;
/* 0x22 */ s8 room;
/* 0x23 */ s8 layer;
/* 0x24 */ s8 entrance;
/* 0x25 */ s8 night;
/* 0x26 */ s8 trial;
/* 0x27 */ s8 transitionType;
/* 0x28 */ s32 unk;
};
class ScGame {
public:
static SpawnInfo currentSpawnInfo;
static SpawnInfo nextSpawnInfo;
static ScGame *sInstance;
};
#endif
@@ -0,0 +1,20 @@
#ifndef SPECIAL_ITEM_DROP_MGR_H
#define SPECIAL_ITEM_DROP_MGR_H
#include <common.h>
class SpecialItemDropMgr {
public:
static SpecialItemDropMgr *sInstance;
SpecialItemDropMgr();
static int fn_800C7BB0(SpecialItemDropMgr *mgr, int specialItemId);
static short fn_800C7D00(SpecialItemDropMgr *mgr, int specialItemId);
static short fn_800C7D20(SpecialItemDropMgr *mgr, int specialItemId);
static int giveSpecialDropItem(SpecialItemDropMgr *mgr, int specialItemId, int roomid, mVec3_c *pos, int subtype, s16 *rot, s32 unused);
static bool spawnSpecialDropItem(SpecialItemDropMgr *mgr, int specialItemId, int roomid, mVec3_c *pos, int subtype, s16 *rot);
static void fn_800C81D0(s16, s16, s16);
~SpecialItemDropMgr();
};
#endif