summaryrefslogtreecommitdiff
path: root/src/d/actor/d_a_kita.cpp
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/d_a_kita.cpp
parenta62f436d2287e557e0d4b4bab0995cce44ecc3bd (diff)
Misc demo matches (#952)
Diffstat (limited to 'src/d/actor/d_a_kita.cpp')
-rw-r--r--src/d/actor/d_a_kita.cpp193
1 files changed, 109 insertions, 84 deletions
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;
}