d_a_kokiie (#884)

This commit is contained in:
Maide
2025-09-14 18:18:13 +01:00
committed by GitHub
parent 5fdcda6661
commit 3fbe8b5798
3 changed files with 442 additions and 23 deletions
+2 -2
View File
@@ -1441,7 +1441,7 @@ config.libs = [
ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_obj_pbco"),
ActorRel(Matching, "d_a_obj_pirateship"),
ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_obj_quake"),
ActorRel(Matching, "d_a_obj_rcloud"),
ActorRel(Matching, "d_a_obj_rcloud"),
ActorRel(Matching, "d_a_obj_roten"),
ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_obj_shelf"),
ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_obj_shmrgrd"),
@@ -1512,7 +1512,7 @@ config.libs = [
ActorRel(Matching, "d_a_kamome2"), # Demo-only
ActorRel(NonMatching, "d_a_kantera"),
ActorRel(Matching, "d_a_kn"),
ActorRel(NonMatching, "d_a_kokiie"),
ActorRel(Equivalent, "d_a_kokiie"),
ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_ks"),
ActorRel(NonMatching, "d_a_kt"), # regalloc
ActorRel(Matching, "d_a_mflft"),
+44 -4
View File
@@ -3,9 +3,49 @@
#include "f_op/f_op_actor.h"
class kokiie_class : public fopAc_ac_c {
public:
/* Place member variables here */
};
class dBgW;
struct kokiie_class {
/* 0x000 */ fopAc_ac_c actor;
/* 0x290 */ request_of_phase_process_class mPhase;
/* 0x298 */ s16 m298;
/* 0x29A */ s16 m29A;
/* 0x29C */ J3DModel* mpModel;
/* 0x2A0 */ u8 m2A0;
/* 0x2A1 */ u8 m2A1[0x2A2 - 0x2A1];
/* 0x2A2 */ u8 m2A2;
/* 0x2A3 */ u8 m2A3[0x2A4 - 0x2A3];
/* 0x2A4 */ cXyz m2A4;
/* 0x2B0 */ f32 m2B0;
/* 0x2B4 */ u8 m2B4[0x2B8 - 0x2B4];
/* 0x2B8 */ f32 m2B8;
/* 0x2BC */ f32 m2BC;
/* 0x2C0 */ u8 m2C0[0x2C4 - 0x2C0];
/* 0x2C4 */ f32 m2C4;
/* 0x2C8 */ csXyz m2C8;
/* 0x2CE */ u8 m2CE[0x2D0 - 0x2CE];
/* 0x2D0 */ f32 m2D0;
/* 0x2D4 */ fpc_ProcID m2D4[5];
/* 0x2E8 */ u8 m2E8[5];
/* 0x2ED */ u8 m2ED[0x2F0 - 0x2ED];
/* 0x2F0 */ cXyz m2F0[5];
/* 0x32C */ u8 m32C[5];
/* 0x331 */ u8 m331[0x332 - 0x331];
/* 0x332 */ s16 m332;
/* 0x334 */ s16 m334;
/* 0x336 */ u8 m336[0x338 - 0x336];
/* 0x338 */ f32 m338;
/* 0x33C */ u8 m33C[0x340 - 0x33C];
/* 0x340 */ Mtx m340;
/* 0x370 */ dBgW* pm_bgw;
/* 0x374 */ f32 m374;
/* 0x378 */ s16 m378;
/* 0x37A */ s16 m37A;
/* 0x37C */ cXyz m37C;
/* 0x388 */ cXyz m388;
/* 0x394 */ u8 m394[0x39C - 0x394];
/* 0x39C */ f32 m39C;
/* 0x3A0 */ f32 m3A0;
}; // size = 0x3A4
#endif /* D_A_KOKIIE_H */
+396 -17
View File
@@ -5,32 +5,309 @@
#include "d/dolzel_rel.h" // IWYU pragma: keep
#include "d/actor/d_a_kokiie.h"
#include "d/actor/d_a_shand.h"
#include "d/d_procname.h"
#include "d/d_priority.h"
#include "d/d_s_play.h"
#include "d/d_com_inf_game.h"
#include "d/d_bg_s_movebg_actor.h"
#include "f_op/f_op_actor_mng.h"
#include "f_op/f_op_camera.h"
#include "JSystem/JUtility/JUTReport.h"
static const f32 unused_4154[] = {10.0f};
/* 000000B4-00000154 .text daKokiie_Draw__FP12kokiie_class */
static BOOL daKokiie_Draw(kokiie_class*) {
/* Nonmatching */
static BOOL daKokiie_Draw(kokiie_class* i_this) {
g_env_light.settingTevStruct(TEV_TYPE_BG0, &i_this->actor.current.pos, &i_this->actor.tevStr);
g_env_light.setLightTevColorType(i_this->mpModel, &(i_this->actor).tevStr);
dComIfGd_setListBG();
mDoExt_modelUpdateDL(i_this->mpModel);
dComIfGd_setList();
return TRUE;
}
/* 00000154-00000884 .text kokiie_move__FP12kokiie_class */
void kokiie_move(kokiie_class*) {
/* Nonmatching */
void kokiie_move(kokiie_class* i_this) {
static u8 himo_off_check[] = {1, 2, 4, 8, 16};
static s16 himo_off_ya[] = {
0x1, 0x0, 0x2EE0, 0x1D4C, 0x5FB4, 0x0, 0x4E20, 0x30D4, 0x987C, 0x0, 0x0, 0x1964, 0x7FFF, 0x7FFF, 0x6784, 0x5014,
0xCF2C, 0xE2B4, 0x0, 0x0, 0x0, 0xE4A8, 0x4C2C, 0x1D4C, 0xB1E0, 0xCF2C, 0xB3D4, 0xE2B4, 0x987C, 0xB3D4, 0x8000, 0x1,
};
static s16 himo_off_xa[] = {
0x0, 0x7D0, 0x7D0, 0xBB8, 0x7D0, 0x0, 0xBB8, 0xFA0, 0x7D0, 0x0, 0x0, 0x7D0, 0xBB8, 0x7D0, 0xFA0, 0xFA0,
0x3E8, 0x7D0, 0x0, 0xFA0, 0x0, 0x7D0, 0x7D0, 0xFA0, 0xBB8, 0xFA0, 0xBB8, 0xFA0, 0xFA0, 0xFA0, 0xFA0, 0xFA0,
};
static s16 himo_off_yp[] = {
0x0, 0x96, 0x96, 0x12C, 0x96, 0x190, 0x190, 0x1F4, 0x96, 0x12C, 0x12C, 0x1F4, 0x12C, 0x1F4, 0x1F4, 0x2BC,
0x96, 0x12C, 0x12C, 0x1F4, 0x12C, 0x1F4, 0x1F4, 0x2BC, 0x12C, 0x1F4, 0x1F4, 0x2BC, 0x1F4, 0x2BC, 0x2BC, 0x0,
};
i_this->m298++;
switch (i_this->m29A) {
case 0: {
s32 uVar6 = 0;
for (s32 i = 0; i < ARRAY_SSIZE(i_this->m32C); i++) {
if (i_this->m32C[i] == 2) {
i_this->m32C[i] = 0;
i_this->m338 = 0.0f;
}
if (i_this->m32C[i] != 0) {
if (i_this->m32C[i] == 1) {
i_this->m338 = 1.0f;
i_this->m32C[i] = 5;
}
uVar6 |= himo_off_check[i];
}
}
s16 sVar1 = himo_off_ya[uVar6];
s16 target = himo_off_xa[uVar6];
cLib_addCalc2(&i_this->m2D0, REG8_F(4) - himo_off_yp[uVar6], 0.1f, i_this->m338 * 50.0f);
if ((uVar6 == 0x1f) && dComIfGs_checkGetItem(dItem_BOOMERANG_e)) {
i_this->m29A = 1;
i_this->actor.health = 0;
i_this->m378 = 1;
}
s16 maxSpeed = i_this->m338 * 10000.0f;
cLib_addCalcAngleS2(&i_this->m334, target, 4, maxSpeed);
if (target != 0) {
cLib_addCalcAngleS2(&i_this->m332, sVar1, 2, maxSpeed);
}
cLib_addCalc2(&i_this->m338, 1.0f, 1.0f, REG8_F(14) + 0.001f);
cLib_addCalcAngleS2(&i_this->actor.current.angle.x, 0, 10, 0x200);
cLib_addCalcAngleS2(&i_this->actor.current.angle.z, 0, 10, 0x200);
i_this->m2C8.x = i_this->m2BC * cM_ssin(i_this->m298 * 900);
i_this->m2C8.z = i_this->m2C4 * cM_ssin(i_this->m298 * 700);
cLib_addCalc2(&i_this->m2BC, REG14_F(9) + 300.0f, 1.0f, REG14_F(3) + 20.0f);
cLib_addCalc2(&i_this->m2C4, REG14_F(9) + 300.0f, 1.0f, REG14_F(3) + 20.0f);
i_this->m2A4.x = i_this->m2B0 * cM_ssin(i_this->m298 * 0x2ee);
i_this->m2A4.z = i_this->m2B8 * cM_ssin(i_this->m298 * 900);
cLib_addCalc0(&i_this->m2B0, 1.0f, 0.25f);
cLib_addCalc0(&i_this->m2B8, 1.0f, 0.25f);
i_this->actor.shape_angle = i_this->actor.current.angle + i_this->m2C8;
i_this->actor.current.pos = i_this->actor.home.pos + i_this->m2A4;
i_this->actor.current.pos.y += i_this->m2D0;
cLib_addCalc0(&i_this->m2A4.y, 0.05f, REG0_F(7) + 2.0f);
} break;
case 1:
cLib_addCalcAngleS2(&i_this->actor.shape_angle.x, 0, 10, 0x800);
cLib_addCalcAngleS2(&i_this->actor.shape_angle.z, 0, 10, 0x800);
cLib_addCalcAngleS2(&i_this->m334, 0, 4, 0x200);
i_this->actor.current.pos.y += i_this->actor.speed.y;
i_this->actor.speed.y -= REG12_F(14) + 3.0f;
if (i_this->m37A == (s16)(REG0_S(4) + 0x1b)) {
if (i_this->m2A2 != 0xff) {
dComIfGs_onSwitch(i_this->m2A2, fopAcM_GetRoomNo(&i_this->actor));
}
fopAcM_seStartCurrent(&i_this->actor, JA_SE_OBJ_KOKIRI_H_CRASH, 0);
dComIfGp_getVibration().StartShock(REG0_S(2) + 4, -0x21, cXyz(0.0f, 1.0f, 0.0f));
}
if (i_this->m37A == (s16)(REG0_S(5) + 0x40)) {
cXyz sp44 = i_this->actor.current.pos;
sp44.y = 1170.0f;
dComIfGp_particle_set(dPa_name::ID_SCENE_82A4, &sp44);
dComIfGp_particle_set(dPa_name::ID_SCENE_82A5, &sp44);
dComIfGp_particle_set(dPa_name::ID_SCENE_82A6, &i_this->actor.current.pos);
dComIfGp_particle_set(dPa_name::ID_SCENE_82A7, &sp44);
}
i_this->m374 = (REG0_F(9) + 5180.0f) - 3800.0f;
if (i_this->actor.current.pos.y <= i_this->m374) {
i_this->actor.current.pos.y = i_this->m374;
if (i_this->actor.speed.y < -20.0f) {
dComIfGp_getVibration().StartShock(REG6_S(2) + 7, -0x21, cXyz(0.0f, 1.0f, 0.0f));
fopAcM_seStartCurrent(&i_this->actor, JA_SE_OBJ_KOKIRI_H_LANDING, 0);
i_this->m39C = REG12_F(10) + 40.0f + 50.0f;
}
i_this->actor.speed.y = 0.0f;
cLib_addCalcAngleS2(&i_this->m334, 0, 2, 0x2000);
}
break;
}
}
/* 00000884-00000A18 .text himo_create__FP12kokiie_class */
void himo_create(kokiie_class*) {
/* Nonmatching */
#if VERSION == VERSION_DEMO
void himo_create(kokiie_class* i_this) {
#else
BOOL himo_create(kokiie_class* i_this) {
#endif
#if VERSION > VERSION_DEMO
if ((i_this->m2A2 != 0xff) && fopAcM_isSwitch(&i_this->actor, i_this->m2A2)) {
return FALSE;
}
s32 uVar2 = 0;
#endif
fopAcM_prm_class* pfVar3;
shand_class* pfVar6;
for (s32 i = 0; i < ARRAY_SSIZE(i_this->m2E8); i++) {
switch (i_this->m2E8[i]) {
case 0:
pfVar3 = fopAcM_CreateAppend();
pfVar3->base.position = i_this->actor.current.pos;
pfVar3->base.angle.y = i_this->actor.current.angle.y + i * 0x3333 + -13000;
pfVar3->base.parameters = 0xffffff01;
pfVar3->room_no = i_this->actor.current.roomNo;
i_this->m2D4[i] = fopAcM_create(PROC_SHAND, NULL, pfVar3);
i_this->m2E8[i]++;
case 1:
pfVar6 = (shand_class*)fopAcM_SearchByID(i_this->m2D4[i]);
if (pfVar6 != NULL) {
pfVar6->field_308 = fopAcM_GetID(&i_this->actor);
pfVar6->field_310 = &i_this->m2F0[i];
pfVar6->field_314 = &i_this->m32C[i];
i_this->m2E8[i]++;
#if VERSION > VERSION_DEMO
uVar2++;
#endif
}
break;
case 2:
break;
}
}
#if VERSION > VERSION_DEMO
return uVar2 < 5;
#endif
}
/* 00000A18-00000E98 .text demo_camera__FP12kokiie_class */
void demo_camera(kokiie_class*) {
/* Nonmatching */
void demo_camera(kokiie_class* i_this) {
camera_class* camera = dComIfGp_getCamera(dComIfGp_getPlayerCameraID(0));
cXyz sp5C;
cXyz sp50;
cMtx_YrotS(*calc_mtx, i_this->actor.shape_angle.y);
switch (i_this->m378) {
case 0:
break;
case 1:
if (!i_this->actor.eventInfo.checkCommandDemoAccrpt()) {
fopAcM_orderPotentialEvent(&i_this->actor, 2, 0xffff, 0);
i_this->actor.eventInfo.onCondition(dEvtCnd_UNK2_e);
return;
}
i_this->m378++;
camera->mCamera.Stop();
camera->mCamera.SetTrimSize(2);
i_this->m37C = i_this->actor.current.pos;
sp5C.x = (REG12_F(2) + 1300.0f) - 800.0f;
sp5C.y = 0.0f;
sp5C.z = REG12_F(4) - 1000.0f;
MtxPosition(&sp5C, &sp50);
i_this->m37C.x = i_this->actor.current.pos.x + sp50.x;
i_this->m37C.y = ((REG12_F(5) + 4030.0f) - 3800.0f) + 1500.0f;
i_this->m37C.z = i_this->actor.current.pos.z + sp50.z;
i_this->m388 = i_this->actor.current.pos;
i_this->m388.y += REG12_F(6) + -450.0f;
i_this->m3A0 = REG12_F(18) + 65.0f;
i_this->m37A = 0;
case 2:
if (i_this->m37A < (s16)(REG12_S(3) + 10)) {
i_this->actor.speed.y = 0.0f;
}
cLib_addCalc2(&i_this->m388.y, (i_this->actor.current.pos.y - 450.0f) + REG12_F(6), REG12_F(7) + 0.5f, REG12_F(8) + 200.0f);
if (i_this->m37A > (s16)(REG12_S(4) + 0x32)) {
cLib_addCalc2(&i_this->m3A0, REG12_F(19) + 80.0f, 0.02f, REG12_F(20) + 0.5f);
}
if (i_this->m37A == 100) {
mDoAud_seStart(JA_SE_READ_RIDDLE_1);
}
if ((i_this->m37A == 0x96) && (REG0_S(3) == 0)) {
i_this->m378 = 0;
dComIfGp_event_reset();
camera->mCamera.Reset(i_this->m388, i_this->m37C);
camera->mCamera.Start();
camera->mCamera.SetTrimSize(0);
}
break;
}
if (i_this->m378 != 0) {
f32 sin = i_this->m39C * cM_ssin(i_this->m37A * 0x3300);
f32 cos = i_this->m39C * cM_scos(i_this->m37A * 0x3000);
cXyz sp44;
cXyz sp38;
sp44.x = i_this->m37C.x + sin;
sp44.y = i_this->m37C.y + cos;
sp44.z = i_this->m37C.z;
sp38.x = i_this->m388.x + sin;
sp38.y = i_this->m388.y + cos;
sp38.z = i_this->m388.z;
s16 iVar1 = i_this->m39C * cM_scos(i_this->m298 * 0x1c00) * 8.0f;
camera->mCamera.Set(sp38, sp44, iVar1, i_this->m3A0);
cLib_addCalc0(&i_this->m39C, 1.0f, REG0_F(16) + 5.0f);
JUTReport(0x19a, 0x1ae, "K SUB COUNT %d", i_this->m37A);
i_this->m37A = i_this->m37A + 1;
}
}
/* 00000E98-0000107C .text daKokiie_Execute__FP12kokiie_class */
static BOOL daKokiie_Execute(kokiie_class*) {
/* Nonmatching */
static BOOL daKokiie_Execute(kokiie_class* i_this) {
kokiie_move(i_this);
MtxTrans(i_this->actor.current.pos.x, i_this->actor.current.pos.y, i_this->actor.current.pos.z, 0);
cMtx_YrotM(*calc_mtx, i_this->actor.shape_angle.y);
cMtx_YrotM(*calc_mtx, i_this->m332);
cMtx_XrotM(*calc_mtx, i_this->m334);
cMtx_YrotM(*calc_mtx, -i_this->m332);
cMtx_XrotM(*calc_mtx, i_this->actor.shape_angle.x);
cMtx_ZrotM(*calc_mtx, i_this->actor.shape_angle.z);
cMtx_YrotM(*calc_mtx, 0xb54);
i_this->mpModel->setBaseTRMtx(*calc_mtx);
MTXCopy(*calc_mtx, i_this->m340);
i_this->pm_bgw->Move();
cMtx_YrotM(*calc_mtx, -0xb54);
for (s32 i = 0; i < ARRAY_SSIZE(i_this->m2F0); i++) {
MtxPush();
cMtx_YrotM(*calc_mtx, i * 0x3333);
cXyz sp08;
sp08.x = 0.0f;
sp08.y = REG0_F(5) + -170.0f;
sp08.z = REG0_F(6) + 400.0f;
MtxPosition(&sp08, &i_this->m2F0[i]);
MtxPull();
}
#if VERSION == VERSION_DEMO
himo_create(i_this);
#endif
demo_camera(i_this);
return TRUE;
}
/* 0000107C-00001084 .text daKokiie_IsDelete__FP12kokiie_class */
@@ -39,18 +316,120 @@ static BOOL daKokiie_IsDelete(kokiie_class*) {
}
/* 00001084-000010E4 .text daKokiie_Delete__FP12kokiie_class */
static BOOL daKokiie_Delete(kokiie_class*) {
/* Nonmatching */
static BOOL daKokiie_Delete(kokiie_class* i_this) {
dComIfG_resDeleteDemo(&i_this->mPhase, "Kokiie");
#if VERSION > VERSION_DEMO
if (i_this->actor.heap != NULL)
#endif
{
dComIfG_Bgsp()->Release(i_this->pm_bgw);
}
return TRUE;
}
/* 000010E4-00001250 .text CallbackCreateHeap__FP10fopAc_ac_c */
static BOOL CallbackCreateHeap(fopAc_ac_c*) {
/* Nonmatching */
static BOOL CallbackCreateHeap(fopAc_ac_c* a_this) {
kokiie_class* actor = (kokiie_class*)a_this;
J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("Kokiie", 4);
actor->mpModel = mDoExt_J3DModel__create(modelData, 0, 0x11020203);
if (actor->mpModel == NULL) {
return FALSE;
}
JUT_ASSERT(DEMO_SELECT(924, 945), modelData != NULL);
actor->pm_bgw = new dBgW();
JUT_ASSERT(DEMO_SELECT(929, 950), actor->pm_bgw != NULL);
actor->pm_bgw->Set((cBgD_t*)dComIfG_getObjectRes("Kokiie", 7), dBgW::MOVE_BG_e, &actor->m340);
actor->pm_bgw->SetCrrFunc(dBgS_MoveBGProc_Typical);
return TRUE;
}
/* 00001250-000014E4 .text daKokiie_Create__FP10fopAc_ac_c */
static cPhs_State daKokiie_Create(fopAc_ac_c*) {
/* Nonmatching */
static cPhs_State daKokiie_Create(fopAc_ac_c* a_this) {
kokiie_class* i_this = (kokiie_class*)a_this;
fopAcM_SetupActor(a_this, kokiie_class);
cPhs_State PVar3 = dComIfG_resLoad(&i_this->mPhase, "Kokiie");
#if VERSION == VERSION_DEMO
if (PVar3 == cPhs_COMPLEATE_e)
#else
if (PVar3 != cPhs_COMPLEATE_e) {
return PVar3;
}
#endif
{
i_this->m2A0 = fopAcM_GetParam(a_this);
if (i_this->m2A0 == 0xff) {
i_this->m2A0 = 0;
}
i_this->m2A2 = fopAcM_GetParam(a_this) >> 0x18;
#if VERSION > VERSION_DEMO
if (himo_create(i_this)) {
return FALSE;
}
#endif
if (!fopAcM_entrySolidHeap(a_this, CallbackCreateHeap, 0x10000)) {
return cPhs_ERROR_e;
}
if ((i_this->pm_bgw != NULL) && dComIfG_Bgsp()->Regist(i_this->pm_bgw, a_this)) {
return cPhs_ERROR_e;
}
switch (i_this->m2A0) {
case 1:
a_this->scale.x = 0.9f;
a_this->scale.z = 0.9f;
break;
case 2:
a_this->scale.x = 0.8f;
a_this->scale.z = 0.8f;
break;
case 3:
a_this->scale.x = 0.7f;
a_this->scale.z = 0.7f;
break;
default:
a_this->scale.z = 1.0f;
a_this->scale.x = 1.0f;
break;
}
a_this->scale.y = 1.0f;
fopAcM_SetMtx(a_this, i_this->mpModel->getBaseTRMtx());
fopAcM_SetMin(a_this, a_this->scale.x * -1000.0f, DEMO_SELECT(-1000.0f, -1500.0f), a_this->scale.z * -1000.0f);
fopAcM_SetMax(a_this, a_this->scale.x * 1000.0f, 1000.0f, a_this->scale.z * 1000.0f);
i_this->mpModel->setBaseScale(a_this->scale);
a_this->health = 1;
if ((i_this->m2A2 != 0xff) && fopAcM_isSwitch(a_this, i_this->m2A2)) {
a_this->current.pos.y = i_this->m374 + 50.0f + 720.0f + REG0_F(17);
i_this->m29A = 1;
a_this->health = 0;
#if VERSION == VERSION_DEMO
for (s32 i = 0; i < ARRAY_SSIZE(i_this->m2E8); i++) {
i_this->m2E8[i] = 2;
}
#endif
}
for (s32 i = 0; i < 2; i++) {
daKokiie_Execute(i_this);
}
}
return PVar3;
}
static actor_method_class l_daKokiie_Method = {
@@ -73,7 +452,7 @@ actor_process_profile_definition g_profile_KOKIIE = {
/* Leaf SubMtd */ &g_fopAc_Method.base,
/* Priority */ PRIO_KOKIIE,
/* Actor SubMtd */ &l_daKokiie_Method,
/* Status */ fopAcStts_CULL_e | fopAcStts_UNK4000_e | fopAcStts_UNK40000_e,
/* Status */ fopAcStts_CULL_e | DEMO_SELECT(0, fopAcStts_UNK4000_e) | fopAcStts_UNK40000_e,
/* Group */ fopAc_ACTOR_e,
/* CullType */ fopAc_CULLBOX_CUSTOM_e,
};