diff --git a/configure.py b/configure.py index 1b984bfcc..2e2daa6d8 100644 --- a/configure.py +++ b/configure.py @@ -453,7 +453,7 @@ config.libs = [ Object(NonMatching, "d/d_file_select.cpp"), Object(NonMatching, "d/d_gameover.cpp"), Object(NonMatching, "d/d_kankyo.cpp"), - Object(NonMatching, "d/d_kyeff.cpp"), + Object(Matching, "d/d_kyeff.cpp"), Object(Matching, "d/d_kyeff2.cpp"), Object(NonMatching, "d/d_ky_thunder.cpp"), Object(Matching, "d/d_letter.cpp"), @@ -1239,7 +1239,7 @@ config.libs = [ ActorRel(NonMatching, "d_a_ki"), ActorRel(NonMatching, "d_a_knob00"), ActorRel(NonMatching, "d_a_kui"), - ActorRel(NonMatching, "d_a_kytag00"), + ActorRel(Matching, "d_a_kytag00"), ActorRel(Matching, "d_a_kytag01"), ActorRel(NonMatching, "d_a_kytag02"), ActorRel(NonMatching, "d_a_kytag03"), diff --git a/src/d/actor/d_a_kytag00.cpp b/src/d/actor/d_a_kytag00.cpp index ac7c83acb..a143e3e31 100644 --- a/src/d/actor/d_a_kytag00.cpp +++ b/src/d/actor/d_a_kytag00.cpp @@ -17,10 +17,9 @@ /* 00000078-0000024C .text get_check_pos__FP13kytag00_class */ cXyz get_check_pos(kytag00_class* i_this) { - /* Nonmatching - regswap */ cXyz ret; - camera_class * pCamera = dComIfGp_getCamera(0); + camera_class * pCamera = (camera_class*)dComIfGp_getCamera(0); fopAc_ac_c * pPlayer = dComIfGp_getPlayer(0); f32 cameraDist = i_this->current.pos.abs(pCamera->mLookat.mEye); @@ -41,14 +40,105 @@ cXyz get_check_pos(kytag00_class* i_this) { /* 0000024C-000005E4 .text wether_tag_move__FP13kytag00_class */ void wether_tag_move(kytag00_class* i_this) { - /* Nonmatching */ + cXyz chk_pos_xz; cXyz chk_pos = get_check_pos(i_this); - cXyz chk_pos_xz(chk_pos.x, i_this->current.pos.y, chk_pos.z); f32 fade_y = i_this->mInnerFadeY * 100.0f; + chk_pos_xz.x = chk_pos.x; + chk_pos_xz.y = i_this->current.pos.y; + chk_pos_xz.z = chk_pos.z; f32 dist_xz = i_this->current.pos.abs(chk_pos_xz); - if (dist_xz <= i_this->mOuterRadius && (chk_pos.y > (i_this->current.pos.y - fade_y) && chk_pos.y < (i_this->current.pos.y + i_this->mScale.y * 5000.0f + fade_y)) && i_this->mTarget > 0.0f) { + if (dist_xz < i_this->mOuterRadius && + (chk_pos.y >= (i_this->current.pos.y - fade_y) && + chk_pos.y < (i_this->current.pos.y + i_this->mScale.y * 5000.0f + fade_y)) && + i_this->mTarget > 0.0f) + { + f32 blend = 1.0f; + f32 f9 = 1.0f; + f32 fade_radius = i_this->mOuterRadius - i_this->mInnerRadius; + if (fade_radius != 0.0f) { + blend = (i_this->mOuterRadius - dist_xz) / fade_radius; + if (blend > 1.0f) { + blend = 1.0f; + } + } + + if (chk_pos.y <= i_this->current.pos.y) { + if (fade_y != 0.0f) { + f9 = (i_this->current.pos.y - chk_pos.y) / fade_y; + if (f9 < 0.0f) { + f9 = 0.0f; + } + f9 = 1.0f - f9; + } + } else { + if (fade_y != 0.0f) { + f9 = (chk_pos.y - (i_this->current.pos.y + i_this->mScale.y * 5000.0f)) / fade_y; + if (f9 < 0.0f) { + f9 = 0.0f; + } + f9 = 1.0f - f9; + } + } + + blend *= f9 * i_this->mTarget; + + if (g_env_light.mEnvrIdxPrev != g_env_light.mEnvrIdxCurr) { + return; + } + i_this->mbPselSet = true; + + switch (i_this->mPselIdx) { + case 0: + g_env_light.mColpatPrevGather = g_env_light.mColpatWeather; + g_env_light.mColpatCurrGather = 0; + g_env_light.mColPatBlendGather = blend; + g_env_light.mColPatModeGather = 1; + break; + case 1: + if (blend > 0.5f) { + g_env_light.mColpatPrevGather = g_env_light.mColpatWeather; + g_env_light.mColpatCurrGather = 1; + g_env_light.mColPatBlendGather = blend; + } else { + blend = 1.0f - blend; + g_env_light.mColpatPrevGather = 1; + g_env_light.mColpatCurrGather = g_env_light.mColpatWeather; + g_env_light.mColPatBlendGather = blend; + } + g_env_light.mColPatModeGather = 1; + break; + case 2: + if (blend > 0.5f) { + g_env_light.mColpatPrevGather = g_env_light.mColpatWeather; + g_env_light.mColpatCurrGather = 2; + g_env_light.mColPatBlendGather = blend; + } else { + blend = 1.0f - blend; + g_env_light.mColpatPrevGather = 2; + g_env_light.mColpatCurrGather = g_env_light.mColpatWeather; + g_env_light.mColPatBlendGather = blend; + } + g_env_light.mColPatModeGather = 1; + break; + case 3: + if (blend > 0.5f) { + g_env_light.mColpatPrevGather = g_env_light.mColpatWeather; + g_env_light.mColpatCurrGather = 3; + g_env_light.mColPatBlendGather = blend; + } else { + blend = 1.0f - blend; + g_env_light.mColpatPrevGather = 3; + g_env_light.mColpatCurrGather = g_env_light.mColpatWeather; + g_env_light.mColPatBlendGather = blend; + } + g_env_light.mColPatModeGather = 1; + break; + default: + i_this->mbPselSet = false; + break; + } } else { if (i_this->mbPselSet) { i_this->mbPselSet = false; @@ -66,7 +156,7 @@ void raincnt_set(f32 count) { if (dKy_checkEventNightStop()) { s32 newCount2; - if (g_env_light.mRainCount > (newCount2 = (count * count * count) * 250.0f)) + if (g_env_light.mRainCount < (newCount2 = (count * count * count) * 250.0f)) newCount = newCount2; } else { newCount = (count * count * count) * 250.0f; @@ -84,7 +174,144 @@ void raincnt_cut() { /* 000006D8-00000C0C .text wether_tag_efect_move__FP13kytag00_class */ void wether_tag_efect_move(kytag00_class* i_this) { - /* Nonmatching */ + cXyz chk_pos_xz; + cXyz chk_pos = get_check_pos(i_this); + f32 fade_y = i_this->mInnerFadeY * 100.0f; + chk_pos_xz.x = chk_pos.x; + chk_pos_xz.y = i_this->current.pos.y; + chk_pos_xz.z = chk_pos.z; + f32 dist_xz = i_this->current.pos.abs(chk_pos_xz); + + if (dist_xz < i_this->mOuterRadius && + (chk_pos.y >= (i_this->current.pos.y - fade_y) && + chk_pos.y < (i_this->current.pos.y + i_this->mScale.y * 5000.0f + fade_y)) && + i_this->mTarget > 0.0f) + { + f32 blend = 1.0f; + f32 f9 = 1.0f; + + i_this->mbEfSet = 1; + + f32 fade_radius = i_this->mOuterRadius - i_this->mInnerRadius; + + if (fade_radius != 0.0f) { + blend = (i_this->mOuterRadius - dist_xz) / fade_radius; + if (blend > 1.0f) { + blend = 1.0f; + } + } + + if (chk_pos.y <= i_this->current.pos.y) { + if (fade_y != 0.0f) { + f9 = (i_this->current.pos.y - chk_pos.y) / fade_y; + if (f9 < 0.0f) { + f9 = 0.0f; + } + f9 = 1.0f - f9; + } + } else { + if (fade_y != 0.0f) { + f9 = (chk_pos.y - (i_this->current.pos.y + i_this->mScale.y * 5000.0f)) / fade_y; + if (f9 < 0.0f) { + f9 = 0.0f; + } + f9 = 1.0f - f9; + } + } + + blend *= f9 * i_this->mTarget; + + switch (i_this->mEfMode) { + case 0x1: + raincnt_set(blend); + break; + case 0x2: + g_env_light.mSnowCount = 250.0f * blend; + g_env_light.mMoyaMode = 2; + g_env_light.mMoyaCount = 100.0f * blend; + break; + case 0x3: + g_env_light.mMoyaMode = 0; + g_env_light.mMoyaCount = 100.0f * blend; + break; + case 0x4: + g_env_light.mMoyaMode = 1; + g_env_light.mMoyaCount = 100.0f * blend; + break; + case 0x5: + g_env_light.mMoyaMode = 2; + g_env_light.mMoyaCount = 100.0f * blend; + break; + case 0x6: + if (i_this->orig.roomNo == dComIfGp_roomControl_getStayNo()) { + g_env_light.mHousiCount = 300.0f * blend; + } else { + g_env_light.mHousiCount = 0; + } + break; + case 0x7: + if (g_env_light.mThunderEff.mMode == 0) { + g_env_light.mThunderEff.mMode = 2; + } + break; + case 0x8: + if (g_env_light.mThunderEff.mMode == 0) { + g_env_light.mThunderEff.mMode = 2; + } + raincnt_set(blend); + break; + case 0x9: + g_env_light.mMoyaMode = 0; + g_env_light.mMoyaCount = 100.0f * blend; + raincnt_set(blend); + if (g_env_light.mThunderEff.mMode == 0) { + g_env_light.mThunderEff.mMode = 2; + } + break; + case 0xA: + g_env_light.mMoyaMode = 3; + g_env_light.mMoyaCount = 100.0f * blend; + break; + case 0xB: + g_env_light.mMoyaMode = 4; + g_env_light.mMoyaCount = 100.0f * blend; + break; + } + } else if (i_this->mbEfSet != 0) { + i_this->mbEfSet = 0; + + switch (i_this->mEfMode) { + case 0x1: + raincnt_cut(); + break; + case 0x2: + g_env_light.mSnowCount = 0; + g_env_light.mMoyaCount = 0; + break; + case 0x3: + case 0x4: + case 0x5: + case 0xA: + g_env_light.mMoyaCount = 0; + break; + case 0x6: + g_env_light.mHousiCount = 0; + break; + case 0x7: + case 0x8: + case 0x9: + if (g_env_light.mThunderEff.mMode == 2) { + g_env_light.mThunderEff.mMode = 0; + } + if (i_this->mEfMode == 8 || i_this->mEfMode == 9) { + raincnt_cut(); + } + if (i_this->mEfMode == 9) { + g_env_light.mMoyaCount = 0; + } + break; + } + } } /* 00000C0C-00000C30 .text daKytag00_Draw__FP13kytag00_class */ @@ -131,10 +358,10 @@ static s32 daKytag00_Create(fopAc_ac_c* i_ac) { fopAcM_SetupActor(i_this, kytag00_class); i_this->field_0x296 = 0; - i_this->mPselIdx = (fopAcM_GetParam(i_this) >> 0) & 0xFF; - i_this->mEfMode = (fopAcM_GetParam(i_this) >> 8) & 0xFF; - i_this->mThickness = (fopAcM_GetParam(i_this) >> 16) & 0xFF; - i_this->mInnerFadeY = (fopAcM_GetParam(i_this) >> 24) & 0xFF; + i_this->mPselIdx = (fopAcM_GetParam(i_ac) >> 0) & 0xFF; + i_this->mEfMode = (fopAcM_GetParam(i_ac) >> 8) & 0xFF; + i_this->mThickness = (fopAcM_GetParam(i_ac) >> 16) & 0xFF; + i_this->mInnerFadeY = (fopAcM_GetParam(i_ac) >> 24) & 0xFF; i_this->mSwitchNo = (i_this->current.angle.x >> 0) & 0xFF; i_this->mbInvert = (i_this->current.angle.x >> 8) & 0xFF; i_this->mMode = (i_this->current.angle.z >> 0) & 0xFF; diff --git a/src/d/d_kankyo_rain.cpp b/src/d/d_kankyo_rain.cpp index 394eafc19..8cd2e6b85 100644 --- a/src/d/d_kankyo_rain.cpp +++ b/src/d/d_kankyo_rain.cpp @@ -381,8 +381,7 @@ void rain_bg_chk(dKankyo_rain_Packet* pPkt, int idx) { /* 8008D0DC-8008D53C .text overhead_bg_chk__Fv */ bool overhead_bg_chk() { - /* Nonmatching - regalloc */ - camera_class * pCamera = dComIfGp_getCamera(0); + camera_class * pCamera = (camera_class*)dComIfGp_getCamera(0); bool ret = false; dBgS_ObjGndChk_All gndChk; diff --git a/src/d/d_ky_thunder.cpp b/src/d/d_ky_thunder.cpp index b1f67226b..e36e6ac62 100644 --- a/src/d/d_ky_thunder.cpp +++ b/src/d/d_ky_thunder.cpp @@ -108,6 +108,7 @@ BOOL dThunder_IsDelete(dThunder_c* i_this) { /* 80198ABC-80198B68 .text dThunder_Delete__FP10dThunder_c */ BOOL dThunder_Delete(dThunder_c* i_this) { + /* Nonmatching */ mDoAud_seDeleteObject(&i_this->mPos); mDoAud_seDeleteObject(&i_this->mPosNeg); i_this->~dThunder_c(); @@ -127,9 +128,8 @@ s32 dThunder_Create(kankyo_class* i_ky) { /* 80198BC4-801990CC .text create__10dThunder_cFv */ s32 dThunder_c::create() { - /* Nonmatching - regalloc */ dScnKy_env_light_c& envLight = dKy_getEnvlight(); - camera_class *pCamera = dComIfGp_getCamera(0); + camera_class *pCamera = (camera_class*)dComIfGp_getCamera(0); new(this) dThunder_c(); J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("Always", ALWAYS_BDL_YTHDR00); @@ -160,10 +160,12 @@ s32 dThunder_c::create() { mRot = 4000.0f; mRot = size * cM_rndFX(mRot); - mScale.x = size * (cM_rndF(15.0f) + 5.0f); + f32 f1 = cM_rndF(15.0f); + mScale.x = size * (f1 + 5.0f); if (cM_rndFX(1.0f) >= 0.5) mScale.x *= -1.0f; - mScale.y = size * (cM_rndF(60.0f) + 20.0f); + f1 = cM_rndF(60.0f); + mScale.y = size * (f1 + 20.0f); mScale.z = 1.0f; dKyr_get_vectle_calc(&pCamera->mLookat.mEye, &pCamera->mLookat.mCenter, &fwd); @@ -205,7 +207,7 @@ kankyo_method_class l_dThunder_Method = { (process_method_func)dThunder_Draw, }; -kankyo_process_profile_definition g_profile_THUNDER = { +kankyo_process_profile_definition g_profile_KY_THUNDER = { fpcLy_CURRENT_e, 7, fpcPi_CURRENT_e, diff --git a/src/d/d_kyeff.cpp b/src/d/d_kyeff.cpp index c4bab4610..6dc42c96c 100644 --- a/src/d/d_kyeff.cpp +++ b/src/d/d_kyeff.cpp @@ -48,8 +48,10 @@ static s16 s16_data_ratio_set(s16 param_0, s16 param_1, f32 param_2) { /* 8019808C-8019847C .text menu_vrbox_set__Fv */ void menu_vrbox_set() { - /* Nonmatching - regalloc. */ f32 blendPalAB, curTime; + stage_vrbox_info_class* vrbox; + stage_vrbox_info_class* vrbox0; + stage_vrbox_info_class* vrbox1; camera_class * pCamera = dComIfGp_getCamera(0); @@ -72,7 +74,7 @@ void menu_vrbox_set() { g_env_light.mpSchejule = dKyd_schejule_menu_getp(); - u8 palIdx1, palIdx0; + u8 palIdx0, palIdx1; for (s32 i = 0; i < 11; i++) { if (curTime >= g_env_light.mpSchejule[i].mTimeEnd && curTime <= g_env_light.mpSchejule[i].mTimeBegin) { palIdx0 = g_env_light.mpSchejule[i].mPalIdx0; @@ -81,11 +83,11 @@ void menu_vrbox_set() { } } - stage_vrbox_info_class* vrbox = dKyd_dmvrbox_getp(); + vrbox = dKyd_dmvrbox_getp(); g_env_light.mpVrboxInfo = vrbox; - stage_vrbox_info_class* vrbox0 = &vrbox[palIdx0]; - stage_vrbox_info_class* vrbox1 = &vrbox[palIdx1]; + vrbox0 = &vrbox[palIdx0]; + vrbox1 = &vrbox[palIdx1]; g_env_light.mVrSkyColor.r = s16_data_ratio_set(vrbox0->mSkyColor.r, vrbox1->mSkyColor.r, blendPalAB); g_env_light.mVrSkyColor.g = s16_data_ratio_set(vrbox0->mSkyColor.g, vrbox1->mSkyColor.g, blendPalAB); g_env_light.mVrSkyColor.b = s16_data_ratio_set(vrbox0->mSkyColor.b, vrbox1->mSkyColor.b, blendPalAB);