Lots of HUD-related implementations

This commit is contained in:
Jack Andersen 2017-04-01 17:03:37 -10:00
parent 1731cae418
commit b3c94f1d2b
64 changed files with 2066 additions and 106 deletions

View File

@ -36,6 +36,13 @@ struct ITweakGui : ITweak
virtual float GetScanSpeed(int idx) const=0;
virtual float GetXrayBlurScaleLinear() const=0;
virtual float GetXrayBlurScaleQuadratic() const=0;
virtual float GetScanSidesAngle() const=0;
virtual float GetScanSidesXScale() const=0;
virtual float GetScanSidesPositionEnd() const=0;
virtual float GetScanSidesDuration() const=0;
virtual float GetScanSidesStartTime() const=0;
virtual float GetScanSidesEndTime() const=0;
virtual float GetScanSidesPositionStart() const=0;
virtual float GetWorldTransManagerCharsPerSfx() const=0;
virtual atUint32 GetXRayFogMode() const=0;
virtual float GetXRayFogNearZ() const=0;

View File

@ -7,6 +7,12 @@ namespace DataSpec
{
struct ITweakGuiColors : BigYAML
{
virtual zeus::CColor GetHudMessageFill() const=0;
virtual zeus::CColor GetHudMessageOutline() const=0;
virtual zeus::CColor GetHudFrameColor() const=0;
virtual zeus::CColor GetTickDecoColor() const=0;
virtual zeus::CColor GetHudCounterFill() const=0;
virtual zeus::CColor GetHudCounterOutline() const=0;
};
}

View File

@ -13,6 +13,7 @@ struct ITweakPlayer : ITweak
virtual float GetX54() const=0;
virtual float GetX58() const=0;
virtual float GetX5C() const=0;
virtual float GetScanningRange() const=0; // x218
virtual float GetPlayerHeight() const=0; // x26c
virtual float GetPlayerXYHalfExtent() const=0; // x270
virtual bool GetX228_24() const=0; // x228_24

View File

@ -123,13 +123,13 @@ struct CTweakGui : ITweakGui
float x204_xrayBlurScaleLinear = 0.0014f;
float x208_xrayBlurScaleQuadratic = 0.0000525f;
Value<float> x20c_;
Value<float> x210_;
Value<float> x214_;
Value<float> x218_;
Value<float> x210_scanSidesAngle;
Value<float> x214_scanSidesXScale;
Value<float> x218_scanSidesPositionEnd;
Value<float> x21c_;
Value<float> x220_;
Value<float> x224_;
float x228_;
Value<float> x220_scanSidesDuration;
Value<float> x224_scanSidesStartTime;
float x228_scanSidesEndTime;
Value<float> x22c_;
Value<float> x230_;
Value<float> x234_;
@ -147,7 +147,7 @@ struct CTweakGui : ITweakGui
Value<float> x264_;
Value<float> x268_;
Value<float> x26c_;
Value<float> x270_;
Value<float> x270_scanSidesPositionStart;
Value<bool> x274_;
bool x275_ = true;
Value<float> x278_wtMgrCharsPerSfx;
@ -204,6 +204,13 @@ struct CTweakGui : ITweakGui
float GetScanAppearanceOffset() const { return x244_scanAppearanceOffset; }
float GetXrayBlurScaleLinear() const { return x204_xrayBlurScaleLinear; }
float GetXrayBlurScaleQuadratic() const { return x208_xrayBlurScaleQuadratic; }
float GetScanSidesAngle() const { return x210_scanSidesAngle; }
float GetScanSidesXScale() const { return x214_scanSidesXScale; }
float GetScanSidesPositionEnd() const { return x218_scanSidesPositionEnd; }
float GetScanSidesDuration() const { return x220_scanSidesDuration; }
float GetScanSidesStartTime() const { return x224_scanSidesStartTime; }
float GetScanSidesEndTime() const { return x228_scanSidesEndTime; }
float GetScanSidesPositionStart() const { return x270_scanSidesPositionStart; }
float GetWorldTransManagerCharsPerSfx() const { return x278_wtMgrCharsPerSfx; }
atUint32 GetXRayFogMode() const { return x27c_xrayFogMode; }
float GetXRayFogNearZ() const { return x280_xrayFogNearZ; }
@ -228,8 +235,8 @@ struct CTweakGui : ITweakGui
x204_xrayBlurScaleLinear = x1f8_ * 0.25f;
x208_xrayBlurScaleQuadratic = x1fc_ * 0.25f;
x210_ = zeus::degToRad(x210_);
x228_ = x220_ + x224_;
x210_scanSidesAngle = zeus::degToRad(x210_scanSidesAngle);
x228_scanSidesEndTime = x220_scanSidesDuration + x224_scanSidesStartTime;
if (x27c_xrayFogMode == 1)
x27c_xrayFogMode = 2;

View File

@ -14,9 +14,9 @@ struct CTweakGuiColors : public ITweakGuiColors
DNAColor x8_;
DNAColor xc_;
DNAColor x10_;
DNAColor x14_;
DNAColor x18_;
DNAColor x1c_;
DNAColor x14_hudMessageFill;
DNAColor x18_hudMessageOutline;
DNAColor x1c_hudFrameColor;
DNAColor x20_;
DNAColor x24_;
DNAColor x28_;
@ -43,7 +43,7 @@ struct CTweakGuiColors : public ITweakGuiColors
DNAColor x7c_;
DNAColor x80_;
DNAColor x84_;
DNAColor x88_;
DNAColor x88_tickDecoColor;
DNAColor x8c_;
DNAColor x90_;
DNAColor x94_;
@ -105,8 +105,8 @@ struct CTweakGuiColors : public ITweakGuiColors
DNAColor x174_;
DNAColor x178_;
DNAColor x17c_;
DNAColor x180_;
DNAColor x184_;
DNAColor x180_hudCounterFill;
DNAColor x184_hudCounterOutline;
DNAColor x188_;
DNAColor x18c_;
DNAColor x190_;
@ -138,6 +138,13 @@ struct CTweakGuiColors : public ITweakGuiColors
CTweakGuiColors() = default;
CTweakGuiColors(athena::io::IStreamReader& r) { this->read(r); }
zeus::CColor GetHudMessageFill() const { return x14_hudMessageFill; }
zeus::CColor GetHudMessageOutline() const { return x18_hudMessageOutline; }
zeus::CColor GetHudFrameColor() const { return x1c_hudFrameColor; }
zeus::CColor GetTickDecoColor() const { return x88_tickDecoColor; }
zeus::CColor GetHudCounterFill() const { return x180_hudCounterFill; }
zeus::CColor GetHudCounterOutline() const { return x184_hudCounterOutline; }
};
}
}

View File

@ -350,7 +350,7 @@ void CTweakPlayer::read(athena::io::IStreamReader& __dna_reader)
/* x214_ */
x214_ = __dna_reader.readFloatBig();
/* x218_ */
x218_ = __dna_reader.readFloatBig();
x218_scanningRange = __dna_reader.readFloatBig();
/* x21c_24_ */
x21c_24_ = __dna_reader.readBool();
/* x21c_25_ */
@ -790,7 +790,7 @@ void CTweakPlayer::write(athena::io::IStreamWriter& __dna_writer) const
/* x214_ */
__dna_writer.writeFloatBig(x214_);
/* x218_ */
__dna_writer.writeFloatBig(x218_);
__dna_writer.writeFloatBig(x218_scanningRange);
/* x21c_24_ */
__dna_writer.writeBool(x21c_24_);
/* x21c_25_ */
@ -1304,8 +1304,8 @@ void CTweakPlayer::read(athena::io::YAMLDocReader& __dna_docin)
x210_ = __dna_docin.readFloat("x210_");
/* x214_ */
x214_ = __dna_docin.readFloat("x214_");
/* x218_ */
x218_ = __dna_docin.readFloat("x218_");
/* x218_scanningRange */
x218_scanningRange = __dna_docin.readFloat("x218_scanningRange");
/* x21c_24_ */
x21c_24_ = __dna_docin.readBool("x21c_24_");
/* x21c_25_ */
@ -1392,12 +1392,12 @@ void CTweakPlayer::read(athena::io::YAMLDocReader& __dna_docin)
x2f8_ = __dna_docin.readFloat("x2f8_");
/* x2fc_ */
x2fc_ = __dna_docin.readUint32("x2fc_");
/* x300_ */
x300_variaDamageReduction = __dna_docin.readFloat("x300_");
/* x304_ */
x304_gravityDamageReduction = __dna_docin.readFloat("x304_");
/* x308_ */
x308_phazonDamageReduction = __dna_docin.readFloat("x308_");
/* x300_variaDamageReduction */
x300_variaDamageReduction = __dna_docin.readFloat("x300_variaDamageReduction");
/* x304_gravityDamageReduction */
x304_gravityDamageReduction = __dna_docin.readFloat("x304_gravityDamageReduction");
/* x308_phazonDamageReduction */
x308_phazonDamageReduction = __dna_docin.readFloat("x308_phazonDamageReduction");
}
void CTweakPlayer::CTweakPlayer::write(athena::io::YAMLDocWriter& __dna_docout) const
@ -1804,8 +1804,8 @@ void CTweakPlayer::CTweakPlayer::write(athena::io::YAMLDocWriter& __dna_docout)
__dna_docout.writeFloat("x210_", x210_);
/* x214_ */
__dna_docout.writeFloat("x214_", x214_);
/* x218_ */
__dna_docout.writeFloat("x218_", x218_);
/* x218_scanningRange */
__dna_docout.writeFloat("x218_scanningRange", x218_scanningRange);
/* x21c_24_ */
__dna_docout.writeBool("x21c_24_", x21c_24_);
/* x21c_25_ */
@ -1892,12 +1892,12 @@ void CTweakPlayer::CTweakPlayer::write(athena::io::YAMLDocWriter& __dna_docout)
__dna_docout.writeFloat("x2f8_", x2f8_);
/* x2fc_ */
__dna_docout.writeUint32("x2fc_", x2fc_);
/* x300_ */
__dna_docout.writeFloat("x300_", x300_variaDamageReduction);
/* x304_ */
__dna_docout.writeFloat("x304_", x304_gravityDamageReduction);
/* x308_ */
__dna_docout.writeFloat("x308_", x308_phazonDamageReduction);
/* x300_variaDamageReduction */
__dna_docout.writeFloat("x300_variaDamageReduction", x300_variaDamageReduction);
/* x304_gravityDamageReduction */
__dna_docout.writeFloat("x304_gravityDamageReduction", x304_gravityDamageReduction);
/* x308_phazonDamageReduction */
__dna_docout.writeFloat("x308_phazonDamageReduction", x308_phazonDamageReduction);
}
void CTweakPlayer::FixupValues()

View File

@ -91,7 +91,7 @@ struct CTweakPlayer : ITweakPlayer
Value<float> x20c_;
Value<float> x210_;
Value<float> x214_;
Value<float> x218_;
Value<float> x218_scanningRange;
Value<bool> x21c_24_ : 1;
Value<bool> x21c_25_ : 1;
Value<bool> x21c_26_ : 1;
@ -179,6 +179,7 @@ struct CTweakPlayer : ITweakPlayer
float GetX54() const { return x44_[4]; }
float GetX58() const { return x44_[5]; }
float GetX5C() const { return x44_[6]; }
float GetScanningRange() const { return x218_scanningRange; }
float GetPlayerHeight() const { return x26c_playerHeight; }
float GetPlayerXYHalfExtent() const { return x270_playerXYHalfExtent; }
float GetX274() const { return x274_; }

View File

@ -3,6 +3,7 @@
#include "RetroTypes.hpp"
#include "Audio/CAudioSys.hpp"
#include "CSaveWorld.hpp"
namespace urde
{
@ -131,9 +132,7 @@ class CGameOptions
u16 _dummy = 0;
};
u32 x70_ = 0;
u32 x74_ = 0;
u32 x78_ = 0;
std::vector<CSaveWorld::SScanState> x6c_scanStates;
public:
CGameOptions();
@ -174,6 +173,7 @@ public:
bool GetIsHintSystemEnabled() const { return x68_28_hintSystem; }
void SetControls(s32);
void ResetControllerAssets();
std::vector<CSaveWorld::SScanState>& GetScanStates() { return x6c_scanStates; }
static void TryRestoreDefaults(const CFinalInput& input, int category,
int option, bool frontend, bool forceRestore);

View File

@ -74,7 +74,6 @@ add_library(RuntimeCommon
CIOWinManager.hpp CIOWinManager.cpp
CStateManager.hpp CStateManager.cpp
CGameState.hpp CGameState.cpp
CScanDisplay.hpp CScanDisplay.cpp
CRelayTracker.hpp CRelayTracker.cpp
CPlayerState.hpp CPlayerState.cpp
CRandom16.hpp CRandom16.cpp

View File

@ -143,6 +143,7 @@ public:
EBeamId GetCurrentBeam() const { return x8_currentBeam; }
bool CanVisorSeeFog(const CStateManager& stateMgr) const;
EPlayerVisor GetCurrentVisor() const { return x14_currentVisor; }
EPlayerVisor GetTransitioningVisor() const { return x18_transitioningVisor; }
EPlayerVisor GetActiveVisor(const CStateManager& stateMgr) const;
void UpdateStaticInterference(CStateManager& stateMgr, const float& dt);
void IncreaseScanTime(u32 time, float val);

View File

@ -1372,7 +1372,7 @@ void CStateManager::ApplyDamageToWorld(TUniqueId damager, const CActor& actor, c
if (player->GetFrozenState())
{
g_GameState->SystemOptions().IncrFreezeBreakCount();
SHudMemoInfo info = {0.f, true, true, true};
CHUDMemoParms info = {0.f, true, true, true};
MP1::CSamusHud::DisplayHudMemo(u"", info);
player->Stop(*this);
}
@ -1973,13 +1973,13 @@ void CStateManager::UpdateHintState(float dt)
{
if (nextHintIdx == -1)
{
SHudMemoInfo memoInfo = {0.f, true, true, true};
CHUDMemoParms memoInfo = {0.f, true, true, true};
MP1::CSamusHud::DisplayHudMemo(u"", memoInfo);
}
else
{
const CGameHintInfo::CGameHint& data = g_MemoryCardSys->GetHints()[nextHintIdx];
SHudMemoInfo memoInfo = {0.f, true, false, true};
CHUDMemoParms memoInfo = {0.f, true, false, true};
MP1::CSamusHud::DeferHintMemo(data.GetStringID(), hintPeriods, memoInfo);
}
xeec_hintIdx = nextHintIdx;

View File

@ -111,7 +111,7 @@ void CFirstPersonCamera::UpdateTransform(CStateManager& mgr, float dt)
if (player->x304_ == 4 || player->x304_ == 1)
{
const CActor* act = TCastToConstPtr<CActor>(mgr.GetObjectById(player->x310_grapplePointId));
const CActor* act = TCastToConstPtr<CActor>(mgr.GetObjectById(player->x310_hudPoiId));
if (act && act->GetMaterialList().Intersection(CMaterialList(EMaterialTypes::Lava)) != 0)
{
zeus::CVector3f v = player->x318_ - eyePos;
@ -173,7 +173,7 @@ void CFirstPersonCamera::UpdateTransform(CStateManager& mgr, float dt)
qGun = zeus::CQuaternion::lookAt(rVec, gunFrontVec, scaledDt * clampedAngle);
const CScriptGrapplePoint* gPoint =
TCastToConstPtr<CScriptGrapplePoint>(mgr.GetObjectById(player->x310_grapplePointId));
TCastToConstPtr<CScriptGrapplePoint>(mgr.GetObjectById(player->x310_hudPoiId));
if (gPoint && player->x29c_ > 0.f)
{
gunFrontVec = x190_gunFollowXf.frontVector();

View File

@ -11,7 +11,8 @@ if(WIN32)
Shaders/CXRayBlurFilterHLSL.cpp
Shaders/CTextSupportShaderHLSL.cpp
Shaders/CFogVolumePlaneShaderHLSL.cpp
Shaders/CFogVolumeFilterHLSL.cpp)
Shaders/CFogVolumeFilterHLSL.cpp
Shaders/CEnergyBarShaderHLSL.cpp)
elseif(BOO_HAS_METAL)
set(PLAT_SRCS
Shaders/CLineRendererShadersMetal.cpp
@ -25,7 +26,8 @@ elseif(BOO_HAS_METAL)
Shaders/CXRayBlurFilterMetal.cpp
Shaders/CTextSupportShaderMetal.cpp
Shaders/CFogVolumePlaneShaderMetal.cpp
Shaders/CFogVolumeFilterMetal.cpp)
Shaders/CFogVolumeFilterMetal.cpp
Shaders/CEnergyBarShaderMetal.cpp)
endif()
set(GRAPHICS_SOURCES
@ -61,6 +63,7 @@ set(GRAPHICS_SOURCES
Shaders/CTextSupportShader.hpp Shaders/CTextSupportShader.cpp Shaders/CTextSupportShaderGLSL.cpp
Shaders/CFogVolumePlaneShader.hpp Shaders/CFogVolumePlaneShader.cpp Shaders/CFogVolumePlaneShaderGLSL.cpp
Shaders/CFogVolumeFilter.hpp Shaders/CFogVolumeFilter.cpp Shaders/CFogVolumeFilterGLSL.cpp
Shaders/CEnergyBarShader.hpp Shaders/CEnergyBarShader.cpp Shaders/CEnergyBarShaderGLSL.cpp
${PLAT_SRCS})
runtime_add_list(Graphics GRAPHICS_SOURCES)

View File

@ -68,8 +68,8 @@ public:
u16 GetWidth() const {return x4_w;}
u16 GetHeight() const {return x6_h;}
void Load(int slot, EClampMode clamp) const;
boo::ITexture* GetBooTexture() {return m_booTex;}
boo::ITexture* GetPaletteTexture() {return m_paletteTex;}
boo::ITexture* GetBooTexture() const {return m_booTex;}
boo::ITexture* GetPaletteTexture() const {return m_paletteTex;}
std::unique_ptr<u8[]> BuildMemoryCardTex(u32& sizeOut, ETexelFormat& fmtOut,
std::unique_ptr<u8[]>& paletteOut) const;
boo::ITexture* GetFontTexture(EFontType tp);

View File

@ -0,0 +1,82 @@
#include "CEnergyBarShader.hpp"
namespace urde
{
void CEnergyBarShader::updateModelMatrix()
{
m_uniform.m_matrix = CGraphics::GetPerspectiveProjectionMatrix(true) * CGraphics::g_GXModelView.toMatrix4f();
}
void CEnergyBarShader::draw(const zeus::CColor& color0, const std::vector<Vertex>& verts0,
const zeus::CColor& color1, const std::vector<Vertex>& verts1,
const zeus::CColor& color2, const std::vector<Vertex>& verts2,
const CTexture* tex)
{
size_t totalVerts = verts0.size() + verts1.size() + verts2.size();
if (!totalVerts)
return;
if (totalVerts > m_maxVerts)
{
m_maxVerts = totalVerts;
m_tex = tex;
m_token = CGraphics::CommitResources([this](boo::IGraphicsDataFactory::Context& ctx)
{
m_vbo = ctx.newDynamicBuffer(boo::BufferUse::Vertex, sizeof(Vertex), m_maxVerts);
for (int i=0 ; i<3 ; ++i)
m_uniBuf[i] = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(Uniform), 1);
TShader<CEnergyBarShader>::BuildShaderDataBinding(ctx, *this);
return true;
});
}
size_t vertIter = 0;
Vertex* verts = reinterpret_cast<Vertex*>(m_vbo->map(sizeof(Vertex) * totalVerts));
if (verts0.size())
{
memmove(verts, verts0.data(), sizeof(Vertex) * verts0.size());
vertIter += verts0.size();
}
if (verts1.size())
{
memmove(verts + vertIter, verts1.data(), sizeof(Vertex) * verts1.size());
vertIter += verts1.size();
}
if (verts2.size())
{
memmove(verts + vertIter, verts2.data(), sizeof(Vertex) * verts2.size());
}
m_vbo->unmap();
vertIter = 0;
if (verts0.size())
{
m_uniform.m_color = color0;
m_uniBuf[0]->load(&m_uniform, sizeof(Uniform));
CGraphics::SetShaderDataBinding(m_dataBind[0]);
CGraphics::DrawArray(0, verts0.size());
vertIter += verts0.size();
}
if (verts1.size())
{
m_uniform.m_color = color1;
m_uniBuf[1]->load(&m_uniform, sizeof(Uniform));
CGraphics::SetShaderDataBinding(m_dataBind[1]);
CGraphics::DrawArray(vertIter, verts1.size());
vertIter += verts1.size();
}
if (verts2.size())
{
m_uniform.m_color = color2;
m_uniBuf[2]->load(&m_uniform, sizeof(Uniform));
CGraphics::SetShaderDataBinding(m_dataBind[2]);
CGraphics::DrawArray(vertIter, verts2.size());
}
}
URDE_SPECIALIZE_SHADER(CEnergyBarShader)
void CEnergyBarShader::Shutdown() {}
}

View File

@ -0,0 +1,54 @@
#ifndef __URDE_CENERGYBARSHADER_HPP__
#define __URDE_CENERGYBARSHADER_HPP__
#include "TShader.hpp"
#include "zeus/CMatrix4f.hpp"
#include "zeus/CColor.hpp"
#include "zeus/CRectangle.hpp"
#include "Camera/CCameraFilter.hpp"
namespace urde
{
class CEnergyBarShader
{
friend struct CEnergyBarShaderGLDataBindingFactory;
friend struct CEnergyBarShaderVulkanDataBindingFactory;
friend struct CEnergyBarShaderMetalDataBindingFactory;
friend struct CEnergyBarShaderD3DDataBindingFactory;
public:
struct Vertex
{
zeus::CVector3f pos;
zeus::CVector2f uv;
};
private:
struct Uniform
{
zeus::CMatrix4f m_matrix;
zeus::CColor m_color;
};
boo::GraphicsDataToken m_token;
boo::IGraphicsBufferD* m_vbo;
boo::IGraphicsBufferD* m_uniBuf[3];
boo::IShaderDataBinding* m_dataBind[3];
Uniform m_uniform;
const CTexture* m_tex = nullptr;
size_t m_maxVerts = 0;
public:
void updateModelMatrix();
void draw(const zeus::CColor& color0, const std::vector<Vertex>& verts0,
const zeus::CColor& color1, const std::vector<Vertex>& verts1,
const zeus::CColor& color2, const std::vector<Vertex>& verts2,
const CTexture* tex);
using _CLS = CEnergyBarShader;
#include "TShaderDecl.hpp"
};
}
#endif // __URDE_CENERGYBARSHADER_HPP__

View File

@ -0,0 +1,133 @@
#include "CEnergyBarShader.hpp"
#include "TShader.hpp"
#include "Graphics/CTexture.hpp"
namespace urde
{
static const char* VS =
"#version 330\n"
BOO_GLSL_BINDING_HEAD
"layout(location=0) in vec4 posIn;\n"
"layout(location=0) in vec4 uvIn;\n"
"\n"
"UBINDING0 uniform EnergyBarUniform\n"
"{\n"
" mat4 xf;\n"
" vec4 color;\n"
"};\n"
"\n"
"struct VertToFrag\n"
"{\n"
" vec4 color;\n"
" vec2 uv;\n"
"};\n"
"\n"
"SBINDING(0) out VertToFrag vtf;\n"
"void main()\n"
"{\n"
" vtf.color = color;\n"
" vtf.uv = uvIn.xy;\n"
" gl_Position = xf * vec4(posIn.xyz, 1.0);\n"
"}\n";
static const char* FS =
"#version 330\n"
BOO_GLSL_BINDING_HEAD
"struct VertToFrag\n"
"{\n"
" vec4 color;\n"
" vec2 uv;\n"
"};\n"
"\n"
"SBINDING(0) in VertToFrag vtf;\n"
"layout(location=0) out vec4 colorOut;\n"
"TBINDING0 uniform sampler2D tex;\n"
"void main()\n"
"{\n"
" colorOut = vtf.color * texture(tex, vtf.uv);\n"
"}\n";
URDE_DECL_SPECIALIZE_SHADER(CEnergyBarShader)
static boo::IVertexFormat* s_VtxFmt = nullptr;
static boo::IShaderPipeline* s_Pipeline = nullptr;
struct CEnergyBarShaderGLDataBindingFactory : TShader<CEnergyBarShader>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CEnergyBarShader& filter)
{
boo::GLDataFactory::Context& cctx = static_cast<boo::GLDataFactory::Context&>(ctx);
const boo::VertexElementDescriptor VtxVmt[] =
{
{filter.m_vbo, nullptr, boo::VertexSemantic::Position4},
{filter.m_vbo, nullptr, boo::VertexSemantic::UV4}
};
boo::IVertexFormat* vtxFmt = ctx.newVertexFormat(2, VtxVmt);
boo::IGraphicsBuffer* bufs[1];
boo::PipelineStage stages[] = {boo::PipelineStage::Vertex};
boo::ITexture* texs[] = {filter.m_tex->GetBooTexture()};
for (int i=0 ; i<3 ; ++i)
{
bufs[0] = filter.m_uniBuf[i];
filter.m_dataBind[i] = cctx.newShaderDataBinding(s_Pipeline,
vtxFmt, filter.m_vbo, nullptr, nullptr,
1, bufs, stages, nullptr, nullptr, 1, texs, nullptr, nullptr);
}
return filter.m_dataBind[0];
}
};
#if BOO_HAS_VULKAN
struct CEnergyBarShaderVulkanDataBindingFactory : TShader<CEnergyBarShader>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CEnergyBarShader& filter)
{
boo::VulkanDataFactory::Context& cctx = static_cast<boo::VulkanDataFactory::Context&>(ctx);
boo::IGraphicsBuffer* bufs[1];
boo::ITexture* texs[] = {filter.m_tex->GetBooTexture()};
for (int i=0 ; i<3 ; ++i)
{
bufs[0] = filter.m_uniBuf[i];
filter.m_dataBind[i] = cctx.newShaderDataBinding(s_Pipeline, s_VtxFmt,
filter.m_vbo, nullptr, nullptr, 1, bufs,
nullptr, nullptr, nullptr, 1, texs, nullptr, nullptr);
}
return filter.m_dataBind[0];
}
};
#endif
TShader<CEnergyBarShader>::IDataBindingFactory*
CEnergyBarShader::Initialize(boo::GLDataFactory::Context& ctx)
{
const char* uniNames[] = {"EnergyBarUniform"};
const char* texNames[] = {"tex"};
s_Pipeline = ctx.newShaderPipeline(VS, FS, 1, texNames, 1, uniNames, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::One, boo::Primitive::TriStrips,
boo::ZTest::LEqual, false, true, false, boo::CullMode::None);
return new CEnergyBarShaderGLDataBindingFactory;
}
#if BOO_HAS_VULKAN
TShader<CEnergyBarShader>::IDataBindingFactory*
CEnergyBarShader::Initialize(boo::VulkanDataFactory::Context& ctx)
{
const boo::VertexElementDescriptor VtxVmt[] =
{
{nullptr, nullptr, boo::VertexSemantic::Position4},
{nullptr, nullptr, boo::VertexSemantic::UV4}
};
s_VtxFmt = ctx.newVertexFormat(2, VtxVmt);
s_Pipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::One, boo::Primitive::TriStrips,
boo::ZTest::LEqual, false, true, false, boo::CullMode::None);
return new CEnergyBarShaderVulkanDataBindingFactory;
}
#endif
}

View File

@ -0,0 +1,96 @@
#include "CEnergyBarShader.hpp"
#include "TShader.hpp"
#include "Graphics/CTexture.hpp"
namespace urde
{
static const char* VS =
"#include <metal_stdlib>\n"
"using namespace metal;\n"
"struct VertData\n"
"{\n"
" float4 posIn [[ attribute(0) ]];\n"
" float4 uvIn [[ attribute(1) ]];\n"
"};\n"
"\n"
"struct EnergyBarUniform\n"
"{\n"
" float4x4 xf;\n"
" float4 color;\n"
"};\n"
"\n"
"struct VertToFrag\n"
"{\n"
" float4 position [[ position ]];\n"
" float4 color;\n"
" float2 uv;\n"
"};\n"
"\n"
"vertex VertToFrag vmain(VertData v [[ stage_in ]], constant EnergyBarUniform& ebu [[ buffer(2) ]])\n"
"{\n"
" VertToFrag vtf;\n"
" vtf.color = ebu.color;\n"
" vtf.uv = v.uvIn.xy;\n"
" vtf.position = ebu.xf * float4(v.posIn.xyz, 1.0);\n"
" return vtf;\n"
"}\n";
static const char* FS =
"#include <metal_stdlib>\n"
"using namespace metal;\n"
"constexpr sampler samp(address::repeat, filter::linear);\n"
"struct VertToFrag\n"
"{\n"
" float4 position [[ position ]];\n"
" float4 color;\n"
" float2 uv;\n"
"};\n"
"\n"
"fragment float4 fmain(VertToFrag vtf [[ stage_in ]], texture2d<float> tex [[ texture(0) ]])\n"
"{\n"
" return vtf.color * tex.sample(samp, vtf.uv);\n"
"}\n";
URDE_DECL_SPECIALIZE_SHADER(CEnergyBarShader)
static boo::IVertexFormat* s_VtxFmt = nullptr;
static boo::IShaderPipeline* s_Pipeline = nullptr;
struct CEnergyBarShaderMetalDataBindingFactory : TShader<CEnergyBarShader>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CEnergyBarShader& filter)
{
boo::MetalDataFactory::Context& cctx = static_cast<boo::MetalDataFactory::Context&>(ctx);
boo::IGraphicsBuffer* bufs[1];
boo::ITexture* texs[] = {filter.m_tex->GetBooTexture()};
for (int i=0 ; i<3 ; ++i)
{
bufs[0] = filter.m_uniBuf[i];
filter.m_dataBind[i] = cctx.newShaderDataBinding(s_Pipeline, s_VtxFmt,
filter.m_vbo, nullptr, nullptr, 1, bufs,
nullptr, nullptr, nullptr, 1, texs, nullptr, nullptr);
}
return filter.m_dataBind[0];
}
};
TShader<CEnergyBarShader>::IDataBindingFactory*
CEnergyBarShader::Initialize(boo::MetalDataFactory::Context& ctx)
{
const boo::VertexElementDescriptor VtxVmt[] =
{
{nullptr, nullptr, boo::VertexSemantic::Position4},
{nullptr, nullptr, boo::VertexSemantic::UV4}
};
s_VtxFmt = ctx.newVertexFormat(2, VtxVmt);
s_Pipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, boo::ZTest::LEqual,
false, true, false, boo::CullMode::None);
return new CEnergyBarShaderMetalDataBindingFactory;
}
}

View File

@ -1,18 +1,173 @@
#include "CAuiEnergyBarT01.hpp"
#include "CGuiSys.hpp"
#include "CSimplePool.hpp"
#include "CGuiWidgetDrawParms.hpp"
namespace urde
{
CAuiEnergyBarT01::CAuiEnergyBarT01(const CGuiWidgetParms& parms, u32)
: CGuiWidget(parms)
CAuiEnergyBarT01::CAuiEnergyBarT01(const CGuiWidgetParms& parms, CSimplePool* sp, ResId txtrId)
: CGuiWidget(parms), xb8_txtrId(txtrId)
{
if (g_GuiSys->GetUsageMode() != CGuiSys::EUsageMode::Two)
xbc_tex = sp->GetObj(SObjectTag{FOURCC('TXTR'), xb8_txtrId});
}
std::pair<zeus::CVector3f, zeus::CVector3f> CAuiEnergyBarT01::DownloadBarCoordFunc(float t)
{
float x = 12.5 * t - 6.25;
return {zeus::CVector3f{x, 0.f, -0.2f}, zeus::CVector3f{x, 0.f, 0.2f}};
}
void CAuiEnergyBarT01::Update(float dt)
{
if (x100_shadowDrainDelayTimer > 0.f)
x100_shadowDrainDelayTimer = std::max(x100_shadowDrainDelayTimer - dt, 0.f);
if (xf8_filledEnergy < xf4_setEnergy)
{
if (xf1_wrapping)
{
xf8_filledEnergy -= dt * xe4_filledSpeed;
if (xf8_filledEnergy < 0.f)
{
xf8_filledEnergy = std::max(xf4_setEnergy, xf8_filledEnergy + xe0_maxEnergy);
xf1_wrapping = false;
xfc_shadowEnergy = xe0_maxEnergy;
}
}
else
{
xf8_filledEnergy = std::min(xf4_setEnergy, xf8_filledEnergy + dt * xe4_filledSpeed);
}
}
else if (xf8_filledEnergy > xf4_setEnergy)
{
if (xf1_wrapping)
{
xf8_filledEnergy += dt * xe4_filledSpeed;
if (xf8_filledEnergy > xe0_maxEnergy)
{
xf8_filledEnergy = std::min(xf4_setEnergy, xf8_filledEnergy - xe0_maxEnergy);
xf1_wrapping = false;
xfc_shadowEnergy = xf8_filledEnergy;
}
}
else
{
xf8_filledEnergy = std::max(xf4_setEnergy, xf8_filledEnergy - dt * xe4_filledSpeed);
}
}
if (xfc_shadowEnergy < xf8_filledEnergy)
xfc_shadowEnergy = xf8_filledEnergy;
else if (xfc_shadowEnergy > xf8_filledEnergy && x100_shadowDrainDelayTimer == 0.f)
xfc_shadowEnergy = std::max(xf8_filledEnergy, xfc_shadowEnergy - dt * xe8_shadowSpeed);
CGuiWidget::Update(dt);
}
void CAuiEnergyBarT01::Draw(const CGuiWidgetDrawParms& drawParms) const
{
if (!xbc_tex || !xbc_tex.IsLoaded() || !xd8_coordFunc)
return;
CGraphics::SetModelMatrix(x34_worldXF);
const_cast<CEnergyBarShader&>(m_energyBarShader).updateModelMatrix();
float filledT = xe0_maxEnergy > 0.f ? xf8_filledEnergy / xe0_maxEnergy : 0.f;
float shadowT = xe0_maxEnergy > 0.f ? xfc_shadowEnergy / xe0_maxEnergy : 0.f;
zeus::CColor filledColor = xd0_filledColor;
filledColor.a *= drawParms.x0_alphaMod;
filledColor *= xa8_color2;
zeus::CColor shadowColor = xd4_shadowColor;
shadowColor.a *= drawParms.x0_alphaMod;
shadowColor *= xa8_color2;
zeus::CColor emptyColor = xcc_emptyColor;
emptyColor.a *= drawParms.x0_alphaMod;
emptyColor *= xa8_color2;
for (int i=0 ; i<3 ; ++i)
{
std::vector<CEnergyBarShader::Vertex>& verts = const_cast<CAuiEnergyBarT01&>(*this).m_verts[i];
verts.clear();
float start;
float end;
switch (i)
{
case 0:
default:
start = 0.f;
end = filledT;
break;
case 1:
start = filledT;
end = shadowT;
break;
case 2:
start = shadowT;
end = 1.f;
break;
}
if (start == end)
continue;
std::pair<zeus::CVector3f, zeus::CVector3f> coords = xd8_coordFunc(start);
while (start < end)
{
verts.push_back({coords.first, zeus::CVector2f(start, 0.f)});
verts.push_back({coords.second, zeus::CVector2f(start, 1.f)});
start += xdc_tesselation;
if (start >= end)
{
coords = xd8_coordFunc(end);
verts.push_back({coords.first, zeus::CVector2f(end, 0.f)});
verts.push_back({coords.second, zeus::CVector2f(end, 1.f)});
}
else
{
coords = xd8_coordFunc(start);
}
}
}
const_cast<CEnergyBarShader&>(m_energyBarShader).draw(filledColor, m_verts[0],
shadowColor, m_verts[1],
emptyColor, m_verts[2],
xbc_tex.GetObj());
}
void CAuiEnergyBarT01::SetCurrEnergy(float e, ESetMode mode)
{
e = zeus::clamp(0.f, e, xe0_maxEnergy);
if (e == xf4_setEnergy)
return;
if (xf0_alwaysResetDelayTimer || xf8_filledEnergy == xfc_shadowEnergy)
x100_shadowDrainDelayTimer = xec_shadowDrainDelay;
xf1_wrapping = mode == ESetMode::Wrapped;
xf4_setEnergy = e;
if (mode == ESetMode::Insta)
xf8_filledEnergy = xf4_setEnergy;
}
void CAuiEnergyBarT01::SetMaxEnergy(float maxEnergy)
{
xe0_maxEnergy = maxEnergy;
xf4_setEnergy = std::min(xe0_maxEnergy, xf4_setEnergy);
xf8_filledEnergy = std::min(xe0_maxEnergy, xf8_filledEnergy);
xfc_shadowEnergy = std::min(xe0_maxEnergy, xfc_shadowEnergy);
}
std::shared_ptr<CGuiWidget> CAuiEnergyBarT01::Create(CGuiFrame* frame, CInputStream& in, CSimplePool* sp)
{
CGuiWidgetParms parms = ReadWidgetHeader(frame, in);
u32 a = in.readUint32Big();
std::shared_ptr<CGuiWidget> ret = std::make_shared<CAuiEnergyBarT01>(parms, a);
ResId tex = in.readUint32Big();
std::shared_ptr<CGuiWidget> ret = std::make_shared<CAuiEnergyBarT01>(parms, sp, tex);
ret->ParseBaseInfo(frame, in, parms);
return ret;
}

View File

@ -2,6 +2,9 @@
#define __URDE_CAUIENERGYBAR_HPP__
#include "CGuiWidget.hpp"
#include "CToken.hpp"
#include "Graphics/CTexture.hpp"
#include "Graphics/Shaders/CEnergyBarShader.hpp"
namespace urde
{
@ -10,8 +13,52 @@ class CSimplePool;
class CAuiEnergyBarT01 : public CGuiWidget
{
public:
CAuiEnergyBarT01(const CGuiWidgetParms& parms, u32);
typedef std::pair<zeus::CVector3f, zeus::CVector3f>(*FCoordFunc)(float t);
enum class ESetMode
{
Normal,
Wrapped,
Insta
};
private:
ResId xb8_txtrId;
TLockedToken<CTexture> xbc_tex; // Used to be optional
zeus::CColor xcc_emptyColor;
zeus::CColor xd0_filledColor;
zeus::CColor xd4_shadowColor;
FCoordFunc xd8_coordFunc = nullptr;
float xdc_tesselation = 1.f;
float xe0_maxEnergy = 0.f;
float xe4_filledSpeed = 1000.f;
float xe8_shadowSpeed = 1000.f;
float xec_shadowDrainDelay = 0.f;
bool xf0_alwaysResetDelayTimer = false;
bool xf1_wrapping = false;
float xf4_setEnergy = 0.f;
float xf8_filledEnergy = 0.f;
float xfc_shadowEnergy = 0.f;
float x100_shadowDrainDelayTimer = 0.f;
CEnergyBarShader m_energyBarShader;
std::vector<CEnergyBarShader::Vertex> m_verts[3];
public:
CAuiEnergyBarT01(const CGuiWidgetParms& parms, CSimplePool* sp, ResId txtrId);
FourCC GetWidgetTypeID() const { return FOURCC('ENRG'); }
static std::pair<zeus::CVector3f, zeus::CVector3f> DownloadBarCoordFunc(float t);
void Update(float dt);
void Draw(const CGuiWidgetDrawParms& drawParms) const;
float GetActualFraction() const { return xe0_maxEnergy == 0.f ? 0.f : xf4_setEnergy / xe0_maxEnergy; }
void SetCurrEnergy(float e, ESetMode mode);
void SetCoordFunc(FCoordFunc func) { xd8_coordFunc = func; }
void SetEmptyColor(const zeus::CColor& c) { xcc_emptyColor = c; }
void SetFilledColor(const zeus::CColor& c) { xd0_filledColor = c; }
void SetShadowColor(const zeus::CColor& c) { xd4_shadowColor = c; }
void SetMaxEnergy(float maxEnergy);
void ResetMaxEnergy() { SetMaxEnergy(xdc_tesselation); }
void SetTesselation(float t) { xdc_tesselation = t; }
void SetIsAlwaysResetTimer(bool b) { xf0_alwaysResetDelayTimer = b; }
void SetFilledDrainSpeed(float s) { xe4_filledSpeed = s; }
void SetShadowDrainSpeed(float s) { xe8_shadowSpeed = s; }
void SetShadowDrainDelay(float d) { xec_shadowDrainDelay = d; }
static std::shared_ptr<CGuiWidget> Create(CGuiFrame* frame, CInputStream& in, CSimplePool* sp);
};

View File

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

View File

@ -16,24 +16,24 @@ public:
Orthographic
};
private:
EProjection xf8_proj;
EProjection xb8_proj;
union
{
struct
{
float xfc_left;
float x100_right;
float x104_top;
float x108_bottom;
float x10c_znear;
float x110_zfar;
float xbc_left;
float xc0_right;
float xc4_top;
float xc8_bottom;
float xcc_znear;
float xd0_zfar;
};
struct
{
float xfc_fov;
float x100_aspect;
float x104_znear;
float x108_zfar;
float xbc_fov;
float xc0_aspect;
float xc4_znear;
float xc8_zfar;
};
};
public:
@ -46,6 +46,7 @@ public:
static std::shared_ptr<CGuiWidget> Create(CGuiFrame* frame, CInputStream& in, CSimplePool* sp);
zeus::CVector3f ConvertToScreenSpace(const zeus::CVector3f& vec) const;
void SetFov(float fov) { xbc_fov = fov; }
void Draw(const CGuiWidgetDrawParms& parms) const;
std::shared_ptr<CGuiCamera> shared_from_this()

View File

@ -26,9 +26,10 @@ public:
void MoveInWorld(const zeus::CVector3f& vec);
const zeus::CVector3f& GetLocalPosition() const { return x4_localXF.origin; }
const zeus::CTransform& GetLocalTransform() const { return x4_localXF; }
void SetLocalPosition(const zeus::CVector3f& pos);
const zeus::CVector3f& GetWorldPosition() const { return x34_worldXF.origin; }
const zeus::CTransform& GetLocalTransform() const { return x34_worldXF; }
const zeus::CTransform& GetWorldTransform() const { return x34_worldXF; }
void RotateReset();
zeus::CVector3f RotateW2O(const zeus::CVector3f& vec) const;
zeus::CVector3f RotateO2P(const zeus::CVector3f& vec) const;

View File

@ -308,4 +308,13 @@ bool CGuiTextSupport::GetIsTextSupportFinishedLoading() const
return _GetIsTextSupportFinishedLoading();
}
void CGuiTextSupport::SetScanStates(const std::vector<CSaveWorld::SScanState>* scanStates)
{
if (x14_props.xc_scanStates != scanStates)
{
x14_props.xc_scanStates = scanStates;
ClearRenderBuffer();
}
}
}

View File

@ -6,6 +6,7 @@
#include "CToken.hpp"
#include "CTextRenderBuffer.hpp"
#include "CGuiWidget.hpp"
#include "CSaveWorld.hpp"
#include "optional.hpp"
#include <string>
@ -66,12 +67,13 @@ class CGuiTextProperties
bool x1_horizontal;
EJustification x4_justification;
EVerticalJustification x8_vertJustification;
u32 xc_;
const std::vector<CSaveWorld::SScanState>* xc_scanStates;
public:
CGuiTextProperties(bool wordWrap, bool horizontal, EJustification justification,
EVerticalJustification vertJustification, u32 unk=0)
EVerticalJustification vertJustification,
const std::vector<CSaveWorld::SScanState>* scanStates=nullptr)
: x0_wordWrap(wordWrap), x1_horizontal(horizontal), x4_justification(justification),
x8_vertJustification(vertJustification), xc_(unk) {}
x8_vertJustification(vertJustification), xc_scanStates(scanStates) {}
};
class CGuiTextSupport
@ -136,6 +138,7 @@ public:
void SetImageBaseline(bool b);
bool GetIsTextSupportFinishedLoading() const;
float GetCurTime() const { return x3c_curTime; }
void SetScanStates(const std::vector<CSaveWorld::SScanState>* scanStates);
};
}

View File

@ -129,6 +129,8 @@ public:
CGuiWidget* FindWidget(s16 id);
bool GetIsFinishedLoading() const;
void DispatchInitialize();
void SetDepthTest(bool v) { xb6_31_depthTest = v; }
void SetDepthWrite(bool v) { xb7_24_depthWrite = v; }
CGuiFrame* GetGuiFrame() const { return xb0_frame; }
};

View File

@ -2,5 +2,5 @@
namespace urde
{
CGuiWidgetDrawParms CGuiWidgetDrawParms::Default;
CGuiWidgetDrawParms CGuiWidgetDrawParms::Default = {};
}

View File

View File

@ -0,0 +1,14 @@
#ifndef __URDE_CHUDBALLINTERFACE_HPP__
#define __URDE_CHUDBALLINTERFACE_HPP__
namespace urde
{
class CHudBallInterface
{
};
}
#endif // __URDE_CHUDBALLINTERFACE_HPP__

View File

@ -0,0 +1,14 @@
#ifndef __URDE_CHUDBOSSENERGYINTERFACE_HPP__
#define __URDE_CHUDBOSSENERGYINTERFACE_HPP__
namespace urde
{
class CHudBossEnergyInterface
{
};
}
#endif // __URDE_CHUDBOSSENERGYINTERFACE_HPP__

View File

@ -0,0 +1,530 @@
#include "CHudDecoInterface.hpp"
#include "CGuiFrame.hpp"
#include "CGuiTextPane.hpp"
#include "CGuiCamera.hpp"
#include "CGuiModel.hpp"
#include "CAuiEnergyBarT01.hpp"
#include "GameGlobalObjects.hpp"
#include "CSimplePool.hpp"
#include "MP1/CSamusHud.hpp"
#include "TCastTo.hpp"
#include "CGuiWidgetDrawParms.hpp"
namespace urde
{
CHudDecoInterfaceCombat::CHudDecoInterfaceCombat(CGuiFrame& selHud)
{
x68_24_visDebug = true;
x68_25_visGame = true;
x6c_camera = selHud.GetFrameCamera();
x2c_camPos = x6c_camera->GetLocalPosition();
x70_basewidget_pivot = selHud.FindWidget("basewidget_pivot");
x74_basewidget_deco = selHud.FindWidget("basewidget_deco");
x78_basewidget_tickdeco0 = selHud.FindWidget("basewidget_tickdeco0");
x7c_basewidget_frame = selHud.FindWidget("basewidget_frame");
x14_pivotPosition = x70_basewidget_pivot->GetIdlePosition();
x78_basewidget_tickdeco0->SetColor(g_tweakGuiColors->GetTickDecoColor());
x38_basePosition = x7c_basewidget_frame->GetLocalPosition();
x44_baseRotation = x7c_basewidget_frame->GetLocalTransform().buildMatrix3f();
}
void CHudDecoInterfaceCombat::UpdateVisibility()
{
bool vis = x68_24_visDebug && x68_25_visGame;
x74_basewidget_deco->SetVisibility(vis, ETraversalMode::Children);
x78_basewidget_tickdeco0->SetVisibility(vis, ETraversalMode::Children);
}
void CHudDecoInterfaceCombat::SetIsVisibleDebug(bool v)
{
x68_24_visDebug = v;
UpdateVisibility();
}
void CHudDecoInterfaceCombat::SetIsVisibleGame(bool v)
{
x68_25_visGame = v;
UpdateVisibility();
}
void CHudDecoInterfaceCombat::SetHudRotation(const zeus::CQuaternion& rot)
{
x4_rotation = rot;
}
void CHudDecoInterfaceCombat::SetHudOffset(const zeus::CVector3f& off)
{
x20_offset = off;
}
void CHudDecoInterfaceCombat::SetDamageTransform(const zeus::CMatrix3f& rotation,
const zeus::CVector3f& position)
{
x7c_basewidget_frame->SetLocalTransform(zeus::CTransform(rotation * x44_baseRotation,
position + x38_basePosition));
}
void CHudDecoInterfaceCombat::SetFrameColorValue(float v)
{
zeus::CColor color = v > 0.f ? zeus::CColor::skWhite : g_tweakGuiColors->GetHudFrameColor();
x7c_basewidget_frame->SetColor(color);
}
void CHudDecoInterfaceCombat::Update(float dt, const CStateManager& stateMgr)
{
x6c_camera->SetO2WTransform(MP1::CSamusHud::BuildFinalCameraTransform(
x4_rotation, x14_pivotPosition + x20_offset, x2c_camPos));
}
void CHudDecoInterfaceCombat::SetCameraParms(float fov, float y, float z)
{
x6c_camera->SetFov(fov);
x2c_camPos.y = y;
x2c_camPos.z = z;
}
void CHudDecoInterfaceCombat::UpdateHudAlpha()
{
zeus::CColor color = zeus::CColor::skWhite;
color.a = g_GameState->GameOptions().GetHUDAlpha() / 255.f;
x70_basewidget_pivot->SetColor(color);
}
CHudDecoInterfaceScan::CHudDecoInterfaceScan(CGuiFrame& selHud)
: x14_selHud(selHud)
{
x4_scanHudFlat = g_SimplePool->GetObj("FRME_ScanHudFlat");
x234_sidesPositioner = g_tweakGui->GetScanSidesPositionStart();
x240_24_visDebug = true;
x240_25_visGame = true;
x244_camera = selHud.GetFrameCamera();
x248_basewidget_pivot = selHud.FindWidget("basewidget_pivot");
x24c_basewidget_leftside = selHud.FindWidget("basewidget_leftside");
x250_basewidget_rightside = selHud.FindWidget("basewidget_rightside");
x1f4_pivotPosition = x248_basewidget_pivot->GetIdlePosition();
if (CGuiWidget* deco = selHud.FindWidget("basewidget_deco"))
deco->SetColor(g_tweakGuiColors->GetHudFrameColor());
x218_leftsidePosition = x24c_basewidget_leftside->GetLocalPosition();
zeus::CTransform leftXf(zeus::CMatrix3f::RotateZ(g_tweakGui->GetScanSidesAngle()), x218_leftsidePosition);
x24c_basewidget_leftside->SetLocalTransform(leftXf);
if (CGuiWidget* w = selHud.FindWidget("basewidget_databankl"))
{
zeus::CTransform xf(zeus::CMatrix3f::RotateZ(g_tweakGui->GetScanSidesAngle() * -1.f), w->GetLocalPosition());
w->SetLocalTransform(xf);
}
if (CGuiWidget* w = selHud.FindWidget("basewidget_leftguages"))
{
zeus::CTransform xf(zeus::CMatrix3f(zeus::CVector3f{g_tweakGui->GetScanSidesXScale(), 1.f, 1.f}),
w->GetLocalPosition());
w->SetLocalTransform(xf);
}
x224_rightsidePosition = x250_basewidget_rightside->GetLocalPosition();
zeus::CTransform rightXf(zeus::CMatrix3f::RotateZ(g_tweakGui->GetScanSidesAngle() * -1.f), x224_rightsidePosition);
x250_basewidget_rightside->SetLocalTransform(rightXf);
if (CGuiWidget* w = selHud.FindWidget("basewidget_databankr"))
{
zeus::CTransform xf(zeus::CMatrix3f::RotateZ(g_tweakGui->GetScanSidesAngle()), w->GetLocalPosition());
w->SetLocalTransform(xf);
}
if (CGuiWidget* w = selHud.FindWidget("basewidget_rightguages"))
{
zeus::CTransform xf(zeus::CMatrix3f(zeus::CVector3f{g_tweakGui->GetScanSidesXScale(), 1.f, 1.f}),
w->GetLocalPosition());
w->SetLocalTransform(xf);
}
zeus::CVector3f sidesPos(x234_sidesPositioner, 0.f, 0.f);
x24c_basewidget_leftside->SetLocalPosition(x24c_basewidget_leftside->RotateO2P(
x218_leftsidePosition + sidesPos));
x250_basewidget_rightside->SetLocalPosition(x250_basewidget_rightside->RotateO2P(
x224_rightsidePosition - sidesPos));
UpdateHudAlpha();
}
void CHudDecoInterfaceScan::UpdateVisibility()
{
// Empty
}
void CHudDecoInterfaceScan::SetIsVisibleDebug(bool v)
{
x240_24_visDebug = v;
UpdateVisibility();
}
void CHudDecoInterfaceScan::SetIsVisibleGame(bool v)
{
x240_25_visGame = v;
UpdateVisibility();
}
void CHudDecoInterfaceScan::SetHudRotation(const zeus::CQuaternion& rot)
{
x1e4_rotation = rot;
}
void CHudDecoInterfaceScan::SetHudOffset(const zeus::CVector3f& off)
{
x200_offset = off;
}
void CHudDecoInterfaceScan::SetReticuleTransform(const zeus::CMatrix3f& xf)
{
// Empty
}
void CHudDecoInterfaceScan::SetDamageTransform(const zeus::CMatrix3f& rotation,
const zeus::CVector3f& position)
{
// Empty
}
void CHudDecoInterfaceScan::SetFrameColorValue(float v)
{
// Empty
}
void CHudDecoInterfaceScan::InitializeFlatFrame()
{
x10_loadedScanHudFlat = x4_scanHudFlat.GetObj();
x10_loadedScanHudFlat->GetFrameCamera()->SetO2WTransform(zeus::CTransform::Translate(x20c_camPos));
x258_flat_basewidget_scanguage = x10_loadedScanHudFlat->FindWidget("basewidget_scanguage");
x258_flat_basewidget_scanguage->SetVisibility(false, ETraversalMode::Children);
x254_flat_textpane_scanning = static_cast<CGuiTextPane*>(x10_loadedScanHudFlat->FindWidget("textpane_scanning"));
x25c_flat_energybart01_scanbar = static_cast<CAuiEnergyBarT01*>(x10_loadedScanHudFlat->FindWidget("energybart01_scanbar"));
x264_flat_textpane_message = static_cast<CGuiTextPane*>(x10_loadedScanHudFlat->FindWidget("textpane_message"));
x268_flat_textpane_scrollmessage = static_cast<CGuiTextPane*>(x10_loadedScanHudFlat->FindWidget("textpane_scrollmessage"));
x260_flat_basewidget_textgroup = x10_loadedScanHudFlat->FindWidget("basewidget_textgroup");
x26c_flat_model_xmark = static_cast<CGuiModel*>(x10_loadedScanHudFlat->FindWidget("model_xmark"));
x270_flat_model_abutton = static_cast<CGuiModel*>(x10_loadedScanHudFlat->FindWidget("model_abutton"));
x274_flat_model_dash = static_cast<CGuiModel*>(x10_loadedScanHudFlat->FindWidget("model_dash"));
x260_flat_basewidget_textgroup->SetVisibility(false, ETraversalMode::Children);
x254_flat_textpane_scanning->SetIsVisible(false);
x254_flat_textpane_scanning->TextSupport()->SetFontColor(g_tweakGuiColors->GetHudMessageFill());
x254_flat_textpane_scanning->TextSupport()->SetOutlineColor(g_tweakGuiColors->GetHudMessageOutline());
x25c_flat_energybart01_scanbar->SetCoordFunc(CAuiEnergyBarT01::DownloadBarCoordFunc);
x25c_flat_energybart01_scanbar->ResetMaxEnergy();
x25c_flat_energybart01_scanbar->SetFilledColor(zeus::CColor(0.4f, 0.68f, 0.88f, 1.f));
x25c_flat_energybart01_scanbar->SetShadowColor(zeus::CColor::skClear);
x25c_flat_energybart01_scanbar->SetEmptyColor(zeus::CColor::skClear);
x25c_flat_energybart01_scanbar->SetFilledDrainSpeed(999.f);
x25c_flat_energybart01_scanbar->SetShadowDrainSpeed(999.f);
x25c_flat_energybart01_scanbar->SetShadowDrainDelay(0.f);
x25c_flat_energybart01_scanbar->SetIsAlwaysResetTimer(false);
x26c_flat_model_xmark->SetVisibility(false, ETraversalMode::Children);
x26c_flat_model_xmark->SetVisibility(false, ETraversalMode::Children);
x270_flat_model_abutton->SetVisibility(false, ETraversalMode::Children);
x274_flat_model_dash->SetVisibility(false, ETraversalMode::Children);
}
const CScannableObjectInfo* CHudDecoInterfaceScan::GetCurrScanInfo(const CStateManager& stateMgr) const
{
if (x1d4_latestScanState == CPlayer::EPlayerScanState::Zero)
return nullptr;
if (TCastToConstPtr<CActor> act = stateMgr.GetObjectById(x1d2_latestScanningObject))
return act->GetScannableObjectInfo();
return nullptr;
}
void CHudDecoInterfaceScan::UpdateScanDisplay(const CStateManager& stateMgr, float dt)
{
CPlayer& player = stateMgr.GetPlayer();
CPlayer::EPlayerScanState scanState = player.GetScanningState();
if (scanState != x1d4_latestScanState)
{
if (player.IsNewScanScanning())
{
if (scanState == CPlayer::EPlayerScanState::Two)
{
if (x1d4_latestScanState == CPlayer::EPlayerScanState::One)
{
// Scan complete
x254_flat_textpane_scanning->TextSupport()->SetText(g_MainStringTable->GetString(15));
x254_flat_textpane_scanning->TextSupport()->SetTypeWriteEffectOptions(false, 0.f, 40.f);
x238_scanningTextAlpha = 2.f;
}
}
else if (scanState == CPlayer::EPlayerScanState::One)
{
// Scanning
x254_flat_textpane_scanning->TextSupport()->SetText(g_MainStringTable->GetString(14));
x254_flat_textpane_scanning->TextSupport()->SetTypeWriteEffectOptions(false, 0.f, 40.f);
x238_scanningTextAlpha = 2.f;
}
}
x1d4_latestScanState = scanState;
}
if (player.GetScanningObjectId() != x1d2_latestScanningObject)
x1d2_latestScanningObject = player.GetScanningObjectId();
if (player.GetHudPOIId() != x1d0_latestHudPoi)
{
x1d0_latestHudPoi = player.GetHudPOIId();
if (x1d0_latestHudPoi != kInvalidUniqueId)
{
if (!player.ObjectInScanningRange(x1d0_latestHudPoi, stateMgr))
{
// Object out of scanning range
x254_flat_textpane_scanning->TextSupport()->SetText(g_MainStringTable->GetString(16));
x254_flat_textpane_scanning->TextSupport()->SetTypeWriteEffectOptions(true, 0.f, 40.f);
x238_scanningTextAlpha = 1.f;
}
}
}
const CScannableObjectInfo* scanInfo = GetCurrScanInfo(stateMgr);
if (x1d2_latestScanningObject != x18_scanDisplay.x10_ || !scanInfo)
{
x18_scanDisplay.StopScan();
if (!x18_scanDisplay.xc_ && scanInfo)
{
x18_scanDisplay.StartScan(x1d2_latestScanningObject, *scanInfo, x264_flat_textpane_message,
x268_flat_textpane_scrollmessage, x260_flat_basewidget_textgroup,
x26c_flat_model_xmark, x270_flat_model_abutton, x274_flat_model_dash,
player.GetScanningTime());
}
}
x18_scanDisplay.Update(dt, player.GetScanningTime());
if (x1d2_latestScanningObject != kInvalidUniqueId && GetCurrScanInfo(stateMgr))
if (TCastToConstPtr<CActor> act = stateMgr.GetObjectById(x1d2_latestScanningObject))
if (const CScannableObjectInfo* actScan = act->GetScannableObjectInfo())
x25c_flat_energybart01_scanbar->SetCurrEnergy(x1d8_scanningTime / actScan->GetTotalDownloadTime(),
CAuiEnergyBarT01::ESetMode::Normal);
if (x1d4_latestScanState != CPlayer::EPlayerScanState::One)
if (x1d0_latestHudPoi == kInvalidUniqueId || player.ObjectInScanningRange(x1d0_latestHudPoi, stateMgr))
x238_scanningTextAlpha = std::max(0.f, x238_scanningTextAlpha - dt);
if (x238_scanningTextAlpha > 0.f)
{
zeus::CColor color = zeus::CColor::skWhite;
color.a = std::min(x238_scanningTextAlpha, 1.f);
x254_flat_textpane_scanning->SetColor(color);
x254_flat_textpane_scanning->SetIsVisible(true);
}
else
{
x254_flat_textpane_scanning->SetIsVisible(false);
}
if (GetCurrScanInfo(stateMgr))
x23c_scanBarAlpha = std::min(x23c_scanBarAlpha + 2.f * dt, 1.f);
else
x23c_scanBarAlpha = std::max(0.f, x23c_scanBarAlpha - 2.f * dt);
if (x23c_scanBarAlpha > 0.f)
{
zeus::CColor color = zeus::CColor::skWhite;
color.a = std::min(x23c_scanBarAlpha, 1.f);
x258_flat_basewidget_scanguage->SetColor(color);
x258_flat_basewidget_scanguage->SetVisibility(true, ETraversalMode::Children);
}
else
{
x258_flat_basewidget_scanguage->SetVisibility(false, ETraversalMode::Children);
}
}
void CHudDecoInterfaceScan::Update(float dt, const CStateManager& stateMgr)
{
CPlayer& player = stateMgr.GetPlayer();
CPlayer::EPlayerScanState scanState = player.GetScanningState();
if (scanState != CPlayer::EPlayerScanState::Zero)
x1d8_scanningTime = player.GetScanningTime();
if (scanState == CPlayer::EPlayerScanState::One || scanState == CPlayer::EPlayerScanState::Two)
x230_sidesTimer = std::min(x230_sidesTimer + dt, g_tweakGui->GetScanSidesEndTime());
else
x230_sidesTimer = std::max(0.f, x230_sidesTimer - dt);
float sidesT = x230_sidesTimer < g_tweakGui->GetScanSidesStartTime() ? 0.f :
(x230_sidesTimer - g_tweakGui->GetScanSidesStartTime()) / g_tweakGui->GetScanSidesDuration();
float oldSidesPositioner = x234_sidesPositioner;
x234_sidesPositioner = (1.f - sidesT) * g_tweakGui->GetScanSidesPositionStart() +
sidesT * g_tweakGui->GetScanSidesPositionEnd();
if (oldSidesPositioner != x234_sidesPositioner)
{
zeus::CVector3f sidesPos(x234_sidesPositioner, 0.f, 0.f);
x24c_basewidget_leftside->SetLocalPosition(x24c_basewidget_leftside->RotateO2P(
x218_leftsidePosition + sidesPos));
x250_basewidget_rightside->SetLocalPosition(x250_basewidget_rightside->RotateO2P(
x224_rightsidePosition - sidesPos));
}
x244_camera->SetO2WTransform(
MP1::CSamusHud::BuildFinalCameraTransform(x1e4_rotation, x1f4_pivotPosition + x200_offset, x20c_camPos));
if (!x10_loadedScanHudFlat)
{
if (!x4_scanHudFlat.IsLoaded() || !x4_scanHudFlat->GetIsFinishedLoading())
return;
InitializeFlatFrame();
}
x10_loadedScanHudFlat->Update(dt);
UpdateScanDisplay(stateMgr, dt);
}
void CHudDecoInterfaceScan::Draw() const
{
x18_scanDisplay.Draw();
if (x10_loadedScanHudFlat)
x10_loadedScanHudFlat->Draw(CGuiWidgetDrawParms::Default);
}
void CHudDecoInterfaceScan::ProcessInput(const CFinalInput& input)
{
x18_scanDisplay.ProcessInput(input);
}
void CHudDecoInterfaceScan::SetCameraParms(float fov, float y, float z)
{
x244_camera->SetFov(fov);
x20c_camPos.y = y;
x20c_camPos.z = z;
}
void CHudDecoInterfaceScan::UpdateHudAlpha()
{
zeus::CColor color = zeus::CColor::skWhite;
color.a = g_GameState->GameOptions().GetHUDAlpha() / 255.f;
x248_basewidget_pivot->SetColor(color);
}
float CHudDecoInterfaceScan::GetMessageTextAlpha() const
{
return 1.f - std::max(std::min(x238_scanningTextAlpha, 1.f), x18_scanDisplay.x1a8_);
}
CHudDecoInterfaceXRay::CHudDecoInterfaceXRay(CGuiFrame& selHud)
{
}
void CHudDecoInterfaceXRay::UpdateVisibility()
{
}
void CHudDecoInterfaceXRay::SetIsVisibleDebug(bool v)
{
}
void CHudDecoInterfaceXRay::SetIsVisibleGame(bool v)
{
}
void CHudDecoInterfaceXRay::SetHudRotation(const zeus::CQuaternion& rot)
{
}
void CHudDecoInterfaceXRay::SetHudOffset(const zeus::CVector3f& off)
{
}
void CHudDecoInterfaceXRay::SetReticuleTransform(const zeus::CMatrix3f& xf)
{
}
void CHudDecoInterfaceXRay::UpdateTransforms()
{
}
void CHudDecoInterfaceXRay::SetDamageTransform(const zeus::CMatrix3f& rotation,
const zeus::CVector3f& position)
{
}
void CHudDecoInterfaceXRay::SetFrameColorValue(float v)
{
}
void CHudDecoInterfaceXRay::Update(float dt, const CStateManager& stateMgr)
{
}
void CHudDecoInterfaceXRay::SetCameraParms(float fov, float y, float z)
{
}
void CHudDecoInterfaceXRay::UpdateHudAlpha()
{
}
CHudDecoInterfaceThermal::CHudDecoInterfaceThermal(CGuiFrame& selHud)
{
}
void CHudDecoInterfaceThermal::UpdateVisibility()
{
}
void CHudDecoInterfaceThermal::SetIsVisibleDebug(bool v)
{
}
void CHudDecoInterfaceThermal::SetIsVisibleGame(bool v)
{
}
void CHudDecoInterfaceThermal::SetHudRotation(const zeus::CQuaternion& rot)
{
}
void CHudDecoInterfaceThermal::SetHudOffset(const zeus::CVector3f& off)
{
}
void CHudDecoInterfaceThermal::SetReticuleTransform(const zeus::CMatrix3f& xf)
{
}
void CHudDecoInterfaceThermal::SetDamageTransform(const zeus::CMatrix3f& rotation,
const zeus::CVector3f& position)
{
}
void CHudDecoInterfaceThermal::Update(float dt, const CStateManager& stateMgr)
{
}
void CHudDecoInterfaceThermal::SetCameraParms(float fov, float y, float z)
{
}
void CHudDecoInterfaceThermal::UpdateHudAlpha()
{
}
}

View File

@ -0,0 +1,164 @@
#ifndef __URDE_CHUDDECOINTERFACE_HPP__
#define __URDE_CHUDDECOINTERFACE_HPP__
#include "zeus/CMatrix3f.hpp"
#include "zeus/CQuaternion.hpp"
#include "zeus/CVector3f.hpp"
#include "CToken.hpp"
#include "CScanDisplay.hpp"
#include "World/CPlayer.hpp"
namespace urde
{
class CGuiFrame;
class CFinalInput;
class CStateManager;
class CGuiCamera;
class CGuiWidget;
class CAuiEnergyBarT01;
class CGuiModel;
class IHudDecoInterface
{
public:
virtual void SetIsVisibleDebug(bool v)=0;
virtual void SetIsVisibleGame(bool v)=0;
virtual void SetHudRotation(const zeus::CQuaternion& rot)=0;
virtual void SetHudOffset(const zeus::CVector3f& off)=0;
virtual void SetReticuleTransform(const zeus::CMatrix3f& xf) {}
virtual void UpdateTransforms() {}
virtual void SetDamageTransform(const zeus::CMatrix3f& rotation, const zeus::CVector3f& position)=0;
virtual void SetFrameColorValue(float v);
virtual void Update(float dt, const CStateManager& stateMgr)=0;
virtual void Draw() const {}
virtual void ProcessInput(const CFinalInput& input) {}
virtual void SetCameraParms(float fov, float y, float z)=0;
virtual void UpdateHudAlpha()=0;
virtual float GetMessageTextAlpha() const { return 1.f; }
virtual ~IHudDecoInterface() = default;
};
class CHudDecoInterfaceCombat : public IHudDecoInterface
{
zeus::CQuaternion x4_rotation;
zeus::CVector3f x14_pivotPosition;
zeus::CVector3f x20_offset;
zeus::CVector3f x2c_camPos;
zeus::CVector3f x38_basePosition;
zeus::CMatrix3f x44_baseRotation;
bool x68_24_visDebug : 1;
bool x68_25_visGame : 1;
CGuiCamera* x6c_camera;
CGuiWidget* x70_basewidget_pivot;
CGuiWidget* x74_basewidget_deco;
CGuiWidget* x78_basewidget_tickdeco0;
CGuiWidget* x7c_basewidget_frame;
void UpdateVisibility();
public:
CHudDecoInterfaceCombat(CGuiFrame& selHud);
void SetIsVisibleDebug(bool v);
void SetIsVisibleGame(bool v);
void SetHudRotation(const zeus::CQuaternion& rot);
void SetHudOffset(const zeus::CVector3f& off);
void SetDamageTransform(const zeus::CMatrix3f& rotation, const zeus::CVector3f& position);
void SetFrameColorValue(float v);
void Update(float dt, const CStateManager& stateMgr);
void SetCameraParms(float fov, float y, float z);
void UpdateHudAlpha();
};
class CHudDecoInterfaceScan : public IHudDecoInterface
{
TLockedToken<CGuiFrame> x4_scanHudFlat;
CGuiFrame* x10_loadedScanHudFlat = nullptr;
CGuiFrame& x14_selHud;
CScanDisplay x18_scanDisplay;
TUniqueId x1d0_latestHudPoi = kInvalidUniqueId;
TUniqueId x1d2_latestScanningObject = kInvalidUniqueId;
CPlayer::EPlayerScanState x1d4_latestScanState = CPlayer::EPlayerScanState::Zero;
float x1d8_scanningTime = 0.f;
float x1dc_ = 0.f;
float x1e0_ = 1.f;
zeus::CQuaternion x1e4_rotation;
zeus::CVector3f x1f4_pivotPosition;
zeus::CVector3f x200_offset;
zeus::CVector3f x20c_camPos;
zeus::CVector3f x218_leftsidePosition;
zeus::CVector3f x224_rightsidePosition;
float x230_sidesTimer = 0.f;
float x234_sidesPositioner;
float x238_scanningTextAlpha = 0.f;
float x23c_scanBarAlpha = 0.f;
bool x240_24_visDebug : 1;
bool x240_25_visGame : 1;
CGuiCamera* x244_camera;
CGuiWidget* x248_basewidget_pivot;
CGuiWidget* x24c_basewidget_leftside;
CGuiWidget* x250_basewidget_rightside;
CGuiTextPane* x254_flat_textpane_scanning;
CGuiWidget* x258_flat_basewidget_scanguage;
CAuiEnergyBarT01* x25c_flat_energybart01_scanbar;
CGuiWidget* x260_flat_basewidget_textgroup;
CGuiTextPane* x264_flat_textpane_message;
CGuiTextPane* x268_flat_textpane_scrollmessage;
CGuiModel* x26c_flat_model_xmark;
CGuiModel* x270_flat_model_abutton;
CGuiModel* x274_flat_model_dash;
void UpdateVisibility();
public:
CHudDecoInterfaceScan(CGuiFrame& selHud);
void SetIsVisibleDebug(bool v);
void SetIsVisibleGame(bool v);
void SetHudRotation(const zeus::CQuaternion& rot);
void SetHudOffset(const zeus::CVector3f& off);
void SetReticuleTransform(const zeus::CMatrix3f& xf);
void SetDamageTransform(const zeus::CMatrix3f& rotation, const zeus::CVector3f& position);
void SetFrameColorValue(float v);
void InitializeFlatFrame();
const CScannableObjectInfo* GetCurrScanInfo(const CStateManager& stateMgr) const;
void UpdateScanDisplay(const CStateManager& stateMgr, float dt);
void Update(float dt, const CStateManager& stateMgr);
void Draw() const;
void ProcessInput(const CFinalInput& input);
void SetCameraParms(float fov, float y, float z);
void UpdateHudAlpha();
float GetMessageTextAlpha() const;
};
class CHudDecoInterfaceXRay : public IHudDecoInterface
{
void UpdateVisibility();
public:
CHudDecoInterfaceXRay(CGuiFrame& selHud);
void SetIsVisibleDebug(bool v);
void SetIsVisibleGame(bool v);
void SetHudRotation(const zeus::CQuaternion& rot);
void SetHudOffset(const zeus::CVector3f& off);
void SetReticuleTransform(const zeus::CMatrix3f& xf);
void UpdateTransforms();
void SetDamageTransform(const zeus::CMatrix3f& rotation, const zeus::CVector3f& position);
void SetFrameColorValue(float v);
void Update(float dt, const CStateManager& stateMgr);
void SetCameraParms(float fov, float y, float z);
void UpdateHudAlpha();
};
class CHudDecoInterfaceThermal : public IHudDecoInterface
{
void UpdateVisibility();
public:
CHudDecoInterfaceThermal(CGuiFrame& selHud);
void SetIsVisibleDebug(bool v);
void SetIsVisibleGame(bool v);
void SetHudRotation(const zeus::CQuaternion& rot);
void SetHudOffset(const zeus::CVector3f& off);
void SetReticuleTransform(const zeus::CMatrix3f& xf);
void SetDamageTransform(const zeus::CMatrix3f& rotation, const zeus::CVector3f& position);
void Update(float dt, const CStateManager& stateMgr);
void SetCameraParms(float fov, float y, float z);
void UpdateHudAlpha();
};
}
#endif // __URDE_CHUDDECOINTERFACE_HPP__

View File

View File

@ -0,0 +1,14 @@
#ifndef __URDE_CHUDENERGYINTERFACE_HPP__
#define __URDE_CHUDENERGYINTERFACE_HPP__
namespace urde
{
class CHudEnergyInterfaceBall
{
};
}
#endif // __URDE_CHUDENERGYINTERFACE_HPP__

View File

@ -0,0 +1,18 @@
#include "CHudFreeLookInterface.hpp"
namespace urde
{
CHudFreeLookInterfaceCombat::CHudFreeLookInterfaceCombat(CGuiFrame& selHud, bool, bool,
bool, bool grapplePoint)
{
}
CHudFreeLookInterfaceXRay::CHudFreeLookInterfaceXRay(CGuiFrame& selHud, bool,
bool, bool grapplePoint)
{
}
}

View File

@ -0,0 +1,28 @@
#ifndef __URDE_CHUDFREELOOKINTERFACE_HPP__
#define __URDE_CHUDFREELOOKINTERFACE_HPP__
namespace urde
{
class CGuiFrame;
class IFreeLookInterface
{
public:
virtual ~IFreeLookInterface() = default;
};
class CHudFreeLookInterfaceCombat : public IFreeLookInterface
{
public:
CHudFreeLookInterfaceCombat(CGuiFrame& selHud, bool, bool, bool, bool grapplePoint);
};
class CHudFreeLookInterfaceXRay : public IFreeLookInterface
{
public:
CHudFreeLookInterfaceXRay(CGuiFrame& selHud, bool, bool, bool grapplePoint);
};
}
#endif // __URDE_CHUDFREELOOKINTERFACE_HPP__

View File

@ -0,0 +1,16 @@
#include "CHudHelmetInterface.hpp"
namespace urde
{
CHudHelmetInterface::CHudHelmetInterface(CGuiFrame& helmetFrame)
{
}
void CHudHelmetInterface::UpdateHelmetAlpha()
{
}
}

View File

@ -0,0 +1,17 @@
#ifndef __URDE_CHUDHELMETINTERFACE_HPP__
#define __URDE_CHUDHELMETINTERFACE_HPP__
namespace urde
{
class CGuiFrame;
class CHudHelmetInterface
{
public:
CHudHelmetInterface(CGuiFrame& helmetFrame);
void UpdateHelmetAlpha();
};
}
#endif // __URDE_CHUDHELMETINTERFACE_HPP__

View File

View File

@ -0,0 +1,14 @@
#ifndef __URDE_CHUDMISSILEINTERFACE_HPP__
#define __URDE_CHUDMISSILEINTERFACE_HPP__
namespace urde
{
class CHudMissileInterfaceCombat
{
};
}
#endif // __URDE_CHUDMISSILEINTERFACE_HPP__

View File

@ -0,0 +1,11 @@
#include "CHudRadarInterface.hpp"
namespace urde
{
CHudRadarInterface::CHudRadarInterface(CGuiFrame& selHud, CStateManager& stateMgr)
{
}
}

View File

@ -0,0 +1,17 @@
#ifndef __URDE_CHUDRADARINTERFACE_HPP__
#define __URDE_CHUDRADARINTERFACE_HPP__
namespace urde
{
class CGuiFrame;
class CStateManager;
class CHudRadarInterface
{
public:
CHudRadarInterface(CGuiFrame& selHud, CStateManager& stateMgr);
};
}
#endif // __URDE_CHUDRADARINTERFACE_HPP__

View File

View File

@ -0,0 +1,22 @@
#ifndef __URDE_CHUDTHREATINTERFACE_HPP__
#define __URDE_CHUDTHREATINTERFACE_HPP__
namespace urde
{
class CGuiFrame;
class IHudThreatInterface
{
public:
virtual ~IHudThreatInterface() = default;
};
class CHudThreatInterfaceCombat : public IHudThreatInterface
{
public:
CHudThreatInterfaceCombat(CGuiFrame& selHud, float);
};
}
#endif // __URDE_CHUDTHREATINTERFACE_HPP__

View File

@ -0,0 +1,12 @@
#include "CHudVisorBeamMenu.hpp"
namespace urde
{
CHudVisorBeamMenu::CHudVisorBeamMenu(CGuiFrame* baseHud, EHudVisorBeamMenu type,
rstl::prereserved_vector<bool, 4> enables)
{
}
}

View File

@ -0,0 +1,25 @@
#ifndef __URDE_CHUDVISORBEAMMENU_HPP__
#define __URDE_CHUDVISORBEAMMENU_HPP__
#include "RetroTypes.hpp"
namespace urde
{
class CGuiFrame;
class CHudVisorBeamMenu
{
public:
enum class EHudVisorBeamMenu
{
Visor,
Beam
};
private:
public:
CHudVisorBeamMenu(CGuiFrame* baseHud, EHudVisorBeamMenu type, rstl::prereserved_vector<bool, 4> enables);
};
}
#endif // __URDE_CHUDVISORBEAMMENU_HPP__

View File

@ -37,6 +37,16 @@ set(GUISYS_SOURCES
CStringTable.hpp CStringTable.cpp
CTargetingManager.hpp CTargetingManager.cpp
CCompoundTargetReticle.hpp CCompoundTargetReticle.cpp
COrbitPointMarker.hpp COrbitPointMarker.cpp)
COrbitPointMarker.hpp COrbitPointMarker.cpp
CHudEnergyInterface.hpp CHudEnergyInterface.cpp
CHudThreatInterface.hpp CHudThreatInterface.cpp
CHudMissileInterface.hpp CHudMissileInterface.cpp
CHudFreeLookInterface.hpp CHudFreeLookInterface.cpp
CHudDecoInterface.hpp CHudDecoInterface.cpp
CHudHelmetInterface.hpp CHudHelmetInterface.cpp
CHudVisorBeamMenu.hpp CHudVisorBeamMenu.cpp
CHudRadarInterface.hpp CHudRadarInterface.cpp
CHudBallInterface.hpp CHudBallInterface.cpp
CScanDisplay.hpp CScanDisplay.cpp)
runtime_add_list(GuiSys GUISYS_SOURCES)

View File

@ -1,13 +1,13 @@
#ifndef __URDE_CORBITPOINTMARKER_HPP__
#define __URDE_CORBIGPOINTMARKER_HPP__
#define __URDE_CORBITPOINTMARKER_HPP__
namespace
{
class CStateManager;
class COrbigPointMarker
class COrbitPointMarker
{
public:
};
}
#endif // __URDE_CORBIGPOINTMARKER_HPP__
#endif // __URDE_CORBITPOINTMARKER_HPP__

View File

@ -71,4 +71,21 @@ void CScanDisplay::CDataDot::SetDestPosition(const zeus::CVector2f& pos)
else
x14_ = pos;
}
void CScanDisplay::ProcessInput(const CFinalInput& input)
{
}
void CScanDisplay::StartScan(TUniqueId id, const CScannableObjectInfo& scanInfo, CGuiTextPane* message,
CGuiTextPane* scrollMessage, CGuiWidget* textGroup, CGuiModel* xmark,
CGuiModel* abutton, CGuiModel* dash, float scanTime)
{
}
void CScanDisplay::StopScan()
{
}
}

View File

@ -12,8 +12,11 @@ namespace urde
{
class CGuiTextPane;
class CGuiWidget;
class CGuiModel;
class CFinalInput;
class CScanDisplay
{
friend class CHudDecoInterfaceScan;
public:
class CDataDot
{
@ -50,9 +53,17 @@ public:
{
};
private:
u32 xc_;
TUniqueId x10_;
float x1a8_;
public:
CScanDisplay() = default;
void StartScan(TUniqueId, const CScannableObjectInfo&, CGuiTextPane*, CGuiWidget*, float);
void ProcessInput(const CFinalInput& input);
void StartScan(TUniqueId id, const CScannableObjectInfo& scanInfo, CGuiTextPane* message,
CGuiTextPane* scrollMessage, CGuiWidget* textGroup, CGuiModel* xmark,
CGuiModel* abutton, CGuiModel* dash, float scanTime);
void StopScan();
void InitializeFrame(float);
void Update(float, float);

View File

@ -0,0 +1,11 @@
#include "CTargetingManager.hpp"
namespace urde
{
CTargetingManager::CTargetingManager(const CStateManager&)
{
}
}

View File

@ -280,13 +280,13 @@ bool CInGameGuiManager::CheckLoadComplete(CStateManager& stateMgr)
return false;
x8_preLoadDeps.clear();
CGuiFrame& baseHud = *x34_samusHud->x274_loadedBaseHud;
CGuiFrame& baseHud = *x34_samusHud->x274_loadedFrmeBaseHud;
x144_basewidget_automapper = baseHud.FindWidget("BaseWidget_AutoMapper");
x148_model_automapper = static_cast<CGuiModel*>(baseHud.FindWidget("Model_AutoMapper"));
x14c_basehud_camera = baseHud.GetFrameCamera();
x150_basewidget_functional = baseHud.FindWidget("BaseWidget_Functional");
x154_automapperRotate = zeus::CQuaternion(x144_basewidget_automapper->GetLocalTransform().basis);
x154_automapperRotate = zeus::CQuaternion(x144_basewidget_automapper->GetWorldTransform().basis);
x164_automapperOffset = x144_basewidget_automapper->GetLocalPosition();
x170_camRotate = zeus::CQuaternion::skNoRotation;
x180_camOffset = x14c_basehud_camera->GetLocalPosition() +

View File

@ -1,4 +1,12 @@
#include "CSamusHud.hpp"
#include "CSimplePool.hpp"
#include "GameGlobalObjects.hpp"
#include "World/CPlayer.hpp"
#include "GuiSys/CGuiFrame.hpp"
#include "GuiSys/CGuiTextPane.hpp"
#include "GuiSys/CGuiLight.hpp"
#include "GuiSys/CGuiModel.hpp"
#include "GuiSys/CGuiCamera.hpp"
namespace urde
{
@ -8,6 +16,146 @@ namespace MP1
CSamusHud* CSamusHud::g_SamusHud = nullptr;
CSamusHud::CSamusHud(CStateManager& stateMgr)
: x8_targetingMgr(stateMgr),
x258_frmeHelmet(g_SimplePool->GetObj("FRME_Helmet")),
x268_frmeBaseHud(g_SimplePool->GetObj("FRME_BaseHud"))
{
x2e0_26_ = true;
x2e0_27_energyLow = stateMgr.GetPlayer().IsEnergyLow(stateMgr);
x33c_lights = std::make_unique<CActorLights>(8, zeus::CVector3f::skZero, 4, 1, true, 0, 0, 0.1f);
x340_hudLights.resize(3, SCachedHudLight(zeus::CVector3f::skZero, zeus::CColor::skWhite,
0.f, 0.f, 0.f, 0.f));
x46c_.resize(3);
x5a4_videoBands.resize(4);
x5d8_guiLights.resize(4);
UpdateStateTransition(1.f, stateMgr);
for (int i=0 ; i<16 ; ++i)
x5ec_[i] = 5.f * i + 40.f;
for (int i=0 ; i<64 ; ++i)
x62c_[i] = -0.5f * i;
for (int i=0 ; i<32 ; ++i)
x72c_[i] = 0.5f * i - 8.f;
x264_loadedFrmeHelmet = x258_frmeHelmet.GetObj();
x274_loadedFrmeBaseHud = x268_frmeBaseHud.GetObj();
x2a0_helmetIntf = std::make_unique<CHudHelmetInterface>(*x264_loadedFrmeHelmet);
rstl::prereserved_vector<bool, 4> hasVisors = BuildPlayerHasVisors(stateMgr);
x2a4_visorMenu = std::make_unique<CHudVisorBeamMenu>(x274_loadedFrmeBaseHud,
CHudVisorBeamMenu::EHudVisorBeamMenu::Visor,
hasVisors);
rstl::prereserved_vector<bool, 4> hasBeams = BuildPlayerHasBeams(stateMgr);
x2a8_beamMenu = std::make_unique<CHudVisorBeamMenu>(x274_loadedFrmeBaseHud,
CHudVisorBeamMenu::EHudVisorBeamMenu::Beam,
hasBeams);
x2ac_radarIntf = std::make_unique<CHudRadarInterface>(*x274_loadedFrmeBaseHud, stateMgr);
InitializeFrameGluePermanent(stateMgr);
UpdateEnergy(0.f, stateMgr, true);
UpdateMissile(0.f, stateMgr, true);
UpdateBallMode(stateMgr, true);
}
rstl::prereserved_vector<bool, 4> CSamusHud::BuildPlayerHasVisors(const CStateManager& mgr)
{
rstl::prereserved_vector<bool, 4> ret;
ret[0] = mgr.GetPlayerState()->HasPowerUp(CPlayerState::EItemType::CombatVisor);
ret[1] = mgr.GetPlayerState()->HasPowerUp(CPlayerState::EItemType::XRayVisor);
ret[2] = mgr.GetPlayerState()->HasPowerUp(CPlayerState::EItemType::ScanVisor);
ret[3] = mgr.GetPlayerState()->HasPowerUp(CPlayerState::EItemType::ThermalVisor);
return ret;
}
rstl::prereserved_vector<bool, 4> CSamusHud::BuildPlayerHasBeams(const CStateManager& mgr)
{
rstl::prereserved_vector<bool, 4> ret;
ret[0] = mgr.GetPlayerState()->HasPowerUp(CPlayerState::EItemType::PowerBeam);
ret[1] = mgr.GetPlayerState()->HasPowerUp(CPlayerState::EItemType::IceBeam);
ret[2] = mgr.GetPlayerState()->HasPowerUp(CPlayerState::EItemType::WaveBeam);
ret[3] = mgr.GetPlayerState()->HasPowerUp(CPlayerState::EItemType::PlasmaBeam);
return ret;
}
void CSamusHud::InitializeFrameGluePermanent(const CStateManager& mgr)
{
x588_base_basewidget_pivot = x274_loadedFrmeBaseHud->FindWidget("basewidget_pivot");
x58c_helmet_BaseWidget_Pivot = x264_loadedFrmeHelmet->FindWidget("BaseWidget_Pivot");
x590_base_Model_AutoMapper = static_cast<CGuiModel*>(x274_loadedFrmeBaseHud->FindWidget("Model_AutoMapper"));
x594_base_textpane_counter = static_cast<CGuiTextPane*>(x274_loadedFrmeBaseHud->FindWidget("textpane_counter"));
x594_base_textpane_counter->TextSupport()->SetFontColor(g_tweakGuiColors->GetHudCounterFill());
x594_base_textpane_counter->TextSupport()->SetOutlineColor(g_tweakGuiColors->GetHudCounterOutline());
x598_base_basewidget_message = x274_loadedFrmeBaseHud->FindWidget("basewidget_message");
for (CGuiWidget* child = static_cast<CGuiWidget*>(x598_base_basewidget_message->GetChildObject());
child ; child = static_cast<CGuiWidget*>(child->GetNextSibling()))
child->SetDepthTest(false);
x59c_base_textpane_message = static_cast<CGuiTextPane*>(x274_loadedFrmeBaseHud->FindWidget("textpane_message"));
x5a0_base_model_abutton = static_cast<CGuiModel*>(x274_loadedFrmeBaseHud->FindWidget("model_abutton"));
for (int i=0 ; i<4 ; ++i)
x5d8_guiLights[i] = x264_loadedFrmeHelmet->GetFrameLight(i);
x5d8_guiLights[3]->SetColor(zeus::CColor::skBlack);
for (int i=0 ; i<4 ; ++i)
{
SVideoBand& band = x5a4_videoBands[i];
band.x0_videoband = static_cast<CGuiModel*>(x274_loadedFrmeBaseHud->FindWidget(hecl::Format("model_videoband%d", i)));
band.x4_randA = CRandom16::GetRandomNumber()->Range(6.f, 66.f);
band.x8_randB = CRandom16::GetRandomNumber()->Range(16.f, 256.f);
}
x59c_base_textpane_message->SetDepthTest(false);
x598_base_basewidget_message->SetVisibility(false, ETraversalMode::Children);
x59c_base_textpane_message->TextSupport()->SetFontColor(g_tweakGuiColors->GetHudMessageFill());
x59c_base_textpane_message->TextSupport()->SetOutlineColor(g_tweakGuiColors->GetHudMessageOutline());
x59c_base_textpane_message->TextSupport()->SetScanStates(&g_GameState->GameOptions().GetScanStates());
x590_base_Model_AutoMapper->SetDepthWrite(true);
x304_basewidgetIdlePos = x588_base_basewidget_pivot->GetIdlePosition();
x310_cameraPos = x274_loadedFrmeBaseHud->GetFrameCamera()->GetLocalPosition();
RefreshHudOptions();
}
void CSamusHud::InitializeFrameGlueMutable(const CStateManager& mgr)
{
}
void CSamusHud::UpdateEnergy(float dt, const CStateManager& mgr, bool init)
{
}
void CSamusHud::UpdateMissile(float dt, const CStateManager& mgr, bool init)
{
}
void CSamusHud::UpdateBallMode(const CStateManager& mgr, bool init)
{
}
EHudState CSamusHud::GetDesiredHudState(const CStateManager& mgr)
{
if (mgr.GetPlayer().GetMorphballTransitionState() == CPlayer::EPlayerMorphBallState::Morphed ||
mgr.GetPlayer().GetMorphballTransitionState() == CPlayer::EPlayerMorphBallState::Morphing)
return EHudState::Ball;
switch (mgr.GetPlayerState()->GetTransitioningVisor())
{
case CPlayerState::EPlayerVisor::Combat:
return EHudState::Combat;
case CPlayerState::EPlayerVisor::XRay:
return EHudState::XRay;
case CPlayerState::EPlayerVisor::Scan:
return EHudState::Scan;
case CPlayerState::EPlayerVisor::Thermal:
return EHudState::Thermal;
default:
return EHudState::None;
}
}
void CSamusHud::UpdateStateTransition(float time, const CStateManager& mgr)
{
}
@ -22,17 +170,33 @@ void CSamusHud::OnNewInGameGuiState(EInGameGuiState state, CStateManager& stateM
}
void CSamusHud::RefreshHudOptions()
{
if (x29c_decoIntf)
x29c_decoIntf->UpdateHudAlpha();
if (x2a0_helmetIntf)
x2a0_helmetIntf->UpdateHelmetAlpha();
}
void CSamusHud::Touch()
{
}
void CSamusHud::DisplayHudMemo(const std::u16string& text, const SHudMemoInfo& info)
zeus::CTransform CSamusHud::BuildFinalCameraTransform(const zeus::CQuaternion& rot,
const zeus::CVector3f& pos,
const zeus::CVector3f& camPos)
{
zeus::CQuaternion invRot = rot.inverse();
return zeus::CTransform(invRot, invRot.transform(camPos - pos) + pos);
}
void CSamusHud::DisplayHudMemo(const std::u16string& text, const CHUDMemoParms& info)
{
}
void CSamusHud::_DeferHintMemo(ResId strg, u32 timePeriods, const SHudMemoInfo& info)
void CSamusHud::_DeferHintMemo(ResId strg, u32 timePeriods, const CHUDMemoParms& info)
{
}

View File

@ -2,13 +2,25 @@
#define __URDE_CSAMUSHUD_HPP__
#include "CInGameGuiManager.hpp"
#include "GuiSys/CTargetingManager.hpp"
#include "GuiSys/CHudBallInterface.hpp"
#include "GuiSys/CHudBossEnergyInterface.hpp"
#include "GuiSys/CHudDecoInterface.hpp"
#include "GuiSys/CHudEnergyInterface.hpp"
#include "GuiSys/CHudFreeLookInterface.hpp"
#include "GuiSys/CHudHelmetInterface.hpp"
#include "GuiSys/CHudMissileInterface.hpp"
#include "GuiSys/CHudRadarInterface.hpp"
#include "GuiSys/CHudThreatInterface.hpp"
#include "GuiSys/CHudVisorBeamMenu.hpp"
namespace urde
{
class CGuiFrame;
class CStateManager;
class CGuiLight;
struct SHudMemoInfo
struct CHUDMemoParms
{
float x0_;
bool x4_;
@ -16,26 +28,186 @@ struct SHudMemoInfo
bool x6_;
};
enum class EHudState
{
Combat,
XRay,
Thermal,
Scan,
Ball,
None
};
namespace MP1
{
class CSamusHud
{
enum class ELoadPhase
{
Zero
};
enum class ETransitionState
{
Zero,
One,
Two
};
struct SCachedHudLight
{
zeus::CVector3f x0_pos;
zeus::CColor xc_color;
float x10_ = 0.f;
float x14_ = 0.f;
float x18_ = 0.f;
float x1c_ = 0.f;
SCachedHudLight(const zeus::CVector3f& pos, const zeus::CColor& color,
float f1, float f2, float f3, float f4)
: x0_pos(pos), xc_color(color), x10_(f1), x14_(f2), x18_(f3), x1c_(f4) {}
};
struct SVideoBand
{
CGuiModel* x0_videoband = nullptr;
float x4_randA = 0.f;
float x8_randB = 0.f;
};
struct SProfileInfo
{
u32 x0_ = 0;
u32 x4_ = 0;
u32 x8_ = 0;
u32 xc_ = 0;
};
friend class CInGameGuiManager;
CGuiFrame* x274_loadedBaseHud = nullptr;
ELoadPhase x4_loadPhase = ELoadPhase::Zero;
CTargetingManager x8_targetingMgr;
TLockedToken<CGuiFrame> x258_frmeHelmet;
CGuiFrame* x264_loadedFrmeHelmet = nullptr;
TLockedToken<CGuiFrame> x268_frmeBaseHud;
CGuiFrame* x274_loadedFrmeBaseHud = nullptr;
TLockedToken<CGuiFrame> x278_selectedHud; // used to be optional
CGuiFrame* x288_loadedSelectedHud = nullptr;
std::unique_ptr<CHudEnergyInterfaceBall> x28c_ballEnergyIntf;
std::unique_ptr<IHudThreatInterface> x290_threatIntf;
std::unique_ptr<CHudMissileInterfaceCombat> x294_missileIntf;
std::unique_ptr<IFreeLookInterface> x298_freeLookIntf;
std::unique_ptr<IHudDecoInterface> x29c_decoIntf;
std::unique_ptr<CHudHelmetInterface> x2a0_helmetIntf;
std::unique_ptr<CHudVisorBeamMenu> x2a4_visorMenu;
std::unique_ptr<CHudVisorBeamMenu> x2a8_beamMenu;
std::unique_ptr<CHudRadarInterface> x2ac_radarIntf;
std::unique_ptr<CHudBallInterface> x2b0_ballIntf;
std::unique_ptr<CHudBossEnergyInterface> x2b4_bossEnergyIntf;
EHudState x2b8_curState = EHudState::None;
EHudState x2bc_nextState = EHudState::None;
EHudState x2c0_otherState = EHudState::None;
ETransitionState x2c4_activeTransState = ETransitionState::Zero;
float x2c8_ = 1.f;
ETransitionState x2cc_curTransState = ETransitionState::Zero;
float x2d0_ = 0.f;
u32 x2d4_totalEnergyTanks = 0;
u32 x2d8_missileAmount = 0;
u32 x2dc_missileCapacity = 0;
rstl::reserved_vector<SCachedHudLight, 3> x340_lights;
union
{
struct
{
bool x2e0_24_ : 1;
bool x2e0_25_ : 1;
bool x2e0_26_ : 1;
bool x2e0_27_energyLow : 1;
};
u16 _dummy = 0;
};
u32 x2e4_ = 0;
u32 x2e8_ = 0;
u32 x2ec_missilesActive = 0;
float x2f0_ = 1.f;
zeus::CVector3f x2f8_fpCamDir;
zeus::CVector3f x304_basewidgetIdlePos;
zeus::CVector3f x310_cameraPos;
zeus::CQuaternion x31c_;
zeus::CQuaternion x32c_;
std::unique_ptr<CActorLights> x33c_lights;
rstl::reserved_vector<SCachedHudLight, 3> x340_hudLights;
CSfxHandle x3a4_damageSfx;
CCameraFilterPass x3a8_camFilter;
CGuiWidget* x3d4_selected_basewidget_pivot = nullptr;
std::vector<zeus::CTransform> x3d8_lightTransforms;
float x3e8_ = 0.f;
float x3ec_ = 0.f;
float x3f0_ = 1.f;
float x3f4_ = 0.f;
float x3f8_ = 0.f;
float x3fc_ = 0.f;
float x400_ = 0.f;
float x404_ = 0.f;
zeus::CVector3f x408_;
float x414_ = 0.f;
float x418_ = 0.f;
zeus::CVector3f x41c_;
zeus::CMatrix3f x428_;
zeus::CQuaternion x44c_;
float x45c_ = 0.f;
float x460_ = 0.f;
float x464_ = 0.f;
rstl::reserved_vector<zeus::CTransform, 3> x46c_;
float x500_ = 1.f;
float x504_ = 1.f;
u32 x508_ = 0;
u32 x50c_ = 0;
float x510_ = 0.f;
float x514_ = 0.f;
float x518_ = 0.f;
CCameraFilterPass x51c_camFilter2;
CGuiWidget* x588_base_basewidget_pivot;
CGuiWidget* x58c_helmet_BaseWidget_Pivot;
CGuiModel* x590_base_Model_AutoMapper;
CGuiTextPane* x594_base_textpane_counter;
CGuiWidget* x598_base_basewidget_message;
CGuiTextPane* x59c_base_textpane_message;
CGuiModel* x5a0_base_model_abutton;
rstl::reserved_vector<SVideoBand, 4> x5a4_videoBands;
rstl::reserved_vector<CGuiLight*, 4> x5d8_guiLights;
float x5ec_[16];
float x62c_[64];
float x72c_[32];
rstl::reserved_vector<SProfileInfo, 15> x7ac_;
static CSamusHud* g_SamusHud;
static rstl::prereserved_vector<bool, 4> BuildPlayerHasVisors(const CStateManager& mgr);
static rstl::prereserved_vector<bool, 4> BuildPlayerHasBeams(const CStateManager& mgr);
void InitializeFrameGluePermanent(const CStateManager& mgr);
void InitializeFrameGlueMutable(const CStateManager& mgr);
void UpdateEnergy(float dt, const CStateManager& mgr, bool init);
void UpdateMissile(float dt, const CStateManager& mgr, bool init);
void UpdateBallMode(const CStateManager& mgr, bool init);
static EHudState GetDesiredHudState(const CStateManager& mgr);
public:
CSamusHud(CStateManager& stateMgr);
void UpdateStateTransition(float time, const CStateManager& mgr);
bool CheckLoadComplete(CStateManager& stateMgr);
void OnNewInGameGuiState(EInGameGuiState state, CStateManager& stateMgr);
void RefreshHudOptions();
void Touch();
static void DisplayHudMemo(const std::u16string& text, const SHudMemoInfo& info);
static void DeferHintMemo(ResId strg, u32 timePeriods, const SHudMemoInfo& info)
static zeus::CTransform BuildFinalCameraTransform(const zeus::CQuaternion& rot,
const zeus::CVector3f& pos,
const zeus::CVector3f& camPos);
static void DisplayHudMemo(const std::u16string& text, const CHUDMemoParms& info);
static void DeferHintMemo(ResId strg, u32 timePeriods, const CHUDMemoParms& info)
{
if (g_SamusHud)
g_SamusHud->_DeferHintMemo(strg, timePeriods, info);
}
void _DeferHintMemo(ResId strg, u32 timePeriods, const SHudMemoInfo& info);
void _DeferHintMemo(ResId strg, u32 timePeriods, const CHUDMemoParms& info);
};
}

View File

@ -8,6 +8,7 @@
#include "Graphics/Shaders/CCameraBlurFilter.hpp"
#include "Graphics/Shaders/CXRayBlurFilter.hpp"
#include "Graphics/Shaders/CTextSupportShader.hpp"
#include "Graphics/Shaders/CEnergyBarShader.hpp"
#include "Character/CCharLayoutInfo.hpp"
#include "Audio/CStreamAudioManager.hpp"
#include "CGBASupport.hpp"
@ -23,6 +24,7 @@ URDE_DECL_SPECIALIZE_SHADER(CCameraBlurFilter)
URDE_DECL_SPECIALIZE_SHADER(CXRayBlurFilter)
URDE_DECL_SPECIALIZE_SHADER(CFogVolumePlaneShader)
URDE_DECL_SPECIALIZE_SHADER(CFogVolumeFilter)
URDE_DECL_SPECIALIZE_SHADER(CEnergyBarShader)
URDE_DECL_SPECIALIZE_MULTI_BLEND_SHADER(CColoredQuadFilter)
URDE_DECL_SPECIALIZE_MULTI_BLEND_SHADER(CTexturedQuadFilter)
URDE_DECL_SPECIALIZE_MULTI_BLEND_SHADER(CTexturedQuadFilterAlpha)
@ -213,6 +215,7 @@ CMain::BooSetter::BooSetter(boo::IGraphicsDataFactory* factory,
TShader<CXRayBlurFilter>::Initialize();
TShader<CFogVolumePlaneShader>::Initialize();
TShader<CFogVolumeFilter>::Initialize();
TShader<CEnergyBarShader>::Initialize();
TMultiBlendShader<CColoredQuadFilter>::Initialize();
TMultiBlendShader<CTexturedQuadFilter>::Initialize();
TMultiBlendShader<CTexturedQuadFilterAlpha>::Initialize();
@ -331,6 +334,7 @@ void CMain::Shutdown()
TShader<CXRayBlurFilter>::Shutdown();
TShader<CFogVolumePlaneShader>::Shutdown();
TShader<CFogVolumeFilter>::Shutdown();
TShader<CEnergyBarShader>::Shutdown();
TMultiBlendShader<CColoredQuadFilter>::Shutdown();
TMultiBlendShader<CTexturedQuadFilter>::Shutdown();
TMultiBlendShader<CTexturedQuadFilterAlpha>::Shutdown();

View File

@ -66,7 +66,7 @@ class CPlayerGun
u32 x310_ = 0;
u32 x314_ = 0;
u32 x318_ = 0;
u32 x31c_ = 0;
u32 x31c_missilesActive = 0;
u32 x320_ = 0;
u32 x324_ = 4;
u32 x328_ = 0x2000;

View File

@ -339,4 +339,16 @@ bool CActor::CanDrawStatic() const
return false;
}
const CScannableObjectInfo* CActor::GetScannableObjectInfo() const
{
if (!x98_scanObjectInfo)
return nullptr;
TToken<CScannableObjectInfo>& info = *x98_scanObjectInfo;
if (!info || !info.IsLoaded())
return nullptr;
return info.GetObj();
}
}

View File

@ -161,6 +161,7 @@ public:
void SetActorLights(std::unique_ptr<CActorLights>);
bool CanDrawStatic() const;
bool GetE7_29() const { return xe7_29_; }
const CScannableObjectInfo* GetScannableObjectInfo() const;
};
}

View File

@ -89,7 +89,7 @@ void CPlayer::Accept(IVisitor& visitor)
visitor.Visit(this);
}
CHealthInfo* CPlayer::HealthInfo(CStateManager& mgr) { return &mgr.GetPlayerState()->HealthInfo(); }
CHealthInfo* CPlayer::HealthInfo(const CStateManager& mgr) { return &mgr.GetPlayerState()->HealthInfo(); }
bool CPlayer::IsUnderBetaMetroidAttack(CStateManager& mgr) const { return false; }
@ -199,8 +199,6 @@ void CPlayer::DrawGun(CStateManager& mgr) {}
void CPlayer::HolsterGun(CStateManager& mgr) {}
CPlayer::EPlayerMorphBallState CPlayer::GetMorphballTransitionState() const { return x2f8_morphTransState; }
void CPlayer::UpdateGrappleArmTransform(const zeus::CVector3f&, CStateManager& mgr, float) {}
void CPlayer::ApplyGrappleForces(const CFinalInput& input, CStateManager& mgr, float) {}
@ -382,6 +380,24 @@ void CPlayer::SetCameraState(EPlayerCameraState camState, CStateManager& stateMg
}
}
bool CPlayer::IsEnergyLow(const CStateManager& mgr) const
{
float lowThreshold = mgr.GetPlayerState()->GetItemCapacity(CPlayerState::EItemType::EnergyTanks) < 4 ? 30.f : 100.f;
return HealthInfo(mgr)->GetHP() < lowThreshold;
}
bool CPlayer::ObjectInScanningRange(TUniqueId id, const CStateManager& mgr) const
{
const CEntity* ent = mgr.GetObjectById(id);
if (TCastToConstPtr<CActor> act = ent)
{
zeus::CVector3f delta = act->GetTranslation() - GetTranslation();
if (delta.canBeNormalized())
return delta.magnitude() < g_tweakPlayer->GetScanningRange();
}
return false;
}
void CPlayer::Touch() {}
void CPlayer::CVisorSteam::SetSteam(float a, float b, float c, ResId d, bool e)

View File

@ -31,6 +31,9 @@ class CPlayer : public CPhysicsActor
public:
enum class EPlayerScanState
{
Zero,
One,
Two
};
enum class EPlayerOrbitType
{
@ -116,7 +119,7 @@ private:
u32 x304_ = 0;
u32 x308_ = 0;
u32 x30c_ = 0;
TUniqueId x310_grapplePointId = kInvalidUniqueId;
TUniqueId x310_hudPoiId = kInvalidUniqueId;
float x314_ = 0.f;
float x318_ = 0.f;
float x31c_ = 0.f;
@ -145,10 +148,10 @@ private:
u8 x39c_ = 0;
float x3a0_ = 0.5f;
float x3a4_ = 0.449f;
u32 x3a8_ = 0;
float x3ac_ = 0.f;
EPlayerScanState x3a8_scanState = EPlayerScanState::Zero;
float x3ac_scanningTime = 0.f;
float x3b0_ = 0.f;
TUniqueId x3b4_ = kInvalidUniqueId;
TUniqueId x3b4_scanningObject = kInvalidUniqueId;
u32 x3b8_ = 0;
float x3bc_ = 0.f;
float x3c0_ = 1.0f;
@ -258,7 +261,7 @@ private:
bool x9c6_27_ : 1;
bool x9c6_28_ : 1;
bool x9c6_29_disableInput : 1;
bool x9c6_30_ : 1;
bool x9c6_30_newScanScanning : 1;
bool x9c6_31_ : 1;
bool x9c7_24_ : 1;
bool x9c7_25_ : 1;
@ -314,7 +317,7 @@ public:
bool WasDamaged() const;
void TakeDamage(bool, const zeus::CVector3f&, float, EWeaponType, CStateManager& mgr);
void Accept(IVisitor& visitor);
CHealthInfo* HealthInfo(CStateManager& mgr);
static CHealthInfo* HealthInfo(const CStateManager& mgr);
bool IsUnderBetaMetroidAttack(CStateManager& mgr) const;
rstl::optional_object<zeus::CAABox> GetTouchBounds() const;
void Touch(CActor&, CStateManager& mgr);
@ -354,7 +357,7 @@ public:
void UpdateGunTransform(const zeus::CVector3f&, float, CStateManager& mgr, bool);
void DrawGun(CStateManager& mgr);
void HolsterGun(CStateManager& mgr);
CPlayer::EPlayerMorphBallState GetMorphballTransitionState() const;
EPlayerMorphBallState GetMorphballTransitionState() const { return x2f8_morphTransState; }
void UpdateGrappleArmTransform(const zeus::CVector3f&, CStateManager& mgr, float);
void ApplyGrappleForces(const CFinalInput& input, CStateManager& mgr, float);
bool ValidateFPPosition(const zeus::CVector3f& pos, CStateManager& mgr);
@ -427,6 +430,13 @@ public:
float GetMapAlpha() const { return x494_mapAlpha; }
void UpdateCinematicState(CStateManager& mgr);
void SetCameraState(EPlayerCameraState camState, CStateManager& stateMgr);
bool IsEnergyLow(const CStateManager& mgr) const;
EPlayerScanState GetScanningState() const { return x3a8_scanState; }
float GetScanningTime() const { return x3ac_scanningTime; }
TUniqueId GetHudPOIId() const { return x310_hudPoiId; }
TUniqueId GetScanningObjectId() const { return x3b4_scanningObject; }
bool IsNewScanScanning() const { return x9c6_30_newScanScanning; }
bool ObjectInScanningRange(TUniqueId id, const CStateManager& mgr) const;
CPlayerGun* GetPlayerGun() const { return x490_gun.get(); }
CMorphBall* GetMorphBall() const { return x768_morphball.get(); }

View File

@ -41,6 +41,7 @@ public:
T& back() const { x4_data[(x0_size == 0) ? 0 : x0_size - 1]; }
T& front() const { return x4_data[0]; }
T& operator[](size_t idx) { return x4_data[idx]; }
};
}

@ -1 +1 @@
Subproject commit 7daecc680d57562a563b8d9120f4c64ade9b3cbf
Subproject commit d936dc71939f5e33776754e3ea2196bdfe4b1613