mirror of
https://github.com/zeldaret/ss
synced 2026-06-13 13:56:38 -04:00
Review comments
This commit is contained in:
@@ -94,7 +94,7 @@ public:
|
||||
/* 0xF4 */ char someStr[4];
|
||||
/* 0xF8 */ char field_0xf8[0xfc - 0xf8];
|
||||
|
||||
protected:
|
||||
public:
|
||||
/* 80501544 */ // vtable
|
||||
/* 0x08 | 8002c880 */ virtual int create();
|
||||
/* 0x10 | 8002c8f0 */ virtual void postCreate(MAIN_STATE_e state);
|
||||
@@ -173,14 +173,6 @@ public:
|
||||
return actor_properties & property;
|
||||
}
|
||||
|
||||
void callunkVirtFunc_0x60() {
|
||||
unkVirtFunc_0x60();
|
||||
}
|
||||
|
||||
void callrestorePosRotFromCopy() {
|
||||
restorePosRotFromCopy();
|
||||
}
|
||||
|
||||
public:
|
||||
// funcs found in TU
|
||||
/* 8002c650 */ static void setTempCreateParams(
|
||||
|
||||
+1
-39
@@ -18,6 +18,7 @@
|
||||
#include "nw4r/math/math_geometry.h"
|
||||
#include "s/s_State.hpp"
|
||||
#include "sized_string.h"
|
||||
#include "toBeSorted/raii_ptr.h"
|
||||
#include "toBeSorted/unk_with_water.h"
|
||||
|
||||
struct DrawPriorityConfig {
|
||||
@@ -26,45 +27,6 @@ struct DrawPriorityConfig {
|
||||
u8 pDrawOpa2;
|
||||
};
|
||||
|
||||
// This could be std::unique_ptr, but we don't have it yet
|
||||
template <typename T>
|
||||
class RaiiPtr {
|
||||
public:
|
||||
T *mPtr;
|
||||
|
||||
RaiiPtr() : mPtr(nullptr) {}
|
||||
~RaiiPtr() {
|
||||
if (mPtr != nullptr) {
|
||||
delete mPtr;
|
||||
mPtr = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void operator=(T *ptr) {
|
||||
mPtr = ptr;
|
||||
}
|
||||
|
||||
operator bool() const {
|
||||
return mPtr != nullptr;
|
||||
}
|
||||
|
||||
const T *operator->() const {
|
||||
return mPtr;
|
||||
}
|
||||
|
||||
T *operator->() {
|
||||
return mPtr;
|
||||
}
|
||||
|
||||
const T &operator*() const {
|
||||
return *this->operator->();
|
||||
}
|
||||
|
||||
T &operator*() {
|
||||
return *this->operator->();
|
||||
}
|
||||
};
|
||||
|
||||
class dRoom_c : public dBase_c {
|
||||
class mdl_c : public m3d::smdl_c {
|
||||
public:
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "m/m3d/m_smdl.h"
|
||||
#include "m/m_allocator.h"
|
||||
#include "toBeSorted/effects_struct.h"
|
||||
|
||||
#include "toBeSorted/raii_ptr.h"
|
||||
|
||||
static const u32 OFF = 'off ';
|
||||
static const u32 NONE = 'none';
|
||||
@@ -18,25 +18,12 @@ static const u32 NEXT = 'next';
|
||||
static const u32 ON = 'on ';
|
||||
static const u32 AWAY = 'away';
|
||||
|
||||
class UniquePtrLike {
|
||||
public:
|
||||
m3d::anmChr_c *mPtr;
|
||||
|
||||
UniquePtrLike() : mPtr(nullptr) {}
|
||||
~UniquePtrLike() {
|
||||
if (mPtr != nullptr) {
|
||||
delete mPtr;
|
||||
mPtr = nullptr;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class InteractionMdl {
|
||||
public:
|
||||
m3d::smdl_c mMdl;
|
||||
m3d::anmMatClr_c mAnmClr;
|
||||
m3d::anmTexPat_c mAnmTex;
|
||||
UniquePtrLike mAnmChr;
|
||||
RaiiPtr<m3d::anmChr_c> mAnmChr;
|
||||
u8 field_0x78;
|
||||
u8 field_0x79;
|
||||
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
#ifndef RAII_PTR_H
|
||||
#define RAII_PTR_H
|
||||
|
||||
#include "common.h"
|
||||
|
||||
// This could be std::unique_ptr, but we don't have it yet
|
||||
template <typename T>
|
||||
class RaiiPtr {
|
||||
public:
|
||||
T *mPtr;
|
||||
|
||||
RaiiPtr() : mPtr(nullptr) {}
|
||||
~RaiiPtr() {
|
||||
if (mPtr != nullptr) {
|
||||
delete mPtr;
|
||||
mPtr = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void operator=(T *ptr) {
|
||||
mPtr = ptr;
|
||||
}
|
||||
|
||||
operator bool() const {
|
||||
return mPtr != nullptr;
|
||||
}
|
||||
|
||||
const T *operator->() const {
|
||||
return mPtr;
|
||||
}
|
||||
|
||||
T *operator->() {
|
||||
return mPtr;
|
||||
}
|
||||
|
||||
const T &operator*() const {
|
||||
return *this->operator->();
|
||||
}
|
||||
|
||||
T &operator*() {
|
||||
return *this->operator->();
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
+18
-18
@@ -50,13 +50,13 @@ extern "C" void parseRoomBzs(int roomid, void *bzs);
|
||||
int dRoom_c::create() {
|
||||
roomid = params & 0x3F;
|
||||
mCanHavePastState = dStageMgr_c::GetInstance()->getSTIFunk1() == 0 &&
|
||||
// SSH machine room (less sure about D303...)
|
||||
!(dScGame_c::isCurrentStage("D301") && roomid == 12) &&
|
||||
!(dScGame_c::isCurrentStage("D303") && roomid == 12) &&
|
||||
// LMF first two rooms, Gust Bellows room
|
||||
!(dScGame_c::isCurrentStage("D300") && (roomid == 0 || roomid == 1 || roomid == 4)) &&
|
||||
// LMF crawlspace, spike maze
|
||||
!(dScGame_c::isCurrentStage("D300_1") && (roomid == 7 || roomid == 9));
|
||||
// SSH machine room (less sure about D303...)
|
||||
!(dScGame_c::isCurrentStage("D301") && roomid == 12) &&
|
||||
!(dScGame_c::isCurrentStage("D303") && roomid == 12) &&
|
||||
// LMF first two rooms, Gust Bellows room
|
||||
!(dScGame_c::isCurrentStage("D300") && (roomid == 0 || roomid == 1 || roomid == 4)) &&
|
||||
// LMF crawlspace, spike maze
|
||||
!(dScGame_c::isCurrentStage("D300_1") && (roomid == 7 || roomid == 9));
|
||||
if (!mAllocator.createNewTempFrmHeap(
|
||||
-1, CurrentStageArcManager::sInstance->getHeap(roomid), "dRoom_c::m_allocator", 0x20, 0
|
||||
)) {
|
||||
@@ -69,7 +69,7 @@ int dRoom_c::create() {
|
||||
dStage_c::bindStageResToFile(&mRoomRes);
|
||||
dStage_c::bindSkyCmnToResFile(&mRoomRes);
|
||||
|
||||
for (s32 i = 0; i < 8; i++) {
|
||||
for (s32 i = 0; i < ARRAY_LENGTH(mModels); 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)) {
|
||||
@@ -133,7 +133,7 @@ int dRoom_c::execute() {
|
||||
if (mCanHavePastState) {
|
||||
val = dTimeAreaMgr_c::sInstance->checkPositionIsInPastState(roomid, mVec3_c::Zero, nullptr, 1000000.0f);
|
||||
mSkipDrawing = !mHasAnmTexPat && (!dTimeAreaMgr_c::sInstance->isInLanayruMiningFacility() || val > 0.0f) &&
|
||||
dTimeAreaMgr_c::sInstance->isField0x78();
|
||||
dTimeAreaMgr_c::sInstance->isField0x78();
|
||||
} else {
|
||||
mSkipDrawing = false;
|
||||
}
|
||||
@@ -144,7 +144,7 @@ int dRoom_c::execute() {
|
||||
}
|
||||
|
||||
executeBg();
|
||||
for (s32 i = 0; i < 8; i++) {
|
||||
for (s32 i = 0; i < ARRAY_LENGTH(mModels); i++) {
|
||||
mModels[i].execute(i, mCanHavePastState, val);
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ int dRoom_c::draw() {
|
||||
if ((mFlags & 2) != 0 || mSkipDrawing) {
|
||||
return SUCCEEDED;
|
||||
}
|
||||
for (s32 i = 0; i < 8; i++) {
|
||||
for (s32 i = 0; i < ARRAY_LENGTH(mModels); i++) {
|
||||
mModels[i].draw(roomid);
|
||||
}
|
||||
return SUCCEEDED;
|
||||
@@ -165,7 +165,7 @@ void deactivateUpdatesCb(dAcBase_c *ac) {
|
||||
if (!ac->checkActorProperty(0x400)) {
|
||||
return;
|
||||
}
|
||||
ac->callunkVirtFunc_0x60();
|
||||
ac->unkVirtFunc_0x60();
|
||||
}
|
||||
|
||||
void dRoom_c::deactivateUpdates() {
|
||||
@@ -180,7 +180,7 @@ void activateUpdatesCb(dAcBase_c *ac) {
|
||||
if (!ac->checkActorProperty(0x400)) {
|
||||
return;
|
||||
}
|
||||
ac->callrestorePosRotFromCopy();
|
||||
ac->restorePosRotFromCopy();
|
||||
}
|
||||
|
||||
void dRoom_c::activateUpdates() {
|
||||
@@ -220,7 +220,7 @@ static const BgData sRoomBg[] = {
|
||||
};
|
||||
|
||||
bool dRoom_c::setupBg() {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
for (int i = 0; i < ARRAY_LENGTH(mBg); i++) {
|
||||
dBgWKCol *bg = &mBg[i];
|
||||
void *kcl = CurrentStageArcManager::sInstance->getDataFromRoomArc(roomid, sRoomBg[i].kcl);
|
||||
if (kcl != nullptr) {
|
||||
@@ -245,7 +245,7 @@ bool dRoom_c::setupBg() {
|
||||
}
|
||||
|
||||
void dRoom_c::executeBg() {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
for (int i = 0; i < ARRAY_LENGTH(mBg); i++) {
|
||||
if (!mBg[i].ChkNotReady()) {
|
||||
dBgS::GetInstance()->Regist(&mBg[i], (dAcObjBase_c *)nullptr);
|
||||
}
|
||||
@@ -281,7 +281,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 < 8; i++) {
|
||||
for (int i = 0; i < ARRAY_LENGTH(mModels); i++) {
|
||||
mVec3_c tMin, tMax;
|
||||
mModels[i].getBounds(&tMin, &tMax);
|
||||
if (i == 0) {
|
||||
@@ -301,13 +301,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 < 8; i++) {
|
||||
for (int i = 0; i < ARRAY_LENGTH(mModels); i++) {
|
||||
mModels[i].updateObjNode(objName, visible);
|
||||
}
|
||||
}
|
||||
|
||||
void dRoom_c::destroyModels() {
|
||||
for (int i = 0; i < 8; i++) {
|
||||
for (int i = 0; i < ARRAY_LENGTH(mModels); i++) {
|
||||
mModels[i].destroy();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user