summaryrefslogtreecommitdiff
path: root/src/d/actor
diff options
context:
space:
mode:
authorLagoLunatic <LagoLunatic@users.noreply.github.com>2025-05-31 20:09:14 -0400
committerLagoLunatic <LagoLunatic@users.noreply.github.com>2025-05-31 20:09:14 -0400
commitbd917524bad56cb7348f50a2fc1fa92c44dcdeed (patch)
treeefbaf908ac28ad01808bc44bd9661536141ce9fd /src/d/actor
parentf71ec718fe9c74e74267c89afd34ccfd209793a2 (diff)
Demo work, d_a_kytag02 and d_a_ff OK
Diffstat (limited to 'src/d/actor')
-rw-r--r--src/d/actor/d_a_branch.cpp10
-rw-r--r--src/d/actor/d_a_dr.cpp14
-rw-r--r--src/d/actor/d_a_ff.cpp162
-rw-r--r--src/d/actor/d_a_kytag02.cpp12
-rw-r--r--src/d/actor/d_a_kytag03.cpp14
-rw-r--r--src/d/actor/d_a_kytag05.cpp24
-rw-r--r--src/d/actor/d_a_kytag06.cpp7
-rw-r--r--src/d/actor/d_a_kytag07.cpp13
-rw-r--r--src/d/actor/d_a_obj_movebox.cpp2
-rw-r--r--src/d/actor/d_a_player_main.cpp8
-rw-r--r--src/d/actor/d_a_swc00.cpp38
11 files changed, 165 insertions, 139 deletions
diff --git a/src/d/actor/d_a_branch.cpp b/src/d/actor/d_a_branch.cpp
index 8cd6fba9..04cbd74e 100644
--- a/src/d/actor/d_a_branch.cpp
+++ b/src/d/actor/d_a_branch.cpp
@@ -190,16 +190,16 @@ static BOOL daBranch_Delete(daBranch_c* i_this) {
}
inline cPhs_State daBranch_c::create() {
-#if VERSION == VERSION_DEMO
- cPhs_State phase_state = dComIfG_resLoad(&mPhase, daBranch_c::m_arcname);
- if (phase_state == cPhs_COMPLEATE_e) {
- fopAcM_SetupActor(this, daBranch_c);
-#else
+#if VERSION > VERSION_DEMO
fopAcM_SetupActor(this, daBranch_c);
+#endif
cPhs_State phase_state = dComIfG_resLoad(&mPhase, daBranch_c::m_arcname);
if (phase_state == cPhs_COMPLEATE_e) {
+#if VERSION == VERSION_DEMO
+ fopAcM_SetupActor(this, daBranch_c);
#endif
+
if (!fopAcM_entrySolidHeap(this, daBranch_c::solidHeapCB, 0x4000)) {
for (int i = 0; i < (s32)ARRAY_SIZE(mAnims); i++) {
mAnims[i] = NULL;
diff --git a/src/d/actor/d_a_dr.cpp b/src/d/actor/d_a_dr.cpp
index fe1e3de2..9710e7b6 100644
--- a/src/d/actor/d_a_dr.cpp
+++ b/src/d/actor/d_a_dr.cpp
@@ -245,17 +245,17 @@ static BOOL createHeap(fopAc_ac_c* i_actor) {
/* 00000C08-00000CE4 .text daDr_Create__FP10fopAc_ac_c */
static cPhs_State daDr_Create(fopAc_ac_c* i_this) {
dr_class* a_this = (dr_class*)i_this;
-
-#if VERSION == VERSION_DEMO
- cPhs_State phase_state = dComIfG_resLoad(&a_this->mPhs, "Dr");
- if (phase_state == cPhs_COMPLEATE_e) {
- fopAcM_SetupActor(a_this, dr_class);
-#else
+
+#if VERSION > VERSION_DEMO
fopAcM_SetupActor(a_this, dr_class);
-
+#endif
+
cPhs_State phase_state = dComIfG_resLoad(&a_this->mPhs, "Dr");
if (phase_state == cPhs_COMPLEATE_e) {
+#if VERSION == VERSION_DEMO
+ fopAcM_SetupActor(a_this, dr_class);
#endif
+
if (!fopAcM_entrySolidHeap(a_this, createHeap, 0xF000)) {
return cPhs_ERROR_e;
}
diff --git a/src/d/actor/d_a_ff.cpp b/src/d/actor/d_a_ff.cpp
index c33fc0da..e0160721 100644
--- a/src/d/actor/d_a_ff.cpp
+++ b/src/d/actor/d_a_ff.cpp
@@ -26,7 +26,7 @@ static void fire_fly_draw(ff_class* i_this) {
dComIfGd_setListMaskOff();
mDoExt_modelUpdate(i_this->mpModel[0]);
if (i_this->mGlowScale > 0.01f) {
- mDoMtx_YrotM(*calc_mtx, i_this->mLiveTimer * 0x100);
+ cMtx_YrotM(*calc_mtx, i_this->mLiveTimer * 0x100);
MtxScale(i_this->mGlowScale, i_this->mGlowScale * i_this->mGlowScaleY,
i_this->mGlowScale, true);
i_this->mpModel[1]->setBaseTRMtx(*calc_mtx);
@@ -78,18 +78,11 @@ static BOOL daFf_Draw(ff_class* i_this) {
/* 0000037C-00000D18 .text fire_fly_move__FP8ff_class */
static void fire_fly_move(ff_class* i_this) {
- /* Nonmatching - regalloc */
- s8 cVar1;
- f32 fVar2;
- f32 fVar3;
- f32 dVar7;
- f32 dVar8;
- f32 dVar9;
- f32 fVar10;
- cXyz local_cc;
-
daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0);
dBgS_GndChk chk;
+ f32 step;
+ cXyz local_cc;
+
i_this->mLiveTimer++;
if (i_this->mTimers[2] == 0) {
i_this->mTimers[1] = cM_rndF(50.0f) + 40.0f;
@@ -100,95 +93,93 @@ static void fire_fly_move(ff_class* i_this) {
} else {
i_this->mScaleTarget = 0.0f;
}
+
cLib_addCalc2(&i_this->mScale, i_this->mScaleTarget, 0.1f, 0.05f);
- cVar1 = i_this->mState;
- switch (cVar1) {
+ switch (i_this->mMode) {
case 0:
Vec pos;
pos = i_this->current.pos;
pos.y += 250.0f;
chk.SetPos(&pos);
- fVar10 = dComIfG_Bgsp()->GroundCross(&chk);
- i_this->mGroundY = fVar10 + 12.5f;
+ i_this->mGroundY = dComIfG_Bgsp()->GroundCross(&chk) + 12.5f;
if (i_this->mbNoUseGroundY == 0) {
i_this->current.pos.y = i_this->mGroundY;
}
i_this->mHomePos = i_this->current.pos;
- i_this->mState++;
+ i_this->mMode++;
+ // Fall-through
+ case 1: {
cLib_addCalc2(&i_this->current.pos.x, i_this->mHomePos.x, 0.1f, std::abs(i_this->speed.x));
cLib_addCalc2(&i_this->current.pos.y, i_this->mHomePos.y, 0.1f, std::abs(i_this->speed.y));
cLib_addCalc2(&i_this->current.pos.z, i_this->mHomePos.z, 0.1f, std::abs(i_this->speed.z));
- fVar10 = player->current.pos.x - i_this->current.pos.x;
- fVar2 = player->current.pos.y - i_this->current.pos.y;
- fVar3 = player->current.pos.z - i_this->current.pos.z;
- fVar10 = std::sqrtf(fVar3 * fVar3 + fVar10 * fVar10 + fVar2 * fVar2);
- if (fVar10 < 250.0f) {
- i_this->mState++;
- fVar10 = cM_rndF(100.0f);
- i_this->mTimers[3] = (fVar10 + 1000.0f);
+ f32 xd = player->current.pos.x - i_this->current.pos.x;
+ f32 yd = player->current.pos.y - i_this->current.pos.y;
+ f32 zd = player->current.pos.z - i_this->current.pos.z;
+ xd = std::sqrtf(xd * xd + yd * yd + zd * zd);
+ if (xd < 250.0f) {
+ i_this->mMode++;
+ xd = cM_rndF(100.0f);
+ i_this->mTimers[3] = (xd + 1000.0f);
i_this->current.angle.x = -0x3000;
i_this->speedF = 10.0f;
}
- break;
- case 2:
+ goto label_870;
+ }
+ case 2: {
if (i_this->mTimers[0] == 0) {
i_this->mScatterPos.x = i_this->mHomePos.x + cM_rndFX(750.0f);
i_this->mScatterPos.z = i_this->mHomePos.z + cM_rndFX(750.0f);
i_this->mScatterPos.y = i_this->mHomePos.y + cM_rndFX(225.0f) + 137.5f;
i_this->mRotVel = 0.0f;
i_this->mVelocityFwdTarget = cM_rndF(20.0f) + 10.0f;
- fVar2 = i_this->mScatterPos.x - i_this->current.pos.x;
- dVar7 = i_this->mScatterPos.y - i_this->current.pos.y;
- fVar3 = i_this->mScatterPos.z - i_this->current.pos.z;
- dVar9 = fVar3 * fVar3;
- dVar8 = fVar2 * fVar2;
- fVar10 = std::sqrtf(dVar9 + (dVar8 + (dVar7 * dVar7)));
- i_this->mTimers[0] = fVar10 / i_this->mVelocityFwdTarget;
- i_this->mTargetRotY = cM_atan2s(fVar2, fVar3);
- fVar10 = std::sqrtf(dVar8 + dVar9);
- i_this->mTargetRotX = -cM_atan2s(dVar7, fVar10);
+ f32 xd = i_this->mScatterPos.x - i_this->current.pos.x;
+ f32 yd = i_this->mScatterPos.y - i_this->current.pos.y;
+ f32 zd = i_this->mScatterPos.z - i_this->current.pos.z;
+ f32 dist = std::sqrtf(xd * xd + yd * yd + zd * zd);
+ i_this->mTimers[0] = dist / i_this->mVelocityFwdTarget;
+ i_this->mTargetRotY = cM_atan2s(xd, zd);
+ f32 xz_dist = std::sqrtf(xd * xd + zd * zd);
+ i_this->mTargetRotX = -cM_atan2s(yd, xz_dist);
}
if (i_this->mTimers[3] == 0) {
- i_this->mState++;
+ i_this->mMode++;
i_this->mScatterPos.x = i_this->mHomePos.x;
i_this->mScatterPos.y = i_this->mHomePos.y;
i_this->mScatterPos.z = i_this->mHomePos.z;
i_this->mRotVel = 0.0f;
}
break;
- case 4:
- /* attacked */
- fVar10 = i_this->mScatterPos.x - i_this->current.pos.x;
- dVar8 = fVar10;
- dVar7 = i_this->mScatterPos.y - i_this->current.pos.y;
- fVar2 = i_this->mScatterPos.z - i_this->current.pos.z;
- dVar9 = fVar2;
- i_this->mTargetRotY = cM_atan2s(fVar10, fVar2);
- dVar8 = dVar8 * dVar8;
- dVar9 = dVar9 * dVar9;
- fVar10 = std::sqrtf(dVar8 + dVar9);
- i_this->mTargetRotX = -cM_atan2s(dVar7, fVar10);
- if ((dVar9 + (dVar8 + (dVar7 * dVar7))) < 2500.0f) {
- i_this->mState = 1;
+ }
+ case 3: {
+ f32 xd = i_this->mScatterPos.x - i_this->current.pos.x;
+ f32 yd = i_this->mScatterPos.y - i_this->current.pos.y;
+ f32 zd = i_this->mScatterPos.z - i_this->current.pos.z;
+ i_this->mTargetRotY = cM_atan2s(xd, zd);
+ f32 xz_dist = std::sqrtf(xd * xd + zd * zd);
+ i_this->mTargetRotX = -cM_atan2s(yd, xz_dist);
+ if (((xd * xd) + (yd * yd) + (zd * zd)) < 2500.0f) {
+ i_this->mMode = 1;
}
cLib_addCalc2(&i_this->mRotVel, 10.0f, 1.0f, 0.15f);
break;
- default:
+ }
+ case 4:
+ f32 f30;
if (i_this->mTimers[4] == 0) {
- i_this->mState = 2;
- fVar10 = cM_rndF(100.0f);
- i_this->mTimers[3] = (fVar10 + 1000.0f);
+ i_this->mMode = 2;
+ f30 = cM_rndF(100.0f);
+ i_this->mTimers[3] = (f30 + 1000.0f);
} else {
i_this->mVelImpulse += i_this->m2C0;
- fVar10 = cM_rndF(1.0f);
- if (fVar10 < REG13_F(0) + 0.1f) {
- fVar10 = cM_rndFX(REG13_F(1) + 1.0f);
- i_this->m2C0.x = fVar10;
+ f30 = cM_rndF(1.0f);
+ if (f30 < REG13_F(0) + 0.1f) {
+ f30 = cM_rndFX(REG13_F(1) + 1.0f);
+ i_this->m2C0.x = f30;
}
- fVar10 = cM_rndF(1.0f);
- if (fVar10 < REG13_F(0) + 0.1f) {
- fVar10 = cM_rndFX(REG13_F(1) + 1.0f);
- i_this->m2C0.z = fVar10;
+ f30 = cM_rndF(1.0f);
+ if (f30 < REG13_F(0) + 0.1f) {
+ f30 = cM_rndFX(REG13_F(1) + 1.0f);
+ i_this->m2C0.z = f30;
}
i_this->m2C0.y = REG13_F(2) + 2.0f;
if (i_this->mVelImpulse.y > REG13_F(3) + 10.0f) {
@@ -196,23 +187,29 @@ static void fire_fly_move(ff_class* i_this) {
}
}
break;
+ default:
+ goto label_870;
}
+
+ step = 500.0f;
cLib_addCalcAngleS2(&i_this->current.angle.y, i_this->mTargetRotY, 10,
- i_this->mRotVel * 500.0f);
+ step * i_this->mRotVel);
cLib_addCalcAngleS2(&i_this->current.angle.x, i_this->mTargetRotX, 10,
- i_this->mRotVel * 500.0f);
+ step * i_this->mRotVel);
cLib_addCalc2(&i_this->mRotVel, 1.0f, 1.0f, 0.1f);
cLib_addCalc2(&i_this->speedF, i_this->mVelocityFwdTarget, 1.0f, 3.0f);
local_cc.x = 0.0f;
local_cc.y = 0.0f;
local_cc.z = i_this->speedF * 0.25f;
- mDoMtx_YrotS(*calc_mtx, i_this->current.angle.y);
- mDoMtx_XrotM(*calc_mtx, i_this->current.angle.x);
+ cMtx_YrotS(*calc_mtx, i_this->current.angle.y);
+ cMtx_XrotM(*calc_mtx, i_this->current.angle.x);
MtxPosition(&local_cc, &i_this->speed);
i_this->current.pos += (i_this->speed + i_this->mVelImpulse);
cLib_addCalc0(&i_this->mVelImpulse.x, 1.0f, 0.1f);
cLib_addCalc0(&i_this->mVelImpulse.y, 1.0f, 0.1f);
cLib_addCalc0(&i_this->mVelImpulse.z, 1.0f, 0.1f);
+
+label_870:
if (i_this->current.pos.y < i_this->mGroundY + 12.5f) {
if (i_this->current.pos.y < i_this->mGroundY) {
i_this->current.pos.y = i_this->mGroundY;
@@ -225,18 +222,14 @@ static void fire_fly_move(ff_class* i_this) {
/* 00001098-00001168 .text daFf_Execute__FP8ff_class */
static BOOL daFf_Execute(ff_class* i_this) {
- s16 sVar1;
- int iVar3;
-
- for (iVar3 = 0; iVar3 < 5; iVar3++) {
- sVar1 = i_this->mTimers[iVar3];
- if (sVar1 != 0) {
- i_this->mTimers[iVar3]--;
+ for (int i = 0; i < 5; i++) {
+ if (i_this->mTimers[i] != 0) {
+ i_this->mTimers[i]--;
}
}
fire_fly_move(i_this);
if (i_this->mSph.ChkTgHit() != 0) {
- i_this->mState = 4;
+ i_this->mMode = 4;
i_this->mTimers[4] = REG13_F(9) + (cM_rndF(20.0f) + 30.0f);
}
i_this->mSph.SetC(i_this->current.pos);
@@ -251,7 +244,7 @@ static BOOL daFf_IsDelete(ff_class*) {
/* 00001170-000011AC .text daFf_Delete__FP8ff_class */
static BOOL daFf_Delete(ff_class* i_this) {
- dComIfG_resDelete(&i_this->mPhs, "Ff");
+ dComIfG_resDeleteDemo(&i_this->mPhs, "Ff");
ff_count = 0;
return TRUE;
}
@@ -264,10 +257,12 @@ static BOOL useHeapInit(fopAc_ac_c* i_this) {
for (int i = 0; i < 2; i++) {
J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("Ff", ho_bmd[i]);
- JUT_ASSERT(719, modelData != NULL);
+ JUT_ASSERT(VERSION_SELECT(717, 719, 719, 719), modelData != NULL);
+#if VERSION > VERSION_DEMO
if (modelData == NULL) {
return FALSE;
}
+#endif
a_this->mpModel[i] = mDoExt_J3DModel__create(modelData, 0x10000, 0x11020203);
if (a_this->mpModel[i] == NULL) {
return FALSE;
@@ -276,13 +271,16 @@ static BOOL useHeapInit(fopAc_ac_c* i_this) {
if (a_this->mBrkAnm[i] == NULL) {
return FALSE;
}
- J3DAnmTevRegKey* pJVar5 = (J3DAnmTevRegKey*)dComIfG_getObjectRes("Ff", ho_brk[i]);
- modelData = a_this->mpModel[i]->getModelData();
- int iVar6 = a_this->mBrkAnm[i]->init(modelData, pJVar5, true, J3DFrameCtrl::EMode_LOOP,
- 0.9f + cM_rndF(0.15f), 0, -1, false, 0);
+ int iVar6 = a_this->mBrkAnm[i]->init(
+ a_this->mpModel[i]->getModelData(),
+ (J3DAnmTevRegKey*)dComIfG_getObjectRes("Ff", ho_brk[i]),
+ true, J3DFrameCtrl::EMode_LOOP, 0.9f + cM_rndF(0.15f), 0, -1, false, 0
+ );
+#if VERSION > VERSION_DEMO
if (iVar6 == 0) {
return FALSE;
}
+#endif
}
return TRUE;
}
@@ -297,7 +295,7 @@ static cPhs_State daFf_Create(fopAc_ac_c* i_this) {
if (fopAcM_entrySolidHeap(a_this, useHeapInit, 0x2320)) {
int uVar1 = fopAcM_GetParam(a_this) & 0xFF;
if (uVar1 != 0) {
- a_this->base.mParameters = fopAcM_GetParam(a_this) & 0xFF00;
+ fopAcM_SetParam(a_this, fopAcM_GetParam(a_this) & 0xFF00);
for (int iVar7 = 0; iVar7 < uVar1; iVar7 = iVar7 + 1) {
fopAcM_prm_class* pfVar4 = fopAcM_CreateAppend();
pfVar4->base.position.x = a_this->current.pos.x + cM_rndFX(500.0f);
diff --git a/src/d/actor/d_a_kytag02.cpp b/src/d/actor/d_a_kytag02.cpp
index 3795b99d..c3148a6b 100644
--- a/src/d/actor/d_a_kytag02.cpp
+++ b/src/d/actor/d_a_kytag02.cpp
@@ -25,10 +25,14 @@ dPath* set_next_path_info(kytag02_class* i_this, dPath* path) {
/* 000000F0-0000017C .text get_railwind_vec__FP5dPathi */
cXyz get_railwind_vec(dPath* path, int i_no) {
- /* Nonmatching */
- dPnt* pnt = path->m_points;
- cXyz p0 = pnt[i_no].m_position;
- cXyz p1 = pnt[i_no + 1].m_position;
+ cXyz p0;
+ p0.x = path->m_points[i_no].m_position.x;
+ p0.y = path->m_points[i_no].m_position.y;
+ p0.z = path->m_points[i_no].m_position.z;
+ cXyz p1;
+ p1.x = path->m_points[i_no + 1].m_position.x;
+ p1.y = path->m_points[i_no + 1].m_position.y;
+ p1.z = path->m_points[i_no + 1].m_position.z;
cXyz ret;
dKyr_get_vectle_calc(&p0, &p1, &ret);
return ret;
diff --git a/src/d/actor/d_a_kytag03.cpp b/src/d/actor/d_a_kytag03.cpp
index 718b13bb..88c6420d 100644
--- a/src/d/actor/d_a_kytag03.cpp
+++ b/src/d/actor/d_a_kytag03.cpp
@@ -90,7 +90,7 @@ static BOOL daKytag03_Execute(kytag03_class* i_this) {
if (!i_this->mbIsActive && dKy_contrast_flg_get()) {
if (!i_this->mbVisible) {
cXyz pos;
- s16 y = player->shape_angle.y;
+ const s16 y = player->shape_angle.y;
pos.x = cM_scos(0) * cM_ssin(y);
pos.y = cM_ssin(0);
pos.z = cM_scos(0) * cM_scos(y);
@@ -124,15 +124,17 @@ static BOOL daKytag03_Delete(kytag03_class* i_this) {
/* 00000544-00000604 .text daKytag03_Create__FP10fopAc_ac_c */
static cPhs_State daKytag03_Create(fopAc_ac_c* i_ac) {
kytag03_class* i_this = (kytag03_class*)i_ac;
-#if VERSION == VERSION_DEMO
- cPhs_State ret = dComIfG_resLoad(&i_this->mPhs, "M_DOOR");
- if (ret == cPhs_COMPLEATE_e) {
- fopAcM_SetupActor(i_this, kytag03_class);
-#else
+
+#if VERSION > VERSION_DEMO
fopAcM_SetupActor(i_this, kytag03_class);
+#endif
+
cPhs_State ret = dComIfG_resLoad(&i_this->mPhs, "M_DOOR");
if (ret == cPhs_COMPLEATE_e) {
+#if VERSION == VERSION_DEMO
+ fopAcM_SetupActor(i_this, kytag03_class);
#endif
+
if (!fopAcM_entrySolidHeap(i_this, useHeapInit, 0x4c30)) {
return cPhs_ERROR_e;
}
diff --git a/src/d/actor/d_a_kytag05.cpp b/src/d/actor/d_a_kytag05.cpp
index 15d094f9..5e4000bc 100644
--- a/src/d/actor/d_a_kytag05.cpp
+++ b/src/d/actor/d_a_kytag05.cpp
@@ -43,26 +43,26 @@ static BOOL daKytag05_Execute(kytag05_class* a_this) {
camera_process_class *camera = dComIfGp_getCamera(0);
fopAc_ac_c *player = dComIfGp_getPlayer(0);
f32 windPow = dKyw_get_wind_pow();
- f32 i_blend = 1.0f;
+ f32 blend = 1.0f;
if (g_env_light.mWind.mEvtWindSet == 0xFF) {
return TRUE;
}
- if (dComIfGp_event_runCheck() && dComIfGp_evmng_startCheck("demo41") && dComIfGp_demo_get()) {
+ if (dComIfGp_event_runCheck() != FALSE && dComIfGp_evmng_startCheck("demo41") && dComIfGp_demo_get()) {
u32 demoFrame = dComIfGp_demo_get()->getFrame();
if(demoFrame >= 0x186) {
f32 fVar7 = ((f32)demoFrame - 390.0f) / 100.0f;
- if(fVar7 > i_blend) {
- fVar7 = i_blend;
+ if(fVar7 > 1.0f) {
+ fVar7 = 1.0f;
}
- i_blend = 1.0f - fVar7;
- g_env_light.mSnowCount = (int)(200.0f * i_blend);
+ blend = 1.0f - fVar7;
+ g_env_light.mSnowCount = (int)(200.0f * blend);
} else if (demoFrame == 0x187) {
daYkgr_c::stop();
}
}
- dKy_custom_colset(0, 7, i_blend);
+ dKy_custom_colset(0, 7, blend);
if((a_this->mIndex & 1) == 0) {
if (a_this->mTimer >= fuu_timer[a_this->mIndex >> 1]) {
@@ -78,7 +78,8 @@ static BOOL daKytag05_Execute(kytag05_class* a_this) {
if(a_this->mIndex >> 1 >= 4) {
a_this->mIndex = 0;
}
- dKyw_evt_wind_set(0, wind_table[a_this->mIndex >> 1]);
+ s16 windY = wind_table[a_this->mIndex >> 1];
+ dKyw_evt_wind_set(0, windY);
a_this->mTimer = 0;
g_env_light.mWind.mEvtWindSet = 1;
} else {
@@ -120,11 +121,18 @@ static BOOL daKytag05_Delete(kytag05_class*) {
/* 00000404-000004C0 .text daKytag05_Create__FP10fopAc_ac_c */
static cPhs_State daKytag05_Create(fopAc_ac_c* i_this) {
+#if VERSION > VERSION_DEMO
fopAcM_SetupActor(i_this, kytag05_class);
+#endif
kytag05_class *a_this = (kytag05_class*)i_this;
if (dComIfGs_isSymbol(1) != 0) {
return cPhs_STOP_e;
}
+
+#if VERSION == VERSION_DEMO
+ fopAcM_SetupActor(i_this, kytag05_class);
+#endif
+
a_this->mIndex = 0;
a_this->mTimer = 0;
a_this->mUnknownParam = i_this->base.mParameters & 0xff;
diff --git a/src/d/actor/d_a_kytag06.cpp b/src/d/actor/d_a_kytag06.cpp
index 544e0fd5..e2596aae 100644
--- a/src/d/actor/d_a_kytag06.cpp
+++ b/src/d/actor/d_a_kytag06.cpp
@@ -22,7 +22,7 @@ static BOOL daKytag06_Execute(kytag06_class* i_this) {
f32 time;
int date;
- if (!dComIfGp_event_runCheck()) {
+ if (dComIfGp_event_runCheck() == FALSE) {
return TRUE;
}
if(!dComIfGp_evmng_startCheck("ARRIVAL_BRK")) {
@@ -59,13 +59,18 @@ static BOOL daKytag06_Delete(kytag06_class*) {
/* 000001A4-00000224 .text daKytag06_Create__FP10fopAc_ac_c */
static cPhs_State daKytag06_Create(fopAc_ac_c* i_this) {
+#if VERSION > VERSION_DEMO
fopAcM_SetupActor(i_this, kytag06_class);
+#endif
kytag06_class* a_this = (kytag06_class*)i_this;
cPhs_State phase_state;
if(dComIfGs_isSymbol(0)) {
phase_state = cPhs_ERROR_e;
} else {
+#if VERSION == VERSION_DEMO
+ fopAcM_SetupActor(i_this, kytag06_class);
+#endif
a_this->field_0x294 = 0;
phase_state = cPhs_COMPLEATE_e;
}
diff --git a/src/d/actor/d_a_kytag07.cpp b/src/d/actor/d_a_kytag07.cpp
index c4d9262d..ca14c3af 100644
--- a/src/d/actor/d_a_kytag07.cpp
+++ b/src/d/actor/d_a_kytag07.cpp
@@ -84,15 +84,18 @@ static BOOL daKytag07_Delete(kytag07_class*) {
static cPhs_State daKytag07_Create(fopAc_ac_c* i_this) {
kytag07_class* a_this = (kytag07_class*)i_this;
dScnKy_env_light_c& env_light = dKy_getEnvlight();
-#if VERSION == VERSION_DEMO
- if (strcmp(dComIfGp_getStartStageName(), "GTower") != 0)
- env_light.mbDayNightTactStop = true;
- fopAcM_SetupActor(a_this, kytag07_class);
-#else
+
+#if VERSION > VERSION_DEMO
fopAcM_SetupActor(a_this, kytag07_class);
+#endif
+
if (strcmp(dComIfGp_getStartStageName(), "GTower") != 0)
env_light.mbDayNightTactStop = true;
+
+#if VERSION == VERSION_DEMO
+ fopAcM_SetupActor(a_this, kytag07_class);
#endif
+
return cPhs_COMPLEATE_e;
}
diff --git a/src/d/actor/d_a_obj_movebox.cpp b/src/d/actor/d_a_obj_movebox.cpp
index de96ffe4..f1aa2203 100644
--- a/src/d/actor/d_a_obj_movebox.cpp
+++ b/src/d/actor/d_a_obj_movebox.cpp
@@ -132,7 +132,7 @@ namespace daObjMovebox {
M_gnd_work[i].SetActorPid(movebox->base.mBsPcId);
mGroundY[i] = dComIfG_Bgsp()->GroundCross(&M_gnd_work[i]);
if (mGroundY[i] > maxGroundY) {
- fopAc_ac_c* groundActor = dComIfG_Bgsp()->GetActorPointer(M_gnd_work[i].GetBgIndex());
+ fopAc_ac_c* groundActor = dComIfG_Bgsp()->GetActorPointer(M_gnd_work[i]);
if (!(groundActor && fopAcM_GetName(groundActor) == PROC_Obj_Movebox && ((Act_c*)groundActor)->mMode == Act_c::MODE_AFLOAT)) {
maxGroundY = mGroundY[i];
mMaxGroundIdx = i;
diff --git a/src/d/actor/d_a_player_main.cpp b/src/d/actor/d_a_player_main.cpp
index 5cc86e82..bb9d9ec4 100644
--- a/src/d/actor/d_a_player_main.cpp
+++ b/src/d/actor/d_a_player_main.cpp
@@ -6907,7 +6907,7 @@ BOOL daPy_lk_c::procFrontRollCrash_init() {
dKy_Sound_set(current.pos, 100, fopAcM_GetID(this), 5);
if ((mAcch.ChkWallHit()) && (mAcchCir[0].ChkWallHit())) {
daObjMovebox::Act_c* iVar1 =
- (daObjMovebox::Act_c*)dComIfG_Bgsp()->GetActorPointer(mAcchCir[0].GetBgIndex());
+ (daObjMovebox::Act_c*)dComIfG_Bgsp()->GetActorPointer(mAcchCir[0]);
if ((iVar1 != 0) && (fopAcM_GetName(iVar1) == PROC_Obj_Movebox) &&
((iVar1->mType == 0) || (iVar1->mType == 5)))
{
@@ -11167,7 +11167,7 @@ void daPy_lk_c::checkRoofRestart() {
{
if ((dStage_stagInfo_GetSTType(dComIfGp_getStageStagInfo()) != dStageType_BOSS_e &&
((!dComIfG_Bgsp()->ChkMoveBG(mAcch.m_roof) ||
- (fopAcM_GetName(dComIfG_Bgsp()->GetActorPointer(mAcch.m_roof.GetBgIndex())) !=
+ (fopAcM_GetName(dComIfG_Bgsp()->GetActorPointer(mAcch.m_roof)) !=
PROC_BRIDGE)))))
{
f32 dVar9 = mAcch.m_roof_y;
@@ -12460,14 +12460,14 @@ cPhs_State daPy_lk_c::makeBgWait() {
mAcch.CrrPos(*dComIfG_Bgsp());
if ((-G_CM3D_F_INF == mAcch.GetGroundH()) ||
(((m352E != 0 && (dComIfG_Bgsp()->ChkMoveBG(mAcch.m_gnd))) &&
- (fopAcM_GetName(dComIfG_Bgsp()->GetActorPointer(mAcch.m_gnd.GetBgIndex())) ==
+ (fopAcM_GetName(dComIfG_Bgsp()->GetActorPointer(mAcch.m_gnd)) ==
PROC_TBOX))))
{
return cPhs_INIT_e;
}
if (((fopAcM_GetParam(this) & 0x80) != 0) && (m352E != 0)) {
if (!(dComIfG_Bgsp()->ChkMoveBG(mAcch.m_gnd)) ||
- (fopAcM_GetName(dComIfG_Bgsp()->GetActorPointer(mAcch.m_gnd.GetBgIndex())) !=
+ (fopAcM_GetName(dComIfG_Bgsp()->GetActorPointer(mAcch.m_gnd)) !=
PROC_OBJ_IKADA))
{
return cPhs_INIT_e;
diff --git a/src/d/actor/d_a_swc00.cpp b/src/d/actor/d_a_swc00.cpp
index a27ae5a4..5d3dc10f 100644
--- a/src/d/actor/d_a_swc00.cpp
+++ b/src/d/actor/d_a_swc00.cpp
@@ -11,22 +11,22 @@
/* 00000078-00000180 .text daSwc00_Execute__FP11swc00_class */
static BOOL daSwc00_Execute(swc00_class* i_this) {
- s32 enable_sw = daSwc00_getSw2No(i_this);
fopAc_ac_c* actor = i_this;
- if(enable_sw == 0xFF || dComIfGs_isSwitch(enable_sw, fopAcM_GetRoomNo(i_this))) {
- s32 swBit = daSwc00_getSw1No(i_this);
+ int enable_sw = daSwc00_getSw2No(i_this);
+ if(enable_sw == 0xFF || dComIfGs_isSwitch(enable_sw, fopAcM_GetRoomNo(actor))) {
+ int swBit = daSwc00_getSw1No(i_this);
- f32 xz_dist2 = fopAcM_searchPlayerDistanceXZ2(i_this);
- f32 y_diff = fopAcM_searchPlayerDistanceY(i_this);
- if(xz_dist2 < i_this->scale.x && (-100.0f < y_diff && y_diff < i_this->scale.y)) {
- dComIfGs_onSwitch(swBit, fopAcM_GetRoomNo(i_this));
+ f32 xz_dist2 = fopAcM_searchPlayerDistanceXZ2(actor);
+ f32 y_diff = fopAcM_searchPlayerDistanceY(actor);
+ if(xz_dist2 < actor->scale.x && (-100.0f < y_diff && y_diff < actor->scale.y)) {
+ dComIfGs_onSwitch(swBit, fopAcM_GetRoomNo(actor));
if(daSwc00_getType(i_this) != 0) {
- fopAcM_delete(actor);
+ fopAcM_delete(i_this);
}
}
else if(daSwc00_getType(i_this) == 0) {
- dComIfGs_offSwitch(swBit, fopAcM_GetRoomNo(i_this));
+ dComIfGs_offSwitch(swBit, fopAcM_GetRoomNo(actor));
}
}
@@ -44,21 +44,27 @@ static BOOL daSwc00_Delete(swc00_class* i_this) {
}
/* 00000190-00000274 .text daSwc00_Create__FP10fopAc_ac_c */
-static cPhs_State daSwc00_Create(fopAc_ac_c* i_actor) {
- fopAcM_SetupActor(i_actor, swc00_class);
+static cPhs_State daSwc00_Create(fopAc_ac_c* i_this) {
+#if VERSION > VERSION_DEMO
+ fopAcM_SetupActor(i_this, swc00_class);
+#endif
- swc00_class* i_this = (swc00_class*)i_actor;
+ swc00_class* a_this = (swc00_class*)i_this;
- if(dComIfGs_isSwitch(daSwc00_getSw1No(i_this), fopAcM_GetRoomNo(i_this))) {
- if(daSwc00_getType(i_this) == 0) {
- s32 swBit = daSwc00_getSw1No(i_this);
- dComIfGs_offSwitch(swBit, fopAcM_GetRoomNo(i_this));
+ u8 swBit = daSwc00_getSw1No(a_this);
+ if(dComIfGs_isSwitch(swBit, fopAcM_GetRoomNo(i_this))) {
+ if(daSwc00_getType(a_this) == 0) {
+ dComIfGs_offSwitch(daSwc00_getSw1No(a_this), fopAcM_GetRoomNo(i_this));
}
else {
return cPhs_ERROR_e;
}
}
+#if VERSION == VERSION_DEMO
+ fopAcM_SetupActor(i_this, swc00_class);
+#endif
+
i_this->scale.x *= 100.0f;
i_this->scale.x += 30.0f;
i_this->scale.x *= i_this->scale.x;