Finish CPauseScreenBlur; work on CPlayerVisor

This commit is contained in:
Jack Andersen 2017-05-29 09:55:44 -10:00
parent 5f5c1ce2f1
commit d14dc8f7a8
14 changed files with 544 additions and 42 deletions

View File

@ -28,6 +28,7 @@ struct ITweakGui : ITweak
};
virtual float GetMapAlphaInterpolant() const=0;
virtual float GetPauseBlurFactor() const=0;
virtual float GetRadarXYRadius() const=0;
virtual float GetRadarZRadius() const=0;
virtual float GetRadarZCloseRadius() const=0;
@ -101,6 +102,11 @@ struct ITweakGui : ITweak
virtual float GetScanPaneFadeInTime() const=0;
virtual float GetScanPaneFadeOutTime() const=0;
virtual float GetBallViewportYReduction() const=0;
virtual float GetScanWindowIdleWidth() const=0;
virtual float GetScanWindowIdleHeight() const=0;
virtual float GetScanWindowActiveWidth() const=0;
virtual float GetScanWindowActiveHeight() const=0;
virtual float GetScanWindowMagnification() const=0;
virtual float GetScanSpeed(int idx) const=0;
virtual float GetXrayBlurScaleLinear() const=0;
virtual float GetXrayBlurScaleQuadratic() const=0;

View File

@ -22,7 +22,7 @@ struct ITweakGuiColors : BigYAML
const zeus::CColor& shadow;
};
virtual const zeus::CColor& GetInvPhazonSuitFilterMod() const=0;
virtual const zeus::CColor& GetPauseBlurFilterColor() const=0;
virtual const zeus::CColor& GetRadarStuffColor() const=0;
virtual const zeus::CColor& GetRadarPlayerPaintColor() const=0;
virtual const zeus::CColor& GetRadarEnemyPaintColor() const=0;
@ -63,6 +63,7 @@ struct ITweakGuiColors : BigYAML
virtual const zeus::CColor& GetMissileWarningOutline() const=0;
virtual const zeus::CColor& GetDamageAmbientColor() const=0;
virtual const zeus::CColor& GetScanVisorHudLightMultiply() const=0;
virtual const zeus::CColor& GetScanVisorScreenDimColor() const=0;
virtual const zeus::CColor& GetThermalVisorHudLightMultiply() const=0;
virtual const zeus::CColor& GetEnergyDrainFilterColor() const=0;
virtual const zeus::CColor& GetDamageAmbientPulseColor() const=0;

View File

@ -12,7 +12,7 @@ struct CTweakGui : ITweakGui
DECL_YAML
Value<bool> x4_;
Value<float> x8_mapAlphaInterp;
Value<float> xc_;
Value<float> xc_pauseBlurFactor;
Value<float> x10_radarXYRadius;
Value<float> x14_;
Value<float> x18_;
@ -141,11 +141,11 @@ struct CTweakGui : ITweakGui
Value<float> x24c_scanPaneFadeInTime;
Value<float> x250_scanPaneFadeOutTime;
Value<float> x254_ballViewportYReduction;
Value<float> x258_;
Value<float> x25c_;
Value<float> x260_;
Value<float> x264_;
Value<float> x268_;
Value<float> x258_scanWindowIdleW;
Value<float> x25c_scanWindowIdleH;
Value<float> x260_scanWindowActiveW;
Value<float> x264_scanWindowActiveH;
Value<float> x268_scanWindowMagnification;
Value<float> x26c_;
Value<float> x270_scanSidesPositionStart;
Value<bool> x274_showAutomapperInMorphball;
@ -190,6 +190,7 @@ struct CTweakGui : ITweakGui
CTweakGui(athena::io::IStreamReader& r) { this->read(r); }
float GetMapAlphaInterpolant() const { return x8_mapAlphaInterp; }
float GetPauseBlurFactor() const { return xc_pauseBlurFactor; }
float GetRadarXYRadius() const { return x10_radarXYRadius; }
float GetRadarZRadius() const { return x24_radarZRadius; }
float GetRadarZCloseRadius() const { return x28_radarZCloseRadius; }
@ -277,6 +278,11 @@ struct CTweakGui : ITweakGui
float GetScanPaneFadeInTime() const { return x24c_scanPaneFadeInTime; }
float GetScanPaneFadeOutTime() const { return x250_scanPaneFadeOutTime; }
float GetBallViewportYReduction() const { return x254_ballViewportYReduction; }
float GetScanWindowIdleWidth() const { return x258_scanWindowIdleW; }
float GetScanWindowIdleHeight() const { return x25c_scanWindowIdleH; }
float GetScanWindowActiveWidth() const { return x260_scanWindowActiveW; }
float GetScanWindowActiveHeight() const { return x264_scanWindowActiveH; }
float GetScanWindowMagnification() const { return x268_scanWindowMagnification; }
float GetScanSidesPositionStart() const { return x270_scanSidesPositionStart; }
bool GetShowAutomapperInMorphball() const { return x274_showAutomapperInMorphball; }
bool GetLatchArticleText() const { return x275_latchArticleText; }

View File

@ -10,7 +10,7 @@ namespace DNAMP1
struct CTweakGuiColors : public ITweakGuiColors
{
DECL_YAML
DNAColor x4_invPhazonSuitFilterMod;
DNAColor x4_pauseBlurFilterColor;
DNAColor x8_radarStuffColor;
DNAColor xc_radarPlayerPaintColor;
DNAColor x10_radarEnemyPaintColor;
@ -63,7 +63,7 @@ struct CTweakGuiColors : public ITweakGuiColors
DNAColor xcc_;
DNAColor xd0_;
DNAColor xd4_scanVisorHudLightMultiply;
DNAColor xd8_;
DNAColor xd8_scanVisorScreenDimColor;
DNAColor xdc_thermalVisorHudLightMultiply;
DNAColor xe0_energyDrainFilterColor;
DNAColor xe4_damageAmbientPulseColor;
@ -140,7 +140,7 @@ struct CTweakGuiColors : public ITweakGuiColors
CTweakGuiColors() = default;
CTweakGuiColors(athena::io::IStreamReader& r) { this->read(r); }
const zeus::CColor& GetInvPhazonSuitFilterMod() const { return x4_invPhazonSuitFilterMod; }
const zeus::CColor& GetPauseBlurFilterColor() const { return x4_pauseBlurFilterColor; }
const zeus::CColor& GetRadarStuffColor() const { return x8_radarStuffColor; }
const zeus::CColor& GetRadarPlayerPaintColor() const { return xc_radarPlayerPaintColor; }
const zeus::CColor& GetRadarEnemyPaintColor() const { return x10_radarEnemyPaintColor; }
@ -181,6 +181,7 @@ struct CTweakGuiColors : public ITweakGuiColors
const zeus::CColor& GetMissileWarningOutline() const { return xbc_missileWarningOutline; }
const zeus::CColor& GetDamageAmbientColor() const { return xc4_damageAmbientColor; }
const zeus::CColor& GetScanVisorHudLightMultiply() const { return xd4_scanVisorHudLightMultiply; }
const zeus::CColor& GetScanVisorScreenDimColor() const { return xd8_scanVisorScreenDimColor; }
const zeus::CColor& GetThermalVisorHudLightMultiply() const { return xdc_thermalVisorHudLightMultiply; }
const zeus::CColor& GetEnergyDrainFilterColor() const { return xe0_energyDrainFilterColor; }
const zeus::CColor& GetDamageAmbientPulseColor() const { return xe4_damageAmbientPulseColor; }

View File

@ -231,7 +231,7 @@ struct SpecMP2 : SpecBase
int prog = 0;
ctx.progressCB = [&](const std::string& name, float) {
hecl::SystemStringView nameView(name);
progress(_S("MP2 Root"), nameView.c_str(), 3, prog / (float)m_nonPaks.size());
progress(_S("MP2 Root"), nameView.c_str(), 3, prog);
};
for (const nod::Node* node : m_nonPaks)
{

View File

@ -74,6 +74,7 @@ public:
void Update(float dt);
void SetBlur(EBlurType type, float amount, float duration);
void DisableBlur(float duration);
EBlurType GetCurrType() const { return x10_curType; }
};
}

View File

@ -122,7 +122,7 @@ void CInGameGuiManager::EnsureStates(CStateManager& stateMgr)
{
if (x1f8_26_deferTransition)
{
if (!x3c_pauseScreenBlur->GetX50_25())
if (!x3c_pauseScreenBlur->IsGameDraw())
{
DestroyAreaTextures(stateMgr);
x1f8_26_deferTransition = false;
@ -593,7 +593,7 @@ void CInGameGuiManager::Draw(CStateManager& stateMgr)
if (notInCine && (x1bc_prevState == EInGameGuiState::InGame || x1c0_nextState == EInGameGuiState::InGame))
drawVisor = true;
if (x3c_pauseScreenBlur->GetX50_25())
if (x3c_pauseScreenBlur->IsGameDraw())
{
x34_samusHud->GetTargetingManager().Draw(stateMgr, true);
CGraphics::SetDepthRange(0.015625f, 0.03125f);
@ -631,7 +631,7 @@ void CInGameGuiManager::Draw(CStateManager& stateMgr)
x3c_pauseScreenBlur->Draw(stateMgr);
if (notInCine && x1e8_enableAutoMapper &&
(x3c_pauseScreenBlur->GetX50_25() || x1bc_prevState == EInGameGuiState::MapScreen ||
(x3c_pauseScreenBlur->IsGameDraw() || x1bc_prevState == EInGameGuiState::MapScreen ||
x1c0_nextState == EInGameGuiState::MapScreen))
{
float t;
@ -754,7 +754,7 @@ void CInGameGuiManager::StartFadeIn()
bool CInGameGuiManager::GetIsGameDraw() const
{
return x3c_pauseScreenBlur->GetX50_25();
return x3c_pauseScreenBlur->IsGameDraw();
}
}

View File

@ -1,4 +1,7 @@
#include "CPauseScreenBlur.hpp"
#include "CSimplePool.hpp"
#include "GameGlobalObjects.hpp"
#include "Audio/CSfxManager.hpp"
namespace urde
{
@ -7,27 +10,117 @@ namespace MP1
CPauseScreenBlur::CPauseScreenBlur()
{
}
bool CPauseScreenBlur::CheckLoadComplete()
{
return false;
x4_mapLightQuarter = g_SimplePool->GetObj("TXTR_MapLightQuarter");
x50_25_gameDraw = true;
}
void CPauseScreenBlur::OnNewInGameGuiState(EInGameGuiState state, CStateManager& stateMgr)
{
switch (state)
{
case EInGameGuiState::Zero:
case EInGameGuiState::InGame:
SetState(EState::InGame);
break;
case EInGameGuiState::MapScreen:
SetState(EState::MapScreen);
break;
case EInGameGuiState::PauseSaveGame:
SetState(EState::SaveGame);
break;
case EInGameGuiState::PauseHUDMessage:
SetState(EState::HUDMessage);
break;
case EInGameGuiState::PauseGame:
case EInGameGuiState::PauseLogBook:
SetState(EState::Pause);
break;
default: break;
}
}
void CPauseScreenBlur::Update(float dt, const CStateManager& stateMgr, bool)
void CPauseScreenBlur::SetState(EState state)
{
if (x10_prevState == EState::InGame && state != EState::InGame)
{
CSfxManager::SetChannel(CSfxManager::ESfxChannels::PauseScreen);
if (state == EState::HUDMessage)
CSfxManager::SfxStart(1415, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
else if (state == EState::MapScreen)
CSfxManager::SfxStart(1378, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
x18_blurAmt = FLT_EPSILON;
}
if (state == EState::InGame && (x10_prevState != EState::InGame || x14_nextState != EState::InGame))
{
CSfxManager::SetChannel(CSfxManager::ESfxChannels::Game);
if (x10_prevState == EState::HUDMessage)
CSfxManager::SfxStart(1416, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
else if (x10_prevState == EState::MapScreen)
CSfxManager::SfxStart(1380, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
x18_blurAmt = -1.f;
}
x14_nextState = state;
}
void CPauseScreenBlur::Draw(const CStateManager& stateMgr) const
void CPauseScreenBlur::OnBlurComplete(bool b)
{
if (x14_nextState == EState::InGame && !b)
return;
x10_prevState = x14_nextState;
if (x10_prevState == EState::InGame)
x50_25_gameDraw = true;
}
void CPauseScreenBlur::Update(float dt, const CStateManager& stateMgr, bool b)
{
if (x10_prevState == x14_nextState)
return;
if (x18_blurAmt < 0.f)
x18_blurAmt = std::min(0.f, 2.f * dt + x18_blurAmt);
else
x18_blurAmt = std::min(1.f, 2.f * dt + x18_blurAmt);
if (x18_blurAmt == 0.f || x18_blurAmt == 1.f)
OnBlurComplete(b);
if (x18_blurAmt == 0.f && b)
{
x1c_camBlur.DisableBlur(0.f);
}
else
{
x1c_camBlur.SetBlur(CCameraBlurPass::EBlurType::HiBlur,
g_tweakGui->GetPauseBlurFactor() * std::fabs(x18_blurAmt), 0.f);
x50_24_blurring = true;
}
}
void CPauseScreenBlur::Draw(const CStateManager&) const
{
const_cast<CCameraBlurPass&>(x1c_camBlur).Draw();
float t = std::fabs(x18_blurAmt);
if (x1c_camBlur.GetCurrType() != CCameraBlurPass::EBlurType::NoBlur)
{
zeus::CColor filterColor =
zeus::CColor::lerp(zeus::CColor::skWhite, g_tweakGuiColors->GetPauseBlurFilterColor(), t);
CCameraFilterPass::DrawFilter(CCameraFilterPass::EFilterType::Multiply,
CCameraFilterPass::EFilterShape::FullscreenQuarters,
filterColor, x4_mapLightQuarter.GetObj(), t);
zeus::CColor scanLinesColor =
zeus::CColor::lerp(zeus::CColor::skWhite, zeus::CColor(0.75f, 1.f), t);
CCameraFilterPass::DrawFilter(CCameraFilterPass::EFilterType::Multiply,
CCameraFilterPass::EFilterShape::ScanLinesEven,
scanLinesColor, nullptr, t);
}
if (x50_24_blurring /*&& x1c_camBlur.x2d_noPersistentCopy*/)
{
const_cast<CPauseScreenBlur*>(this)->x50_24_blurring = false;
const_cast<CPauseScreenBlur*>(this)->x50_25_gameDraw = false;
}
}
}

View File

@ -2,36 +2,54 @@
#define __URDE_CPAUSESCREENBLUR_HPP__
#include "CInGameGuiManagerCommon.hpp"
#include "CToken.hpp"
#include "Camera/CCameraFilter.hpp"
namespace urde
{
class CStateManager;
class CTexture;
namespace MP1
{
class CPauseScreenBlur
{
u32 x10_ = 0;
u32 x14_ = 0;
enum class EState
{
InGame,
MapScreen,
SaveGame,
HUDMessage,
Pause
};
TLockedToken<CTexture> x4_mapLightQuarter;
EState x10_prevState = EState::InGame;
EState x14_nextState = EState::InGame;
float x18_blurAmt = 0.f;
CCameraBlurPass x1c_camBlur;
union
{
struct
{
bool x50_24_ : 1;
bool x50_25_ : 1;
bool x50_24_blurring : 1;
bool x50_25_gameDraw : 1;
};
u32 _dummy = 0;
};
void OnBlurComplete(bool);
void SetState(EState state);
public:
CPauseScreenBlur();
bool CheckLoadComplete();
void OnNewInGameGuiState(EInGameGuiState state, CStateManager& stateMgr);
bool GetX50_25() const { return x50_25_; }
bool IsGameDraw() const { return x50_25_gameDraw; }
void Update(float dt, const CStateManager& stateMgr, bool);
void Draw(const CStateManager& stateMgr) const;
float GetBlurAmt() const { return std::fabs(x18_blurAmt); }
bool IsNotTransitioning() const { return x10_ == x14_; }
bool IsNotTransitioning() const { return x10_prevState == x14_nextState; }
};
}

View File

@ -1,38 +1,339 @@
#include "CPlayerVisor.hpp"
#include "CSimplePool.hpp"
#include "GameGlobalObjects.hpp"
#include "Graphics/CModel.hpp"
#include "CStateManager.hpp"
#include "World/CPlayer.hpp"
namespace urde
{
namespace MP1
{
CPlayerVisor::CPlayerVisor(CStateManager& stateMgr)
CPlayerVisor::CPlayerVisor(CStateManager&)
{
x25_24_visorTransitioning = false;
x25_25_ = false;
xcc_scanFrameCorner = g_SimplePool->GetObj("CMDL_ScanFrameCorner");
xd8_scanFrameCenterSide = g_SimplePool->GetObj("CMDL_ScanFrameCenterSide");
xe4_scanFrameCenterTop = g_SimplePool->GetObj("CMDL_ScanFrameCenterTop");
xf0_scanFrameStretchSide = g_SimplePool->GetObj("CMDL_ScanFrameStretchSide");
xfc_scanFrameStretchTop = g_SimplePool->GetObj("CMDL_ScanFrameStretchTop");
x108_newScanPane = g_SimplePool->GetObj("CMDL_NewScanPane");
x114_scanShield = g_SimplePool->GetObj("CMDL_ScanShield");
x124_scanIconNoncritical = g_SimplePool->GetObj("CMDL_ScanIconNoncritical");
x130_scanIconCritical = g_SimplePool->GetObj("CMDL_ScanIconCritical");
x13c_scanTargets.resize(64);
x540_xrayPalette = g_SimplePool->GetObj("TXTR_XRayPalette");
x0_scanWindowSizes.push_back({});
x0_scanWindowSizes.push_back({g_tweakGui->GetScanWindowIdleWidth(), g_tweakGui->GetScanWindowIdleHeight()});
x0_scanWindowSizes.push_back({g_tweakGui->GetScanWindowActiveWidth(), g_tweakGui->GetScanWindowActiveHeight()});
}
CPlayerVisor::~CPlayerVisor()
{
CSfxManager::SfxStop(x5c_visorLoopSfx);
CSfxManager::SfxStop(x60_);
}
int CPlayerVisor::FindEmptyInactiveScanTarget() const
{
for (int i=0 ; i<x13c_scanTargets.size() ; ++i)
{
const SScanTarget& tgt = x13c_scanTargets[i];
if (tgt.x4_ == 0.f)
return i;
}
return -1;
}
int CPlayerVisor::FindCachedInactiveScanTarget(TUniqueId uid) const
{
for (int i=0 ; i<x13c_scanTargets.size() ; ++i)
{
const SScanTarget& tgt = x13c_scanTargets[i];
if (tgt.x0_objId == uid && tgt.x4_ > 0.f)
return i;
}
return -1;
}
void CPlayerVisor::DrawScanObjectIndicators(const CStateManager& mgr) const
{
}
void CPlayerVisor::Update(float dt, const CStateManager& stateMgr)
void CPlayerVisor::UpdateScanObjectIndicators(const CStateManager& mgr)
{
}
void CPlayerVisor::Draw(const CStateManager& stateMgr, const CTargetingManager* tgtManager) const
void CPlayerVisor::UpdateScanWindow(float dt, const CStateManager& mgr)
{
}
CPlayerVisor::EScanWindowState
CPlayerVisor::GetDesiredScanWindowState(const CStateManager& mgr) const
{
if (mgr.GetPlayerState()->GetCurrentVisor() == CPlayerState::EPlayerVisor::Scan)
{
switch (mgr.GetPlayer().GetScanningState())
{
case CPlayer::EPlayerScanState::Scanning:
case CPlayer::EPlayerScanState::ScanComplete:
return EScanWindowState::Scan;
default:
return EScanWindowState::Idle;
}
}
return EScanWindowState::NotInScanVisor;
}
void CPlayerVisor::LockUnlockAssets()
{
}
void CPlayerVisor::DrawScanEffect(const CStateManager& mgr, const CTargetingManager* tgtMgr) const
{
}
void CPlayerVisor::DrawXRayEffect(const CStateManager&) const
{
const_cast<CCameraBlurPass&>(x90_xrayBlur).Draw();
}
void CPlayerVisor::DrawThermalEffect(const CStateManager&) const
{
// Empty
}
void CPlayerVisor::UpdateCurrentVisor(float transFactor)
{
switch (x1c_curVisor)
{
case CPlayerState::EPlayerVisor::XRay:
x90_xrayBlur.SetBlur(CCameraBlurPass::EBlurType::Xray, 36.f * transFactor, 0.f);
break;
case CPlayerState::EPlayerVisor::Scan:
{
zeus::CColor dimColor = zeus::CColor::lerp(g_tweakGuiColors->GetScanVisorHudLightMultiply(),
zeus::CColor::skWhite, 1.f - transFactor);
x64_scanDim.SetFilter(CCameraFilterPass::EFilterType::Multiply,
CCameraFilterPass::EFilterShape::Fullscreen,
0.f, dimColor, -1);
break;
}
default: break;
}
}
void CPlayerVisor::FinishTransitionIn()
{
switch (x1c_curVisor)
{
case CPlayerState::EPlayerVisor::Combat:
x90_xrayBlur.DisableBlur(0.f);
break;
case CPlayerState::EPlayerVisor::XRay:
x90_xrayBlur.SetBlur(CCameraBlurPass::EBlurType::Xray, 36.f, 0.f);
if (!x5c_visorLoopSfx)
x5c_visorLoopSfx = CSfxManager::SfxStart(1384, x24_visorSfxVol, 0.f, false, 0x7f, true, kInvalidAreaId);
break;
case CPlayerState::EPlayerVisor::Scan:
{
zeus::CColor dimColor = zeus::CColor::lerp(g_tweakGuiColors->GetScanVisorScreenDimColor(),
g_tweakGuiColors->GetScanVisorHudLightMultiply(),
x2c_scanDimInterp);
x64_scanDim.SetFilter(CCameraFilterPass::EFilterType::Multiply,
CCameraFilterPass::EFilterShape::Fullscreen,
0.f, dimColor, -1);
if (!x5c_visorLoopSfx)
x5c_visorLoopSfx = CSfxManager::SfxStart(1404, x24_visorSfxVol, 0.f, false, 0x7f, true, kInvalidAreaId);
break;
}
case CPlayerState::EPlayerVisor::Thermal:
if (!x5c_visorLoopSfx)
x5c_visorLoopSfx = CSfxManager::SfxStart(1388, x24_visorSfxVol, 0.f, false, 0x7f, true, kInvalidAreaId);
break;
default: break;
}
}
void CPlayerVisor::BeginTransitionIn(const CStateManager&)
{
switch (x1c_curVisor)
{
case CPlayerState::EPlayerVisor::XRay:
x90_xrayBlur.SetBlur(CCameraBlurPass::EBlurType::Xray, 0.f, 0.f);
xc4_vpScaleX = 0.9f;
xc8_vpScaleY = 0.9f;
CSfxManager::SfxStart(1383, x24_visorSfxVol, 0.f, false, 0x7f, false, kInvalidAreaId);
break;
case CPlayerState::EPlayerVisor::Scan:
CSfxManager::SfxStart(1383, x24_visorSfxVol, 0.f, false, 0x7f, false, kInvalidAreaId);
x64_scanDim.SetFilter(CCameraFilterPass::EFilterType::Multiply,
CCameraFilterPass::EFilterShape::Fullscreen,
0.f, zeus::CColor::skWhite, -1);
break;
case CPlayerState::EPlayerVisor::Thermal:
CSfxManager::SfxStart(1383, x24_visorSfxVol, 0.f, false, 0x7f, false, kInvalidAreaId);
break;
default: break;
}
}
void CPlayerVisor::FinishTransitionOut(const CStateManager&)
{
switch (x1c_curVisor)
{
case CPlayerState::EPlayerVisor::XRay:
x90_xrayBlur.DisableBlur(0.f);
xc4_vpScaleX = 1.f;
xc8_vpScaleY = 1.f;
break;
case CPlayerState::EPlayerVisor::Scan:
x64_scanDim.DisableFilter(0.f);
x34_ = 0;
x30_ = 0;
break;
case CPlayerState::EPlayerVisor::Thermal:
x90_xrayBlur.DisableBlur(0.f);
break;
default: break;
}
}
void CPlayerVisor::BeginTransitionOut()
{
if (x5c_visorLoopSfx)
{
CSfxManager::SfxStop(x5c_visorLoopSfx);
x5c_visorLoopSfx.reset();
}
switch (x1c_curVisor)
{
case CPlayerState::EPlayerVisor::XRay:
CSfxManager::SfxStart(1382, x24_visorSfxVol, 0.f, false, 0x7f, false, kInvalidAreaId);
break;
case CPlayerState::EPlayerVisor::Scan:
if (x60_)
{
CSfxManager::SfxStop(x60_);
x60_.reset();
}
CSfxManager::SfxStart(1382, x24_visorSfxVol, 0.f, false, 0x7f, false, kInvalidAreaId);
break;
case CPlayerState::EPlayerVisor::Thermal:
CSfxManager::SfxStart(1382, x24_visorSfxVol, 0.f, false, 0x7f, false, kInvalidAreaId);
break;
default: break;
}
}
void CPlayerVisor::Update(float dt, const CStateManager& mgr)
{
x90_xrayBlur.Update(dt);
CPlayerState& playerState = *mgr.GetPlayerState();
CPlayerState::EPlayerVisor activeVisor = playerState.GetActiveVisor(mgr);
CPlayerState::EPlayerVisor curVisor = playerState.GetCurrentVisor();
CPlayerState::EPlayerVisor transVisor = playerState.GetTransitioningVisor();
bool visorTransitioning = playerState.GetIsVisorTransitioning();
UpdateScanWindow(dt, mgr);
if (x20_nextVisor != transVisor)
x20_nextVisor = transVisor;
LockUnlockAssets();
if (mgr.GetPlayer().GetScanningState() == CPlayer::EPlayerScanState::ScanComplete)
x2c_scanDimInterp = std::max(0.f, x2c_scanDimInterp - 2.f * dt);
else
x2c_scanDimInterp = std::min(x2c_scanDimInterp + 2.f * dt, 1.f);
if (visorTransitioning)
{
if (!x25_24_visorTransitioning)
BeginTransitionOut();
if (x1c_curVisor != curVisor)
{
FinishTransitionOut(mgr);
x1c_curVisor = curVisor;
BeginTransitionIn(mgr);
}
UpdateCurrentVisor(playerState.GetVisorTransitionFactor());
}
else
{
if (x25_24_visorTransitioning)
{
FinishTransitionIn();
}
else if (curVisor == CPlayerState::EPlayerVisor::Scan)
{
zeus::CColor dimColor = zeus::CColor::lerp(g_tweakGuiColors->GetScanVisorScreenDimColor(),
g_tweakGuiColors->GetScanVisorHudLightMultiply(),
x2c_scanDimInterp);
x64_scanDim.SetFilter(CCameraFilterPass::EFilterType::Multiply,
CCameraFilterPass::EFilterShape::Fullscreen,
0.f, dimColor, -1);
}
}
x25_24_visorTransitioning = visorTransitioning;
if (x1c_curVisor != activeVisor)
{
if (x24_visorSfxVol != 0.f)
{
x24_visorSfxVol = 0.f;
CSfxManager::SfxVolume(x5c_visorLoopSfx, x24_visorSfxVol);
CSfxManager::SfxVolume(x60_, x24_visorSfxVol);
}
}
else
{
if (x24_visorSfxVol != 1.f)
{
x24_visorSfxVol = 1.f;
CSfxManager::SfxVolume(x5c_visorLoopSfx, x24_visorSfxVol);
CSfxManager::SfxVolume(x60_, x24_visorSfxVol);
}
}
float scanMag = g_tweakGui->GetScanWindowMagnification();
if (x58_scanMagInterp < scanMag)
x58_scanMagInterp = std::min(x58_scanMagInterp + 2.f * dt, scanMag);
else
x58_scanMagInterp = std::max(x58_scanMagInterp - 2.f * dt, scanMag);
}
void CPlayerVisor::Draw(const CStateManager& mgr, const CTargetingManager* tgtManager) const
{
}
void CPlayerVisor::Touch()
{
if (x124_scanIconNoncritical.IsLoaded())
x124_scanIconNoncritical->Touch(0);
if (x130_scanIconCritical.IsLoaded())
x130_scanIconCritical->Touch(0);
}
float CPlayerVisor::GetDesiredViewportScaleX(const CStateManager& stateMgr) const
float CPlayerVisor::GetDesiredViewportScaleX(const CStateManager& mgr) const
{
return 0.f;
return mgr.GetPlayerState()->GetActiveVisor(mgr) == CPlayerState::EPlayerVisor::Combat ? 1.f : xc4_vpScaleX;
}
float CPlayerVisor::GetDesiredViewportScaleY(const CStateManager& stateMgr) const
float CPlayerVisor::GetDesiredViewportScaleY(const CStateManager& mgr) const
{
return 0.f;
return mgr.GetPlayerState()->GetActiveVisor(mgr) == CPlayerState::EPlayerVisor::Combat ? 1.f : xc8_vpScaleY;
}
}

View File

@ -1,18 +1,93 @@
#ifndef __URDE_CPLAYERVISOR_HPP__
#define __URDE_CPLAYERVISOR_HPP__
#include "RetroTypes.hpp"
#include "Camera/CCameraFilter.hpp"
#include "zeus/CVector2f.hpp"
#include "Audio/CSfxManager.hpp"
#include "CPlayerState.hpp"
namespace urde
{
class CStateManager;
class CTargetingManager;
class CModel;
namespace MP1
{
class CPlayerVisor
{
struct SScanTarget
{
TUniqueId x0_objId = kInvalidUniqueId;
float x4_ = 0.f;
float x8_ = 0.f;
bool xc_ = false;
};
enum class EScanWindowState
{
NotInScanVisor,
Idle,
Scan
};
rstl::reserved_vector<zeus::CVector2f, 3> x0_scanWindowSizes;
CPlayerState::EPlayerVisor x1c_curVisor = CPlayerState::EPlayerVisor::Combat;
CPlayerState::EPlayerVisor x20_nextVisor = CPlayerState::EPlayerVisor::Combat;
float x24_visorSfxVol = 1.f; // used to be u8
bool x25_24_visorTransitioning : 1;
bool x25_25_ : 1;
float x28_ = 0.f;
float x2c_scanDimInterp = 1.f;
u32 x30_ = 0;
u32 x34_ = 0;
float x38_ = 0.f;
float x3c_ = 0.f;
zeus::CVector2f x40_;
zeus::CVector2f x48_;
zeus::CVector2f x50_;
float x58_scanMagInterp = 1.f;
CSfxHandle x5c_visorLoopSfx;
CSfxHandle x60_;
CCameraFilterPass x64_scanDim;
CCameraBlurPass x90_xrayBlur;
float xc4_vpScaleX = 1.f;
float xc8_vpScaleY = 1.f;
TLockedToken<CModel> xcc_scanFrameCorner;
TLockedToken<CModel> xd8_scanFrameCenterSide;
TLockedToken<CModel> xe4_scanFrameCenterTop;
TLockedToken<CModel> xf0_scanFrameStretchSide;
TLockedToken<CModel> xfc_scanFrameStretchTop;
TLockedToken<CModel> x108_newScanPane;
TLockedToken<CModel> x114_scanShield;
TLockedToken<CModel> x124_scanIconNoncritical;
TLockedToken<CModel> x130_scanIconCritical;
rstl::reserved_vector<SScanTarget, 64> x13c_scanTargets;
TLockedToken<CTexture> x540_xrayPalette;
float x54c_ = 0.f;
float x550_ = 0.f;
int FindEmptyInactiveScanTarget() const;
int FindCachedInactiveScanTarget(TUniqueId uid) const;
void DrawScanObjectIndicators(const CStateManager& mgr) const;
void UpdateScanObjectIndicators(const CStateManager& mgr);
void UpdateScanWindow(float dt, const CStateManager& mgr);
EScanWindowState GetDesiredScanWindowState(const CStateManager& mgr) const;
void LockUnlockAssets();
void DrawScanEffect(const CStateManager& mgr, const CTargetingManager* tgtMgr) const;
void DrawXRayEffect(const CStateManager& mgr) const;
void DrawThermalEffect(const CStateManager& mgr) const;
void UpdateCurrentVisor(float transFactor);
void FinishTransitionIn();
void BeginTransitionIn(const CStateManager& mgr);
void FinishTransitionOut(const CStateManager& mgr);
void BeginTransitionOut();
public:
CPlayerVisor(CStateManager& stateMgr);
~CPlayerVisor();
void Update(float dt, const CStateManager& stateMgr);
void Draw(const CStateManager& stateMgr, const CTargetingManager* tgtManager) const;
void Touch();

View File

@ -580,7 +580,7 @@ void CSamusDoll::Draw(const CStateManager& mgr, float alpha)
{
float radius = zeus::clamp(0.2f, (10.f - (xc0_userZoom >= 0.f ? xc0_userZoom : -xc0_userZoom)) / 20.f, 1.f);
float offset = std::sin(x260_phazonOffsetAngle);
zeus::CColor color = g_tweakGuiColors->GetInvPhazonSuitFilterMod();
zeus::CColor color = g_tweakGuiColors->GetPauseBlurFilterColor();
color.a = alpha;
g_Renderer->DrawPhazonSuitIndirectEffect(zeus::CColor(0.1f, alpha), x250_phazonIndirectTexture,
color, radius, 0.1f, offset, offset);

2
hecl

@ -1 +1 @@
Subproject commit b7e8c42c02313e4a9a86aa9de072888c8ec576e7
Subproject commit 1c87c80483c0a38063edbb3517ba287220e57068

2
nod

@ -1 +1 @@
Subproject commit e494dbba9f29634ccbd2b9af203b86d11d5466d5
Subproject commit 7260012be57607149e312ac8565bc2fae9c7c972