Repair some room damage

This commit is contained in:
robojumper
2025-03-09 19:32:07 +01:00
parent 39ff2c753b
commit a507d8fc0a
4 changed files with 42 additions and 20 deletions
+2 -2
View File
@@ -11039,8 +11039,8 @@ execute__7dRoom_cFv = .text:0x801B6670; // type:function size:0x140
executeState__75sStateMgr_c<7dRoom_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x801B67B0; // type:function size:0x10
draw__7dRoom_cFv = .text:0x801B67C0; // type:function size:0x84
getEntranceById__7dRoom_cCFUc = .text:0x801B6850; // type:function size:0x34
fn_801B6890 = .text:0x801B6890; // type:function size:0x10
RoomManager__getEVNTForIndex = .text:0x801B68A0; // type:function size:0x10
getCamForIndex__7dRoom_cCFUl = .text:0x801B6890; // type:function size:0x10
getEventForIndex__7dRoom_cCFUl = .text:0x801B68A0; // type:function size:0x10
deactivateUpdatesCb__FP9dAcBase_c = .text:0x801B68B0; // type:function size:0x20
deactivateUpdates__7dRoom_cFv = .text:0x801B68D0; // type:function size:0x54
activateUpdatesCb__FP9dAcBase_c = .text:0x801B6930; // type:function size:0x20
+1 -1
View File
@@ -55,7 +55,7 @@ struct EVNT {
/* 0x11 */ u8 skipFlag;
/* 0x12 */ u8 _0x12[2];
/* 0x14 */ u16 item;
/* 0x16 */ u16 _0x16[2];
/* 0x16 */ u16 _0x16[1];
/* 0x18 */ char name[32];
};
+7 -2
View File
@@ -27,6 +27,9 @@ struct DrawPriorityConfig {
u8 pDrawOpa2;
};
#define ROOM_NUM_MODELS (8)
#define ROOM_NUM_BG (2)
class dRoom_c : public dBase_c {
class mdl_c : public m3d::smdl_c {
public:
@@ -113,6 +116,8 @@ public:
void drawOnMapIfVisible(mMtx_c *mtx, int param);
void getBounds(mVec3_c *min, mVec3_c *max) const;
const PLY *getEntranceById(u8 id) const;
const CAM *getCamForIndex(u32 idx) const;
const EVNT *getEventForIndex(u32 idx) const;
void someLastBossThing(bool arg);
f32 getFrame() const;
@@ -194,8 +199,8 @@ private:
/* 0x068 */ mHeapAllocator_c mAllocator;
/* 0x084 */ nw4r::g3d::ResFile mRoomRes;
/* 0x088 */ UnkWithWater mWaterThing;
/* 0x0A0 */ model_c mModels[8];
/* 0x220 */ dBgWKCol mBg[2];
/* 0x0A0 */ model_c mModels[ROOM_NUM_MODELS];
/* 0x220 */ dBgWKCol mBg[ROOM_NUM_BG];
/* 0x4E0 */ STATE_MGR_DECLARE(dRoom_c);
/* 0x51C */ const bzsFILE *mpFile;
+32 -15
View File
@@ -10,6 +10,7 @@
#include "d/d_sc_game.h"
#include "d/d_stage.h"
#include "d/d_stage_mgr.h"
#include "d/d_stage_parse.h"
#include "d/flag/sceneflag_manager.h"
#include "d/flag/storyflag_manager.h"
#include "d/t/d_t_mass_obj.h"
@@ -45,8 +46,6 @@ SPECIAL_BASE_PROFILE(ROOM, dRoom_c, fProfile::ROOM, 0x9, 96);
STATE_DEFINE(dRoom_c, Active);
STATE_DEFINE(dRoom_c, NonActive);
extern "C" void parseRoomBzs(int roomid, void *bzs);
int dRoom_c::create() {
roomid = params & 0x3F;
mCanHavePastState = dStageMgr_c::GetInstance()->getSTIFunk1() == 0 &&
@@ -69,7 +68,7 @@ int dRoom_c::create() {
dStage_c::bindStageResToFile(&mRoomRes);
dStage_c::bindSkyCmnToResFile(&mRoomRes);
for (s32 i = 0; i < ARRAY_LENGTH(mModels); i++) {
for (s32 i = 0; i < ROOM_NUM_MODELS; i++) {
model_c *mdl = &mModels[i];
if (i != 2 || roomid != 1 || dScGame_c::currentSpawnInfo.layer != 14 || !dScGame_c::isCurrentStage("F406")) {
if (!mdl->create(mRoomRes, mAllocator, i, &mWaterThing)) {
@@ -144,7 +143,7 @@ int dRoom_c::execute() {
}
executeBg();
for (s32 i = 0; i < ARRAY_LENGTH(mModels); i++) {
for (s32 i = 0; i < ROOM_NUM_MODELS; i++) {
mModels[i].execute(i, mCanHavePastState, val);
}
@@ -155,12 +154,33 @@ int dRoom_c::draw() {
if ((mFlags & 2) != 0 || mSkipDrawing) {
return SUCCEEDED;
}
for (s32 i = 0; i < ARRAY_LENGTH(mModels); i++) {
for (s32 i = 0; i < ROOM_NUM_MODELS; i++) {
mModels[i].draw(roomid);
}
return SUCCEEDED;
}
const PLY *dRoom_c::getEntranceById(u8 entranceId) const {
s32 i = mPlyCount;
const PLY *ply = mpPly;
while (i > 0) {
if (ply->entranceId == entranceId) {
return ply;
}
ply++;
i--;
}
return mpPly;
}
const CAM *dRoom_c::getCamForIndex(u32 idx) const {
return &mpCam[idx];
}
const EVNT *dRoom_c::getEventForIndex(u32 idx) const {
return &mpEvnt[idx];
}
void deactivateUpdatesCb(dAcBase_c *ac) {
if (!ac->checkActorProperty(0x400)) {
return;
@@ -220,7 +240,7 @@ static const BgData sRoomBg[] = {
};
bool dRoom_c::setupBg() {
for (int i = 0; i < ARRAY_LENGTH(mBg); i++) {
for (int i = 0; i < ROOM_NUM_BG; i++) {
dBgWKCol *bg = &mBg[i];
void *kcl = CurrentStageArcManager::sInstance->getDataFromRoomArc(roomid, sRoomBg[i].kcl);
if (kcl != nullptr) {
@@ -245,7 +265,7 @@ bool dRoom_c::setupBg() {
}
void dRoom_c::executeBg() {
for (int i = 0; i < ARRAY_LENGTH(mBg); i++) {
for (int i = 0; i < ROOM_NUM_BG; i++) {
if (!mBg[i].ChkNotReady()) {
dBgS::GetInstance()->Regist(&mBg[i], (dAcObjBase_c *)nullptr);
}
@@ -281,7 +301,7 @@ void dRoom_c::drawOnMapIfVisible(mMtx_c *mtx, int param) {
}
void dRoom_c::getBounds(mVec3_c *min, mVec3_c *max) const {
for (int i = 0; i < ARRAY_LENGTH(mModels); i++) {
for (int i = 0; i < ROOM_NUM_MODELS; i++) {
mVec3_c tMin, tMax;
mModels[i].getBounds(&tMin, &tMax);
if (i == 0) {
@@ -301,13 +321,13 @@ void dRoom_c::formatObj(int obj, SizedString<8> &str) {
void dRoom_c::updateObjNodeInEachRoom(int obj, bool visible) {
SizedString<8> objName;
formatObj(obj, objName);
for (int i = 0; i < ARRAY_LENGTH(mModels); i++) {
for (int i = 0; i < ROOM_NUM_MODELS; i++) {
mModels[i].updateObjNode(objName, visible);
}
}
void dRoom_c::destroyModels() {
for (int i = 0; i < ARRAY_LENGTH(mModels); i++) {
for (int i = 0; i < ROOM_NUM_MODELS; i++) {
mModels[i].destroy();
}
}
@@ -329,15 +349,12 @@ f32 dRoom_c::getFrame() const {
return mModels[0].getFrame();
}
extern "C" void fn_800641D0(int roomid, void *roomBzs);
extern "C" void fn_80064160(int roomid, void *roomBzs);
void dRoom_c::initializeState_Active() {
SceneflagManager::sInstance->unsetZoneflagsForRoom(roomid);
executeBg();
fn_800641D0(roomid, BZS);
parseRoomActivateBzs(roomid, BZS);
if (mDidAlreadyInit) {
fn_80064160(roomid, BZS);
parseRoomReactivateBzs(roomid, BZS);
} else {
mFlags |= 8 | 2;
mDidAlreadyInit = true;