#include "CGameCubeDoll.hpp" #include "GameGlobalObjects.hpp" #include "CSimplePool.hpp" #include "Graphics/CBooRenderer.hpp" namespace urde::MP1 { CGameCubeDoll::CGameCubeDoll() { x0_model = g_SimplePool->GetObj("CMDL_GameCube"); x8_lights.push_back(CLight::BuildDirectional(zeus::CVector3f::skForward, zeus::CColor::skWhite)); x18_actorLights = std::make_unique(8, zeus::CVector3f::skZero, 4, 4, false, false, false, 0.1f); x20_24_loaded = false; } void CGameCubeDoll::UpdateActorLights() { x8_lights[0] = CLight::BuildDirectional( (zeus::CVector3f::skForward + zeus::CVector3f::skRight * 0.25f + zeus::CVector3f::skDown * 0.1f).normalized(), zeus::CColor::skWhite); x18_actorLights->BuildFakeLightList(x8_lights, zeus::CColor(0.25f, 1.f)); } void CGameCubeDoll::Update(float dt) { if (!CheckLoadComplete()) return; x1c_fader = std::min(2.f * dt + x1c_fader, 1.f); UpdateActorLights(); } void CGameCubeDoll::Draw(float alpha) { if (!IsLoaded()) return; g_Renderer->SetPerspective(55.f, g_Viewport.x8_width, g_Viewport.xc_height, 0.2f, 4096.f); CGraphics::SetViewPointMatrix(zeus::CTransform::Translate(0.f, -2.f, 0.f)); x18_actorLights->ActivateLights(x0_model->GetInstance()); CGraphics::SetModelMatrix(zeus::CTransform::RotateZ(zeus::degToRad(360.f * CGraphics::GetSecondsMod900() * -0.25f)) * zeus::CTransform::Scale(0.2f)); CModelFlags flags(5, 0, 3, zeus::CColor(1.f, alpha * x1c_fader)); x0_model->Draw(flags); } void CGameCubeDoll::Touch() { if (!CheckLoadComplete()) return; x0_model->Touch(0); } bool CGameCubeDoll::CheckLoadComplete() { if (IsLoaded()) return true; if (x0_model.IsLoaded()) { x20_24_loaded = true; return true; } return false; } } // namespace urde::MP1