diff options
| author | LagoLunatic <LagoLunatic@users.noreply.github.com> | 2023-11-02 05:58:13 -0400 |
|---|---|---|
| committer | LagoLunatic <LagoLunatic@users.noreply.github.com> | 2023-11-02 05:58:13 -0400 |
| commit | 41c125991666cad49f734f2fce2400d7a85bd638 (patch) | |
| tree | a208f6b6731f09299391c31b0077efd73d046254 /src/d/actor/d_a_vrbox.cpp | |
| parent | f3055e96e8fe66beace30df2367cee950172323e (diff) | |
d_a_vrbox OK
Diffstat (limited to 'src/d/actor/d_a_vrbox.cpp')
| -rw-r--r-- | src/d/actor/d_a_vrbox.cpp | 218 |
1 files changed, 190 insertions, 28 deletions
diff --git a/src/d/actor/d_a_vrbox.cpp b/src/d/actor/d_a_vrbox.cpp index 7190059e..a0785edd 100644 --- a/src/d/actor/d_a_vrbox.cpp +++ b/src/d/actor/d_a_vrbox.cpp @@ -3,56 +3,218 @@ // Translation Unit: d_a_vrbox.cpp // -#include "d_a_vrbox.h" -#include "dolphin/types.h" +#include "d/actor/d_a_vrbox.h" +#include "JSystem/JKernel/JKRHeap.h" +#include "JSystem/J3DGraphBase/J3DMatBlock.h" +#include "d/d_com_inf_game.h" +#include "d/d_procname.h" +#include "m_Do/m_Do_mtx.h" +#include "d/d_kankyo_wether.h" + +static BOOL daVrbox_color_set(vrbox_class* i_this); /* 8015E3F0-8015E530 .text daVrbox_Draw__FP11vrbox_class */ -void daVrbox_Draw(vrbox_class*) { - /* Nonmatching */ +static BOOL daVrbox_Draw(vrbox_class* i_this) { + J3DModel* model = i_this->mpModel; + f32 y_origin = 0.0f; + dStage_FileList_dt_c* fili = NULL; + + daVrbox_color_set(i_this); + + if (g_env_light.mbVrboxInvisible != 0) { + return TRUE; + } + + s32 roomNo = dComIfGp_roomControl_getStayNo(); + if (roomNo >= 0) { + fili = dComIfGp_roomControl_getStatusRoomDt(roomNo)->getFileListInfo(); + } + + if (fili) { + y_origin = fili->mSeaLevel; + } + + f32 y_offset; + if (dComIfGd_getView()) { + y_offset = (dComIfGd_getView()->mInvViewMtx[1][3] - y_origin) * 0.09f; + } else { + y_offset = 0.0f; + } + + mDoMtx_stack_c::transS( + dComIfGd_getView()->mInvViewMtx[0][3], + dComIfGd_getView()->mInvViewMtx[1][3] - y_offset, + dComIfGd_getView()->mInvViewMtx[2][3] + ); + + model->setBaseTRMtx(mDoMtx_stack_c::get()); + + dComIfGd_setListSky(); + mDoExt_modelUpdateDL(model); + dComIfGd_setList(); + + return TRUE; } /* 8015E530-8015E6B0 .text daVrbox_color_set__FP11vrbox_class */ -void daVrbox_color_set(vrbox_class*) { - /* Nonmatching */ -} - -/* 8015E6B0-8015E6B4 .text setTevKColor__11J3DTevBlockFUlPC10J3DGXColor */ -void J3DTevBlock::setTevKColor(unsigned long, const J3DGXColor*) { - /* Nonmatching */ -} - -/* 8015E6B4-8015E6B8 .text setCullMode__13J3DColorBlockFUc */ -void J3DColorBlock::setCullMode(unsigned char) { - /* Nonmatching */ +static BOOL daVrbox_color_set(vrbox_class* i_this) { + if (g_env_light.mVrKasumiMaeColor.r + g_env_light.mVrKasumiMaeColor.g + g_env_light.mVrKasumiMaeColor.b + + g_env_light.mVrSkyColor.r + g_env_light.mVrSkyColor.g + g_env_light.mVrSkyColor.b + + g_env_light.mVrkumoColor.r + g_env_light.mVrkumoColor.g + g_env_light.mVrkumoColor.b == 0) + { + g_env_light.mbVrboxInvisible = 1; + return TRUE; + } + + g_env_light.mbVrboxInvisible = 0; + + J3DModelData* modelData = i_this->mpModel->getModelData(); + J3DMaterial* mat = modelData->getMaterialNodePointer(0); + J3DGXColor color; + + mat->setCullMode(GX_CULL_NONE); + mat->change(); + color.mColor.r = g_env_light.mVrKasumiMaeColor.r; + color.mColor.g = g_env_light.mVrKasumiMaeColor.g; + color.mColor.b = g_env_light.mVrKasumiMaeColor.b; + color.mColor.a = 0xFF; + mat->setTevKColor(0, &color); + + mat = modelData->getMaterialNodePointer(1); + mat->setCullMode(GX_CULL_NONE); + mat->change(); + color.mColor.r = g_env_light.mVrSkyColor.r; + color.mColor.g = g_env_light.mVrSkyColor.g; + color.mColor.b = g_env_light.mVrSkyColor.b; + color.mColor.a = 0xFF; + mat->setTevKColor(0, &color); + + return TRUE; } /* 8015E6B8-8015E864 .text dungeon_rain_proc__Fv */ -void dungeon_rain_proc() { - /* Nonmatching */ +static void dungeon_rain_proc() { + dScnKy_env_light_c* env_light = &g_env_light; + u8 mode = 0; + int roomNo = dComIfGp_roomControl_getStayNo(); + + if (!dKy_checkEventNightStop()) { + return; + } + + bool inDungeon = true; + if (strcmp(dComIfGp_getStartStageName(), "M_NewD2") == 0) { + if (roomNo == 3) { + mode = 1; + } + } else if (strcmp(dComIfGp_getStartStageName(), "M_Dra09") == 0) { + mode = 1; + } else if (strcmp(dComIfGp_getStartStageName(), "kinMB") == 0) { + mode = 1; + } else if (strcmp(dComIfGp_getStartStageName(), "kindan") == 0) { + if (roomNo == 2 || roomNo == 13) { + mode = 1; + } else if (roomNo == 4) { + mode = 2; + } + } else { + inDungeon = false; + } + + if (inDungeon) { + if (mode == 1) { // Rain and thunder + if (env_light->mRainCountOrig != 250) { + dKy_change_colpat(1); + dKyw_rain_set(250); + g_env_light.mThunderEff.mMode = 1; + } + } else if (mode == 2) { // Thunder, but no rain + env_light = &g_env_light; + if (g_env_light.mThunderEff.mMode == 0) { + dKy_change_colpat(1); + env_light->mThunderEff.mMode = 0xA; + } + } else { // No rain or thunder + env_light = &g_env_light; + if (g_env_light.mThunderEff.mMode != 0) { + dKyw_rain_set(0); + env_light->mThunderEff.mMode = 0; + } + } + } } /* 8015E864-8015E888 .text daVrbox_Execute__FP11vrbox_class */ -void daVrbox_Execute(vrbox_class*) { - /* Nonmatching */ +static BOOL daVrbox_Execute(vrbox_class* i_this) { + dungeon_rain_proc(); + return TRUE; } /* 8015E888-8015E890 .text daVrbox_IsDelete__FP11vrbox_class */ -void daVrbox_IsDelete(vrbox_class*) { - /* Nonmatching */ +static BOOL daVrbox_IsDelete(vrbox_class* i_this) { + return TRUE; } /* 8015E890-8015E898 .text daVrbox_Delete__FP11vrbox_class */ -void daVrbox_Delete(vrbox_class*) { - /* Nonmatching */ +static BOOL daVrbox_Delete(vrbox_class* i_this) { + return TRUE; } /* 8015E898-8015E968 .text daVrbox_solidHeapCB__FP10fopAc_ac_c */ -void daVrbox_solidHeapCB(fopAc_ac_c*) { - /* Nonmatching */ +static BOOL daVrbox_solidHeapCB(fopAc_ac_c* i_actor) { + vrbox_class* i_this = static_cast<vrbox_class*>(i_actor); + + J3DModelData* modelData = (J3DModelData*)dComIfG_getStageRes("Stage", "vr_sky.bdl"); + JUT_ASSERT(469, modelData != 0); + + i_this->mpModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x11020202); + + bool success = FALSE; + if (modelData && i_this->mpModel) { + success = TRUE; + } + return success; } /* 8015E968-8015EA14 .text daVrbox_Create__FP10fopAc_ac_c */ -void daVrbox_Create(fopAc_ac_c*) { - /* Nonmatching */ +static s32 daVrbox_Create(fopAc_ac_c* i_actor) { + fopAcM_SetupActor(i_actor, vrbox_class); + vrbox_class* i_this = static_cast<vrbox_class*>(i_actor); + + i_this->m29C = 0; + + s32 phase_state = cPhs_COMPLEATE_e; + if (fopAcM_entrySolidHeap(i_this, (heapCallbackFunc)&daVrbox_solidHeapCB, 0xC60)) { + dComIfGp_onStatus(1); + g_env_light.mbVrboxInvisible = 0; + } else { + phase_state = cPhs_ERROR_e; + } + + return phase_state; } +actor_method_class l_daVrbox_Method = { + (process_method_func)daVrbox_Create, + (process_method_func)daVrbox_Delete, + (process_method_func)daVrbox_Execute, + (process_method_func)daVrbox_IsDelete, + (process_method_func)daVrbox_Draw, +}; + +actor_process_profile_definition g_profile_VRBOX = { + /* LayerID */ fpcLy_CURRENT_e, + /* ListID */ 7, + /* ListPrio */ fpcLy_CURRENT_e, + /* ProcName */ PROC_VRBOX, + /* Proc SubMtd */ &g_fpcLf_Method.mBase, + /* Size */ sizeof(vrbox_class), + /* SizeOther */ 0, + /* Parameters */ 0, + /* Leaf SubMtd */ &g_fopAc_Method.base, + /* Priority */ 0x0007, + /* Actor SubMtd */ &l_daVrbox_Method, + /* Status */ fopAcStts_UNK4000_e | fopAcStts_UNK40000_e, + /* Group */ fopAc_ACTOR_e, + /* CullType */ fopAc_CULLBOX_0_e, +}; |
