mirror of https://github.com/AxioDL/metaforce.git
Various bug fixes
This commit is contained in:
parent
0b3a9e1865
commit
1aab0528f3
|
@ -11,7 +11,7 @@ using Material = MaterialSet::Material;
|
||||||
void MaterialSet::RegisterMaterialProps(Stream& out)
|
void MaterialSet::RegisterMaterialProps(Stream& out)
|
||||||
{
|
{
|
||||||
out << "bpy.types.Material.retro_depth_sort = bpy.props.BoolProperty(name='Retro: Transparent Depth Sort')\n"
|
out << "bpy.types.Material.retro_depth_sort = bpy.props.BoolProperty(name='Retro: Transparent Depth Sort')\n"
|
||||||
"bpy.types.Material.retro_punchthrough_alpha = bpy.props.BoolProperty(name='Retro: Punchthrough Alpha')\n"
|
"bpy.types.Material.retro_alpha_test = bpy.props.BoolProperty(name='Retro: Punchthrough Alpha')\n"
|
||||||
"bpy.types.Material.retro_samus_reflection = bpy.props.BoolProperty(name='Retro: Samus Reflection')\n"
|
"bpy.types.Material.retro_samus_reflection = bpy.props.BoolProperty(name='Retro: Samus Reflection')\n"
|
||||||
"bpy.types.Material.retro_depth_write = bpy.props.BoolProperty(name='Retro: Depth Write')\n"
|
"bpy.types.Material.retro_depth_write = bpy.props.BoolProperty(name='Retro: Depth Write')\n"
|
||||||
"bpy.types.Material.retro_samus_reflection_persp = bpy.props.BoolProperty(name='Retro: Samus Reflection Perspective')\n"
|
"bpy.types.Material.retro_samus_reflection_persp = bpy.props.BoolProperty(name='Retro: Samus Reflection Perspective')\n"
|
||||||
|
@ -794,7 +794,7 @@ void _ConstructMaterial(Stream& out,
|
||||||
|
|
||||||
/* Material Flags */
|
/* Material Flags */
|
||||||
out.format("new_material.retro_depth_sort = %s\n"
|
out.format("new_material.retro_depth_sort = %s\n"
|
||||||
"new_material.retro_punchthrough_alpha = %s\n"
|
"new_material.retro_alpha_test = %s\n"
|
||||||
"new_material.retro_samus_reflection = %s\n"
|
"new_material.retro_samus_reflection = %s\n"
|
||||||
"new_material.retro_depth_write = %s\n"
|
"new_material.retro_depth_write = %s\n"
|
||||||
"new_material.retro_samus_reflection_persp = %s\n"
|
"new_material.retro_samus_reflection_persp = %s\n"
|
||||||
|
@ -803,7 +803,7 @@ void _ConstructMaterial(Stream& out,
|
||||||
"new_material.retro_lightmapped = %s\n"
|
"new_material.retro_lightmapped = %s\n"
|
||||||
"new_material.game_settings.invisible = %s\n",
|
"new_material.game_settings.invisible = %s\n",
|
||||||
material.flags.depthSorting() ? "True" : "False",
|
material.flags.depthSorting() ? "True" : "False",
|
||||||
material.flags.punchthroughAlpha() ? "True" : "False",
|
material.flags.alphaTest() ? "True" : "False",
|
||||||
material.flags.samusReflection() ? "True" : "False",
|
material.flags.samusReflection() ? "True" : "False",
|
||||||
material.flags.depthWrite() ? "True" : "False",
|
material.flags.depthWrite() ? "True" : "False",
|
||||||
material.flags.samusReflectionSurfaceEye() ? "True" : "False",
|
material.flags.samusReflectionSurfaceEye() ? "True" : "False",
|
||||||
|
@ -946,7 +946,7 @@ MaterialSet::Material::Material(const hecl::Backend::GX& gx,
|
||||||
if (search != iprops.end())
|
if (search != iprops.end())
|
||||||
flags.setDepthSorting(search->second != 0);
|
flags.setDepthSorting(search->second != 0);
|
||||||
|
|
||||||
search = iprops.find("retro_punchthrough_alpha");
|
search = iprops.find("retro_alpha_test");
|
||||||
if (search != iprops.end())
|
if (search != iprops.end())
|
||||||
flags.setPunchthroughAlpha(search->second != 0);
|
flags.setPunchthroughAlpha(search->second != 0);
|
||||||
|
|
||||||
|
@ -1212,7 +1212,7 @@ HMDLMaterialSet::Material::Material(hecl::Frontend::Frontend& FE,
|
||||||
if (search != iprops.end())
|
if (search != iprops.end())
|
||||||
flags.setDepthSorting(search->second != 0);
|
flags.setDepthSorting(search->second != 0);
|
||||||
|
|
||||||
search = iprops.find("retro_punchthrough_alpha");
|
search = iprops.find("retro_alpha_test");
|
||||||
if (search != iprops.end())
|
if (search != iprops.end())
|
||||||
flags.setPunchthroughAlpha(search->second != 0);
|
flags.setPunchthroughAlpha(search->second != 0);
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ struct MaterialSet : BigDNA
|
||||||
void setKonstValuesEnabled(bool enabled) {flags &= ~0x8; flags |= atUint32(enabled) << 3;}
|
void setKonstValuesEnabled(bool enabled) {flags &= ~0x8; flags |= atUint32(enabled) << 3;}
|
||||||
bool depthSorting() const {return (flags & 0x10) != 0;}
|
bool depthSorting() const {return (flags & 0x10) != 0;}
|
||||||
void setDepthSorting(bool enabled) {flags &= ~0x10; flags |= atUint32(enabled) << 4;}
|
void setDepthSorting(bool enabled) {flags &= ~0x10; flags |= atUint32(enabled) << 4;}
|
||||||
bool punchthroughAlpha() const {return (flags & 0x20) != 0;}
|
bool alphaTest() const {return (flags & 0x20) != 0;}
|
||||||
void setPunchthroughAlpha(bool enabled) {flags &= ~0x20; flags |= atUint32(enabled) << 5;}
|
void setPunchthroughAlpha(bool enabled) {flags &= ~0x20; flags |= atUint32(enabled) << 5;}
|
||||||
bool samusReflection() const {return (flags & 0x40) != 0;}
|
bool samusReflection() const {return (flags & 0x40) != 0;}
|
||||||
void setSamusReflection(bool enabled) {flags &= ~0x40; flags |= atUint32(enabled) << 6;}
|
void setSamusReflection(bool enabled) {flags &= ~0x40; flags |= atUint32(enabled) << 6;}
|
||||||
|
|
|
@ -30,8 +30,8 @@
|
||||||
#define SFXsfx047A 1146
|
#define SFXsfx047A 1146
|
||||||
#define SFXpik_x_elevamb_lp_00 1147
|
#define SFXpik_x_elevamb_lp_00 1147
|
||||||
#define SFXsfx047C 1148
|
#define SFXsfx047C 1148
|
||||||
#define SFXsfx047D 1149
|
#define SFXeff_x_largeburndeath_lp_00 1149
|
||||||
#define SFXeff_x_smallfire_lp_00 1150
|
#define SFXeff_x_smallburndeath_lp_00 1150
|
||||||
#define SFXeff_x_fire_lp_00 1151
|
#define SFXeff_x_fire_lp_00 1151
|
||||||
#define SFXsfx0480 1152
|
#define SFXsfx0480 1152
|
||||||
#define SFXsfx0481 1153
|
#define SFXsfx0481 1153
|
||||||
|
|
|
@ -76,7 +76,7 @@ void MaterialSet::Material::Enumerate<BigDNA::BinarySize>(typename BinarySize::S
|
||||||
|
|
||||||
void MaterialSet::RegisterMaterialProps(Stream& out)
|
void MaterialSet::RegisterMaterialProps(Stream& out)
|
||||||
{
|
{
|
||||||
out << "bpy.types.Material.retro_punchthrough_alpha = bpy.props.BoolProperty(name='Retro: Punchthrough Alpha')\n"
|
out << "bpy.types.Material.retro_alpha_test = bpy.props.BoolProperty(name='Retro: Punchthrough Alpha')\n"
|
||||||
"bpy.types.Material.retro_shadow_occluder = bpy.props.BoolProperty(name='Retro: Shadow Occluder')\n"
|
"bpy.types.Material.retro_shadow_occluder = bpy.props.BoolProperty(name='Retro: Shadow Occluder')\n"
|
||||||
"bpy.types.Material.retro_lightmapped = bpy.props.BoolProperty(name='Retro: Lightmapped')\n"
|
"bpy.types.Material.retro_lightmapped = bpy.props.BoolProperty(name='Retro: Lightmapped')\n"
|
||||||
"bpy.types.Material.retro_opac = bpy.props.IntProperty(name='Retro: OPAC')\n"
|
"bpy.types.Material.retro_opac = bpy.props.IntProperty(name='Retro: OPAC')\n"
|
||||||
|
@ -121,10 +121,10 @@ void MaterialSet::ConstructMaterial(Stream& out,
|
||||||
"\n", groupIdx, matIdx);
|
"\n", groupIdx, matIdx);
|
||||||
|
|
||||||
/* Material Flags */
|
/* Material Flags */
|
||||||
out.format("new_material.retro_punchthrough_alpha = %s\n"
|
out.format("new_material.retro_alpha_test = %s\n"
|
||||||
"new_material.retro_shadow_occluder = %s\n"
|
"new_material.retro_shadow_occluder = %s\n"
|
||||||
"new_material.game_settings.invisible = %s\n",
|
"new_material.game_settings.invisible = %s\n",
|
||||||
material.header.flags.punchthroughAlpha() ? "True" : "False",
|
material.header.flags.alphaTest() ? "True" : "False",
|
||||||
material.header.flags.shadowOccluderMesh() ? "True" : "False",
|
material.header.flags.shadowOccluderMesh() ? "True" : "False",
|
||||||
material.header.flags.shadowOccluderMesh() ? "True" : "False");
|
material.header.flags.shadowOccluderMesh() ? "True" : "False");
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ struct MaterialSet : BigDNA
|
||||||
Value<atUint32> flags;
|
Value<atUint32> flags;
|
||||||
bool alphaBlending() const {return (flags & 0x8) != 0;}
|
bool alphaBlending() const {return (flags & 0x8) != 0;}
|
||||||
void setAlphaBlending(bool enabled) {flags &= ~0x8; flags |= atUint32(enabled) << 3;}
|
void setAlphaBlending(bool enabled) {flags &= ~0x8; flags |= atUint32(enabled) << 3;}
|
||||||
bool punchthroughAlpha() const {return (flags & 0x10) != 0;}
|
bool alphaTest() const {return (flags & 0x10) != 0;}
|
||||||
void setPunchthroughAlpha(bool enabled) {flags &= ~0x10; flags |= atUint32(enabled) << 4;}
|
void setPunchthroughAlpha(bool enabled) {flags &= ~0x10; flags |= atUint32(enabled) << 4;}
|
||||||
bool additiveBlending() const {return (flags & 0x20) != 0;}
|
bool additiveBlending() const {return (flags & 0x20) != 0;}
|
||||||
void setAdditiveBlending(bool enabled) {flags &= ~0x20; flags |= atUint32(enabled) << 5;}
|
void setAdditiveBlending(bool enabled) {flags &= ~0x20; flags |= atUint32(enabled) << 5;}
|
||||||
|
|
|
@ -1018,6 +1018,54 @@ void CStateManager::PreRender()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CStateManager::GetCharacterRenderMaskAndTarget(bool thawed, int& mask, int& target) const
|
||||||
|
{
|
||||||
|
switch (x8b8_playerState->GetActiveVisor(*this))
|
||||||
|
{
|
||||||
|
case CPlayerState::EPlayerVisor::Combat:
|
||||||
|
case CPlayerState::EPlayerVisor::Scan:
|
||||||
|
mask = 0x1000;
|
||||||
|
target = 0x0;
|
||||||
|
break;
|
||||||
|
case CPlayerState::EPlayerVisor::XRay:
|
||||||
|
mask = 0x800;
|
||||||
|
target = 0x0;
|
||||||
|
break;
|
||||||
|
case CPlayerState::EPlayerVisor::Thermal:
|
||||||
|
if (thawed)
|
||||||
|
{
|
||||||
|
if (xf34_thermalFlag == EThermalDrawFlag::Hot)
|
||||||
|
{
|
||||||
|
mask = 0x600;
|
||||||
|
target = 0x0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mask = 0x600;
|
||||||
|
target = 0x200;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (xf34_thermalFlag == EThermalDrawFlag::Cold)
|
||||||
|
{
|
||||||
|
mask = 0x500;
|
||||||
|
target = 0x0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mask = 0x500;
|
||||||
|
target = 0x100;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
mask = 0x0;
|
||||||
|
target = 0x0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool CStateManager::GetVisSetForArea(TAreaId a, TAreaId b, CPVSVisSet& setOut) const
|
bool CStateManager::GetVisSetForArea(TAreaId a, TAreaId b, CPVSVisSet& setOut) const
|
||||||
{
|
{
|
||||||
if (b == kInvalidAreaId)
|
if (b == kInvalidAreaId)
|
||||||
|
|
|
@ -284,6 +284,7 @@ public:
|
||||||
void SetupFogForArea(const CGameArea& area) const;
|
void SetupFogForArea(const CGameArea& area) const;
|
||||||
bool SetupFogForDraw() const;
|
bool SetupFogForDraw() const;
|
||||||
void PreRender();
|
void PreRender();
|
||||||
|
void GetCharacterRenderMaskAndTarget(bool thawed, int& mask, int& target) const;
|
||||||
bool GetVisSetForArea(TAreaId, TAreaId, CPVSVisSet& setOut) const;
|
bool GetVisSetForArea(TAreaId, TAreaId, CPVSVisSet& setOut) const;
|
||||||
void RecursiveDrawTree(TUniqueId) const;
|
void RecursiveDrawTree(TUniqueId) const;
|
||||||
void SendScriptMsg(CEntity* dest, TUniqueId src, EScriptObjectMessage msg);
|
void SendScriptMsg(CEntity* dest, TUniqueId src, EScriptObjectMessage msg);
|
||||||
|
|
|
@ -254,6 +254,7 @@ public:
|
||||||
|
|
||||||
s32 GetCharacterIndex() const { return x204_charIdx; }
|
s32 GetCharacterIndex() const { return x204_charIdx; }
|
||||||
u16 GetDefaultAnimation() const { return x208_defaultAnim; }
|
u16 GetDefaultAnimation() const { return x208_defaultAnim; }
|
||||||
|
TLockedToken<CMorphableSkinnedModel>& IceModel() { return xe4_iceModelData; }
|
||||||
const TLockedToken<CMorphableSkinnedModel>& GetIceModel() const { return xe4_iceModelData; }
|
const TLockedToken<CMorphableSkinnedModel>& GetIceModel() const { return xe4_iceModelData; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ u32 CAnimTreeDoubleChild::VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINod
|
||||||
if (newCapacity > capacity)
|
if (newCapacity > capacity)
|
||||||
newCapacity = capacity;
|
newCapacity = capacity;
|
||||||
|
|
||||||
std::qsort(listOut, newCapacity, sizeof(CBoolPOINode), CPOINode::compare);
|
std::sort(listOut, listOut + newCapacity);
|
||||||
|
|
||||||
return newCapacity;
|
return newCapacity;
|
||||||
}
|
}
|
||||||
|
@ -83,7 +83,7 @@ u32 CAnimTreeDoubleChild::VGetInt32POIList(const CCharAnimTime& time, CInt32POIN
|
||||||
if (newCapacity > capacity)
|
if (newCapacity > capacity)
|
||||||
newCapacity = capacity;
|
newCapacity = capacity;
|
||||||
|
|
||||||
std::qsort(listOut, newCapacity, sizeof(CInt32POINode), CPOINode::compare);
|
std::sort(listOut, listOut + newCapacity);
|
||||||
|
|
||||||
return newCapacity;
|
return newCapacity;
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ u32 CAnimTreeDoubleChild::VGetParticlePOIList(const CCharAnimTime& time, CPartic
|
||||||
if (newCapacity > capacity)
|
if (newCapacity > capacity)
|
||||||
newCapacity = capacity;
|
newCapacity = capacity;
|
||||||
|
|
||||||
std::qsort(listOut, newCapacity, sizeof(CParticlePOINode), CPOINode::compare);
|
std::sort(listOut, listOut + newCapacity);
|
||||||
|
|
||||||
return newCapacity;
|
return newCapacity;
|
||||||
}
|
}
|
||||||
|
@ -109,7 +109,7 @@ u32 CAnimTreeDoubleChild::VGetSoundPOIList(const CCharAnimTime& time, CSoundPOIN
|
||||||
if (newCapacity > capacity)
|
if (newCapacity > capacity)
|
||||||
newCapacity = capacity;
|
newCapacity = capacity;
|
||||||
|
|
||||||
std::qsort(listOut, newCapacity, sizeof(CSoundPOINode), CPOINode::compare);
|
std::sort(listOut, listOut + newCapacity);
|
||||||
|
|
||||||
return newCapacity;
|
return newCapacity;
|
||||||
}
|
}
|
||||||
|
|
|
@ -484,4 +484,34 @@ void CModelData::InvSuitDraw(EWhichModel which, const zeus::CTransform& xf, cons
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CModelData::DisintegrateDraw(const CStateManager& mgr, const zeus::CTransform& xf,
|
||||||
|
const CTexture& tex, const zeus::CColor& addColor, float t)
|
||||||
|
{
|
||||||
|
DisintegrateDraw(GetRenderingModel(mgr), xf, tex, addColor, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CModelData::DisintegrateDraw(EWhichModel which, const zeus::CTransform& xf,
|
||||||
|
const CTexture& tex, const zeus::CColor& addColor, float t)
|
||||||
|
{
|
||||||
|
zeus::CTransform scaledXf = xf * zeus::CTransform::Scale(x0_scale);
|
||||||
|
CGraphics::SetModelMatrix(scaledXf);
|
||||||
|
|
||||||
|
CBooModel::SetDisintegrateTexture(tex.GetBooTexture());
|
||||||
|
CModelFlags flags(5, 0, 3, zeus::CColor::skWhite);
|
||||||
|
flags.m_extendedShader = EExtendedShader::Disintegrate;
|
||||||
|
flags.addColor = addColor;
|
||||||
|
flags.addColor.a = t; // Stash T value in here (shader does not care)
|
||||||
|
|
||||||
|
if (x10_animData)
|
||||||
|
{
|
||||||
|
CSkinnedModel& sModel = PickAnimatedModel(which);
|
||||||
|
x10_animData->Render(sModel, flags, {}, nullptr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CBooModel& model = *PickStaticModel(which);
|
||||||
|
model.Draw(flags, nullptr, nullptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -145,6 +145,10 @@ public:
|
||||||
|
|
||||||
void InvSuitDraw(EWhichModel which, const zeus::CTransform& xf, const CActorLights* lights,
|
void InvSuitDraw(EWhichModel which, const zeus::CTransform& xf, const CActorLights* lights,
|
||||||
const zeus::CColor& color0, const zeus::CColor& color1);
|
const zeus::CColor& color0, const zeus::CColor& color1);
|
||||||
|
void DisintegrateDraw(const CStateManager& mgr, const zeus::CTransform& xf,
|
||||||
|
const CTexture& tex, const zeus::CColor& addColor, float t);
|
||||||
|
void DisintegrateDraw(EWhichModel which, const zeus::CTransform& xf,
|
||||||
|
const CTexture& tex, const zeus::CColor& addColor, float t);
|
||||||
|
|
||||||
CAnimData* AnimationData() { return x10_animData.get(); }
|
CAnimData* AnimationData() { return x10_animData.get(); }
|
||||||
const CAnimData* GetAnimationData() const { return x10_animData.get(); }
|
const CAnimData* GetAnimationData() const { return x10_animData.get(); }
|
||||||
|
|
|
@ -43,17 +43,6 @@ bool CPOINode::operator<(const CPOINode& other) const
|
||||||
return x1c_time > other.x1c_time;
|
return x1c_time > other.x1c_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CPOINode::compare(const void* a, const void* b)
|
|
||||||
{
|
|
||||||
const CPOINode& na = *reinterpret_cast<const CPOINode*>(a);
|
|
||||||
const CPOINode& nb = *reinterpret_cast<const CPOINode*>(b);
|
|
||||||
if (na > nb)
|
|
||||||
return 1;
|
|
||||||
else if (na < nb)
|
|
||||||
return -1;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
u32 _getPOIList(const CCharAnimTime& time,
|
u32 _getPOIList(const CCharAnimTime& time,
|
||||||
T* listOut,
|
T* listOut,
|
||||||
|
|
|
@ -48,7 +48,6 @@ public:
|
||||||
|
|
||||||
bool operator>(const CPOINode& other) const;
|
bool operator>(const CPOINode& other) const;
|
||||||
bool operator<(const CPOINode& other) const;
|
bool operator<(const CPOINode& other) const;
|
||||||
static int compare(const void* a, const void* b);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
|
|
|
@ -270,6 +270,7 @@ void CBooRenderer::ActivateLightsForModel(CAreaListItem* item, CBooModel& model)
|
||||||
void CBooRenderer::RenderBucketItems(CAreaListItem* item)
|
void CBooRenderer::RenderBucketItems(CAreaListItem* item)
|
||||||
{
|
{
|
||||||
CModelFlags flags;
|
CModelFlags flags;
|
||||||
|
flags.m_noZWrite = true;
|
||||||
flags.m_extendedShader = EExtendedShader::Lighting;
|
flags.m_extendedShader = EExtendedShader::Lighting;
|
||||||
|
|
||||||
for (u16 idx : Buckets::sBucketIndex)
|
for (u16 idx : Buckets::sBucketIndex)
|
||||||
|
@ -831,7 +832,7 @@ void CBooRenderer::UpdateAreaUniforms(int areaIdx, bool shadowRender)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
item.m_shaderSet->m_geomLayout->Update(flags, nullptr, nullptr, &item.m_shaderSet->m_matSet,
|
item.m_shaderSet->m_geomLayout->Update(flags, nullptr, nullptr, &item.m_shaderSet->m_matSet,
|
||||||
item.m_shaderSet->m_geomLayout->m_sharedBuffer[bufIdx]);
|
item.m_shaderSet->m_geomLayout->m_sharedBuffer[bufIdx], nullptr);
|
||||||
|
|
||||||
for (auto it = item.x10_models.begin(); it != item.x10_models.end(); ++it)
|
for (auto it = item.x10_models.begin(); it != item.x10_models.end(); ++it)
|
||||||
{
|
{
|
||||||
|
|
|
@ -97,7 +97,8 @@ struct GeometryUniformLayout
|
||||||
|
|
||||||
GeometryUniformLayout(const CModel* model, const MaterialSet* matSet);
|
GeometryUniformLayout(const CModel* model, const MaterialSet* matSet);
|
||||||
void Update(const CModelFlags& flags, const CSkinRules* cskr, const CPoseAsTransforms* pose,
|
void Update(const CModelFlags& flags, const CSkinRules* cskr, const CPoseAsTransforms* pose,
|
||||||
const MaterialSet* matSet, const boo::ObjToken<boo::IGraphicsBufferD>& buf) const;
|
const MaterialSet* matSet, const boo::ObjToken<boo::IGraphicsBufferD>& buf,
|
||||||
|
const CBooModel* parent) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SShader
|
struct SShader
|
||||||
|
@ -161,7 +162,8 @@ private:
|
||||||
{
|
{
|
||||||
static void ProcessAnimation(u8*& bufOut, const UVAnimation& anim);
|
static void ProcessAnimation(u8*& bufOut, const UVAnimation& anim);
|
||||||
static void PadOutBuffer(u8*& bufStart, u8*& bufOut);
|
static void PadOutBuffer(u8*& bufStart, u8*& bufOut);
|
||||||
static void Update(u8*& bufOut, const MaterialSet* matSet, const CModelFlags& flags);
|
static void Update(u8*& bufOut, const MaterialSet* matSet,
|
||||||
|
const CModelFlags& flags, const CBooModel* parent);
|
||||||
};
|
};
|
||||||
|
|
||||||
CModelShaders::LightingUniform m_lightingData;
|
CModelShaders::LightingUniform m_lightingData;
|
||||||
|
@ -185,6 +187,7 @@ private:
|
||||||
boo::ObjToken<boo::ITexture> m_txtrOverrides[8];
|
boo::ObjToken<boo::ITexture> m_txtrOverrides[8];
|
||||||
|
|
||||||
boo::ObjToken<boo::ITexture> m_lastDrawnShadowMap;
|
boo::ObjToken<boo::ITexture> m_lastDrawnShadowMap;
|
||||||
|
boo::ObjToken<boo::ITexture> m_lastDrawnOneTexture;
|
||||||
|
|
||||||
ModelInstance* PushNewModelInstance(int sharedLayoutBuf = -1);
|
ModelInstance* PushNewModelInstance(int sharedLayoutBuf = -1);
|
||||||
void DrawAlphaSurfaces(const CModelFlags& flags) const;
|
void DrawAlphaSurfaces(const CModelFlags& flags) const;
|
||||||
|
@ -268,10 +271,15 @@ public:
|
||||||
static void EnableShadowMaps(const boo::ObjToken<boo::ITexture>& map, const zeus::CTransform& texXf);
|
static void EnableShadowMaps(const boo::ObjToken<boo::ITexture>& map, const zeus::CTransform& texXf);
|
||||||
static void DisableShadowMaps();
|
static void DisableShadowMaps();
|
||||||
|
|
||||||
|
static boo::ObjToken<boo::ITexture> g_disintegrateTexture;
|
||||||
|
static void SetDisintegrateTexture(const boo::ObjToken<boo::ITexture>& map) { g_disintegrateTexture = map; }
|
||||||
|
|
||||||
static void SetDummyTextures(bool b) { g_DummyTextures = b; }
|
static void SetDummyTextures(bool b) { g_DummyTextures = b; }
|
||||||
static void SetRenderModelBlack(bool b) { g_RenderModelBlack = b; }
|
static void SetRenderModelBlack(bool b) { g_RenderModelBlack = b; }
|
||||||
|
|
||||||
static void AssertAllFreed();
|
static void AssertAllFreed();
|
||||||
|
|
||||||
|
const zeus::CAABox& GetAABB() const { return x20_aabb; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class CModel
|
class CModel
|
||||||
|
|
|
@ -149,6 +149,7 @@ void CBooModel::EnsureViewDepStateCached(const CBooModel& model, const CBooSurfa
|
||||||
|
|
||||||
boo::ObjToken<boo::ITexture> CBooModel::g_shadowMap;
|
boo::ObjToken<boo::ITexture> CBooModel::g_shadowMap;
|
||||||
zeus::CTransform CBooModel::g_shadowTexXf;
|
zeus::CTransform CBooModel::g_shadowTexXf;
|
||||||
|
boo::ObjToken<boo::ITexture> CBooModel::g_disintegrateTexture;
|
||||||
|
|
||||||
void CBooModel::EnableShadowMaps(const boo::ObjToken<boo::ITexture>& map, const zeus::CTransform& texXf)
|
void CBooModel::EnableShadowMaps(const boo::ObjToken<boo::ITexture>& map, const zeus::CTransform& texXf)
|
||||||
{
|
{
|
||||||
|
@ -198,7 +199,7 @@ CBooModel::CBooModel(TToken<CModel>& token, CModel* parent, std::vector<CBooSurf
|
||||||
{
|
{
|
||||||
u32 matId = it->m_data.matIdx;
|
u32 matId = it->m_data.matIdx;
|
||||||
const MaterialSet::Material& matData = GetMaterialByIndex(matId);
|
const MaterialSet::Material& matData = GetMaterialByIndex(matId);
|
||||||
if (matData.flags.depthSorting() || matData.heclIr.m_doAlpha)
|
if (matData.flags.depthSorting())
|
||||||
{
|
{
|
||||||
it->m_next = x3c_firstSortedSurface;
|
it->m_next = x3c_firstSortedSurface;
|
||||||
x3c_firstSortedSurface = &*it;
|
x3c_firstSortedSurface = &*it;
|
||||||
|
@ -251,7 +252,7 @@ GeometryUniformLayout::GeometryUniformLayout(const CModel* model, const Material
|
||||||
/* Skinned */
|
/* Skinned */
|
||||||
for (size_t i=0 ; i<m_skinBankCount ; ++i)
|
for (size_t i=0 ; i<m_skinBankCount ; ++i)
|
||||||
{
|
{
|
||||||
size_t thisSz = ROUND_UP_256(sizeof(zeus::CMatrix4f) * (2 * m_weightVecCount * 4 + 1));
|
size_t thisSz = ROUND_UP_256(sizeof(zeus::CMatrix4f) * (2 * m_weightVecCount * 4 + 3));
|
||||||
m_skinOffs.push_back(m_geomBufferSize);
|
m_skinOffs.push_back(m_geomBufferSize);
|
||||||
m_skinSizes.push_back(thisSz);
|
m_skinSizes.push_back(thisSz);
|
||||||
m_geomBufferSize += thisSz;
|
m_geomBufferSize += thisSz;
|
||||||
|
@ -445,6 +446,14 @@ CBooModel::ModelInstance* CBooModel::PushNewModelInstance(int sharedLayoutBuf)
|
||||||
texs[7] = g_Renderer->x220_sphereRamp.get();
|
texs[7] = g_Renderer->x220_sphereRamp.get();
|
||||||
ltexs = texs;
|
ltexs = texs;
|
||||||
}
|
}
|
||||||
|
else if (idx == EExtendedShader::Disintegrate)
|
||||||
|
{
|
||||||
|
if (g_disintegrateTexture)
|
||||||
|
texs[7] = g_disintegrateTexture;
|
||||||
|
else
|
||||||
|
texs[7] = g_Renderer->x220_sphereRamp.get();
|
||||||
|
ltexs = texs;
|
||||||
|
}
|
||||||
else if (useReflection)
|
else if (useReflection)
|
||||||
{
|
{
|
||||||
ltexs = texs;
|
ltexs = texs;
|
||||||
|
@ -757,11 +766,8 @@ void CBooModel::UVAnimationBuffer::ProcessAnimation(u8*& bufOut, const UVAnimati
|
||||||
{
|
{
|
||||||
case UVAnimation::Mode::MvInvNoTranslation:
|
case UVAnimation::Mode::MvInvNoTranslation:
|
||||||
{
|
{
|
||||||
/* Handled in-shader
|
|
||||||
texMtxOut = CGraphics::g_GXModelViewInvXpose.toMatrix4f();
|
texMtxOut = CGraphics::g_GXModelViewInvXpose.toMatrix4f();
|
||||||
texMtxOut.vec[3].zeroOut();
|
|
||||||
texMtxOut.vec[3].w = 1.f;
|
texMtxOut.vec[3].w = 1.f;
|
||||||
*/
|
|
||||||
postMtxOut.vec[0].x = 0.5f;
|
postMtxOut.vec[0].x = 0.5f;
|
||||||
postMtxOut.vec[1].y = 0.5f;
|
postMtxOut.vec[1].y = 0.5f;
|
||||||
postMtxOut.vec[3].x = 0.5f;
|
postMtxOut.vec[3].x = 0.5f;
|
||||||
|
@ -770,6 +776,7 @@ void CBooModel::UVAnimationBuffer::ProcessAnimation(u8*& bufOut, const UVAnimati
|
||||||
}
|
}
|
||||||
case UVAnimation::Mode::MvInv:
|
case UVAnimation::Mode::MvInv:
|
||||||
{
|
{
|
||||||
|
texMtxOut = CGraphics::g_GXModelViewInvXpose.toMatrix4f();
|
||||||
texMtxOut.vec[3] = CGraphics::g_ViewMatrix.inverse() * CGraphics::g_GXModelMatrix.origin;
|
texMtxOut.vec[3] = CGraphics::g_ViewMatrix.inverse() * CGraphics::g_GXModelMatrix.origin;
|
||||||
texMtxOut.vec[3].w = 1.f;
|
texMtxOut.vec[3].w = 1.f;
|
||||||
postMtxOut.vec[0].x = 0.5f;
|
postMtxOut.vec[0].x = 0.5f;
|
||||||
|
@ -822,11 +829,7 @@ void CBooModel::UVAnimationBuffer::ProcessAnimation(u8*& bufOut, const UVAnimati
|
||||||
}
|
}
|
||||||
case UVAnimation::Mode::CylinderEnvironment:
|
case UVAnimation::Mode::CylinderEnvironment:
|
||||||
{
|
{
|
||||||
/* Handled in-shader
|
texMtxOut = CGraphics::g_GXModelViewInvXpose.toMatrix4f();
|
||||||
//texMtxOut = (CGraphics::g_ViewMatrix.inverse() * CGraphics::g_GXModelMatrix).toMatrix4f();
|
|
||||||
texMtxOut = CGraphics::g_GXModelView.toMatrix4f();
|
|
||||||
texMtxOut.vec[3].zeroOut();
|
|
||||||
*/
|
|
||||||
|
|
||||||
const zeus::CVector3f& viewOrigin = CGraphics::g_ViewMatrix.origin;
|
const zeus::CVector3f& viewOrigin = CGraphics::g_ViewMatrix.origin;
|
||||||
float xy = (viewOrigin.x + viewOrigin.y) * 0.025f * anim.vals[1];
|
float xy = (viewOrigin.x + viewOrigin.y) * 0.025f * anim.vals[1];
|
||||||
|
@ -862,13 +865,19 @@ static const zeus::CMatrix4f MBShadowPost1(0.f, 0.f, 0.f, 1.f,
|
||||||
0.f, 0.f, 0.f, 1.f,
|
0.f, 0.f, 0.f, 1.f,
|
||||||
0.f, 0.f, 0.f, 1.f);
|
0.f, 0.f, 0.f, 1.f);
|
||||||
|
|
||||||
void CBooModel::UVAnimationBuffer::Update(u8*& bufOut, const MaterialSet* matSet, const CModelFlags& flags)
|
static const zeus::CMatrix4f DisintegratePost(1.f, 1.f, 0.f, 0.f,
|
||||||
|
0.f, 0.f, 1.f, 0.f,
|
||||||
|
0.f, 0.f, 0.f, 1.f,
|
||||||
|
0.f, 0.f, 0.f, 1.f);
|
||||||
|
|
||||||
|
void CBooModel::UVAnimationBuffer::Update(u8*& bufOut, const MaterialSet* matSet,
|
||||||
|
const CModelFlags& flags, const CBooModel* parent)
|
||||||
{
|
{
|
||||||
u8* start = bufOut;
|
u8* start = bufOut;
|
||||||
|
|
||||||
/* Special matrices for MorphBall shadow rendering */
|
|
||||||
if (flags.m_extendedShader == EExtendedShader::MorphBallShadow)
|
if (flags.m_extendedShader == EExtendedShader::MorphBallShadow)
|
||||||
{
|
{
|
||||||
|
/* Special matrices for MorphBall shadow rendering */
|
||||||
zeus::CMatrix4f texMtx =
|
zeus::CMatrix4f texMtx =
|
||||||
(zeus::CTransform::Scale(1.f / (flags.mbShadowBox.max.x - flags.mbShadowBox.min.x),
|
(zeus::CTransform::Scale(1.f / (flags.mbShadowBox.max.x - flags.mbShadowBox.min.x),
|
||||||
1.f / (flags.mbShadowBox.max.y - flags.mbShadowBox.min.y),
|
1.f / (flags.mbShadowBox.max.y - flags.mbShadowBox.min.y),
|
||||||
|
@ -889,6 +898,34 @@ void CBooModel::UVAnimationBuffer::Update(u8*& bufOut, const MaterialSet* matSet
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else if (flags.m_extendedShader == EExtendedShader::Disintegrate)
|
||||||
|
{
|
||||||
|
assert(parent != nullptr && "Parent CBooModel not set");
|
||||||
|
zeus::CTransform xf = zeus::CTransform::RotateX(-zeus::degToRad(45.f));
|
||||||
|
zeus::CAABox aabb = parent->GetAABB().getTransformedAABox(xf);
|
||||||
|
xf = zeus::CTransform::Scale(5.f / (aabb.max - aabb.min)) *
|
||||||
|
zeus::CTransform::Translate(-aabb.min) * xf;
|
||||||
|
zeus::CMatrix4f texMtx = xf.toMatrix4f();
|
||||||
|
zeus::CMatrix4f post0 = DisintegratePost;
|
||||||
|
post0[3].x = flags.addColor.a;
|
||||||
|
post0[3].y = 6.f * -(1.f - flags.addColor.a) + 1.f;
|
||||||
|
zeus::CMatrix4f post1 = DisintegratePost;
|
||||||
|
post1[3].x = -0.85f * flags.addColor.a - 0.15f;
|
||||||
|
post1[3].y = post0[3].y;
|
||||||
|
/* Special matrices for disintegration rendering */
|
||||||
|
for (const MaterialSet::Material& mat : matSet->materials)
|
||||||
|
{
|
||||||
|
(void)mat;
|
||||||
|
std::array<zeus::CMatrix4f, 2>* mtxs = reinterpret_cast<std::array<zeus::CMatrix4f, 2>*>(bufOut);
|
||||||
|
mtxs[0][0] = texMtx;
|
||||||
|
mtxs[0][1] = post0;
|
||||||
|
mtxs[1][0] = texMtx;
|
||||||
|
mtxs[1][1] = post1;
|
||||||
|
bufOut += sizeof(zeus::CMatrix4f) * 2 * 8;
|
||||||
|
PadOutBuffer(start, bufOut);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
std::experimental::optional<std::array<zeus::CMatrix4f, 2>> specialMtxOut;
|
std::experimental::optional<std::array<zeus::CMatrix4f, 2>> specialMtxOut;
|
||||||
if (flags.m_extendedShader == EExtendedShader::Thermal)
|
if (flags.m_extendedShader == EExtendedShader::Thermal)
|
||||||
|
@ -946,7 +983,8 @@ void GeometryUniformLayout::Update(const CModelFlags& flags,
|
||||||
const CSkinRules* cskr,
|
const CSkinRules* cskr,
|
||||||
const CPoseAsTransforms* pose,
|
const CPoseAsTransforms* pose,
|
||||||
const MaterialSet* matSet,
|
const MaterialSet* matSet,
|
||||||
const boo::ObjToken<boo::IGraphicsBufferD>& buf) const
|
const boo::ObjToken<boo::IGraphicsBufferD>& buf,
|
||||||
|
const CBooModel* parent) const
|
||||||
{
|
{
|
||||||
u8* dataOut = reinterpret_cast<u8*>(buf->map(m_geomBufferSize));
|
u8* dataOut = reinterpret_cast<u8*>(buf->map(m_geomBufferSize));
|
||||||
u8* dataCur = dataOut;
|
u8* dataCur = dataOut;
|
||||||
|
@ -965,25 +1003,20 @@ void GeometryUniformLayout::Update(const CModelFlags& flags,
|
||||||
|
|
||||||
for (size_t w=0 ; w<weightCount ; ++w)
|
for (size_t w=0 ; w<weightCount ; ++w)
|
||||||
{
|
{
|
||||||
zeus::CMatrix4f& mv = reinterpret_cast<zeus::CMatrix4f&>(*dataCur);
|
zeus::CMatrix4f& obj = reinterpret_cast<zeus::CMatrix4f&>(*dataCur);
|
||||||
if (w >= bankTransforms.size())
|
if (w >= bankTransforms.size())
|
||||||
mv = CGraphics::g_GXModelView.toMatrix4f();
|
obj = zeus::CMatrix4f::skIdentityMatrix4f;
|
||||||
else
|
else
|
||||||
mv = (CGraphics::g_GXModelView * *bankTransforms[w]).toMatrix4f();
|
obj = bankTransforms[w]->toMatrix4f();
|
||||||
dataCur += sizeof(zeus::CMatrix4f);
|
dataCur += sizeof(zeus::CMatrix4f);
|
||||||
}
|
}
|
||||||
for (size_t w=0 ; w<weightCount ; ++w)
|
for (size_t w=0 ; w<weightCount ; ++w)
|
||||||
{
|
{
|
||||||
zeus::CMatrix4f& mvinv = reinterpret_cast<zeus::CMatrix4f&>(*dataCur);
|
zeus::CMatrix4f& objInv = reinterpret_cast<zeus::CMatrix4f&>(*dataCur);
|
||||||
if (w >= bankTransforms.size())
|
if (w >= bankTransforms.size())
|
||||||
mvinv = CGraphics::g_GXModelViewInvXpose.toMatrix4f();
|
objInv = zeus::CMatrix4f::skIdentityMatrix4f;
|
||||||
else
|
else
|
||||||
{
|
objInv = bankTransforms[w]->basis;
|
||||||
zeus::CTransform xf = (CGraphics::g_GXModelView.basis * bankTransforms[w]->basis);
|
|
||||||
xf.basis.invert();
|
|
||||||
xf.basis.transpose();
|
|
||||||
mvinv = xf.toMatrix4f();
|
|
||||||
}
|
|
||||||
dataCur += sizeof(zeus::CMatrix4f);
|
dataCur += sizeof(zeus::CMatrix4f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -994,16 +1027,24 @@ void GeometryUniformLayout::Update(const CModelFlags& flags,
|
||||||
for (size_t w=0 ; w<weightCount ; ++w)
|
for (size_t w=0 ; w<weightCount ; ++w)
|
||||||
{
|
{
|
||||||
zeus::CMatrix4f& mv = reinterpret_cast<zeus::CMatrix4f&>(*dataCur);
|
zeus::CMatrix4f& mv = reinterpret_cast<zeus::CMatrix4f&>(*dataCur);
|
||||||
mv = CGraphics::g_GXModelView.toMatrix4f();
|
mv = zeus::CMatrix4f::skIdentityMatrix4f;
|
||||||
dataCur += sizeof(zeus::CMatrix4f);
|
dataCur += sizeof(zeus::CMatrix4f);
|
||||||
}
|
}
|
||||||
for (size_t w=0 ; w<weightCount ; ++w)
|
for (size_t w=0 ; w<weightCount ; ++w)
|
||||||
{
|
{
|
||||||
zeus::CMatrix4f& mvinv = reinterpret_cast<zeus::CMatrix4f&>(*dataCur);
|
zeus::CMatrix4f& mvinv = reinterpret_cast<zeus::CMatrix4f&>(*dataCur);
|
||||||
mvinv = CGraphics::g_GXModelViewInvXpose.toMatrix4f();
|
mvinv = zeus::CMatrix4f::skIdentityMatrix4f;
|
||||||
dataCur += sizeof(zeus::CMatrix4f);
|
dataCur += sizeof(zeus::CMatrix4f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
zeus::CMatrix4f& mv = reinterpret_cast<zeus::CMatrix4f&>(*dataCur);
|
||||||
|
mv = CGraphics::g_GXModelView.toMatrix4f();
|
||||||
|
dataCur += sizeof(zeus::CMatrix4f);
|
||||||
|
|
||||||
|
zeus::CMatrix4f& mvinv = reinterpret_cast<zeus::CMatrix4f&>(*dataCur);
|
||||||
|
mvinv = CGraphics::g_GXModelViewInvXpose.toMatrix4f();
|
||||||
|
dataCur += sizeof(zeus::CMatrix4f);
|
||||||
|
|
||||||
zeus::CMatrix4f& proj = reinterpret_cast<zeus::CMatrix4f&>(*dataCur);
|
zeus::CMatrix4f& proj = reinterpret_cast<zeus::CMatrix4f&>(*dataCur);
|
||||||
proj = CGraphics::GetPerspectiveProjectionMatrix(true);
|
proj = CGraphics::GetPerspectiveProjectionMatrix(true);
|
||||||
dataCur += sizeof(zeus::CMatrix4f);
|
dataCur += sizeof(zeus::CMatrix4f);
|
||||||
|
@ -1029,7 +1070,7 @@ void GeometryUniformLayout::Update(const CModelFlags& flags,
|
||||||
dataCur = dataOut + ROUND_UP_256(dataCur - dataOut);
|
dataCur = dataOut + ROUND_UP_256(dataCur - dataOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
CBooModel::UVAnimationBuffer::Update(dataCur, matSet, flags);
|
CBooModel::UVAnimationBuffer::Update(dataCur, matSet, flags, parent);
|
||||||
buf->unmap();
|
buf->unmap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1046,6 +1087,14 @@ boo::ObjToken<boo::IGraphicsBufferD> CBooModel::UpdateUniformData(const CModelFl
|
||||||
const_cast<CBooModel*>(this)->m_instances.clear();
|
const_cast<CBooModel*>(this)->m_instances.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Invalidate instances if new one-texture being drawn */
|
||||||
|
if (flags.m_extendedShader == EExtendedShader::Disintegrate &&
|
||||||
|
m_lastDrawnOneTexture != g_disintegrateTexture)
|
||||||
|
{
|
||||||
|
const_cast<CBooModel*>(this)->m_lastDrawnOneTexture = g_disintegrateTexture;
|
||||||
|
const_cast<CBooModel*>(this)->m_instances.clear();
|
||||||
|
}
|
||||||
|
|
||||||
const ModelInstance* inst;
|
const ModelInstance* inst;
|
||||||
if (sharedLayoutBuf >= 0)
|
if (sharedLayoutBuf >= 0)
|
||||||
{
|
{
|
||||||
|
@ -1076,7 +1125,7 @@ boo::ObjToken<boo::IGraphicsBufferD> CBooModel::UpdateUniformData(const CModelFl
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inst->m_geomUniformBuffer)
|
if (inst->m_geomUniformBuffer)
|
||||||
m_geomLayout->Update(flags, cskr, pose, x4_matSet, inst->m_geomUniformBuffer);
|
m_geomLayout->Update(flags, cskr, pose, x4_matSet, inst->m_geomUniformBuffer, this);
|
||||||
|
|
||||||
u8* dataOut = reinterpret_cast<u8*>(inst->m_uniformBuffer->map(m_uniformDataSize));
|
u8* dataOut = reinterpret_cast<u8*>(inst->m_uniformBuffer->map(m_uniformDataSize));
|
||||||
u8* dataCur = dataOut;
|
u8* dataCur = dataOut;
|
||||||
|
@ -1100,6 +1149,12 @@ boo::ObjToken<boo::IGraphicsBufferD> CBooModel::UpdateUniformData(const CModelFl
|
||||||
shadowOut.shadowUp.w = flags.x4_color.a;
|
shadowOut.shadowUp.w = flags.x4_color.a;
|
||||||
shadowOut.shadowId = flags.x4_color.r;
|
shadowOut.shadowId = flags.x4_color.r;
|
||||||
}
|
}
|
||||||
|
else if (flags.m_extendedShader == EExtendedShader::Disintegrate)
|
||||||
|
{
|
||||||
|
CModelShaders::OneTextureUniform& oneTexOut = *reinterpret_cast<CModelShaders::OneTextureUniform*>(dataCur);
|
||||||
|
oneTexOut.addColor = flags.addColor;
|
||||||
|
oneTexOut.fog = CGraphics::g_Fog;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CModelShaders::LightingUniform& lightingOut = *reinterpret_cast<CModelShaders::LightingUniform*>(dataCur);
|
CModelShaders::LightingUniform& lightingOut = *reinterpret_cast<CModelShaders::LightingUniform*>(dataCur);
|
||||||
|
@ -1230,7 +1285,7 @@ SShader::BuildShader(const hecl::HMDLMeta& meta, const MaterialSet::Material& ma
|
||||||
hecl::Backend::ShaderTag tag(mat.heclIr,
|
hecl::Backend::ShaderTag tag(mat.heclIr,
|
||||||
meta.colorCount, meta.uvCount, meta.weightCount,
|
meta.colorCount, meta.uvCount, meta.weightCount,
|
||||||
meta.weightCount * 4, boo::Primitive(meta.topology),
|
meta.weightCount * 4, boo::Primitive(meta.topology),
|
||||||
reflectionType, true, true, true);
|
reflectionType, true, true, true, mat.flags.alphaTest());
|
||||||
return CModelShaders::BuildExtendedShader(tag, mat.heclIr);
|
return CModelShaders::BuildExtendedShader(tag, mat.heclIr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,9 +62,11 @@ public:
|
||||||
|
|
||||||
class CMorphableSkinnedModel : public CSkinnedModel
|
class CMorphableSkinnedModel : public CSkinnedModel
|
||||||
{
|
{
|
||||||
|
std::unique_ptr<float[]> x40_morphMagnitudes;
|
||||||
public:
|
public:
|
||||||
CMorphableSkinnedModel(IObjectStore& store, CAssetId model, CAssetId skinRules,
|
CMorphableSkinnedModel(IObjectStore& store, CAssetId model, CAssetId skinRules,
|
||||||
CAssetId layoutInfo, int shaderIdx, int drawInsts);
|
CAssetId layoutInfo, int shaderIdx, int drawInsts);
|
||||||
|
const float* GetMorphMagnitudes() const { return x40_morphMagnitudes.get(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,6 +71,12 @@ static const hecl::Backend::TextureInfo WorldShadowTextures[] =
|
||||||
{hecl::Backend::TexGenSrc::Position, 7, 0, 7, false} // Shadow tex
|
{hecl::Backend::TexGenSrc::Position, 7, 0, 7, false} // Shadow tex
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const hecl::Backend::TextureInfo DisintegrateTextures[] =
|
||||||
|
{
|
||||||
|
{hecl::Backend::TexGenSrc::Position, 7, 0, 0, false}, // Ashy tex
|
||||||
|
{hecl::Backend::TexGenSrc::Position, 7, 0, 1, false} // Ashy tex
|
||||||
|
};
|
||||||
|
|
||||||
static const char* BlockNames[] = {"LightingUniform"};
|
static const char* BlockNames[] = {"LightingUniform"};
|
||||||
static const char* ThermalBlockNames[] = {"ThermalUniform"};
|
static const char* ThermalBlockNames[] = {"ThermalUniform"};
|
||||||
static const char* SolidBlockNames[] = {"SolidUniform"};
|
static const char* SolidBlockNames[] = {"SolidUniform"};
|
||||||
|
@ -157,7 +163,11 @@ static hecl::Backend::ExtensionSlot g_ExtensionSlots[] =
|
||||||
/* Depth GEqual no Z-write */
|
/* Depth GEqual no Z-write */
|
||||||
{1, BlockNames, 0, nullptr, hecl::Backend::BlendFactor::SrcAlpha,
|
{1, BlockNames, 0, nullptr, hecl::Backend::BlendFactor::SrcAlpha,
|
||||||
hecl::Backend::BlendFactor::InvSrcAlpha, hecl::Backend::ZTest::GEqual,
|
hecl::Backend::BlendFactor::InvSrcAlpha, hecl::Backend::ZTest::GEqual,
|
||||||
hecl::Backend::CullMode::Backface, true, false, true}
|
hecl::Backend::CullMode::Backface, true, false, true},
|
||||||
|
/* Disintegration */
|
||||||
|
{1, BlockNames, 2, DisintegrateTextures, hecl::Backend::BlendFactor::SrcAlpha,
|
||||||
|
hecl::Backend::BlendFactor::InvSrcAlpha, hecl::Backend::ZTest::LEqual,
|
||||||
|
hecl::Backend::CullMode::Original, false, false, true, false, false, true}
|
||||||
};
|
};
|
||||||
|
|
||||||
extern const hecl::Backend::Function ExtensionLightingFuncsGLSL[];
|
extern const hecl::Backend::Function ExtensionLightingFuncsGLSL[];
|
||||||
|
|
|
@ -35,6 +35,7 @@ enum EExtendedShader : uint8_t
|
||||||
ForcedAlphaNoCullNoZWrite,
|
ForcedAlphaNoCullNoZWrite,
|
||||||
ForcedAdditiveNoCullNoZWrite,
|
ForcedAdditiveNoCullNoZWrite,
|
||||||
DepthGEqualNoZWrite,
|
DepthGEqualNoZWrite,
|
||||||
|
Disintegrate,
|
||||||
MAX
|
MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -79,6 +80,12 @@ public:
|
||||||
float shadowId;
|
float shadowId;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct OneTextureUniform
|
||||||
|
{
|
||||||
|
zeus::CColor addColor;
|
||||||
|
CGraphics::CFogState fog;
|
||||||
|
};
|
||||||
|
|
||||||
static void Initialize();
|
static void Initialize();
|
||||||
static void Shutdown();
|
static void Shutdown();
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,46 @@ using namespace std::literals;
|
||||||
extern const hecl::Backend::Function ExtensionLightingFuncsGLSL[];
|
extern const hecl::Backend::Function ExtensionLightingFuncsGLSL[];
|
||||||
extern const hecl::Backend::Function ExtensionPostFuncsGLSL[];
|
extern const hecl::Backend::Function ExtensionPostFuncsGLSL[];
|
||||||
|
|
||||||
|
#define FOG_STRUCT_GLSL \
|
||||||
|
"struct Fog\n" \
|
||||||
|
"{\n" \
|
||||||
|
" int mode;\n" \
|
||||||
|
" vec4 color;\n" \
|
||||||
|
" float rangeScale;\n" \
|
||||||
|
" float start;\n" \
|
||||||
|
"};\n"
|
||||||
|
|
||||||
|
#define FOG_ALGORITHM_GLSL \
|
||||||
|
" float fogZ, temp;\n" \
|
||||||
|
" switch (fog.mode)\n" \
|
||||||
|
" {\n" \
|
||||||
|
" case 2:\n" \
|
||||||
|
" fogZ = (-vtf.mvPos.z - fog.start) * fog.rangeScale;\n" \
|
||||||
|
" break;\n" \
|
||||||
|
" case 4:\n" \
|
||||||
|
" fogZ = 1.0 - exp2(-8.0 * (-vtf.mvPos.z - fog.start) * fog.rangeScale);\n" \
|
||||||
|
" break;\n" \
|
||||||
|
" case 5:\n" \
|
||||||
|
" temp = (-vtf.mvPos.z - fog.start) * fog.rangeScale;\n" \
|
||||||
|
" fogZ = 1.0 - exp2(-8.0 * temp * temp);\n" \
|
||||||
|
" break;\n" \
|
||||||
|
" case 6:\n" \
|
||||||
|
" fogZ = exp2(-8.0 * (fog.start + vtf.mvPos.z) * fog.rangeScale);\n" \
|
||||||
|
" break;\n" \
|
||||||
|
" case 7:\n" \
|
||||||
|
" temp = (fog.start + vtf.mvPos.z) * fog.rangeScale;\n" \
|
||||||
|
" fogZ = exp2(-8.0 * temp * temp);\n" \
|
||||||
|
" break;\n" \
|
||||||
|
" default:\n" \
|
||||||
|
" fogZ = 0.0;\n" \
|
||||||
|
" break;\n" \
|
||||||
|
" }\n" \
|
||||||
|
"#ifdef BLEND_DST_ONE\n" \
|
||||||
|
" return vec4(mix(colorIn, vec4(0.0), clamp(fogZ, 0.0, 1.0)).rgb, colorIn.a);\n" \
|
||||||
|
"#else\n" \
|
||||||
|
" return vec4(mix(colorIn, fog.color, clamp(fogZ, 0.0, 1.0)).rgb, colorIn.a);\n" \
|
||||||
|
"#endif\n"
|
||||||
|
|
||||||
static std::string_view LightingGLSL =
|
static std::string_view LightingGLSL =
|
||||||
"struct Light\n"
|
"struct Light\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
|
@ -17,13 +57,7 @@ static std::string_view LightingGLSL =
|
||||||
" vec4 linAtt;\n"
|
" vec4 linAtt;\n"
|
||||||
" vec4 angAtt;\n"
|
" vec4 angAtt;\n"
|
||||||
"};\n"
|
"};\n"
|
||||||
"struct Fog\n"
|
FOG_STRUCT_GLSL
|
||||||
"{\n"
|
|
||||||
" int mode;\n"
|
|
||||||
" vec4 color;\n"
|
|
||||||
" float rangeScale;\n"
|
|
||||||
" float start;\n"
|
|
||||||
"};\n"
|
|
||||||
"\n"
|
"\n"
|
||||||
"UBINDING2 uniform LightingUniform\n"
|
"UBINDING2 uniform LightingUniform\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
|
@ -124,35 +158,7 @@ static std::string_view LightingShadowGLSL =
|
||||||
static std::string_view MainPostGLSL =
|
static std::string_view MainPostGLSL =
|
||||||
"vec4 MainPostFunc(vec4 colorIn)\n"
|
"vec4 MainPostFunc(vec4 colorIn)\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" float fogZ, temp;\n"
|
FOG_ALGORITHM_GLSL
|
||||||
" switch (fog.mode)\n"
|
|
||||||
" {\n"
|
|
||||||
" case 2:\n"
|
|
||||||
" fogZ = (-vtf.mvPos.z - fog.start) * fog.rangeScale;\n"
|
|
||||||
" break;\n"
|
|
||||||
" case 4:\n"
|
|
||||||
" fogZ = 1.0 - exp2(-8.0 * (-vtf.mvPos.z - fog.start) * fog.rangeScale);\n"
|
|
||||||
" break;\n"
|
|
||||||
" case 5:\n"
|
|
||||||
" temp = (-vtf.mvPos.z - fog.start) * fog.rangeScale;\n"
|
|
||||||
" fogZ = 1.0 - exp2(-8.0 * temp * temp);\n"
|
|
||||||
" break;\n"
|
|
||||||
" case 6:\n"
|
|
||||||
" fogZ = exp2(-8.0 * (fog.start + vtf.mvPos.z) * fog.rangeScale);\n"
|
|
||||||
" break;\n"
|
|
||||||
" case 7:\n"
|
|
||||||
" temp = (fog.start + vtf.mvPos.z) * fog.rangeScale;\n"
|
|
||||||
" fogZ = exp2(-8.0 * temp * temp);\n"
|
|
||||||
" break;\n"
|
|
||||||
" default:\n"
|
|
||||||
" fogZ = 0.0;\n"
|
|
||||||
" break;\n"
|
|
||||||
" }\n"
|
|
||||||
"#ifdef BLEND_DST_ONE\n"
|
|
||||||
" return vec4(mix(colorIn, vec4(0.0), clamp(fogZ, 0.0, 1.0)).rgb, colorIn.a);\n"
|
|
||||||
"#else\n"
|
|
||||||
" return vec4(mix(colorIn, fog.color, clamp(fogZ, 0.0, 1.0)).rgb, colorIn.a);\n"
|
|
||||||
"#endif\n"
|
|
||||||
"}\n"
|
"}\n"
|
||||||
"\n"sv;
|
"\n"sv;
|
||||||
|
|
||||||
|
@ -197,6 +203,23 @@ static std::string_view MBShadowPostGLSL =
|
||||||
"}\n"
|
"}\n"
|
||||||
"\n"sv;
|
"\n"sv;
|
||||||
|
|
||||||
|
static std::string_view DisintegratePostGLSL =
|
||||||
|
FOG_STRUCT_GLSL
|
||||||
|
"UBINDING2 uniform DisintegrateUniform\n"
|
||||||
|
"{\n"
|
||||||
|
" vec4 addColor;\n"
|
||||||
|
" Fog fog;\n"
|
||||||
|
"};\n"
|
||||||
|
"vec4 DisintegratePostFunc(vec4 colorIn)\n"
|
||||||
|
"{\n"
|
||||||
|
" vec4 texel0 = texture(extTex7, vtf.extTcgs[0]);\n"
|
||||||
|
" vec4 texel1 = texture(extTex7, vtf.extTcgs[1]);\n"
|
||||||
|
" colorIn = mix(vec4(0.0), texel1, texel0);\n"
|
||||||
|
" colorIn.rgb += addColor.rgb;\n"
|
||||||
|
FOG_ALGORITHM_GLSL
|
||||||
|
"}\n"
|
||||||
|
"\n"sv;
|
||||||
|
|
||||||
const hecl::Backend::Function ExtensionLightingFuncsGLSL[] =
|
const hecl::Backend::Function ExtensionLightingFuncsGLSL[] =
|
||||||
{
|
{
|
||||||
{},
|
{},
|
||||||
|
@ -218,7 +241,8 @@ const hecl::Backend::Function ExtensionLightingFuncsGLSL[] =
|
||||||
{LightingGLSL, "LightingFunc"},
|
{LightingGLSL, "LightingFunc"},
|
||||||
{LightingGLSL, "LightingFunc"},
|
{LightingGLSL, "LightingFunc"},
|
||||||
{LightingGLSL, "LightingFunc"},
|
{LightingGLSL, "LightingFunc"},
|
||||||
{LightingGLSL, "LightingFunc"}
|
{LightingGLSL, "LightingFunc"},
|
||||||
|
{},
|
||||||
};
|
};
|
||||||
|
|
||||||
const hecl::Backend::Function ExtensionPostFuncsGLSL[] =
|
const hecl::Backend::Function ExtensionPostFuncsGLSL[] =
|
||||||
|
@ -243,6 +267,7 @@ const hecl::Backend::Function ExtensionPostFuncsGLSL[] =
|
||||||
{MainPostGLSL, "MainPostFunc"},
|
{MainPostGLSL, "MainPostFunc"},
|
||||||
{MainPostGLSL, "MainPostFunc"},
|
{MainPostGLSL, "MainPostFunc"},
|
||||||
{MainPostGLSL, "MainPostFunc"},
|
{MainPostGLSL, "MainPostFunc"},
|
||||||
|
{DisintegratePostGLSL, "DisintegratePostFunc"},
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -162,17 +162,16 @@ CElementGen::CElementGen(const TToken<CGenDescription>& gen,
|
||||||
else
|
else
|
||||||
x268_PSLT = INT_MAX;
|
x268_PSLT = INT_MAX;
|
||||||
|
|
||||||
int useMAXP = 256;
|
|
||||||
if (CIntElement* maxpElem = desc->x28_x1c_MAXP.get())
|
if (CIntElement* maxpElem = desc->x28_x1c_MAXP.get())
|
||||||
{
|
{
|
||||||
maxpElem->GetValue(x74_curFrame, x90_MAXP);
|
maxpElem->GetValue(x74_curFrame, x90_MAXP);
|
||||||
useMAXP = maxpElem->GetMaxValue();
|
m_maxMAXP = maxpElem->GetMaxValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
useMAXP = std::min(useMAXP, 256);
|
m_maxMAXP = std::min(m_maxMAXP, 256);
|
||||||
x30_particles.reserve(useMAXP);
|
x30_particles.reserve(m_maxMAXP);
|
||||||
if (x2c_orientType == EModelOrientationType::One)
|
if (x2c_orientType == EModelOrientationType::One)
|
||||||
x50_parentMatrices.resize(useMAXP);
|
x50_parentMatrices.resize(m_maxMAXP);
|
||||||
|
|
||||||
x26c_31_LINE = desc->x44_24_x30_24_LINE;
|
x26c_31_LINE = desc->x44_24_x30_24_LINE;
|
||||||
x26d_24_FXLL = desc->x44_25_x30_25_FXLL;
|
x26d_24_FXLL = desc->x44_25_x30_25_FXLL;
|
||||||
|
@ -224,7 +223,7 @@ CElementGen::CElementGen(const TToken<CGenDescription>& gen,
|
||||||
boo::ObjToken<boo::ITexture> tex;
|
boo::ObjToken<boo::ITexture> tex;
|
||||||
if (texr)
|
if (texr)
|
||||||
tex = texr->GetValueTexture(0).GetObj()->GetBooTexture();
|
tex = texr->GetValueTexture(0).GetObj()->GetBooTexture();
|
||||||
int maxVerts = (x90_MAXP == 0 ? 256 : x90_MAXP);
|
int maxVerts = (m_maxMAXP == 0 ? 256 : m_maxMAXP);
|
||||||
m_lineRenderer.reset(new CLineRenderer(CLineRenderer::EPrimitiveMode::Lines,
|
m_lineRenderer.reset(new CLineRenderer(CLineRenderer::EPrimitiveMode::Lines,
|
||||||
maxVerts * 2, tex, x26c_26_AAPH, x26c_28_zTest));
|
maxVerts * 2, tex, x26c_26_AAPH, x26c_28_zTest));
|
||||||
}
|
}
|
||||||
|
@ -233,7 +232,7 @@ CElementGen::CElementGen(const TToken<CGenDescription>& gen,
|
||||||
m_shaderClass = CElementGenShaders::GetShaderClass(*this);
|
m_shaderClass = CElementGenShaders::GetShaderClass(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t maxInsts = x26c_30_MBLR ? (m_maxMBSP * useMAXP) : useMAXP;
|
size_t maxInsts = x26c_30_MBLR ? (m_maxMBSP * m_maxMAXP) : m_maxMAXP;
|
||||||
maxInsts = (maxInsts == 0 ? 256 : maxInsts);
|
maxInsts = (maxInsts == 0 ? 256 : maxInsts);
|
||||||
|
|
||||||
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx)
|
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx)
|
||||||
|
@ -546,7 +545,7 @@ void CElementGen::CreateNewParticles(int count)
|
||||||
CGlobalRandom gr(x27c_randState);
|
CGlobalRandom gr(x27c_randState);
|
||||||
x30_particles.reserve(x90_MAXP);
|
x30_particles.reserve(x90_MAXP);
|
||||||
if (x26d_28_enableADV && x60_advValues.empty())
|
if (x26d_28_enableADV && x60_advValues.empty())
|
||||||
x60_advValues.resize(x90_MAXP);
|
x60_advValues.resize(m_maxMAXP);
|
||||||
|
|
||||||
CParticleGlobals::g_particleAccessParameters = nullptr;
|
CParticleGlobals::g_particleAccessParameters = nullptr;
|
||||||
|
|
||||||
|
|
|
@ -77,6 +77,7 @@ private:
|
||||||
bool x88_particleEmission = true;
|
bool x88_particleEmission = true;
|
||||||
float x8c_generatorRemainder = 0.f;
|
float x8c_generatorRemainder = 0.f;
|
||||||
int x90_MAXP = 0;
|
int x90_MAXP = 0;
|
||||||
|
int m_maxMAXP = 256;
|
||||||
u16 x94_randomSeed = 99;
|
u16 x94_randomSeed = 99;
|
||||||
float x98_generatorRate = 1.f;
|
float x98_generatorRate = 1.f;
|
||||||
float x9c_cextValues[16] = {};
|
float x9c_cextValues[16] = {};
|
||||||
|
|
|
@ -347,10 +347,10 @@ static bool IsMediumOrLarge(CActor& act)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CActorModelParticles::PlayFireSFX(CActor& act)
|
void CActorModelParticles::StartBurnDeath(CActor& act)
|
||||||
{
|
{
|
||||||
auto iter = FindOrCreateSystem(act);
|
auto iter = FindOrCreateSystem(act);
|
||||||
u16 sfx = SFXeff_x_smallfire_lp_00 + u16(IsMediumOrLarge(act));
|
u16 sfx = SFXeff_x_smallburndeath_lp_00 - s16(IsMediumOrLarge(act));
|
||||||
CSfxManager::AddEmitter(sfx, act.GetTranslation(), zeus::CVector3f::skZero, true, false, 0x7f, kInvalidAreaId);
|
CSfxManager::AddEmitter(sfx, act.GetTranslation(), zeus::CVector3f::skZero, true, false, 0x7f, kInvalidAreaId);
|
||||||
iter->xdc_ashy.Lock();
|
iter->xdc_ashy.Lock();
|
||||||
}
|
}
|
||||||
|
@ -377,8 +377,19 @@ void CActorModelParticles::LightDudeOnFire(CActor& act)
|
||||||
{
|
{
|
||||||
auto iter = FindOrCreateSystem(act);
|
auto iter = FindOrCreateSystem(act);
|
||||||
iter->EnsureLoaded(EDependency::OnFire);
|
iter->EnsureLoaded(EDependency::OnFire);
|
||||||
if (iter->x6c_ <= 0.f)
|
if (iter->x6c_onFireDelayTimer <= 0.f)
|
||||||
iter->x70_ = true;
|
iter->x70_onFire = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
const CTexture* CActorModelParticles::GetAshyTexture(const CActor& act)
|
||||||
|
{
|
||||||
|
auto iter = FindSystem(act.GetUniqueId());
|
||||||
|
if (iter != x0_items.cend() && iter->xdc_ashy && iter->xdc_ashy.IsLoaded())
|
||||||
|
{
|
||||||
|
iter->xdc_ashy->GetBooTexture()->setClampMode(boo::TextureClampMode::ClampToEdge);
|
||||||
|
return iter->xdc_ashy.GetObj();
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CActorModelParticles::AddRainSplashGenerator(CActor& act, CStateManager& mgr, u32 maxSplashes,
|
void CActorModelParticles::AddRainSplashGenerator(CActor& act, CStateManager& mgr, u32 maxSplashes,
|
||||||
|
|
|
@ -37,8 +37,8 @@ public:
|
||||||
TUniqueId x0_id;
|
TUniqueId x0_id;
|
||||||
TAreaId x4_areaId;
|
TAreaId x4_areaId;
|
||||||
rstl::reserved_vector<std::pair<std::unique_ptr<CElementGen>, u32>, 8> x8_thermalHotParticles;
|
rstl::reserved_vector<std::pair<std::unique_ptr<CElementGen>, u32>, 8> x8_thermalHotParticles;
|
||||||
float x6c_ = 0.f;
|
float x6c_onFireDelayTimer = 0.f;
|
||||||
bool x70_ = false;
|
bool x70_onFire = false;
|
||||||
CSfxHandle x74_sfx;
|
CSfxHandle x74_sfx;
|
||||||
std::unique_ptr<CElementGen> x78_;
|
std::unique_ptr<CElementGen> x78_;
|
||||||
u32 x80_ = 0;
|
u32 x80_ = 0;
|
||||||
|
@ -153,11 +153,12 @@ public:
|
||||||
void StartElectric(CActor& act);
|
void StartElectric(CActor& act);
|
||||||
void StopElectric(CActor& act);
|
void StopElectric(CActor& act);
|
||||||
void StopThermalHotParticles(CActor& act);
|
void StopThermalHotParticles(CActor& act);
|
||||||
void PlayFireSFX(CActor& act);
|
void StartBurnDeath(CActor& act);
|
||||||
void EnsureElectricLoaded(CActor& act);
|
void EnsureElectricLoaded(CActor& act);
|
||||||
void EnsureFirePopLoaded(CActor& act);
|
void EnsureFirePopLoaded(CActor& act);
|
||||||
void EnsureIceBreakLoaded(CActor& act);
|
void EnsureIceBreakLoaded(CActor& act);
|
||||||
void LightDudeOnFire(CActor& act);
|
void LightDudeOnFire(CActor& act);
|
||||||
|
const CTexture* GetAshyTexture(const CActor& act);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -199,19 +199,19 @@ static const CKnockBackController::KnockBackParms KnockBackParmsTable[3][19][4]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
{EKnockBackAnimationState::KnockBack, EKnockBackAnimationFollowUp::Burn, 6.000000f, -1.000000f},
|
{EKnockBackAnimationState::KnockBack, EKnockBackAnimationFollowUp::Burn, 6.000000f, -1.000000f},
|
||||||
{EKnockBackAnimationState::Fall, EKnockBackAnimationFollowUp::FireDeath, 6.000000f, -1.000000f},
|
{EKnockBackAnimationState::Fall, EKnockBackAnimationFollowUp::BurnDeath, 6.000000f, -1.000000f},
|
||||||
{EKnockBackAnimationState::KnockBack, EKnockBackAnimationFollowUp::Burn, 6.000000f, 0.000000f},
|
{EKnockBackAnimationState::KnockBack, EKnockBackAnimationFollowUp::Burn, 6.000000f, 0.000000f},
|
||||||
{EKnockBackAnimationState::Fall, EKnockBackAnimationFollowUp::IceDeath, 0.000000f, -1.000000f},
|
{EKnockBackAnimationState::Fall, EKnockBackAnimationFollowUp::IceDeath, 0.000000f, -1.000000f},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
{EKnockBackAnimationState::KnockBack, EKnockBackAnimationFollowUp::FireDeath, 6.000000f, -1.000000f},
|
{EKnockBackAnimationState::KnockBack, EKnockBackAnimationFollowUp::BurnDeath, 6.000000f, -1.000000f},
|
||||||
{EKnockBackAnimationState::Fall, EKnockBackAnimationFollowUp::FireDeath, 6.000000f, -1.000000f},
|
{EKnockBackAnimationState::Fall, EKnockBackAnimationFollowUp::BurnDeath, 6.000000f, -1.000000f},
|
||||||
{EKnockBackAnimationState::KnockBack, EKnockBackAnimationFollowUp::Burn, 6.000000f, 0.000000f},
|
{EKnockBackAnimationState::KnockBack, EKnockBackAnimationFollowUp::Burn, 6.000000f, 0.000000f},
|
||||||
{EKnockBackAnimationState::Fall, EKnockBackAnimationFollowUp::IceDeath, 0.000000f, -1.000000f},
|
{EKnockBackAnimationState::Fall, EKnockBackAnimationFollowUp::IceDeath, 0.000000f, -1.000000f},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
{EKnockBackAnimationState::None, EKnockBackAnimationFollowUp::Burn, 6.000000f, -1.000000f},
|
{EKnockBackAnimationState::None, EKnockBackAnimationFollowUp::Burn, 6.000000f, -1.000000f},
|
||||||
{EKnockBackAnimationState::Fall, EKnockBackAnimationFollowUp::FireDeath, 0.000000f, -1.000000f},
|
{EKnockBackAnimationState::Fall, EKnockBackAnimationFollowUp::BurnDeath, 0.000000f, -1.000000f},
|
||||||
{EKnockBackAnimationState::KnockBack, EKnockBackAnimationFollowUp::Burn, 6.000000f, 0.000000f},
|
{EKnockBackAnimationState::KnockBack, EKnockBackAnimationFollowUp::Burn, 6.000000f, 0.000000f},
|
||||||
{EKnockBackAnimationState::Fall, EKnockBackAnimationFollowUp::IceDeath, 0.000000f, -1.000000f},
|
{EKnockBackAnimationState::Fall, EKnockBackAnimationFollowUp::IceDeath, 0.000000f, -1.000000f},
|
||||||
},
|
},
|
||||||
|
@ -228,8 +228,8 @@ static const CKnockBackController::KnockBackParms KnockBackParmsTable[3][19][4]
|
||||||
{EKnockBackAnimationState::Fall, EKnockBackAnimationFollowUp::IceDeath, 0.000000f, -1.000000f},
|
{EKnockBackAnimationState::Fall, EKnockBackAnimationFollowUp::IceDeath, 0.000000f, -1.000000f},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
{EKnockBackAnimationState::Hurled, EKnockBackAnimationFollowUp::Disintegrate, 0.000000f, -1.000000f},
|
{EKnockBackAnimationState::Hurled, EKnockBackAnimationFollowUp::LaggedBurnDeath, 0.000000f, -1.000000f},
|
||||||
{EKnockBackAnimationState::Fall, EKnockBackAnimationFollowUp::Disintegrate, 0.000000f, -1.000000f},
|
{EKnockBackAnimationState::Fall, EKnockBackAnimationFollowUp::LaggedBurnDeath, 0.000000f, -1.000000f},
|
||||||
{EKnockBackAnimationState::Hurled, EKnockBackAnimationFollowUp::IceDeath, 0.000000f, -1.000000f},
|
{EKnockBackAnimationState::Hurled, EKnockBackAnimationFollowUp::IceDeath, 0.000000f, -1.000000f},
|
||||||
{EKnockBackAnimationState::Fall, EKnockBackAnimationFollowUp::IceDeath, 0.000000f, -1.000000f},
|
{EKnockBackAnimationState::Fall, EKnockBackAnimationFollowUp::IceDeath, 0.000000f, -1.000000f},
|
||||||
},
|
},
|
||||||
|
@ -327,7 +327,7 @@ static const CKnockBackController::KnockBackParms KnockBackParmsTable[3][19][4]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
{EKnockBackAnimationState::None, EKnockBackAnimationFollowUp::Burn, 6.000000f, -1.000000f},
|
{EKnockBackAnimationState::None, EKnockBackAnimationFollowUp::Burn, 6.000000f, -1.000000f},
|
||||||
{EKnockBackAnimationState::Fall, EKnockBackAnimationFollowUp::FireDeath, 0.000000f, -1.000000f},
|
{EKnockBackAnimationState::Fall, EKnockBackAnimationFollowUp::BurnDeath, 0.000000f, -1.000000f},
|
||||||
{EKnockBackAnimationState::KnockBack, EKnockBackAnimationFollowUp::Burn, 6.000000f, 0.000000f},
|
{EKnockBackAnimationState::KnockBack, EKnockBackAnimationFollowUp::Burn, 6.000000f, 0.000000f},
|
||||||
{EKnockBackAnimationState::Fall, EKnockBackAnimationFollowUp::IceDeath, 0.000000f, -1.000000f},
|
{EKnockBackAnimationState::Fall, EKnockBackAnimationFollowUp::IceDeath, 0.000000f, -1.000000f},
|
||||||
},
|
},
|
||||||
|
@ -344,8 +344,8 @@ static const CKnockBackController::KnockBackParms KnockBackParmsTable[3][19][4]
|
||||||
{EKnockBackAnimationState::Fall, EKnockBackAnimationFollowUp::IceDeath, 0.000000f, -1.000000f},
|
{EKnockBackAnimationState::Fall, EKnockBackAnimationFollowUp::IceDeath, 0.000000f, -1.000000f},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
{EKnockBackAnimationState::Hurled, EKnockBackAnimationFollowUp::Disintegrate, 0.000000f, -1.000000f},
|
{EKnockBackAnimationState::Hurled, EKnockBackAnimationFollowUp::LaggedBurnDeath, 0.000000f, -1.000000f},
|
||||||
{EKnockBackAnimationState::Hurled, EKnockBackAnimationFollowUp::Disintegrate, 0.000000f, -1.000000f},
|
{EKnockBackAnimationState::Hurled, EKnockBackAnimationFollowUp::LaggedBurnDeath, 0.000000f, -1.000000f},
|
||||||
{EKnockBackAnimationState::Hurled, EKnockBackAnimationFollowUp::IceDeath, 0.000000f, -1.000000f},
|
{EKnockBackAnimationState::Hurled, EKnockBackAnimationFollowUp::IceDeath, 0.000000f, -1.000000f},
|
||||||
{EKnockBackAnimationState::Fall, EKnockBackAnimationFollowUp::IceDeath, 0.000000f, -1.000000f},
|
{EKnockBackAnimationState::Fall, EKnockBackAnimationFollowUp::IceDeath, 0.000000f, -1.000000f},
|
||||||
},
|
},
|
||||||
|
@ -364,9 +364,9 @@ CKnockBackController::CKnockBackController(EKnockBackVariant variant)
|
||||||
x81_24_autoResetImpulse = true;
|
x81_24_autoResetImpulse = true;
|
||||||
x81_25_enableFreeze = true;
|
x81_25_enableFreeze = true;
|
||||||
x81_27_enableBurn = true;
|
x81_27_enableBurn = true;
|
||||||
x81_28_enableFireDeath = true;
|
x81_28_enableBurnDeath = true;
|
||||||
x81_29_enableExplodeDeath = true;
|
x81_29_enableExplodeDeath = true;
|
||||||
x81_30_enableDisintegrate = true;
|
x81_30_enableLaggedBurnDeath = true;
|
||||||
x81_31_ = true;
|
x81_31_ = true;
|
||||||
x82_24_ = true;
|
x82_24_ = true;
|
||||||
for (int i = 0; i < 4; ++i)
|
for (int i = 0; i < 4; ++i)
|
||||||
|
@ -472,11 +472,11 @@ void CKnockBackController::ValidateState(CPatterned& parent)
|
||||||
case EKnockBackAnimationFollowUp::IceDeath:
|
case EKnockBackAnimationFollowUp::IceDeath:
|
||||||
disableFollowup = !x81_29_enableExplodeDeath;
|
disableFollowup = !x81_29_enableExplodeDeath;
|
||||||
break;
|
break;
|
||||||
case EKnockBackAnimationFollowUp::FireDeath:
|
case EKnockBackAnimationFollowUp::BurnDeath:
|
||||||
disableFollowup = !x81_28_enableFireDeath;
|
disableFollowup = !x81_28_enableBurnDeath;
|
||||||
break;
|
break;
|
||||||
case EKnockBackAnimationFollowUp::Disintegrate:
|
case EKnockBackAnimationFollowUp::LaggedBurnDeath:
|
||||||
disableFollowup = !x81_30_enableDisintegrate;
|
disableFollowup = !x81_30_enableLaggedBurnDeath;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -75,8 +75,8 @@ enum class EKnockBackAnimationFollowUp
|
||||||
Death,
|
Death,
|
||||||
ExplodeDeath,
|
ExplodeDeath,
|
||||||
IceDeath,
|
IceDeath,
|
||||||
FireDeath,
|
BurnDeath,
|
||||||
Disintegrate
|
LaggedBurnDeath
|
||||||
};
|
};
|
||||||
|
|
||||||
class CKnockBackController
|
class CKnockBackController
|
||||||
|
@ -116,9 +116,9 @@ private:
|
||||||
bool x81_25_enableFreeze : 1; // t
|
bool x81_25_enableFreeze : 1; // t
|
||||||
bool x81_26_enableShock : 1;
|
bool x81_26_enableShock : 1;
|
||||||
bool x81_27_enableBurn : 1; // t
|
bool x81_27_enableBurn : 1; // t
|
||||||
bool x81_28_enableFireDeath : 1; // t
|
bool x81_28_enableBurnDeath : 1; // t
|
||||||
bool x81_29_enableExplodeDeath : 1; // t
|
bool x81_29_enableExplodeDeath : 1; // t
|
||||||
bool x81_30_enableDisintegrate : 1; // t
|
bool x81_30_enableLaggedBurnDeath : 1; // t
|
||||||
bool x81_31_ : 1; // t
|
bool x81_31_ : 1; // t
|
||||||
bool x82_24_ : 1; // t
|
bool x82_24_ : 1; // t
|
||||||
bool x82_25_inDeferredKnockBack : 1;
|
bool x82_25_inDeferredKnockBack : 1;
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#include "MP1/World/CSpacePirate.hpp"
|
#include "MP1/World/CSpacePirate.hpp"
|
||||||
#include "World/CStateMachine.hpp"
|
#include "World/CStateMachine.hpp"
|
||||||
#include "CExplosion.hpp"
|
#include "CExplosion.hpp"
|
||||||
|
#include "Graphics/CSkinnedModel.hpp"
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
|
@ -249,7 +250,7 @@ void CPatterned::Think(float dt, CStateManager& mgr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub8007a68c(dt, mgr);
|
UpdateAlpha(dt, mgr);
|
||||||
|
|
||||||
x3e4_ = HealthInfo(mgr)->GetHP();
|
x3e4_ = HealthInfo(mgr)->GetHP();
|
||||||
if (!x330_stateMachineState.x4_state)
|
if (!x330_stateMachineState.x4_state)
|
||||||
|
@ -305,8 +306,8 @@ void CPatterned::Think(float dt, CStateManager& mgr)
|
||||||
//if (x450_bodyController->IsFrozen())
|
//if (x450_bodyController->IsFrozen())
|
||||||
//mgr.GetActorModelParticles()->sub801e5044(*this);
|
//mgr.GetActorModelParticles()->sub801e5044(*this);
|
||||||
|
|
||||||
if (!x401_27_ || x401_28_)
|
if (!x401_27_ || x401_28_burning)
|
||||||
x3e8_ = -0.33333334f;
|
x3e8_alphaRate = -0.33333334f;
|
||||||
|
|
||||||
if (x401_30_)
|
if (x401_30_)
|
||||||
{
|
{
|
||||||
|
@ -314,7 +315,7 @@ void CPatterned::Think(float dt, CStateManager& mgr)
|
||||||
Death(mgr, GetTransform().frontVector(), EScriptObjectState::DeathRattle);
|
Death(mgr, GetTransform().frontVector(), EScriptObjectState::DeathRattle);
|
||||||
}
|
}
|
||||||
|
|
||||||
float thinkDt = (x400_25_alive ? dt : dt * sub80078a88());
|
float thinkDt = (x400_25_alive ? dt : dt * CalcDyingThinkRate());
|
||||||
|
|
||||||
x450_bodyController->Update(thinkDt, mgr);
|
x450_bodyController->Update(thinkDt, mgr);
|
||||||
x450_bodyController->MultiplyPlaybackRate(x3b4_speed);
|
x450_bodyController->MultiplyPlaybackRate(x3b4_speed);
|
||||||
|
@ -334,8 +335,8 @@ void CPatterned::Think(float dt, CStateManager& mgr)
|
||||||
if (x420_curDamageTime > 0.f)
|
if (x420_curDamageTime > 0.f)
|
||||||
x420_curDamageTime -= dt;
|
x420_curDamageTime -= dt;
|
||||||
|
|
||||||
if (x401_28_ && x3f4_ > dt)
|
if (x401_28_burning && x3f4_burnThinkRateTimer > dt)
|
||||||
x3f4_ -= dt;
|
x3f4_burnThinkRateTimer -= dt;
|
||||||
|
|
||||||
xd0_thermalMag = x50c_thermalMag;
|
xd0_thermalMag = x50c_thermalMag;
|
||||||
sub8007a5b8(dt);
|
sub8007a5b8(dt);
|
||||||
|
@ -424,7 +425,7 @@ void CPatterned::KnockBack(const zeus::CVector3f& backVec, CStateManager& mgr, c
|
||||||
EKnockBackType type, bool inDeferred, float magnitude)
|
EKnockBackType type, bool inDeferred, float magnitude)
|
||||||
{
|
{
|
||||||
CHealthInfo* hInfo = HealthInfo(mgr);
|
CHealthInfo* hInfo = HealthInfo(mgr);
|
||||||
if (!x401_27_ && !x401_28_ && hInfo)
|
if (!x401_27_ && !x401_28_burning && hInfo)
|
||||||
{
|
{
|
||||||
x460_knockBackController.KnockBack(backVec, mgr, *this, info, type, magnitude);
|
x460_knockBackController.KnockBack(backVec, mgr, *this, info, type, magnitude);
|
||||||
if (x450_bodyController->IsFrozen() && x460_knockBackController.GetActiveParms().xc_ >= 0.f)
|
if (x450_bodyController->IsFrozen() && x460_knockBackController.GetActiveParms().xc_ >= 0.f)
|
||||||
|
@ -444,19 +445,19 @@ void CPatterned::KnockBack(const zeus::CVector3f& backVec, CStateManager& mgr, c
|
||||||
case EKnockBackAnimationFollowUp::Burn:
|
case EKnockBackAnimationFollowUp::Burn:
|
||||||
Burn(x460_knockBackController.GetActiveParms().x8_followupMagnitude, 0.25f);
|
Burn(x460_knockBackController.GetActiveParms().x8_followupMagnitude, 0.25f);
|
||||||
break;
|
break;
|
||||||
case EKnockBackAnimationFollowUp::Disintegrate:
|
case EKnockBackAnimationFollowUp::LaggedBurnDeath:
|
||||||
x401_29_ = true;
|
x401_29_laggedBurnDeath = true;
|
||||||
case EKnockBackAnimationFollowUp::FireDeath:
|
case EKnockBackAnimationFollowUp::BurnDeath:
|
||||||
Burn(x460_knockBackController.GetActiveParms().x8_followupMagnitude, -1.f);
|
Burn(x460_knockBackController.GetActiveParms().x8_followupMagnitude, -1.f);
|
||||||
Death(mgr, zeus::CVector3f::skZero, EScriptObjectState::DeathRattle);
|
Death(mgr, zeus::CVector3f::skZero, EScriptObjectState::DeathRattle);
|
||||||
x400_28_ = x400_29_ = false;
|
x400_28_ = x400_29_ = false;
|
||||||
x400_27_ = x401_28_ = true;
|
x400_27_deleteWhenDoneBurning = x401_28_burning = true;
|
||||||
x3f4_ = 1.5f;
|
x3f4_burnThinkRateTimer = 1.5f;
|
||||||
x402_29_ = false;
|
x402_29_ = false;
|
||||||
x450_bodyController->DouseFlames();
|
x450_bodyController->DouseFlames();
|
||||||
mgr.GetActorModelParticles()->StopThermalHotParticles(*this);
|
mgr.GetActorModelParticles()->StopThermalHotParticles(*this);
|
||||||
mgr.GetActorModelParticles()->PlayFireSFX(*this);
|
mgr.GetActorModelParticles()->StartBurnDeath(*this);
|
||||||
if (!x401_29_)
|
if (!x401_29_laggedBurnDeath)
|
||||||
{
|
{
|
||||||
mgr.GetActorModelParticles()->EnsureFirePopLoaded(*this);
|
mgr.GetActorModelParticles()->EnsureFirePopLoaded(*this);
|
||||||
mgr.GetActorModelParticles()->EnsureIceBreakLoaded(*this);
|
mgr.GetActorModelParticles()->EnsureIceBreakLoaded(*this);
|
||||||
|
@ -522,7 +523,7 @@ void CPatterned::DoDeath(CStateManager& mgr)
|
||||||
{
|
{
|
||||||
CSfxManager::AddEmitter(x454_deathSfx, GetTranslation(), zeus::CVector3f::skZero,
|
CSfxManager::AddEmitter(x454_deathSfx, GetTranslation(), zeus::CVector3f::skZero,
|
||||||
true, false, 0x7f, kInvalidAreaId);
|
true, false, 0x7f, kInvalidAreaId);
|
||||||
if (!x401_28_)
|
if (!x401_28_burning)
|
||||||
{
|
{
|
||||||
SendScriptMsgs(EScriptObjectState::DeathExplosion, mgr, EScriptObjectMessage::None);
|
SendScriptMsgs(EScriptObjectState::DeathExplosion, mgr, EScriptObjectMessage::None);
|
||||||
GenerateDeathExplosion(mgr);
|
GenerateDeathExplosion(mgr);
|
||||||
|
@ -579,15 +580,37 @@ void CPatterned::SetupPlayerCollision(bool v)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float CPatterned::sub80078a88()
|
void CPatterned::UpdateAlpha(float dt, CStateManager& mgr)
|
||||||
{
|
{
|
||||||
float f0 = (x401_28_ ? x3f4_ / 1.f : 1.f);
|
if (x3e8_alphaRate == 0.f)
|
||||||
|
return;
|
||||||
|
|
||||||
|
float alpha = dt * x3e8_alphaRate + x42c_color.a;
|
||||||
|
if (alpha > 1.f)
|
||||||
|
{
|
||||||
|
alpha = 1.f;
|
||||||
|
x3e8_alphaRate = 0.f;
|
||||||
|
}
|
||||||
|
else if (alpha < 0.f)
|
||||||
|
{
|
||||||
|
alpha = 0.f;
|
||||||
|
x3e8_alphaRate = 0.f;
|
||||||
|
if (x400_27_deleteWhenDoneBurning)
|
||||||
|
DeathDelete(mgr);
|
||||||
|
}
|
||||||
|
x94_simpleShadow->SetUserAlpha(alpha);
|
||||||
|
x42c_color.a = alpha;
|
||||||
|
x64_modelData->AnimationData()->GetParticleDB().SetModulationColorAllActiveEffects(zeus::CColor(1.f, alpha));
|
||||||
|
}
|
||||||
|
|
||||||
|
float CPatterned::CalcDyingThinkRate()
|
||||||
|
{
|
||||||
|
float f0 = (x401_28_burning ? (x3f4_burnThinkRateTimer / 1.5f) : 1.f);
|
||||||
return zeus::max(0.1f, f0);
|
return zeus::max(0.1f, f0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPatterned::PreRender(CStateManager& mgr, const zeus::CFrustum& frustum)
|
void CPatterned::PreRender(CStateManager& mgr, const zeus::CFrustum& frustum)
|
||||||
{
|
{
|
||||||
#if 1
|
|
||||||
if (mgr.GetPlayerState()->GetActiveVisor(mgr) == CPlayerState::EPlayerVisor::Thermal)
|
if (mgr.GetPlayerState()->GetActiveVisor(mgr) == CPlayerState::EPlayerVisor::Thermal)
|
||||||
{
|
{
|
||||||
SetCalculateLighting(false);
|
SetCalculateLighting(false);
|
||||||
|
@ -596,25 +619,119 @@ void CPatterned::PreRender(CStateManager& mgr, const zeus::CFrustum& frustum)
|
||||||
else
|
else
|
||||||
SetCalculateLighting(true);
|
SetCalculateLighting(true);
|
||||||
|
|
||||||
zeus::CColor col = x42c_;
|
zeus::CColor col = x42c_color;
|
||||||
u8 alpha = GetModelAlphau8(mgr);
|
u8 alpha = GetModelAlphau8(mgr);
|
||||||
if (x402_27_ && mgr.GetPlayerState()->GetActiveVisor(mgr) == CPlayerState::EPlayerVisor::XRay)
|
if (x402_27_ && mgr.GetPlayerState()->GetActiveVisor(mgr) == CPlayerState::EPlayerVisor::XRay)
|
||||||
alpha = 0x4C;
|
alpha = 76;
|
||||||
|
|
||||||
if (alpha < 0xFF)
|
if (alpha < 255)
|
||||||
{
|
{
|
||||||
if (col.r == 0.f && col.g == 0.f && col.b == 0.f)
|
if (col.r == 0.f && col.g == 0.f && col.b == 0.f)
|
||||||
col = zeus::CColor::skWhite;
|
col = zeus::CColor::skWhite;
|
||||||
}
|
|
||||||
|
|
||||||
if (x401_29_ && alpha > 0x7F)
|
if (x401_29_laggedBurnDeath)
|
||||||
|
{
|
||||||
|
int stripedAlpha = 255;
|
||||||
|
if (alpha > 127)
|
||||||
|
stripedAlpha = (alpha - 128) * 2;
|
||||||
|
xb4_drawFlags = CModelFlags(3, 0, 3, zeus::CColor(0.f, (stripedAlpha * stripedAlpha) / 65025.f));
|
||||||
|
}
|
||||||
|
else if (x401_28_burning)
|
||||||
|
{
|
||||||
|
xb4_drawFlags = CModelFlags(5, 0, 3, zeus::CColor(0.f, 1.f));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
zeus::CColor col2 = col;
|
||||||
|
col2.a = alpha / 255.f;
|
||||||
|
xb4_drawFlags = CModelFlags(5, 0, 3, col2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
|
if (col.r != 0.f || col.g != 0.f || col.b != 0.f)
|
||||||
|
{
|
||||||
|
zeus::CColor col2 = col;
|
||||||
|
col2.a = alpha / 255.f;
|
||||||
|
xb4_drawFlags = CModelFlags(2, 0, 3, col2);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
xb4_drawFlags = CModelFlags(0, 0, 3, zeus::CColor::skWhite);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
CActor::PreRender(mgr, frustum);
|
CActor::PreRender(mgr, frustum);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPatterned::RenderIceModelWithFlags(const CModelFlags& flags) const
|
||||||
|
{
|
||||||
|
CModelFlags useFlags = flags;
|
||||||
|
useFlags.x1_matSetIdx = 0;
|
||||||
|
CAnimData* animData = x64_modelData->AnimationData();
|
||||||
|
if (CMorphableSkinnedModel* iceModel = animData->IceModel().GetObj())
|
||||||
|
animData->Render(*iceModel, useFlags, {*x510_vertexMorph}, iceModel->GetMorphMagnitudes());
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPatterned::Render(const CStateManager& mgr) const
|
||||||
|
{
|
||||||
|
int mask = 0;
|
||||||
|
int target = 0;
|
||||||
|
if (x402_29_)
|
||||||
|
{
|
||||||
|
mgr.GetCharacterRenderMaskAndTarget(x402_31_thawed, mask, target);
|
||||||
|
x64_modelData->GetAnimationData()->GetParticleDB().RenderSystemsToBeDrawnFirstMasked(mask, target);
|
||||||
|
}
|
||||||
|
if ((mgr.GetThermalDrawFlag() == EThermalDrawFlag::Cold && !x402_31_thawed) ||
|
||||||
|
(mgr.GetThermalDrawFlag() == EThermalDrawFlag::Hot && x402_31_thawed) ||
|
||||||
|
mgr.GetThermalDrawFlag() == EThermalDrawFlag::Bypass)
|
||||||
|
{
|
||||||
|
if (x401_28_burning)
|
||||||
|
{
|
||||||
|
const CTexture* ashy = mgr.GetActorModelParticles()->GetAshyTexture(*this);
|
||||||
|
u8 alpha = GetModelAlphau8(mgr);
|
||||||
|
if (ashy && ((!x401_29_laggedBurnDeath && alpha <= 255) || alpha <= 127))
|
||||||
|
{
|
||||||
|
if (xe5_31_pointGeneratorParticles)
|
||||||
|
mgr.SetupParticleHook(*this);
|
||||||
|
zeus::CColor addColor;
|
||||||
|
if (x401_29_laggedBurnDeath)
|
||||||
|
{
|
||||||
|
addColor = zeus::CColor::skClear;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
addColor = mgr.GetThermalDrawFlag() == EThermalDrawFlag::Hot ?
|
||||||
|
zeus::CColor::skWhite : zeus::CColor::skBlack;
|
||||||
|
}
|
||||||
|
x64_modelData->DisintegrateDraw(mgr, GetTransform(), *ashy, addColor,
|
||||||
|
alpha * (x401_29_laggedBurnDeath ? 0.00787402f : 0.00392157f));
|
||||||
|
if (xe5_31_pointGeneratorParticles)
|
||||||
|
{
|
||||||
|
CSkinnedModel::ClearPointGeneratorFunc();
|
||||||
|
mgr.GetActorModelParticles()->Render(*this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CPhysicsActor::Render(mgr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CPhysicsActor::Render(mgr);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (x450_bodyController->IsFrozen() && !x401_28_burning)
|
||||||
|
{
|
||||||
|
RenderIceModelWithFlags(CModelFlags(0, 0, 3, zeus::CColor::skWhite));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (x402_29_)
|
||||||
|
{
|
||||||
|
x64_modelData->GetAnimationData()->GetParticleDB().RenderSystemsToBeDrawnLastMasked(mask, target);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPatterned::ThinkAboutMove(float dt)
|
void CPatterned::ThinkAboutMove(float dt)
|
||||||
|
|
|
@ -139,10 +139,10 @@ protected:
|
||||||
float x3dc_;
|
float x3dc_;
|
||||||
float x3e0_;
|
float x3e0_;
|
||||||
float x3e4_ = 0.f;
|
float x3e4_ = 0.f;
|
||||||
float x3e8_ = 0.f;
|
float x3e8_alphaRate = 0.f;
|
||||||
float x3ec_ = 0.f;
|
float x3ec_ = 0.f;
|
||||||
float x3f0_ = 0.f;
|
float x3f0_ = 0.f;
|
||||||
float x3f4_ = 0.f;
|
float x3f4_burnThinkRateTimer = 0.f;
|
||||||
u32 x3f8_ = 0;
|
u32 x3f8_ = 0;
|
||||||
EFlavorType x3fc_flavor;
|
EFlavorType x3fc_flavor;
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ protected:
|
||||||
bool x400_24_ : 1;
|
bool x400_24_ : 1;
|
||||||
bool x400_25_alive : 1; // t
|
bool x400_25_alive : 1; // t
|
||||||
bool x400_26_ : 1;
|
bool x400_26_ : 1;
|
||||||
bool x400_27_ : 1;
|
bool x400_27_deleteWhenDoneBurning : 1;
|
||||||
bool x400_28_ : 1;
|
bool x400_28_ : 1;
|
||||||
bool x400_29_ : 1;
|
bool x400_29_ : 1;
|
||||||
bool x400_30_ : 1;
|
bool x400_30_ : 1;
|
||||||
|
@ -162,8 +162,8 @@ protected:
|
||||||
bool x401_25_ : 1;
|
bool x401_25_ : 1;
|
||||||
bool x401_26_ : 1;
|
bool x401_26_ : 1;
|
||||||
bool x401_27_ : 1;
|
bool x401_27_ : 1;
|
||||||
bool x401_28_ : 1;
|
bool x401_28_burning : 1;
|
||||||
bool x401_29_ : 1;
|
bool x401_29_laggedBurnDeath : 1;
|
||||||
bool x401_30_ : 1;
|
bool x401_30_ : 1;
|
||||||
bool x401_31_ : 1;
|
bool x401_31_ : 1;
|
||||||
bool x402_24_ : 1;
|
bool x402_24_ : 1;
|
||||||
|
@ -185,7 +185,7 @@ protected:
|
||||||
float x420_curDamageTime = 0.f;
|
float x420_curDamageTime = 0.f;
|
||||||
float x424_damageWaitTime;
|
float x424_damageWaitTime;
|
||||||
float x428_ = -1.f;
|
float x428_ = -1.f;
|
||||||
zeus::CColor x42c_ = zeus::CColor::skBlack;
|
zeus::CColor x42c_color = zeus::CColor::skBlack;
|
||||||
zeus::CColor x430_ = skDamageColor;
|
zeus::CColor x430_ = skDamageColor;
|
||||||
zeus::CVector3f x434_posDelta;
|
zeus::CVector3f x434_posDelta;
|
||||||
zeus::CQuaternion x440_rotDelta;
|
zeus::CQuaternion x440_rotDelta;
|
||||||
|
@ -214,6 +214,7 @@ protected:
|
||||||
void UpdateFrozenState(bool thawed);
|
void UpdateFrozenState(bool thawed);
|
||||||
void GenerateIceDeathExplosion(CStateManager& mgr);
|
void GenerateIceDeathExplosion(CStateManager& mgr);
|
||||||
void GenerateDeathExplosion(CStateManager& mgr);
|
void GenerateDeathExplosion(CStateManager& mgr);
|
||||||
|
void RenderIceModelWithFlags(const CModelFlags& flags) const;
|
||||||
public:
|
public:
|
||||||
CPatterned(ECharacter character, TUniqueId uid, std::string_view name, EFlavorType flavor, const CEntityInfo& info,
|
CPatterned(ECharacter character, TUniqueId uid, std::string_view name, EFlavorType flavor, const CEntityInfo& info,
|
||||||
const zeus::CTransform& xf, CModelData&& mData, const CPatternedInfo& pinfo,
|
const zeus::CTransform& xf, CModelData&& mData, const CPatternedInfo& pinfo,
|
||||||
|
@ -225,6 +226,7 @@ public:
|
||||||
void PreThink(float, CStateManager& mgr) { CEntity::Think(x500_, mgr); }
|
void PreThink(float, CStateManager& mgr) { CEntity::Think(x500_, mgr); }
|
||||||
void Think(float, CStateManager&);
|
void Think(float, CStateManager&);
|
||||||
void PreRender(CStateManager&, const zeus::CFrustum&);
|
void PreRender(CStateManager&, const zeus::CFrustum&);
|
||||||
|
void Render(const CStateManager& mgr) const;
|
||||||
|
|
||||||
void Touch(CActor&, CStateManager&);
|
void Touch(CActor&, CStateManager&);
|
||||||
std::experimental::optional<zeus::CAABox> GetTouchBounds() const;
|
std::experimental::optional<zeus::CAABox> GetTouchBounds() const;
|
||||||
|
@ -256,7 +258,7 @@ public:
|
||||||
virtual void ThinkAboutMove(float);
|
virtual void ThinkAboutMove(float);
|
||||||
virtual void GetSearchPath() {}
|
virtual void GetSearchPath() {}
|
||||||
virtual CDamageInfo GetContactDamage() const { return x404_contactDamage; }
|
virtual CDamageInfo GetContactDamage() const { return x404_contactDamage; }
|
||||||
virtual u8 GetModelAlphau8(const CStateManager&) const { return u8(x42c_.a * 255);}
|
virtual u8 GetModelAlphau8(const CStateManager&) const { return u8(x42c_color.a * 255);}
|
||||||
virtual bool IsOnGround() const { return x328_27_onGround; }
|
virtual bool IsOnGround() const { return x328_27_onGround; }
|
||||||
virtual float GetGravityConstant() const { return 24.525002f; }
|
virtual float GetGravityConstant() const { return 24.525002f; }
|
||||||
virtual CProjectileInfo* GetProjectileInfo() { return nullptr; }
|
virtual CProjectileInfo* GetProjectileInfo() { return nullptr; }
|
||||||
|
@ -275,8 +277,8 @@ public:
|
||||||
|
|
||||||
|
|
||||||
void SetDestPos(const zeus::CVector3f& pos) { x2e0_destPos = pos; }
|
void SetDestPos(const zeus::CVector3f& pos) { x2e0_destPos = pos; }
|
||||||
void sub8007a68c(float, CStateManager&) {}
|
void UpdateAlpha(float dt, CStateManager& mgr);
|
||||||
float sub80078a88();
|
float CalcDyingThinkRate();
|
||||||
void sub8007a5b8(float) {}
|
void sub8007a5b8(float) {}
|
||||||
|
|
||||||
bool GetX328_26() const { return x328_26_; }
|
bool GetX328_26() const { return x328_26_; }
|
||||||
|
|
2
hecl
2
hecl
|
@ -1 +1 @@
|
||||||
Subproject commit 75e7dc2e871e4ca41d9691737259455fb337dc15
|
Subproject commit 91a0755d30574217539042b7a6a3c6db08653bcc
|
Loading…
Reference in New Issue