more CREATE_ALLOCATOR macros

This commit is contained in:
elijah-thomas774
2026-04-11 12:32:15 -04:00
parent 124935c073
commit 7156493229
14 changed files with 31 additions and 46 deletions
+6 -3
View File
@@ -254,14 +254,17 @@ public:
return result; \
} while (0)
// Use this in actors' create functions
#define CREATE_ALLOCATOR(className) \
#define CREATE_ALLOCATOR_SIZE(className, size) \
do { \
if (!initAllocatorWork1Heap(-1, #className "::m_allocator", 0x20)) { \
if (!initAllocatorWork1Heap(size, #className "::m_allocator", 0x20)) { \
return FAILED; \
} \
} while (0)
// Use this in actors' create functions
#define CREATE_ALLOCATOR(className) CREATE_ALLOCATOR_SIZE(className, -1)
#define CREATE_ALLOCATOR_UNCHECKED(className) initAllocatorWork1Heap(-1, #className "::m_allocator", 0x20)
class dAcObjRef_unk {
public:
dAcObjRef_unk(dAcObjBase_c *ref) : mObj(nullptr), refOwner(ref) {}
+1 -3
View File
@@ -14,9 +14,7 @@ bool dAcNpcRivalLOD_c::createHeap() {
return true;
}
int dAcNpcRivalLOD_c::create() {
if (!initAllocatorWork1Heap(-1, "dAcNpcRivalLOD_c::m_allocator", 0x20)) {
return FAILED;
}
CREATE_ALLOCATOR(dAcNpcRivalLOD_c);
0.0f; // float order, cool
mAcceleration = -1.0f;
mMaxSpeed = -40.0f;
+3 -3
View File
@@ -1,5 +1,7 @@
#include "d/a/obj/d_a_obj_bird_statue.h"
#include "d/a/obj/d_a_obj_base.h"
SPECIAL_ACTOR_PROFILE(OBJ_BIRD_STATUE, dAcOBirdStatue_c, fProfile::OBJ_BIRD_STATUE, 0x285, 0, 3);
bool dAcOBirdStatue_c::createHeap() {
@@ -22,9 +24,7 @@ bool dAcOBirdStatue_c::createHeap() {
}
int dAcOBirdStatue_c::create() {
if (!initAllocatorWork1Heap(0xffffffff, "dAcOBirdStatue_c::m_allocator", 0x20)) {
return FAILED;
}
CREATE_ALLOCATOR(dAcOBirdStatue_c);
updateMatrix();
mMdl.setLocalMtx(mWorldMtx);
mVec3_c min, max;
+1 -3
View File
@@ -109,9 +109,7 @@ bool dAcOChest_c::createHeap() {
}
int dAcOChest_c::create() {
if (!initAllocatorWork1Heap(0x4000, "dAcOChest_c::m_allocator", 0x20)) {
return FAILED;
}
CREATE_ALLOCATOR_SIZE(dAcOChest_c, 0x4000);
mBgW.Lock();
dBgS::GetInstance()->Regist(&mBgW, this);
dBgS::GetInstance()->RegistBg(&mBgW, this);
+2 -3
View File
@@ -2,6 +2,7 @@
#include "common.h"
#include "d/a/d_a_player.h"
#include "d/a/obj/d_a_obj_base.h"
#include "f/f_base.h"
#include "m/m_vec.h"
#include "nw4r/g3d/res/g3d_resfile.h"
@@ -20,9 +21,7 @@ bool dAcODecoB_c::createHeap() {
}
int dAcODecoB_c::create() {
if (!initAllocatorWork1Heap(0x1000, "dAcODecoB_c::m_allocator", 0x20)) {
return FAILED;
}
CREATE_ALLOCATOR_SIZE(dAcODecoB_c, 0x1000);
mAcceleration = 0.0f;
mMaxSpeed = 0.0f;
mStateMgr.changeState(StateID_Wait);
+3 -6
View File
@@ -4,6 +4,7 @@
#include "c/c_math.h"
#include "common.h"
#include "d/a/d_a_player.h"
#include "d/a/obj/d_a_obj_base.h"
#include "d/col/bg/d_bg_s.h"
#include "d/col/cc/d_cc_s.h"
#include "d/flag/sceneflag_manager.h"
@@ -116,9 +117,7 @@ int dAcODungeonShip_c::create() {
mIsDocked = true;
}
if (!initAllocatorWork1Heap(0x40000, "dAcODungeonShip_c::m_allocator", 0x20)) {
return FAILED;
}
CREATE_ALLOCATOR_SIZE(dAcODungeonShip_c, 0x40000);
mPathIdx = mParams & 0xFF;
if (mPathIdx == 0xFF) {
@@ -190,9 +189,7 @@ int dAcODungeonShip_c::actorExecute() {
mAnmMatClr.play();
mMdl.calc(false);
if (field_0x8D8) {
mEffects[0].holdEffect(
PARTICLE_RESOURCE_ID_MAPPING_682_, mPosition, &mRotation, nullptr, nullptr, nullptr
);
mEffects[0].holdEffect(PARTICLE_RESOURCE_ID_MAPPING_682_, mPosition, &mRotation, nullptr, nullptr, nullptr);
}
if (field_0x8D9) {
@@ -46,7 +46,7 @@ const cCcD_SrcGObj dAcOFlyingClawshotTarget_c::sColSrc = {
// clang-format on
int dAcOFlyingClawshotTarget_c::actorCreate() {
initAllocatorWork1Heap(-1, "dAcOFlyingClawshotTarget_c::m_allocator", 0x20);
CREATE_ALLOCATOR_UNCHECKED(dAcOFlyingClawshotTarget_c);
mMdl.setPriorityDraw(0x7F, 0x7F);
mWorldMtx.transS(mVec3_c::Zero);
+2 -3
View File
@@ -1,5 +1,6 @@
#include "d/a/obj/d_a_obj_pumpkin_leaf.h"
#include "d/a/obj/d_a_obj_base.h"
#include "nw4r/g3d/res/g3d_resfile.h"
#include "s/s_Math.h"
@@ -15,9 +16,7 @@ bool dAcOPumpkinLeaf_c::createHeap() {
}
int dAcOPumpkinLeaf_c::create() {
if (!initAllocatorWork1Heap(0x1000, "dAcOPumpkinLeaf_c::m_allocator", 0x20)) {
return FAILED;
}
CREATE_ALLOCATOR_SIZE(dAcOPumpkinLeaf_c, 0x1000);
mAcceleration = -1.0f;
mMaxSpeed = -40.0f;
+2 -3
View File
@@ -1,5 +1,6 @@
#include "d/a/obj/d_a_obj_spike.h"
#include "d/a/obj/d_a_obj_base.h"
#include "d/col/cc/d_cc_s.h"
SPECIAL_ACTOR_PROFILE(OBJ_SPIKE, dAcOspike_c, fProfile::OBJ_SPIKE, 0x1D9, 0, 2);
@@ -25,9 +26,7 @@ bool dAcOspike_c::createHeap() {
}
int dAcOspike_c::create() {
if (!initAllocatorWork1Heap(-1, "dAcOspike_c::m_allocator", 0x20)) {
return FAILED;
}
CREATE_ALLOCATOR(dAcOspike_c);
mStts.SetDefaultRank();
mCollision.Set(sCcSrc);
@@ -1,6 +1,7 @@
#include "d/a/obj/d_a_obj_toD3_stone_figure.h"
#include "d/a/d_a_item.h"
#include "d/a/obj/d_a_obj_base.h"
#include "d/col/cc/d_cc_s.h"
#include "d/d_sc_game.h"
#include "d/flag/storyflag_manager.h"
@@ -39,9 +40,8 @@ int dAcOtoD3StoneFigure_c::create() {
mIsSkyKeepAlreadyOpen = isStoneOfTrialsPlaced();
mExitId = mParams & 0xFF;
updateMatrix();
if (!initAllocatorWork1Heap(-1, "dAcOtoD3StoneFigure_c::m_allocator", 0x20)) {
return FAILED;
}
CREATE_ALLOCATOR(dAcOtoD3StoneFigure_c);
mMdl.setLocalMtx(mWorldMtx);
mStts.SetDefaultRank();
+2 -6
View File
@@ -34,9 +34,7 @@ bool dAcOTowerGearD101_c::createHeap() {
}
int dAcOTowerGearD101_c::actorCreate() {
if (!initAllocatorWork1Heap(0x1000, "dAcOTowerGearD101_c::m_allocator", 0x20)) {
return FAILED;
}
CREATE_ALLOCATOR_SIZE(dAcOTowerGearD101_c, 0x1000);
nw4r::g3d::ResMdl mdl = mMdl.getResMdl();
mMdlCallback.init(mdl.GetResNode("model0").GetID());
mMdl.setCallback(&mMdlCallback);
@@ -128,7 +126,5 @@ void dAcOTowerGearD101_c::initTransform() {
}
void dAcOTowerGearD101_c::playVisualEffect() {
mEffects.holdEffect(
PARTICLE_RESOURCE_ID_MAPPING_572_, field_0x3F4, &mRotation, nullptr, nullptr, nullptr
);
mEffects.holdEffect(PARTICLE_RESOURCE_ID_MAPPING_572_, field_0x3F4, &mRotation, nullptr, nullptr, nullptr);
}
+2 -3
View File
@@ -1,6 +1,7 @@
#include "d/a/obj/d_a_obj_triforce.h"
#include "c/c_math.h"
#include "d/a/obj/d_a_obj_base.h"
#include "d/col/cc/d_cc_s.h"
#include "m/m_vec.h"
#include "nw4r/g3d/res/g3d_resfile.h"
@@ -32,9 +33,7 @@ bool dAcOtriforce_c::createHeap() {
}
int dAcOtriforce_c::create() {
if (!initAllocatorWork1Heap(-1, "dAcOtriforce_c::m_allocator", 0x20)) {
return FAILED;
}
CREATE_ALLOCATOR(dAcOtriforce_c);
mStts.SetDefaultRank();
mCollision.Set(sCcSrc);
@@ -40,9 +40,7 @@ int dAcOUgSwitch_c::create() {
mActiveSceneFlag = mParams & 0xFF;
field_0x3BD = (mParams >> 8) & 0xFF;
setVariant((mParams >> 16) & 0xF);
if (!initAllocatorWork1Heap(0x1000, "dAcOUgSwitch_c::m_allocator", 0x20)) {
return FAILED;
}
CREATE_ALLOCATOR_SIZE(dAcOUgSwitch_c, 0x1000);
mOnEventTimer = 0;
updateMatrix();
+2 -3
View File
@@ -4,6 +4,7 @@
#include "c/c_math.h"
#include "d/a/d_a_item.h"
#include "d/a/d_a_player.h"
#include "d/a/obj/d_a_obj_base.h"
#include "d/col/c/c_cc_d.h"
#include "d/col/cc/d_cc_s.h"
#include "d/d_pouch.h"
@@ -33,9 +34,7 @@ bool dTgReaction_c::createHeap() {
int dTgReaction_c::create() {
// Note the double _c here
if (!initAllocatorWork1Heap(0x1000, "dTgReaction_c_c::m_allocator", 0x20)) {
return FAILED;
}
CREATE_ALLOCATOR_SIZE(dTgReaction_c_c, 0x1000);
if (getReactType() != REACT_UNDERWATER) {
if (getSceneFlag() >= 0xFF) {