mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-14 17:26:09 +00:00
CGuiFrame & Model fixes; CModel::Draw impl; Document CModelFlags bits
This commit is contained in:
@@ -149,11 +149,13 @@ void CScriptActor::PreRender(CStateManager& mgr, const zeus::CFrustum& frustum)
|
||||
|
||||
if (x2e2_24_noThermalHotZ && xe6_27_thermalVisorFlags == 2) {
|
||||
if (mgr.GetPlayerState()->GetActiveVisor(mgr) == CPlayerState::EPlayerVisor::Thermal) {
|
||||
xb4_drawFlags.x2_flags &= ~3; // Disable Z test/update
|
||||
// xb4_drawFlags.m_noZTest = true;
|
||||
// Disable Z test/update
|
||||
xb4_drawFlags.x2_flags &= CModelFlagBits::DepthTest;
|
||||
xb4_drawFlags.x2_flags &= CModelFlagBits::DepthUpdate;
|
||||
} else {
|
||||
xb4_drawFlags.x2_flags |= 3; // Enable Z test/update
|
||||
// xb4_drawFlags.m_noZTest = false;
|
||||
// Enable Z test/update
|
||||
xb4_drawFlags.x2_flags |= CModelFlagBits::DepthTest;
|
||||
xb4_drawFlags.x2_flags |= CModelFlagBits::DepthUpdate;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -109,83 +109,38 @@ void CScriptColorModulate::Think(float dt, CStateManager& mgr) {
|
||||
}
|
||||
|
||||
CModelFlags CScriptColorModulate::CalculateFlags(const zeus::CColor& col) const {
|
||||
CModelFlags ret;
|
||||
if (x54_28_depthBackwards) {
|
||||
if (x48_blendMode == EBlendMode::Alpha) {
|
||||
ret.x0_blendMode = 5;
|
||||
ret.x1_matSetIdx = 0;
|
||||
ret.x2_flags = x54_26_depthCompare << 0 | x54_27_depthUpdate << 1 | 0x8;
|
||||
ret.x4_color = col;
|
||||
return {5, 0, static_cast<u16>(x54_26_depthCompare << 0 | x54_27_depthUpdate << 1 | 0x8), col};
|
||||
} else if (x48_blendMode == EBlendMode::Additive) {
|
||||
ret.x0_blendMode = 7;
|
||||
ret.x1_matSetIdx = 0;
|
||||
ret.x2_flags = x54_26_depthCompare << 0 | x54_27_depthUpdate << 1 | 0x8;
|
||||
ret.x4_color = col;
|
||||
return {7, 0, static_cast<u16>(x54_26_depthCompare << 0 | x54_27_depthUpdate << 1 | 0x8), col};
|
||||
} else if (x48_blendMode == EBlendMode::Additive2) {
|
||||
ret.x0_blendMode = 8;
|
||||
ret.x1_matSetIdx = 0;
|
||||
ret.x2_flags = x54_26_depthCompare << 0 | x54_27_depthUpdate << 1 | 0x8;
|
||||
ret.x4_color = col;
|
||||
return {8, 0, static_cast<u16>(x54_26_depthCompare << 0 | x54_27_depthUpdate << 1 | 0x8), col};
|
||||
} else if (x48_blendMode == EBlendMode::Opaque) {
|
||||
ret.x0_blendMode = 1;
|
||||
ret.x1_matSetIdx = 0;
|
||||
ret.x2_flags = x54_26_depthCompare << 0 | x54_27_depthUpdate << 1 | 0x8;
|
||||
ret.x4_color = col;
|
||||
return {1, 0, static_cast<u16>(x54_26_depthCompare << 0 | x54_27_depthUpdate << 1 | 0x8), col};
|
||||
} else if (x48_blendMode == EBlendMode::OpaqueAdd) {
|
||||
ret.x0_blendMode = 2;
|
||||
ret.x1_matSetIdx = 0;
|
||||
ret.x2_flags = x54_26_depthCompare << 0 | x54_27_depthUpdate << 1 | 0x8;
|
||||
// ret.addColor = col;
|
||||
} else {
|
||||
ret.x2_flags = 3;
|
||||
ret.x4_color = zeus::skWhite;
|
||||
return {2, 0, static_cast<u16>(x54_26_depthCompare << 0 | x54_27_depthUpdate << 1 | 0x8), col};
|
||||
}
|
||||
} else {
|
||||
if (x48_blendMode == EBlendMode::Alpha) {
|
||||
if (col == zeus::skWhite) {
|
||||
ret.x0_blendMode = 0;
|
||||
ret.x1_matSetIdx = 0;
|
||||
ret.x2_flags = x54_26_depthCompare << 0 | x54_27_depthUpdate << 1;
|
||||
ret.x4_color = zeus::skWhite;
|
||||
} else {
|
||||
ret.x0_blendMode = 5;
|
||||
ret.x1_matSetIdx = 0;
|
||||
ret.x2_flags = x54_26_depthCompare << 0 | x54_27_depthUpdate << 1;
|
||||
ret.x4_color = col;
|
||||
}
|
||||
} else if (x48_blendMode == EBlendMode::Additive) {
|
||||
ret.x0_blendMode = 7;
|
||||
ret.x1_matSetIdx = 0;
|
||||
ret.x2_flags = x54_26_depthCompare << 0 | x54_27_depthUpdate << 1;
|
||||
ret.x4_color = col;
|
||||
} else if (x48_blendMode == EBlendMode::Additive2) {
|
||||
ret.x0_blendMode = 8;
|
||||
ret.x1_matSetIdx = 0;
|
||||
ret.x2_flags = x54_26_depthCompare << 0 | x54_27_depthUpdate << 1;
|
||||
ret.x4_color = col;
|
||||
} else if (x48_blendMode == EBlendMode::Opaque) {
|
||||
if (col == zeus::skWhite) {
|
||||
ret.x0_blendMode = 0;
|
||||
ret.x1_matSetIdx = 0;
|
||||
ret.x2_flags = x54_26_depthCompare << 0 | x54_27_depthUpdate << 1;
|
||||
ret.x4_color = zeus::skWhite;
|
||||
} else {
|
||||
ret.x0_blendMode = 1;
|
||||
ret.x1_matSetIdx = 0;
|
||||
ret.x2_flags = x54_26_depthCompare << 0 | x54_27_depthUpdate << 1;
|
||||
ret.x4_color = col;
|
||||
}
|
||||
} else if (x48_blendMode == EBlendMode::OpaqueAdd) {
|
||||
ret.x0_blendMode = 2;
|
||||
ret.x1_matSetIdx = 0;
|
||||
ret.x2_flags = x54_26_depthCompare << 0 | x54_27_depthUpdate << 1;
|
||||
// ret.addColor = col;
|
||||
} else if (x48_blendMode == EBlendMode::Alpha) {
|
||||
if (col == zeus::skWhite) {
|
||||
return {0, 0, static_cast<u16>(x54_26_depthCompare << 0 | x54_27_depthUpdate << 1), zeus::skWhite};
|
||||
} else {
|
||||
ret.x2_flags = 3;
|
||||
ret.x4_color = zeus::skWhite;
|
||||
return {5, 0, static_cast<u16>(x54_26_depthCompare << 0 | x54_27_depthUpdate << 1), col};
|
||||
}
|
||||
} else if (x48_blendMode == EBlendMode::Additive) {
|
||||
return {7, 0, static_cast<u16>(x54_26_depthCompare << 0 | x54_27_depthUpdate << 1), col};
|
||||
} else if (x48_blendMode == EBlendMode::Additive2) {
|
||||
return {8, 0, static_cast<u16>(x54_26_depthCompare << 0 | x54_27_depthUpdate << 1), col};
|
||||
} else if (x48_blendMode == EBlendMode::Opaque) {
|
||||
if (col == zeus::skWhite) {
|
||||
return {0, 0, static_cast<u16>(x54_26_depthCompare << 0 | x54_27_depthUpdate << 1), zeus::skWhite};
|
||||
} else {
|
||||
return {1, 0, static_cast<u16>(x54_26_depthCompare << 0 | x54_27_depthUpdate << 1), col};
|
||||
}
|
||||
} else if (x48_blendMode == EBlendMode::OpaqueAdd) {
|
||||
return {2, 0, static_cast<u16>(x54_26_depthCompare << 0 | x54_27_depthUpdate << 1), col};
|
||||
}
|
||||
return ret;
|
||||
return {0, 0, 3, zeus::skWhite};
|
||||
}
|
||||
|
||||
void CScriptColorModulate::SetTargetFlags(CStateManager& stateMgr, const CModelFlags& flags) {
|
||||
|
||||
@@ -539,10 +539,7 @@ void CScriptGunTurret::Render(CStateManager& mgr) {
|
||||
if (x4a4_extensionModel && x4f8_extensionT > 0.f) {
|
||||
zeus::CTransform xf = GetTransform();
|
||||
xf.origin = x4fc_extensionOffset + (x4f4_extensionRange * 0.5f * zeus::skDown);
|
||||
CModelFlags flags;
|
||||
flags.x2_flags = 3;
|
||||
flags.x1_matSetIdx = 0;
|
||||
flags.x4_color = zeus::skWhite;
|
||||
CModelFlags flags{0, 0, 3, zeus::skWhite};
|
||||
x4a4_extensionModel->Render(mgr, xf, x90_actorLights.get(), flags);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,9 +38,7 @@ CScriptPickup::CScriptPickup(TUniqueId uid, std::string_view name, const CEntity
|
||||
}
|
||||
|
||||
if (x278_delayTimer != 0.f) {
|
||||
xb4_drawFlags = CModelFlags(5, 0, 3, zeus::CColor(1.f, 1.f, 1.f, 0.f));
|
||||
xb4_drawFlags.x2_flags &= 0xFFFC;
|
||||
xb4_drawFlags.x2_flags |= 1;
|
||||
xb4_drawFlags = CModelFlags(5, 0, 1, zeus::CColor(1.f, 1.f, 1.f, 0.f));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,9 +64,7 @@ void CScriptPickup::Think(float dt, CStateManager& mgr) {
|
||||
|
||||
if (x268_fadeInTime != 0.f) {
|
||||
if (x270_curTime < x268_fadeInTime) {
|
||||
drawFlags = CModelFlags(5, 0, 3, zeus::CColor(1.f, x270_curTime / x268_fadeInTime));
|
||||
drawFlags.x2_flags &= 0xFFFC;
|
||||
drawFlags.x2_flags |= 1;
|
||||
drawFlags = CModelFlags(5, 0, 1, zeus::CColor(1.f, x270_curTime / x268_fadeInTime));
|
||||
} else {
|
||||
x268_fadeInTime = 0.f;
|
||||
}
|
||||
@@ -80,9 +76,7 @@ void CScriptPickup::Think(float dt, CStateManager& mgr) {
|
||||
alpha = (x26c_lifeTime - x270_curTime) * 0.5f;
|
||||
}
|
||||
|
||||
drawFlags = CModelFlags(5, 0, 3, zeus::CColor(1.f, alpha));
|
||||
drawFlags.x2_flags &= 0xFFFC;
|
||||
drawFlags.x2_flags |= 1;
|
||||
drawFlags = CModelFlags(5, 0, 1, zeus::CColor(1.f, alpha));
|
||||
}
|
||||
|
||||
xb4_drawFlags = drawFlags;
|
||||
|
||||
@@ -654,8 +654,8 @@ void CWorld::TouchSky() {
|
||||
xb4_skyboxOverride.value()->Touch(0);
|
||||
}
|
||||
|
||||
void CWorld::DrawSky(const zeus::CTransform& xf) const {
|
||||
const CModel* model;
|
||||
void CWorld::DrawSky(const zeus::CTransform& xf) {
|
||||
CModel* model;
|
||||
if (xa4_skyboxWorldLoaded)
|
||||
model = xa4_skyboxWorldLoaded->GetObj();
|
||||
else if (xb4_skyboxOverride)
|
||||
@@ -674,7 +674,6 @@ void CWorld::DrawSky(const zeus::CTransform& xf) const {
|
||||
CGraphics::SetDepthRange(DEPTH_SKY, DEPTH_FAR);
|
||||
|
||||
CModelFlags flags(0, 0, 1, zeus::skWhite);
|
||||
// flags.m_noZWrite = true;
|
||||
model->Draw(flags);
|
||||
|
||||
CGraphics::SetDepthRange(DEPTH_WORLD, DEPTH_FAR);
|
||||
|
||||
@@ -227,7 +227,7 @@ public:
|
||||
void Update(float dt);
|
||||
void PreRender();
|
||||
void TouchSky();
|
||||
void DrawSky(const zeus::CTransform& xf) const;
|
||||
void DrawSky(const zeus::CTransform& xf);
|
||||
void StopGlobalSound(u16 id);
|
||||
bool HasGlobalSound(u16 id) const;
|
||||
void AddGlobalSound(const CSfxHandle& hnd);
|
||||
|
||||
Reference in New Issue
Block a user