From a9e7d404d7d03374ee2bdd85b4bc3a577287e6c7 Mon Sep 17 00:00:00 2001 From: Luzagar Date: Tue, 25 Aug 2026 16:35:29 +0200 Subject: [PATCH] kytag work --- include/d/actor/d_a_kytag15.h | 8 +- include/d/actor/d_a_kytag16.h | 28 +++--- src/d/actor/d_a_kytag15.cpp | 66 +++++++------- src/d/actor/d_a_kytag16.cpp | 164 +++++++++++++++++----------------- 4 files changed, 133 insertions(+), 133 deletions(-) diff --git a/include/d/actor/d_a_kytag15.h b/include/d/actor/d_a_kytag15.h index 033e8e321e5..e6e0d123d74 100644 --- a/include/d/actor/d_a_kytag15.h +++ b/include/d/actor/d_a_kytag15.h @@ -13,12 +13,12 @@ */ class kytag15_class : public fopAc_ac_c { public: - /* 0x568 */ J3DModel* mpModel; - /* 0x56C */ mDoExt_btkAnm mBtk; + /* 0x568 */ J3DModel* model; + /* 0x56C */ mDoExt_btkAnm btk; /* 0x584 */ request_of_phase_process_class mPhase; - /* 0x58C */ u8 field_0x58c; + /* 0x58C */ u8 desert_stage; /* 0x58D */ u8 field_0x58d[0x590 - 0x58D]; - /* 0x590 */ f32 field_0x590; + /* 0x590 */ f32 blend; }; STATIC_ASSERT(sizeof(kytag15_class) == 0x594); diff --git a/include/d/actor/d_a_kytag16.h b/include/d/actor/d_a_kytag16.h index f3355aa04d4..7c283f319cb 100644 --- a/include/d/actor/d_a_kytag16.h +++ b/include/d/actor/d_a_kytag16.h @@ -13,21 +13,21 @@ */ class kytag16_class : public fopAc_ac_c { public: - /* 0x568 */ f32 field_0x568; - /* 0x56C */ u8 field_0x56c; - /* 0x56D */ GXColor mColor; - /* 0x571 */ u8 field_0x571; - /* 0x572 */ u8 field_0x572; - /* 0x573 */ u8 mSwitch; - /* 0x574 */ f32 field_0x574; - /* 0x578 */ f32 field_0x578; - /* 0x57C */ f32 field_0x57c; - /* 0x580 */ f32 field_0x580; + /* 0x568 */ f32 blend; + /* 0x56C */ u8 light_type; + /* 0x56D */ GXColor color; + /* 0x571 */ u8 time_start; + /* 0x572 */ u8 time_end; + /* 0x573 */ u8 bitsw; + /* 0x574 */ f32 ref_dist; + /* 0x578 */ f32 angleX; + /* 0x57C */ f32 angleY; + /* 0x580 */ f32 cutoff; /* 0x584 */ f32 field_0x584; - /* 0x588 */ s16 field_0x588; - /* 0x58A */ s16 field_0x58a; - /* 0x58C */ u8 field_0x58c; - /* 0x58D */ u8 field_0x58d; + /* 0x588 */ s16 swayX; + /* 0x58A */ s16 swayY; + /* 0x58C */ u8 spot_type; + /* 0x58D */ u8 distattn_type; }; STATIC_ASSERT(sizeof(kytag16_class) == 0x590); diff --git a/src/d/actor/d_a_kytag15.cpp b/src/d/actor/d_a_kytag15.cpp index 3287f45a6a8..e486bb8a98a 100644 --- a/src/d/actor/d_a_kytag15.cpp +++ b/src/d/actor/d_a_kytag15.cpp @@ -19,33 +19,33 @@ static int daKytag15_Draw(kytag15_class* i_this) { scale.y = 0.00524f; scale.z = 0.00524f; - if (i_this->mpModel != NULL && i_this->field_0x590 > 0.0f) { + if (i_this->model != NULL && i_this->blend > 0.0f) { J3DGXColorS10 color; - J3DMaterial* mat_p = i_this->mpModel->getModelData()->getMaterialNodePointer(0); + J3DMaterial* mat_p = i_this->model->getModelData()->getMaterialNodePointer(0); color.b = 0; color.g = 0; color.r = 0; color.a = -180; - if (i_this->field_0x58c == 1) { + if (i_this->desert_stage == 1) { color.a = -100; } - color.a = (color.a + 255.0f) * i_this->field_0x590 + -255.0f; + color.a = (color.a + 255.0f) * i_this->blend + -255.0f; mat_p->setTevColor(0, &color); - i_this->mpModel->setBaseScale(scale); - i_this->mpModel->setBaseTRMtx(mDoMtx_stack_c::get()); + i_this->model->setBaseScale(scale); + i_this->model->setBaseTRMtx(mDoMtx_stack_c::get()); - i_this->mBtk.entry(i_this->mpModel->getModelData()); - i_this->mBtk.play(); + i_this->btk.entry(i_this->model->getModelData()); + i_this->btk.play(); - if (i_this->field_0x58c == 1) { - i_this->mBtk.play(); + if (i_this->desert_stage == 1) { + i_this->btk.play(); } dComIfGd_setXluList2DScreen(); - mDoExt_modelUpdateDL(i_this->mpModel); + mDoExt_modelUpdateDL(i_this->model); dComIfGd_setList(); } @@ -53,14 +53,14 @@ static int daKytag15_Draw(kytag15_class* i_this) { } static int daKytag15_Execute(kytag15_class* i_this) { - if (!i_this->field_0x58c) { + if (!i_this->desert_stage) { if (!dKy_daynight_check()) { - cLib_addCalc(&i_this->field_0x590, 1.0f, 0.05f, 0.01f, 1.0E-8f); + cLib_addCalc(&i_this->blend, 1.0f, 0.05f, 0.01f, 1.0E-8f); } else { - cLib_addCalc(&i_this->field_0x590, 0.0f, 0.05f, 0.01f, 1.0E-8f); + cLib_addCalc(&i_this->blend, 0.0f, 0.05f, 0.01f, 1.0E-8f); } } else if (g_env_light.wether_pat0 == 11) { - cLib_addCalc(&i_this->field_0x590, 1.0f, 0.05f, 0.01f, 1.0E-8f); + cLib_addCalc(&i_this->blend, 1.0f, 0.05f, 0.01f, 1.0E-8f); } return 1; @@ -75,52 +75,52 @@ static int daKytag15_Delete(kytag15_class* i_this) { return 1; } -static int useHeapInit(fopAc_ac_c* i_this) { - kytag15_class* a_this = (kytag15_class*)i_this; +static int useHeapInit(fopAc_ac_c* actor) { + kytag15_class* i_this = (kytag15_class*)actor; J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("Kytag15", 4); - a_this->mpModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000284); - if (a_this->mpModel == NULL) { + i_this->model = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000284); + if (i_this->model == NULL) { return 0; } J3DAnmTextureSRTKey* btk = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("Kytag15", 7); - if (!a_this->mBtk.init(modelData, btk, TRUE, 2, 1.0f, 0, -1)) { + if (!i_this->btk.init(modelData, btk, TRUE, 2, 1.0f, 0, -1)) { return 0; } return 1; } -static int daKytag15_Create(fopAc_ac_c* i_this) { - kytag15_class* a_this = (kytag15_class*)i_this; +static int daKytag15_Create(fopAc_ac_c* actor) { + kytag15_class* i_this = (kytag15_class*)actor; if (strcmp(dComIfGp_getStartStageName(), "F_SP118") == 0) { - a_this->field_0x58c = 1; + i_this->desert_stage = 1; } else { - a_this->field_0x58c = 0; + i_this->desert_stage = 0; } - fopAcM_ct(a_this, kytag15_class); + fopAcM_ct(i_this, kytag15_class); - if (a_this->field_0x58c == 0) { + if (i_this->desert_stage == 0) { if (!dKy_daynight_check()) { - a_this->field_0x590 = 1.0f; + i_this->blend = 1.0f; } else { - a_this->field_0x590 = 0.0f; + i_this->blend = 0.0f; } } else { - a_this->field_0x590 = 0.0f; + i_this->blend = 0.0f; } - int phase = dComIfG_resLoad(&a_this->mPhase, "Kytag15"); - if (phase == cPhs_COMPLEATE_e) { - if (!fopAcM_entrySolidHeap(a_this, useHeapInit, 0)) { + cPhs_Step phase_state = dComIfG_resLoad(&i_this->mPhase, "Kytag15"); + if (phase_state == cPhs_COMPLEATE_e) { + if (!fopAcM_entrySolidHeap(i_this, useHeapInit, 0)) { return cPhs_ERROR_e; } } - return phase; + return phase_state; } static actor_method_class l_daKytag15_Method = { diff --git a/src/d/actor/d_a_kytag16.cpp b/src/d/actor/d_a_kytag16.cpp index addbc046fae..d084a046068 100644 --- a/src/d/actor/d_a_kytag16.cpp +++ b/src/d/actor/d_a_kytag16.cpp @@ -17,61 +17,61 @@ static int daKytag16_Draw(kytag16_class* i_this) { } static int daKytag16_Execute(kytag16_class* i_this) { - bool var_r29 = false; - f32 var_f31 = 0.0f; - f32 var_f30 = 0.0f; - - if (i_this->field_0x571 < 31) { - if (i_this->field_0x571 > i_this->field_0x572) { - if (dKy_getdaytime_hour() >= i_this->field_0x571 || - dKy_getdaytime_hour() <= i_this->field_0x572) + bool light_set = false; + f32 x = 0.0f; + f32 y = 0.0f; + + if (i_this->time_start < 31) { + if (i_this->time_start > i_this->time_end) { + if (dKy_getdaytime_hour() >= i_this->time_start || + dKy_getdaytime_hour() <= i_this->time_end) { - var_r29 = true; + light_set = true; } - } else if (dKy_getdaytime_hour() >= i_this->field_0x571 && - dKy_getdaytime_hour() <= i_this->field_0x572) + } else if (dKy_getdaytime_hour() >= i_this->time_start && + dKy_getdaytime_hour() <= i_this->time_end) { - var_r29 = true; + light_set = true; } } else { - var_r29 = true; + light_set = true; } - if (var_r29) { - var_r29 = false; + if (light_set) { + light_set = false; - if (i_this->mSwitch != 0xFF) { - if (dComIfGs_isSwitch(i_this->mSwitch, dComIfGp_roomControl_getStayNo())) { - var_r29 = true; + if (i_this->bitsw != 0xFF) { + if (dComIfGs_isSwitch(i_this->bitsw, dComIfGp_roomControl_getStayNo())) { + light_set = true; } } else { - var_r29 = true; + light_set = true; } } - if (var_r29) { + if (light_set) { if (strcmp(dComIfGp_getStartStageName(), "F_SP117") != 0) { - cLib_addCalc(&i_this->field_0x568, 1.0f, 0.5f, 0.1f, 0.0001f); + cLib_addCalc(&i_this->blend, 1.0f, 0.5f, 0.1f, 0.0001f); } else { - var_f31 = cM_ssin(i_this->field_0x588); - var_f30 = cM_scos(i_this->field_0x58a); + x = cM_ssin(i_this->swayX); + y = cM_scos(i_this->swayY); - i_this->field_0x588 += 0x500; - i_this->field_0x58a += 800; + i_this->swayX += 0x500; + i_this->swayY += 800; - cLib_addCalc(&i_this->field_0x568, 0.9f + (0.1f * cM_ssin(g_Counter.mCounter0 * 0x500)), + cLib_addCalc(&i_this->blend, 0.9f + (0.1f * cM_ssin(g_Counter.mCounter0 * 0x500)), 0.5f, 0.1f, 0.0001f); - i_this->field_0x580 = 40.0f; + i_this->cutoff = 40.0f; } } else { - cLib_addCalc(&i_this->field_0x568, 0.0f, 0.5f, 0.05f, 0.0001f); + cLib_addCalc(&i_this->blend, 0.0f, 0.5f, 0.05f, 0.0001f); } - if (i_this->field_0x568 > 0.001f) { - dKy_BossSpotLight_set(&i_this->current.pos, i_this->field_0x578 + (12.0f * var_f31), - i_this->field_0x57c + (50.0f * var_f30), i_this->field_0x580, - &i_this->mColor, i_this->field_0x574 * i_this->field_0x568, - i_this->field_0x58c, i_this->field_0x58d); + if (i_this->blend > 0.001f) { + dKy_BossSpotLight_set(&i_this->current.pos, i_this->angleX + (12.0f * x), + i_this->angleY + (50.0f * y), i_this->cutoff, + &i_this->color, i_this->ref_dist * i_this->blend, + i_this->spot_type, i_this->distattn_type); } return 1; @@ -85,75 +85,75 @@ static int daKytag16_Delete(kytag16_class* i_this) { return 1; } -static int daKytag16_Create(fopAc_ac_c* i_this) { - fopAcM_ct(i_this, kytag16_class); - kytag16_class* a_this = (kytag16_class*)i_this; +static int daKytag16_Create(fopAc_ac_c* actor) { + fopAcM_ct(actor, kytag16_class); + kytag16_class* i_this = (kytag16_class*)actor; - a_this->mSwitch = fopAcM_GetParam(a_this) & 0xFF; - a_this->field_0x56c = (a_this->current.angle.z >> 10) & 0x3F; + i_this->bitsw = fopAcM_GetParam(i_this) & 0xFF; + i_this->light_type = (i_this->current.angle.z >> 10) & 0x3F; - a_this->mColor.r = fopAcM_GetParam(a_this) >> 0x8; - a_this->mColor.g = fopAcM_GetParam(a_this) >> 0x10; - a_this->mColor.b = fopAcM_GetParam(a_this) >> 0x18; + i_this->color.r = fopAcM_GetParam(i_this) >> 0x8; + i_this->color.g = fopAcM_GetParam(i_this) >> 0x10; + i_this->color.b = fopAcM_GetParam(i_this) >> 0x18; - a_this->field_0x571 = a_this->current.angle.z & 0x1F; - a_this->field_0x572 = (a_this->current.angle.z >> 5) & 0x1F; - a_this->field_0x578 = (a_this->shape_angle.x / 32767.0f) * 180.0f; - a_this->field_0x57c = (a_this->shape_angle.y / 32767.0f) * 180.0f; + i_this->time_start = i_this->current.angle.z & 0x1F; + i_this->time_end = (i_this->current.angle.z >> 5) & 0x1F; + i_this->angleX = (i_this->shape_angle.x / 32767.0f) * 180.0f; + i_this->angleY = (i_this->shape_angle.y / 32767.0f) * 180.0f; - a_this->field_0x588 = cM_rndFX(65535.0f); - a_this->field_0x58a = cM_rndFX(65535.0f); - a_this->field_0x584 = 1.0f; - a_this->field_0x568 = 0.0f; + i_this->swayX = cM_rndFX(65535.0f); + i_this->swayY = cM_rndFX(65535.0f); + i_this->field_0x584 = 1.0f; + i_this->blend = 0.0f; - switch (a_this->field_0x56c) { + switch (i_this->light_type) { case 0: - a_this->field_0x580 = 45.0f; - a_this->field_0x574 = 1.0f; - a_this->field_0x58c = 0; - a_this->field_0x58d = 3; + i_this->cutoff = 45.0f; + i_this->ref_dist = 1.0f; + i_this->spot_type = 0; + i_this->distattn_type = 3; break; case 1: - a_this->field_0x580 = 45.0f; - a_this->field_0x574 = 5.0f; - a_this->field_0x58c = 0; - a_this->field_0x58d = 3; + i_this->cutoff = 45.0f; + i_this->ref_dist = 5.0f; + i_this->spot_type = 0; + i_this->distattn_type = 3; break; case 2: - a_this->field_0x580 = 45.0f; - a_this->field_0x574 = 10.0f; - a_this->field_0x58c = 0; - a_this->field_0x58d = 3; + i_this->cutoff = 45.0f; + i_this->ref_dist = 10.0f; + i_this->spot_type = 0; + i_this->distattn_type = 3; break; case 3: - a_this->field_0x580 = 25.0f; - a_this->field_0x574 = 1.0f; - a_this->field_0x58c = 2; - a_this->field_0x58d = 3; + i_this->cutoff = 25.0f; + i_this->ref_dist = 1.0f; + i_this->spot_type = 2; + i_this->distattn_type = 3; break; case 4: - a_this->field_0x580 = 45.0f; - a_this->field_0x574 = 5.0f; - a_this->field_0x58c = 2; - a_this->field_0x58d = 3; + i_this->cutoff = 45.0f; + i_this->ref_dist = 5.0f; + i_this->spot_type = 2; + i_this->distattn_type = 3; break; case 5: - a_this->field_0x580 = 70.0f; - a_this->field_0x574 = 10.0f; - a_this->field_0x58c = 2; - a_this->field_0x58d = 3; + i_this->cutoff = 70.0f; + i_this->ref_dist = 10.0f; + i_this->spot_type = 2; + i_this->distattn_type = 3; break; case 6: - a_this->field_0x580 = 60.0f; - a_this->field_0x574 = 0.01f; - a_this->field_0x58c = 2; - a_this->field_0x58d = 1; + i_this->cutoff = 60.0f; + i_this->ref_dist = 0.01f; + i_this->spot_type = 2; + i_this->distattn_type = 1; break; case 7: - a_this->field_0x580 = 50.0f; - a_this->field_0x574 = 0.01f; - a_this->field_0x58c = 2; - a_this->field_0x58d = 1; + i_this->cutoff = 50.0f; + i_this->ref_dist = 0.01f; + i_this->spot_type = 2; + i_this->distattn_type = 1; break; }