Almost match CGunMorph::Update

Former-commit-id: 9e99dc2d36
This commit is contained in:
Henrique Gemignani Passos Lima 2022-10-06 20:12:06 +03:00
parent 71986fcb89
commit 1d574dea1c
1 changed files with 48 additions and 2 deletions

View File

@ -617,8 +617,54 @@ void CPlayerGun::CGunMorph::StartWipe(CPlayerGun::CGunMorph::EDir dir) {
x24_24_morphing = true; x24_24_morphing = true;
} }
CPlayerGun::CGunMorph::EMorphEvent CPlayerGun::CGunMorph::Update(float, float, float) { CPlayerGun::CGunMorph::EMorphEvent CPlayerGun::CGunMorph::Update(float inY, float outY, float dt) {
return kME_None; EMorphEvent ret = kME_None;
switch (x20_gunState) {
case kGS_InWipeDone:
x14_remHoldTime -= dt;
if (x14_remHoldTime <= 0.f && x24_25_weaponChanged) {
StartWipe(kD_Out);
x24_25_weaponChanged = false;
x14_remHoldTime = 0.f;
ret = kME_InWipeDone;
}
// explicitly no break
case kGS_OutWipeDone:
case kGS_InWipe:
case kGS_OutWipe:
default:
if (x24_24_morphing) {
float omt = x8_remTime * xc_speed;
float t = 1.f - omt;
if (x1c_dir == kD_In) {
x0_yLerp = omt * outY + t * inY;
x18_transitionFactor = omt;
} else {
x0_yLerp = omt * inY + t * outY;
x18_transitionFactor = t;
}
if (x8_remTime <= 0.f) {
x24_24_morphing = false;
x8_remTime = 0.f;
if (x1c_dir == kD_In) {
x20_gunState = kGS_InWipeDone;
x18_transitionFactor = 0.f;
} else {
x18_transitionFactor = 1.f;
x20_gunState = kGS_OutWipeDone;
x1c_dir = kD_Done;
ret = kME_OutWipeDone;
}
} else {
x8_remTime -= dt;
}
}
}
return ret;
} }
void CPlayerGun::UpdateWeaponFire(float, CPlayerState&, CStateManager&) {} void CPlayerGun::UpdateWeaponFire(float, CPlayerState&, CStateManager&) {}