mirror of https://github.com/AxioDL/metaforce.git
Decomp fixes for CScriptShadowProjector
This commit is contained in:
parent
6ef1de8dda
commit
e412adef33
|
@ -75,7 +75,7 @@ float CScriptCoverPoint::GetSinSqVerticalAngle() const { return xf0_sinVerticalA
|
|||
void CScriptCoverPoint::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) {
|
||||
CActor::AcceptScriptMsg(msg, uid, mgr);
|
||||
|
||||
if (msg == EScriptObjectMessage::WorldInitialized) {
|
||||
if (msg == EScriptObjectMessage::InitializedInArea) {
|
||||
for (const SConnection& con : x20_conns)
|
||||
if (con.x0_state == EScriptObjectState::Retreat) {
|
||||
xfc_retreating = mgr.GetIdForScript(con.x8_objId);
|
||||
|
|
|
@ -29,11 +29,11 @@ void CScriptShadowProjector::Think(float dt, CStateManager& mgr) {
|
|||
return;
|
||||
}
|
||||
|
||||
xfc_opacity = (x100_opacityRecip * xfc_opacity) - dt;
|
||||
if (dt > 0.f) {
|
||||
xfc_opacity = -(x100_opacityRecip * dt - xfc_opacity);
|
||||
if (xfc_opacity > 0.f) {
|
||||
return;
|
||||
}
|
||||
|
||||
xfc_opacity = 0.f;
|
||||
x108_projectedShadow.reset();
|
||||
|
||||
x110_25_shadowInvalidated = false;
|
||||
|
@ -50,41 +50,44 @@ void CScriptShadowProjector::CreateProjectedShadow() {
|
|||
|
||||
void CScriptShadowProjector::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) {
|
||||
CActor::AcceptScriptMsg(msg, uid, mgr);
|
||||
if (msg == EScriptObjectMessage::Decrement) {
|
||||
if (x110_24_persistent) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (xfc_opacity <= 0.f) {
|
||||
return;
|
||||
}
|
||||
|
||||
x110_25_shadowInvalidated = true;
|
||||
} else if (msg == EScriptObjectMessage::InitializedInArea) {
|
||||
switch (msg) {
|
||||
case EScriptObjectMessage::InitializedInArea:
|
||||
for (const SConnection& conn : x20_conns) {
|
||||
if (conn.x0_state != EScriptObjectState::Play) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const CActor* act = TCastToConstPtr<CActor>(mgr.GetObjectById(mgr.GetIdForScript(conn.x8_objId)));
|
||||
if (!act) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (act) {
|
||||
const CModelData* mData = act->GetModelData();
|
||||
if (!mData || (!mData->GetAnimationData() && !mData->GetNormalModel())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (mData && (mData->GetAnimationData() || mData->HasNormalModel())) {
|
||||
x104_target = act->GetUniqueId();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (x104_target == kInvalidUniqueId) {
|
||||
mgr.FreeScriptObject(GetUniqueId());
|
||||
} else {
|
||||
CreateProjectedShadow();
|
||||
break;
|
||||
}
|
||||
} else if (msg == EScriptObjectMessage::Activate) {
|
||||
[[fallthrough]];
|
||||
case EScriptObjectMessage::Deactivate:
|
||||
case EScriptObjectMessage::Activate:
|
||||
CreateProjectedShadow();
|
||||
break;
|
||||
|
||||
case EScriptObjectMessage::Decrement:
|
||||
if (!GetActive()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (xfc_opacity > 0.f) {
|
||||
x110_25_shadowInvalidated = true;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue