metaforce/Runtime/World/CWorldTransManager.hpp

124 lines
3.7 KiB
C++
Raw Normal View History

2018-10-06 20:42:33 -07:00
#pragma once
2015-08-16 22:26:58 -07:00
#include <array>
#include <memory>
#include <vector>
#include "Runtime/CRandom16.hpp"
#include "Runtime/RetroTypes.hpp"
#include "Runtime/Audio/CSfxManager.hpp"
#include "Runtime/Camera/CCameraFilter.hpp"
#include "Runtime/Character/CModelData.hpp"
#include "Runtime/Graphics/CLight.hpp"
#include "Runtime/Graphics/Shaders/CCameraBlurFilter.hpp"
#include "Runtime/Graphics/Shaders/CColoredQuadFilter.hpp"
#include "Runtime/Graphics/Shaders/CTexturedQuadFilter.hpp"
#include "Runtime/GuiSys/CGuiTextSupport.hpp"
2020-04-19 18:09:30 -07:00
#include "Runtime/GuiSys/CStringTable.hpp"
#include <zeus/CTransform.hpp>
#include <zeus/CVector2f.hpp>
#include <zeus/CVector3f.hpp>
2021-04-10 01:42:06 -07:00
namespace metaforce {
2016-08-15 13:58:07 -07:00
class CSimplePool;
2018-12-07 21:30:43 -08:00
class CWorldTransManager {
2016-08-15 13:58:07 -07:00
public:
2018-12-07 21:30:43 -08:00
enum class ETransType { Disabled, Enabled, Text };
2016-08-15 13:58:07 -07:00
2018-12-07 21:30:43 -08:00
struct SModelDatas {
CAnimRes x0_samusRes;
CModelData x1c_samusModelData;
CModelData x68_beamModelData;
CModelData xb4_platformModelData;
std::array<CModelData, 3> x100_bgModelData;
2018-12-07 21:30:43 -08:00
TLockedToken<CModel> x14c_beamModel;
TLockedToken<CModel> x158_suitModel;
TLockedToken<CSkinRules> x164_suitSkin;
zeus::CTransform x170_gunXf;
std::vector<CLight> x1a0_lights;
// std::unique_ptr<u8> x1b0_dissolveTextureBuffer;
zeus::CVector2f x1b4_shakeResult;
zeus::CVector2f x1bc_shakeDelta;
float x1c4_randTimeout = 0.f;
float x1c8_blurResult = 0.f;
float x1cc_blurDelta = 0.f;
float x1d0_dissolveStartTime = 99999.f;
float x1d4_dissolveEndTime = 99999.f;
float x1d8_transCompleteTime = 99999.f;
bool x1dc_dissolveStarted = false;
2016-08-16 15:49:19 -07:00
explicit SModelDatas(const CAnimRes& samusRes);
2018-12-07 21:30:43 -08:00
};
2016-08-15 13:58:07 -07:00
private:
2018-12-07 21:30:43 -08:00
float x0_curTime = 0.f;
std::unique_ptr<SModelDatas> x4_modelData;
std::unique_ptr<CGuiTextSupport> x8_textData;
TLockedToken<CStringTable> xc_strTable;
u8 x14_ = 0;
float x18_bgOffset = 0.0f;
float x1c_bgHeight = 0.0f;
2018-12-07 21:30:43 -08:00
CRandom16 x20_random = CRandom16(99);
u16 x24_sfx = 1189;
CSfxHandle x28_sfxHandle;
u8 x2c_volume = 127;
u8 x2d_panning = 64;
ETransType x30_type = ETransType::Disabled;
float x34_stopTime = 0.0f;
2018-12-07 21:30:43 -08:00
float x38_textStartTime = 0.f;
float x3c_sfxInterval = 0.0f;
2022-02-05 07:22:30 -08:00
u32 x40_strIdx = 0;
bool x44_24_transFinished : 1 = true;
bool x44_25_stopSoon : 1 = false;
bool x44_26_goingUp : 1 = false;
bool x44_27_fadeWhite : 1 = false;
bool x44_28_textDirty : 1 = false;
2016-08-16 15:49:19 -07:00
2018-12-07 21:30:43 -08:00
static int GetSuitCharIdx();
2019-05-31 20:41:01 -07:00
void DrawFirstPass(CActorLights* lights);
void DrawSecondPass(CActorLights* lights);
void DrawPlatformModels(CActorLights* lights);
void DrawAllModels(CActorLights* lights);
2018-12-07 21:30:43 -08:00
void UpdateLights(float dt);
void UpdateEnabled(float);
void UpdateDisabled(float);
void UpdateText(float);
void DrawEnabled();
void DrawDisabled();
void DrawText();
2016-08-19 21:22:13 -07:00
public:
CWorldTransManager() = default;
2016-08-19 21:22:13 -07:00
2018-12-07 21:30:43 -08:00
void Update(float);
void Draw();
2018-12-07 21:30:43 -08:00
void EnableTransition(const CAnimRes& samusRes, CAssetId platRes, const zeus::CVector3f& platScale, CAssetId bgRes,
const zeus::CVector3f& bgScale, bool goingUp);
void EnableTransition(CAssetId fontId, CAssetId stringId, u32 strIdx, bool fadeWhite, float chFadeTime,
float chFadeRate, float textStartTime);
2016-08-15 13:58:07 -07:00
2018-12-07 21:30:43 -08:00
void StartTransition();
void EndTransition();
bool IsTransitionFinished() const { return x44_24_transFinished; }
void PleaseStopSoon() { x44_25_stopSoon = true; }
void StartTextFadeOut();
bool IsTransitionEnabled() const { return x30_type != ETransType::Disabled; }
void DisableTransition();
void TouchModels();
ETransType GetTransType() const { return x30_type; }
2018-12-07 21:30:43 -08:00
void SetSfx(u16 sfx, u8 volume, u8 panning) {
x24_sfx = sfx;
x2c_volume = volume;
x2d_panning = panning;
}
void SfxStart();
void SfxStop();
2017-02-11 19:17:18 -08:00
2018-12-07 21:30:43 -08:00
static bool WaitForModelsAndTextures();
2015-08-16 22:26:58 -07:00
};
2021-04-10 01:42:06 -07:00
} // namespace metaforce