summaryrefslogtreecommitdiff
path: root/src/f_op
diff options
context:
space:
mode:
authorLagoLunatic <LagoLunatic@users.noreply.github.com>2025-06-01 16:05:42 -0400
committerLagoLunatic <LagoLunatic@users.noreply.github.com>2025-06-01 16:05:42 -0400
commitcdfaa05635dc5e4857eede2e1cb66ad37751032e (patch)
treebafe0677a9d83c9f61b055b08e359277f81f3c8f /src/f_op
parent63a92eaa88967ecc21420cb085c69dedf1f839f7 (diff)
More demo work, cleanup
Diffstat (limited to 'src/f_op')
-rw-r--r--src/f_op/f_op_actor_mng.cpp167
1 files changed, 97 insertions, 70 deletions
diff --git a/src/f_op/f_op_actor_mng.cpp b/src/f_op/f_op_actor_mng.cpp
index c4ed5418..cf325328 100644
--- a/src/f_op/f_op_actor_mng.cpp
+++ b/src/f_op/f_op_actor_mng.cpp
@@ -30,12 +30,12 @@
#include "weak_bss_3569.h" // IWYU pragma: keep
#define MAKE_ITEM_PARAMS(itemNo, itemBitNo, switchNo2, type, action) \
- ((itemNo & 0xFF) << 0 | (itemBitNo & 0xFF) << 0x8 | switchNo2 << 0x10 | (type & 0x3) << 0x18 | (action & 0x3F) << 0x1A)
+ ((itemNo & 0xFF) << 0 | (itemBitNo & 0xFF) << 8 | (switchNo2 & 0xFF) << 16 | (type & 0x3) << 24 | (action & 0x3F) << 26)
/* 80024060-80024104 .text fopAcM_setStageLayer__FPv */
void fopAcM_setStageLayer(void* pProc) {
scene_class* stageProc = fopScnM_SearchByID(dStage_roomControl_c::getProcID());
- JUT_ASSERT(0xee, stageProc != NULL);
+ JUT_ASSERT(238, stageProc != NULL);
fpcM_ChangeLayerID(pProc, fopScnM_LayerID(stageProc));
}
@@ -43,7 +43,7 @@ void fopAcM_setStageLayer(void* pProc) {
void fopAcM_setRoomLayer(void* pProc, int room_no) {
if (room_no >= 0) {
scene_class* roomProc = fopScnM_SearchByID(dStage_roomControl_c::getStatusProcID(room_no));
- JUT_ASSERT(0x105, roomProc != NULL);
+ JUT_ASSERT(261, roomProc != NULL);
fpcM_ChangeLayerID(pProc, fopScnM_LayerID(roomProc));
}
}
@@ -269,8 +269,8 @@ fpc_ProcID fopAcM_createChildFromOffset(char* pProcNameString, fpc_ProcID parent
/* 80024B78-80024CA0 .text fopAcM_createHeap__FP10fopAc_ac_cUlUl */
s32 fopAcM_createHeap(fopAc_ac_c* i_this, u32 size, u32 align) {
- JUT_ASSERT(0x33b, i_this);
- JUT_ASSERT(0x33c, i_this->heap == NULL);
+ JUT_ASSERT(827, i_this);
+ JUT_ASSERT(828, i_this->heap == NULL);
fopAcM_Log(i_this, "アクターのヒープの生成");
if (align == 0)
align = 0x20;
@@ -317,8 +317,11 @@ bool fopAcM_entrySolidHeap(fopAc_ac_c* i_this, heapCallbackFunc createHeapCB, u3
heap = mDoExt_createSolidHeapFromGameToCurrent(estimatedHeapSize, 0x20);
if (heap != NULL) {
bool result = createHeapCB(i_this);
+
+#if VERSION > VERSION_DEMO
if (heap->getFreeSize() >= 0x20)
- JKRHeap::alloc(0x20, 0, NULL);
+ JKRAlloc(0x20, 0);
+#endif
mDoExt_restoreCurrentHeap();
@@ -352,7 +355,7 @@ bool fopAcM_entrySolidHeap(fopAc_ac_c* i_this, heapCallbackFunc createHeapCB, u3
if (heap == NULL) {
heap = mDoExt_createSolidHeapFromGameToCurrent(-1, 0x20);
- JUT_ASSERT(0x453, heap);
+ JUT_ASSERT(VERSION_SELECT(1103, 1107, 1107, 1107), heap);
bool result = createHeapCB(i_this);
mDoExt_restoreCurrentHeap();
@@ -389,7 +392,7 @@ bool fopAcM_entrySolidHeap(fopAc_ac_c* i_this, heapCallbackFunc createHeapCB, u3
heap = NULL;
bool result = createHeapCB(i_this);
mDoExt_restoreCurrentHeap();
- JUT_ASSERT(0x48d, result != FALSE);
+ JUT_ASSERT(VERSION_SELECT(1161, 1165, 1165, 1165), result != FALSE);
if (result == FALSE) {
// "Entry failed with the exact size heap? (Bug)\n"
OSReport_Error("ぴったりサイズで、登録失敗?(バグ)\n");
@@ -417,7 +420,7 @@ bool fopAcM_entrySolidHeap(fopAc_ac_c* i_this, heapCallbackFunc createHeapCB, u3
// "Buggy!\n"
OSReport_Error("ばぐばぐです\n");
- JUT_ASSERT(0x4b5, FALSE);
+ JUT_ASSERT(VERSION_SELECT(1201, 1205, 1205, 1205), FALSE);
}
// "fopAcM_entrySolidHeap failed. [%s]\n"
@@ -445,7 +448,7 @@ void fopAcM_setCullSizeSphere(fopAc_ac_c* i_this, f32 x, f32 y, f32 z, f32 r) {
/* 80025114-80025144 .text fopAcM_addAngleY__FP10fopAc_ac_css */
bool fopAcM_addAngleY(fopAc_ac_c* i_this, short target, short step) {
- return cLib_chaseAngleS(&i_this->current.angle.y, target, step);
+ return cLib_chaseAngleS(&fopAcM_GetAngle_p(i_this)->y, target, step);
}
/* 80025144-800251A0 .text fopAcM_calcSpeed__FP10fopAc_ac_c */
@@ -483,24 +486,24 @@ void fopAcM_posMoveF(fopAc_ac_c* i_this, const cXyz* move) {
/* 80025250-80025278 .text fopAcM_searchActorAngleY__FP10fopAc_ac_cP10fopAc_ac_c */
s16 fopAcM_searchActorAngleY(fopAc_ac_c* i_this, fopAc_ac_c* i_other) {
- return cLib_targetAngleY(&i_this->current.pos, &i_other->current.pos);
+ return cLib_targetAngleY(fopAcM_GetPosition_p(i_this), fopAcM_GetPosition_p(i_other));
}
/* 80025278-800252BC .text fopAcM_seenActorAngleY__FP10fopAc_ac_cP10fopAc_ac_c */
s32 fopAcM_seenActorAngleY(fopAc_ac_c* i_this, fopAc_ac_c* i_other) {
- s16 angleY = cLib_targetAngleY(&i_this->current.pos, &i_other->current.pos);
+ s16 angleY = cLib_targetAngleY(fopAcM_GetPosition_p(i_this), fopAcM_GetPosition_p(i_other));
return abs((s16)(angleY - i_this->shape_angle.y));
}
/* 800252BC-80025370 .text fopAcM_searchActorDistance__FP10fopAc_ac_cP10fopAc_ac_c */
f32 fopAcM_searchActorDistance(fopAc_ac_c* i_this, fopAc_ac_c* i_other) {
- cXyz delta = i_other->current.pos - i_this->current.pos;
+ cXyz delta = *fopAcM_GetPosition_p(i_other) - *fopAcM_GetPosition_p(i_this);
return delta.abs();
}
/* 80025370-800253C0 .text fopAcM_searchActorDistance2__FP10fopAc_ac_cP10fopAc_ac_c */
f32 fopAcM_searchActorDistance2(fopAc_ac_c* i_this, fopAc_ac_c* i_other) {
- cXyz delta = i_other->current.pos - i_this->current.pos;
+ cXyz delta = *fopAcM_GetPosition_p(i_other) - *fopAcM_GetPosition_p(i_this);
return delta.abs2();
}
@@ -541,7 +544,7 @@ s32 fopAcM_checkCullingBox(Mtx pMtx, f32 x0, f32 y0, f32 z0, f32 x1, f32 y1, f32
Vec p0 = { x0, y0, z0 };
Vec p1 = { x1, y1, z1 };
Mtx viewMtx;
- MTXConcat(j3dSys.mViewMtx, pMtx, viewMtx);
+ MTXConcat(j3dSys.getViewMtx(), pMtx, viewMtx);
return mDoLib_clipper::clip(viewMtx, &p1, &p0) != 0;
}
@@ -608,14 +611,14 @@ s32 fopAcM_cullingCheck(fopAc_ac_c* i_this) {
return mDoLib_clipper::clip(pMtx, fopAcM_getCullSizeBoxMax(i_this), fopAcM_getCullSizeBoxMin(i_this));
}
} else {
- fopAc_cullSizeBox& cullBox = l_cullSizeBox[fopAcM_CULLSIZE_IDX(fopAcM_GetCullSize(i_this))];
+ fopAc_cullSizeBox* cullBox = &l_cullSizeBox[fopAcM_CULLSIZE_IDX(fopAcM_GetCullSize(i_this))];
if (fopAcM_getCullSizeFar(i_this) > 0.0f) {
mDoLib_clipper::changeFar(cullFar * mDoLib_clipper::getFar());
- s32 ret = mDoLib_clipper::clip(pMtx, &cullBox.max, &cullBox.min);
+ s32 ret = mDoLib_clipper::clip(pMtx, &cullBox->max, &cullBox->min);
mDoLib_clipper::resetFar();
return ret;
} else {
- return mDoLib_clipper::clip(pMtx, &cullBox.max, &cullBox.min);
+ return mDoLib_clipper::clip(pMtx, &cullBox->max, &cullBox->min);
}
}
} else { // Sphere
@@ -632,17 +635,16 @@ s32 fopAcM_cullingCheck(fopAc_ac_c* i_this) {
return mDoLib_clipper::clip(pMtx, *fopAcM_getCullSizeSphereCenter(i_this), radius);
}
} else {
- fopAc_cullSizeSphere& cullSphere = l_cullSizeSphere[fopAcM_CULLSIZE_Q_IDX(fopAcM_GetCullSize(i_this))];
+ fopAc_cullSizeSphere* cullSphere = &l_cullSizeSphere[fopAcM_CULLSIZE_Q_IDX(fopAcM_GetCullSize(i_this))];
if (fopAcM_getCullSizeFar(i_this) > 0.0f) {
mDoLib_clipper::changeFar(cullFar * mDoLib_clipper::getFar());
- f32 radius = cullSphere.radius;
- Vec center = cullSphere.center;
+ f32 radius = cullSphere->radius;
+ Vec center = cullSphere->center;
s32 ret = mDoLib_clipper::clip(pMtx, center, radius);
mDoLib_clipper::resetFar();
return ret;
} else {
- f32 radius = cullSphere.radius;
- return mDoLib_clipper::clip(pMtx, cullSphere.center, radius);
+ return mDoLib_clipper::clip(pMtx, cullSphere->center, cullSphere->radius);
}
}
}
@@ -777,7 +779,7 @@ fopAc_ac_c* fopAcM_getEventPartner(fopAc_ac_c* i_this) {
/* 80026118-800261E8 .text fopAcM_createItemForPresentDemo__FP4cXyziUciiP5csXyzP4cXyz */
fpc_ProcID fopAcM_createItemForPresentDemo(cXyz* pos, int i_itemNo, u8 argFlag, int roomNo, int param_5, csXyz* angle, cXyz* scale) {
- JUT_ASSERT(2413, 0 <= i_itemNo && i_itemNo < 256);
+ JUT_ASSERT(VERSION_SELECT(2409, 2413, 2413, 2413), 0 <= i_itemNo && i_itemNo < 256);
dComIfGp_event_setGtItm(i_itemNo);
@@ -790,7 +792,7 @@ fpc_ProcID fopAcM_createItemForPresentDemo(cXyz* pos, int i_itemNo, u8 argFlag,
/* 800261E8-800262B4 .text fopAcM_createItemForTrBoxDemo__FP4cXyziiiP5csXyzP4cXyz */
fpc_ProcID fopAcM_createItemForTrBoxDemo(cXyz* pos, int i_itemNo, int roomNo, int param_5, csXyz* angle, cXyz* scale) {
- JUT_ASSERT(2458, 0 <= i_itemNo && i_itemNo < 256);
+ JUT_ASSERT(VERSION_SELECT(2454, 2458, 2458, 2458), 0 <= i_itemNo && i_itemNo < 256);
dComIfGp_event_setGtItm(i_itemNo);
@@ -803,7 +805,7 @@ fpc_ProcID fopAcM_createItemForTrBoxDemo(cXyz* pos, int i_itemNo, int roomNo, in
/* 800262B4-80026694 .text fopAcM_createItemFromTable__FP4cXyziiiiP5csXyziP4cXyz */
fpc_ProcID fopAcM_createItemFromTable(cXyz* p_pos, int i_itemNo, int i_itemBitNo, int roomNo, int type, csXyz* p_angle, int action, cXyz* p_scale) {
- JUT_ASSERT(2514, 0 <= i_itemNo && i_itemNo < 64 && (-1 <= i_itemBitNo && i_itemBitNo <= 79) || i_itemBitNo == 127);
+ JUT_ASSERT(VERSION_SELECT(2510, 2514, 2514, 2514), 0 <= i_itemNo && i_itemNo < 64 && (-1 <= i_itemBitNo && i_itemBitNo <= 79) || i_itemBitNo == 127);
static cXyz fairy_offset_tbl[3] = {
cXyz(40.0f, 0.0f, 0.0f),
@@ -822,9 +824,13 @@ fpc_ProcID fopAcM_createItemFromTable(cXyz* p_pos, int i_itemNo, int i_itemBitNo
case 0x02:
case 0x03:
case 0x04: {
- int life = dComIfGs_getLife() * 100;
+ int life = dComIfGs_getLife();
+#if VERSION == VERSION_DEMO
+ int max = dComIfGs_getMaxLife();
+#else
int max = dComIfGs_getMaxLife() & 0xFC;
- u8 lifePercent = life / max;
+#endif
+ u8 lifePercent = (100 * life) / max;
if (lifePercent != 0 && lifePercent <= 20) {
tableIdx = 4;
} else if (lifePercent > 20 && lifePercent <= 40) {
@@ -896,13 +902,13 @@ fpc_ProcID fopAcM_createItemFromTable(cXyz* p_pos, int i_itemNo, int i_itemBitNo
/* 80026694-800267C8 .text fopAcM_createRaceItemFromTable__FP4cXyziiiP5csXyzP4cXyzi */
fpc_ProcID fopAcM_createRaceItemFromTable(cXyz* pos, int i_itemNo, int i_itemBitNo, int i_roomNo, csXyz* angle, cXyz* scale, int param_7) {
- JUT_ASSERT(2660, 0 <= i_itemNo && i_itemNo < 64 && (-1 <= i_itemBitNo && i_itemBitNo <= 79) || i_itemBitNo == 127);
+ JUT_ASSERT(VERSION_SELECT(2654, 2660, 2660, 2660), 0 <= i_itemNo && i_itemNo < 64 && (-1 <= i_itemBitNo && i_itemBitNo <= 79) || i_itemBitNo == 127);
if (i_itemNo >= 0x20 && i_itemNo <= 0x3E) {
+ i_itemNo -= 0x20;
ItemTableList* itemTableList = dComIfGp_getItemTable();
int itemIdx = (int)cM_rndF(15.9999f);
- int tableIdx = i_itemNo - 0x20;
- i_itemNo = itemTableList->mItemTables[tableIdx][itemIdx];
+ i_itemNo = itemTableList->mItemTables[i_itemNo][itemIdx];
}
if (i_itemNo == 0x3F || i_itemNo == 0xFF) {
@@ -917,7 +923,7 @@ fpc_ProcID fopAcM_createRaceItemFromTable(cXyz* pos, int i_itemNo, int i_itemBit
/* 800267C8-8002688C .text fopAcM_createShopItem__FP4cXyziP5csXyziP4cXyzPFPv_i */
fpc_ProcID fopAcM_createShopItem(cXyz* pos, int i_itemNo, csXyz* angle, int roomNo, cXyz* scale,
createFunc createFunc) {
- JUT_ASSERT(2716, 0 <= i_itemNo && i_itemNo < 256);
+ JUT_ASSERT(VERSION_SELECT(2710, 2716, 2716, 2716), 0 <= i_itemNo && i_itemNo < 256);
if (i_itemNo == dItem_NONE_e) {
return fpcM_ERROR_PROCESS_ID_e;
}
@@ -927,24 +933,24 @@ fpc_ProcID fopAcM_createShopItem(cXyz* pos, int i_itemNo, csXyz* angle, int room
/* 8002688C-80026980 .text fopAcM_createRaceItem__FP4cXyziiP5csXyziP4cXyzi */
fpc_ProcID fopAcM_createRaceItem(cXyz* pos, int i_itemNo, int i_itemBitNo, csXyz* angle, int roomNo, cXyz* scale, int param_7) {
- JUT_ASSERT(2763, 0 <= i_itemNo && i_itemNo < 256 && (-1 <= i_itemBitNo && i_itemBitNo <= 79) || i_itemBitNo == 127);
+ JUT_ASSERT(VERSION_SELECT(2757, 2763, 2763, 2763), 0 <= i_itemNo && i_itemNo < 256 && (-1 <= i_itemBitNo && i_itemBitNo <= 79) || i_itemBitNo == 127);
if (i_itemNo == dItem_NONE_e) {
return fpcM_ERROR_PROCESS_ID_e;
}
i_itemNo = check_itemno(i_itemNo);
- u32 params = (i_itemBitNo & 0x7F) << 0x08 | (i_itemNo & 0xFF) | (param_7 & 0xF) << 0xF;
+ u32 params = (i_itemBitNo & 0x7F) << 8 | (i_itemNo & 0xFF) << 0 | (param_7 & 0xF) << 15;
return fopAcM_create(PROC_RACEITEM, params, pos, roomNo, angle, scale);
}
/* 80026980-80026A68 .text fopAcM_createDemoItem__FP4cXyziiP5csXyziP4cXyzUc */
fpc_ProcID fopAcM_createDemoItem(cXyz* pos, int i_itemNo, int i_itemBitNo, csXyz* i_angle, int i_roomNo, cXyz* i_scale, u8 i_argFlag) {
- JUT_ASSERT(2813, 0 <= i_itemNo && i_itemNo < 256 && (-1 <= i_itemBitNo && i_itemBitNo <= 79) || i_itemBitNo == 127);
+ JUT_ASSERT(VERSION_SELECT(2807, 2813, 2813, 2813), 0 <= i_itemNo && i_itemNo < 256 && (-1 <= i_itemBitNo && i_itemBitNo <= 79) || i_itemBitNo == 127);
if (i_itemNo == dItem_NONE_e) {
return fpcM_ERROR_PROCESS_ID_e;
}
- u32 params = (i_itemNo & 0xFF) | (i_itemBitNo & 0x7F) << 0x08 | (i_argFlag & 0xFF) << 0x10;
+ u32 params = (i_itemNo & 0xFF) << 0 | (i_itemBitNo & 0x7F) << 8 | (i_argFlag & 0xFF) << 16;
return fopAcM_create(PROC_Demo_Item, params, pos, i_roomNo, i_angle, i_scale);
}
@@ -961,10 +967,7 @@ fpc_ProcID fopAcM_createItemForBoss(cXyz* pos, int unused, int roomNo, csXyz* an
/* 80026ADC-80026C90 .text fopAcM_createItem__FP4cXyziiiiP5csXyziP4cXyz */
fpc_ProcID fopAcM_createItem(cXyz* pos, int i_itemNo, int i_itemBitNo, int roomNo, int type, csXyz* angle, int action, cXyz* scale) {
- int switchNo = 0xFF;
- int switchNo2 = 0xFF;
-
- JUT_ASSERT(2915, 0 <= i_itemNo && i_itemNo < 256 && (-1 <= i_itemBitNo && i_itemBitNo <= 79) || i_itemBitNo == 127);
+ JUT_ASSERT(VERSION_SELECT(2909, 2915, 2915, 2915), 0 <= i_itemNo && i_itemNo < 256 && (-1 <= i_itemBitNo && i_itemBitNo <= 79) || i_itemBitNo == 127);
if (i_itemNo == dItem_NONE_e) {
return fpcM_ERROR_PROCESS_ID_e;
@@ -974,9 +977,11 @@ fpc_ProcID fopAcM_createItem(cXyz* pos, int i_itemNo, int i_itemBitNo, int roomN
if (angle) {
prmAngle = *angle;
}
+ int switchNo = 0xFF;
prmAngle.z = switchNo;
u8 itemNo = check_itemno(i_itemNo);
+ int switchNo2 = -1;
u32 params = MAKE_ITEM_PARAMS(itemNo, i_itemBitNo, switchNo2, type, action);
switch (i_itemNo) {
@@ -997,10 +1002,8 @@ fpc_ProcID fopAcM_createItem(cXyz* pos, int i_itemNo, int i_itemBitNo, int roomN
void* fopAcM_fastCreateItem2(cXyz* pos, int i_itemNo, int i_itemBitNo, int roomNo, int type,
csXyz* angle, int action, cXyz* scale)
{
- int switchNo = 0xFF;
- int switchNo2 = 0xFF;
-
- JUT_ASSERT(2995, 0 <= i_itemNo && i_itemNo < 256 && (-1 <= i_itemBitNo && i_itemBitNo <= 79) || i_itemBitNo == 127);
+
+ JUT_ASSERT(VERSION_SELECT(2989, 2995, 2995, 2995), 0 <= i_itemNo && i_itemNo < 256 && (-1 <= i_itemBitNo && i_itemBitNo <= 79) || i_itemBitNo == 127);
int i;
@@ -1013,9 +1016,11 @@ void* fopAcM_fastCreateItem2(cXyz* pos, int i_itemNo, int i_itemBitNo, int roomN
if (angle) {
prmAngle = *angle;
}
+ int switchNo = 0xFF;
prmAngle.z = switchNo;
u8 itemNo = check_itemno(i_itemNo);
+ int switchNo2 = -1;
u32 params = MAKE_ITEM_PARAMS(itemNo, i_itemBitNo, switchNo2, type, action);
switch (i_itemNo) {
@@ -1034,11 +1039,12 @@ void* fopAcM_fastCreateItem2(cXyz* pos, int i_itemNo, int i_itemBitNo, int roomN
/* 80026E5C-80026F5C .text fopAcM_createItemForKP2__FP4cXyziiP5csXyzP4cXyzfffUs */
fopAc_ac_c* fopAcM_createItemForKP2(cXyz* pos, int i_itemNo, int roomNo, csXyz* angle, cXyz* scale, f32 speedF, f32 speedY, f32 gravity, u16 i_itemBitNo) {
- JUT_ASSERT(0xc25, 0 <= i_itemNo && i_itemNo < 256);
+ JUT_ASSERT(VERSION_SELECT(3103, 3109, 3109, 3109), 0 <= i_itemNo && i_itemNo < 256);
if (i_itemNo == dItem_NONE_e)
return NULL;
- fopAc_ac_c* ac = (fopAc_ac_c*)fopAcM_fastCreate(PROC_SPC_ITEM01, i_itemNo | (i_itemBitNo & 0xFFFF) << 8, pos, roomNo, angle, scale);
+ u32 params = i_itemNo | (i_itemBitNo & 0xFFFF) << 8;
+ fopAc_ac_c* ac = (fopAc_ac_c*)fopAcM_fastCreate(PROC_SPC_ITEM01, params, pos, roomNo, angle, scale);
if (ac != NULL) {
fopAcM_SetSpeedF(ac, speedF);
ac->speed.y = speedY;
@@ -1058,12 +1064,7 @@ daItem_c* fopAcM_createItemForSimpleDemo(cXyz* pos, int i_itemNo, int roomNo, cs
/* 80026F98-80027254 .text fopAcM_fastCreateItem__FP4cXyziiP5csXyzP4cXyzfffiPFPv_i */
void* fopAcM_fastCreateItem(cXyz* pos, int i_itemNo, int roomNo, csXyz* angle, cXyz* scale,
f32 speedF, f32 speedY, f32 gravity, int i_itemBitNo, createFunc createFunc) {
- int type = daItemType_0_e;
- int action = daItemAct_A_e;
- int switchNo = 0xFF;
- int switchNo2 = 0xFF;
-
- JUT_ASSERT(3201, 0 <= i_itemNo && i_itemNo < 256);
+ JUT_ASSERT(VERSION_SELECT(3195, 3201, 3201, 3201), 0 <= i_itemNo && i_itemNo < 256);
if (i_itemNo == dItem_NONE_e) {
return NULL;
}
@@ -1071,6 +1072,9 @@ void* fopAcM_fastCreateItem(cXyz* pos, int i_itemNo, int roomNo, csXyz* angle, c
int i;
u8 itemNo = check_itemno(i_itemNo);
+ int type = daItemType_0_e;
+ int action = daItemAct_A_e;
+ int switchNo2 = -1;
u8 itemBitNo = i_itemBitNo;
u32 params = MAKE_ITEM_PARAMS(itemNo, itemBitNo, switchNo2, type, action);
@@ -1092,6 +1096,7 @@ void* fopAcM_fastCreateItem(cXyz* pos, int i_itemNo, int roomNo, csXyz* angle, c
} else {
prmAngle = csXyz::Zero;
}
+ int switchNo = 0xFF;
prmAngle.z = switchNo;
prmAngle.y += (int)cM_rndFX(0x2000);
@@ -1121,6 +1126,7 @@ void* fopAcM_fastCreateItem(cXyz* pos, int i_itemNo, int roomNo, csXyz* angle, c
}
}
+#if VERSION > VERSION_DEMO
/* 80027254-80027280 .text stealItem_CB__FPv */
BOOL stealItem_CB(void* actor) {
if (actor) {
@@ -1130,6 +1136,7 @@ BOOL stealItem_CB(void* actor) {
}
return TRUE;
}
+#endif
/* 80027280-800273D4 .text fopAcM_createStealItem__FP4cXyziiP5csXyzi */
void* fopAcM_createStealItem(cXyz* p_pos, int i_tblNo, int i_roomNo, csXyz* p_angle, int i_itemBitNo) {
@@ -1158,7 +1165,16 @@ void* fopAcM_createStealItem(cXyz* p_pos, int i_tblNo, int i_roomNo, csXyz* p_an
i_itemBitNo = -1;
}
+#if VERSION == VERSION_DEMO
+ daItem_c* item = (daItem_c*)fopAcM_fastCreateItem(p_pos, itemNo, i_roomNo, p_angle, NULL, 0.0f, 0.0f, -6.0f, i_itemBitNo);
+ if (item != NULL) {
+ item->scale.setall(1.0f);
+ item->setFlag(daItem_c::FLAG_HOOK);
+ }
+ return item;
+#else
return fopAcM_fastCreateItem(p_pos, itemNo, i_roomNo, p_angle, NULL, 0.0f, 0.0f, -6.0f, i_itemBitNo, stealItem_CB);
+#endif
}
/* 800273D4-8002777C .text fopAcM_createItemFromEnemyTable__FUsiiP4cXyzP5csXyz */
@@ -1207,7 +1223,11 @@ void* fopAcM_createItemFromEnemyTable(u16 itemTableIdx, int i_itemBitNo, int i_r
items[itemIdx] = getItemNoByLife(items[itemIdx]);
return fopAcM_fastCreateItem(
+#if VERSION == VERSION_DEMO
+ p_pos, items[itemIdx], i_roomNo, p_angle, &scale,
+#else
p_pos, items[itemIdx], i_roomNo, NULL, &scale,
+#endif
cM_rndFX(5.0f), 50.0f + cM_rndFX(10.0f), -6.0f, i_itemBitNo
);
}
@@ -1226,11 +1246,13 @@ fpc_ProcID fopAcM_createIball(cXyz* p_pos, int itemTableIdx, int i_roomNo, csXyz
}
if (dropChance > randPercent) {
+ u32 params = (u16)itemTableIdx | (i_itemBitNo & 0xFF) << 16;
daIball_c::remove_old();
- void* item = fopAcM_fastCreate(
- PROC_Iball, (u16)itemTableIdx | (i_itemBitNo & 0xFF) << 0x10,
- p_pos, i_roomNo
- );
+#if VERSION == VERSION_DEMO
+ void* item = fopAcM_fastCreate(PROC_Iball, params, p_pos, i_roomNo, p_angle);
+#else
+ void* item = fopAcM_fastCreate(PROC_Iball, params, p_pos, i_roomNo);
+#endif
return fopAcM_GetID(item);
} else {
void* item = fopAcM_createItemFromEnemyTable(
@@ -1259,10 +1281,10 @@ fopAc_ac_c * enemySearchJugge(void* ptr, void*) {
/* 80027970-80027A9C .text fopAcM_myRoomSearchEnemy__FSc */
fopAc_ac_c* fopAcM_myRoomSearchEnemy(s8 roomNo) {
- JUT_ASSERT(0xe07, roomNo >= 0);
+ JUT_ASSERT(VERSION_SELECT(3569, 3591, 3591, 3591), roomNo >= 0);
scene_class* roomProc = fopScnM_SearchByID(dStage_roomControl_c::getStatusProcID(roomNo));
- JUT_ASSERT(0xe0a, roomProc != NULL);
+ JUT_ASSERT(VERSION_SELECT(3572, 3594, 3594, 3594), roomProc != NULL);
fpc_ProcID grabProcID = daPy_getPlayerActorClass()->getGrabActorID();
fopAc_ac_c* enemy = fopAcM_SearchByID(grabProcID);
@@ -1274,8 +1296,12 @@ fopAc_ac_c* fopAcM_myRoomSearchEnemy(s8 roomNo) {
/* 80027A9C-80027B24 .text fopAcM_createDisappear__FP10fopAc_ac_cP4cXyzUcUcUc */
fpc_ProcID fopAcM_createDisappear(fopAc_ac_c* i_actor, cXyz* p_pos, u8 i_scale, u8 i_dropType, u8 i_itemBitNo) {
- u32 params = (i_itemBitNo & 0xFF) << 0x10 | (i_scale & 0xFF) << 0x08 | (i_dropType & 0xFF);
+ u32 params = (i_itemBitNo & 0xFF) << 16 | (i_scale & 0xFF) << 8 | (i_dropType & 0xFF) << 0;
+#if VERSION == VERSION_DEMO
+ fopAc_ac_c* disappear = (fopAc_ac_c*)fopAcM_fastCreate(PROC_DISAPPEAR, params, p_pos, fopAcM_GetRoomNo(i_actor));
+#else
fopAc_ac_c* disappear = (fopAc_ac_c*)fopAcM_fastCreate(PROC_DISAPPEAR, params, p_pos, fopAcM_GetRoomNo(i_actor), fopAcM_GetAngle_p(i_actor));
+#endif
if (disappear) {
disappear->itemTableIdx = i_actor->itemTableIdx;
}
@@ -1294,25 +1320,26 @@ BOOL fopAcM_getGroundAngle(fopAc_ac_c* actor, csXyz* p_angle) {
s16 targetAngleX;
int targetAngleZ;
if (pos.y != -G_CM3D_F_INF) {
- f32 origY = pos.y + 50.0f;
- gndChk.GetPointP()->set(pos.x, origY, pos.z + 10.0f);
- f32 origX = gndChk.GetPointP()->x;
- f32 origZ = gndChk.GetPointP()->z;
+ Vec chk_pos;
+ chk_pos.x = pos.x;
+ chk_pos.y = pos.y + 50.0f;
+ chk_pos.z = pos.z + 10.0f;
+ gndChk.SetPos(&chk_pos);
f32 groundY = dComIfG_Bgsp()->GroundCross(&gndChk);
if (groundY != -G_CM3D_F_INF) {
- targetAngleX = -cM_atan2s(groundY - pos.y, origZ - pos.z);
+ targetAngleX = -cM_atan2s(groundY - pos.y, chk_pos.z - pos.z);
} else {
pos.y = pos.y; // ?? fakematch?
ret = FALSE;
}
- origX = pos.x + 10.0f;
- origY = pos.y + 50.0f;
- f32 tempZ = pos.z;
- gndChk.GetPointP()->set(origX, origY, tempZ);
+ chk_pos.x = pos.x + 10.0f;
+ chk_pos.y = pos.y + 50.0f;
+ chk_pos.z = pos.z;
+ gndChk.SetPos(&chk_pos);
groundY = dComIfG_Bgsp()->GroundCross(&gndChk);
if (groundY != -G_CM3D_F_INF) {
- targetAngleZ = cM_atan2s(groundY - pos.y, origX - pos.x);
+ targetAngleZ = cM_atan2s(groundY - pos.y, chk_pos.x - pos.x);
} else {
ret = FALSE;
}
@@ -1386,7 +1413,7 @@ const char * fopAcM_getProcNameString(fopAc_ac_c* i_this) {
/* 8002833C-80028410 .text fopAcM_findObjectCB__FP10fopAc_ac_cPv */
fopAc_ac_c* fopAcM_findObjectCB(fopAc_ac_c* it, void* i_prm) {
fopAcM_search_prm* Prm = (fopAcM_search_prm*)i_prm;
- JUT_ASSERT(4095, Prm);
+ JUT_ASSERT(VERSION_SELECT(4071, 4095, 4095, 4095), Prm);
dStage_objectNameInf *inf = dStage_searchName(Prm->procname);
if (inf == NULL)