From eabcab65a648d0524f58f77bb7fbfb4659ccee23 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Wed, 25 Oct 2023 20:15:43 -0700 Subject: [PATCH] dKyr_thunder_move --- include/d/d_kankyo.h | 10 +++- include/f_op/f_op_kankyo_mng.h | 3 +- src/d/d_kankyo_rain.cpp | 87 +++++++++++++++++++++++++++++++++- src/d/d_ky_thunder.cpp | 2 +- src/f_op/f_op_kankyo_mng.cpp | 3 +- 5 files changed, 97 insertions(+), 8 deletions(-) diff --git a/include/d/d_kankyo.h b/include/d/d_kankyo.h index 070ad3561..1a1133283 100644 --- a/include/d/d_kankyo.h +++ b/include/d/d_kankyo.h @@ -64,7 +64,7 @@ struct GB_WIND_INFLUENCE { struct EF_THUNDER { /* 0x00 */ u8 mStatus; - /* 0x01 */ u8 mStateTimer; + /* 0x01 */ u8 mState; /* 0x02 */ u8 field_0x2; /* 0x04 */ int mMode; /* 0x08 */ f32 mFlashTimer; @@ -392,14 +392,20 @@ void dKy_Sound_set(cXyz i_pos, int param_1, unsigned int i_actorID, int param_3) void dKy_itudemo_se(); void dKy_actor_addcol_set(s16, s16, s16, f32); void dKy_actor_addcol_amb_set(s16, s16, s16, f32); +void dKy_actor_addcol_dif_set(s16, s16, s16, f32); void dKy_bg_addcol_amb_set(s16, s16, s16, f32); void dKy_bg_addcol_dif_set(s16, s16, s16, f32); +void dKy_bg1_addcol_amb_set(s16, s16, s16, f32); +void dKy_bg1_addcol_dif_set(s16, s16, s16, f32); +void dKy_vrbox_addcol_sky0_set(s16, s16, s16, f32); +void dKy_vrbox_addcol_kasumi_set(s16, s16, s16, f32); +void dKy_vrbox_addcol_set(s16, s16, s16, f32); +void dKy_addcol_fog_set(s16, s16, s16, f32); void dKy_plight_set(LIGHT_INFLUENCE*); void dKy_efplight_set(LIGHT_INFLUENCE* param_0); void dKy_plight_cut(LIGHT_INFLUENCE* param_0); void dKy_efplight_cut(LIGHT_INFLUENCE* param_0); void dKy_fog_startendz_set(f32, f32, f32); -void dKy_vrbox_addcol_set(s16, s16, s16, f32); BOOL dKy_daynight_check(); void dKy_tevstr_init(dKy_tevstr_c*, s8, u8); void dKy_Sound_init(); diff --git a/include/f_op/f_op_kankyo_mng.h b/include/f_op/f_op_kankyo_mng.h index a721af482..17611e080 100644 --- a/include/f_op/f_op_kankyo_mng.h +++ b/include/f_op/f_op_kankyo_mng.h @@ -14,6 +14,7 @@ typedef int (*fopKyM_CreateFunc)(void*); void fopKyM_Delete(void* param_1); int fopKyM_Create(s16 param_1, fopKyM_CreateFunc param_2, void* param_3); +int fopKyM_create(s16 i_procName, int i_param, cXyz* i_pos, cXyz* i_scale, fopKyM_CreateFunc i_createFunc); base_process_class* fopKyM_fastCreate(s16 param_0, int param_1, cXyz* param_2, cXyz* param_3, fopKyM_CreateFunc); int fopKyM_createWpillar(cXyz const* i_pos, f32 scaleXZ, f32 scaleY, int i_param); @@ -22,4 +23,4 @@ inline void* fopKyM_GetAppend(void* param_0) { return fpcM_GetAppend(param_0); } -#endif \ No newline at end of file +#endif diff --git a/src/d/d_kankyo_rain.cpp b/src/d/d_kankyo_rain.cpp index 639030b2a..d5a84295a 100644 --- a/src/d/d_kankyo_rain.cpp +++ b/src/d/d_kankyo_rain.cpp @@ -9,8 +9,11 @@ #include "d/d_com_inf_game.h" #include "d/d_kankyo.h" #include "d/d_kankyo_wether.h" +#include "d/d_procname.h" #include "d/d_snap.h" #include "f_op/f_op_camera_mng.h" +#include "f_op/f_op_kankyo_mng.h" +#include "m_Do/m_Do_audio.h" #include "m_Do/m_Do_lib.h" #include "JSystem/JKernel/JKRHeap.h" @@ -1192,10 +1195,90 @@ void drawVrkumo(Mtx, GXColor&, u8**) { /* 8009B9C4-8009B9D8 .text dKyr_thunder_init__Fv */ void dKyr_thunder_init() { - g_env_light.mThunderEff.mStateTimer = 0; + g_env_light.mThunderEff.mState = 0; } /* 8009B9D8-8009BDEC .text dKyr_thunder_move__Fv */ void dKyr_thunder_move() { - /* Nonmatching */ + EF_THUNDER * pThunder = &g_env_light.mThunderEff; + camera_class * pCamera = dComIfGp_getCamera(0); + + switch (pThunder->mState) { + case 0: + { + pThunder->mFlashTimer = 0.0f; + pThunder->field_0xc = 0.0f; + pThunder->field_0x10 = 0.0f; + + if (cM_rndF(1.0f) < 0.007f) { + pThunder->mState = 11; + } else if (cM_rndF(1.0f) < 0.005f && g_env_light.mThunderEff.mMode < 10) { + pThunder->mLightInfluence.mPos.x = pCamera->mLookat.mEye.x; + pThunder->mLightInfluence.mPos.y = pCamera->mLookat.mEye.y; + pThunder->mLightInfluence.mPos.z = pCamera->mLookat.mEye.z; + pThunder->mLightInfluence.mColor.r = 0; + pThunder->mLightInfluence.mColor.g = 0; + pThunder->mLightInfluence.mColor.b = 0; + pThunder->mLightInfluence.mPower = 90000.0f; + pThunder->mLightInfluence.mFluctuation = 150.0f; + dKy_efplight_set(&pThunder->mLightInfluence); + pThunder->mState++; + } + } + break; + case 1: + case 11: + { + cLib_addCalc(&pThunder->mFlashTimer, 1.0f, 0.3f, 0.2f, 0.001f); + if (pThunder->mFlashTimer >= 1.0f) { + if (pThunder->mState < 10) + mDoAud_seStart(0x69f7, NULL, 0, 0); + pThunder->mState++; + } + + if (cM_rndF(1.0f) < 0.18f) + fopKyM_create(PROC_KY_THUNDER, -1, NULL, NULL, NULL); + } + break; + case 2: + case 12: + { + cLib_addCalc(&pThunder->mFlashTimer, 0.0f, 0.1f, 0.05f, 0.001f); + if (pThunder->mFlashTimer <= 0.0f) { + if (pThunder->mState < 10) + dKy_efplight_cut(&pThunder->mLightInfluence); + + pThunder->mState = 0; + if (g_env_light.mThunderEff.mMode == 0) + pThunder->mStatus = 0; + } + } + break; + } + + if (pThunder->mState != 0) { + if (pThunder->mState < 10) { + pThunder->mLightInfluence.mPos.x = pCamera->mLookat.mEye.x; + pThunder->mLightInfluence.mPos.y = pCamera->mLookat.mEye.y + 150.0f; + pThunder->mLightInfluence.mPos.z = pCamera->mLookat.mEye.z; + pThunder->mLightInfluence.mColor.r = (u8)(pThunder->mFlashTimer * 0.2f * 180.0f); + pThunder->mLightInfluence.mColor.g = (u8)(pThunder->mFlashTimer * 0.2f * 235.0f); + pThunder->mLightInfluence.mColor.b = (u8)(pThunder->mFlashTimer * 0.2f * 255.0f); + if (g_env_light.field_0xc98 == 0) { + dKy_actor_addcol_amb_set(0x5a, 0xa0, 0xf5, pThunder->mFlashTimer * 0.5f); + dKy_actor_addcol_dif_set(0x5a, 0xa0, 0xf5, pThunder->mFlashTimer * 0.5f); + dKy_bg_addcol_amb_set(0x32, 0x78, 0xff, pThunder->mFlashTimer * 0.7f); + dKy_bg_addcol_dif_set(0x32, 0x78, 0xff, pThunder->mFlashTimer * 0.7f); + dKy_bg1_addcol_amb_set(0x5a, 0xa0, 0xf5, pThunder->mFlashTimer * 0.35f); + dKy_bg1_addcol_dif_set(0x5a, 0xa0, 0xf5, pThunder->mFlashTimer * 0.35f); + dKy_vrbox_addcol_sky0_set(0x5a, 0xa0, 0xf5, pThunder->mFlashTimer * 0.4f); + dKy_vrbox_addcol_kasumi_set(0x5a, 0xa0, 0xf5, pThunder->mFlashTimer * 0.5f); + dKy_addcol_fog_set(0x5a, 0xa0, 0xf5, pThunder->mFlashTimer * 0.3f); + } + } else { + dKy_vrbox_addcol_sky0_set(0x5a,0xa0,0xf5,(pThunder->mFlashTimer * 0.15f)); + dKy_vrbox_addcol_kasumi_set(0x5a,0xa0,0xf5,(pThunder->mFlashTimer * 0.35f)); + dKy_addcol_fog_set(0x5a, 0xa0, 0xf5, pThunder->mFlashTimer * 0.12f); + } + } } diff --git a/src/d/d_ky_thunder.cpp b/src/d/d_ky_thunder.cpp index 4cc25c03c..61f06668b 100644 --- a/src/d/d_ky_thunder.cpp +++ b/src/d/d_ky_thunder.cpp @@ -152,7 +152,7 @@ s32 dThunder_c::create() { mBtkTime = cM_rndF(1.0f); - f32 size = g_env_light.mThunderEff.mStateTimer < 10 ? 1.0f : 0.5f; + f32 size = g_env_light.mThunderEff.mState < 10 ? 1.0f : 0.5f; mRot = 4000.0f; mRot = size * cM_rndFX(mRot); mScale.x = size * (cM_rndF(15.0f) + 5.0f); diff --git a/src/f_op/f_op_kankyo_mng.cpp b/src/f_op/f_op_kankyo_mng.cpp index c91869174..9e143bb0a 100644 --- a/src/f_op/f_op_kankyo_mng.cpp +++ b/src/f_op/f_op_kankyo_mng.cpp @@ -53,8 +53,7 @@ int fopKyM_Create(s16 i_procName, fopKyM_CreateFunc i_createFunc, void* i_proces } /* 8002A9D8-8002AA38 .text fopKyM_create__FsiP4cXyzP4cXyzPFPv_i */ -int fopKyM_create(s16 i_procName, int i_param, cXyz* i_pos, cXyz* i_scale, - fopKyM_CreateFunc i_createFunc) { +int fopKyM_create(s16 i_procName, int i_param, cXyz* i_pos, cXyz* i_scale, fopKyM_CreateFunc i_createFunc) { fopKyM_prm_class* params = createAppend(i_param, i_pos, i_scale); if (params == NULL) {