Review comments

This commit is contained in:
robojumper
2025-03-09 18:56:32 +01:00
parent 08d659a21c
commit 1be580fb78
5 changed files with 67 additions and 81 deletions
+1 -9
View File
@@ -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
View File
@@ -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:
+2 -15
View File
@@ -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;
+45
View File
@@ -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