mirror of https://github.com/AxioDL/metaforce.git
CScriptSpecialFunction: SpinnerController fixes
This commit is contained in:
parent
7513b7b9bc
commit
6a7b87bea1
|
@ -180,6 +180,7 @@ void CScriptSpecialFunction::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId
|
|||
break;
|
||||
}
|
||||
case EScriptObjectMessage::SetToMax: {
|
||||
x16c_ = x104_float3;
|
||||
SendScriptMsgs(EScriptObjectState::Play, mgr, EScriptObjectMessage::None);
|
||||
break;
|
||||
}
|
||||
|
@ -659,9 +660,9 @@ void CScriptSpecialFunction::ThinkSpinnerController(float dt, CStateManager& mgr
|
|||
if (const TCastToPtr<CScriptPlatform> plat = mgr.ObjectById((*it).second)) {
|
||||
if (plat->HasModelData() && plat->GetModelData()->HasAnimData()) {
|
||||
plat->SetControlledAnimation(true);
|
||||
if (!x1e4_24_) {
|
||||
x13c_ = plat->GetTransform();
|
||||
x1e4_24_ = true;
|
||||
if (!x1e4_24_spinnerInitializedXf) {
|
||||
x13c_spinnerInitialXf = plat->GetTransform();
|
||||
x1e4_24_spinnerInitializedXf = true;
|
||||
}
|
||||
|
||||
float f28 = x138_;
|
||||
|
@ -692,7 +693,7 @@ void CScriptSpecialFunction::ThinkSpinnerController(float dt, CStateManager& mgr
|
|||
x138_ = f28 - twoByDt;
|
||||
}
|
||||
} else if (mode == ESpinnerControllerMode::One) {
|
||||
x138_ = (0.1f * x16c_) * xfc_float1 + f28;
|
||||
x138_ = (0.01f * x16c_) * xfc_float1 + f28;
|
||||
|
||||
if (!noBackward) {
|
||||
x138_ -= f29;
|
||||
|
@ -715,7 +716,7 @@ void CScriptSpecialFunction::ThinkSpinnerController(float dt, CStateManager& mgr
|
|||
}
|
||||
|
||||
bool r23 = true;
|
||||
f28 = x138_ - f28;
|
||||
f28 = x138_ - f28; // always 0?
|
||||
if (zeus::close_enough(x138_, 1.f, FLT_EPSILON)) {
|
||||
if (!x1e4_27_sfx3Played) {
|
||||
if (x174_sfx3 != 0xFFFF) {
|
||||
|
@ -746,14 +747,9 @@ void CScriptSpecialFunction::ThinkSpinnerController(float dt, CStateManager& mgr
|
|||
x1e4_26_sfx2Played = false;
|
||||
}
|
||||
|
||||
// local_1ac = x184_.GetAverage();
|
||||
if (r23) {
|
||||
if (x170_sfx1 != 0xFFFF) {
|
||||
if (r23) { // ?
|
||||
x184_.AddValue(0.f <= f28 ? 100 : 0x7f);
|
||||
} else {
|
||||
x184_.AddValue(0.f);
|
||||
}
|
||||
x184_.AddValue(0.f <= f28 ? 100 : 0x7f);
|
||||
const std::optional<float> avg = x184_.GetAverage();
|
||||
AddOrUpdateEmitter(0.f <= f28 ? x108_float4 : 1.f, x178_sfxHandle, x170_sfx1, GetTranslation(),
|
||||
avg.value());
|
||||
|
@ -767,7 +763,7 @@ void CScriptSpecialFunction::ThinkSpinnerController(float dt, CStateManager& mgr
|
|||
animData->SetPhase(0.f);
|
||||
animData->SetPlaybackRate(1.f);
|
||||
const SAdvancementDeltas& deltas = plat->UpdateAnimation(dur, mgr, true);
|
||||
plat->SetTransform(x13c_ * deltas.xc_rotDelta.toTransform(deltas.x0_posDelta));
|
||||
plat->SetTransform(x13c_spinnerInitialXf * deltas.xc_rotDelta.toTransform(deltas.x0_posDelta));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ private:
|
|||
zeus::CColor x118_color;
|
||||
CDamageInfo x11c_damageInfo;
|
||||
float x138_ = 0.f;
|
||||
zeus::CTransform x13c_ = zeus::CTransform();
|
||||
zeus::CTransform x13c_spinnerInitialXf = zeus::CTransform();
|
||||
float x16c_ = 0.f;
|
||||
u16 x170_sfx1;
|
||||
u16 x172_sfx2;
|
||||
|
@ -99,7 +99,7 @@ private:
|
|||
s32 x1c0_layerIdx;
|
||||
CPlayerState::EItemType x1c4_item;
|
||||
std::optional<zeus::CAABox> x1c8_touchBounds;
|
||||
bool x1e4_24_ : 1 = false;
|
||||
bool x1e4_24_spinnerInitializedXf : 1 = false;
|
||||
bool x1e4_25_spinnerCanMove : 1 = false;
|
||||
bool x1e4_26_sfx2Played : 1 = true;
|
||||
bool x1e4_27_sfx3Played : 1 = false;
|
||||
|
|
Loading…
Reference in New Issue