// // Generated by dtk // Translation Unit: d_ky_thunder.cpp // #include "d/d_ky_thunder.h" #include "f_op/f_op_kankyo.h" #include "f_op/f_op_kankyo_mng.h" #include "f_op/f_op_camera.h" #include "d/d_com_inf_game.h" #include "d/d_kankyo_rain.h" #include "d/d_procname.h" #include "JSystem/JKernel/JKRSolidHeap.h" #include "JSystem/J3DGraphAnimator/J3DModel.h" #include "SSystem/SComponent/c_phase.h" #include "m_Do/m_Do_audio.h" #include "m_Do/m_Do_ext.h" #include "m_Do/m_Do_mtx.h" dThunder_c::~dThunder_c() { mDoExt_destroySolidHeap(solid_heap); } BOOL dThunder_c::execute() { mModelInfo.mBrk.setPlaySpeed(1.0f); if (mModelInfo.mBrk.play()) { mDoAud_seStart(JA_SE_OBJ_THUNDER_FAR, &mPos); fopKyM_Delete(this); } return TRUE; } BOOL dThunder_c::draw() { static cXyz l_offsetPos(0.0f, 40.0f, -250.0f); mDoMtx_stack_c::transS(mPos); mDoMtx_stack_c::ZrotM(mRot); mDoMtx_stack_c::XrotM(mRot); Mtx m; MTXCopy(mDoMtx_stack_c::get(), m); mModelInfo.mpModel->setBaseScale(mScale); mModelInfo.mpModel->setBaseTRMtx(m); mModelInfo.mBtk.entry(mModelInfo.mpModel->getModelData(), mBtkTime); mModelInfo.mBrk.entry(mModelInfo.mpModel->getModelData()); dComIfGd_setList(); mDoExt_modelUpdateDL(mModelInfo.mpModel); mModelInfo.mInvisModel.entryMaskOff(); mModelInfo.mBtk.remove(mModelInfo.mpModel->getModelData()); mModelInfo.mBrk.remove(mModelInfo.mpModel->getModelData()); return TRUE; } /* 80198810-8019886C .text createHeap__10dThunder_cFv */ BOOL dThunder_c::createHeap() { if (solid_heap == NULL) { solid_heap = mDoExt_createSolidHeapFromGameToCurrent(0x4a0, 0x20); if (solid_heap == NULL) return FALSE; } return TRUE; } /* 8019886C-801988B8 .text adjustHeap__10dThunder_cFv */ void dThunder_c::adjustHeap() { mDoExt_restoreCurrentHeap(); if (mDoExt_adjustSolidHeap(solid_heap) >= 0) DCStoreRangeNoSync(solid_heap->getStartAddr(), solid_heap->getHeapSize()); } /* 801988B8-80198A38 .text dThunder_Draw__FP10dThunder_c */ static BOOL dThunder_Draw(dThunder_c* i_this) { return i_this->draw(); } /* 80198A38-80198AB4 .text dThunder_Execute__FP10dThunder_c */ static BOOL dThunder_Execute(dThunder_c* i_this) { return i_this->execute(); } /* 80198AB4-80198ABC .text dThunder_IsDelete__FP10dThunder_c */ static BOOL dThunder_IsDelete(dThunder_c* i_this) { return TRUE; } /* 80198ABC-80198B68 .text dThunder_Delete__FP10dThunder_c */ static BOOL dThunder_Delete(dThunder_c* i_this) { mDoAud_seDeleteObject(&i_this->mPos); mDoAud_seDeleteObject(&i_this->mPosNeg); i_this->~dThunder_c(); return TRUE; } /* 80198B68-80198BC4 .text dThunder_Create__FP12kankyo_class */ static cPhs_State dThunder_Create(kankyo_class* i_ky) { dThunder_c * i_this = (dThunder_c *)i_ky; if (!i_this->createHeap()) return cPhs_ERROR_e; cPhs_State ret = i_this->create(); i_this->adjustHeap(); return ret; } /* 80198BC4-801990CC .text create__10dThunder_cFv */ cPhs_State dThunder_c::create() { dScnKy_env_light_c& envLight = dKy_getEnvlight(); camera_class *pCamera = (camera_class*)dComIfGp_getCamera(0); new(this) dThunder_c(); J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("Always", ALWAYS_BDL_YTHDR00); JUT_ASSERT(0x6e, modelData != NULL); mModelInfo.mpModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x01000200); if (mModelInfo.mpModel == NULL) return cPhs_ERROR_e; if (!mModelInfo.mInvisModel.create(mModelInfo.mpModel)) return cPhs_ERROR_e; J3DAnmTextureSRTKey * anm = (J3DAnmTextureSRTKey *)dComIfG_getObjectRes("Always", ALWAYS_BTK_YTHDR00); JUT_ASSERT(0x7d, anm != NULL); if (!mModelInfo.mBtk.init(modelData, anm, false, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, false, 0)) return cPhs_ERROR_e; J3DAnmTevRegKey * canm = (J3DAnmTevRegKey *)dComIfG_getObjectRes("Always", ALWAYS_BRK_YTHDR00); JUT_ASSERT(0x8c, canm != NULL); if (!mModelInfo.mBrk.init(modelData, canm, true, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, false, 0)) return cPhs_ERROR_e; mBtkTime = cM_rndF(1.0f); f32 size = envLight.mThunderEff.mState < 10 ? 1.0f : 0.5f; cXyz fwd; cXyz offs(120000.0f, 2000.0f, 0.0f); mRot = 4000.0f; mRot = size * cM_rndFX(mRot); f32 f1 = cM_rndF(15.0f); mScale.x = size * (f1 + 5.0f); if (cM_rndFX(1.0f) >= 0.5) mScale.x *= -1.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); f32 distXZ = std::sqrtf(fwd.x * fwd.x + fwd.z * fwd.z); s16 rotX = cM_atan2s(fwd.x, fwd.z); s16 rotY = cM_atan2s(fwd.y, distXZ); if (cM_rndFX(1.0f) >= 0.0f) { rotX += 0x4000; } else { rotX -= 0x4000; } cXyz rot; rot.x = cM_scos(rotY) * cM_ssin(rotX); rot.z = cM_scos(rotY) * cM_scos(rotX); f32 baseXZ = cM_rndF(offs.x); mPos.x = pCamera->mLookat.mEye.x + fwd.x * 100000.0f + rot.x * baseXZ; mPos.y = pCamera->mLookat.mEye.y + cM_rndFX(offs.y); mPos.z = pCamera->mLookat.mEye.z + fwd.z * 100000.0f + rot.z * baseXZ; if (cM_rndF(1.0f) < 0.3f) { mPosNeg.x = -mPos.x; mPosNeg.y = -mPos.y; mPosNeg.z = -mPos.z; mDoAud_seStart(JA_SE_OBJ_THUNDER_FAR, &mPosNeg); } return cPhs_COMPLEATE_e; } kankyo_method_class l_dThunder_Method = { (process_method_func)dThunder_Create, (process_method_func)dThunder_Delete, (process_method_func)dThunder_Execute, (process_method_func)dThunder_IsDelete, (process_method_func)dThunder_Draw, }; kankyo_process_profile_definition g_profile_KY_THUNDER = { fpcLy_CURRENT_e, 7, fpcPi_CURRENT_e, PROC_KY_THUNDER, &g_fpcLf_Method.base, sizeof(dThunder_c), 0, 0, &g_fopKy_Method, 0x006, &l_dThunder_Method, };