summaryrefslogtreecommitdiff
path: root/src/d/actor
diff options
context:
space:
mode:
authorLagoLunatic <LagoLunatic@users.noreply.github.com>2026-04-14 20:33:05 -0400
committerGitHub <noreply@github.com>2026-04-14 20:33:05 -0400
commit55a6be8b87cd97a551d1faa75769035ee763e3aa (patch)
tree8a6d1bad0dba990255aa7251c5c3acacc9934fc9 /src/d/actor
parenta62f436d2287e557e0d4b4bab0995cce44ecc3bd (diff)
Misc demo matches (#952)
Diffstat (limited to 'src/d/actor')
-rw-r--r--src/d/actor/d_a_bk.cpp402
-rw-r--r--src/d/actor/d_a_boko.cpp101
-rw-r--r--src/d/actor/d_a_bwdg.cpp12
-rw-r--r--src/d/actor/d_a_cc.cpp2
-rw-r--r--src/d/actor/d_a_demo_item.cpp12
-rw-r--r--src/d/actor/d_a_fganon.cpp239
-rw-r--r--src/d/actor/d_a_fgmahou.cpp22
-rw-r--r--src/d/actor/d_a_himo3.cpp201
-rw-r--r--src/d/actor/d_a_hys.cpp6
-rw-r--r--src/d/actor/d_a_kita.cpp193
-rw-r--r--src/d/actor/d_a_ks.cpp248
-rw-r--r--src/d/actor/d_a_leaflift.cpp18
-rw-r--r--src/d/actor/d_a_mbdoor.cpp47
-rw-r--r--src/d/actor/d_a_obj_gong.cpp2
-rw-r--r--src/d/actor/d_a_obj_hat.cpp2
-rw-r--r--src/d/actor/d_a_obj_iceisland.cpp6
-rw-r--r--src/d/actor/d_a_obj_pfall.cpp40
-rw-r--r--src/d/actor/d_a_shutter.cpp7
-rw-r--r--src/d/actor/d_a_swtact.cpp5
-rw-r--r--src/d/actor/d_a_tag_ghostship.cpp9
-rw-r--r--src/d/actor/d_a_tag_light.cpp10
-rw-r--r--src/d/actor/d_a_tornado.cpp6
22 files changed, 1003 insertions, 587 deletions
diff --git a/src/d/actor/d_a_bk.cpp b/src/d/actor/d_a_bk.cpp
index f2a5de64..7b9ebf48 100644
--- a/src/d/actor/d_a_bk.cpp
+++ b/src/d/actor/d_a_bk.cpp
@@ -101,33 +101,36 @@ static void anm_init(bk_class* i_this, int bckFileIdx, f32 morf, u8 loopMode, f3
/* 00000234-000005A8 .text yari_off_check__FP8bk_class */
static void yari_off_check(bk_class* i_this) {
+ fopAc_ac_c* actor = i_this;
+
if (i_this->m0B34 == 0) {
return;
}
- daBoko_c* boko = (daBoko_c*)fopAcM_SearchByID(i_this->m1200);
+ fopAc_ac_c* boko_actor = fopAcM_SearchByID(i_this->m1200);
+ daBoko_c* boko = (daBoko_c*)boko_actor;
if (boko) {
daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0);
- fopAcM_cancelCarryNow(boko);
+ fopAcM_cancelCarryNow(boko_actor);
if (i_this->m0B34 != 2) {
boko->setRotAngleSpeed(cM_rndFX(2000.0f));
- s16 angleY = i_this->shape_angle.y + 0x8000 + (s16)cM_rndFX(8000.0f);
+ s16 angleY = actor->shape_angle.y + 0x8000 + (s16)cM_rndFX(8000.0f);
f32 speedY = 20.0f + cM_rndF(20.0f);
f32 speedForward = 20.0f + cM_rndF(10.0f);
boko->moveStateInit(speedForward, speedY, angleY);
}
- boko->current.angle.y = player->shape_angle.y;
+ boko_actor->current.angle.y = player->shape_angle.y;
cXyz offset;
dBgS_LinChk linChk;
- linChk.Set(&i_this->eyePos, &boko->current.pos, i_this);
+ linChk.Set(&actor->eyePos, &boko_actor->current.pos, i_this);
if (dComIfG_Bgsp()->LineCross(&linChk)) {
MtxP mtx = i_this->mpMorf->getModel()->getAnmMtx(0x10); // mune (chest) joint
MTXCopy(mtx, *calc_mtx);
boko->setMatrix(*calc_mtx);
offset.set(0.0f, 0.0f, 0.0f);
- MtxPosition(&offset, &boko->current.pos);
+ MtxPosition(&offset, &boko_actor->current.pos);
}
}
@@ -275,13 +278,13 @@ static BOOL nodeCallBack(J3DNode* node, int calcTiming) {
if (i_this) {
MTXCopy(model->getAnmMtx(jntNo), *calc_mtx);
if (jntNo == 0x13) { // ago joint
- mDoMtx_ZrotM(*calc_mtx, i_this->m11F4);
+ cMtx_ZrotM(*calc_mtx, i_this->m11F4);
model->setAnmMtx(jntNo, *calc_mtx);
MTXCopy(*calc_mtx, J3DSys::mCurrentMtx);
} else {
- mDoMtx_YrotM(*calc_mtx, i_this->dr.m088[r28].y);
- mDoMtx_XrotM(*calc_mtx, i_this->dr.m088[r28].x);
- mDoMtx_ZrotM(*calc_mtx, i_this->dr.m088[r28].z);
+ cMtx_YrotM(*calc_mtx, i_this->dr.m088[r28].y);
+ cMtx_XrotM(*calc_mtx, i_this->dr.m088[r28].x);
+ cMtx_ZrotM(*calc_mtx, i_this->dr.m088[r28].z);
model->setAnmMtx(jntNo, *calc_mtx);
MTXCopy(*calc_mtx, J3DSys::mCurrentMtx);
@@ -368,17 +371,17 @@ static void search_check_draw(bk_class* i_this) {
s16 r26 = 0;
for (i = 0; i < 0x10; i++, r26 += 0x1000) {
MtxTrans(i_this->current.pos.x, 2.5f + i_this->dr.mSpawnY, i_this->current.pos.z, 0);
- mDoMtx_YrotM(*calc_mtx, r26);
+ cMtx_YrotM(*calc_mtx, r26);
MtxPosition(&sp08, &sp14[0]);
- mDoMtx_YrotM(*calc_mtx, 0x1000);
+ cMtx_YrotM(*calc_mtx, 0x1000);
MtxPosition(&sp08, &sp14[1]);
}
sp08.z = l_bkHIO.m02C;
for (i = 0; i < 0x10; i++, r26 += 0x1000) {
MtxTrans(i_this->current.pos.x, 2.5f + i_this->dr.mSpawnY, i_this->current.pos.z, 0);
- mDoMtx_YrotM(*calc_mtx, (int)r26);
+ cMtx_YrotM(*calc_mtx, (int)r26);
MtxPosition(&sp08, &sp14[0]);
- mDoMtx_YrotM(*calc_mtx, 0x1000);
+ cMtx_YrotM(*calc_mtx, 0x1000);
MtxPosition(&sp08, &sp14[1]);
}
@@ -387,25 +390,25 @@ static void search_check_draw(bk_class* i_this) {
MtxTrans(i_this->eyePos.x, i_this->eyePos.y, i_this->eyePos.z, 0);
MtxPush();
- mDoMtx_YrotM(*calc_mtx, i_this->m0330 - l_bkHIO.m034);
+ cMtx_YrotM(*calc_mtx, i_this->m0330 - l_bkHIO.m034);
sp08.y = l_bkHIO.m038;
MtxPosition(&sp08, &sp14[1]);
MtxPull();
MtxPush();
sp08.y = l_bkHIO.m038;
- mDoMtx_YrotM(*calc_mtx, i_this->m0330 + l_bkHIO.m034);
+ cMtx_YrotM(*calc_mtx, i_this->m0330 + l_bkHIO.m034);
MtxPosition(&sp08, &sp14[2]);
MtxPull();
MtxPush();
- mDoMtx_YrotM(*calc_mtx, i_this->m0330 - l_bkHIO.m034);
+ cMtx_YrotM(*calc_mtx, i_this->m0330 - l_bkHIO.m034);
sp08.y = -l_bkHIO.m038;
MtxPosition(&sp08, &sp14[4]);
MtxPull();
sp08.y = -l_bkHIO.m038;
- mDoMtx_YrotM(*calc_mtx, i_this->m0330 + l_bkHIO.m034);
+ cMtx_YrotM(*calc_mtx, i_this->m0330 + l_bkHIO.m034);
MtxPosition(&sp08, &sp14[5]);
sp14[0] = i_this->eyePos;
@@ -415,7 +418,7 @@ static void search_check_draw(bk_class* i_this) {
sp08.x = 0.0f;
sp08.z = l_bkHIO.m02C;
MtxTrans(i_this->eyePos.x, i_this->eyePos.y, i_this->eyePos.z, 0);
- mDoMtx_YrotM(*calc_mtx, i_this->current.angle.y);
+ cMtx_YrotM(*calc_mtx, i_this->current.angle.y);
sp08.x = l_bkHIO.m03C;
sp08.y = l_bkHIO.m040;
@@ -1216,7 +1219,9 @@ static void stand(bk_class* i_this) {
anm_init(i_this, BK_BCK_BK_WAIT, 10.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, BK_BAS_BK_WAIT);
i_this->dr.mMode = -19;
i_this->m0300[1] = 20;
+ #if VERSION > VERSION_DEMO
i_this->m02B5 = 0;
+ #endif
// Fall-through
case -19:
if (i_this->m0300[1] == 0) {
@@ -1802,14 +1807,15 @@ static void fight_run(bk_class* i_this) {
break;
}
// Fall-through
- case 1:
+ case 1: {
f32 scaleMag;
if (i_this->m0B30 != 0 || i_this->m11F3 != 0) {
scaleMag = l_bkHIO.m054;
} else {
scaleMag = l_bkHIO.m058;
}
- cLib_addCalc2(&i_this->speedF, scaleMag, 1.0f, 5.0f);
+ f32 f3 = 5.0f;
+ cLib_addCalc2(&i_this->speedF, scaleMag, 1.0f, f3);
i_this->m1212++;
if (daBk_player_way_check(i_this) && (i_this->m1212 & 0x30) && !r29) {
if (i_this->m120C != 0) {
@@ -1869,6 +1875,7 @@ static void fight_run(bk_class* i_this) {
return;
}
break;
+ }
case 2:
i_this->m120C = 0;
@@ -2043,8 +2050,7 @@ static void fight_run(bk_class* i_this) {
daBk_player_view_check(i_this, &i_this->dr.m714->current.pos, i_this->m0332, l_bkHIO.m034)
) {
i_this->m02FC++;
- s16 temp = 0x19 + REG0_S(0);
- if (i_this->m02FC >= temp) {
+ if (i_this->m02FC >= (s16)(0x19 + REG0_S(0))) {
if (cM_rndF(1.0f) < 0.5f + REG0_F(0) &&
(ground_4_check(i_this, 4, i_this->current.angle.y, 200.0f) & 0xD) == 0
) {
@@ -2228,7 +2234,6 @@ temp_1B8:
u8 attackType = 0;
f32 startFrame = 1000.0f;
f32 endFrame = 1000.0f;
- f32 maxDist = 10000.0f;
if (i_this->m0B5C == 0) {
startFrame = 12.0f + REG0_F(8);
endFrame = 25.0f + REG0_F(9);
@@ -2238,7 +2243,7 @@ temp_1B8:
endFrame = 10.0f + REG0_F(11);
attackType = 2;
}
- i_this->setBtAttackData(startFrame, endFrame, maxDist, attackType);
+ i_this->setBtAttackData(startFrame, endFrame, 10000.0f, attackType);
i_this->setBtMaxDis(l_bkHIO.m014);
i_this->setBtNowFrame(i_this->m0B64);
@@ -2486,8 +2491,8 @@ static void hukki(bk_class* i_this) {
daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0);
cXyz sp24 = i_this->dr.m100[10] - i_this->dr.m100[13];
cXyz sp18;
- mDoMtx_YrotS(*calc_mtx, cM_atan2s(sp24.x, sp24.z));
- mDoMtx_XrotM(*calc_mtx, -cM_atan2s(sp24.y, std::sqrtf(sp24.x*sp24.x + sp24.z*sp24.z)));
+ cMtx_YrotS(*calc_mtx, cM_atan2s(sp24.x, sp24.z));
+ cMtx_XrotM(*calc_mtx, -cM_atan2s(sp24.y, std::sqrtf(sp24.x*sp24.x + sp24.z*sp24.z)));
sp24.x = sp24.y = 0.0f;
i_this->m030E = 2;
@@ -2640,7 +2645,7 @@ static void fail(bk_class* i_this) {
}
if (i_this->m02B8 != 0) {
- dComIfGs_onSwitch(i_this->m02B8, i_this->current.roomNo);
+ dComIfGs_onSwitch(i_this->m02B8, fopAcM_GetRoomNo(i_this));
}
fopAcM_onActor(i_this);
@@ -2698,17 +2703,19 @@ static void yogan_fail(bk_class* i_this) {
/* 000090E0-0000924C .text water_fail__FP8bk_class */
static void water_fail(bk_class* i_this) {
+ fopAc_ac_c* actor = i_this;
+
i_this->dr.m71E = 5;
i_this->m030E = 5;
- fopAcM_OffStatus(i_this, 0);
- i_this->attention_info.flags = 0;
- i_this->speedF = 0.0f;
+ fopAcM_OffStatus(actor, 0);
+ actor->attention_info.flags = 0;
+ actor->speedF = 0.0f;
switch (i_this->dr.mMode) {
case 0:
anm_init(i_this, BK_BCK_BK_NIGERU, 5.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, BK_BAS_BK_NIGERU);
i_this->dr.mMode = 1;
- fopAcM_monsSeStart(i_this, JA_SE_CV_BK_SURPRISE, 0);
+ fopAcM_monsSeStart(actor, JA_SE_CV_BK_SURPRISE, 0);
i_this->dr.m458.y = 0.0f;
i_this->dr.m44C.y = 0.0f;
i_this->dr.m480 = 0;
@@ -2718,13 +2725,13 @@ static void water_fail(bk_class* i_this) {
i_this->m0300[3] = 120;
// Fall-through
case 1:
- i_this->speed.y = 0.0f;
- i_this->current.pos.y -= 1.0f;
- cLib_addCalcAngleS2(&i_this->current.angle.x, 0, 8, 0x800);
+ actor->speed.y = 0.0f;
+ actor->current.pos.y -= 1.0f;
+ cLib_addCalcAngleS2(&actor->current.angle.x, 0, 8, 0x800);
if (i_this->m0300[3] == 0) {
- fopAcM_delete(i_this);
+ fopAcM_delete(actor);
if (i_this->m02B8 != 0) {
- dComIfGs_onSwitch(i_this->m02B8, i_this->current.roomNo);
+ dComIfGs_onSwitch(i_this->m02B8, fopAcM_GetRoomNo(actor));
}
}
break;
@@ -2815,6 +2822,7 @@ static void wepon_search(bk_class* i_this) {
if (i_this->m0300[1] == 24) {
if (boko != NULL && !fopAcM_checkCarryNow(boko)) {
i_this->m0B30 = 2;
+ #if VERSION > VERSION_DEMO
if (fopAcM_GetParam(boko) == daBoko_c::Type_BOKO_STICK_e) {
i_this->m02D5 = 0;
i_this->m1040.SetAtType(AT_TYPE_UNK2000);
@@ -2824,6 +2832,7 @@ static void wepon_search(bk_class* i_this) {
i_this->m1040.SetAtType(AT_TYPE_UNK800);
i_this->m1040.SetAtSe(dCcG_SE_UNK2);
}
+ #endif
fopAcM_setCarryNow(boko, FALSE);
} else {
i_this->dr.mAction = 0;
@@ -3249,6 +3258,8 @@ static void b_hang(bk_class* i_this) {
/* 0000A9BC-0000AC6C .text rope_on__FP8bk_class */
static void rope_on(bk_class* i_this) {
+ daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0);
+
i_this->dr.m710 = 1;
i_this->m030E = 2;
@@ -3893,7 +3904,7 @@ static void waki_set(bk_class* i_this) {
} else {
params->base.parameters = (i_this->m02B6 << 0x10) | 0xFF00FF39; // TODO clean up parameters
}
- params->room_no = actor->current.roomNo;
+ params->room_no = fopAcM_GetRoomNo(actor);
fopAcM_Create(PROC_BK, NULL, params);
i_this->m1212++;
}
@@ -3902,6 +3913,7 @@ static void waki_set(bk_class* i_this) {
/* 0000C2D0-0000CC68 .text demo_camera__FP8bk_class */
static void demo_camera(bk_class* i_this) {
fopAc_ac_c* actor = i_this;
+ fopAc_ac_c* player_actor = dComIfGp_getPlayer(0);
daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0);
camera_class* camera = dComIfGp_getCamera(dComIfGp_getPlayerCameraID(0));
@@ -3926,17 +3938,17 @@ static void demo_camera(bk_class* i_this) {
// Fall-through
case 2:
sp80.x = 1884.0f;
- sp80.y = player->current.pos.y;
+ sp80.y = player_actor->current.pos.y;
sp80.z = -4100.0f;
player->setPlayerPosAndAngle(&sp80, REG8_S(4) + 0x61A8);
- i_this->m1244 = player->current.pos;
+ i_this->m1244 = player_actor->current.pos;
i_this->m1244.y += REG13_F(6) + 100.0f;
- cMtx_YrotS(*calc_mtx, player->shape_angle.y);
+ cMtx_YrotS(*calc_mtx, player_actor->shape_angle.y);
sp8C.x = 0.0f;
sp8C.y = REG13_F(7) + 50.0f;
sp8C.z = REG13_F(8) + 150.0f;
MtxPosition(&sp8C, &sp80);
- i_this->m1238 = player->current.pos + sp80;
+ i_this->m1238 = player_actor->current.pos + sp80;
i_this->m1260 = REG13_F(9) + 45.0f;
if (i_this->m1236 == 30) {
player->changeOriginalDemo();
@@ -3955,7 +3967,7 @@ static void demo_camera(bk_class* i_this) {
sp8C.y = 100.0f;
sp8C.z = REG8_F(18) + 30.0f;
MtxPosition(&sp8C, &sp80);
- i_this->m1238 = player->current.pos + sp80;
+ i_this->m1238 = player_actor->current.pos + sp80;
i_this->m1244 = ken->current.pos;
i_this->m1244.y += REG8_F(4);
if (i_this->m1236 > 10) {
@@ -3971,18 +3983,18 @@ static void demo_camera(bk_class* i_this) {
player->changeDemoMode(29);
player->voiceStart(0x1F);
}
- i_this->m1244 = player->current.pos;
+ i_this->m1244 = player_actor->current.pos;
i_this->m1244.y += REG8_F(6) + 90.0f;
- cMtx_YrotS(*calc_mtx, player->shape_angle.y);
+ cMtx_YrotS(*calc_mtx, player_actor->shape_angle.y);
sp8C.x = 0.0f;
sp8C.y = REG8_F(7) + 50.0f;
sp8C.z = REG8_F(8) + 200.0f;
MtxPosition(&sp8C, &sp80);
- i_this->m1238 = player->current.pos + sp80;
+ i_this->m1238 = player_actor->current.pos + sp80;
i_this->m1260 = REG8_F(9) + 55.0f;
if (i_this->m1236 == 30) {
- dComIfGs_onSwitch(0xE0, actor->current.roomNo);
+ dComIfGs_onSwitch(0xE0, fopAcM_GetRoomNo(actor));
mDoAud_bgmAllMute(30);
}
if (i_this->m1236 == 50) {
@@ -4051,7 +4063,7 @@ static void demo_camera(bk_class* i_this) {
camera->mCamera.Start();
camera->mCamera.SetTrimSize(0);
dComIfGp_event_reset();
- dComIfGs_onSwitch(0xE1, actor->current.roomNo);
+ dComIfGs_onSwitch(0xE1, fopAcM_GetRoomNo(actor));
}
break;
case 50:
@@ -4095,8 +4107,7 @@ static void demo_camera(bk_class* i_this) {
/* 0000CC68-0000CD00 .text tate_mtx_set__FP8bk_class */
static void tate_mtx_set(bk_class* i_this) {
if (i_this->m02D4 != 0) {
- int jointIdx = 0x25; // tate joint
- MTXCopy(i_this->mpMorf->getModel()->getAnmMtx(jointIdx), *calc_mtx);
+ MTXCopy(i_this->mpMorf->getModel()->getAnmMtx(0x25), *calc_mtx); // tate joint
i_this->m02D0->setBaseTRMtx(*calc_mtx);
cXyz sp08;
sp08.x = REG8_F(12);
@@ -4129,6 +4140,8 @@ static void bou_mtx_set(bk_class* i_this) {
/* 0000CE18-0000DD1C .text daBk_Execute__FP8bk_class */
static BOOL daBk_Execute(bk_class* i_this) {
+ daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0);
+
another_hit = 0;
if (i_this->mpSearchLight != NULL) {
@@ -4150,7 +4163,8 @@ static BOOL daBk_Execute(bk_class* i_this) {
i_this->mpMorf->setPlayMode(J3DFrameCtrl::EMode_NONE);
i_this->mpMorf->setPlaySpeed(3.0f);
i_this->mpMorf->play(&i_this->eyePos, 0, 0);
- i_this->mpMorf->getModel()->setBaseTRMtx(mDoMtx_stack_c::get());
+ J3DModel* model = i_this->mpMorf->getModel();
+ model->setBaseTRMtx(mDoMtx_stack_c::get());
i_this->mpMorf->calc();
tate_mtx_set(i_this);
bou_mtx_set(i_this);
@@ -4362,8 +4376,7 @@ static BOOL daBk_Execute(bk_class* i_this) {
if (boko != NULL) {
if (fopAcM_checkCarryNow(boko)) {
if (i_this->m0B7B == 0) {
- int jointIdx = 0x2C; // buki joint
- MTXCopy(i_this->mpMorf->getModel()->getAnmMtx(jointIdx), *calc_mtx);
+ MTXCopy(i_this->mpMorf->getModel()->getAnmMtx(0x2C), *calc_mtx); // buki joint
s16 angleY = 0x3E80 + REG8_S(1);
cMtx_YrotM(*calc_mtx, angleY);
s16 angleX = REG8_S(2);
@@ -4496,10 +4509,12 @@ static BOOL daBk_IsDelete(bk_class* i_this) {
/* 0000DD24-0000DDD8 .text daBk_Delete__FP8bk_class */
static BOOL daBk_Delete(bk_class* i_this) {
- dComIfG_resDelete(&i_this->mPhase, "Bk");
+ dComIfG_resDeleteDemo(&i_this->mPhase, "Bk");
+#if VERSION > VERSION_DEMO
if (i_this->heap) {
i_this->mpMorf->stopZelAnime();
}
+#endif
if (i_this->m121D) {
hio_set = 0;
mDoHIO_deleteChild(l_bkHIO.mNo);
@@ -4510,6 +4525,7 @@ static BOOL daBk_Delete(bk_class* i_this) {
return TRUE;
}
+#if VERSION > VERSION_DEMO
/* 0000DDD8-0000E2C8 .text useHeapInit__FP10fopAc_ac_c */
static BOOL useHeapInit(fopAc_ac_c* i_actor) {
bk_class* i_this = (bk_class*)i_actor;
@@ -4549,6 +4565,8 @@ static BOOL useHeapInit(fopAc_ac_c* i_actor) {
i_this->m02C4 = new mDoExt_btpAnm();
if (i_this->m02C4 == NULL) {
// Bug: This function is supposed to return a boolean but here it returns a phase state instead.
+ // This is because the contents of this function were originally written in daBk_Create (which returns
+ // a phase state) for the demo version and were cut and pasted into a separate function for retail.
// TODO: Check what happens when this bug occurs.
return cPhs_ERROR_e;
}
@@ -4561,7 +4579,7 @@ static BOOL useHeapInit(fopAc_ac_c* i_actor) {
J3DModelData* modelData;
modelData = (J3DModelData*)dComIfG_getObjectRes("Bk", BK_BMD_BK_KB);
- JUT_ASSERT(VERSION_SELECT(9398, 9398, 9418, 9418), modelData != NULL);
+ JUT_ASSERT(VERSION_SELECT(9459, 9398, 9418, 9418), modelData != NULL);
if (i_this->m02D5 & 0x40) {
J3DMaterialTable* bmt = (J3DMaterialTable*)dComIfG_getObjectRes("Bk", BK_BMT_BK_KEN);
modelData->setMaterialTable(bmt, J3DMatCopyFlag_Material);
@@ -4580,13 +4598,13 @@ static BOOL useHeapInit(fopAc_ac_c* i_actor) {
if (i_this->m02D4 != 0) {
modelData = (J3DModelData*)dComIfG_getObjectRes("Bk", BK_BMD_BK_TATE);
i_this->m02D0 = mDoExt_J3DModel__create(modelData, 0, 0x11020203);
- JUT_ASSERT(VERSION_SELECT(9425, 9425, 9445, 9445), modelData != NULL);
+ JUT_ASSERT(VERSION_SELECT(9486, 9425, 9445, 9445), modelData != NULL);
}
if (i_this->m02DC != 0) {
modelData = (J3DModelData*)dComIfG_getObjectRes("Bk", BK_BDL_BOUEN);
i_this->m02D8 = mDoExt_J3DModel__create(modelData, 0, 0x11020203);
- JUT_ASSERT(VERSION_SELECT(9434, 9434, 9454, 9454), modelData != NULL);
+ JUT_ASSERT(VERSION_SELECT(9496, 9434, 9454, 9454), modelData != NULL);
}
static Vec hip_offset[] = {
@@ -4721,6 +4739,7 @@ static BOOL useHeapInit(fopAc_ac_c* i_actor) {
return TRUE;
}
+#endif
/* 0000E310-0000EA2C .text daBk_Create__FP10fopAc_ac_c */
static cPhs_State daBk_Create(fopAc_ac_c* i_actor) {
@@ -4729,7 +4748,7 @@ static cPhs_State daBk_Create(fopAc_ac_c* i_actor) {
cPhs_State phase_state = dComIfG_resLoad(&i_this->mPhase, "Bk");
if (phase_state == cPhs_COMPLEATE_e) {
- i_this->gbaName = 1;
+ i_actor->gbaName = 1;
if (strcmp(dComIfGp_getStartStageName(), "ITest63") == 0 ||
strcmp(dComIfGp_getStartStageName(), "GanonJ") == 0)
@@ -4739,41 +4758,245 @@ static cPhs_State daBk_Create(fopAc_ac_c* i_actor) {
search_sp = 0;
}
- i_this->mType = fopAcM_GetParam(i_this) & 0xF;
- i_this->m02B9 = fopAcM_GetParam(i_this) & 0x10;
- i_this->m02D4 = fopAcM_GetParam(i_this) & 0x20;
+ i_this->mType = fopAcM_GetParam(i_actor) & 0xF;
+ i_this->m02B9 = fopAcM_GetParam(i_actor) & 0x10;
+ i_this->m02D4 = fopAcM_GetParam(i_actor) & 0x20;
if (i_this->mType == 0xB) {
i_this->m02D4 = 0;
i_this->m02DC = 1;
i_this->mType = 4;
}
- i_this->m02D5 = fopAcM_GetParam(i_this) & 0xC0;
- i_this->m02B5 = fopAcM_GetParam(i_this) >> 8 & 0xFF;
- i_this->m02B6 = fopAcM_GetParam(i_this) >> 16 & 0xFF;
- i_this->m02B7 = fopAcM_GetParam(i_this) >> 24 & 0xFF;
- i_this->m02B8 = i_this->current.angle.z;
- i_this->current.angle.x = i_this->current.angle.z = 0;
+ i_this->m02D5 = fopAcM_GetParam(i_actor) & 0xC0;
+ i_this->m02B5 = fopAcM_GetParam(i_actor) >> 8 & 0xFF;
+ i_this->m02B6 = fopAcM_GetParam(i_actor) >> 16 & 0xFF;
+ i_this->m02B7 = fopAcM_GetParam(i_actor) >> 24 & 0xFF;
+ i_this->m02B8 = i_actor->current.angle.z;
+ i_actor->current.angle.x = i_actor->current.angle.z = 0;
if (i_this->m02B8 == 0xFF) {
i_this->m02B8 = 0;
}
if (i_this->m02B8 != 0) {
- if (dComIfGs_isSwitch(i_this->m02B8, fopAcM_GetRoomNo(i_this))) {
+ if (dComIfGs_isSwitch(i_this->m02B8, fopAcM_GetRoomNo(i_actor))) {
return cPhs_ERROR_e;
}
}
if (i_this->m02B9 != 0) {
- if (dComIfGs_isSwitch(i_this->m02B7, fopAcM_GetRoomNo(i_this))) {
+ if (dComIfGs_isSwitch(i_this->m02B7, fopAcM_GetRoomNo(i_actor))) {
return cPhs_ERROR_e;
}
i_this->m02B7 = 0xFF;
}
- i_this->itemTableIdx = dComIfGp_CharTbl()->GetNameIndex("Bk", 0);
+ i_actor->itemTableIdx = dComIfGp_CharTbl()->GetNameIndex("Bk", 0);
+
+#if VERSION == VERSION_DEMO
+ u32 heap_size = 0x16D00;
+ if (fopAcM_createHeap(i_actor, heap_size, 0) == NULL) {
+ return cPhs_ERROR_e;
+ }
+
+ i_this->mpMorf = new mDoExt_McaMorf(
+ (J3DModelData*)dComIfG_getObjectRes("Bk", BK_BDL_BK),
+ NULL, NULL,
+ (J3DAnmTransformKey*)dComIfG_getObjectRes("Bk", BK_BCK_BK_SUWARI),
+ J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, 1,
+ dComIfG_getObjectRes("Bk", BK_BAS_BK_SUWARI),
+ 0x00080000,
+ 0x37221203
+ );
+
+ J3DModel* model = i_this->mpMorf->getModel();
+ for (u16 i = 0; i < model->getModelData()->getJointNum(); i++) {
+ s32 r3 = joint_check[i];
+ if (r3 < 0) {
+ continue;
+ }
+ if (r3 == 0x0E || r3 == 0x0F || r3 == 0x10 || r3 == 0x11 || r3 == 0x14) {
+ model->getModelData()->getJointNodePointer(i)->setCallBack(nodeCallBack_P);
+ } else {
+ model->getModelData()->getJointNodePointer(i)->setCallBack(nodeCallBack);
+ }
+ }
+
+ if (i_this->m02DC != 0) {
+ i_this->m1230 = (J3DMaterialTable*)dComIfG_getObjectRes("Bk", BK_BMT_PINK);
+ } else if (i_this->m02D4 != 0) {
+ i_this->m1230 = (J3DMaterialTable*)dComIfG_getObjectRes("Bk", BK_BMT_GREEN);
+ }
+
+ i_this->m02C4 = new mDoExt_btpAnm();
+ if (i_this->m02C4 == NULL) {
+ return cPhs_ERROR_e;
+ }
+ J3DAnmTexPattern* btp = (J3DAnmTexPattern*)dComIfG_getObjectRes("Bk", BK_BTP_TMABATAKI);
+ if (!i_this->m02C4->init(model->getModelData(), btp, TRUE, J3DFrameCtrl::EMode_NONE)) {
+ return cPhs_ERROR_e;
+ }
+
+ J3DModelData* modelData;
+ modelData = (J3DModelData*)dComIfG_getObjectRes("Bk", BK_BMD_BK_KB);
+ JUT_ASSERT(VERSION_SELECT(9459, 9398, 9418, 9418), modelData != NULL);
+ if (i_this->m02D5 & 0x40) {
+ J3DMaterialTable* bmt = (J3DMaterialTable*)dComIfG_getObjectRes("Bk", BK_BMT_BK_KEN);
+ modelData->setMaterialTable(bmt, J3DMatCopyFlag_Material);
+ } else {
+ J3DMaterialTable* bmt = (J3DMaterialTable*)dComIfG_getObjectRes("Bk", BK_BMT_BK_BOKO);
+ modelData->setMaterialTable(bmt, J3DMatCopyFlag_Material);
+ }
+ i_this->m02E8 = mDoExt_J3DModel__create(modelData, 0, 0x11020203);
+ if (i_this->m02E8 == NULL) {
+ phase_state = cPhs_ERROR_e;
+ } else {
+ i_this->m02E8->setBaseScale(i_actor->scale);
+ }
+
+ if (i_this->m02D4 != 0) {
+ modelData = (J3DModelData*)dComIfG_getObjectRes("Bk", BK_BMD_BK_TATE);
+ i_this->m02D0 = mDoExt_J3DModel__create(modelData, 0, 0x11020203);
+ JUT_ASSERT(VERSION_SELECT(9486, 9425, 9445, 9445), modelData != NULL);
+ }
+
+ if (i_this->m02DC != 0) {
+ modelData = (J3DModelData*)dComIfG_getObjectRes("Bk", BK_BDL_BOUEN);
+ i_this->m02D8 = mDoExt_J3DModel__create(modelData, 0, 0x11020203);
+ JUT_ASSERT(VERSION_SELECT(9496, 9434, 9454, 9454), modelData != NULL);
+ }
- if (!fopAcM_entrySolidHeap(i_this, useHeapInit, 0x17B20)) {
+ static Vec hip_offset[] = {
+ {0.0f, 0.0f, 0.0f},
+ };
+ static Vec momo_offset[] = {
+ {-10.0f, 0.0f, 0.0f},
+ {20.0f, 0.0f, 0.0f},
+ };
+ static Vec sune_offset[] = {
+ {0.0f, -2.0f, 0.0f},
+ {15.0f, -2.0f, 0.0f},
+ };
+ static Vec shipo_offset[] = {
+ {0.0f, -1.0f, 0.0f},
+ {22.0f, -1.0f, 0.0f},
+ };
+ static Vec mune1_offset[] = {
+ {15.0f, 0.0f, 0.0f},
+ {40.0f, 0.0f, 0.0f},
+ };
+ static Vec mune2_offset[] = {
+ {40.0f, 0.0f, 0.0f},
+ {60.0f, 0.0f, 0.0f},
+ };
+ static Vec udeL_offset[] = {
+ {0.0f, 0.0f, 0.0f},
+ {45.0f, 0.0f, 0.0f},
+ };
+ static Vec udeR_offset[] = {
+ {0.0f, 0.0f, 0.0f},
+ {-45.0f, 0.0f, 0.0f},
+ };
+ static __jnt_hit_data_c search_data[] = {
+ {
+ /* mShapeType */ JntHitType_SPH_e,
+ /* mJointIndex */ 0x01, // hip1 joint
+ /* mRadius */ 20.0f,
+ /* mpOffsets */ hip_offset,
+ },
+ {
+ /* mShapeType */ JntHitType_CYL_e,
+ /* mJointIndex */ 0x03, // momoL joint
+ /* mRadius */ 5.0f,
+ /* mpOffsets */ momo_offset,
+ },
+ {
+ /* mShapeType */ JntHitType_CYL_e,
+ /* mJointIndex */ 0x04, // suneL1 joint
+ /* mRadius */ 2.5f,
+ /* mpOffsets */ sune_offset,
+ },
+ {
+ /* mShapeType */ JntHitType_CYL_e,
+ /* mJointIndex */ 0x08, // momorR joint
+ /* mRadius */ 5.0f,
+ /* mpOffsets */ momo_offset,
+ },
+ {
+ /* mShapeType */ JntHitType_CYL_e,
+ /* mJointIndex */ 0x09, // suneR1 joint
+ /* mRadius */ 2.5f,
+ /* mpOffsets */ sune_offset,
+ },
+ {
+ /* mShapeType */ JntHitType_CYL_e,
+ /* mJointIndex */ 0x0C, // sippo1 joint
+ /* mRadius */ 3.0f,
+ /* mpOffsets */ shipo_offset,
+ },
+ {
+ /* mShapeType */ JntHitType_CYL_e,
+ /* mJointIndex */ 0x0D, // sippo2 joint
+ /* mRadius */ 2.5f,
+ /* mpOffsets */ shipo_offset,
+ },
+ {
+ /* mShapeType */ JntHitType_CYL_e,
+ /* mJointIndex */ 0x0E, // sippo3 joint
+ /* mRadius */ 1.5f,
+ /* mpOffsets */ shipo_offset,
+ },
+ {
+ /* mShapeType */ JntHitType_CYL_e,
+ /* mJointIndex */ 0x0F, // sippo4 joint
+ /* mRadius */ 2.5f,
+ /* mpOffsets */ shipo_offset,
+ },
+ {
+ /* mShapeType */ JntHitType_CYL_e,
+ /* mJointIndex */ 0x10, // mune joint
+ /* mRadius */ 20.0f,
+ /* mpOffsets */ mune1_offset,
+ },
+ {
+ /* mShapeType */ JntHitType_CYL_e,
+ /* mJointIndex */ 0x10, // mune joint
+ /* mRadius */ 15.0f,
+ /* mpOffsets */ mune2_offset,
+ },
+ {
+ /* mShapeType */ JntHitType_CYL_e,
+ /* mJointIndex */ 0x21, // udeL2 joint
+ /* mRadius */ 6.0f,
+ /* mpOffsets */ udeL_offset,
+ },
+ {
+ /* mShapeType */ JntHitType_CYL_e,
+ /* mJointIndex */ 0x22, // udeL3 joint
+ /* mRadius */ 3.0f,
+ /* mpOffsets */ udeL_offset,
+ },
+ {
+ /* mShapeType */ JntHitType_CYL_e,
+ /* mJointIndex */ 0x29, // udeR2 joint
+ /* mRadius */ 6.0f,
+ /* mpOffsets */ udeR_offset,
+ },
+ {
+ /* mShapeType */ JntHitType_CYL_e,
+ /* mJointIndex */ 0x2A, // udeR3 joint
+ /* mRadius */ 3.0f,
+ /* mpOffsets */ udeR_offset,
+ },
+ };
+ i_this->mpJntHit = JntHit_create(i_this->mpMorf->getModel(), search_data, ARRAY_SIZE(search_data));
+
+ if (i_this->mpJntHit) {
+ i_actor->jntHit = i_this->mpJntHit;
+ }
+ fopAcM_adjustHeap(i_actor);
+#else
+ if (!fopAcM_entrySolidHeap(i_actor, useHeapInit, 0x17B20)) {
return cPhs_ERROR_e;
}
+#endif
if (!hio_set) {
l_bkHIO.mNo = mDoHIO_createChild("ボコちゃん", &l_bkHIO); // "Boko-chan"
@@ -4787,18 +5010,18 @@ static cPhs_State daBk_Create(fopAc_ac_c* i_actor) {
return cPhs_ERROR_e;
}
- fopAcM_SetMin(i_this, -200.0f, -50.0f, -100.0f);
- fopAcM_SetMax(i_this, 125.0f, 250.0f, 250.0f);
- fopAcM_SetMtx(i_this, i_this->mpMorf->getModel()->getBaseTRMtx());
+ fopAcM_SetMin(i_actor, -200.0f, -50.0f, -100.0f);
+ fopAcM_SetMax(i_actor, 125.0f, 250.0f, 250.0f);
+ fopAcM_SetMtx(i_actor, i_this->mpMorf->getModel()->getBaseTRMtx());
i_this->mpMorf->getModel()->setUserArea((u32)i_this);
i_this->initBt(162.5f, 125.0f);
i_this->dr.m70C = 1;
- i_this->dr.mSpawnY = i_this->current.pos.y;
+ i_this->dr.mSpawnY = i_actor->current.pos.y;
i_this->dr.mMaxFallDistance = 1000.0f;
if (i_this->m02B6 != 0xFF) {
- i_this->ppd = dPath_GetRoomPath(i_this->m02B6, fopAcM_GetRoomNo(i_this));
+ i_this->ppd = dPath_GetRoomPath(i_this->m02B6, fopAcM_GetRoomNo(i_actor));
if (i_this->ppd == NULL) {
return cPhs_ERROR_e;
}
@@ -4810,7 +5033,7 @@ static cPhs_State daBk_Create(fopAc_ac_c* i_actor) {
i_this->dr.mAction = 1;
if (i_this->mType == 0xA) {
i_this->dr.mMode = -20;
- fopAcM_OnStatus(i_this, fopAcStts_BOSS_e);
+ fopAcM_OnStatus(i_actor, fopAcStts_BOSS_e);
#if VERSION != VERSION_USA
search_sp = 1;
#endif
@@ -4834,10 +5057,10 @@ static cPhs_State daBk_Create(fopAc_ac_c* i_actor) {
i_this->m030E = 0xA;
} else if (i_this->mType == 9) {
i_this->dr.mAction = 3;
- i_this->m1216 = i_this->current.angle.z;
- i_this->m1217 = i_this->current.angle.y;
- i_this->current.angle.z = 0;
- i_this->current.angle.y = 0;
+ i_this->m1216 = i_actor->current.angle.z;
+ i_this->m1217 = i_actor->current.angle.y;
+ i_actor->current.angle.z = 0;
+ i_actor->current.angle.y = 0;
}
if (i_this->m02B7 != 0xFF) {
@@ -4862,17 +5085,20 @@ static cPhs_State daBk_Create(fopAc_ac_c* i_actor) {
} else {
weaponType = 0;
}
- i_this->m1200 = fopAcM_create(PROC_BOKO, weaponType, &i_this->current.pos, fopAcM_GetRoomNo(i_this));
+ i_this->m1200 = fopAcM_create(PROC_BOKO, weaponType, &i_actor->current.pos, fopAcM_GetRoomNo(i_actor));
i_this->m1214 = 1;
i_this->m02D5 &= 0x40;
- } else {
+ }
+ #if VERSION > VERSION_DEMO
+ else {
i_this->m11F3 = 1;
}
+ #endif
i_this->dr.mAcch.Set(
- fopAcM_GetPosition_p(i_this), fopAcM_GetOldPosition_p(i_this),
+ fopAcM_GetPosition_p(i_actor), fopAcM_GetOldPosition_p(i_actor),
i_this, 1, &i_this->dr.mAcchCir,
- fopAcM_GetSpeed_p(i_this)
+ fopAcM_GetSpeed_p(i_actor)
);
i_this->dr.mAcchCir.SetWall(40.0f, 40.0f);
i_this->dr.mAcch.ClrRoofNone();
@@ -4881,9 +5107,9 @@ static cPhs_State daBk_Create(fopAc_ac_c* i_actor) {
i_this->dr.mInvincibleTimer = 5;
if (i_this->m02D4 != 0) {
- i_this->max_health = i_this->health = 7;
+ i_actor->max_health = i_actor->health = 7;
} else {
- i_this->max_health = i_this->health = 5;
+ i_actor->max_health = i_actor->health = 5;
}
i_this->dr.mStts.Init(200, 0xFF, i_this);
@@ -5079,7 +5305,7 @@ static cPhs_State daBk_Create(fopAc_ac_c* i_actor) {
i_this->mEnemyFire.mParticleScale[i] = fire_sc[i];
}
- i_this->stealItemLeft = 3;
+ i_actor->stealItemLeft = 3;
daBk_Execute(i_this);
}
diff --git a/src/d/actor/d_a_boko.cpp b/src/d/actor/d_a_boko.cpp
index 9d90381f..8218e033 100644
--- a/src/d/actor/d_a_boko.cpp
+++ b/src/d/actor/d_a_boko.cpp
@@ -86,7 +86,7 @@ void daBoko_c::keDraw() {
/* 0000017C-00000620 .text keCalc1__8daBoko_cFP6ke_c_si */
void daBoko_c::keCalc1(ke_c_s* arg1, int arg2) {
- s32 i;
+ int i;
cXyz* pcVar11 = &arg1->m000[1];
cXyz* pcVar10 = &arg1->m078[1];
cXyz sp18(0.0f, 0.0f, 21.875f);
@@ -97,7 +97,12 @@ void daBoko_c::keCalc1(ke_c_s* arg1, int arg2) {
f32 fVar6;
dBgS_GndChk gndChk;
- gndChk.m_pos.set(pcVar11->x, pcVar11->y + 100.0f, pcVar11->z);
+ Vec temp;
+ temp.x = pcVar11->x;
+ temp.y = pcVar11->y;
+ temp.z = pcVar11->z;
+ temp.y += 100.0f;
+ gndChk.m_pos.set(temp);
f32 fVar14 = dComIfG_Bgsp()->GroundCross(&gndChk) + 3.0f;
if (fVar14 == -G_CM3D_F_INF) {
@@ -122,7 +127,7 @@ void daBoko_c::keCalc1(ke_c_s* arg1, int arg2) {
fVar5 = fVar5tmp - pcVar11[-1].y;
s16 iVar7 = -cM_atan2s(fVar5, fVar6);
- s32 iVar8 = cM_atan2s(fVar7, std::sqrtf(SQUARE(fVar5) + SQUARE(fVar6)));
+ int iVar8 = cM_atan2s(fVar7, std::sqrtf(SQUARE(fVar5) + SQUARE(fVar6)));
mDoMtx_XrotS(*calc_mtx, iVar7);
mDoMtx_YrotM(*calc_mtx, iVar8);
cXyz sp0C;
@@ -142,7 +147,7 @@ void daBoko_c::keCalc1(ke_c_s* arg1, int arg2) {
}
cXyz* segments = mpLineKe->lineMat.getPos(arg2);
- for (s32 i = 0; i < 10; i++) {
+ for (int i = 0; i < 10; i++) {
*segments++ = arg1->m000[i];
}
}
@@ -153,7 +158,7 @@ void daBoko_c::keCalc() {
MTXCopy(mpModel->getBaseTRMtx(), *calc_mtx);
- for (s32 i = 0; i < ARRAY_SSIZE(mpLineKe->m001C); i++, ke++) {
+ for (int i = 0; i < ARRAY_SSIZE(mpLineKe->m001C); i++, ke++) {
MtxPush();
cXyz sp08;
sp08.x = cM_ssin(15000 * i) * 12.0f;
@@ -186,13 +191,13 @@ BOOL daBoko_c::draw() {
GXColor color = {0xEB, 0x7D, 0, 0};
dComIfGd_setAlphaModelColor(color);
- s32 i;
+ int i;
for (i = 0; i < 2; i++) {
dComIfGd_setAlphaModel(dDlst_alphaModel_c::TYPE_SPHERE, mAlphaModelMtx[i], dark_stts->getBokoAlpha(i));
}
if (getNowMode() == Mode_PLAYER_CARRY_e && dStage_roomControl_c::getDarkMode() != 0) {
- for (s32 j = i; j < 4; j++) {
+ for (int j = i; j < 4; j++) {
dComIfGd_setSpotModel(dDlst_alphaModel_c::TYPE_SPHERE, mAlphaModelMtx[j], dark_stts->getBokoAlpha(j));
}
}
@@ -235,7 +240,7 @@ static BOOL daBoko_Draw(daBoko_c* i_this) {
/* 00000DE4-00000EB0 .text setTopRootPos__8daBoko_cFi */
void daBoko_c::setTopRootPos(int arg1) {
- s32 type = fopAcM_GetParam(this);
+ int type = fopAcM_GetParam(this);
if (arg1 != 0) {
mDoMtx_stack_c::transS(current.pos.x, current.pos.y + 5.0f, current.pos.z);
mDoMtx_stack_c::ZXYrotM(shape_angle.x, shape_angle.y, shape_angle.z);
@@ -272,7 +277,7 @@ void daBoko_c::setFlameEffect() {
dStage_darkStatus_c* dark_stts = dStage_roomControl_c::getDarkStatus();
if (dark_stts != NULL) {
- for (s32 i = 0; i < 4; i++) {
+ for (int i = 0; i < 4; i++) {
cLib_addCalc2(&m7E4, cM_rndF(0.2f) + 1.0f, 0.5f, 0.01f);
f32 scale = m7E4 * dark_stts->getBokoScale(i);
s16 y = g_Counter.mTimer * base_angle[i];
@@ -290,30 +295,33 @@ void daBoko_c::setFlameEffect() {
JPABaseEmitter* pJVar5 = mParticleCallBack.getEmitter();
if (pJVar5 != NULL) {
- f32 fVar1 = (REG0_F(4) + -0.03f) * (m2D0.x - m320.x);
- if (fVar1 > 1.0f) {
- fVar1 = 1.0f;
- } else if (fVar1 < -1.0f) {
- fVar1 = -1.0f;
+ Vec temp;
+
+ temp.x = (REG0_F(4) + -0.03f) * (m2D0.x - m320.x);
+ if (temp.x > 1.0f) {
+ temp.x = 1.0f;
+ } else if (temp.x < -1.0f) {
+ temp.x = -1.0f;
}
- f32 fVar2 = (REG0_F(4) + -0.03f) * (m2D0.z - m320.z);
- if (fVar2 > 1.0f) {
- fVar2 = 1.0f;
- } else if (fVar2 < -1.0f) {
- fVar2 = -1.0f;
+ temp.z = (REG0_F(4) + -0.03f) * (m2D0.z - m320.z);
+ if (temp.z > 1.0f) {
+ temp.z = 1.0f;
+ } else if (temp.z < -1.0f) {
+ temp.z = -1.0f;
}
- JGeometry::TVec3<f32> s(fVar1, 0.1f, fVar2);
+ JGeometry::TVec3<f32> s(temp.x, 0.1f, temp.z);
pJVar5->setDirection(s);
s = current.pos - old.pos;
+ const f32 f5 = 1.0f; // TODO: nonmatching for demo
f32 fVar11 = (REG0_F(12) + 0.05f) * std::sqrtf(SQUARE(s.x) + SQUARE(s.y) + SQUARE(s.z)) + 1.0f;
if (fVar11 > REG0_F(13) + 2.0f) {
fVar11 = REG0_F(13) + 2.0f;
}
- JGeometry::TVec3<f32> s2(1.0f, fVar11, 1.0f);
+ JGeometry::TVec3<f32> s2(f5, fVar11, f5);
pJVar5->setGlobalParticleScale(s2);
m320 = m2D0;
mDoAud_seStart(JA_SE_OBJ_TORCH_BURNING, &m2D0, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(this)));
@@ -354,7 +362,7 @@ void daBoko_c::setThrowReverse(s16 arg1) {
speedF *= 0.25f;
current.angle.y = arg1 + cM_rndFX(12288.0f);
- s32 sVar1 = cLib_distanceAngleS(current.angle.y, shape_angle.y);
+ int sVar1 = cLib_distanceAngleS(current.angle.y, shape_angle.y);
if (sVar1 >= 0x4000) {
m2C2 = -(cM_rndFX(500.0f) + 3500.0f);
shape_angle.y = current.angle.y - -0x8000;
@@ -425,21 +433,23 @@ BOOL daBoko_c::procMove() {
cXyz sp1C(m2DC.x, fVar14_2, m2DC.z);
m_ground_check.SetPos(&sp1C);
- f32 fVar14 = dComIfG_Bgsp()->GroundCross(&m_ground_check);
- if (fVar14 == -G_CM3D_F_INF) {
- fVar14 = mAcch.GetGroundH();
+ f32 f31;
+ f32 f30;
+ f30 = dComIfG_Bgsp()->GroundCross(&m_ground_check);
+ if (f30 == -G_CM3D_F_INF) {
+ f30 = mAcch.GetGroundH();
}
- f32 fVar2 = m2DC.y - fVar14;
+ f31 = m2DC.y - f30;
sp1C.set(m2D0.x, fVar15_2, m2D0.z);
m_ground_check.SetPos(&sp1C);
- f32 fVar15 = dComIfG_Bgsp()->GroundCross(&m_ground_check);
- if (fVar15 == -G_CM3D_F_INF) {
- fVar15 = mAcch.GetGroundH();
+ f32 f1 = dComIfG_Bgsp()->GroundCross(&m_ground_check);
+ if (f1 == -G_CM3D_F_INF) {
+ f1 = mAcch.GetGroundH();
}
- f32 fVar3 = m2D0.y - fVar15;
- if ((fVar2 < fVar3 && fVar2 < 0.0f) || (fVar3 < fVar2 && fVar3 < 0.0f)) {
+ f32 f3 = m2D0.y - f1;
+ if ((f31 < f3 && f31 < 0.0f) || (f3 < f31 && f3 < 0.0f)) {
if (speed.y < -10.0f) {
speed.y *= -0.5f;
if (speed.y > 20.0f) {
@@ -448,15 +458,15 @@ BOOL daBoko_c::procMove() {
}
if (m2BB != 0) {
- if (fVar2 < fVar3) {
- current.pos.y -= fVar2;
+ if (f31 < f3) {
+ current.pos.y -= f31;
} else {
- current.pos.y -= fVar3;
+ current.pos.y -= f3;
}
m2BB--;
}
- sp1C.set(m2D0.x - m2DC.x, fVar15 - fVar14, m2D0.z - m2DC.z);
+ sp1C.set(m2D0.x - m2DC.x, f1 - f30, m2D0.z - m2DC.z);
s16 sVar5 = shape_angle.x - cM_atan2s(-sp1C.y, sp1C.absXZ());
m2C0 = sVar5 * -0.2f;
if (m2C0 == 0 && sVar5 != 0) {
@@ -489,8 +499,8 @@ BOOL daBoko_c::procMove() {
bVar4 = TRUE;
}
- s32 iVar6 = abs(m2C0);
- s32 iVar8 = abs(m2C2);
+ int iVar6 = abs(m2C0);
+ int iVar8 = abs(m2C2);
if (iVar8 > iVar6) {
shape_angle.x += m2C2;
} else {
@@ -519,7 +529,7 @@ BOOL daBoko_c::procMove() {
mAcch.CrrPos(*dComIfG_Bgsp());
setRoomInfo();
- if (mAcch.ChkGroundHit() && fVar14 <= 2.5f) {
+ if (mAcch.ChkGroundHit() && fVar14_3 <= 2.5f) {
if (dComIfG_Bgsp()->ChkMoveBG(mAcch.m_gnd) && fopAcM_GetName(dComIfG_Bgsp()->GetActorPointer(mAcch.m_gnd)) == PROC_TBOX) {
if (speedF < 15.0f) {
speedF = 15.0f;
@@ -527,10 +537,9 @@ BOOL daBoko_c::procMove() {
speed.y = 20.0f;
} else {
cM3dGPla* pcVar10 = dComIfG_Bgsp()->GetTriPla(mAcch.m_gnd);
- s16 iVar6 = cM_atan2s(pcVar10->mNormal.x, pcVar10->mNormal.z);
- s16 tmp = iVar6 - shape_angle.y;
- iVar6 = cM_atan2s(std::sqrtf(SQUARE(pcVar10->mNormal.x) + SQUARE(pcVar10->mNormal.z)) * cM_scos(tmp), pcVar10->mNormal.y);
- s16 __x = iVar6 - shape_angle.x;
+ s16 r0 = cM_atan2s(pcVar10->mNormal.x, pcVar10->mNormal.z) - shape_angle.y;
+ s16 r30 = cM_atan2s(std::sqrtf(SQUARE(pcVar10->mNormal.x) + SQUARE(pcVar10->mNormal.z)) * cM_scos(r0), pcVar10->mNormal.y);
+ s16 __x = r30 - shape_angle.x;
if (abs(__x) > 0x1000 && m2BB != 0) {
speed.y = 15.0f;
@@ -545,7 +554,7 @@ BOOL daBoko_c::procMove() {
m2BB = 0;
}
} else {
- shape_angle.x = iVar6;
+ shape_angle.x = r30;
shape_angle.z = 0;
procWait_init();
}
@@ -692,7 +701,7 @@ BOOL daBoko_c::procCarry() {
procMove_init();
- s32 i;
+ int i;
for (i = 0; i < 3; i++) {
m_ground_check.SetPos(&current.pos);
if (dComIfG_Bgsp()->GroundCross(&m_ground_check) != -G_CM3D_F_INF) {
@@ -838,7 +847,7 @@ static BOOL daBoko_createHeap(fopAc_ac_c* i_this) {
/* 00002AE8-00002CFC .text createHeap__8daBoko_cFv */
BOOL daBoko_c::createHeap() {
- static const s32 model_idx[] = {BOKO_BDL_BOKO, NATA_BDL_BK_NATA, CLUB_BDL_ST_BUKI, TKWN_BDL_TN_KEN1, SPEAR_BDL_MO_YARI, PGSW_BDL_BPG_KEN1};
+ static const int model_idx[] = {BOKO_BDL_BOKO, NATA_BDL_BK_NATA, CLUB_BDL_ST_BUKI, TKWN_BDL_TN_KEN1, SPEAR_BDL_MO_YARI, PGSW_BDL_BPG_KEN1};
u32 type = fopAcM_GetParam(this);
if (type >= Type_COUNT_e) {
@@ -850,7 +859,7 @@ BOOL daBoko_c::createHeap() {
J3DModelData* modelData = static_cast<J3DModelData*>(dComIfG_getObjectRes(m_arc_name[type], model_idx[type]));
JUT_ASSERT(DEMO_SELECT(1708, 1746), modelData != NULL);
- mpModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000002);
+ mpModel = mDoExt_J3DModel__create(modelData, 0x80000, type == Type_PGANON_SWORD_e ? 0x11000002 : 0x11000002);
if (mpModel == NULL) {
return FALSE;
}
diff --git a/src/d/actor/d_a_bwdg.cpp b/src/d/actor/d_a_bwdg.cpp
index 0afd5441..19b0d944 100644
--- a/src/d/actor/d_a_bwdg.cpp
+++ b/src/d/actor/d_a_bwdg.cpp
@@ -67,7 +67,8 @@ void daBwdg_packet_c::draw() {
/* 000001C4-00000260 .text daBwdg_Draw__FP10bwdg_class */
static BOOL daBwdg_Draw(bwdg_class* i_this) {
g_env_light.settingTevStruct(TEV_TYPE_BG0_FULL, &i_this->current.pos, &i_this->tevStr);
- MtxTrans(0.0f, 10.0f, 0.0f, 0);
+ f32 f1 = 0.0f;
+ MtxTrans(0.0f, 10.0f + f1, 0.0f, 0);
cMtx_concat(j3dSys.getViewMtx(), *calc_mtx, i_this->mBwdgPacket.getMtx());
i_this->mBwdgPacket.setTevStr(&i_this->tevStr);
j3dSys.getDrawBuffer(0)->entryImm(&i_this->mBwdgPacket, 0);
@@ -138,7 +139,11 @@ static void wave_cont(bwdg_class* i_this, u8 r4) {
cXyz* nrmVtx = i_this->mBwdgPacket.getNrm();
posVtx = i_this->mBwdgPacket.getPos();
cXyz sp18(0.0f, 0.0f, 1.0f);
+#if VERSION == VERSION_DEMO
+ cMtx_XrotM(*calc_mtx, -0x4A38);
+#else
cMtx_XrotS(*calc_mtx, -0x4A38);
+#endif
cXyz sp0C;
MtxPosition(&sp18, &sp0C);
@@ -185,7 +190,10 @@ static BOOL daBwdg_IsDelete(bwdg_class* i_this) {
/* 00000854-000008B0 .text daBwdg_Delete__FP10bwdg_class */
static BOOL daBwdg_Delete(bwdg_class* i_this) {
dComIfG_resDeleteDemo(&i_this->mPhase, "Bwdg");
- if (i_this->heap) {
+#if VERSION > VERSION_DEMO
+ if (i_this->heap)
+#endif
+ {
dComIfG_Bgsp()->Release(i_this->mpBgW);
}
return TRUE;
diff --git a/src/d/actor/d_a_cc.cpp b/src/d/actor/d_a_cc.cpp
index a0028881..76b69ccd 100644
--- a/src/d/actor/d_a_cc.cpp
+++ b/src/d/actor/d_a_cc.cpp
@@ -23,7 +23,7 @@ static u8 DEMO_COME_START_FLAG;
static u8 DEMO_RET_START_FLAG;
static u8 DEMO_SHORT_CUT_FLAG;
static fopAc_ac_c* target_info[10];
-static s32 target_info_count;
+static int target_info_count;
/* 00000078-000002AC .text nodeCallBack__FP7J3DNodei */
static BOOL nodeCallBack(J3DNode* node, int calcTiming) {
diff --git a/src/d/actor/d_a_demo_item.cpp b/src/d/actor/d_a_demo_item.cpp
index 2a42e87c..99ac20da 100644
--- a/src/d/actor/d_a_demo_item.cpp
+++ b/src/d/actor/d_a_demo_item.cpp
@@ -26,7 +26,7 @@ u8 daDitem_c::m_effect_type[0x100] = {
0x03, // dItem_RED_RUPEE_e
0x03, // dItem_PURPLE_RUPEE_e
0x03, // dItem_ORANGE_RUPEE_e
- 0x00, // dItem_HEART_PIECE_e
+ DEMO_SELECT(0x01, 0x00), // dItem_HEART_PIECE_e
0x00, // dItem_HEART_CONTAINER_e
0x04, // dItem_SMALL_MAGIC_e
0x04, // dItem_LARGE_MAGIC_e
@@ -34,7 +34,7 @@ u8 daDitem_c::m_effect_type[0x100] = {
0x04, // dItem_BOMB_10_e
0x04, // dItem_BOMB_20_e
0x04, // dItem_BOMB_30_e
- 0x03, // dItem_SILVER_RUPEE_e
+ DEMO_SELECT(0x04, 0x03), // dItem_SILVER_RUPEE_e
0x04, // dItem_ARROW_10_e
0x04, // dItem_ARROW_20_e
0x04, // dItem_ARROW_30_e
@@ -80,7 +80,7 @@ u8 daDitem_c::m_effect_type[0x100] = {
0x04, // dItem_MASTER_SWORD_2_e
0x00, // dItem_SHIELD_e
0x00, // dItem_MIRROR_SHIELD_e
- 0x00, // dItem_DROPPED_SWORD_e
+ DEMO_SELECT(0x04, 0x00), // dItem_DROPPED_SWORD_e
0x04, // dItem_MASTER_SWORD_3_e
0x01, // KAKERA_HEART2
0x04, // noentry64
@@ -103,7 +103,7 @@ u8 daDitem_c::m_effect_type[0x100] = {
0x02, // dItem_RED_POTION_e
0x02, // dItem_GREEN_POTION_e
0x02, // dItem_BLUE_POTION_e
- 0x00, // dItem_HALF_SOUP_BOTTLE_e
+ DEMO_SELECT(0x04, 0x00), // dItem_HALF_SOUP_BOTTLE_e
0x00, // dItem_SOUP_BOTTLE_e
0x02, // dItem_WATER_BOTTLE_e
0x02, // dItem_FAIRY_BOTTLE_e
@@ -175,10 +175,10 @@ u8 daDitem_c::m_effect_type[0x100] = {
0x02, // dItem_NOTE_TO_MOM_e
0x02, // MAGYS_LETTER
0x02, // MO_LETTER
- 0x00, // COTTAGE_PAPER
+ DEMO_SELECT(0x04, 0x00), // COTTAGE_PAPER
0x02, // KAISEN_PRESENT1
0x02, // KAISEN_PRESENT2
- 0x00, // SALVAGE_ITEM1
+ DEMO_SELECT(0x04, 0x00), // SALVAGE_ITEM1
0x04, // SALVAGE_ITEM2
0x04, // SALVAGE_ITEM3
0x04, // XXX_039
diff --git a/src/d/actor/d_a_fganon.cpp b/src/d/actor/d_a_fganon.cpp
index c84083c7..545db948 100644
--- a/src/d/actor/d_a_fganon.cpp
+++ b/src/d/actor/d_a_fganon.cpp
@@ -2371,9 +2371,6 @@ void* mahou_se_set(void* i_act, void* i_other) {
return NULL;
}
-static u32 jno[2] = {0x7, 0xD};
-static u16 eno[2] = {dPa_name::ID_AK_SN_BPGLEGSMOKE00, dPa_name::ID_AK_SN_BPGARMSMOKE00};
-
/* 000086B4-0000924C .text daFganon_Execute__FP12fganon_class */
static BOOL daFganon_Execute(fganon_class* i_this) {
fopEn_enemy_c* a_this = &i_this->actor;
@@ -2509,9 +2506,11 @@ static BOOL daFganon_Execute(fganon_class* i_this) {
for (int i = 0; i < 2; i++) {
if ((i_this->mbIsMaterialized != 0) && (i_this->mAction != 22)) {
if (i_this->mEmitters1[i] != NULL) {
+ static u32 jno[2] = {0x7, 0xD};
i_this->mEmitters1[i]->setGlobalRTMatrix(i_this->mpMorf->getModel()->getAnmMtx(jno[i]));
}
else {
+ static u16 eno[2] = {dPa_name::ID_AK_SN_BPGLEGSMOKE00, dPa_name::ID_AK_SN_BPGARMSMOKE00};
i_this->mEmitters1[i] = dComIfGp_particle_set(eno[i], &a_this->current.pos, NULL);
}
}
@@ -2732,123 +2731,6 @@ static BOOL useHeapInit(fopAc_ac_c* i_act) {
return TRUE;
}
-static dCcD_SrcCyl cc_cyl_src = {
- // dCcD_SrcGObjInf
- {
- /* Flags */ 0,
- /* SrcObjAt Type */ 0,
- /* SrcObjAt Atp */ 0,
- /* SrcObjAt SPrm */ 0,
- /* SrcObjTg Type */ ~(AT_TYPE_UNK8 | AT_TYPE_WATER | AT_TYPE_UNK20000 | AT_TYPE_WIND | AT_TYPE_UNK400000 | AT_TYPE_LIGHT),
- /* SrcObjTg SPrm */ cCcD_TgSPrm_Set_e | cCcD_TgSPrm_IsEnemy_e,
- /* SrcObjCo SPrm */ cCcD_CoSPrm_Set_e | cCcD_CoSPrm_IsPlayer_e | cCcD_CoSPrm_VsGrpAll_e,
- /* SrcGObjAt Se */ 0,
- /* SrcGObjAt HitMark */ 0,
- /* SrcGObjAt Spl */ 0,
- /* SrcGObjAt Mtrl */ 0,
- /* SrcGObjAt SPrm */ 0,
- /* SrcGObjTg Se */ 0,
- /* SrcGObjTg HitMark */ dCcG_TgHitMark_Nrm_e,
- /* SrcGObjTg Spl */ 0,
- /* SrcGObjTg Mtrl */ 0,
- /* SrcGObjTg SPrm */ dCcG_TgSPrm_NoConHit_e,
- /* SrcGObjCo SPrm */ 0,
- },
- // cM3dGCylS
- {{
- /* Center */ {0.0f, -150.0f, 0.0f},
- /* Radius */ 100.0f,
- /* Height */ 100.0f,
- }},
-};
-
-static dCcD_SrcSph wepon_sph_src = {
- // dCcD_SrcGObjInf
- {
- /* Flags */ 0,
- /* SrcObjAt Type */ AT_TYPE_UNK8,
- /* SrcObjAt Atp */ 0,
- /* SrcObjAt SPrm */ cCcD_AtSPrm_Set_e | cCcD_AtSPrm_GrpAll_e,
- /* SrcObjTg Type */ 0,
- /* SrcObjTg SPrm */ 0,
- /* SrcObjCo SPrm */ 0,
- /* SrcGObjAt Se */ 0,
- /* SrcGObjAt HitMark */ dCcG_AtHitMark_Nrm_e,
- /* SrcGObjAt Spl */ dCcG_At_Spl_UNK7,
- /* SrcGObjAt Mtrl */ 0,
- /* SrcGObjAt SPrm */ dCcG_AtSPrm_NoConHit_e,
- /* SrcGObjTg Se */ 0,
- /* SrcGObjTg HitMark */ 0,
- /* SrcGObjTg Spl */ 0,
- /* SrcGObjTg Mtrl */ 0,
- /* SrcGObjTg SPrm */ dCcG_TgSPrm_NoConHit_e,
- /* SrcGObjCo SPrm */ 0,
- },
- // cM3dGSphS
- {{
- /* Center */ {0.0f, 0.0f, 0.0f},
- /* Radius */ 200.0f,
- }},
-};
-
-static dCcD_SrcSph ball_tg_sph_src = {
- // dCcD_SrcGObjInf
- {
- /* Flags */ 0,
- /* SrcObjAt Type */ 0,
- /* SrcObjAt Atp */ 0,
- /* SrcObjAt SPrm */ 0,
- /* SrcObjTg Type */ ~(AT_TYPE_WATER | AT_TYPE_UNK20000 | AT_TYPE_WIND | AT_TYPE_UNK400000 | AT_TYPE_LIGHT),
- /* SrcObjTg SPrm */ cCcD_TgSPrm_Set_e | cCcD_TgSPrm_IsEnemy_e,
- /* SrcObjCo SPrm */ 0,
- /* SrcGObjAt Se */ 0,
- /* SrcGObjAt HitMark */ 0,
- /* SrcGObjAt Spl */ 0,
- /* SrcGObjAt Mtrl */ 0,
- /* SrcGObjAt SPrm */ 0,
- /* SrcGObjTg Se */ 0,
- /* SrcGObjTg HitMark */ 0,
- /* SrcGObjTg Spl */ 0,
- /* SrcGObjTg Mtrl */ 0,
- /* SrcGObjTg SPrm */ 0,
- /* SrcGObjCo SPrm */ 0,
- },
- // cM3dGSphS
- {{
- /* Center */ {0.0f, 0.0f, 0.0f},
- /* Radius */ 60.0f,
- }},
-};
-
-static dCcD_SrcSph ball_at_sph_src = {
- // dCcD_SrcGObjInf
- {
- /* Flags */ 0,
- /* SrcObjAt Type */ AT_TYPE_UNK800,
- /* SrcObjAt Atp */ 0x2,
- /* SrcObjAt SPrm */ cCcD_AtSPrm_Set_e | cCcD_AtSPrm_GrpAll_e,
- /* SrcObjTg Type */ 0,
- /* SrcObjTg SPrm */ 0,
- /* SrcObjCo SPrm */ 0,
- /* SrcGObjAt Se */ 0,
- /* SrcGObjAt HitMark */ 0,
- /* SrcGObjAt Spl */ dCcG_At_Spl_UNKA,
- /* SrcGObjAt Mtrl */ 0,
- /* SrcGObjAt SPrm */ 0,
- /* SrcGObjTg Se */ 0,
- /* SrcGObjTg HitMark */ 0,
- /* SrcGObjTg Spl */ 0,
- /* SrcGObjTg Mtrl */ 0,
- /* SrcGObjTg SPrm */ 0,
- /* SrcGObjCo SPrm */ 0,
- },
- // cM3dGSphS
- {{
- /* Center */ {0.0f, 0.0f, 0.0f},
- /* Radius */ 30.0f,
- }},
-};
-
/* 00009844-00009C70 .text daFganon_Create__FP10fopAc_ac_c */
static cPhs_State daFganon_Create(fopAc_ac_c* a_this) {
fganon_class* i_this = (fganon_class*)a_this;
@@ -2911,6 +2793,123 @@ static cPhs_State daFganon_Create(fopAc_ac_c* a_this) {
i_this->mStts.Init(0xFA, 0xFF, a_this);
+ static dCcD_SrcCyl cc_cyl_src = {
+ // dCcD_SrcGObjInf
+ {
+ /* Flags */ 0,
+ /* SrcObjAt Type */ 0,
+ /* SrcObjAt Atp */ 0,
+ /* SrcObjAt SPrm */ 0,
+ /* SrcObjTg Type */ ~(AT_TYPE_UNK8 | AT_TYPE_WATER | AT_TYPE_UNK20000 | AT_TYPE_WIND | AT_TYPE_UNK400000 | AT_TYPE_LIGHT),
+ /* SrcObjTg SPrm */ cCcD_TgSPrm_Set_e | cCcD_TgSPrm_IsEnemy_e,
+ /* SrcObjCo SPrm */ cCcD_CoSPrm_Set_e | cCcD_CoSPrm_IsPlayer_e | cCcD_CoSPrm_VsGrpAll_e,
+ /* SrcGObjAt Se */ 0,
+ /* SrcGObjAt HitMark */ 0,
+ /* SrcGObjAt Spl */ 0,
+ /* SrcGObjAt Mtrl */ 0,
+ /* SrcGObjAt SPrm */ 0,
+ /* SrcGObjTg Se */ 0,
+ /* SrcGObjTg HitMark */ dCcG_TgHitMark_Nrm_e,
+ /* SrcGObjTg Spl */ 0,
+ /* SrcGObjTg Mtrl */ 0,
+ /* SrcGObjTg SPrm */ dCcG_TgSPrm_NoConHit_e,
+ /* SrcGObjCo SPrm */ 0,
+ },
+ // cM3dGCylS
+ {{
+ /* Center */ {0.0f, -150.0f, 0.0f},
+ /* Radius */ 100.0f,
+ /* Height */ 100.0f,
+ }},
+ };
+
+ static dCcD_SrcSph wepon_sph_src = {
+ // dCcD_SrcGObjInf
+ {
+ /* Flags */ 0,
+ /* SrcObjAt Type */ AT_TYPE_UNK8,
+ /* SrcObjAt Atp */ 0,
+ /* SrcObjAt SPrm */ cCcD_AtSPrm_Set_e | cCcD_AtSPrm_GrpAll_e,
+ /* SrcObjTg Type */ 0,
+ /* SrcObjTg SPrm */ 0,
+ /* SrcObjCo SPrm */ 0,
+ /* SrcGObjAt Se */ 0,
+ /* SrcGObjAt HitMark */ dCcG_AtHitMark_Nrm_e,
+ /* SrcGObjAt Spl */ dCcG_At_Spl_UNK7,
+ /* SrcGObjAt Mtrl */ 0,
+ /* SrcGObjAt SPrm */ dCcG_AtSPrm_NoConHit_e,
+ /* SrcGObjTg Se */ 0,
+ /* SrcGObjTg HitMark */ 0,
+ /* SrcGObjTg Spl */ 0,
+ /* SrcGObjTg Mtrl */ 0,
+ /* SrcGObjTg SPrm */ dCcG_TgSPrm_NoConHit_e,
+ /* SrcGObjCo SPrm */ 0,
+ },
+ // cM3dGSphS
+ {{
+ /* Center */ {0.0f, 0.0f, 0.0f},
+ /* Radius */ 200.0f,
+ }},
+ };
+
+ static dCcD_SrcSph ball_tg_sph_src = {
+ // dCcD_SrcGObjInf
+ {
+ /* Flags */ 0,
+ /* SrcObjAt Type */ 0,
+ /* SrcObjAt Atp */ 0,
+ /* SrcObjAt SPrm */ 0,
+ /* SrcObjTg Type */ ~(AT_TYPE_WATER | AT_TYPE_UNK20000 | AT_TYPE_WIND | AT_TYPE_UNK400000 | AT_TYPE_LIGHT),
+ /* SrcObjTg SPrm */ cCcD_TgSPrm_Set_e | cCcD_TgSPrm_IsEnemy_e,
+ /* SrcObjCo SPrm */ 0,
+ /* SrcGObjAt Se */ 0,
+ /* SrcGObjAt HitMark */ 0,
+ /* SrcGObjAt Spl */ 0,
+ /* SrcGObjAt Mtrl */ 0,
+ /* SrcGObjAt SPrm */ 0,
+ /* SrcGObjTg Se */ 0,
+ /* SrcGObjTg HitMark */ 0,
+ /* SrcGObjTg Spl */ 0,
+ /* SrcGObjTg Mtrl */ 0,
+ /* SrcGObjTg SPrm */ 0,
+ /* SrcGObjCo SPrm */ 0,
+ },
+ // cM3dGSphS
+ {{
+ /* Center */ {0.0f, 0.0f, 0.0f},
+ /* Radius */ 60.0f,
+ }},
+ };
+
+ static dCcD_SrcSph ball_at_sph_src = {
+ // dCcD_SrcGObjInf
+ {
+ /* Flags */ 0,
+ /* SrcObjAt Type */ AT_TYPE_UNK800,
+ /* SrcObjAt Atp */ 0x2,
+ /* SrcObjAt SPrm */ cCcD_AtSPrm_Set_e | cCcD_AtSPrm_GrpAll_e,
+ /* SrcObjTg Type */ 0,
+ /* SrcObjTg SPrm */ 0,
+ /* SrcObjCo SPrm */ 0,
+ /* SrcGObjAt Se */ 0,
+ /* SrcGObjAt HitMark */ 0,
+ /* SrcGObjAt Spl */ dCcG_At_Spl_UNKA,
+ /* SrcGObjAt Mtrl */ 0,
+ /* SrcGObjAt SPrm */ 0,
+ /* SrcGObjTg Se */ 0,
+ /* SrcGObjTg HitMark */ 0,
+ /* SrcGObjTg Spl */ 0,
+ /* SrcGObjTg Mtrl */ 0,
+ /* SrcGObjTg SPrm */ 0,
+ /* SrcGObjCo SPrm */ 0,
+ },
+ // cM3dGSphS
+ {{
+ /* Center */ {0.0f, 0.0f, 0.0f},
+ /* Radius */ 30.0f,
+ }},
+ };
+
i_this->mCyl.Set(cc_cyl_src);
i_this->mCyl.SetStts(&i_this->mStts);
i_this->mCyl.OnTgNoHitMark();
diff --git a/src/d/actor/d_a_fgmahou.cpp b/src/d/actor/d_a_fgmahou.cpp
index 9c202b4d..95466bd2 100644
--- a/src/d/actor/d_a_fgmahou.cpp
+++ b/src/d/actor/d_a_fgmahou.cpp
@@ -119,7 +119,9 @@ static void move(fgmahou_class* i_this) {
}
dComIfGp_particle_set(dPa_name::ID_AK_SN_BPGSMASHDARKSHOT00, &i_this->current.pos, &i_this->home.angle);
+ #if VERSION > VERSION_DEMO
fopAcM_seStartCurrent(i_this, JA_SE_LK_PG_BOMB_STRIKE, 0);
+ #endif
i_this->mState = 5;
case 5:
@@ -178,16 +180,16 @@ static void move(fgmahou_class* i_this) {
i_this->field_0x2D4 += REG0_S(6) + 0xDAC;
i_this->field_0x2D6 += REG0_S(7) + 0xCE4;
- f32 temp5 = cM_ssin(i_this->field_0x2D4);
- f32 temp7 = cM_ssin(i_this->field_0x2D6);
- i_this->shape_angle.y = i_this->home.angle.y + (s16)(temp4 * temp5);
- i_this->shape_angle.x = i_this->home.angle.x + (s16)(temp4 * temp7 * 0.75f);
+ s16 temp5 = (s16)(temp4 * cM_ssin(i_this->field_0x2D4));
+ s16 temp7 = (s16)(temp4 * cM_ssin(i_this->field_0x2D6) * 0.75f);
+ i_this->shape_angle.y = i_this->home.angle.y + temp5;
+ i_this->shape_angle.x = i_this->home.angle.x + temp7;
diff2.x = 0.0f;
diff2.y = 0.0f;
diff2.z = i_this->speedF;
- mDoMtx_YrotS(*calc_mtx, i_this->shape_angle.y);
- mDoMtx_XrotM(*calc_mtx, i_this->shape_angle.x);
+ cMtx_YrotS(*calc_mtx, i_this->shape_angle.y);
+ cMtx_XrotM(*calc_mtx, i_this->shape_angle.x);
MtxPosition(&diff2, &i_this->speed);
if(temp2 <= 1) {
@@ -288,7 +290,7 @@ static BOOL daFgmahou_IsDelete(fgmahou_class* i_this) {
/* 00000DE0-00000E3C .text daFgmahou_Delete__FP13fgmahou_class */
static BOOL daFgmahou_Delete(fgmahou_class* i_this) {
- dComIfG_resDelete(&i_this->mPhs, "Fganon");
+ dComIfG_resDeleteDemo(&i_this->mPhs, "Fganon");
if(i_this->mpEmitter) {
i_this->mpEmitter->becomeInvalidEmitter();
@@ -398,10 +400,16 @@ static cPhs_State daFgmahou_Create(fopAc_ac_c* a_this) {
fgmahou_class* i_this = static_cast<fgmahou_class*>(a_this);
+#if VERSION > VERSION_DEMO
fopAcM_SetupActor(i_this, fgmahou_class);
+#endif
cPhs_State phase_state = dComIfG_resLoad(&i_this->mPhs, "Fganon");
if(phase_state == cPhs_COMPLEATE_e) {
+ #if VERSION == VERSION_DEMO
+ fopAcM_SetupActor(i_this, fgmahou_class);
+ #endif
+
i_this->mOrbNumber = fopAcM_GetParam(i_this) & 0xF;
if(!fopAcM_entrySolidHeap(i_this, useHeapInit, 0x19000)) {
diff --git a/src/d/actor/d_a_himo3.cpp b/src/d/actor/d_a_himo3.cpp
index 23a7a670..39f3d9a2 100644
--- a/src/d/actor/d_a_himo3.cpp
+++ b/src/d/actor/d_a_himo3.cpp
@@ -7,7 +7,9 @@
#include "d/actor/d_a_himo3.h"
#include "d/actor/d_a_player.h"
#include "d/res/res_always.h"
+#if VERSION > VERSION_DEMO
#include "d/res/res_bgn.h"
+#endif
#include "d/res/res_link.h"
#include "d/res/res_himo3.h"
#include "d/d_s_play.h"
@@ -48,14 +50,19 @@ static bool hio_set;
static himo3HIO_c l_HIO;
/* 000000EC-00000C58 .text himo3_control__FP11himo3_classP7himo3_s */
-void himo3_control(himo3_class* i_this, himo3_s* arg1) {
+void himo3_control(himo3_class* i_this, himo3_s* r31) {
+ fopAc_ac_c* actor = &i_this->actor;
daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0);
- s32 i = 1;
+ int i = 1;
cXyz spAC;
cXyz spA0;
cXyz sp94;
- f32 unaff_f28;
- himo3_s* pcVar11 = &arg1[1];
+ f32 tmp200;
+ f32 tmpReg;
+ f32 f28;
+ f32 f27;
+
+ r31 += 1;
if (i_this->m02BE != 0) {
s16 target;
@@ -75,24 +82,24 @@ void himo3_control(himo3_class* i_this, himo3_s* arg1) {
i_this->m15C4 = spAC;
}
- cXyz sp88 = spAC - i_this->current.pos;
+ cXyz sp88 = spAC - actor->current.pos;
f32 sqrt = sp88.abs();
- s32 iVar8 = sqrt / HIMO3_SCALE;
- unaff_f28 = sqrt / HIMO3_SCALE - iVar8;
+ int iVar8 = sqrt / HIMO3_SCALE;
+ f28 = sqrt / HIMO3_SCALE - iVar8;
if (iVar8 >= i_this->m15C0 - 1) {
iVar8 = i_this->m15C0 - 1;
}
if (iVar8 > 1) {
- for (i = 1; i < iVar8; i++, pcVar11++) {
- f32 fVar12 = (f32)i / iVar8;
- pcVar11->m00.x = i_this->current.pos.x + sp88.x * fVar12;
- pcVar11->m00.y = i_this->current.pos.y + sp88.y * fVar12;
- pcVar11->m00.z = i_this->current.pos.z + sp88.z * fVar12;
+ for (i = 1; i < iVar8; i++, r31++) {
+ f32 fVar12 = (f32)i / (iVar8 - 1);
+ r31->m00.x = actor->current.pos.x + sp88.x * fVar12;
+ r31->m00.y = actor->current.pos.y + sp88.y * fVar12;
+ r31->m00.z = actor->current.pos.z + sp88.z * fVar12;
}
}
- cLib_addCalcAngleS2(&i_this->current.angle.y, target, 2, 0x2000);
+ cLib_addCalcAngleS2(&actor->current.angle.y, target, 2, 0x2000);
spA0 = spAC - i_this->m15C4;
cMtx_YrotS(*calc_mtx, -target);
@@ -101,9 +108,12 @@ void himo3_control(himo3_class* i_this, himo3_s* arg1) {
f32 tmp2 = DEMO_SELECT(REG0_F(6) + 10.0f, 10.0f);
cLib_addCalc2(&i_this->m15D0, tmp1, 0.1f, tmp2 * i_this->m15E4);
- tmp1 = sp94.x * DEMO_SELECT(REG0_F(5) + -10.0f, -10.0f);
+ f32 f1 = sp94.x * DEMO_SELECT(REG0_F(5) + -10.0f, -10.0f);
tmp2 = DEMO_SELECT(REG0_F(6) + 10.0f, 10.0f);
- cLib_addCalc2(&i_this->m15D8, tmp1, 0.1f, tmp2 * i_this->m15E4);
+ cLib_addCalc2(&i_this->m15D8, f1, 0.1f, tmp2 * i_this->m15E4);
+ // TODO: fakematch
+ f32 fake1 = tmp1;
+ f32 fake2 = f1;
if (std::fabsf(sp94.z) > 1.0f || std::fabsf(sp94.x) > 1.0f) {
cLib_addCalc2(&i_this->m15E4, 1.0f, 1.0f, 0.05f);
@@ -142,7 +152,7 @@ void himo3_control(himo3_class* i_this, himo3_s* arg1) {
i_this->m15C4.y = -23535.0f;
}
- cMtx_YrotS(*calc_mtx, i_this->current.angle.y);
+ cMtx_YrotS(*calc_mtx, actor->current.angle.y);
spA0.x = i_this->m15D8;
spA0.y = 0.0f;
spA0.z = i_this->m15D0;
@@ -179,62 +189,62 @@ void himo3_control(himo3_class* i_this, himo3_s* arg1) {
cXyz sp64;
MtxPosition(&spA0, &sp64);
sp64 += sp70;
- f32 tmpReg = DEMO_SELECT(REG0_F(1), 0.0f);
+ tmpReg = DEMO_SELECT(REG0_F(1), 0.0f);
spA0.x = 0.0f;
spA0.y = 0.0f;
- f32 tmp200 = DEMO_SELECT(REG0_F(8) + -200.0f, -200.0f);
+ tmp200 = DEMO_SELECT(REG0_F(8) + -200.0f, -200.0f);
- s32 j = 0;
+ int j = 0;
- f32 fVar12;
if ((i_this->m02BE == 0) && (i_this->m02BC == 0)) {
- fVar12 = DEMO_SELECT(REG0_F(2) + 30.0f + 20.0f - 20.0f, 30.0f);
+ f27 = DEMO_SELECT(REG0_F(2) + 30.0f + 20.0f - 20.0f, 30.0f);
} else {
- fVar12 = -200.0f;
+ f27 = -200.0f;
}
- u8 bVar4 = 0;
s16 unaff_r24;
s16 unaff_r23;
+ u8 bVar4 = 0;
- for (; i < i_this->m15C0; i++, pcVar11++) {
+ for (; i < i_this->m15C0; i++, r31++) {
cXyz sp60;
sp60.z = 0.0f;
sp60.y = 0.0f;
sp60.x = 0.0f;
- f32 fVar1 = pcVar11->m00.x - pcVar11[-1].m00.x + pcVar11->m0C.x + sp7C.x + sp64.x + sp60.x;
- f32 fVar2 = pcVar11->m00.y - pcVar11[-1].m00.y + tmp200 + pcVar11->m0C.y + sp60.y;
- f32 fVar3 = pcVar11->m00.z - pcVar11[-1].m00.z + pcVar11->m0C.z + sp7C.z + sp64.z + sp60.z;
+ Vec f29_f26_f25;
+ f29_f26_f25.x = r31->m00.x - r31[-1].m00.x + r31->m0C.x + sp7C.x + sp64.x + sp60.x;
+ f29_f26_f25.y = r31->m00.y - r31[-1].m00.y + tmp200 + r31->m0C.y + sp60.y;
+ f29_f26_f25.z = r31->m00.z - r31[-1].m00.z + r31->m0C.z + sp7C.z + sp64.z + sp60.z;
- unaff_r24 = -cM_atan2s(fVar2, fVar3);
- unaff_r23 = (s16)cM_atan2s(fVar1 + 0.0f, std::sqrtf(SQUARE(fVar2) + SQUARE(fVar3)));
+ unaff_r24 = -cM_atan2s(f29_f26_f25.y, f29_f26_f25.z);
+ unaff_r23 = (s16)cM_atan2s(f29_f26_f25.x + 0.0f, std::sqrtf(SQUARE(f29_f26_f25.y) + SQUARE(f29_f26_f25.z)));
cMtx_XrotS(*calc_mtx, unaff_r24);
cMtx_YrotM(*calc_mtx, unaff_r23);
spA0.z = HIMO3_SCALE;
if (bVar4 == 0) {
- spA0.z = HIMO3_SCALE - unaff_f28 * HIMO3_SCALE;
+ spA0.z -= f28 * HIMO3_SCALE;
bVar4++;
}
MtxPosition(&spA0, &sp94);
- pcVar11->m0C = pcVar11->m00;
- pcVar11->m00 = pcVar11[-1].m00 + sp94;
- pcVar11->m0C.x = (pcVar11->m00.x - pcVar11->m0C.x) * tmpReg;
- pcVar11->m0C.y = (pcVar11->m00.y - pcVar11->m0C.y) * tmpReg;
- pcVar11->m0C.z = (pcVar11->m00.z - pcVar11->m0C.z) * tmpReg;
+ r31->m0C = r31->m00;
+ r31->m00 = r31[-1].m00 + sp94;
+ r31->m0C.x = (r31->m00.x - r31->m0C.x) * tmpReg;
+ r31->m0C.y = (r31->m00.y - r31->m0C.y) * tmpReg;
+ r31->m0C.z = (r31->m00.z - r31->m0C.z) * tmpReg;
if ((i_this->m0298 == 0xf) && (i == i_this->m15C0 - 1)) {
if (i_this->m02BE == 0) {
- i_this->mCyl.SetC(pcVar11->m00);
+ i_this->mCyl.SetC(r31->m00);
} else {
cXyz sp4C(-10000.0f, -10000.0f, 0.0f);
i_this->mCyl.SetC(sp4C);
}
dComIfG_Ccsp()->Set(&i_this->mCyl);
} else if (((i + i_this->m02BA * 3 & 0xf) == 0) && (j < 5)) {
- i_this->mSphs[j].SetR(fVar12);
- i_this->mSphs[j].SetC(pcVar11->m00);
+ i_this->mSphs[j].SetR(f27);
+ i_this->mSphs[j].SetC(r31->m00);
dComIfG_Ccsp()->Set(&i_this->mSphs[j]);
j++;
}
@@ -242,7 +252,7 @@ void himo3_control(himo3_class* i_this, himo3_s* arg1) {
cXyz* pcVar10 = i_this->mLineMat.getPos(0);
himo3_s* phVar11 = i_this->m02C0;
- for (s32 i = 0; i < i_this->m15C0; i++, phVar11++, pcVar10++) {
+ for (int i = 0; i < i_this->m15C0; i++, phVar11++, pcVar10++) {
if (i_this->m15E0 >= 0.999f) {
*pcVar10 = phVar11->m00;
} else {
@@ -272,7 +282,7 @@ void himo3_control(himo3_class* i_this, himo3_s* arg1) {
void ga_draw(himo3_class* i_this) {
h3_ga_s* ga = &i_this->m2114[0];
- for (s32 i = 0; i < ARRAY_SSIZE(i_this->m2114); i++, ga++) {
+ for (int i = 0; i < ARRAY_SSIZE(i_this->m2114); i++, ga++) {
if (ga->m2E == 1) {
MtxTrans(ga->mPos.x, ga->mPos.y, ga->mPos.z, 0);
cMtx_YrotM(*calc_mtx, ga->m1E);
@@ -287,7 +297,8 @@ void ga_draw(himo3_class* i_this) {
/* 00000D1C-00000EF8 .text daHimo3_Draw__FP11himo3_class */
static BOOL daHimo3_Draw(himo3_class* i_this) {
- g_env_light.settingTevStruct(TEV_TYPE_BG0, &i_this->current.pos, &i_this->tevStr);
+ fopAc_ac_c* actor = &i_this->actor;
+ g_env_light.settingTevStruct(TEV_TYPE_BG0, &actor->current.pos, &actor->tevStr);
f32 fVar1;
if (i_this->m0298 == 0xf) {
fVar1 = DEMO_SELECT(REG0_F(0) + 4.625f, 4.625f);
@@ -296,16 +307,16 @@ static BOOL daHimo3_Draw(himo3_class* i_this) {
}
#ifdef __MWERKS__
- i_this->mLineMat.update(i_this->m15C0, fVar1, (GXColor){200, 150, 50, 255}, 0, &i_this->tevStr);
+ i_this->mLineMat.update(i_this->m15C0, fVar1, (GXColor){200, 150, 50, 255}, 0, &actor->tevStr);
#else
GXColor color = (GXColor){200, 150, 50, 255};
- i_this->mLineMat.update(i_this->m15C0, fVar1, color, 0, &i_this->tevStr);
+ i_this->mLineMat.update(i_this->m15C0, fVar1, color, 0, &actor->tevStr);
#endif
dComIfGd_set3DlineMat(&i_this->mLineMat);
if (i_this->m0298 != 0xf) {
J3DModel* model = i_this->mpModel;
- g_env_light.setLightTevColorType(model, &i_this->tevStr);
+ g_env_light.setLightTevColorType(model, &actor->tevStr);
mDoExt_modelUpdateDL(model);
if (i_this->m0298 == 0) {
@@ -367,6 +378,7 @@ void himo3_class::setActorHang(cXyz arg1, short arg2) {
/* 00001128-000014F8 .text path_move__FP11himo3_class */
void path_move(himo3_class* i_this) {
+ fopAc_ac_c* actor = &i_this->actor;
cXyz sp28;
cXyz sp10;
dPnt* pnt;
@@ -382,8 +394,8 @@ void path_move(himo3_class* i_this) {
i_this->m029C = i_this->ppd->m_num - 2;
}
- if ((s32)i_this->ppd->m_nextID != 0xFFFF) {
- i_this->ppd = dPath_GetRoomPath(i_this->ppd->m_nextID, fopAcM_GetRoomNo(i_this));
+ if ((int)i_this->ppd->m_nextID != 0xFFFF) {
+ i_this->ppd = dPath_GetRoomPath(i_this->ppd->m_nextID, fopAcM_GetRoomNo(actor));
JUT_ASSERT(DEMO_SELECT(890, 891), i_this->ppd != NULL);
}
} else if (i_this->m029C < 0) {
@@ -396,28 +408,28 @@ void path_move(himo3_class* i_this) {
i_this->m02A8 = pnt->m_position;
case 1:
- sp10 = i_this->m02A8 - i_this->current.pos;
+ sp10 = i_this->m02A8 - actor->current.pos;
if (i_this->m02BE == 0) {
u8 uStack_14 = i_this->ppd->m_points[i_this->m029C].mArg3;
if (uStack_14 != 0 && uStack_14 != 0xff) {
- cLib_addCalc2(&i_this->speedF, uStack_14, 1.0f, uStack_14 * 0.1f);
+ cLib_addCalc2(&actor->speedF, uStack_14, 1.0f, uStack_14 * 0.1f);
} else {
uStack_14 = i_this->m0299;
- cLib_addCalc2(&i_this->speedF, uStack_14, 1.0f, uStack_14 * 0.1f);
+ cLib_addCalc2(&actor->speedF, uStack_14, 1.0f, uStack_14 * 0.1f);
}
} else {
- cLib_addCalc0(&i_this->speedF, 1.0f, 1.0f);
+ cLib_addCalc0(&actor->speedF, 1.0f, 1.0f);
}
sp28.x = 0.0f;
sp28.y = 0.0f;
- sp28.z = i_this->speedF;
+ sp28.z = actor->speedF;
cMtx_YrotS(*calc_mtx, cM_atan2s(sp10.x, sp10.z));
f32 fVar8 = std::sqrtf(SQUARE(sp10.x) + SQUARE(sp10.z));
cMtx_XrotM(*calc_mtx, -cM_atan2s(sp10.y, fVar8));
- MtxPosition(&sp28, &i_this->speed);
- i_this->current.pos += i_this->speed;
- if (sp10.abs() < i_this->speedF * 2.0f) {
+ MtxPosition(&sp28, &actor->speed);
+ actor->current.pos += actor->speed;
+ if (sp10.abs() < actor->speedF * 2.0f) {
i_this->m02A4 = 0;
}
break;
@@ -426,6 +438,7 @@ void path_move(himo3_class* i_this) {
/* 000014F8-00001A3C .text daHimo3_Execute__FP11himo3_class */
static BOOL daHimo3_Execute(himo3_class* i_this) {
+ fopAc_ac_c* actor = &i_this->actor;
fopAc_ac_c* player = dComIfGp_getPlayer(0);
if (i_this->m02BC != 0) {
@@ -437,7 +450,7 @@ static BOOL daHimo3_Execute(himo3_class* i_this) {
}
i_this->m02BA++;
- i_this->m02C0[0].m00 = i_this->current.pos;
+ i_this->m02C0[0].m00 = actor->current.pos;
himo3_control(i_this, i_this->m02C0);
if (i_this->m0298 != 0xf) {
@@ -471,7 +484,7 @@ static BOOL daHimo3_Execute(himo3_class* i_this) {
dComIfG_Ccsp()->Set(&i_this->mSph);
if (i_this->m0298 == 0) {
- for (s32 i = 0; i < ARRAY_SSIZE(i_this->m02B4); i++) {
+ for (int i = 0; i < ARRAY_SSIZE(i_this->m02B4); i++) {
if (i_this->m02B4[i]) {
i_this->m02B4[i]--;
}
@@ -509,43 +522,46 @@ static BOOL daHimo3_Execute(himo3_class* i_this) {
JPABaseEmitter* pJVar6 = i_this->m20FC.getEmitter();
#endif
if (pJVar6 != NULL) {
- f32 fVar3 = DEMO_SELECT(REG0_F(3) + -0.03f, -0.03f);
- f32 fVar1 = (i_this->m1624.x - i_this->m1630.x) * fVar3;
- if (fVar1 > 1.0f) {
- fVar1 = 1.0f;
- } else if (fVar1 < -1.0f) {
- fVar1 = -1.0f;
+ Vec vec1;
+ f32 f3;
+ f3 = DEMO_SELECT(REG0_F(3) + -0.03f, -0.03f);
+ vec1.x = f3 * (i_this->m1624.x - i_this->m1630.x);
+ if (vec1.x > 1.0f) {
+ vec1.x = 1.0f;
+ } else if (vec1.x < -1.0f) {
+ vec1.x = -1.0f;
}
- f32 fVar4 = fVar3 * ((i_this->m1624).z - (i_this->m1630).z);
- if (fVar4 > 1.0f) {
- fVar4 = 1.0f;
- } else if (fVar4 < -1.0f) {
- fVar4 = -1.0f;
+ vec1.z = f3 * (i_this->m1624.z - i_this->m1630.z);
+ if (vec1.z > 1.0f) {
+ vec1.z = 1.0f;
+ } else if (vec1.z < -1.0f) {
+ vec1.z = -1.0f;
}
- JGeometry::TVec3<f32> s;
- s.x = fVar1;
- s.y = 0.1f;
- s.z = fVar4;
- pJVar6->setDirection(s);
-
- f32 tmp = 1.0f;
- f32 sqrt = std::sqrtf(SQUARE(fVar1) + SQUARE(fVar4));
- f32 sqrt2 = 1.0f + sqrt * DEMO_SELECT(REG0_F(12) + 2.0f, 2.0f);
- if (sqrt2 > DEMO_SELECT(REG0_F(13) + 4.0f, 4.0f)) {
- sqrt2 = DEMO_SELECT(REG0_F(13) + 4.0f, 4.0f);
+ JGeometry::TVec3<f32> dir;
+ dir.x = vec1.x;
+ dir.y = 0.1f;
+ dir.z = vec1.z;
+ pJVar6->setDirection(dir);
+
+ Vec vec2;
+ vec2.x = 1.0f;
+ vec2.y = 1.0f + std::sqrtf(SQUARE(vec1.x) + SQUARE(vec1.z)) * DEMO_SELECT(REG0_F(12) + 2.0f, 2.0f);
+ f32 f0 = DEMO_SELECT(REG0_F(13) + 4.0f, 4.0f);
+ if (vec2.y > f0) {
+ vec2.y = f0;
}
- JGeometry::TVec3<f32> s2;
- s2.x = tmp;
- s2.y = sqrt2;
- s2.z = tmp;
+ JGeometry::TVec3<f32> scale;
+ scale.x = vec2.x;
+ scale.y = vec2.y;
+ scale.z = vec2.x;
#if VERSION == VERSION_DEMO
pJVar6 = i_this->demo_m20FC;
#endif
- pJVar6->setGlobalParticleScale(s2);
+ pJVar6->setGlobalParticleScale(scale);
cLib_addCalc2(&i_this->m1620, cM_rndF(0.2f) + 1.0f, 0.5f, 0.02f);
} else {
i_this->m1620 = 0.0f;
@@ -562,7 +578,9 @@ static BOOL daHimo3_Execute(himo3_class* i_this) {
ga_move(i_this);
}
}
+
i_this->m1630 = i_this->m1624;
+
return TRUE;
}
@@ -596,7 +614,8 @@ static BOOL daHimo3_Delete(himo3_class* i_this) {
/* 00001AE0-00001DD4 .text useHeapInit__FP11himo3_class */
cPhs_State useHeapInit(himo3_class* i_this) {
- static s32 hook_bmd[] = {HIMO3_BMD_SLAMP_00, LINK_BDL_ROPEEND, HIMO3_BMD_SLAMP_00, HIMO3_BMD_SLAMP_00, HIMO3_BMD_SLAMP_00};
+ fopAc_ac_c* actor = &i_this->actor;
+ static int hook_bmd[] = {HIMO3_BMD_SLAMP_00, LINK_BDL_ROPEEND, HIMO3_BMD_SLAMP_00, HIMO3_BMD_SLAMP_00, HIMO3_BMD_SLAMP_00};
#if VERSION == VERSION_DEMO
if (!i_this->mLineMat.init(1, 200, (ResTIMG*)dComIfG_getObjectRes("Always", i_this->m0298 == 0xf ? ALWAYS_BTI_TXM_ROPE1 : ALWAYS_BTI_ROPE), 0)) {
@@ -633,7 +652,7 @@ cPhs_State useHeapInit(himo3_class* i_this) {
JUT_ASSERT(DEMO_SELECT(1264, 1298), modelData != NULL);
s32 tmp = 0;
- for (s32 i = 0; i < ARRAY_SSIZE(i_this->m2114); i++) {
+ for (int i = 0; i < ARRAY_SSIZE(i_this->m2114); i++) {
i_this->m2114[i].mpModel = mDoExt_J3DModel__create(modelData, 0, 0x11020203);
if (i_this->m2114[i].mpModel == NULL) {
return cPhs_INIT_e;
@@ -641,7 +660,7 @@ cPhs_State useHeapInit(himo3_class* i_this) {
if (tmp == 0 || cM_rndF(1.0f) < 0.5f) {
i_this->m2114[i].m2E = true;
- i_this->m2114[i].mPos = i_this->current.pos;
+ i_this->m2114[i].mPos = actor->current.pos;
i_this->m2114[i].m24 = cM_rndF(0.3f) + 0.3f;
i_this->m2114[i].m2C = cM_rndF(30000.0f);
}
@@ -753,7 +772,7 @@ static cPhs_State daHimo3_Create(fopAc_ac_c* a_this) {
i_this->m0298 = 0;
}
- if (fopAcM_createHeap(i_this, 0xa220, 0) == 0) {
+ if (fopAcM_createHeap(a_this, 0xa220, 0) == 0) {
return cPhs_ERROR_e;
}
@@ -792,20 +811,20 @@ static cPhs_State daHimo3_Create(fopAc_ac_c* a_this) {
}
i_this->m15E0 = 1.0f;
- i_this->mStts.Init(0xff, 0xff, i_this);
+ i_this->mStts.Init(0xff, 0xff, a_this);
if (i_this->m0298 == 0xf) {
i_this->mCyl.Set(cc_cyl_src);
i_this->mCyl.SetStts(&i_this->mStts);
} else {
- for (s32 i = 0; i < ARRAY_SSIZE(i_this->mSphs); i++) {
+ for (int i = 0; i < ARRAY_SSIZE(i_this->mSphs); i++) {
i_this->mSphs[i].Set(sph_src);
i_this->mSphs[i].SetStts(&i_this->mStts);
}
i_this->mSph.Set(sph2_src);
i_this->mSph.SetStts(&i_this->mStts);
- i_this->mAcch.Set(&i_this->m1624, &i_this->m1630, i_this, 1, &i_this->mAcchCir, fopAcM_GetSpeed_p(i_this));
+ i_this->mAcch.Set(&i_this->m1624, &i_this->m1630, a_this, 1, &i_this->mAcchCir, fopAcM_GetSpeed_p(a_this));
if (i_this->m0298 == 0) {
i_this->mAcchCir.SetWall(40.0f, 50.0f);
@@ -824,7 +843,7 @@ static cPhs_State daHimo3_Create(fopAc_ac_c* a_this) {
l_HIO.mNo = mDoHIO_createChild("ぶら下がりロープ", &l_HIO);
}
- for (s32 i = 0; i < 10; i++) {
+ for (int i = 0; i < 10; i++) {
daHimo3_Execute(i_this);
}
}
diff --git a/src/d/actor/d_a_hys.cpp b/src/d/actor/d_a_hys.cpp
index 302400ba..f3adc409 100644
--- a/src/d/actor/d_a_hys.cpp
+++ b/src/d/actor/d_a_hys.cpp
@@ -53,14 +53,14 @@ static dCcD_SrcSph l_sph_src = {
/* 00000078-000000B8 .text Delete__7daHys_cFv */
BOOL daHys_c::Delete() {
- dComIfG_resDelete(&mPhs, m_arcname[mType]);
+ dComIfG_resDeleteDemo(&mPhs, m_arcname[mType]);
return TRUE;
}
/* 000000B8-00000250 .text CreateHeap__7daHys_cFv */
BOOL daHys_c::CreateHeap() {
J3DModelData* modelData = (J3DModelData *)dComIfG_getObjectRes(m_arcname[mType], m_bdlidx[mType]);
- JUT_ASSERT(0x106, modelData != NULL);
+ JUT_ASSERT(DEMO_SELECT(258, 262), modelData != NULL);
mpModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x11020022);
if (mpModel == NULL) {
@@ -68,7 +68,7 @@ BOOL daHys_c::CreateHeap() {
}
J3DAnmTexPattern* pbtp = (J3DAnmTexPattern *)dComIfG_getObjectRes(m_arcname[mType], m_btpidx[mType]);
- JUT_ASSERT(0x114, pbtp != NULL);
+ JUT_ASSERT(DEMO_SELECT(272, 276), pbtp != NULL);
if (!mBtpAnm.init(modelData, pbtp, FALSE, J3DFrameCtrl::EMode_NONE)) {
return FALSE;
diff --git a/src/d/actor/d_a_kita.cpp b/src/d/actor/d_a_kita.cpp
index ceb6b09c..81da4ef6 100644
--- a/src/d/actor/d_a_kita.cpp
+++ b/src/d/actor/d_a_kita.cpp
@@ -25,7 +25,7 @@ void ride_call_back(dBgW* bgw, fopAc_ac_c* i_ac, fopAc_ac_c* i_pt) {
cXyz delta_pos, local_44, local_50;
if (!pActor->field_29A || (pActor->field_360 != 0)) {
- mDoMtx_YrotS(*calc_mtx, -pActor->current.angle.y);
+ cMtx_YrotS(*calc_mtx, -pActor->current.angle.y);
delta_pos = i_pt->current.pos - pActor->current.pos;
MtxPosition(&delta_pos,&local_44);
delta_pos = i_pt->old.pos - pActor->current.pos;
@@ -33,8 +33,8 @@ void ride_call_back(dBgW* bgw, fopAc_ac_c* i_ac, fopAc_ac_c* i_pt) {
if (fopAcM_GetName(i_pt) == PROC_PLAYER) {
pActor->mExecuteCount = 10;
}
- short zAngle_target = -local_44.x * ((REG0_F(0) + 10.0f) / pActor->scale.x);
- short xAngle_target = local_44.z * ((REG0_F(0) + 10.0f) / pActor->scale.z);
+ s16 xAngle_target = local_44.z * ((REG0_F(0) + 10.0f) / pActor->scale.z);
+ s16 zAngle_target = -local_44.x * ((REG0_F(0) + 10.0f) / pActor->scale.x);
cLib_addCalcAngleS2(&pActor->current.angle.x,xAngle_target,10,0x800);
cLib_addCalcAngleS2(&pActor->current.angle.z,zAngle_target,10,0x800);
@@ -44,7 +44,7 @@ void ride_call_back(dBgW* bgw, fopAc_ac_c* i_ac, fopAc_ac_c* i_pt) {
f32 min_val_z = (REG0_F(4) + 50.0f) * std::abs(local_44.x - local_50.x);
if(pActor->field_2BC.z < min_val_z) pActor->field_2BC.z = min_val_z;
- float fVar1 = (REG0_F(8) + 5.0f) * std::abs(local_44.x - local_50.x);
+ f32 fVar1 = (REG0_F(8) + 5.0f) * std::abs(local_44.x - local_50.x);
if (fVar1 > 10.0f && pActor->field_2B0.x < fVar1) {
cLib_addCalc2(&pActor->field_2B0.x,fVar1,1.0,REG0_F(7) + 1.2f);
}
@@ -70,9 +70,9 @@ static BOOL daKita_Draw(kita_class* i_this) {
void kita_move(kita_class* i_this) {
fopAc_ac_c* actor = static_cast<fopAc_ac_c*>(i_this);
static u8 himo_off_check[4] = {1,2,4, 8};
- static short himo_off_ya[16] = {1, 0xA000, 0x6000, 0x8000, 0xE000, 0xC000, 0xE000, 0xA000, 0x2000, 0x2000, 0x4000, 0x6000, 0, 0xE000, 0x2000, 1};
- static short himo_off_xa[16] = {0, 0xF000, 0xF000, 0xC800, 0xF000, 0xC800, 0, 0xC000, 0xF000, 0, 0xC800, 0xC000, 0xC800, 0xC000, 0xC000, 0};
- static short himo_off_yp[16] = {0, 0x96, 0x96, 0x190, 0x96, 0x190, 0x190,0x1F4, 0x96, 0x190, 0x190, 0x1F4, 0x190, 0x1F4, 0x1F4, 0};
+ static s16 himo_off_ya[16] = {1, 0xA000, 0x6000, 0x8000, 0xE000, 0xC000, 0xE000, 0xA000, 0x2000, 0x2000, 0x4000, 0x6000, 0, 0xE000, 0x2000, 1};
+ static s16 himo_off_xa[16] = {0, 0xF000, 0xF000, 0xC800, 0xF000, 0xC800, 0, 0xC000, 0xF000, 0, 0xC800, 0xC000, 0xC800, 0xC000, 0xC000, 0};
+ static s16 himo_off_yp[16] = {0, 0x96, 0x96, 0x190, 0x96, 0x190, 0x190,0x1F4, 0x96, 0x190, 0x190, 0x1F4, 0x190, 0x1F4, 0x1F4, 0};
daPy_py_c* player_actor = daPy_getPlayerActorClass();
i_this->mMoveCounter++;
@@ -96,7 +96,7 @@ void kita_move(kita_class* i_this) {
s16 xa_offset, ya_offset;
ya_offset = himo_off_ya[mask];
xa_offset = himo_off_xa[mask];
- cLib_addCalc2(&i_this->mHeight, REG0_F(4) + (-static_cast<float>(himo_off_yp[mask]) * 0.3f), 0.05, i_this->field_320 * 250.0f);
+ cLib_addCalc2(&i_this->mHeight, REG0_F(4) + (-(f32)(himo_off_yp[mask]) * 0.3f), 0.05, i_this->field_320 * 250.0f);
if(mask == 0b1111){
i_this->field_29A = 1;
@@ -122,7 +122,7 @@ void kita_move(kita_class* i_this) {
}
actor->health = 0;
}
- short maxSpeed = i_this->field_320 * 10000.0f;
+ s16 maxSpeed = i_this->field_320 * 10000.0f;
cLib_addCalcAngleS2(&i_this->mRotX, xa_offset, 16, maxSpeed);
if(xa_offset != 0) cLib_addCalcAngleS2(&i_this->mRotY, ya_offset, 4, maxSpeed * 2);
cLib_addCalc2(&i_this->field_320, 1.0, 1.0, REG0_F(14) + 0.001f);
@@ -151,14 +151,14 @@ void kita_move(kita_class* i_this) {
if(i_this->mExecuteCount != 0){
s16 angleY_kita_player = fopAcM_searchPlayerAngleY(actor) - player_actor->shape_angle.y;
i_this->field_36C = (REG0_F(2) + -6.0f) * JMASCos(angleY_kita_player);
- float fVar3 = fopAcM_searchPlayerDistance(actor) * 0.003f;
+ f32 fVar3 = fopAcM_searchPlayerDistance(actor) * 0.003f;
if(fVar3 > 1.0f) fVar3 = 1.0f;
i_this->field_370 = (REG0_F(3) + 200.0f) * JMASSin(angleY_kita_player) * fVar3;
i_this->mPlayerAngle = fopAcM_searchPlayerAngleY(actor);
i_this->field_374 = 20;
}
else {
- short angle = fopAcM_searchPlayerAngleY(actor) - player_actor->shape_angle.y;
+ s16 angle = fopAcM_searchPlayerAngleY(actor) - player_actor->shape_angle.y;
i_this->field_36C = (REG0_F(12) + 6.0f) * JMASCos(angle);
i_this->field_370 = cM_rndFX(100.0);
i_this->mPlayerAngle = fopAcM_searchPlayerAngleY(actor);
@@ -166,14 +166,14 @@ void kita_move(kita_class* i_this) {
}
fopAcM_seStartCurrent(actor, JA_SE_LK_FLIFT_GO_WATER, 0);
}
- mDoMtx_YrotS(*calc_mtx, i_this->mPlayerAngle);
+ cMtx_YrotS(*calc_mtx, i_this->mPlayerAngle);
cXyz pos_offset2, pos_offset;
pos_offset2.x = 0.0f;
pos_offset2.y = 0.0f;
pos_offset2.z = i_this->field_364 * 2.0f;
MtxPosition(&pos_offset2, &pos_offset);
i_this->current.pos += pos_offset;
- i_this->current.angle.y += static_cast<short>(i_this->mAngleYSpeed);
+ i_this->current.angle.y += (s16)(i_this->mAngleYSpeed);
if(i_this->field_374 != 0){
i_this->field_374--;
cLib_addCalc2(&i_this->field_364, i_this->field_36C, 1.0, REG0_F(5) + 0.3f);
@@ -192,8 +192,8 @@ void kita_move(kita_class* i_this) {
cLib_addCalcAngleS2(&actor->current.angle.z, 0, 10, 0x300);
cLib_addCalcAngleS2(&i_this->mRotX, 0, 4, 0x200);
- float fVar4;
- short local29A;
+ f32 fVar4;
+ s16 local29A;
if(i_this->field_360 == 2){
fVar4 = 1.0;
local29A = 800;
@@ -240,9 +240,14 @@ void kita_move(kita_class* i_this) {
}
}
+#if VERSION == VERSION_DEMO
+void himo_create(kita_class* i_this)
+#else
/* 00001894-000019F8 .text himo_create__FP10kita_class */
-cPhs_State himo_create(kita_class* i_this) {
- static short yad[4] = {0x2000, 0xE000, 0x6000, 0xA000};
+BOOL himo_create(kita_class* i_this)
+#endif
+{
+ static s16 yad[4] = {0x2000, 0xE000, 0x6000, 0xA000};
int shand_count = 0;
fopAcM_prm_class *param;
shand_class* shand_i;
@@ -274,44 +279,58 @@ cPhs_State himo_create(kita_class* i_this) {
}
}
- return (shand_count < 4);
+#if VERSION > VERSION_DEMO
+ if (shand_count < 4) {
+ return TRUE;
+ }
+ return FALSE;
+#endif
}
/* 000019F8-00001CB8 .text daKita_Execute__FP10kita_class */
static BOOL daKita_Execute(kita_class* i_this) {
- static float xd[4] = {130, -130, 130, -130};
- static float zd[4] = {130, 130, -130, -130};
+ fopAc_ac_c* actor = i_this;
+
+ static f32 xd[4] = {130.0f, -130.0f, 130.0f, -130.0f};
+ static f32 zd[4] = {130.0f, 130.0f, -130.0f, -130.0f};
if(i_this->mExecuteCount != 0) i_this->mExecuteCount--;
kita_move(i_this);
- MtxTrans(i_this->current.pos.x, i_this->current.pos.y, i_this->current.pos.z, false);
- mDoMtx_YrotM(*calc_mtx, i_this->shape_angle.y);
- mDoMtx_YrotM(*calc_mtx, i_this->mRotY);
+ MtxTrans(actor->current.pos.x, actor->current.pos.y, actor->current.pos.z, false);
+ cMtx_YrotM(*calc_mtx, actor->shape_angle.y);
+ cMtx_YrotM(*calc_mtx, i_this->mRotY);
MtxTrans(0.0f, 0.0f, (REG0_F(11) + -150.0f) * JMASSin(i_this->mRotX), true);
- mDoMtx_XrotM(*calc_mtx, i_this->mRotX);
- mDoMtx_YrotM(*calc_mtx, -i_this->mRotY);
- mDoMtx_XrotM(*calc_mtx, i_this->shape_angle.x);
- mDoMtx_ZrotM(*calc_mtx, i_this->shape_angle.z);
+ cMtx_XrotM(*calc_mtx, i_this->mRotX);
+ cMtx_YrotM(*calc_mtx, -i_this->mRotY);
+ cMtx_XrotM(*calc_mtx, actor->shape_angle.x);
+ cMtx_ZrotM(*calc_mtx, actor->shape_angle.z);
i_this->mModel->setBaseTRMtx(*calc_mtx);
cXyz local48[1];
for(int i = 0; i < 4; i++){
MtxPush();
- local48->x = i_this->scale.x * xd[i];
+ local48->x = actor->scale.x * xd[i];
local48->y = REG0_F(5) + -15.0f;
- local48->z = i_this->scale.z * zd[i];
+ local48->z = actor->scale.z * zd[i];
MtxPosition(local48, &i_this->field_2E8[i]);
MtxPull();
}
- mDoMtx_copy(*calc_mtx, i_this->mBgwMtx);
+ cMtx_copy(*calc_mtx, i_this->mBgwMtx);
i_this->pm_bgw->Move();
+
+#if VERSION == VERSION_DEMO
+ if (i_this->field_2A1 != 1) {
+ himo_create(i_this);
+ }
+#endif
+
if(i_this->field_360 == 2){
if(i_this->mBaseEmitter == NULL){
- i_this->mBaseEmitter = dComIfGp_particle_set(dPa_name::ID_AK_SN_FFHAMON00, &i_this->current.pos);
+ i_this->mBaseEmitter = dComIfGp_particle_set(dPa_name::ID_AK_SN_FFHAMON00, &actor->current.pos);
}
else {
- i_this->mBaseEmitter->setGlobalTranslation(i_this->current.pos.x, i_this->current.pos.y - (REG0_F(17) + 40.0f), i_this->current.pos.z);
+ i_this->mBaseEmitter->setGlobalTranslation(actor->current.pos.x, actor->current.pos.y - (REG0_F(17) + 40.0f), actor->current.pos.z);
}
}
else {
@@ -331,8 +350,11 @@ static BOOL daKita_IsDelete(kita_class*) {
/* 00001CC0-00001D3C .text daKita_Delete__FP10kita_class */
static BOOL daKita_Delete(kita_class* i_this) {
- dComIfG_resDelete(&i_this->mPhs, "Kita");
- if(i_this->heap != NULL){
+ dComIfG_resDeleteDemo(&i_this->mPhs, "Kita");
+#if VERSION > VERSION_DEMO
+ if(i_this->heap != NULL)
+#endif
+ {
dComIfG_Bgsp()->Release(i_this->pm_bgw);
}
if(i_this->mBaseEmitter != NULL){
@@ -354,9 +376,9 @@ static BOOL CallbackCreateHeap(fopAc_ac_c* i_this) {
ret = FALSE;
}
else {
- JUT_ASSERT(0x3b2, modelData != NULL);
+ JUT_ASSERT(DEMO_SELECT(928, 946), modelData != NULL);
actor->pm_bgw = new dBgW();
- JUT_ASSERT(0x3b7, actor->pm_bgw != NULL);
+ JUT_ASSERT(DEMO_SELECT(933, 951), actor->pm_bgw != NULL);
actor->pm_bgw->Set(static_cast<cBgD_t*>(dComIfG_getObjectRes("Kita", KITA_DZB_HLIF_00)), cBgW::MOVE_BG_e, &actor->mBgwMtx);
actor->pm_bgw->SetCrrFunc(dBgS_MoveBGProc_Typical);
actor->pm_bgw->SetRideCallback(ride_call_back);
@@ -368,7 +390,6 @@ static BOOL CallbackCreateHeap(fopAc_ac_c* i_this) {
/* 00001EB0-00002224 .text daKita_Create__FP10fopAc_ac_c */
static cPhs_State daKita_Create(fopAc_ac_c* a_this) {
- /* Nonmatching - regalloc */
static dCcD_SrcSph utiwa_sph_src = {
// dCcD_SrcGObjInf
{
@@ -403,61 +424,65 @@ static cPhs_State daKita_Create(fopAc_ac_c* a_this) {
cPhs_State ret;
ret = dComIfG_resLoad(&i_this->mPhs, "Kita");
- if(ret != cPhs_COMPLEATE_e)
+ if(ret != cPhs_COMPLEATE_e) {
+#if VERSION > VERSION_DEMO
return ret;
-
- i_this->field_2A0 = fopAcM_GetParam(a_this);
- i_this->field_2A1 = fopAcM_GetParam(a_this) >> 8;
-
- if(i_this->field_2A1 == 1){
- i_this->field_29A = 1;
- i_this->field_360 = 1;
- i_this->field_35C = a_this->current.pos.y + 70.0f + REG0_F(17);
- }
- else if(himo_create(i_this) != cPhs_INIT_e)
+#endif
+ } else {
+ i_this->field_2A0 = fopAcM_GetParam(a_this);
+ i_this->field_2A1 = fopAcM_GetParam(a_this) >> 8;
+
+ if(i_this->field_2A1 == 1){
+ i_this->field_29A = 1;
+ i_this->field_360 = 1;
+ i_this->field_35C = a_this->current.pos.y + 70.0f + REG0_F(17);
+ }
+#if VERSION > VERSION_DEMO
+ else if(himo_create(i_this))
return cPhs_INIT_e;
-
- if(i_this->field_2A0 == 0xff)
- i_this->field_2A0 = 0;
-
- if(fopAcM_entrySolidHeap(i_this, CallbackCreateHeap, 0x10000) == false)
- return cPhs_ERROR_e;
+#endif
+
+ if(i_this->field_2A0 == 0xff)
+ i_this->field_2A0 = 0;
- if(i_this->pm_bgw != NULL && dComIfG_Bgsp()->Regist(i_this->pm_bgw, i_this) != 0)
- return cPhs_ERROR_e;
+ if(fopAcM_entrySolidHeap(i_this, CallbackCreateHeap, 0x10000) == false)
+ return cPhs_ERROR_e;
+ if(i_this->pm_bgw != NULL && dComIfG_Bgsp()->Regist(i_this->pm_bgw, i_this) != 0)
+ return cPhs_ERROR_e;
- switch(i_this->field_2A0){
- case 1:
- i_this->scale.x = 1.25f;
- i_this->scale.z = 1.25f;
- break;
- case 2:
- i_this->scale.x = 1.5f;
- i_this->scale.z = 1.5f;
- break;
+ switch(i_this->field_2A0){
+ case 1:
+ i_this->scale.x = 1.25f;
+ i_this->scale.z = 1.25f;
+ break;
- default:
- i_this->scale.z = 1.0f;
- i_this->scale.x = 1.0f;
- break;
+ case 2:
+ i_this->scale.x = 1.5f;
+ i_this->scale.z = 1.5f;
+ break;
+
+ default:
+ i_this->scale.z = 1.0f;
+ i_this->scale.x = 1.0f;
+ break;
+ }
+ i_this->scale.y = 1.0f;
+ fopAcM_SetMtx(i_this, i_this->mModel->getBaseTRMtx());
+ fopAcM_SetMin( i_this, i_this->scale.x * -200.0f, -200.0f, i_this->scale.z * -200.0f);
+ fopAcM_SetMax(i_this, i_this->scale.x * 200.0f, 200.0f, i_this->scale.z * 200.0f);
+ i_this->mModel->setBaseScale(i_this->scale);
+ i_this->health = 1;
+ i_this->mAcch.Set(fopAcM_GetPosition_p(i_this), fopAcM_GetOldPosition_p(i_this), i_this, 1, &i_this->mAcchCir, fopAcM_GetSpeed_p(i_this));
+ i_this->mAcchCir.SetWall(50.0f, 300.0f);
+ i_this->mStts.Init(0xff, 0xff, i_this);
+ i_this->mSph.Set(utiwa_sph_src);
+ i_this->mSph.SetStts(&i_this->mStts);
+
+ for(int i = 0; i < 2; i++)
+ daKita_Execute(i_this);
}
- i_this->scale.y = 1.0f;
- fopAcM_SetMtx(i_this, i_this->mModel->getBaseTRMtx());
- fopAcM_SetMin( i_this, i_this->scale.x * -200.0f, -200.0f, i_this->scale.z * -200.0f);
- fopAcM_SetMax(i_this, i_this->scale.x * 200.0f, 200.0f, i_this->scale.z * 200.0f);
- i_this->mModel->setBaseScale(i_this->scale);
- i_this->health = 1;
- i_this->mAcch.Set(fopAcM_GetPosition_p(i_this), fopAcM_GetOldPosition_p(i_this), i_this, 1, &i_this->mAcchCir, fopAcM_GetSpeed_p(i_this));
- i_this->mAcchCir.SetWall(50.0f, 300.0f);
- i_this->mStts.Init(0xff, 0xff, i_this);
- i_this->mSph.Set(utiwa_sph_src);
- i_this->mSph.SetStts(&i_this->mStts);
-
- // Regalloc for i
- for(int i = 0; i < 2; i++)
- daKita_Execute(i_this);
return ret;
}
diff --git a/src/d/actor/d_a_ks.cpp b/src/d/actor/d_a_ks.cpp
index bd6a3664..9d3dc6c8 100644
--- a/src/d/actor/d_a_ks.cpp
+++ b/src/d/actor/d_a_ks.cpp
@@ -185,7 +185,8 @@ BOOL tyaku_check(ks_class* i_this) {
}
/* 00000788-0000087C .text ks_kuttuki_check__FP8ks_class */
-BOOL ks_kuttuki_check(ks_class* i_this) {
+BOOL ks_kuttuki_check(ks_class* i_this) {
+ daPy_lk_c* link = daPy_getPlayerLinkActorClass();
if (i_this->mSph.ChkAtHit() && !i_this->mSph.ChkAtShieldHit()) {
fopAc_ac_c* hit_actor = i_this->mSph.GetAtHitAc();
if (hit_actor && hit_actor == daPy_getPlayerLinkActorClass() && KUTTUKU_ALL_COUNT >= 0 && KUTTUKU_ALL_COUNT < 20 && GORON_COUNT == 0) {
@@ -387,8 +388,9 @@ void speed_keisan(ks_class* i_this, short i_speed) {
}
/* 00000EBC-00001314 .text action_dousa_move__FP8ks_class */
-void action_dousa_move(ks_class* i_this) {
+void action_dousa_move(ks_class* i_this) {
fopAc_ac_c* actor = &i_this->actor;
+ daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0);
daPy_lk_c* link = daPy_getPlayerLinkActorClass();
switch (i_this->mMode) {
@@ -403,10 +405,11 @@ void action_dousa_move(ks_class* i_this) {
i_this->mMode++;
// Fall-through
- case 1:
+ case 1: {
cLib_addCalcAngleS2(&actor->shape_angle.z, 0, 1, 0x1000);
- if (fopAcM_searchPlayerDistance(actor) > 10000.0f) {
+ f32 max_dist = 10000.0f;
+ if (fopAcM_searchPlayerDistance(actor) > max_dist) {
break;
}
@@ -429,14 +432,16 @@ void action_dousa_move(ks_class* i_this) {
i_this->mMode++;
// Fall-through
- case 2:
+ }
+ case 2: {
if (i_this->mAcch.ChkGroundHit()) {
actor->current.angle.y = i_this->m2FC + fopAcM_searchPlayerAngleY(actor);
}
+ f32 max_dist = 500.0f;
if (KUTTUKU_ALL_COUNT >= 0 && KUTTUKU_ALL_COUNT < 0x14 &&
(link->getSpeedF() > 12.0f || HEAVY_IN) &&
- fopAcM_searchPlayerDistance(actor) < 500.0f &&
+ fopAcM_searchPlayerDistance(actor) < max_dist &&
!dComIfGp_checkPlayerStatus0(0, daPyStts0_SWIM_e) &&
tyaku_check(i_this)) {
@@ -478,11 +483,14 @@ void action_dousa_move(ks_class* i_this) {
actor->speed.y += cM_rndF(5.0f);
}
break;
- case 3:
- if (fopAcM_searchPlayerDistance(actor) < 500.0f) {
+ }
+ case 3: {
+ f32 max_dist = 500.0f;
+ if (fopAcM_searchPlayerDistance(actor) < max_dist) {
actor->current.angle.y = fopAcM_searchPlayerAngleY(actor);
}
break;
+ }
}
if (i_this->mMode == 2 || i_this->mMode == 3) {
@@ -647,8 +655,6 @@ void action_kaze_move(ks_class* i_this) {
}
}
-static u8 item_tbl[4] = {0xA, 0xB, 0xC, 0xA};
-
#if VERSION > VERSION_DEMO
/* 00001874-00001A14 .text dead_eff_set__FP8ks_classP4cXyz */
void dead_eff_set(ks_class* i_this, cXyz* i_pos) {
@@ -669,6 +675,12 @@ void dead_eff_set(ks_class* i_this, cXyz* i_pos) {
drop_type = daDisItem_ARROW_e;
}
else {
+ static u8 item_tbl[] = {
+ daDisItem_HEART_e,
+ daDisItem_MAGIC_e,
+ daDisItem_ARROW_e,
+ daDisItem_HEART_e,
+ };
drop_type = item_tbl[(int)cM_rndF(2.99f)];
}
}
@@ -827,20 +839,42 @@ void action_omoi(ks_class* i_this) {
i_this->m2F0[i] = 0;
}
+ #if VERSION == VERSION_DEMO
if (KUTTUKU_ALL_COUNT >= 0x14) {
- i_this->m300 = 0x13;
+ i_this->m528 = NULL;
+ } else {
+ i_this->m528 = link->getModelJointMtx(pl_harituki_joint_dt[KUTTUKU_ALL_COUNT]);
}
- #if VERSION > VERSION_DEMO
+ i_this->m52C.remove();
+ if (i_this->m528 == NULL) {
+ fopAcM_OffStatus(actor, fopAcStts_UNK4000_e);
+ i_this->mMode = 42;
+ break;
+ } else {
+ i_this->m300 = KUTTUKU_ALL_COUNT;
+ if (i_this->m300 > KUTTUKU_ALL_COUNT - 1) {
+ i_this->m300 = KUTTUKU_ALL_COUNT - 1;
+ } else if (i_this->m300 < 0) {
+ i_this->m300 = 0;
+ }
+ actor->speedF = 0.0f;
+ actor->gravity = 0.0f;
+ actor->speed.setall(0.0f);
+ }
+ #else
+ if (KUTTUKU_ALL_COUNT >= 0x14) {
+ i_this->m300 = 0x13;
+ }
if (KUTTUKU_ALL_COUNT < 0) {
i_this->m300 = 0;
}
else {
i_this->m300 = KUTTUKU_ALL_COUNT;
}
- #endif
i_this->m528 = link->getModelJointMtx(pl_harituki_joint_dt[i_this->m300]);
+ #endif
if (KUTTUKU_ALL_COUNT == 0) {
GORON_COUNT = 0;
@@ -850,9 +884,20 @@ void action_omoi(ks_class* i_this) {
KUTTUKU_ALL_COUNT++;
- if (HEAVY_IN == FALSE && KUTTUKU_ALL_COUNT >= 5) {
- link->onHeavyState();
- HEAVY_IN = TRUE;
+ #if VERSION == VERSION_DEMO
+ if (KUTTUKU_ALL_COUNT >= 0x14) {
+ KUTTUKU_ALL_COUNT = 0x14;
+ }
+ #endif
+
+ if (HEAVY_IN == FALSE) {
+ int r0;
+ int r3 = KUTTUKU_ALL_COUNT;
+ r0 = 5;
+ if (r3 >= r0) {
+ link->onHeavyState();
+ HEAVY_IN = TRUE;
+ }
}
i_this->m2D2 = 0;
@@ -868,6 +913,16 @@ void action_omoi(ks_class* i_this) {
// Fall-through
}
case 0x29: {
+ #if VERSION == VERSION_DEMO
+ if (i_this->m528 == NULL) {
+ if (KUTTUKU_ALL_COUNT > 0) {
+ KUTTUKU_ALL_COUNT--;
+ }
+ i_this->mMode = 42;
+ break;
+ }
+ #endif
+
fopAcM_SetRoomNo(actor, fopAcM_GetRoomNo(mpCurPlayerActor));
if (!(fopAcM_GetID(actor) & 1)) {
@@ -877,7 +932,7 @@ void action_omoi(ks_class* i_this) {
actor->shape_angle.y -= i_this->m2FE * 0.25f;
}
- if (i_this->m528) {
+ if (VERSION == VERSION_DEMO || i_this->m528) {
local_10.x = i_this->m528[0][3];
local_10.y = i_this->m528[1][3];
local_10.z = i_this->m528[2][3];
@@ -887,7 +942,15 @@ void action_omoi(ks_class* i_this) {
}
if (!(local_10.x || local_10.y || local_10.z)) {
+ #if VERSION == VERSION_DEMO
+ if (KUTTUKU_ALL_COUNT > 0) {
+ KUTTUKU_ALL_COUNT--;
+ }
+ i_this->mMode = 42;
+ break;
+ #else
local_10 = mpCurPlayerActor->current.pos;
+ #endif
}
local_1c.x = std::fabsf(mpCurPlayerActor->speed.x * 10.0f);
@@ -946,6 +1009,16 @@ void action_omoi(ks_class* i_this) {
}
i_this->m528 = link->getModelJointMtx(pl_harituki_joint_dt[i_this->m300]);
+
+ #if VERSION == VERSION_DEMO
+ if (i_this->m528 == NULL) {
+ if (KUTTUKU_ALL_COUNT > 0) {
+ KUTTUKU_ALL_COUNT--;
+ }
+ i_this->mMode = 42;
+ break;
+ }
+ #endif
}
}
@@ -957,7 +1030,14 @@ void action_omoi(ks_class* i_this) {
cLib_addCalc2(&actor->current.pos.y, local_10.y, 1.0f, local_1c.y);
cLib_addCalc2(&actor->current.pos.z, local_10.z, 1.0f, local_1c.z);
- if (link->checkFrontRollCrash() || link->getCutType() == 8 || link->getCutType() == 9 || dComIfGp_checkPlayerStatus0(0, daPyStts0_SWIM_e)) {
+ if (
+ link->checkFrontRollCrash() ||
+ link->getCutType() == 8 ||
+ #if VERSION > VERSION_DEMO
+ link->getCutType() == 9 ||
+ #endif
+ dComIfGp_checkPlayerStatus0(0, daPyStts0_SWIM_e)
+ ) {
i_this->mSph.OnCoSetBit();
i_this->mSph.OnTgSetBit();
@@ -1050,9 +1130,12 @@ void action_omoi(ks_class* i_this) {
GORON_COUNT--;
KUTTUKU_ALL_COUNT--;
- if (HEAVY_IN && KUTTUKU_ALL_COUNT < 5) {
- HEAVY_IN = FALSE;
- link->offHeavyState();
+ if (HEAVY_IN) {
+ int r0 = 5;
+ if (KUTTUKU_ALL_COUNT < r0) {
+ HEAVY_IN = FALSE;
+ link->offHeavyState();
+ }
}
i_this->mMode = 42;
@@ -1064,7 +1147,7 @@ void action_omoi(ks_class* i_this) {
if (i_this->m528) {
fopAcM_OffStatus(actor, fopAcStts_UNK4000_e);
- fopAcM_setRoomLayer(actor, fopAcM_GetRoomNo(actor));
+ fopAcM_setRoomLayer(actor, actor->current.roomNo);
i_this->m528 = 0;
}
@@ -1103,7 +1186,8 @@ void action_omoi(ks_class* i_this) {
void* tsubo_search(void* param_1, void* i_data) {
ks_class* i_this = (ks_class*)i_data;
fopAc_ac_c* actor = &i_this->actor;
- if (fopAc_IsActor(param_1) && (fopAcM_GetName(param_1) == PROC_TSUBO)) {
+ int r0 = 0;
+ if (r0 < 100 && fopAc_IsActor(param_1) && (fopAcM_GetName(param_1) == PROC_TSUBO)) {
fopAc_ac_c* tsubo_actor = (fopAc_ac_c*)param_1;
if (std::fabsf(tsubo_actor->current.pos.x - actor->current.pos.x) < 20.0f &&
@@ -1253,8 +1337,11 @@ static BOOL daKS_Execute(ks_class* i_this) {
fopAc_ac_c* actor = &i_this->actor;
if (enemy_ice(&i_this->mEnemyIce)) {
- i_this->mpBodyMorf->getModel()->setBaseTRMtx(mDoMtx_stack_c::get());
- i_this->mpEyeMorf->getModel()->setBaseTRMtx(mDoMtx_stack_c::get());
+ J3DModel* model;
+ model = i_this->mpBodyMorf->getModel();
+ model->setBaseTRMtx(mDoMtx_stack_c::get());
+ model = i_this->mpEyeMorf->getModel();
+ model->setBaseTRMtx(mDoMtx_stack_c::get());
if (i_this->m2D0 && (i_this->m320++, i_this->m320 > 7.0f)) {
i_this->m320 = 7.0f;
}
@@ -1463,62 +1550,6 @@ static BOOL useHeapInit(fopAc_ac_c* i_act) {
return TRUE;
}
-static dCcD_SrcSph body_co_sph_src = {
- // dCcD_SrcGObjInf
- {
- /* Flags */ 0,
- /* SrcObjAt Type */ AT_TYPE_STALFOS_MACE,
- /* SrcObjAt Atp */ 0,
- /* SrcObjAt SPrm */ cCcD_AtSPrm_Set_e | cCcD_AtSPrm_VsPlayer_e | cCcD_AtSPrm_NoTgHitInfSet_e,
- /* SrcObjTg Type */ ~(AT_TYPE_WATER | AT_TYPE_UNK20000 | AT_TYPE_UNK400000 | AT_TYPE_LIGHT),
- /* SrcObjTg SPrm */ cCcD_TgSPrm_Set_e | cCcD_TgSPrm_IsEnemy_e,
- /* SrcObjCo SPrm */ cCcD_CoSPrm_Set_e | cCcD_CoSPrm_IsPlayer_e | cCcD_CoSPrm_VsPlayer_e | cCcD_CoSPrm_VsOther_e,
- /* SrcGObjAt Se */ dCcG_SE_UNK6,
- /* SrcGObjAt HitMark */ 0,
- /* SrcGObjAt Spl */ 0,
- /* SrcGObjAt Mtrl */ 0,
- /* SrcGObjAt SPrm */ 0,
- /* SrcGObjTg Se */ 0,
- /* SrcGObjTg HitMark */ 0,
- /* SrcGObjTg Spl */ 0,
- /* SrcGObjTg Mtrl */ 0,
- /* SrcGObjTg SPrm */ dCcG_TgSPrm_NoConHit_e | dCcG_TgSPrm_NoHitMark_e,
- /* SrcGObjCo SPrm */ 0,
- },
- // cM3dGSphS
- {{
- /* Center */ {0.0f, 0.0f, 0.0f},
- /* Radius */ 15.0f,
- }},
-};
-
-static s8 fire_j[10] = {
- 0,
- -1,
- -1,
- -1,
- -1,
- -1,
- -1,
- -1,
- -1,
- -1,
-
-};
-
-static f32 fire_sc[10] = {
- 1.0f,
- 1.0f,
- 1.0f,
- 1.0f,
- 1.0f,
- 1.0f,
- 1.0f,
- 1.0f,
- 1.0f,
- 1.0f,
-};
-
/* 000034F8-00003A94 .text daKS_Create__FP10fopAc_ac_c */
static cPhs_State daKS_Create(fopAc_ac_c* i_this) {
#if VERSION > VERSION_DEMO
@@ -1612,6 +1643,35 @@ static cPhs_State daKS_Create(fopAc_ac_c* i_this) {
a_this->m2FE = (fopAcM_GetID(i_this) & 7) * 0x32 + 1000;
+ static dCcD_SrcSph body_co_sph_src = {
+ // dCcD_SrcGObjInf
+ {
+ /* Flags */ 0,
+ /* SrcObjAt Type */ AT_TYPE_STALFOS_MACE,
+ /* SrcObjAt Atp */ 0,
+ /* SrcObjAt SPrm */ cCcD_AtSPrm_Set_e | cCcD_AtSPrm_VsPlayer_e | cCcD_AtSPrm_NoTgHitInfSet_e,
+ /* SrcObjTg Type */ ~(AT_TYPE_WATER | AT_TYPE_UNK20000 | AT_TYPE_UNK400000 | AT_TYPE_LIGHT),
+ /* SrcObjTg SPrm */ cCcD_TgSPrm_Set_e | cCcD_TgSPrm_IsEnemy_e,
+ /* SrcObjCo SPrm */ cCcD_CoSPrm_Set_e | cCcD_CoSPrm_IsPlayer_e | cCcD_CoSPrm_VsPlayer_e | cCcD_CoSPrm_VsOther_e,
+ /* SrcGObjAt Se */ dCcG_SE_UNK6,
+ /* SrcGObjAt HitMark */ 0,
+ /* SrcGObjAt Spl */ 0,
+ /* SrcGObjAt Mtrl */ 0,
+ /* SrcGObjAt SPrm */ 0,
+ /* SrcGObjTg Se */ 0,
+ /* SrcGObjTg HitMark */ 0,
+ /* SrcGObjTg Spl */ 0,
+ /* SrcGObjTg Mtrl */ 0,
+ /* SrcGObjTg SPrm */ dCcG_TgSPrm_NoConHit_e | dCcG_TgSPrm_NoHitMark_e,
+ /* SrcGObjCo SPrm */ 0,
+ },
+ // cM3dGSphS
+ {{
+ /* Center */ {0.0f, 0.0f, 0.0f},
+ /* Radius */ 15.0f,
+ }},
+ };
+
a_this->mSph.Set(body_co_sph_src);
a_this->mSph.SetStts(&a_this->mStts);
@@ -1623,6 +1683,32 @@ static cPhs_State daKS_Create(fopAc_ac_c* i_this) {
a_this->mEnemyFire.mpMcaMorf = a_this->mpBodyMorf;
a_this->mEnemyFire.mpActor = i_this;
+ static s8 fire_j[10] = {
+ 0,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+
+ };
+ static f32 fire_sc[10] = {
+ 1.0f,
+ 1.0f,
+ 1.0f,
+ 1.0f,
+ 1.0f,
+ 1.0f,
+ 1.0f,
+ 1.0f,
+ 1.0f,
+ 1.0f,
+ };
+
for (int i = 0; i < 10; i++) {
a_this->mEnemyFire.mFlameJntIdxs[i] = fire_j[i];
a_this->mEnemyFire.mParticleScale[i] = fire_sc[i];
diff --git a/src/d/actor/d_a_leaflift.cpp b/src/d/actor/d_a_leaflift.cpp
index 0a1139cf..b9f76db5 100644
--- a/src/d/actor/d_a_leaflift.cpp
+++ b/src/d/actor/d_a_leaflift.cpp
@@ -62,9 +62,13 @@ bool daLlift_c::_delete() {
mEmitter3->becomeInvalidEmitter();
mEmitter3 = NULL;
}
+#if VERSION > VERSION_DEMO
if (heap)
+#endif
+ {
dComIfG_Bgsp()->Release(mpBgW);
- dComIfG_resDelete(&mPhs, m_arcname);
+ }
+ dComIfG_resDeleteDemo(&mPhs, m_arcname);
return TRUE;
}
@@ -78,7 +82,7 @@ static void rideCallBack(dBgW* param1, fopAc_ac_c* i_this, fopAc_ac_c* i_other);
/* 000001E0-00000338 .text CreateHeap__9daLlift_cFv */
BOOL daLlift_c::CreateHeap() {
J3DModelData* modelData = (J3DModelData *)dComIfG_getObjectRes(m_arcname, OLIFT_BDL_OLIFT);
- JUT_ASSERT(0x14e, modelData != NULL);
+ JUT_ASSERT(DEMO_SELECT(327, 334), modelData != NULL);
mpModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000022);
if (!mpModel) {
@@ -204,13 +208,14 @@ static void rideCallBack(dBgW* param1, fopAc_ac_c* i_act, fopAc_ac_c* i_other) {
mDoMtx_stack_c::YrotS(-i_this->current.angle.y);
mDoMtx_stack_c::multVec(&posOffset, &posOffset);
s16 angle = (i_this->mActorLifetimeFrameCount % 32U) * (0x10000 / 32);
- tiltFactor = cM_ssin(angle) * 2.0f * 0.25f * (cM_rndFX(0.2f) + 1.0f);
+ tiltFactor = cM_ssin(angle) * tiltFactor * 0.25f * (cM_rndFX(0.2f) + 1.0f);
}
offsetMagnitude = posOffset.abs();
if (!posOffset.normalizeRS() ) {
return;
}
- cLib_addCalcAngleS2(&i_this->mTiltAngle, -offsetMagnitude * tiltFactor, 8, 0x200);
+ s16 temp = -offsetMagnitude * tiltFactor;
+ cLib_addCalcAngleS2(&i_this->mTiltAngle, temp, 8, 0x200);
tiltFactor = cM_ssin(i_this->mTiltAngle);
i_this->mTargetRotation.x = posOffset.x * tiltFactor;
i_this->mTargetRotation.y = posOffset.y * tiltFactor;
@@ -240,7 +245,8 @@ void daLlift_c::setMoveBGMtx() {
bool daLlift_c::_execute() {
Quaternion interpolatedRotation;
cXyz adjustedPosition;
- float distXZ = fopAcM_searchActorDistanceXZ(this, dComIfGp_getPlayer(0));
+ f32 distXZ = fopAcM_searchActorDistanceXZ(this, dComIfGp_getPlayer(0));
+ f32 f2 = 270.0f;
mActorLifetimeFrameCount++;
if (m43F > 0) {
m43F--;
@@ -250,7 +256,7 @@ bool daLlift_c::_execute() {
}
if ((!m43C) && (m43E)) {
mTargetRotation = ZeroQuat;
- if (distXZ > 270.0f) {
+ if (distXZ > f2) {
mbIsDescending = TRUE;
}
}
diff --git a/src/d/actor/d_a_mbdoor.cpp b/src/d/actor/d_a_mbdoor.cpp
index f4c0ee06..66a7dbdd 100644
--- a/src/d/actor/d_a_mbdoor.cpp
+++ b/src/d/actor/d_a_mbdoor.cpp
@@ -219,8 +219,8 @@ void daMbdoor_c::calcMtx() {
/* 00000898-00000A44 .text CreateInit__10daMbdoor_cFv */
BOOL daMbdoor_c::CreateInit() {
- s32 swbit = getSwbit();
- s32 type = getType();
+ int swbit = getSwbit();
+ int type = getType();
if (dComIfG_Bgsp()->Regist(mpBgW, this)) {
JUT_ASSERT(334, FALSE);
@@ -257,12 +257,18 @@ BOOL daMbdoor_c::CreateInit() {
/* 00000A44-00000AF4 .text create__10daMbdoor_cFv */
cPhs_State daMbdoor_c::create() {
cPhs_State phase_state = dComIfG_resLoad(&mPhs, getArcName());
-
+#if VERSION > VERSION_DEMO
fopAcM_SetupActor(this, daMbdoor_c);
+#endif
if (phase_state != cPhs_COMPLEATE_e) {
return phase_state;
}
+
+#if VERSION == VERSION_DEMO
+ fopAcM_SetupActor(this, daMbdoor_c);
+#endif
+
if (!fopAcM_entrySolidHeap(this, CheckCreateHeap, 0x8200)) {
return cPhs_ERROR_e;
}
@@ -273,7 +279,7 @@ cPhs_State daMbdoor_c::create() {
}
/* 00000AF4-00000B3C .text getDemoAction__10daMbdoor_cFv */
-s32 daMbdoor_c::getDemoAction() {
+int daMbdoor_c::getDemoAction() {
static char* action_table[] = {
"WAIT",
"SET_START",
@@ -293,7 +299,7 @@ s32 daMbdoor_c::getDemoAction() {
void daMbdoor_c::demoProc() {
// Explicit cast from daPy_py_c to daPy_py_c necessary for matching regalloc.
daPy_py_c* player = (daPy_py_c*)daPy_getPlayerActorClass();
- s32 actIdx = getDemoAction();
+ int actIdx = getDemoAction();
cXyz goal;
s16 angle;
@@ -343,7 +349,7 @@ void daMbdoor_c::demoProc() {
if (field_0x2b4 < 250) {
field_0x2b4 += 50;
}
- s32 temp = field_0x2b2 - field_0x2b4;
+ int temp = field_0x2b2 - field_0x2b4;
if (temp < -0x1C71) {
field_0x2b2 = -0x1C71;
dComIfGp_evmng_cutEnd(mEvtStaffId);
@@ -364,7 +370,7 @@ void daMbdoor_c::demoProc() {
if (field_0x2b4 < 400) {
field_0x2b4 += 40;
}
- s32 temp = field_0x2b0 - field_0x2b4;
+ int temp = field_0x2b0 - field_0x2b4;
if (temp < -0x3F65) {
field_0x2b0 = -0x3F65;
dComIfGp_evmng_cutEnd(mEvtStaffId);
@@ -378,9 +384,10 @@ void daMbdoor_c::demoProc() {
dComIfGp_evmng_cutEnd(mEvtStaffId);
}
break;
- case ACT_ADJUSTMENT:
+ case ACT_ADJUSTMENT: {
angle = player->shape_angle.y;
- cLib_addCalcAngleS2(&angle, current.angle.y + 0x7FFF, 10, 0x800);
+ s16 r4 = current.angle.y + 0x7FFF;
+ cLib_addCalcAngleS2(&angle, r4, 10, 0x800);
goal = player->current.pos;
goal.x = goal.x*0.9f + field_0x2c4.x*0.1f;
goal.z = goal.z*0.9f + field_0x2c4.z*0.1f;
@@ -391,6 +398,7 @@ void daMbdoor_c::demoProc() {
dComIfGp_evmng_cutEnd(mEvtStaffId);
}
break;
+ }
default:
dComIfGp_evmng_cutEnd(mEvtStaffId);
break;
@@ -426,7 +434,7 @@ BOOL daMbdoor_c::checkArea() {
/* 000010CC-00001198 .text checkUnlock__10daMbdoor_cFv */
BOOL daMbdoor_c::checkUnlock() {
- s32 swbit = getSwbit();
+ int swbit = getSwbit();
switch (getType()) {
case 0:
return dComIfGs_isSwitch(swbit, fopAcM_GetRoomNo(this));
@@ -446,13 +454,13 @@ BOOL daMbdoor_c::checkUnlock() {
}
/* 00001198-000011BC .text daMbdoor_actionWait__FP10daMbdoor_c */
-BOOL daMbdoor_actionWait(daMbdoor_c* i_this) {
+static BOOL daMbdoor_actionWait(daMbdoor_c* i_this) {
i_this->calcMtx();
return TRUE;
}
/* 000011BC-0000121C .text daMbdoor_actionLockWait__FP10daMbdoor_c */
-BOOL daMbdoor_actionLockWait(daMbdoor_c* i_this) {
+static BOOL daMbdoor_actionLockWait(daMbdoor_c* i_this) {
if (i_this->checkUnlock()) {
i_this->setAction(2);
fopAcM_orderOtherEvent(i_this, "MBDOOR_STOP_OPEN");
@@ -461,7 +469,7 @@ BOOL daMbdoor_actionLockWait(daMbdoor_c* i_this) {
}
/* 0000121C-000012AC .text daMbdoor_actionLockOff__FP10daMbdoor_c */
-BOOL daMbdoor_actionLockOff(daMbdoor_c* i_this) {
+static BOOL daMbdoor_actionLockOff(daMbdoor_c* i_this) {
if (i_this->eventInfo.checkCommandDemoAccrpt()) {
i_this->mEvtStaffId = dComIfGp_evmng_getMyStaffId("MBDOOR");
i_this->demoProc();
@@ -473,7 +481,7 @@ BOOL daMbdoor_actionLockOff(daMbdoor_c* i_this) {
}
/* 000012AC-00001324 .text daMbdoor_actionLockDemo__FP10daMbdoor_c */
-BOOL daMbdoor_actionLockDemo(daMbdoor_c* i_this) {
+static BOOL daMbdoor_actionLockDemo(daMbdoor_c* i_this) {
if (dComIfGp_evmng_endCheck("MBDOOR_STOP_OPEN")) {
dComIfGp_event_reset();
i_this->setAction(4);
@@ -484,7 +492,7 @@ BOOL daMbdoor_actionLockDemo(daMbdoor_c* i_this) {
}
/* 00001324-000013E4 .text daMbdoor_actionCloseWait__FP10daMbdoor_c */
-BOOL daMbdoor_actionCloseWait(daMbdoor_c* i_this) {
+static BOOL daMbdoor_actionCloseWait(daMbdoor_c* i_this) {
if (i_this->eventInfo.checkCommandDoor()) {
i_this->mEvtStaffId = dComIfGp_evmng_getMyStaffId("MBDOOR");
i_this->demoProc();
@@ -501,7 +509,7 @@ BOOL daMbdoor_actionCloseWait(daMbdoor_c* i_this) {
}
/* 000013E4-00001408 .text daMbdoor_actionOpen__FP10daMbdoor_c */
-BOOL daMbdoor_actionOpen(daMbdoor_c* i_this) {
+static BOOL daMbdoor_actionOpen(daMbdoor_c* i_this) {
i_this->demoProc();
return TRUE;
}
@@ -565,7 +573,12 @@ static BOOL daMbdoor_IsDelete(daMbdoor_c* i_this) {
/* 00001560-000015D4 .text daMbdoor_Delete__FP10daMbdoor_c */
static BOOL daMbdoor_Delete(daMbdoor_c* i_this) {
- if (i_this->heap) {
+#if VERSION == VERSION_DEMO
+ if (i_this->field_0x2ac)
+#else
+ if (i_this->heap)
+#endif
+ {
dComIfG_Bgsp()->Release(i_this->mpBgW);
}
dComIfG_resDelete(&i_this->mPhs, i_this->getArcName());
diff --git a/src/d/actor/d_a_obj_gong.cpp b/src/d/actor/d_a_obj_gong.cpp
index a0d842ef..899bca6e 100644
--- a/src/d/actor/d_a_obj_gong.cpp
+++ b/src/d/actor/d_a_obj_gong.cpp
@@ -92,7 +92,7 @@ cPhs_State daObjGong::Act_c::_create() {
/* 00000374-000003A4 .text _delete__Q29daObjGong5Act_cFv */
bool daObjGong::Act_c::_delete() {
- dComIfG_resDelete(&mPhs, M_arcname);
+ dComIfG_resDeleteDemo(&mPhs, M_arcname);
return true;
}
diff --git a/src/d/actor/d_a_obj_hat.cpp b/src/d/actor/d_a_obj_hat.cpp
index 1eae5829..b1649ee2 100644
--- a/src/d/actor/d_a_obj_hat.cpp
+++ b/src/d/actor/d_a_obj_hat.cpp
@@ -128,7 +128,7 @@ cPhs_State daObjHat_c::createInit() {
/* 000006AC-000006DC .text _delete__10daObjHat_cFv */
BOOL daObjHat_c::_delete() {
- dComIfG_resDelete(&mPhs, "Ro");
+ dComIfG_resDeleteDemo(&mPhs, "Ro");
return TRUE;
}
diff --git a/src/d/actor/d_a_obj_iceisland.cpp b/src/d/actor/d_a_obj_iceisland.cpp
index ef496b78..82aac051 100644
--- a/src/d/actor/d_a_obj_iceisland.cpp
+++ b/src/d/actor/d_a_obj_iceisland.cpp
@@ -53,7 +53,7 @@ void daObjIceisland_c::CreateInit() {
fopAcM_SetMtx(this, mpModel->getBaseTRMtx());
fopAcM_setCullSizeFar(this, 1.0f);
set_mtx();
- dKy_tevstr_init(&mTevStr, fopAcM_GetHomeRoomNo(this), 0xFF);
+ dKy_tevstr_init(&mTevStr, home.roomNo, 0xFF);
g_env_light.settingTevStruct(TEV_TYPE_BG0, &current.pos, &mTevStr);
mEmitter1 = NULL;
mEmitter2 = NULL;
@@ -171,7 +171,7 @@ cPhs_State daObjIceisland_c::_create(){
fopAcM_SetupActor(this, daObjIceisland_c);
cPhs_State phase_state = dComIfG_resLoad(&mPhs, "GiceL");
if (phase_state == cPhs_COMPLEATE_e) {
- if (!fopAcM_entrySolidHeap(this, CheckCreateHeap, 0x13D0)) {
+ if (!fopAcM_entrySolidHeap(this, CheckCreateHeap, DEMO_SELECT(0x300, 0x13D0))) {
return cPhs_ERROR_e;
} else {
CreateInit();
@@ -181,7 +181,7 @@ cPhs_State daObjIceisland_c::_create(){
}
bool daObjIceisland_c::_delete(){
- dComIfG_resDelete(&mPhs, "GiceL");
+ dComIfG_resDeleteDemo(&mPhs, "GiceL");
return true;
}
diff --git a/src/d/actor/d_a_obj_pfall.cpp b/src/d/actor/d_a_obj_pfall.cpp
index 113ef34e..74d123e1 100644
--- a/src/d/actor/d_a_obj_pfall.cpp
+++ b/src/d/actor/d_a_obj_pfall.cpp
@@ -183,10 +183,17 @@ void daObj_Pfall_c::CreateInit() {
/* 000008CC-000009E8 .text _create__13daObj_Pfall_cFv */
cPhs_State daObj_Pfall_c::_create() {
+#if VERSION > VERSION_DEMO
fopAcM_SetupActor(this, daObj_Pfall_c);
+#endif
+
cPhs_State phase = dComIfG_resLoad(&mPhsPfall, "Pfall");
if (phase == cPhs_COMPLEATE_e) {
+#if VERSION == VERSION_DEMO
+ fopAcM_SetupActor(this, daObj_Pfall_c);
+#endif
+
if (!fopAcM_entrySolidHeap(this, CallbackCreateHeap, 0x38E0)) {
return cPhs_ERROR_e;
} else {
@@ -198,7 +205,7 @@ cPhs_State daObj_Pfall_c::_create() {
/* 000009EC-00000AB0 .text _delete__13daObj_Pfall_cFv */
bool daObj_Pfall_c::_delete() {
- dComIfG_resDelete(&mPhsPfall, "Pfall");
+ dComIfG_resDeleteDemo(&mPhsPfall, "Pfall");
if(mpBgW && mpBgW->ChkUsed()) {
dComIfG_Bgsp()->Release(mpBgW);
}
@@ -322,10 +329,13 @@ void daObj_Pfall_c::mode_wait_init() {
/* 00000F1C-00000FC0 .text mode_wait__13daObj_Pfall_cFv */
void daObj_Pfall_c::mode_wait() {
- if(dLib_checkPlayerInCircle(current.pos, 100.0f, 100.0f)
- && dComIfGp_getPlayer(0)->speedF == 0.0f
- && cLib_calcTimer(&field_0x3B8) == 0) {
- mode_event_init();
+ if(dLib_checkPlayerInCircle(current.pos, 100.0f, 100.0f)) {
+ daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0);
+ if (player->getSpeedF() == 0.0f) {
+ if (cLib_calcTimer(&field_0x3B8) == 0) {
+ mode_event_init();
+ }
+ }
}
mpBgW->Move();
mpBgW2->Move();
@@ -377,17 +387,15 @@ bool daObj_Pfall_c::_execute() {
if(mpMorf->getFrame() == 6.0f) {
fopAcM_seStart(this, JA_SE_OBJ_TC_JAIL_STRING, 0);
}
- f32 frame = mpMorf->getFrame();
- if (!(frame > 0.0f && frame <= 6.0f)) {
- if (frame > 6.0f && frame <= 10.0f) {
- field_0x438 += 1.0f;
- }
- else {
- if (!(frame > 10.0f && frame <= 23.0f) && frame > 23.0f && frame <= 29.0f) {
- field_0x438 -= 3.0f;
- }
- }
- }
+ if (mpMorf->getFrame() > 0.0f && mpMorf->getFrame() <= 6.0f) {
+ // Do nothing
+ } else if (mpMorf->getFrame() > 6.0f && mpMorf->getFrame() <= 10.0f) {
+ field_0x438 += 1.0f;
+ } else if (mpMorf->getFrame() > 10.0f && mpMorf->getFrame() <= 23.0f) {
+ // Do nothing
+ } else if (mpMorf->getFrame() > 23.0f && mpMorf->getFrame() <= 29.0f) {
+ field_0x438 -= 3.0f;
+ }
} else {
field_0x438 = 0.0f;
}
diff --git a/src/d/actor/d_a_shutter.cpp b/src/d/actor/d_a_shutter.cpp
index cd9f6f19..606b156f 100644
--- a/src/d/actor/d_a_shutter.cpp
+++ b/src/d/actor/d_a_shutter.cpp
@@ -29,8 +29,11 @@ char* daShutter_c::m_staff_name[2] = {"Htobi1", "Htobi2"};
/* 00000078-00000108 .text _delete__11daShutter_cFv */
bool daShutter_c::_delete() {
- dComIfG_resDelete(&mPhs, m_arcname[mType]);
- if (heap != NULL) {
+ dComIfG_resDeleteDemo(&mPhs, m_arcname[mType]);
+#if VERSION > VERSION_DEMO
+ if (heap != NULL)
+#endif
+ {
for (int i = 0; i < (int)ARRAY_SIZE(mMtx); i++) {
dComIfG_Bgsp()->Release(mdBgW[i]);
};
diff --git a/src/d/actor/d_a_swtact.cpp b/src/d/actor/d_a_swtact.cpp
index 48ba8cdb..dd05caa9 100644
--- a/src/d/actor/d_a_swtact.cpp
+++ b/src/d/actor/d_a_swtact.cpp
@@ -121,7 +121,8 @@ bool daSwTact_c::_execute() {
if (player == NULL || dComIfGp_checkPlayerStatus0(0, daPyStts0_SHIP_RIDE_e))
return true;
- if ((player->current.pos - current.pos).absXZ() <= getR()) {
+ f32 dist = (player->current.pos - current.pos).absXZ();
+ if (dist <= getR()) {
if (mPlayerStatus != stts1 && stts1 != 0) {
player->setTactZev(fopAcM_GetID(this), getAnswer(), NULL);
}
@@ -160,7 +161,7 @@ bool daSwTact_c::_execute() {
}
if (mTrigger != 0 && !dComIfGp_event_runCheck()) {
- dComIfGs_onSwitch(mSwitchNo, fopAcM_GetHomeRoomNo(this));
+ fopAcM_onSwitch(this, mSwitchNo);
mTrigger = 0;
}
diff --git a/src/d/actor/d_a_tag_ghostship.cpp b/src/d/actor/d_a_tag_ghostship.cpp
index ef1d7d50..738d5ee4 100644
--- a/src/d/actor/d_a_tag_ghostship.cpp
+++ b/src/d/actor/d_a_tag_ghostship.cpp
@@ -31,8 +31,13 @@ void daTag_Gship_c::modeClearWait() {
/* 000001C0-00000214 .text modeClearEventInit__13daTag_Gship_cFv */
void daTag_Gship_c::modeClearEventInit() {
- dComIfGs_getEventReg(dSv_event_flag_c::UNK_8803);
- dComIfGs_setEventReg(dSv_event_flag_c::UNK_8803, 3);
+ u8 reg = dComIfGs_getEventReg(dSv_event_flag_c::UNK_8803);
+#if VERSION == VERSION_DEMO
+ reg += 1;
+#else
+ reg = 3;
+#endif
+ dComIfGs_setEventReg(dSv_event_flag_c::UNK_8803, reg);
}
/* 00000214-00000418 .text modeClearEvent__13daTag_Gship_cFv */
diff --git a/src/d/actor/d_a_tag_light.cpp b/src/d/actor/d_a_tag_light.cpp
index 10264aff..597c0f19 100644
--- a/src/d/actor/d_a_tag_light.cpp
+++ b/src/d/actor/d_a_tag_light.cpp
@@ -498,7 +498,7 @@ bool Act_c::_execute() {
}
/* 00001C90-00001D20 .text set_material__Q210daTagLight5Act_cFP11J3DMaterialUc */
-void Act_c::set_material(J3DMaterial* material, unsigned char alpha) {
+void Act_c::set_material(J3DMaterial* material, u8 alpha) {
while (material != NULL) {
if (alpha == 0) {
material->getShape()->hide();
@@ -534,9 +534,11 @@ bool Act_c::_draw() {
}
J3DModelData* modelData = mpModel->getModelData();
- u8 tmp = (s8)(m308 * 255.5f);
- set_material(modelData->getJointNodePointer(1)->getMesh(), tmp);
- set_material(modelData->getJointNodePointer(2)->getMesh(), tmp);
+ s8 tmp = (m308 * 255.5f);
+ // Fakematch?
+ u8 tmp2 = tmp;
+ set_material(modelData->getJointNodePointer(1)->getMesh(), (u8)tmp2);
+ set_material(modelData->getJointNodePointer(2)->getMesh(), (u8)tmp2);
mDoExt_modelUpdateDL(mpModel);
}
return true;
diff --git a/src/d/actor/d_a_tornado.cpp b/src/d/actor/d_a_tornado.cpp
index e2175e05..ee08690a 100644
--- a/src/d/actor/d_a_tornado.cpp
+++ b/src/d/actor/d_a_tornado.cpp
@@ -44,7 +44,6 @@ BOOL daTornado_c::jointCallBack(int jntNo) {
}
static const float l_joint_scale[11] = { 0.1f, 0.4f, 0.7f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f };
-static const float joint_offset[11] = { 100.0f, 200.0f, 300.0f, 400.0f, 300.0f, 300.0f, 400.0f, 500.0f, 400.0f, 500.0f, 600.0f };
static daTornado_HIO_c0 l_HIO;
@@ -137,9 +136,8 @@ BOOL daTornado_c::execute() {
}
for (int i = 0; i < 11; i++) {
- f32 sin = cM_ssin(mAngle1 - 0x1000 * i);
- f32 tmp1 = fVar8 * joint_offset[i];
- f32 fVar1 = tmp1 * (sin + 1.0f);
+ static const f32 joint_offset[11] = { 100.0f, 200.0f, 300.0f, 400.0f, 300.0f, 300.0f, 400.0f, 500.0f, 400.0f, 500.0f, 600.0f };
+ f32 fVar1 = (fVar8 * joint_offset[i]) * ((cM_ssin(mAngle1 - 0x1000 * i)) + 1.0f);
s16 angle2 = mAngle2 - 0x1800 * i;
mJointX[i] = cM_ssin(angle2) * fVar1 * scale.x;
mJointZ[i] = cM_scos(angle2) * fVar1 * scale.x;