diff --git a/include/d/actor/d_a_ykgr.h b/include/d/actor/d_a_ykgr.h new file mode 100644 index 000000000..2ed3f9479 --- /dev/null +++ b/include/d/actor/d_a_ykgr.h @@ -0,0 +1,20 @@ +// +// Created by kris on 04/10/23. +// + +#ifndef TWW_D_A_YKGR_H +#define TWW_D_A_YKGR_H + +struct daYkgr_c { +public: + static JPABaseEmitter* m_emitter; + static u8 m_alpha_flag; +public: + +}; + +extern daYkgr_c daYkgr_c_class; + + + +#endif // TWW_D_A_YKGR_H diff --git a/include/d/d_demo.h b/include/d/d_demo.h index 935acaa69..3c326e1df 100644 --- a/include/d/d_demo.h +++ b/include/d/d_demo.h @@ -87,7 +87,7 @@ public: /* 0x1C */ void* mpMessage; /* 0x20 */ dDemo_object_c mDemoObj; /* 0xD0 */ void* field_0xd0; - /* 0xD4 */ void* field_0xd4; + /* 0xD4 */ int field_0xd4; /* 0xD8 */ int field_0xd8; /* 0xDC */ int mState; }; diff --git a/include/d/d_kankyo.h b/include/d/d_kankyo.h index 947331784..b8212fc4b 100644 --- a/include/d/d_kankyo.h +++ b/include/d/d_kankyo.h @@ -403,6 +403,7 @@ BOOL dKy_daynight_check(); void dKy_tevstr_init(dKy_tevstr_c*, s8, u8); void dKy_Sound_init(); void dKy_change_colpat(u8 param_0); +void dKy_custom_colset(u8 param_0, u8 param_1, f32 i_blend); u8 dKy_pship_existense_chk(); void dKy_Itemgetcol_chg_move(); void dKy_arrowcol_chg_on(cXyz*, int); diff --git a/include/d/d_kankyo_wether.h b/include/d/d_kankyo_wether.h index d39e0a2ef..0f56f17a4 100644 --- a/include/d/d_kankyo_wether.h +++ b/include/d/d_kankyo_wether.h @@ -344,5 +344,6 @@ void squal_proc(); void dKyw_pntwind_set(WIND_INFLUENCE*); void dKyw_pntwind_cut(WIND_INFLUENCE*); void dKyw_pwind_cylinder_set(WIND_INFLUENCE*); - +void dKyw_evt_wind_set(s16 i_windX, s16 i_windY); +void dKyw_evt_wind_set_go(); #endif /* D_KANKYO_WETHER_H */ \ No newline at end of file diff --git a/src/d/actor/d_a_kytag05.cpp b/src/d/actor/d_a_kytag05.cpp index a07ab196d..203db190e 100644 --- a/src/d/actor/d_a_kytag05.cpp +++ b/src/d/actor/d_a_kytag05.cpp @@ -2,32 +2,176 @@ // Generated by dtk // Translation Unit: d_a_kytag05.cpp // +#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_ykgr.h" +#include "m_Do/m_Do_audio.h" +#include "d/d_procname.h" -#include "d_a_kytag05.h" -#include "dolphin/types.h" -/* 00000078-00000080 .text daKytag05_Draw__FP13kytag05_class */ -void daKytag05_Draw(kytag05_class*) { - /* Nonmatching */ +class kytag05_class : public fopAc_ac_c { +public: + /* 0x00 */ u8 mIndex; + /* 0x04 */ int field_0x294; + /* 0x08 */ int field_0x298; +}; /* size = 0x29C */ + +BOOL daKytag05_Draw(kytag05_class*) { + return true; } +static const s16 wind_table[] = { + 0, + 90, + 180, + 270 +}; + +static const s16 mufuu_timer[] = { + 0x0A, + 0xA, + 0x00, + 0x5A +}; + +static const s16 fuu_timer[] = { + 0x0096, + 0x0096, + 0x0096, + 0x0096, +}; + + /* 00000080-000003F4 .text daKytag05_Execute__FP13kytag05_class */ -void daKytag05_Execute(kytag05_class*) { - /* Nonmatching */ +int daKytag05_Execute(kytag05_class* a_this) { + /* Nonmatching - 92% matching */ + daPy_py_c *playerActor; + camera_class *mpCamera; + f32 cameraEyeZ; + f32 i_blend; + f32 windPow; + u32 demoField; + mpCamera = dComIfGp_getCamera(0); + playerActor = daPy_getPlayerActorClass(); + windPow = dKyw_get_wind_pow(); + i_blend = 1.0f; + + if (g_env_light.mWind.mEvtWindSet == 0xFF) { + return 1; + } + if (g_dComIfG_gameInfo.play.mEvtCtrl.mMode != 0 && + dComIfGp_getEventManager().startCheckOld("demo41") != 0 && + g_dComIfG_gameInfo.play.getDemo() != NULL) { + demoField = g_dComIfG_gameInfo.play.getDemo()->field_0xd4; + if(demoField >= 0x186) { + f32 fVar7 = ((f32)demoField - 390.0f) / 100.0f; + if(fVar7 > i_blend) { + fVar7 = 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->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->field_0x294 += 1; + } + } else { + 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->mIndex >> 1]); + a_this->field_0x294 = 0; + g_env_light.mWind.mEvtWindSet = 1; + } else { + a_this->field_0x294 += 1; + } + } + /* Numbers in this sections aren't necessarily right */ + cameraEyeZ = mpCamera->mLookat.mEye.z; + 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); + } else if(cameraEyeZ > 630.0f || playerActor->current.pos.z > 630.0f) { + dKyw_evt_wind_set(0, 0x4E20); + } else { + dKyw_evt_wind_set(0,0x4650); + } + } 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.x < 810 ) { + dKyw_evt_wind_set(0, -0x4B00); + } else if(mpCamera->mLookat.mEye.z < 900 || playerActor->current.pos.x < 900) { + dKyw_evt_wind_set(0, -0x32C8); + } + + mDoAud_seStart(0x106A, 0, (u32)(windPow * 180), 0); + return 1; } -/* 000003F4-000003FC .text daKytag05_IsDelete__FP13kytag05_class */ -void daKytag05_IsDelete(kytag05_class*) { - /* Nonmatching */ +BOOL daKytag05_IsDelete(kytag05_class*) { + return true; } -/* 000003FC-00000404 .text daKytag05_Delete__FP13kytag05_class */ -void daKytag05_Delete(kytag05_class*) { - /* Nonmatching */ +BOOL daKytag05_Delete(kytag05_class*) { + return true; } -/* 00000404-000004C0 .text daKytag05_Create__FP10fopAc_ac_c */ -void daKytag05_Create(fopAc_ac_c*) { - /* Nonmatching */ +int daKytag05_Create(fopAc_ac_c* i_this) { + fopAcM_SetupActor(i_this, kytag05_class); + kytag05_class *a_this = (kytag05_class*)i_this; + if (dComIfGs_isSymbol(1) != 0) { + return 3; + } + 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); + g_env_light.mSnowCount = 200; + g_env_light.mMoyaMode = 0; + g_env_light.mMoyaCount = 100; + + return 4; } +static actor_method_class l_daKytag05_Method = { + (process_method_func)daKytag05_Create, + (process_method_func)daKytag05_Delete, + (process_method_func)daKytag05_Execute, + (process_method_func)daKytag05_IsDelete, + (process_method_func)daKytag05_Draw, +}; + +extern actor_process_profile_definition g_profile_KYTAG06 = { + fpcLy_CURRENT_e, + 7, + fpcLy_CURRENT_e, + PROC_KYTAG05, + &g_fpcLf_Method.mBase, + sizeof(kytag05_class), + 0, + 0, + &g_fopAc_Method.base, + 0xA5, + &l_daKytag05_Method, + 0x00000044000, + fopAc_ACTOR_e, + fopAc_CULLBOX_0_e, +}; \ No newline at end of file diff --git a/src/d/actor/d_a_spotbox.cpp b/src/d/actor/d_a_spotbox.cpp index 3b8ca1699..ba8522bc1 100644 --- a/src/d/actor/d_a_spotbox.cpp +++ b/src/d/actor/d_a_spotbox.cpp @@ -52,7 +52,6 @@ u32 daSpotbox_c::getType() { return fopAcM_GetParam(this) & 1; } - /* 00000078-000000C4 .text daSpotbox_Draw__FP11daSpotbox_c */ static int daSpotbox_Draw(daSpotbox_c* i_this) { return ((daSpotbox_c*)i_this)->draw();