Finish CInGameGuiManager

This commit is contained in:
Jack Andersen 2017-05-21 12:01:04 -04:00
parent c8d09f3de7
commit 4b048a0dff
34 changed files with 505 additions and 106 deletions

View File

@ -15,9 +15,11 @@ struct ITweakAutoMapper : public ITweak
virtual float GetMinCamRotateX() const=0; virtual float GetMinCamRotateX() const=0;
virtual float GetMaxCamRotateX() const=0; virtual float GetMaxCamRotateX() const=0;
virtual float GetCamAngle() const=0; virtual float GetCamAngle() const=0;
virtual const zeus::CColor& GetAutomapperWidgetColor() const=0;
virtual float GetMiniCamDist() const=0; virtual float GetMiniCamDist() const=0;
virtual float GetMiniCamXAngle() const=0; virtual float GetMiniCamXAngle() const=0;
virtual float GetMiniCamAngle() const=0; virtual float GetMiniCamAngle() const=0;
virtual const zeus::CColor& GetAutomapperWidgetMiniColor() const=0;
virtual const zeus::CColor& GetSurfaceVisitedColor() const=0; virtual const zeus::CColor& GetSurfaceVisitedColor() const=0;
virtual const zeus::CColor& GetOutlineVisitedColor() const=0; virtual const zeus::CColor& GetOutlineVisitedColor() const=0;
virtual const zeus::CColor& GetSurfaceUnvisitedColor() const=0; virtual const zeus::CColor& GetSurfaceUnvisitedColor() const=0;
@ -53,6 +55,8 @@ struct ITweakAutoMapper : public ITweak
virtual float GetMaxUniverseCamDist() const=0; virtual float GetMaxUniverseCamDist() const=0;
virtual float GetSwitchToFromUniverseTime() const=0; virtual float GetSwitchToFromUniverseTime() const=0;
virtual float GetCamPanUnitsPerFrame() const=0; virtual float GetCamPanUnitsPerFrame() const=0;
virtual float GetAutomapperScaleX() const=0;
virtual float GetAutomapperScaleZ() const=0;
virtual float GetCamVerticalOffset() const=0; virtual float GetCamVerticalOffset() const=0;
virtual const zeus::CColor& GetMiniMapSamusModColor() const=0; virtual const zeus::CColor& GetMiniMapSamusModColor() const=0;
virtual const zeus::CColor& GetAreaFlashPulseColor() const=0; virtual const zeus::CColor& GetAreaFlashPulseColor() const=0;

View File

@ -89,6 +89,9 @@ struct ITweakGui : ITweak
virtual float GetHudDamageFilterGainLinear() const=0; virtual float GetHudDamageFilterGainLinear() const=0;
virtual float GetHudDamageFilterInitConstant() const=0; virtual float GetHudDamageFilterInitConstant() const=0;
virtual float GetHudDamageFilterInitLinear() const=0; virtual float GetHudDamageFilterInitLinear() const=0;
virtual float GetEnergyDrainModPeriod() const=0;
virtual bool GetEnergyDrainSinusoidalPulse() const=0;
virtual bool GetEnergyDrainFilterAdditive() const=0;
virtual float GetHudDamagePulseDuration() const=0; virtual float GetHudDamagePulseDuration() const=0;
virtual float GetHudDamageColorGain() const=0; virtual float GetHudDamageColorGain() const=0;
virtual float GetHudDecoShakeTranslateGain() const=0; virtual float GetHudDecoShakeTranslateGain() const=0;
@ -114,6 +117,7 @@ struct ITweakGui : ITweak
virtual float GetScanDataDotHoldDurationMin() const=0; virtual float GetScanDataDotHoldDurationMin() const=0;
virtual float GetScanDataDotHoldDurationMax() const=0; virtual float GetScanDataDotHoldDurationMax() const=0;
virtual float GetScanSidesPositionStart() const=0; virtual float GetScanSidesPositionStart() const=0;
virtual bool GetShowAutomapperInMorphball() const=0;
virtual bool GetLatchArticleText() const=0; virtual bool GetLatchArticleText() const=0;
virtual float GetWorldTransManagerCharsPerSfx() const=0; virtual float GetWorldTransManagerCharsPerSfx() const=0;
virtual atUint32 GetXRayFogMode() const=0; virtual atUint32 GetXRayFogMode() const=0;

View File

@ -64,6 +64,7 @@ struct ITweakGuiColors : BigYAML
virtual const zeus::CColor& GetDamageAmbientColor() const=0; virtual const zeus::CColor& GetDamageAmbientColor() const=0;
virtual const zeus::CColor& GetScanVisorHudLightMultiply() const=0; virtual const zeus::CColor& GetScanVisorHudLightMultiply() const=0;
virtual const zeus::CColor& GetThermalVisorHudLightMultiply() const=0; virtual const zeus::CColor& GetThermalVisorHudLightMultiply() const=0;
virtual const zeus::CColor& GetEnergyDrainFilterColor() const=0;
virtual const zeus::CColor& GetDamageAmbientPulseColor() const=0; virtual const zeus::CColor& GetDamageAmbientPulseColor() const=0;
virtual const zeus::CColor& GetEnergyBarFlashColor() const=0; virtual const zeus::CColor& GetEnergyBarFlashColor() const=0;
virtual const zeus::CColor& GetXRayEnergyDecoColor() const=0; virtual const zeus::CColor& GetXRayEnergyDecoColor() const=0;

View File

@ -21,12 +21,12 @@ struct CTweakAutoMapper : public ITweakAutoMapper
Value<float> x18_maxCamRotateX; Value<float> x18_maxCamRotateX;
Value<float> x1c_camAngle; Value<float> x1c_camAngle;
Value<float> x20_; Value<float> x20_;
DNAColor x24_; DNAColor x24_automapperWidgetColor;
Value<float> x28_miniCamDist; Value<float> x28_miniCamDist;
Value<float> x2c_miniCamXAngle; Value<float> x2c_miniCamXAngle;
Value<float> x30_miniCamAngle; Value<float> x30_miniCamAngle;
Value<float> x34_; Value<float> x34_;
DNAColor x38_; DNAColor x38_automapperWidgetMiniColor;
DNAColor x3c_surfColorVisited; DNAColor x3c_surfColorVisited;
DNAColor x40_outlineColorVisited; DNAColor x40_outlineColorVisited;
DNAColor x44_surfColorUnvisited; DNAColor x44_surfColorUnvisited;
@ -68,8 +68,8 @@ struct CTweakAutoMapper : public ITweakAutoMapper
Value<float> xd8_maxUniverseCamDist; Value<float> xd8_maxUniverseCamDist;
Value<float> xdc_switchToFromUniverseTime; Value<float> xdc_switchToFromUniverseTime;
Value<float> xe0_camPanUnitsPerFrame; Value<float> xe0_camPanUnitsPerFrame;
Value<float> xe4_; Value<float> xe4_automapperScaleX;
Value<float> xe8_; Value<float> xe8_automapperScaleZ;
Value<float> xec_camVerticalOffset; Value<float> xec_camVerticalOffset;
DNAColor xf0_miniMapSamusModColor; DNAColor xf0_miniMapSamusModColor;
DNAColor xf4_areaFlashPulseColor; DNAColor xf4_areaFlashPulseColor;
@ -90,9 +90,11 @@ struct CTweakAutoMapper : public ITweakAutoMapper
float GetMinCamRotateX() const { return x14_minCamRotateX; } float GetMinCamRotateX() const { return x14_minCamRotateX; }
float GetMaxCamRotateX() const { return x18_maxCamRotateX; } float GetMaxCamRotateX() const { return x18_maxCamRotateX; }
float GetCamAngle() const { return x1c_camAngle; } float GetCamAngle() const { return x1c_camAngle; }
const zeus::CColor& GetAutomapperWidgetColor() const { return x24_automapperWidgetColor; }
float GetMiniCamDist() const { return x28_miniCamDist; } float GetMiniCamDist() const { return x28_miniCamDist; }
float GetMiniCamXAngle() const { return x2c_miniCamXAngle; } float GetMiniCamXAngle() const { return x2c_miniCamXAngle; }
float GetMiniCamAngle() const { return x30_miniCamAngle; } float GetMiniCamAngle() const { return x30_miniCamAngle; }
const zeus::CColor& GetAutomapperWidgetMiniColor() const { return x38_automapperWidgetMiniColor; }
const zeus::CColor& GetSurfaceVisitedColor() const { return x3c_surfColorVisited; } const zeus::CColor& GetSurfaceVisitedColor() const { return x3c_surfColorVisited; }
const zeus::CColor& GetOutlineVisitedColor() const { return x40_outlineColorVisited; } const zeus::CColor& GetOutlineVisitedColor() const { return x40_outlineColorVisited; }
const zeus::CColor& GetSurfaceUnvisitedColor() const { return x44_surfColorUnvisited; } const zeus::CColor& GetSurfaceUnvisitedColor() const { return x44_surfColorUnvisited; }
@ -128,6 +130,8 @@ struct CTweakAutoMapper : public ITweakAutoMapper
float GetMaxUniverseCamDist() const { return xd8_maxUniverseCamDist; } float GetMaxUniverseCamDist() const { return xd8_maxUniverseCamDist; }
float GetSwitchToFromUniverseTime() const { return xdc_switchToFromUniverseTime; } float GetSwitchToFromUniverseTime() const { return xdc_switchToFromUniverseTime; }
float GetCamPanUnitsPerFrame() const { return xe0_camPanUnitsPerFrame; } float GetCamPanUnitsPerFrame() const { return xe0_camPanUnitsPerFrame; }
float GetAutomapperScaleX() const { return xe4_automapperScaleX; }
float GetAutomapperScaleZ() const { return xe8_automapperScaleZ; }
float GetCamVerticalOffset() const { return xec_camVerticalOffset; } float GetCamVerticalOffset() const { return xec_camVerticalOffset; }
const zeus::CColor& GetMiniMapSamusModColor() const { return xf0_miniMapSamusModColor; } const zeus::CColor& GetMiniMapSamusModColor() const { return xf0_miniMapSamusModColor; }
const zeus::CColor& GetAreaFlashPulseColor() const { return xf4_areaFlashPulseColor; } const zeus::CColor& GetAreaFlashPulseColor() const { return xf4_areaFlashPulseColor; }

View File

@ -104,9 +104,9 @@ struct CTweakGui : ITweakGui
Value<float> x1bc_hudDamageFilterGainLinear; Value<float> x1bc_hudDamageFilterGainLinear;
Value<float> x1c0_hudDamageFilterInitConstant; Value<float> x1c0_hudDamageFilterInitConstant;
Value<float> x1c4_hudDamageFilterInitLinear; Value<float> x1c4_hudDamageFilterInitLinear;
Value<float> x1c8_; Value<float> x1c8_energyDrainModPeriod;
Value<bool> x1cc_; Value<bool> x1cc_energyDrainSinusoidalPulse;
Value<bool> x1cd_; Value<bool> x1cd_energyDrainFilterAdditive;
Value<float> x1d0_hudDamagePulseDuration; Value<float> x1d0_hudDamagePulseDuration;
Value<float> x1d4_hudDamageColorGain; Value<float> x1d4_hudDamageColorGain;
Value<float> x1d8_hudDecoShakeTranslateGain; Value<float> x1d8_hudDecoShakeTranslateGain;
@ -148,7 +148,7 @@ struct CTweakGui : ITweakGui
Value<float> x268_; Value<float> x268_;
Value<float> x26c_; Value<float> x26c_;
Value<float> x270_scanSidesPositionStart; Value<float> x270_scanSidesPositionStart;
Value<bool> x274_; Value<bool> x274_showAutomapperInMorphball;
bool x275_latchArticleText = true; bool x275_latchArticleText = true;
Value<float> x278_wtMgrCharsPerSfx; Value<float> x278_wtMgrCharsPerSfx;
Value<atUint32> x27c_xrayFogMode; Value<atUint32> x27c_xrayFogMode;
@ -251,6 +251,9 @@ struct CTweakGui : ITweakGui
float GetHudDamageFilterGainLinear() const { return x1bc_hudDamageFilterGainLinear; } float GetHudDamageFilterGainLinear() const { return x1bc_hudDamageFilterGainLinear; }
float GetHudDamageFilterInitConstant() const { return x1c0_hudDamageFilterInitConstant; } float GetHudDamageFilterInitConstant() const { return x1c0_hudDamageFilterInitConstant; }
float GetHudDamageFilterInitLinear() const { return x1c4_hudDamageFilterInitLinear; } float GetHudDamageFilterInitLinear() const { return x1c4_hudDamageFilterInitLinear; }
float GetEnergyDrainModPeriod() const { return x1c8_energyDrainModPeriod; }
bool GetEnergyDrainSinusoidalPulse() const { return x1cc_energyDrainSinusoidalPulse; }
bool GetEnergyDrainFilterAdditive() const { return x1cd_energyDrainFilterAdditive; }
float GetHudDamagePulseDuration() const { return x1d0_hudDamagePulseDuration; } float GetHudDamagePulseDuration() const { return x1d0_hudDamagePulseDuration; }
float GetHudDamageColorGain() const { return x1d4_hudDamageColorGain; } float GetHudDamageColorGain() const { return x1d4_hudDamageColorGain; }
float GetHudDecoShakeTranslateGain() const { return x1d8_hudDecoShakeTranslateGain; } float GetHudDecoShakeTranslateGain() const { return x1d8_hudDecoShakeTranslateGain; }
@ -275,6 +278,7 @@ struct CTweakGui : ITweakGui
float GetScanPaneFadeOutTime() const { return x250_scanPaneFadeOutTime; } float GetScanPaneFadeOutTime() const { return x250_scanPaneFadeOutTime; }
float GetBallViewportYReduction() const { return x254_ballViewportYReduction; } float GetBallViewportYReduction() const { return x254_ballViewportYReduction; }
float GetScanSidesPositionStart() const { return x270_scanSidesPositionStart; } float GetScanSidesPositionStart() const { return x270_scanSidesPositionStart; }
bool GetShowAutomapperInMorphball() const { return x274_showAutomapperInMorphball; }
bool GetLatchArticleText() const { return x275_latchArticleText; } bool GetLatchArticleText() const { return x275_latchArticleText; }
float GetWorldTransManagerCharsPerSfx() const { return x278_wtMgrCharsPerSfx; } float GetWorldTransManagerCharsPerSfx() const { return x278_wtMgrCharsPerSfx; }
atUint32 GetXRayFogMode() const { return x27c_xrayFogMode; } atUint32 GetXRayFogMode() const { return x27c_xrayFogMode; }

View File

@ -65,7 +65,7 @@ struct CTweakGuiColors : public ITweakGuiColors
DNAColor xd4_scanVisorHudLightMultiply; DNAColor xd4_scanVisorHudLightMultiply;
DNAColor xd8_; DNAColor xd8_;
DNAColor xdc_thermalVisorHudLightMultiply; DNAColor xdc_thermalVisorHudLightMultiply;
DNAColor xe0_; DNAColor xe0_energyDrainFilterColor;
DNAColor xe4_damageAmbientPulseColor; DNAColor xe4_damageAmbientPulseColor;
DNAColor xe8_energyBarFlashColor; DNAColor xe8_energyBarFlashColor;
DNAColor xec_; DNAColor xec_;
@ -182,6 +182,7 @@ struct CTweakGuiColors : public ITweakGuiColors
const zeus::CColor& GetDamageAmbientColor() const { return xc4_damageAmbientColor; } const zeus::CColor& GetDamageAmbientColor() const { return xc4_damageAmbientColor; }
const zeus::CColor& GetScanVisorHudLightMultiply() const { return xd4_scanVisorHudLightMultiply; } const zeus::CColor& GetScanVisorHudLightMultiply() const { return xd4_scanVisorHudLightMultiply; }
const zeus::CColor& GetThermalVisorHudLightMultiply() const { return xdc_thermalVisorHudLightMultiply; } const zeus::CColor& GetThermalVisorHudLightMultiply() const { return xdc_thermalVisorHudLightMultiply; }
const zeus::CColor& GetEnergyDrainFilterColor() const { return xe0_energyDrainFilterColor; }
const zeus::CColor& GetDamageAmbientPulseColor() const { return xe4_damageAmbientPulseColor; } const zeus::CColor& GetDamageAmbientPulseColor() const { return xe4_damageAmbientPulseColor; }
const zeus::CColor& GetEnergyBarFlashColor() const { return xe8_energyBarFlashColor; } const zeus::CColor& GetEnergyBarFlashColor() const { return xe8_energyBarFlashColor; }
const zeus::CColor& GetXRayEnergyDecoColor() const { return x100_xrayEnergyDecoColor; } const zeus::CColor& GetXRayEnergyDecoColor() const { return x100_xrayEnergyDecoColor; }

View File

@ -1398,16 +1398,12 @@ void CAutoMapper::Draw(const CStateManager& mgr, const zeus::CTransform& xf, flo
} }
else if (x1c0_nextState == EAutoMapperState::MiniMap) else if (x1c0_nextState == EAutoMapperState::MiniMap)
{ {
float t = 0.f; float t = GetInterp();
if (x1c4_interpDur > 0.f)
t = x1c8_interpTime / x1c4_interpDur;
alphaInterp = alpha * t + (1.f - t); alphaInterp = alpha * t + (1.f - t);
} }
else if (x1bc_state == EAutoMapperState::MiniMap) else if (x1bc_state == EAutoMapperState::MiniMap)
{ {
float t = 0.f; float t = GetInterp();
if (x1c4_interpDur > 0.f)
t = x1c8_interpTime / x1c4_interpDur;
alphaInterp = alpha * (1.f - t) + t; alphaInterp = alpha * (1.f - t) + t;
} }
else else
@ -1429,24 +1425,13 @@ void CAutoMapper::Draw(const CStateManager& mgr, const zeus::CTransform& xf, flo
if (x1c0_nextState == EAutoMapperState::MapScreenUniverse) if (x1c0_nextState == EAutoMapperState::MapScreenUniverse)
{ {
if (x1bc_state == EAutoMapperState::MapScreenUniverse) if (x1bc_state == EAutoMapperState::MapScreenUniverse)
{
universeInterp = 1.f; universeInterp = 1.f;
}
else else
{ universeInterp = GetInterp();
if (x1c4_interpDur > 0.f)
universeInterp = x1c8_interpTime / x1c4_interpDur;
else
universeInterp = 0.f;
}
} }
else if (x1bc_state == EAutoMapperState::MapScreenUniverse) else if (x1bc_state == EAutoMapperState::MapScreenUniverse)
{ {
if (x1c4_interpDur > 0.f) universeInterp = 1.f - GetInterp();
universeInterp = x1c8_interpTime / x1c4_interpDur;
else
universeInterp = 0.f;
universeInterp = 1.f - universeInterp;
} }
zeus::CTransform preXf; zeus::CTransform preXf;

View File

@ -292,6 +292,7 @@ public:
std::pair<int, int> std::pair<int, int>
FindClosestVisibleWorld(const zeus::CVector3f&, const zeus::CUnitVector3f&, const CStateManager&) const; FindClosestVisibleWorld(const zeus::CVector3f&, const zeus::CUnitVector3f&, const CStateManager&) const;
EAutoMapperState GetNextState() const { return x1c0_nextState; }
bool IsInMapperState(EAutoMapperState state) const bool IsInMapperState(EAutoMapperState state) const
{ {
return state == x1bc_state && state == x1c0_nextState; return state == x1bc_state && state == x1c0_nextState;
@ -304,20 +305,17 @@ public:
{ {
return x1c8_interpTime < x1c4_interpDur; return x1c8_interpTime < x1c4_interpDur;
} }
void UpdateOptionsMenu(const CTweakValue::Audio&); bool IsStateTransitioning() const { return x1bc_state != x1c0_nextState; }
void UpdateAudioMusicMenu(); bool IsFullyInMiniMapState() const { return IsInMapperState(EAutoMapperState::MiniMap); }
void UpdateAudioEvents(); bool IsFullyOutOfMiniMapState() const { return x1bc_state != EAutoMapperState::MiniMap &&
void UpdateAudioEventMenu(); x1c0_nextState != EAutoMapperState::MiniMap; }
void GetCurrentAudioInfo() const;
void PresentAudioMenuInput(const CFinalInput&);
void SetFocusAudioMenu(CAudioMenu::EMenu);
bool IsStateTransitioning() const;
bool IsFullyInMiniMapState() const;
static bool IsDrawState(EAutoMapperState);
void OnNewInGameGuiState(EInGameGuiState, const CStateManager&); void OnNewInGameGuiState(EInGameGuiState, const CStateManager&);
void OnChangeAudioMusicSelection(); float GetInterp() const
{
if (x1c4_interpDur > 0.f)
return x1c8_interpTime / x1c4_interpDur;
return 0.f;
}
}; };
} }

View File

@ -76,6 +76,13 @@ public:
{ {
return true; return true;
} }
static std::string GetIdentifierForMidiEvent(ResId world, ResId area,
const std::string& midiObj)
{
return hecl::Format("World %8.8x Area %8.8x MidiObject: %s",
u32(world), u32(area), midiObj.c_str());
}
}; };
} }

View File

@ -41,9 +41,7 @@ void CCameraBlurPass::Draw()
if (x10_curType == EBlurType::NoBlur) if (x10_curType == EBlurType::NoBlur)
return; return;
SClipScreenRect rect = {}; SClipScreenRect rect(g_Viewport);
rect.xc_width = g_Viewport.x8_width;
rect.x10_height = g_Viewport.xc_height;
CGraphics::ResolveSpareTexture(rect); CGraphics::ResolveSpareTexture(rect);
if (x10_curType == EBlurType::Xray) if (x10_curType == EBlurType::Xray)

View File

@ -1215,11 +1215,7 @@ void CBooRenderer::DrawPhazonSuitIndirectEffect(const zeus::CColor& nonIndirectM
/* Indirect background already in binding 0 */ /* Indirect background already in binding 0 */
/* Resolve alpha channel of just-drawn phazon suit into binding 1 */ /* Resolve alpha channel of just-drawn phazon suit into binding 1 */
SClipScreenRect rect; SClipScreenRect rect(g_Viewport);
rect.x4_left = g_Viewport.x0_left;
rect.x8_top = g_Viewport.x4_top;
rect.xc_width = g_Viewport.x8_width;
rect.x10_height = g_Viewport.xc_height;
CGraphics::ResolveSpareTexture(rect, 1); CGraphics::ResolveSpareTexture(rect, 1);
/* Perform blur filter and resolve into binding 2 */ /* Perform blur filter and resolve into binding 2 */

View File

@ -178,6 +178,14 @@ struct SClipScreenRect
x10_height = rect.size[1]; x10_height = rect.size[1];
x14_dstWidth = rect.size[0]; x14_dstWidth = rect.size[0];
} }
SClipScreenRect(const SViewport& vp)
{
x4_left = vp.x0_left;
x8_top = vp.x4_top;
xc_width = vp.x8_width;
x10_height = vp.xc_height;
}
}; };
enum class ETexelFormat enum class ETexelFormat

View File

@ -20,9 +20,7 @@ void CCameraBlurFilter::draw(float amount)
if (amount <= 0.f) if (amount <= 0.f)
return; return;
SClipScreenRect clipRect = {}; SClipScreenRect clipRect(g_Viewport);
clipRect.xc_width = g_Viewport.x8_width;
clipRect.x10_height = g_Viewport.xc_height;
CGraphics::ResolveSpareTexture(clipRect); CGraphics::ResolveSpareTexture(clipRect);
float aspect = CGraphics::g_CroppedViewport.xc_width / float(CGraphics::g_CroppedViewport.x10_height); float aspect = CGraphics::g_CroppedViewport.xc_width / float(CGraphics::g_CroppedViewport.x10_height);

View File

@ -10,18 +10,15 @@ CGuiCamera::CGuiCamera(const CGuiWidgetParms& parms,
float left, float right, float left, float right,
float top, float bottom, float top, float bottom,
float znear, float zfar) float znear, float zfar)
: CGuiWidget(parms), xb8_proj(EProjection::Orthographic), : CGuiWidget(parms), xb8_projtype(EProjection::Orthographic),
xbc_left(left), xc0_right(right), m_proj(left, right, top, bottom, znear, zfar)
xc4_top(top), xc8_bottom(bottom),
xcc_znear(znear), xd0_zfar(zfar)
{} {}
CGuiCamera::CGuiCamera(const CGuiWidgetParms& parms, CGuiCamera::CGuiCamera(const CGuiWidgetParms& parms,
float fov, float aspect, float fov, float aspect,
float znear, float zfar) float znear, float zfar)
: CGuiWidget(parms), xb8_proj(EProjection::Perspective), : CGuiWidget(parms), xb8_projtype(EProjection::Perspective),
xbc_fov(fov), xc0_aspect(aspect), m_proj(fov, aspect, znear, zfar)
xc4_znear(znear), xc8_zfar(zfar)
{} {}
zeus::CVector3f CGuiCamera::ConvertToScreenSpace(const zeus::CVector3f& vec) const zeus::CVector3f CGuiCamera::ConvertToScreenSpace(const zeus::CVector3f& vec) const
@ -30,18 +27,19 @@ zeus::CVector3f CGuiCamera::ConvertToScreenSpace(const zeus::CVector3f& vec) con
if (local.isZero()) if (local.isZero())
return {-1.f, -1.f, 1.f}; return {-1.f, -1.f, 1.f};
zeus::CMatrix4f mat = CGraphics::CalculatePerspectiveMatrix(xbc_fov, xc0_aspect, zeus::CMatrix4f mat = CGraphics::CalculatePerspectiveMatrix(m_proj.xbc_fov, m_proj.xc0_aspect,
xc4_znear, xc8_zfar, m_proj.xc4_znear, m_proj.xc8_zfar,
false); false);
return mat.multiplyOneOverW(local); return mat.multiplyOneOverW(local);
} }
void CGuiCamera::Draw(const CGuiWidgetDrawParms& parms) const void CGuiCamera::Draw(const CGuiWidgetDrawParms& parms) const
{ {
if (xb8_proj == EProjection::Perspective) if (xb8_projtype == EProjection::Perspective)
CGraphics::SetPerspective(xbc_fov, xc0_aspect, xc4_znear, xc8_zfar); CGraphics::SetPerspective(m_proj.xbc_fov, m_proj.xc0_aspect, m_proj.xc4_znear, m_proj.xc8_zfar);
else else
CGraphics::SetOrtho(xbc_left, xc0_right, xc4_top, xc8_bottom, xcc_znear, xd0_zfar); CGraphics::SetOrtho(m_proj.xbc_left, m_proj.xc0_right, m_proj.xc4_top, m_proj.xc8_bottom,
m_proj.xcc_znear, m_proj.xd0_zfar);
CGraphics::SetViewPointMatrix(GetGuiFrame()->GetAspectTransform() * CGraphics::SetViewPointMatrix(GetGuiFrame()->GetAspectTransform() *
zeus::CTransform::Translate(parms.x4_cameraOffset) * x34_worldXF); zeus::CTransform::Translate(parms.x4_cameraOffset) * x34_worldXF);
CGuiWidget::Draw(parms); CGuiWidget::Draw(parms);

View File

@ -15,8 +15,8 @@ public:
Perspective, Perspective,
Orthographic Orthographic
}; };
private: struct SProjection
EProjection xb8_proj; {
union union
{ {
struct struct
@ -36,6 +36,15 @@ private:
float xc8_zfar; float xc8_zfar;
}; };
}; };
SProjection(float left, float right, float top, float bottom, float znear, float zfar)
: xbc_left(left), xc0_right(right), xc4_top(top), xc8_bottom(bottom), xcc_znear(znear),
xd0_zfar(zfar) {}
SProjection(float fov, float aspect, float znear, float zfar)
: xbc_fov(fov), xc0_aspect(aspect), xc4_znear(znear), xc8_zfar(zfar) {}
};
private:
EProjection xb8_projtype;
SProjection m_proj;
public: public:
CGuiCamera(const CGuiWidgetParms& parms, float left, float right, CGuiCamera(const CGuiWidgetParms& parms, float left, float right,
float top, float bottom, float top, float bottom,
@ -46,7 +55,8 @@ public:
static std::shared_ptr<CGuiWidget> Create(CGuiFrame* frame, CInputStream& in, CSimplePool* sp); static std::shared_ptr<CGuiWidget> Create(CGuiFrame* frame, CInputStream& in, CSimplePool* sp);
zeus::CVector3f ConvertToScreenSpace(const zeus::CVector3f& vec) const; zeus::CVector3f ConvertToScreenSpace(const zeus::CVector3f& vec) const;
void SetFov(float fov) { xbc_fov = fov; } const SProjection& GetProjection() const { return m_proj; }
void SetFov(float fov) { m_proj.xbc_fov = fov; }
void Draw(const CGuiWidgetDrawParms& parms) const; void Draw(const CGuiWidgetDrawParms& parms) const;
std::shared_ptr<CGuiCamera> shared_from_this() std::shared_ptr<CGuiCamera> shared_from_this()

View File

@ -18,7 +18,7 @@ void CTargetingManager::Update(float dt, const CStateManager& stateMgr)
} }
void CTargetingManager::Draw(const CStateManager& stateMgr) const void CTargetingManager::Draw(const CStateManager& stateMgr, bool hideLockon) const
{ {
} }

View File

@ -14,7 +14,7 @@ public:
CTargetingManager(const CStateManager& stateMgr); CTargetingManager(const CStateManager& stateMgr);
bool CheckLoadComplete(); bool CheckLoadComplete();
void Update(float, const CStateManager& stateMgr); void Update(float, const CStateManager& stateMgr);
void Draw(const CStateManager& stateMgr) const; void Draw(const CStateManager& stateMgr, bool hideLockon) const;
void Touch() const; void Touch() const;
void SetRotation(const zeus::CQuaternion& rot) { x0_rot = rot; } void SetRotation(const zeus::CQuaternion& rot) { x0_rot = rot; }
}; };

View File

@ -14,6 +14,8 @@
#include "Input/CInputGenerator.hpp" #include "Input/CInputGenerator.hpp"
#include "TCastTo.hpp" #include "TCastTo.hpp"
#include "Camera/CFirstPersonCamera.hpp" #include "Camera/CFirstPersonCamera.hpp"
#include "Graphics/CBooRenderer.hpp"
#include "GuiSys/CGuiWidgetDrawParms.hpp"
namespace urde namespace urde
{ {
@ -308,14 +310,73 @@ bool CInGameGuiManager::CheckLoadComplete(CStateManager& stateMgr)
} }
} }
void CInGameGuiManager::RefreshHudOptions()
{
x34_samusHud->RefreshHudOptions();
}
void CInGameGuiManager::OnNewPauseScreenState(CArchitectureQueue& archQueue) void CInGameGuiManager::OnNewPauseScreenState(CArchitectureQueue& archQueue)
{ {
if (x1c0_nextState != EInGameGuiState::PauseGame && x1c0_nextState != EInGameGuiState::PauseLogBook)
{
if (x48_pauseScreen->IsTransitioning())
return;
x48_pauseScreen.reset();
}
if (x1c0_nextState >= EInGameGuiState::Zero && x1c0_nextState <= EInGameGuiState::InGame)
{
if (x44_messageScreen)
x44_messageScreen.reset();
RefreshHudOptions();
}
x1bc_prevState = x1c0_nextState;
} }
void CInGameGuiManager::UpdateAutoMapper(float dt, const CStateManager& stateMgr) void CInGameGuiManager::UpdateAutoMapper(float dt, const CStateManager& stateMgr)
{ {
x38_autoMapper->Update(dt, stateMgr);
zeus::CTransform xf = x148_model_automapper->GetParent()->GetWorldTransform() *
x144_basewidget_automapper->GetTransform();
x154_automapperRotate = zeus::CQuaternion(xf.basis);
x164_automapperOffset = xf.origin;
x170_camRotate = zeus::CQuaternion(x14c_basehud_camera->GetWorldTransform().basis);
x180_camOffset = x14c_basehud_camera->GetWorldTransform().basis[1] * 2.f +
x14c_basehud_camera->GetWorldPosition() +
x14c_basehud_camera->GetWorldTransform().basis[2] * g_tweakAutoMapper->GetCamVerticalOffset();
float frameLength = std::tan(zeus::degToRad(x14c_basehud_camera->GetProjection().xbc_fov) / 2.f) / 0.7f;
float scaleX = frameLength * g_tweakAutoMapper->GetAutomapperScaleX();
float scaleZ = frameLength * g_tweakAutoMapper->GetAutomapperScaleZ();
if (x38_autoMapper->IsFullyOutOfMiniMapState())
{
x148_model_automapper->SetO2WTransform(
zeus::CTransform(x170_camRotate, x180_camOffset) * zeus::CTransform::Scale(scaleX, 1.f, scaleZ));
x18c_camXf = zeus::CTransform(x170_camRotate, x180_camOffset) *
zeus::CTransform::Scale(frameLength, 1.f, frameLength);
x148_model_automapper->SetColor(g_tweakAutoMapper->GetAutomapperWidgetColor());
}
else if (x38_autoMapper->IsFullyInMiniMapState())
{
x148_model_automapper->SetO2WTransform(zeus::CTransform(x154_automapperRotate, x164_automapperOffset));
x18c_camXf = x148_model_automapper->GetWorldTransform();
x148_model_automapper->SetColor(g_tweakAutoMapper->GetAutomapperWidgetMiniColor());
}
else
{
float t;
if (x38_autoMapper->GetNextState() != CAutoMapper::EAutoMapperState::MiniMap)
t = x38_autoMapper->GetInterp();
else
t = 1.f - x38_autoMapper->GetInterp();
float st = t * (frameLength - 1.f) + 1.f;
x148_model_automapper->SetO2WTransform(zeus::CTransform(
zeus::CQuaternion::slerp(x154_automapperRotate, x170_camRotate, t),
x164_automapperOffset * (1.f - t) + x180_camOffset * t) * zeus::CTransform::Scale(st, 1.f, st));
x148_model_automapper->SetColor(zeus::CColor::lerp(g_tweakAutoMapper->GetAutomapperWidgetMiniColor(),
g_tweakAutoMapper->GetAutomapperWidgetColor(), t));
}
} }
void CInGameGuiManager::Update(CStateManager& stateMgr, float dt, CArchitectureQueue& archQueue, bool useHud) void CInGameGuiManager::Update(CStateManager& stateMgr, float dt, CArchitectureQueue& archQueue, bool useHud)
@ -503,7 +564,170 @@ void CInGameGuiManager::PreDraw(CStateManager& stateMgr, bool cameraActive)
void CInGameGuiManager::Draw(CStateManager& stateMgr) void CInGameGuiManager::Draw(CStateManager& stateMgr)
{ {
//if (!GetIsGameDraw())
// g_Renderer->x318_26_requestRGBA6 = true;
if (x1d8_onScreenTexAlpha > 0.f && x1dc_onScreenTexTok.IsLoaded())
{
if (!m_onScreenQuad || m_onScreenQuad->GetTex().GetObj() != x1dc_onScreenTexTok.GetObj())
m_onScreenQuad.emplace(CCameraFilterPass::EFilterType::Blend, x1dc_onScreenTexTok);
// No depth read/write
// Alpha blend
int w = (g_Viewport.x0_left + (x1c4_onScreenTex.x4_origin.x - g_Viewport.x8_width) / 2 + x1c4_onScreenTex.xc_extent.x) -
x1c4_onScreenTex.x4_origin.x;
int h = (g_Viewport.x4_top + (x1c4_onScreenTex.x4_origin.y - g_Viewport.xc_height) / 2 - x1c4_onScreenTex.xc_extent.y) -
x1c4_onScreenTex.x4_origin.y;
zeus::CRectangle rect(x1c4_onScreenTex.x4_origin.x / float(g_Viewport.x8_width),
x1c4_onScreenTex.x4_origin.y / float(g_Viewport.xc_height),
w / float(g_Viewport.x8_width), h / float(g_Viewport.xc_height));
m_onScreenQuad->draw(zeus::CColor(1.f, x1d8_onScreenTexAlpha), 1.f, rect);
}
float staticAlpha = 0.f;
if (stateMgr.GetPlayer().GetMorphballTransitionState() == CPlayer::EPlayerMorphBallState::Unmorphed &&
stateMgr.GetPlayer().GetDeathTime() > 0.f)
staticAlpha = zeus::clamp(0.f, stateMgr.GetPlayer().GetDeathTime() / (0.3f * 2.5f), 1.f);
bool notInCine = !stateMgr.GetCameraManager()->IsInCinematicCamera();
bool drawVisor = false;
if (notInCine && (x1bc_prevState == EInGameGuiState::InGame || x1c0_nextState == EInGameGuiState::InGame))
drawVisor = true;
if (x3c_pauseScreenBlur->GetX50_25())
{
x34_samusHud->GetTargetingManager().Draw(stateMgr, true);
CGraphics::SetDepthRange(0.015625f, 0.03125f);
bool scanVisor = stateMgr.GetPlayerState()->GetActiveVisor(stateMgr) == CPlayerState::EPlayerVisor::Scan;
if (drawVisor && x1f0_enablePlayerVisor)
{
if (stateMgr.GetPlayer().GetCameraState() == CPlayer::EPlayerCameraState::Zero)
x20_faceplateDecor.Draw(stateMgr);
CTargetingManager* tgtMgr = nullptr;
if (scanVisor && x1e4_enableTargetingManager)
tgtMgr = &x34_samusHud->GetTargetingManager();
x30_playerVisor->Draw(stateMgr, tgtMgr);
}
x40_samusReflection->Draw(stateMgr);
if (drawVisor)
{
CGraphics::SetDepthRange(0.001953125f, 0.015625f);
if (staticAlpha > 0.f)
{
CCameraFilterPass::DrawFilter(CCameraFilterPass::EFilterType::Blend,
CCameraFilterPass::EFilterShape::RandomStatic,
zeus::CColor(1.f, staticAlpha), nullptr, 1.f);
}
x34_samusHud->Draw(stateMgr, x1f4_visorStaticAlpha * (1.f - staticAlpha),
x1e0_helmetVisMode, x1ec_hudVisMode != EHudVisMode::Zero,
x1e4_enableTargetingManager && !scanVisor);
}
}
float preDrawBlur = true;
if (x1bc_prevState >= EInGameGuiState::Zero && x1bc_prevState <= EInGameGuiState::InGame)
if (x1bc_prevState != EInGameGuiState::MapScreen && x1c0_nextState != EInGameGuiState::MapScreen)
preDrawBlur = false;
if (preDrawBlur)
x3c_pauseScreenBlur->Draw(stateMgr);
if (notInCine && x1e8_enableAutoMapper &&
(x3c_pauseScreenBlur->GetX50_25() || x1bc_prevState == EInGameGuiState::MapScreen ||
x1c0_nextState == EInGameGuiState::MapScreen))
{
float t;
if (stateMgr.GetPlayerState()->GetCurrentVisor() == CPlayerState::EPlayerVisor::Combat)
t = stateMgr.GetPlayerState()->GetVisorTransitionFactor();
else
t = 0.f;
float mapAlpha;
if (g_tweakGui->GetShowAutomapperInMorphball())
mapAlpha = 1.f;
else if (stateMgr.GetPlayer().GetMorphballTransitionState() == CPlayer::EPlayerMorphBallState::Unmorphed)
mapAlpha = 1.f;
else
mapAlpha = 0.f;
x34_samusHud->GetBaseHudFrame()->GetFrameCamera()->Draw(CGuiWidgetDrawParms(0.f, zeus::CVector3f::skZero));
CGraphics::SetDepthRange(0.f, 0.001953125f);
x148_model_automapper->SetIsVisible(true);
x148_model_automapper->Draw(CGuiWidgetDrawParms(1.f, zeus::CVector3f::skZero));
// ZTest no write
x38_autoMapper->Draw(stateMgr, zeus::CTransform::Translate(0.f, 0.02f, 0.f) * x18c_camXf, mapAlpha * x1f4_visorStaticAlpha * t);
// Zest and write
x148_model_automapper->SetIsVisible(false);
}
if (!preDrawBlur)
x3c_pauseScreenBlur->Draw(stateMgr);
if (x1e0_helmetVisMode != EHelmetVisMode::ReducedUpdate && notInCine)
{
float camYOff;
if (!x48_pauseScreen)
camYOff = 0.f;
else
camYOff = x48_pauseScreen->GetHelmetCamYOff();
x34_samusHud->DrawHelmet(stateMgr, camYOff);
}
if (x4c_saveUI)
x4c_saveUI->Draw();
if (x44_messageScreen)
x44_messageScreen->Draw();
if (x48_pauseScreen)
x48_pauseScreen->Draw();
xf8_camFilter.Draw();
if (stateMgr.GetPlayer().GetDeathTime() > 0.f)
{
float dieDur;
if (stateMgr.GetPlayer().GetMorphballTransitionState() == CPlayer::EPlayerMorphBallState::Unmorphed)
dieDur = 2.5f;
else
dieDur = 6.f;
float alpha = zeus::clamp(0.f, stateMgr.GetPlayer().GetDeathTime() / dieDur, 1.f);
CCameraFilterPass::DrawFilter(CCameraFilterPass::EFilterType::Blend,
CCameraFilterPass::EFilterShape::Fullscreen,
zeus::CColor(1.f, alpha), nullptr, 1.f);
float zStart = dieDur - 0.5f - 0.5f - 1.f;
float xStart = 0.5f - zStart;
float colStart = 0.5f - xStart;
if (stateMgr.GetPlayer().GetDeathTime() > zStart)
{
float zT = 1.f - zeus::clamp(0.f, (stateMgr.GetPlayer().GetDeathTime() - zStart) / 0.5f, 1.f);
float xT = 1.f - zeus::clamp(0.f, (stateMgr.GetPlayer().GetDeathTime() - xStart) / 0.5f, 1.f);
float colT = 1.f - zeus::clamp(0.f, (stateMgr.GetPlayer().GetDeathTime() - colStart) / 0.5f, 1.f);
SClipScreenRect rect(g_Viewport);
CGraphics::ResolveSpareTexture(rect);
CCameraFilterPass::DrawFilter(CCameraFilterPass::EFilterType::Blend,
CCameraFilterPass::EFilterShape::Fullscreen,
zeus::CColor::skBlack, nullptr, 1.f);
float z = 0.5f * (zT * zT * zT * zT * zT * (g_Viewport.xc_height - 12.f) + 12.f);
float x = 0.5f * (xT * (g_Viewport.x8_width - 12.f) + 12.f);
CTexturedQuadFilter::Vert verts[] =
{
{{-x, 0.f, z}, {0.f, 0.f}},
{{-x, 0.f, -z}, {0.f, 1.f}},
{{x, 0.f, z}, {1.f, 0.f}},
{{x, 0.f, -z}, {1.f, 1.f}}
};
if (!m_deathRenderTexQuad)
m_deathRenderTexQuad.emplace(CCameraFilterPass::EFilterType::Blend, CGraphics::g_SpareTexture);
m_deathRenderTexQuad->drawVerts(zeus::CColor(1.f, colT), verts);
if (!m_deathDotQuad)
m_deathDotQuad.emplace(CCameraFilterPass::EFilterType::Multiply, x50_deathDot);
m_deathDotQuad->drawVerts(zeus::CColor(1.f, colT), verts);
}
}
} }
void CInGameGuiManager::ShowPauseGameHudMessage(CStateManager& stateMgr, ResId pauseMsg, float time) void CInGameGuiManager::ShowPauseGameHudMessage(CStateManager& stateMgr, ResId pauseMsg, float time)
@ -522,7 +746,10 @@ void CInGameGuiManager::PauseGame(CStateManager& stateMgr, EInGameGuiState state
void CInGameGuiManager::StartFadeIn() void CInGameGuiManager::StartFadeIn()
{ {
xf8_camFilter.SetFilter(CCameraFilterPass::EFilterType::Multiply,
CCameraFilterPass::EFilterShape::Fullscreen,
0.f, zeus::CColor::skBlack, -1);
xf8_camFilter.DisableFilter(0.5f);
} }
bool CInGameGuiManager::GetIsGameDraw() const bool CInGameGuiManager::GetIsGameDraw() const
@ -530,12 +757,5 @@ bool CInGameGuiManager::GetIsGameDraw() const
return x3c_pauseScreenBlur->GetX50_25(); return x3c_pauseScreenBlur->GetX50_25();
} }
std::string CInGameGuiManager::GetIdentifierForMidiEvent(ResId world, ResId area,
const std::string& midiObj)
{
return hecl::Format("World %8.8x Area %8.8x MidiObject: %s",
u32(world), u32(area), midiObj.c_str());
}
} }
} }

View File

@ -90,6 +90,7 @@ private:
SOnScreenTex x1c4_onScreenTex; SOnScreenTex x1c4_onScreenTex;
float x1d8_onScreenTexAlpha = 0.f; float x1d8_onScreenTexAlpha = 0.f;
TLockedToken<CTexture> x1dc_onScreenTexTok; // Used to be heap-allocated TLockedToken<CTexture> x1dc_onScreenTexTok; // Used to be heap-allocated
std::experimental::optional<CTexturedQuadFilterAlpha> m_onScreenQuad;
EHelmetVisMode x1e0_helmetVisMode; EHelmetVisMode x1e0_helmetVisMode;
bool x1e4_enableTargetingManager; bool x1e4_enableTargetingManager;
bool x1e8_enableAutoMapper; bool x1e8_enableAutoMapper;
@ -97,6 +98,9 @@ private:
u32 x1f0_enablePlayerVisor; u32 x1f0_enablePlayerVisor;
float x1f4_visorStaticAlpha; float x1f4_visorStaticAlpha;
std::experimental::optional<CTexturedQuadFilter> m_deathRenderTexQuad;
std::experimental::optional<CTexturedQuadFilter> m_deathDotQuad;
union union
{ {
struct struct
@ -120,6 +124,7 @@ private:
bool IsInPausedStateNotTransitioning() const; bool IsInPausedStateNotTransitioning() const;
void UpdateAutoMapper(float dt, const CStateManager& stateMgr); void UpdateAutoMapper(float dt, const CStateManager& stateMgr);
void OnNewPauseScreenState(CArchitectureQueue& archQueue); void OnNewPauseScreenState(CArchitectureQueue& archQueue);
void RefreshHudOptions();
public: public:
CInGameGuiManager(CStateManager& stateMgr, CArchitectureQueue& archQueue); CInGameGuiManager(CStateManager& stateMgr, CArchitectureQueue& archQueue);
@ -136,7 +141,6 @@ public:
bool IsInGame() const { return x1c0_nextState >= EInGameGuiState::Zero && x1c0_nextState <= EInGameGuiState::InGame; } bool IsInGame() const { return x1c0_nextState >= EInGameGuiState::Zero && x1c0_nextState <= EInGameGuiState::InGame; }
bool IsInSaveUI() const { return x1f8_27_exitSaveUI; } bool IsInSaveUI() const { return x1f8_27_exitSaveUI; }
bool GetIsGameDraw() const; bool GetIsGameDraw() const;
static std::string GetIdentifierForMidiEvent(ResId world, ResId area, const std::string& midiObj);
}; };
} }

View File

@ -20,5 +20,10 @@ bool CMessageScreen::Update(float dt, float blurAmt)
return false; return false;
} }
void CMessageScreen::Draw() const
{
}
} }
} }

View File

@ -16,6 +16,7 @@ public:
CMessageScreen(ResId msg, float time); CMessageScreen(ResId msg, float time);
void ProcessControllerInput(const CFinalInput& input); void ProcessControllerInput(const CFinalInput& input);
bool Update(float dt, float blurAmt); bool Update(float dt, float blurAmt);
void Draw() const;
}; };
} }

View File

@ -300,5 +300,12 @@ bool CPauseScreen::ShouldSwitchToInGame() const
return IsLoaded() && x8_curSubscreen == ESubScreen::ToGame && xc_nextSubscreen == ESubScreen::ToGame; return IsLoaded() && x8_curSubscreen == ESubScreen::ToGame && xc_nextSubscreen == ESubScreen::ToGame;
} }
float CPauseScreen::GetHelmetCamYOff() const
{
if (CPauseScreenBase* screen = x7c_screens[x78_activeIdx].get())
return screen->GetCameraYBias();
return 0.f;
}
} }
} }

View File

@ -71,6 +71,8 @@ public:
bool IsLoaded() const { return x90_resourcesLoaded; } bool IsLoaded() const { return x90_resourcesLoaded; }
bool ShouldSwitchToMapScreen() const; bool ShouldSwitchToMapScreen() const;
bool ShouldSwitchToInGame() const; bool ShouldSwitchToInGame() const;
bool IsTransitioning() const { return x8_curSubscreen != xc_nextSubscreen; }
float GetHelmetCamYOff() const;
}; };
} }

View File

@ -25,5 +25,10 @@ void CPauseScreenBlur::Update(float dt, const CStateManager& stateMgr, bool)
} }
void CPauseScreenBlur::Draw(const CStateManager& stateMgr) const
{
}
} }
} }

View File

@ -29,6 +29,7 @@ public:
void OnNewInGameGuiState(EInGameGuiState state, CStateManager& stateMgr); void OnNewInGameGuiState(EInGameGuiState state, CStateManager& stateMgr);
bool GetX50_25() const { return x50_25_; } bool GetX50_25() const { return x50_25_; }
void Update(float dt, const CStateManager& stateMgr, bool); void Update(float dt, const CStateManager& stateMgr, bool);
void Draw(const CStateManager& stateMgr) const;
float GetBlurAmt() const { return std::fabs(x18_blurAmt); } float GetBlurAmt() const { return std::fabs(x18_blurAmt); }
bool IsNotTransitioning() const { return x10_ == x14_; } bool IsNotTransitioning() const { return x10_ == x14_; }
}; };

View File

@ -15,6 +15,11 @@ void CPlayerVisor::Update(float dt, const CStateManager& stateMgr)
} }
void CPlayerVisor::Draw(const CStateManager& stateMgr, const CTargetingManager* tgtManager) const
{
}
void CPlayerVisor::Touch() void CPlayerVisor::Touch()
{ {

View File

@ -4,6 +4,7 @@
namespace urde namespace urde
{ {
class CStateManager; class CStateManager;
class CTargetingManager;
namespace MP1 namespace MP1
{ {
@ -13,6 +14,7 @@ class CPlayerVisor
public: public:
CPlayerVisor(CStateManager& stateMgr); CPlayerVisor(CStateManager& stateMgr);
void Update(float dt, const CStateManager& stateMgr); void Update(float dt, const CStateManager& stateMgr);
void Draw(const CStateManager& stateMgr, const CTargetingManager* tgtManager) const;
void Touch(); void Touch();
float GetDesiredViewportScaleX(const CStateManager& stateMgr) const; float GetDesiredViewportScaleX(const CStateManager& stateMgr) const;
float GetDesiredViewportScaleY(const CStateManager& stateMgr) const; float GetDesiredViewportScaleY(const CStateManager& stateMgr) const;

View File

@ -21,6 +21,11 @@ void CSamusFaceReflection::PreDraw(const CStateManager& stateMgr)
} }
void CSamusFaceReflection::Draw(const CStateManager& stateMgr) const
{
}
void CSamusFaceReflection::Update(float dt, const CStateManager& stateMgr, CRandom16& rand) void CSamusFaceReflection::Update(float dt, const CStateManager& stateMgr, CRandom16& rand)
{ {

View File

@ -20,6 +20,7 @@ class CSamusFaceReflection
public: public:
CSamusFaceReflection(CStateManager& stateMgr); CSamusFaceReflection(CStateManager& stateMgr);
void PreDraw(const CStateManager& stateMgr); void PreDraw(const CStateManager& stateMgr);
void Draw(const CStateManager& stateMgr) const;
void Update(float dt, const CStateManager& stateMgr, CRandom16& rand); void Update(float dt, const CStateManager& stateMgr, CRandom16& rand);
}; };

View File

@ -8,6 +8,7 @@
#include "GuiSys/CGuiLight.hpp" #include "GuiSys/CGuiLight.hpp"
#include "GuiSys/CGuiModel.hpp" #include "GuiSys/CGuiModel.hpp"
#include "GuiSys/CGuiCamera.hpp" #include "GuiSys/CGuiCamera.hpp"
#include "GuiSys/CGuiWidgetDrawParms.hpp"
#include "Camera/CFirstPersonCamera.hpp" #include "Camera/CFirstPersonCamera.hpp"
#include "TCastTo.hpp" #include "TCastTo.hpp"
#include "World/CGameLight.hpp" #include "World/CGameLight.hpp"
@ -1510,6 +1511,124 @@ void CSamusHud::Update(float dt, const CStateManager& mgr,
x29c_decoIntf->Update(dt, mgr); x29c_decoIntf->Update(dt, mgr);
} }
void CSamusHud::DrawAttachedEnemyEffect(const CStateManager& mgr) const
{
float drainTime = mgr.GetPlayer().GetEnergyDrain().GetEnergyDrainTime();
if (drainTime <= 0.f)
return;
float modPeriod = g_tweakGui->GetEnergyDrainModPeriod();
float alpha;
if (g_tweakGui->GetEnergyDrainSinusoidalPulse())
{
alpha = (std::sin(-0.25f * modPeriod + 2.f * M_PIF * drainTime / modPeriod) + 1.f) * 0.5f;
}
else
{
float halfModPeriod = 0.5 * modPeriod;
float tmp = std::fabs(std::fmod(drainTime, modPeriod));
if (tmp < halfModPeriod)
alpha = tmp / halfModPeriod;
else
alpha = (modPeriod - tmp) / halfModPeriod;
}
zeus::CColor filterColor = g_tweakGuiColors->GetEnergyDrainFilterColor();
filterColor.a *= alpha;
CCameraFilterPass::DrawFilter(g_tweakGui->GetEnergyDrainFilterAdditive() ?
CCameraFilterPass::EFilterType::Add : CCameraFilterPass::EFilterType::Blend,
CCameraFilterPass::EFilterShape::Fullscreen, filterColor,
nullptr, 1.f);
}
void CSamusHud::Draw(const CStateManager& mgr, float alpha,
CInGameGuiManager::EHelmetVisMode helmetVis,
bool hudVis, bool targetingManager) const
{
if (x2bc_nextState == EHudState::None)
return;
if (mgr.GetPlayer().GetMorphballTransitionState() == CPlayer::EPlayerMorphBallState::Unmorphed)
{
DrawAttachedEnemyEffect(mgr);
x51c_camFilter2.Draw();
if (targetingManager)
x8_targetingMgr.Draw(mgr, false);
}
if (helmetVis != CInGameGuiManager::EHelmetVisMode::ReducedUpdate &&
helmetVis < CInGameGuiManager::EHelmetVisMode::HelmetOnly)
{
if (alpha < 1.f)
{
CCameraFilterPass::DrawFilter(CCameraFilterPass::EFilterType::NoColor,
CCameraFilterPass::EFilterShape::CookieCutterDepthRandomStatic,
zeus::CColor::skWhite, nullptr, 1.f - alpha);
}
if (x288_loadedSelectedHud)
{
if (mgr.GetPlayer().GetDeathTime() > 0.f)
{
if (mgr.GetPlayer().GetMorphballTransitionState() != CPlayer::EPlayerMorphBallState::Unmorphed)
{
CGuiWidgetDrawParms parms(
x2c8_transT * zeus::clamp(0.f, 1.f - mgr.GetPlayer().GetDeathTime() / 6.f, 1.f),
zeus::CVector3f::skZero);
x288_loadedSelectedHud->Draw(parms);
}
else
{
CGuiWidgetDrawParms parms(x2c8_transT, zeus::CVector3f::skZero);
x288_loadedSelectedHud->Draw(parms);
}
}
else
{
CGuiWidgetDrawParms parms(x2c8_transT, zeus::CVector3f::skZero);
x288_loadedSelectedHud->Draw(parms);
}
}
if (x274_loadedFrmeBaseHud)
x274_loadedFrmeBaseHud->Draw(CGuiWidgetDrawParms::Default);
}
if (x29c_decoIntf && !x2cc_preLoadCountdown)
x29c_decoIntf->Draw();
if (x2bc_nextState >= EHudState::Combat && x2bc_nextState <= EHudState::Scan)
{
if (hudVis &&
helmetVis != CInGameGuiManager::EHelmetVisMode::ReducedUpdate &&
helmetVis < CInGameGuiManager::EHelmetVisMode::HelmetOnly)
{
float t;
if (mgr.GetPlayerState()->GetCurrentVisor() == CPlayerState::EPlayerVisor::Combat)
t = mgr.GetPlayerState()->GetVisorTransitionFactor();
else
t = 0.f;
x2ac_radarIntf->Draw(mgr, t * alpha);
}
// Depth read/write enable
}
}
void CSamusHud::DrawHelmet(const CStateManager& mgr, float camYOff) const
{
if (!x264_loadedFrmeHelmet ||
mgr.GetPlayer().GetMorphballTransitionState() != CPlayer::EPlayerMorphBallState::Unmorphed ||
x2bc_nextState == EHudState::Ball)
return;
float t;
if (x2c4_activeTransState == ETransitionState::Transitioning && x2b8_curState == EHudState::Ball)
t = x2c8_transT;
else
t = 1.f;
x264_loadedFrmeHelmet->Draw(CGuiWidgetDrawParms(t, zeus::CVector3f(0.f, 15.f * camYOff, 0.f)));
}
void CSamusHud::ProcessControllerInput(const CFinalInput& input) void CSamusHud::ProcessControllerInput(const CFinalInput& input)
{ {
if (x29c_decoIntf) if (x29c_decoIntf)

View File

@ -92,8 +92,7 @@ class CSamusHud
{ {
u32 x0_ = 0; u32 x0_ = 0;
u32 x4_ = 0; u32 x4_ = 0;
u32 x8_ = 0; u64 x8_profUsec = 0;
u32 xc_ = 0;
}; };
friend class CInGameGuiManager; friend class CInGameGuiManager;
@ -240,6 +239,7 @@ class CSamusHud
void ShowDamage(const zeus::CVector3f& position, float dam, float prevDam, const CStateManager& mgr); void ShowDamage(const zeus::CVector3f& position, float dam, float prevDam, const CStateManager& mgr);
void EnterFirstPerson(const CStateManager& mgr); void EnterFirstPerson(const CStateManager& mgr);
void LeaveFirstPerson(const CStateManager& mgr); void LeaveFirstPerson(const CStateManager& mgr);
void DrawAttachedEnemyEffect(const CStateManager& mgr) const;
static EHudState GetDesiredHudState(const CStateManager& mgr); static EHudState GetDesiredHudState(const CStateManager& mgr);
public: public:
@ -248,6 +248,10 @@ public:
void Update(float dt, const CStateManager& mgr, void Update(float dt, const CStateManager& mgr,
CInGameGuiManager::EHelmetVisMode helmetVis, CInGameGuiManager::EHelmetVisMode helmetVis,
bool hudVis, bool targetingManager); bool hudVis, bool targetingManager);
void Draw(const CStateManager& mgr, float alpha,
CInGameGuiManager::EHelmetVisMode helmetVis,
bool hudVis, bool targetingManager) const;
void DrawHelmet(const CStateManager& mgr, float camYOff) const;
void ProcessControllerInput(const CFinalInput& input); void ProcessControllerInput(const CFinalInput& input);
void UpdateStateTransition(float time, const CStateManager& mgr); void UpdateStateTransition(float time, const CStateManager& mgr);
bool CheckLoadComplete(CStateManager& stateMgr); bool CheckLoadComplete(CStateManager& stateMgr);
@ -275,6 +279,7 @@ public:
g_SamusHud->InternalDeferHintMemo(strg, strgIdx, info); g_SamusHud->InternalDeferHintMemo(strg, strgIdx, info);
} }
void InternalDeferHintMemo(ResId strg, u32 strgIdx, const CHUDMemoParms& info); void InternalDeferHintMemo(ResId strg, u32 strgIdx, const CHUDMemoParms& info);
CGuiFrame* GetBaseHudFrame() const { return x274_loadedFrmeBaseHud; }
}; };
} }

View File

@ -101,7 +101,7 @@ private:
u32 x258_jumpState = 0; u32 x258_jumpState = 0;
TUniqueId x26c_ = kInvalidUniqueId; TUniqueId x26c_ = kInvalidUniqueId;
float x270_ = 0.f; float x270_ = 0.f;
CPlayerEnergyDrain x274_ = CPlayerEnergyDrain(4); CPlayerEnergyDrain x274_energyDrain = CPlayerEnergyDrain(4);
float x288_ = 0.f; float x288_ = 0.f;
float x28c_sjTimer = 0.f; float x28c_sjTimer = 0.f;
float x290_ = 0.f; float x290_ = 0.f;
@ -363,6 +363,7 @@ public:
void UpdateGunTransform(const zeus::CVector3f&, float, CStateManager& mgr, bool); void UpdateGunTransform(const zeus::CVector3f&, float, CStateManager& mgr, bool);
void DrawGun(CStateManager& mgr); void DrawGun(CStateManager& mgr);
void HolsterGun(CStateManager& mgr); void HolsterGun(CStateManager& mgr);
EPlayerCameraState GetCameraState() const { return x2f4_cameraState; }
EPlayerMorphBallState GetMorphballTransitionState() const { return x2f8_morphTransState; } EPlayerMorphBallState GetMorphballTransitionState() const { return x2f8_morphTransState; }
void UpdateGrappleArmTransform(const zeus::CVector3f&, CStateManager& mgr, float); void UpdateGrappleArmTransform(const zeus::CVector3f&, CStateManager& mgr, float);
void ApplyGrappleForces(const CFinalInput& input, CStateManager& mgr, float); void ApplyGrappleForces(const CFinalInput& input, CStateManager& mgr, float);
@ -455,6 +456,8 @@ public:
CPlayerGun* GetPlayerGun() const { return x490_gun.get(); } CPlayerGun* GetPlayerGun() const { return x490_gun.get(); }
CMorphBall* GetMorphBall() const { return x768_morphball.get(); } CMorphBall* GetMorphBall() const { return x768_morphball.get(); }
CPlayerCameraBob* GetCameraBob() const { return x76c_cameraBob.get(); } CPlayerCameraBob* GetCameraBob() const { return x76c_cameraBob.get(); }
float GetDeathTime() const { return x9f4_deathTime; }
const CPlayerEnergyDrain& GetEnergyDrain() const { return x274_energyDrain; }
void Touch(); void Touch();

View File

@ -30,7 +30,7 @@ void CScriptMidi::Stop(CStateManager& mgr, float fadeTime)
{ {
const CWorld* wld = mgr.GetWorld(); const CWorld* wld = mgr.GetWorld();
const CGameArea* area = wld->GetAreaAlways(x4_areaId); const CGameArea* area = wld->GetAreaAlways(x4_areaId);
std::string twkName = MP1::CInGameGuiManager::GetIdentifierForMidiEvent(wld->IGetWorldAssetId(), std::string twkName = CInGameTweakManagerBase::GetIdentifierForMidiEvent(wld->IGetWorldAssetId(),
area->GetAreaAssetId(), area->GetAreaAssetId(),
x10_name); x10_name);
if (g_TweakManager->HasTweakValue(twkName)) if (g_TweakManager->HasTweakValue(twkName))
@ -47,7 +47,7 @@ void CScriptMidi::Play(CStateManager& mgr, float fadeTime)
u32 volume = x48_volume; u32 volume = x48_volume;
const CWorld* wld = mgr.GetWorld(); const CWorld* wld = mgr.GetWorld();
const CGameArea* area = wld->GetAreaAlways(x4_areaId); const CGameArea* area = wld->GetAreaAlways(x4_areaId);
std::string twkName = MP1::CInGameGuiManager::GetIdentifierForMidiEvent(wld->IGetWorldAssetId(), std::string twkName = CInGameTweakManagerBase::GetIdentifierForMidiEvent(wld->IGetWorldAssetId(),
area->GetAreaAssetId(), area->GetAreaAssetId(),
x10_name); x10_name);
if (g_TweakManager->HasTweakValue(twkName)) if (g_TweakManager->HasTweakValue(twkName))

View File

@ -278,9 +278,7 @@ void CWorldTransManager::DrawEnabled()
{ {
float t = zeus::clamp(0.f, (x0_curTime - x4_modelData->x1d0_dissolveStartTime) / 2.f, 1.f); float t = zeus::clamp(0.f, (x0_curTime - x4_modelData->x1d0_dissolveStartTime) / 2.f, 1.f);
DrawFirstPass(); DrawFirstPass();
SClipScreenRect rect = {}; SClipScreenRect rect(g_Viewport);
rect.xc_width = g_Viewport.x8_width;
rect.x10_height = g_Viewport.xc_height;
CGraphics::ResolveSpareTexture(rect); CGraphics::ResolveSpareTexture(rect);
CGraphics::g_BooMainCommandQueue->clearTarget(true, true); CGraphics::g_BooMainCommandQueue->clearTarget(true, true);
DrawSecondPass(); DrawSecondPass();