From d54a864b263b3f4503b6eb9926ef9055f4066f36 Mon Sep 17 00:00:00 2001 From: Kristopher Early <1191258+MrPolymorph@users.noreply.github.com> Date: Fri, 6 Oct 2023 16:14:56 +0100 Subject: [PATCH] 92% --- src/d/actor/d_a_kytag05.cpp | 92 +++++++++++++++++-------------------- 1 file changed, 41 insertions(+), 51 deletions(-) diff --git a/src/d/actor/d_a_kytag05.cpp b/src/d/actor/d_a_kytag05.cpp index f74506a79..a0575b474 100644 --- a/src/d/actor/d_a_kytag05.cpp +++ b/src/d/actor/d_a_kytag05.cpp @@ -4,11 +4,12 @@ // #include "JSystem/JKernel/JKRHeap.h" #include "JAZelAudio/JAIZelBasic.h" +#include "d/actor/d_a_player.h" +#include "d/actor/d_a_player_link.h" #include "f_op/f_op_actor_mng.h" #include "f_op/f_op_camera_mng.h" #include "d/d_com_inf_game.h" #include "d/d_kankyo_wether.h" -#include "d/actor/d_a_player.h" #include "d/actor/d_a_ykgr.h" #include "m_Do/m_Do_audio.h" #include "d/d_procname.h" @@ -16,8 +17,8 @@ class kytag05_class : public fopAc_ac_c { public: - /* 0x00 */ u8 mWindIndex; - /* 0x04 */ int mCurrWindDir; + /* 0x00 */ u8 mIndex; + /* 0x04 */ int field_0x294; /* 0x08 */ int field_0x298; }; /* size = 0x29C */ @@ -26,38 +27,27 @@ BOOL daKytag05_Draw(kytag05_class*) { } static const s16 wind_table[] = { - 0x00, - 0x00, - 0x80, - 0x01, - 0xC0, - 0x00, - 0x40, - 0x00 -}; - -static const s16 fuu_timer[] = { - 0x00, - 0x96, - 0x00, - 0x96, - 0x00, - 0x96, - 0x00, - 0x96 + 0, + 0x8001, + 0xC000, + 0x4000 }; static const s16 mufuu_timer[] = { - 0x00, 0x0A, - 0x00, - 0x0A, - 0x00, - 0x00, + 0xA, 0x00, 0x5A }; +static const s16 fuu_timer[] = { + 0x0096, + 0x0096, + 0x0096, + 0x0096, +}; + + /* 00000080-000003F4 .text daKytag05_Execute__FP13kytag05_class */ int daKytag05_Execute(kytag05_class* a_this) { /* Nonmatching */ @@ -70,7 +60,7 @@ int daKytag05_Execute(kytag05_class* a_this) { mpCamera = dComIfGp_getCamera(0); playerActor = daPy_getPlayerActorClass(); windPow = dKyw_get_wind_pow(); - i_blend = 5; + i_blend = 1.0f; if (g_env_light.mWind.mEvtWindSet == 0xFF) { return 1; @@ -80,40 +70,40 @@ int daKytag05_Execute(kytag05_class* a_this) { g_dComIfG_gameInfo.play.getDemo() != NULL) { demoField = g_dComIfG_gameInfo.play.getDemo()->field_0xd4; if(demoField >= 0x186) { - f32 var_f1 = ((f32)demoField - 90.0f) / 180.0f; - if(var_f1 > i_blend) { - var_f1 = i_blend; + f32 fVar7 = ((f32)demoField - 390.0f) / 100.0f; + if(fVar7 > i_blend) { + fVar7 = i_blend; } - i_blend = 0.5f - var_f1; - g_env_light.mSnowCount = (int)(259 * i_blend); + i_blend = 1.0f - fVar7; + g_env_light.mSnowCount = (int)(200.0f * i_blend); } else if (demoField == 0x187 && daYkgr_c::m_emitter != 0) { daYkgr_c::m_alpha_flag = 0; } } dKy_custom_colset(0, 7, i_blend); - if((a_this->mWindIndex & 1) == 0) { - if (a_this->mCurrWindDir >= fuu_timer[(a_this->mWindIndex & ~0x1) >> 1]) { - a_this->mCurrWindDir = 0; - a_this->mWindIndex += 1; + if((a_this->mIndex & 1) == 0) { + if (a_this->field_0x294 >= fuu_timer[a_this->mIndex >> 1]) { + a_this->field_0x294 = 0; + a_this->mIndex += 1; g_env_light.mWind.mEvtWindSet = 2; } else { - a_this->mCurrWindDir += 1; + a_this->field_0x294 += 1; } } else { - if (a_this->mCurrWindDir >= mufuu_timer[(a_this->mWindIndex & ~0x1) >> 1]) { - a_this->mWindIndex += 1; - if(a_this->mWindIndex >> 1 >= 4) { - a_this->mWindIndex = 0; + if (a_this->field_0x294 >= mufuu_timer[(a_this->mIndex) >> 1]) { + a_this->mIndex += 1; + if(a_this->mIndex >> 1 >= 4) { + a_this->mIndex = 0; } - dKyw_evt_wind_set(0, wind_table[a_this->mWindIndex]); - a_this->mCurrWindDir = 0; + dKyw_evt_wind_set(0, wind_table[a_this->mIndex >> 1]); + a_this->field_0x294 = 0; g_env_light.mWind.mEvtWindSet = 1; } else { - a_this->mCurrWindDir += 1; + a_this->field_0x294 += 1; } } cameraEyeZ = mpCamera->mLookat.mEye.z; - if(cameraEyeZ > 360.0f || cameraEyeZ > 360.0f && + if(cameraEyeZ > 360.0f|| playerActor->current.pos.z > 360.0f && mpCamera->mLookat.mEye.x > 450 || playerActor->current.pos.x > 450.0f){ if(cameraEyeZ > 540.0f || playerActor->current.pos.z < 540.0f) { dKyw_evt_wind_set(0, 0x61A8); @@ -122,11 +112,11 @@ int daKytag05_Execute(kytag05_class* a_this) { } else { dKyw_evt_wind_set(0,0x4650); } - } else if(mpCamera->mLookat.mEye.z < 720 || playerActor->current.pos.z < 720) { + } else if(mpCamera->mLookat.mEye.z < 720 || playerActor->current.pos.x < 720) { dKyw_evt_wind_set(0, -0x3E80); - } else if(mpCamera->mLookat.mEye.z < 810 || playerActor->current.pos.z < 810 ) { + } else if(mpCamera->mLookat.mEye.z < 810 || playerActor->current.pos.x < 810 ) { dKyw_evt_wind_set(0, -0x4B00); - } else if(mpCamera->mLookat.mEye.z < 900 || playerActor->current.pos.z < 900) { + } else if(mpCamera->mLookat.mEye.z < 900 || playerActor->current.pos.x < 900) { dKyw_evt_wind_set(0, -0x32C8); } @@ -148,8 +138,8 @@ int daKytag05_Create(fopAc_ac_c* i_this) { if (dComIfGs_isSymbol(1) != 0) { return 3; } - a_this->mWindIndex = 0; - a_this->mCurrWindDir = 0; + a_this->mIndex = 0; + a_this->field_0x294 = 0; a_this->field_0x298 = i_this->mBase.mParameters & 0xff; dKyw_evt_wind_set_go(); dKyw_evt_wind_set(0,0);