More work on CMorphBall

This commit is contained in:
Jack Andersen 2017-09-16 17:13:03 -10:00
parent de5138bb9b
commit 2c4967ca4d
17 changed files with 852 additions and 302 deletions

View File

@ -10,12 +10,21 @@ struct ITweakBall : ITweak
virtual float GetMaxBallTranslationAcceleration(int s) const=0;
virtual float GetBallTranslationFriction(int s) const=0;
virtual float GetBallTranslationMaxSpeed(int s) const=0;
virtual float GetBallForwardBrakingAcceleration(int s) const=0;
virtual float GetBallGravity() const=0;
virtual float GetBallWaterGravity() const=0;
virtual float GetMaxLeanAngle() const=0;
virtual float GetTireToMarbleThresholdSpeed() const=0;
virtual float GetMarbleToTireThresholdSpeed() const=0;
virtual float GetForceToLeanGain() const=0;
virtual float GetLeanTrackingGain() const=0;
virtual float GetBallCameraControlDistance() const=0;
virtual float GetLeftStickDivisor() const=0;
virtual float GetRightStickDivisor() const=0;
virtual float GetBallTouchRadius() const=0;
virtual float GetBoostBallDrainTime() const=0;
virtual float GetBoostBallMaxChargeTime() const=0;
virtual float GetBoostBallMinChargeTime() const=0;
virtual float GetBoostBallMinRelativeSpeedForDamage() const=0;
};
}

View File

@ -63,22 +63,22 @@ void CTweakBall::read(athena::io::IStreamReader& __dna_reader)
x6c_ = __dna_reader.readFloatBig();
/* x70_ */
x70_ = __dna_reader.readFloatBig();
/* xc4_[0] */
xc4_[0] = __dna_reader.readFloatBig();
/* xc4_[1] */
xc4_[1] = __dna_reader.readFloatBig();
/* xc4_[2] */
xc4_[2] = __dna_reader.readFloatBig();
/* xc4_[3] */
xc4_[3] = __dna_reader.readFloatBig();
/* xc4_[4] */
xc4_[4] = __dna_reader.readFloatBig();
/* xc4_[5] */
xc4_[5] = __dna_reader.readFloatBig();
/* xc4_[6] */
xc4_[6] = __dna_reader.readFloatBig();
/* xc4_[7] */
xc4_[7] = __dna_reader.readFloatBig();
/* xc4_ballForwardBrakingAcceleration[0] */
xc4_ballForwardBrakingAcceleration[0] = __dna_reader.readFloatBig();
/* xc4_ballForwardBrakingAcceleration[1] */
xc4_ballForwardBrakingAcceleration[1] = __dna_reader.readFloatBig();
/* xc4_ballForwardBrakingAcceleration[2] */
xc4_ballForwardBrakingAcceleration[2] = __dna_reader.readFloatBig();
/* xc4_ballForwardBrakingAcceleration[3] */
xc4_ballForwardBrakingAcceleration[3] = __dna_reader.readFloatBig();
/* xc4_ballForwardBrakingAcceleration[4] */
xc4_ballForwardBrakingAcceleration[4] = __dna_reader.readFloatBig();
/* xc4_ballForwardBrakingAcceleration[5] */
xc4_ballForwardBrakingAcceleration[5] = __dna_reader.readFloatBig();
/* xc4_ballForwardBrakingAcceleration[6] */
xc4_ballForwardBrakingAcceleration[6] = __dna_reader.readFloatBig();
/* xc4_ballForwardBrakingAcceleration[7] */
xc4_ballForwardBrakingAcceleration[7] = __dna_reader.readFloatBig();
/* xe4_ballGravity */
xe4_ballGravity = __dna_reader.readFloatBig();
/* xe8_ballWaterGravity */
@ -93,16 +93,16 @@ void CTweakBall::read(athena::io::IStreamReader& __dna_reader)
x1dc_ = __dna_reader.readFloatBig();
/* x1e0_ */
x1e0_ = __dna_reader.readFloatBig();
/* x1ec_ */
x1ec_ = __dna_reader.readFloatBig();
/* x1f0_ */
x1f0_ = __dna_reader.readFloatBig();
/* x1f4_ */
x1f4_ = __dna_reader.readFloatBig();
/* x1f8_ */
x1f8_ = __dna_reader.readFloatBig();
/* x1fc_ */
x1fc_ = __dna_reader.readFloatBig();
/* x1ec_maxLeanAngle */
x1ec_maxLeanAngle = __dna_reader.readFloatBig();
/* x1f0_tireToMarbleThresholdSpeed */
x1f0_tireToMarbleThresholdSpeed = __dna_reader.readFloatBig();
/* x1f4_marbleToTireThresholdSpeed */
x1f4_marbleToTireThresholdSpeed = __dna_reader.readFloatBig();
/* x1f8_forceToLeanGain */
x1f8_forceToLeanGain = __dna_reader.readFloatBig();
/* x1fc_leanTrackingGain */
x1fc_leanTrackingGain = __dna_reader.readFloatBig();
/* x74_ */
x74_ = __dna_reader.readFloatBig();
/* x78_ */
@ -205,18 +205,18 @@ void CTweakBall::read(athena::io::IStreamReader& __dna_reader)
x200_ = __dna_reader.readFloatBig();
/* x204_ballTouchRadius */
x204_ballTouchRadius = __dna_reader.readFloatBig();
/* x20c_ */
x20c_ = __dna_reader.readFloatBig();
/* x218_ */
x218_ = __dna_reader.readFloatBig();
/* x21c_ */
/* x20c_boostBallDrainTime */
x20c_boostBallDrainTime = __dna_reader.readFloatBig();
/* x218_boostBallMinChargeTime */
x218_boostBallMinChargeTime = __dna_reader.readFloatBig();
/* x21c_boostBallMinRelativeSpeedForDamage */
x21c_boostBallMinRelativeSpeedForDamage = __dna_reader.readFloatBig();
/* x220_ */
x220_ = __dna_reader.readFloatBig();
/* x224_ */
x224_ = __dna_reader.readFloatBig();
/* x210_ */
x210_ = __dna_reader.readFloatBig();
/* x210_boostBallMaxChargeTime */
x210_boostBallMaxChargeTime = __dna_reader.readFloatBig();
/* x22c_ */
x22c_ = __dna_reader.readFloatBig();
/* x230_ */
@ -283,22 +283,22 @@ void CTweakBall::write(athena::io::IStreamWriter& __dna_writer) const
__dna_writer.writeFloatBig(x6c_);
/* x70_ */
__dna_writer.writeFloatBig(x70_);
/* xc4_[0] */
__dna_writer.writeFloatBig(xc4_[0]);
/* xc4_[1] */
__dna_writer.writeFloatBig(xc4_[1]);
/* xc4_[2] */
__dna_writer.writeFloatBig(xc4_[2]);
/* xc4_[3] */
__dna_writer.writeFloatBig(xc4_[3]);
/* xc4_[4] */
__dna_writer.writeFloatBig(xc4_[4]);
/* xc4_[5] */
__dna_writer.writeFloatBig(xc4_[5]);
/* xc4_[6] */
__dna_writer.writeFloatBig(xc4_[6]);
/* xc4_[7] */
__dna_writer.writeFloatBig(xc4_[7]);
/* xc4_ballForwardBrakingAcceleration[0] */
__dna_writer.writeFloatBig(xc4_ballForwardBrakingAcceleration[0]);
/* xc4_ballForwardBrakingAcceleration[1] */
__dna_writer.writeFloatBig(xc4_ballForwardBrakingAcceleration[1]);
/* xc4_ballForwardBrakingAcceleration[2] */
__dna_writer.writeFloatBig(xc4_ballForwardBrakingAcceleration[2]);
/* xc4_ballForwardBrakingAcceleration[3] */
__dna_writer.writeFloatBig(xc4_ballForwardBrakingAcceleration[3]);
/* xc4_ballForwardBrakingAcceleration[4] */
__dna_writer.writeFloatBig(xc4_ballForwardBrakingAcceleration[4]);
/* xc4_ballForwardBrakingAcceleration[5] */
__dna_writer.writeFloatBig(xc4_ballForwardBrakingAcceleration[5]);
/* xc4_ballForwardBrakingAcceleration[6] */
__dna_writer.writeFloatBig(xc4_ballForwardBrakingAcceleration[6]);
/* xc4_ballForwardBrakingAcceleration[7] */
__dna_writer.writeFloatBig(xc4_ballForwardBrakingAcceleration[7]);
/* xe4_ballGravity */
__dna_writer.writeFloatBig(xe4_ballGravity);
/* xe8_ballWaterGravity */
@ -313,16 +313,16 @@ void CTweakBall::write(athena::io::IStreamWriter& __dna_writer) const
__dna_writer.writeFloatBig(x1dc_);
/* x1e0_ */
__dna_writer.writeFloatBig(x1e0_);
/* x1ec_ */
__dna_writer.writeFloatBig(x1ec_);
/* x1f0_ */
__dna_writer.writeFloatBig(x1f0_);
/* x1f4_ */
__dna_writer.writeFloatBig(x1f4_);
/* x1f8_ */
__dna_writer.writeFloatBig(x1f8_);
/* x1fc_ */
__dna_writer.writeFloatBig(x1fc_);
/* x1ec_maxLeanAngle */
__dna_writer.writeFloatBig(x1ec_maxLeanAngle);
/* x1f0_tireToMarbleThresholdSpeed */
__dna_writer.writeFloatBig(x1f0_tireToMarbleThresholdSpeed);
/* x1f4_marbleToTireThresholdSpeed */
__dna_writer.writeFloatBig(x1f4_marbleToTireThresholdSpeed);
/* x1f8_forceToLeanGain */
__dna_writer.writeFloatBig(x1f8_forceToLeanGain);
/* x1fc_leanTrackingGain */
__dna_writer.writeFloatBig(x1fc_leanTrackingGain);
/* x74_ */
__dna_writer.writeFloatBig(x74_);
/* x78_ */
@ -425,18 +425,18 @@ void CTweakBall::write(athena::io::IStreamWriter& __dna_writer) const
__dna_writer.writeFloatBig(x200_);
/* x204_ballTouchRadius */
__dna_writer.writeFloatBig(x204_ballTouchRadius);
/* x20c_ */
__dna_writer.writeFloatBig(x20c_);
/* x218_ */
__dna_writer.writeFloatBig(x218_);
/* x21c_ */
/* x20c_boostBallDrainTime */
__dna_writer.writeFloatBig(x20c_boostBallDrainTime);
/* x218_boostBallMinChargeTime */
__dna_writer.writeFloatBig(x218_boostBallMinChargeTime);
/* x21c_boostBallMinRelativeSpeedForDamage */
__dna_writer.writeFloatBig(x21c_boostBallMinRelativeSpeedForDamage);
/* x220_ */
__dna_writer.writeFloatBig(x220_);
/* x224_ */
__dna_writer.writeFloatBig(x224_);
/* x210_ */
__dna_writer.writeFloatBig(x210_);
/* x210_boostBallMaxChargeTime */
__dna_writer.writeFloatBig(x210_boostBallMaxChargeTime);
/* x22c_ */
__dna_writer.writeFloatBig(x22c_);
/* x230_ */
@ -518,26 +518,26 @@ void CTweakBall::read(athena::io::YAMLDocReader& __dna_docin)
x6c_ = __dna_docin.readFloat("x6c_");
/* x70_ */
x70_ = __dna_docin.readFloat("x70_");
/* xc4_ */
/* xc4_ballForwardBrakingAcceleration */
size_t __xc4_Count;
if (auto v = __dna_docin.enterSubVector("xc4_", __xc4_Count))
if (auto v = __dna_docin.enterSubVector("xc4_ballForwardBrakingAcceleration", __xc4_Count))
{
/* xc4_[0] */
xc4_[0] = __dna_docin.readFloat("xc4_");
/* xc4_[1] */
xc4_[1] = __dna_docin.readFloat("xc4_");
/* xc4_[2] */
xc4_[2] = __dna_docin.readFloat("xc4_");
/* xc4_[3] */
xc4_[3] = __dna_docin.readFloat("xc4_");
/* xc4_[4] */
xc4_[4] = __dna_docin.readFloat("xc4_");
/* xc4_[5] */
xc4_[5] = __dna_docin.readFloat("xc4_");
/* xc4_[6] */
xc4_[6] = __dna_docin.readFloat("xc4_");
/* xc4_[7] */
xc4_[7] = __dna_docin.readFloat("xc4_");
/* xc4_ballForwardBrakingAcceleration[0] */
xc4_ballForwardBrakingAcceleration[0] = __dna_docin.readFloat("xc4_ballForwardBrakingAcceleration");
/* xc4_ballForwardBrakingAcceleration[1] */
xc4_ballForwardBrakingAcceleration[1] = __dna_docin.readFloat("xc4_ballForwardBrakingAcceleration");
/* xc4_ballForwardBrakingAcceleration[2] */
xc4_ballForwardBrakingAcceleration[2] = __dna_docin.readFloat("xc4_ballForwardBrakingAcceleration");
/* xc4_ballForwardBrakingAcceleration[3] */
xc4_ballForwardBrakingAcceleration[3] = __dna_docin.readFloat("xc4_ballForwardBrakingAcceleration");
/* xc4_ballForwardBrakingAcceleration[4] */
xc4_ballForwardBrakingAcceleration[4] = __dna_docin.readFloat("xc4_ballForwardBrakingAcceleration");
/* xc4_ballForwardBrakingAcceleration[5] */
xc4_ballForwardBrakingAcceleration[5] = __dna_docin.readFloat("xc4_ballForwardBrakingAcceleration");
/* xc4_ballForwardBrakingAcceleration[6] */
xc4_ballForwardBrakingAcceleration[6] = __dna_docin.readFloat("xc4_ballForwardBrakingAcceleration");
/* xc4_ballForwardBrakingAcceleration[7] */
xc4_ballForwardBrakingAcceleration[7] = __dna_docin.readFloat("xc4_ballForwardBrakingAcceleration");
}
/* xe4_ballGravity */
xe4_ballGravity = __dna_docin.readFloat("xe4_ballGravity");
@ -553,16 +553,16 @@ void CTweakBall::read(athena::io::YAMLDocReader& __dna_docin)
x1dc_ = __dna_docin.readFloat("x1dc_");
/* x1e0_ */
x1e0_ = __dna_docin.readFloat("x1e0_");
/* x1ec_ */
x1ec_ = __dna_docin.readFloat("x1ec_");
/* x1f0_ */
x1f0_ = __dna_docin.readFloat("x1f0_");
/* x1f4_ */
x1f4_ = __dna_docin.readFloat("x1f4_");
/* x1f8_ */
x1f8_ = __dna_docin.readFloat("x1f8_");
/* x1fc_ */
x1fc_ = __dna_docin.readFloat("x1fc_");
/* x1ec_maxLeanAngle */
x1ec_maxLeanAngle = __dna_docin.readFloat("x1ec_maxLeanAngle");
/* x1f0_tireToMarbleThresholdSpeed */
x1f0_tireToMarbleThresholdSpeed = __dna_docin.readFloat("x1f0_tireToMarbleThresholdSpeed");
/* x1f4_marbleToTireThresholdSpeed */
x1f4_marbleToTireThresholdSpeed = __dna_docin.readFloat("x1f4_marbleToTireThresholdSpeed");
/* x1f8_forceToLeanGain */
x1f8_forceToLeanGain = __dna_docin.readFloat("x1f8_forceToLeanGain");
/* x1fc_leanTrackingGain */
x1fc_leanTrackingGain = __dna_docin.readFloat("x1fc_leanTrackingGain");
/* x74_ */
x74_ = __dna_docin.readFloat("x74_");
/* x78_ */
@ -665,18 +665,18 @@ void CTweakBall::read(athena::io::YAMLDocReader& __dna_docin)
x200_ = __dna_docin.readFloat("x200_");
/* x204_ballTouchRadius */
x204_ballTouchRadius = __dna_docin.readFloat("x204_ballTouchRadius");
/* x20c_ */
x20c_ = __dna_docin.readFloat("x20c_");
/* x218_ */
x218_ = __dna_docin.readFloat("x218_");
/* x21c_ */
x21c_boostBallMinRelativeSpeedForDamage = __dna_docin.readFloat("x21c_");
/* x20c_boostBallDrainTime */
x20c_boostBallDrainTime = __dna_docin.readFloat("x20c_boostBallDrainTime");
/* x218_boostBallMinChargeTime */
x218_boostBallMinChargeTime = __dna_docin.readFloat("x218_boostBallMinChargeTime");
/* x21c_boostBallMinRelativeSpeedForDamage */
x21c_boostBallMinRelativeSpeedForDamage = __dna_docin.readFloat("x21c_boostBallMinRelativeSpeedForDamage");
/* x220_ */
x220_ = __dna_docin.readFloat("x220_");
/* x224_ */
x224_ = __dna_docin.readFloat("x224_");
/* x210_ */
x210_ = __dna_docin.readFloat("x210_");
/* x210_boostBallMaxChargeTime */
x210_boostBallMaxChargeTime = __dna_docin.readFloat("x210_boostBallMaxChargeTime");
/* x22c_ */
x22c_ = __dna_docin.readFloat("x22c_");
/* x230_ */
@ -755,25 +755,25 @@ void CTweakBall::write(athena::io::YAMLDocWriter& __dna_docout) const
__dna_docout.writeFloat("x6c_", x6c_);
/* x70_ */
__dna_docout.writeFloat("x70_", x70_);
/* xc4_ */
if (auto v = __dna_docout.enterSubVector("xc4_"))
/* xc4_ballForwardBrakingAcceleration */
if (auto v = __dna_docout.enterSubVector("xc4_ballForwardBrakingAcceleration"))
{
/* xc4_[0] */
__dna_docout.writeFloat("xc4_", xc4_[0]);
/* xc4_[1] */
__dna_docout.writeFloat("xc4_", xc4_[1]);
/* xc4_[2] */
__dna_docout.writeFloat("xc4_", xc4_[2]);
/* xc4_[3] */
__dna_docout.writeFloat("xc4_", xc4_[3]);
/* xc4_[4] */
__dna_docout.writeFloat("xc4_", xc4_[4]);
/* xc4_[5] */
__dna_docout.writeFloat("xc4_", xc4_[5]);
/* xc4_[6] */
__dna_docout.writeFloat("xc4_", xc4_[6]);
/* xc4_[7] */
__dna_docout.writeFloat("xc4_", xc4_[7]);
/* xc4_ballForwardBrakingAcceleration[0] */
__dna_docout.writeFloat("xc4_ballForwardBrakingAcceleration", xc4_ballForwardBrakingAcceleration[0]);
/* xc4_ballForwardBrakingAcceleration[1] */
__dna_docout.writeFloat("xc4_ballForwardBrakingAcceleration", xc4_ballForwardBrakingAcceleration[1]);
/* xc4_ballForwardBrakingAcceleration[2] */
__dna_docout.writeFloat("xc4_ballForwardBrakingAcceleration", xc4_ballForwardBrakingAcceleration[2]);
/* xc4_ballForwardBrakingAcceleration[3] */
__dna_docout.writeFloat("xc4_ballForwardBrakingAcceleration", xc4_ballForwardBrakingAcceleration[3]);
/* xc4_ballForwardBrakingAcceleration[4] */
__dna_docout.writeFloat("xc4_ballForwardBrakingAcceleration", xc4_ballForwardBrakingAcceleration[4]);
/* xc4_ballForwardBrakingAcceleration[5] */
__dna_docout.writeFloat("xc4_ballForwardBrakingAcceleration", xc4_ballForwardBrakingAcceleration[5]);
/* xc4_ballForwardBrakingAcceleration[6] */
__dna_docout.writeFloat("xc4_ballForwardBrakingAcceleration", xc4_ballForwardBrakingAcceleration[6]);
/* xc4_ballForwardBrakingAcceleration[7] */
__dna_docout.writeFloat("xc4_ballForwardBrakingAcceleration", xc4_ballForwardBrakingAcceleration[7]);
}
/* xe4_ballGravity */
__dna_docout.writeFloat("xe4_ballGravity", xe4_ballGravity);
@ -789,16 +789,16 @@ void CTweakBall::write(athena::io::YAMLDocWriter& __dna_docout) const
__dna_docout.writeFloat("x1dc_", x1dc_);
/* x1e0_ */
__dna_docout.writeFloat("x1e0_", x1e0_);
/* x1ec_ */
__dna_docout.writeFloat("x1ec_", x1ec_);
/* x1f0_ */
__dna_docout.writeFloat("x1f0_", x1f0_);
/* x1f4_ */
__dna_docout.writeFloat("x1f4_", x1f4_);
/* x1f8_ */
__dna_docout.writeFloat("x1f8_", x1f8_);
/* x1fc_ */
__dna_docout.writeFloat("x1fc_", x1fc_);
/* x1ec_maxLeanAngle */
__dna_docout.writeFloat("x1ec_maxLeanAngle", x1ec_maxLeanAngle);
/* x1f0_tireToMarbleThresholdSpeed */
__dna_docout.writeFloat("x1f0_tireToMarbleThresholdSpeed", x1f0_tireToMarbleThresholdSpeed);
/* x1f4_marbleToTireThresholdSpeed */
__dna_docout.writeFloat("x1f4_marbleToTireThresholdSpeed", x1f4_marbleToTireThresholdSpeed);
/* x1f8_forceToLeanGain */
__dna_docout.writeFloat("x1f8_forceToLeanGain", x1f8_forceToLeanGain);
/* x1fc_leanTrackingGain */
__dna_docout.writeFloat("x1fc_leanTrackingGain", x1fc_leanTrackingGain);
/* x74_ */
__dna_docout.writeFloat("x74_", x74_);
/* x78_ */
@ -901,18 +901,18 @@ void CTweakBall::write(athena::io::YAMLDocWriter& __dna_docout) const
__dna_docout.writeFloat("x200_", x200_);
/* x204_ballTouchRadius */
__dna_docout.writeFloat("x204_ballTouchRadius", x204_ballTouchRadius);
/* x20c_ */
__dna_docout.writeFloat("x20c_", x20c_);
/* x218_ */
__dna_docout.writeFloat("x218_", x218_);
/* x21c_ */
__dna_docout.writeFloat("x21c_", x21c_boostBallMinRelativeSpeedForDamage);
/* x20c_boostBallDrainTime */
__dna_docout.writeFloat("x20c_boostBallDrainTime", x20c_boostBallDrainTime);
/* x218_boostBallMinChargeTime */
__dna_docout.writeFloat("x218_boostBallMinChargeTime", x218_boostBallMinChargeTime);
/* x21c_boostBallMinRelativeSpeedForDamage */
__dna_docout.writeFloat("x21c_boostBallMinRelativeSpeedForDamage", x21c_boostBallMinRelativeSpeedForDamage);
/* x220_ */
__dna_docout.writeFloat("x220_", x220_);
/* x224_ */
__dna_docout.writeFloat("x224_", x224_);
/* x210_ */
__dna_docout.writeFloat("x210_", x210_);
/* x210_boostBallMaxChargeTime */
__dna_docout.writeFloat("x210_boostBallMaxChargeTime", x210_boostBallMaxChargeTime);
/* x22c_ */
__dna_docout.writeFloat("x22c_", x22c_);
/* x230_ */

View File

@ -37,7 +37,7 @@ struct CTweakBall final : public ITweakBall
Value<float> xb8_;
Value<float> xbc_;
Value<float> xc0_;
Value<float> xc4_[8];
Value<float> xc4_ballForwardBrakingAcceleration[8];
Value<float> xe4_ballGravity;
Value<float> xe8_ballWaterGravity;
float xec_ = 10000.f;
@ -98,22 +98,22 @@ struct CTweakBall final : public ITweakBall
Value<float> x1d8_;
Value<float> x1dc_;
Value<float> x1e0_;
Value<float> x1ec_;
Value<float> x1f0_;
Value<float> x1f4_;
Value<float> x1f8_;
Value<float> x1fc_;
Value<float> x1ec_maxLeanAngle;
Value<float> x1f0_tireToMarbleThresholdSpeed;
Value<float> x1f4_marbleToTireThresholdSpeed;
Value<float> x1f8_forceToLeanGain;
Value<float> x1fc_leanTrackingGain;
Value<float> x1e4_leftStickDivisor;
Value<float> x1e8_rightStickDivisor;
Value<float> x200_;
Value<float> x204_ballTouchRadius;
float x208_;
Value<float> x20c_;
Value<float> x218_;
Value<float> x20c_boostBallDrainTime;
Value<float> x218_boostBallMinChargeTime;
Value<float> x21c_boostBallMinRelativeSpeedForDamage;
Value<float> x220_;
Value<float> x224_;
Value<float> x210_;
Value<float> x210_boostBallMaxChargeTime;
float x228_;
Value<float> x22c_;
Value<float> x230_;
@ -134,18 +134,27 @@ struct CTweakBall final : public ITweakBall
x1a8_ = zeus::degToRad(x1a8_);
x1b0_ = zeus::degToRad(x1b0_);
x1b4_ = zeus::degToRad(x1b4_);
x1ec_ = zeus::degToRad(x1ec_);
x1ec_maxLeanAngle = zeus::degToRad(x1ec_maxLeanAngle);
}
float GetMaxBallTranslationAcceleration(int s) const { return x4_maxTranslationAcceleration[s]; }
float GetBallTranslationFriction(int s) const { return x24_translationFriction[s]; }
float GetBallTranslationMaxSpeed(int s) const { return x44_translationMaxSpeed[s]; }
float GetBallForwardBrakingAcceleration(int s) const { return xc4_ballForwardBrakingAcceleration[s]; }
float GetBallGravity() const { return xe4_ballGravity; }
float GetBallWaterGravity() const { return xe8_ballWaterGravity; }
float GetMaxLeanAngle() const { return x1ec_maxLeanAngle; }
float GetTireToMarbleThresholdSpeed() const { return x1f0_tireToMarbleThresholdSpeed; }
float GetMarbleToTireThresholdSpeed() const { return x1f4_marbleToTireThresholdSpeed; }
float GetForceToLeanGain() const { return x1f8_forceToLeanGain; }
float GetLeanTrackingGain() const { return x1fc_leanTrackingGain; }
float GetBallCameraControlDistance() const { return x1d0_ballCameraControlDistance; }
float GetLeftStickDivisor() const { return x1e4_leftStickDivisor; }
float GetRightStickDivisor() const { return x1e8_rightStickDivisor; }
float GetBallTouchRadius() const { return x204_ballTouchRadius; }
float GetBoostBallDrainTime() const { return x20c_boostBallDrainTime; }
float GetBoostBallMaxChargeTime() const { return x210_boostBallMaxChargeTime; }
float GetBoostBallMinChargeTime() const { return x218_boostBallMinChargeTime; }
float GetBoostBallMinRelativeSpeedForDamage() const { return x21c_boostBallMinRelativeSpeedForDamage; }
};
}

View File

@ -1463,9 +1463,9 @@ void CStateManager::ApplyRadiusDamage(const CActor& a1, const zeus::CVector3f& p
}
bool CStateManager::TestRayDamage(const zeus::CVector3f& pos, const CActor& damagee,
const rstl::reserved_vector<TUniqueId, 1024>& nearList)
const rstl::reserved_vector<TUniqueId, 1024>& nearList) const
{
const CHealthInfo* hInfo = const_cast<CActor&>(damagee).HealthInfo(*this);
const CHealthInfo* hInfo = const_cast<CActor&>(damagee).HealthInfo(const_cast<CStateManager&>(*this));
if (!hInfo)
return false;
@ -1505,7 +1505,7 @@ bool CStateManager::TestRayDamage(const zeus::CVector3f& pos, const CActor& dama
}
bool CStateManager::RayCollideWorld(const zeus::CVector3f& start, const zeus::CVector3f& end,
const CMaterialFilter& filter, const CActor& damagee)
const CMaterialFilter& filter, const CActor& damagee) const
{
zeus::CVector3f delta = end - start;
float mag = delta.magnitude();
@ -1517,7 +1517,7 @@ bool CStateManager::RayCollideWorld(const zeus::CVector3f& start, const zeus::CV
bool CStateManager::RayCollideWorld(const zeus::CVector3f& start, const zeus::CVector3f& end,
const rstl::reserved_vector<TUniqueId, 1024>& nearList,
const CMaterialFilter& filter, const CActor& damagee)
const CMaterialFilter& filter, const CActor& damagee) const
{
return RayCollideWorldInternal(start, end, filter, nearList, &damagee);
}
@ -1525,7 +1525,7 @@ bool CStateManager::RayCollideWorld(const zeus::CVector3f& start, const zeus::CV
bool CStateManager::RayCollideWorldInternal(const zeus::CVector3f& start, const zeus::CVector3f& end,
const CMaterialFilter& filter,
const rstl::reserved_vector<TUniqueId, 1024>& nearList,
const CActor* damagee)
const CActor* damagee) const
{
zeus::CVector3f delta = end - start;
if (!delta.canBeNormalized())
@ -1538,7 +1538,7 @@ bool CStateManager::RayCollideWorldInternal(const zeus::CVector3f& start, const
return CGameCollision::RayDynamicIntersectionBool(*this, start, dir, filter, nearList, damagee, mag);
}
bool CStateManager::MultiRayCollideWorld(const zeus::CMRay& ray, const CMaterialFilter& filter)
bool CStateManager::MultiRayCollideWorld(const zeus::CMRay& ray, const CMaterialFilter& filter) const
{
zeus::CVector3f crossed =
{

View File

@ -306,17 +306,17 @@ public:
void ApplyRadiusDamage(const CActor&, const zeus::CVector3f&, CActor&,
const CDamageInfo& info);
bool TestRayDamage(const zeus::CVector3f& pos, const CActor& damagee,
const rstl::reserved_vector<TUniqueId, 1024>& nearList);
const rstl::reserved_vector<TUniqueId, 1024>& nearList) const;
bool RayCollideWorld(const zeus::CVector3f& start, const zeus::CVector3f& end,
const CMaterialFilter& filter, const CActor& damagee);
const CMaterialFilter& filter, const CActor& damagee) const;
bool RayCollideWorld(const zeus::CVector3f& start, const zeus::CVector3f& end,
const rstl::reserved_vector<TUniqueId, 1024>& nearList,
const CMaterialFilter& filter, const CActor& damagee);
const CMaterialFilter& filter, const CActor& damagee) const;
bool RayCollideWorldInternal(const zeus::CVector3f& start, const zeus::CVector3f& end,
const CMaterialFilter& filter,
const rstl::reserved_vector<TUniqueId, 1024>& nearList,
const CActor* damagee);
bool MultiRayCollideWorld(const zeus::CMRay& ray, const CMaterialFilter& filter);
const CActor* damagee) const;
bool MultiRayCollideWorld(const zeus::CMRay& ray, const CMaterialFilter& filter) const;
void TestBombHittingWater(const CActor& damager, const zeus::CVector3f& pos, CActor& damagee);
bool ApplyLocalDamage(const zeus::CVector3f&, const zeus::CVector3f&, CActor&, float,
const CWeaponMode&);

View File

@ -84,8 +84,8 @@ bool CCollisionPrimitive::InternalCollide(const CInternalCollisionStructure& col
return false;
}
bool CCollisionPrimitive::Collide(CInternalCollisionStructure::CPrimDesc& prim0,
CInternalCollisionStructure::CPrimDesc& prim1,
bool CCollisionPrimitive::Collide(const CInternalCollisionStructure::CPrimDesc& prim0,
const CInternalCollisionStructure::CPrimDesc& prim1,
CCollisionInfoList& list)
{
return InternalCollide({prim0, prim1}, list);
@ -138,8 +138,8 @@ bool CCollisionPrimitive::InternalCollideBoolean(const CInternalCollisionStructu
return InternalCollide(collision, list);
}
bool CCollisionPrimitive::CollideBoolean(CInternalCollisionStructure::CPrimDesc& prim0,
CInternalCollisionStructure::CPrimDesc& prim1)
bool CCollisionPrimitive::CollideBoolean(const CInternalCollisionStructure::CPrimDesc& prim0,
const CInternalCollisionStructure::CPrimDesc& prim1)
{
return InternalCollideBoolean({prim0, prim1});
}
@ -173,8 +173,8 @@ bool CCollisionPrimitive::InternalCollideMoving(const CInternalCollisionStructur
return false;
}
bool CCollisionPrimitive::CollideMoving(CInternalCollisionStructure::CPrimDesc& prim0,
CInternalCollisionStructure::CPrimDesc& prim1,
bool CCollisionPrimitive::CollideMoving(const CInternalCollisionStructure::CPrimDesc& prim0,
const CInternalCollisionStructure::CPrimDesc& prim1,
const zeus::CVector3f& dir,
double& dOut,
CCollisionInfo& infoOut)

View File

@ -150,13 +150,13 @@ public:
CRayCastResult CastRay(const zeus::CVector3f& start, const zeus::CVector3f& dir, float length,
const CMaterialFilter& filter, const zeus::CTransform& xf) const;
static bool Collide(CInternalCollisionStructure::CPrimDesc& prim0,
CInternalCollisionStructure::CPrimDesc& prim1,
static bool Collide(const CInternalCollisionStructure::CPrimDesc& prim0,
const CInternalCollisionStructure::CPrimDesc& prim1,
CCollisionInfoList& list);
static bool CollideBoolean(CInternalCollisionStructure::CPrimDesc& prim0,
CInternalCollisionStructure::CPrimDesc& prim1);
static bool CollideMoving(CInternalCollisionStructure::CPrimDesc& prim0,
CInternalCollisionStructure::CPrimDesc& prim1,
static bool CollideBoolean(const CInternalCollisionStructure::CPrimDesc& prim0,
const CInternalCollisionStructure::CPrimDesc& prim1);
static bool CollideMoving(const CInternalCollisionStructure::CPrimDesc& prim0,
const CInternalCollisionStructure::CPrimDesc& prim1,
const zeus::CVector3f& dir,
double& dOut,
CCollisionInfo& infoOut);

View File

@ -399,7 +399,7 @@ bool CGameCollision::RayStaticIntersectionArea(const CGameArea& area, const zeus
return node.LineTest(line, filter, mag);
}
void CGameCollision::BuildAreaCollisionCache(CStateManager& mgr, CAreaCollisionCache& cache)
void CGameCollision::BuildAreaCollisionCache(const CStateManager& mgr, CAreaCollisionCache& cache)
{
cache.ClearCache();
for (const CGameArea& area : *mgr.GetWorld())
@ -434,7 +434,7 @@ float CGameCollision::GetMinExtentForCollisionPrimitive(const CCollisionPrimitiv
return 1.f;
}
bool CGameCollision::DetectCollisionBoolean(CStateManager& mgr, const CCollisionPrimitive& prim,
bool CGameCollision::DetectCollisionBoolean(const CStateManager& mgr, const CCollisionPrimitive& prim,
const zeus::CTransform& xf, const CMaterialFilter& filter,
const rstl::reserved_vector<TUniqueId, 1024>& nearList)
{
@ -446,7 +446,7 @@ bool CGameCollision::DetectCollisionBoolean(CStateManager& mgr, const CCollision
return false;
}
bool CGameCollision::DetectCollisionBoolean_Cached(CStateManager& mgr, CAreaCollisionCache& cache,
bool CGameCollision::DetectCollisionBoolean_Cached(const CStateManager& mgr, CAreaCollisionCache& cache,
const CCollisionPrimitive& prim, const zeus::CTransform& xf,
const CMaterialFilter& filter,
const rstl::reserved_vector<TUniqueId, 1024>& nearList)
@ -459,7 +459,7 @@ bool CGameCollision::DetectCollisionBoolean_Cached(CStateManager& mgr, CAreaColl
return false;
}
bool CGameCollision::DetectStaticCollisionBoolean(CStateManager& mgr, const CCollisionPrimitive& prim,
bool CGameCollision::DetectStaticCollisionBoolean(const CStateManager& mgr, const CCollisionPrimitive& prim,
const zeus::CTransform& xf, const CMaterialFilter& filter)
{
if (prim.GetPrimType() == FOURCC('OBTG'))
@ -495,7 +495,7 @@ bool CGameCollision::DetectStaticCollisionBoolean(CStateManager& mgr, const CCol
return false;
}
bool CGameCollision::DetectStaticCollisionBoolean_Cached(CStateManager& mgr, CAreaCollisionCache& cache,
bool CGameCollision::DetectStaticCollisionBoolean_Cached(const CStateManager& mgr, CAreaCollisionCache& cache,
const CCollisionPrimitive& prim, const zeus::CTransform& xf,
const CMaterialFilter& filter)
{
@ -538,11 +538,11 @@ bool CGameCollision::DetectStaticCollisionBoolean_Cached(CStateManager& mgr, CAr
bool CGameCollision::DetectDynamicCollisionBoolean(const CCollisionPrimitive& prim, const zeus::CTransform& xf,
const rstl::reserved_vector<TUniqueId, 1024>& nearList,
CStateManager& mgr)
const CStateManager& mgr)
{
for (TUniqueId id : nearList)
{
if (TCastToPtr<CPhysicsActor> actor = mgr.ObjectById(id))
if (TCastToConstPtr<CPhysicsActor> actor = mgr.GetObjectById(id))
{
CInternalCollisionStructure::CPrimDesc p0(prim, CMaterialFilter::skPassEverything, xf);
CInternalCollisionStructure::CPrimDesc p1(*actor->GetCollisionPrimitive(),
@ -556,7 +556,7 @@ bool CGameCollision::DetectDynamicCollisionBoolean(const CCollisionPrimitive& pr
return false;
}
bool CGameCollision::DetectCollision_Cached(CStateManager& mgr, CAreaCollisionCache& cache,
bool CGameCollision::DetectCollision_Cached(const CStateManager& mgr, CAreaCollisionCache& cache,
const CCollisionPrimitive& prim, const zeus::CTransform& xf,
const CMaterialFilter& filter,
const rstl::reserved_vector<TUniqueId, 1024>& nearList,
@ -578,7 +578,7 @@ bool CGameCollision::DetectCollision_Cached(CStateManager& mgr, CAreaCollisionCa
return ret;
}
bool CGameCollision::DetectCollision_Cached_Moving(CStateManager& mgr, CAreaCollisionCache& cache,
bool CGameCollision::DetectCollision_Cached_Moving(const CStateManager& mgr, CAreaCollisionCache& cache,
const CCollisionPrimitive& prim, const zeus::CTransform& xf,
const CMaterialFilter& filter,
const rstl::reserved_vector<TUniqueId, 1024>& nearList,
@ -595,7 +595,7 @@ bool CGameCollision::DetectCollision_Cached_Moving(CStateManager& mgr, CAreaColl
return CGameCollision::DetectDynamicCollisionMoving(prim, xf, nearList, dir, idOut, infoOut, d, mgr);
}
bool CGameCollision::DetectStaticCollision(CStateManager& mgr, const CCollisionPrimitive& prim,
bool CGameCollision::DetectStaticCollision(const CStateManager& mgr, const CCollisionPrimitive& prim,
const zeus::CTransform& xf, const CMaterialFilter& filter,
CCollisionInfoList& list)
{
@ -634,7 +634,7 @@ bool CGameCollision::DetectStaticCollision(CStateManager& mgr, const CCollisionP
return false;
}
bool CGameCollision::DetectStaticCollision_Cached(CStateManager& mgr, CAreaCollisionCache& cache,
bool CGameCollision::DetectStaticCollision_Cached(const CStateManager& mgr, CAreaCollisionCache& cache,
const CCollisionPrimitive& prim, const zeus::CTransform& xf,
const CMaterialFilter& filter, CCollisionInfoList& list)
{
@ -677,7 +677,7 @@ bool CGameCollision::DetectStaticCollision_Cached(CStateManager& mgr, CAreaColli
return false;
}
bool CGameCollision::DetectStaticCollision_Cached_Moving(CStateManager& mgr, CAreaCollisionCache& cache,
bool CGameCollision::DetectStaticCollision_Cached_Moving(const CStateManager& mgr, CAreaCollisionCache& cache,
const CCollisionPrimitive& prim, const zeus::CTransform& xf,
const CMaterialFilter& filter, const zeus::CVector3f& dir,
CCollisionInfo& infoOut, double& dOut)
@ -737,11 +737,11 @@ bool CGameCollision::DetectStaticCollision_Cached_Moving(CStateManager& mgr, CAr
bool CGameCollision::DetectDynamicCollision(const CCollisionPrimitive& prim, const zeus::CTransform& xf,
const rstl::reserved_vector<TUniqueId, 1024>& nearList,
TUniqueId& idOut, CCollisionInfoList& list, CStateManager& mgr)
TUniqueId& idOut, CCollisionInfoList& list, const CStateManager& mgr)
{
for (TUniqueId id : nearList)
{
if (TCastToPtr<CPhysicsActor> actor = mgr.ObjectById(id))
if (TCastToConstPtr<CPhysicsActor> actor = mgr.GetObjectById(id))
{
CInternalCollisionStructure::CPrimDesc p0(prim, CMaterialFilter::skPassEverything, xf);
CInternalCollisionStructure::CPrimDesc p1(*actor->GetCollisionPrimitive(),
@ -761,14 +761,14 @@ bool CGameCollision::DetectDynamicCollision(const CCollisionPrimitive& prim, con
bool CGameCollision::DetectDynamicCollisionMoving(const CCollisionPrimitive& prim, const zeus::CTransform& xf,
const rstl::reserved_vector<TUniqueId, 1024>& nearList,
const zeus::CVector3f& dir, TUniqueId& idOut,
CCollisionInfo& infoOut, double& dOut, CStateManager& mgr)
CCollisionInfo& infoOut, double& dOut, const CStateManager& mgr)
{
bool ret = false;
for (TUniqueId id : nearList)
{
double d = dOut;
CCollisionInfo info;
if (TCastToPtr<CPhysicsActor> actor = mgr.ObjectById(id))
if (TCastToConstPtr<CPhysicsActor> actor = mgr.GetObjectById(id))
{
CInternalCollisionStructure::CPrimDesc p0(prim, CMaterialFilter::skPassEverything, xf);
CInternalCollisionStructure::CPrimDesc p1(*actor->GetCollisionPrimitive(),
@ -968,7 +968,7 @@ void CGameCollision::CollideWithStaticBodyNoRot(CPhysicsActor& a0, const CMateri
}
}
void CGameCollision::CollisionFailsafe(CStateManager& mgr, CAreaCollisionCache& cache,
void CGameCollision::CollisionFailsafe(const CStateManager& mgr, CAreaCollisionCache& cache,
CPhysicsActor& actor, const CCollisionPrimitive& prim,
const rstl::reserved_vector<TUniqueId, 1024>& nearList,
float f1, u32 failsafeTicks)
@ -1025,7 +1025,7 @@ void CGameCollision::CollisionFailsafe(CStateManager& mgr, CAreaCollisionCache&
}
std::experimental::optional<zeus::CVector3f>
CGameCollision::FindNonIntersectingVector(CStateManager& mgr, CAreaCollisionCache& cache,
CGameCollision::FindNonIntersectingVector(const CStateManager& mgr, CAreaCollisionCache& cache,
CPhysicsActor& actor, const CCollisionPrimitive& prim,
const rstl::reserved_vector<TUniqueId, 1024>& nearList)
{

View File

@ -61,51 +61,51 @@ public:
const rstl::reserved_vector<TUniqueId, 1024>& nearList);
static bool RayStaticIntersectionArea(const CGameArea& area, const zeus::CVector3f& pos,
const zeus::CVector3f& dir, float mag, const CMaterialFilter& filter);
static void BuildAreaCollisionCache(CStateManager& mgr, CAreaCollisionCache& cache);
static void BuildAreaCollisionCache(const CStateManager& mgr, CAreaCollisionCache& cache);
static float GetMinExtentForCollisionPrimitive(const CCollisionPrimitive& prim);
static bool DetectCollisionBoolean(CStateManager& mgr, const CCollisionPrimitive& prim,
static bool DetectCollisionBoolean(const CStateManager& mgr, const CCollisionPrimitive& prim,
const zeus::CTransform& xf, const CMaterialFilter& filter,
const rstl::reserved_vector<TUniqueId, 1024>& nearList);
static bool DetectCollisionBoolean_Cached(CStateManager& mgr, CAreaCollisionCache& cache,
static bool DetectCollisionBoolean_Cached(const CStateManager& mgr, CAreaCollisionCache& cache,
const CCollisionPrimitive& prim, const zeus::CTransform& xf,
const CMaterialFilter& filter,
const rstl::reserved_vector<TUniqueId, 1024>& nearList);
static bool DetectStaticCollisionBoolean(CStateManager& mgr, const CCollisionPrimitive& prim,
static bool DetectStaticCollisionBoolean(const CStateManager& mgr, const CCollisionPrimitive& prim,
const zeus::CTransform& xf, const CMaterialFilter& filter);
static bool DetectStaticCollisionBoolean_Cached(CStateManager& mgr, CAreaCollisionCache& cache,
static bool DetectStaticCollisionBoolean_Cached(const CStateManager& mgr, CAreaCollisionCache& cache,
const CCollisionPrimitive& prim, const zeus::CTransform& xf,
const CMaterialFilter& filter);
static bool DetectDynamicCollisionBoolean(const CCollisionPrimitive& prim, const zeus::CTransform& xf,
const rstl::reserved_vector<TUniqueId, 1024>& nearList,
CStateManager& mgr);
static bool DetectCollision_Cached(CStateManager& mgr, CAreaCollisionCache& cache,
const CStateManager& mgr);
static bool DetectCollision_Cached(const CStateManager& mgr, CAreaCollisionCache& cache,
const CCollisionPrimitive& prim, const zeus::CTransform& xf,
const CMaterialFilter& filter,
const rstl::reserved_vector<TUniqueId, 1024>& nearList,
TUniqueId& idOut, CCollisionInfoList& infoList);
static bool DetectCollision_Cached_Moving(CStateManager& mgr, CAreaCollisionCache& cache,
static bool DetectCollision_Cached_Moving(const CStateManager& mgr, CAreaCollisionCache& cache,
const CCollisionPrimitive& prim, const zeus::CTransform& xf,
const CMaterialFilter& filter,
const rstl::reserved_vector<TUniqueId, 1024>& nearList,
const zeus::CVector3f& vec,
TUniqueId& idOut, CCollisionInfo& infoOut, double&);
static bool DetectStaticCollision(CStateManager& mgr, const CCollisionPrimitive& prim,
static bool DetectStaticCollision(const CStateManager& mgr, const CCollisionPrimitive& prim,
const zeus::CTransform& xf, const CMaterialFilter& filter,
CCollisionInfoList& list);
static bool DetectStaticCollision_Cached(CStateManager& mgr, CAreaCollisionCache& cache,
static bool DetectStaticCollision_Cached(const CStateManager& mgr, CAreaCollisionCache& cache,
const CCollisionPrimitive& prim, const zeus::CTransform& xf,
const CMaterialFilter& filter, CCollisionInfoList& list);
static bool DetectStaticCollision_Cached_Moving(CStateManager& mgr, CAreaCollisionCache& cache,
static bool DetectStaticCollision_Cached_Moving(const CStateManager& mgr, CAreaCollisionCache& cache,
const CCollisionPrimitive& prim, const zeus::CTransform& xf,
const CMaterialFilter& filter, const zeus::CVector3f& vec,
CCollisionInfo& infoOut, double& d);
static bool DetectDynamicCollision(const CCollisionPrimitive& prim, const zeus::CTransform& xf,
const rstl::reserved_vector<TUniqueId, 1024>& nearList,
TUniqueId& idOut, CCollisionInfoList& list, CStateManager& mgr);
TUniqueId& idOut, CCollisionInfoList& list, const CStateManager& mgr);
static bool DetectDynamicCollisionMoving(const CCollisionPrimitive& prim, const zeus::CTransform& xf,
const rstl::reserved_vector<TUniqueId, 1024>& nearList,
const zeus::CVector3f& vec, TUniqueId& idOut,
CCollisionInfo& infoOut, double& d, CStateManager& mgr);
CCollisionInfo& infoOut, double& d, const CStateManager& mgr);
static void MakeCollisionCallbacks(CStateManager& mgr, CPhysicsActor& actor, TUniqueId id,
const CCollisionInfoList& list);
static void SendScriptMessages(CStateManager& mgr, CActor& a0, CActor* a1, const CCollisionInfoList& list);
@ -114,12 +114,12 @@ public:
float restitution, bool);
static void CollideWithStaticBodyNoRot(CPhysicsActor& a0, const CMaterialList& m0, const CMaterialList& m1,
const zeus::CUnitVector3f& normal, float restitution, bool);
static void CollisionFailsafe(CStateManager& mgr, CAreaCollisionCache& cache,
static void CollisionFailsafe(const CStateManager& mgr, CAreaCollisionCache& cache,
CPhysicsActor& actor, const CCollisionPrimitive& prim,
const rstl::reserved_vector<TUniqueId, 1024>& nearList,
float, u32 failsafeTicks);
static std::experimental::optional<zeus::CVector3f>
FindNonIntersectingVector(CStateManager& mgr, CAreaCollisionCache& cache,
FindNonIntersectingVector(const CStateManager& mgr, CAreaCollisionCache& cache,
CPhysicsActor& actor, const CCollisionPrimitive& prim,
const rstl::reserved_vector<TUniqueId, 1024>& nearList);
};

View File

@ -122,28 +122,28 @@ public:
bool DLALeft() const {return x8_anaLeftX < -0.7f;}
bool DLADown() const {return xc_anaLeftY < -0.7f;}
bool DLAUp() const {return xc_anaLeftY > 0.7f;}
float AStart() const {return x2d_b27_Start ? 1.0 : 0.0;}
float AR() const {return x2c_b30_R ? 1.0 : 0.0;}
float AL() const {return x2c_b29_L ? 1.0 : 0.0;}
float AZ() const {return x2c_b28_Z ? 1.0 : 0.0;}
float AY() const {return x2c_b27_Y ? 1.0 : 0.0;}
float AX() const {return x2c_b26_X ? 1.0 : 0.0;}
float AB() const {return x2c_b25_B ? 1.0 : 0.0;}
float AA() const {return x2c_b24_A ? 1.0 : 0.0;}
float ADPRight() const {return x2d_b24_DPRight ? 1.0 : 0.0;}
float ADPLeft() const {return x2d_b26_DPLeft ? 1.0 : 0.0;}
float ADPDown() const {return x2d_b25_DPDown ? 1.0 : 0.0;}
float ADPUp() const {return x2c_b31_DPUp ? 1.0 : 0.0;}
float AStart() const {return x2d_b27_Start ? 1.f : 0.f;}
float AR() const {return x2c_b30_R ? 1.f : 0.f;}
float AL() const {return x2c_b29_L ? 1.f : 0.f;}
float AZ() const {return x2c_b28_Z ? 1.f : 0.f;}
float AY() const {return x2c_b27_Y ? 1.f : 0.f;}
float AX() const {return x2c_b26_X ? 1.f : 0.f;}
float AB() const {return x2c_b25_B ? 1.f : 0.f;}
float AA() const {return x2c_b24_A ? 1.f : 0.f;}
float ADPRight() const {return x2d_b24_DPRight ? 1.f : 0.f;}
float ADPLeft() const {return x2d_b26_DPLeft ? 1.f : 0.f;}
float ADPDown() const {return x2d_b25_DPDown ? 1.f : 0.f;}
float ADPUp() const {return x2c_b31_DPUp ? 1.f : 0.f;}
float ARTrigger() const {return x1c_anaRightTrigger;}
float ALTrigger() const {return x18_anaLeftTrigger;}
float ARARight() const {return x10_anaRightX > 0.0 ? x10_anaRightX : 0.0;}
float ARALeft() const {return x10_anaRightX < 0.0 ? -x10_anaRightX : 0.0;}
float ARADown() const {return x14_anaRightY < 0.0 ? -x14_anaRightY : 0.0;}
float ARAUp() const {return x14_anaRightY > 0.0 ? x14_anaRightY : 0.0;}
float ALARight() const {return x8_anaLeftX > 0.0 ? x8_anaLeftX : 0.0;}
float ALALeft() const {return x8_anaLeftX < 0.0 ? -x8_anaLeftX : 0.0;}
float ALADown() const {return xc_anaLeftY < 0.0 ? -xc_anaLeftY : 0.0;}
float ALAUp() const {return xc_anaLeftY > 0.0 ? xc_anaLeftY : 0.0;}
float ARARight() const {return x10_anaRightX > 0.f ? x10_anaRightX : 0.f;}
float ARALeft() const {return x10_anaRightX < 0.f ? -x10_anaRightX : 0.f;}
float ARADown() const {return x14_anaRightY < 0.f ? -x14_anaRightY : 0.f;}
float ARAUp() const {return x14_anaRightY > 0.f ? x14_anaRightY : 0.f;}
float ALARight() const {return x8_anaLeftX > 0.f ? x8_anaLeftX : 0.f;}
float ALALeft() const {return x8_anaLeftX < 0.f ? -x8_anaLeftX : 0.f;}
float ALADown() const {return xc_anaLeftY < 0.f ? -xc_anaLeftY : 0.f;}
float ALAUp() const {return xc_anaLeftY > 0.f ? xc_anaLeftY : 0.f;}
float ALeftX() const {return x8_anaLeftX;}
float ALeftY() const {return xc_anaLeftY;}

View File

@ -161,6 +161,12 @@ public:
FourCC Get4CharId() const { return FOURCC('SWHC'); }
void SetRenderGaps(bool r) { x1d0_27_renderGaps = r; }
void DoBallSwooshWarmup()
{
x1d0_26_disableUpdate = true;
Update(0.0);
}
void DoElectricWarmup()
{
for (int i=0 ; i<x15c_swooshes.size() ; ++i)

View File

@ -1,3 +1,4 @@
#include <Runtime/Input/ControlMapper.hpp>
#include "GameGlobalObjects.hpp"
#include "CDependencyGroup.hpp"
#include "CMorphBall.hpp"
@ -7,6 +8,8 @@
#include "World/CWorld.hpp"
#include "World/CScriptAreaAttributes.hpp"
#include "TCastTo.hpp"
#include "Camera/CGameCamera.hpp"
#include "Collision/CGameCollision.hpp"
namespace urde
{
@ -62,7 +65,7 @@ CMorphBall::CMorphBall(CPlayer& player, float radius)
x1df8_24_inHalfPipeMode = false;
x1df8_25_inHalfPipeModeInAir = false;
x1df8_26_touchedHalfPipeRecently = false;
x1df8_27 = false;
x1df8_27_ballCloseToCollision = false;
x19d4_spiderBallMagnetEffectGen->SetParticleEmission(false);
x19d4_spiderBallMagnetEffectGen->Update(1.0 / 60.0);
@ -352,24 +355,35 @@ float CMorphBall::GetBallTouchRadius() const
return g_tweakBall->GetBallTouchRadius();
}
void CMorphBall::ForwardInput(const CFinalInput&) const
float CMorphBall::ForwardInput(const CFinalInput& input) const
{
if (!IsMovementAllowed())
return 0.f;
return ControlMapper::GetAnalogInput(ControlMapper::ECommands::Forward, input) -
ControlMapper::GetAnalogInput(ControlMapper::ECommands::Backward, input);
}
void CMorphBall::BallTurnInput(const CFinalInput&) const
float CMorphBall::BallTurnInput(const CFinalInput& input) const
{
if (!IsMovementAllowed())
return 0.f;
return ControlMapper::GetAnalogInput(ControlMapper::ECommands::TurnLeft, input) -
ControlMapper::GetAnalogInput(ControlMapper::ECommands::TurnRight, input);
}
void CMorphBall::ComputeBallMovement(const CFinalInput&, CStateManager&, float)
void CMorphBall::ComputeBallMovement(const CFinalInput& input, CStateManager& mgr, float dt)
{
ComputeBoostBallMovement(input, mgr, dt);
ComputeMarioMovement(input, mgr, dt);
}
bool CMorphBall::IsMovementAllowed() const
{
return false;
if (!g_tweakPlayer->GetMoveDuringFreeLook() && (x0_player.x3dc_inFreeLook || x0_player.x3dd_lookButtonHeld))
return false;
if (x0_player.IsMorphBallTransitioning())
return false;
return x1e00_ <= 0.f;
}
void CMorphBall::UpdateSpiderBall(const CFinalInput&, CStateManager&, float)
@ -382,6 +396,12 @@ void CMorphBall::ApplySpiderBallSwingingForces(const CFinalInput&, CStateManager
}
zeus::CVector3f CMorphBall::TransformSpiderBallForcesToView(const zeus::CVector2f& forces, CStateManager& mgr)
{
return mgr.GetCameraManager()->GetCurrentCamera(mgr)->GetTransform().basis *
zeus::CVector3f(forces.x, forces.y, 0.f);
}
void CMorphBall::ApplySpiderBallRollForces(const CFinalInput&, CStateManager&, float)
{
@ -435,14 +455,148 @@ void CMorphBall::CreateSpiderBallParticles(const zeus::CVector3f&, const zeus::C
}
void CMorphBall::ComputeMarioMovement(const CFinalInput&, CStateManager&, float)
void CMorphBall::ResetSpiderBallForces()
{
x190c_ = zeus::CVector2f();
x1914_ = 0.f;
x1918_ = 0.f;
x1920_ = true;
}
void CMorphBall::GetSwooshToWorld() const
void CMorphBall::ComputeMarioMovement(const CFinalInput& input, CStateManager& mgr, float dt)
{
x1c_ = zeus::CVector3f::skZero;
x10_ = zeus::CVector3f::skZero;
if (!IsMovementAllowed())
return;
x188c_ = (ControlMapper::GetAnalogInput(ControlMapper::ECommands::SpiderBall, input) >= 0.5f / 100.f) ? 1.f : 0.f;
if (mgr.GetPlayerState()->HasPowerUp(CPlayerState::EItemType::SpiderBall) &&
x188c_ != 0.f && x191c_damageTimer == 0.f)
{
if (x187c_spiderBallState != ESpiderBallState::Active)
{
x18bd_ = false;
x187c_spiderBallState = ESpiderBallState::Active;
x18a8_initialSpiderBallUp = x189c_spiderBallDir = x0_player.GetTransform().basis[2];
}
UpdateSpiderBall(input, mgr, dt);
if (!x18bc_)
{
x187c_spiderBallState = ESpiderBallState::Inactive;
ResetSpiderBallForces();
}
}
else
{
x187c_spiderBallState = ESpiderBallState::Inactive;
ResetSpiderBallForces();
}
if (x187c_spiderBallState != ESpiderBallState::Active)
{
float forward = ForwardInput(input);
float turn = -BallTurnInput(input);
float maxSpeed = ComputeMaxSpeed();
float curSpeed = x0_player.GetVelocity().magnitude();
zeus::CTransform controlXf = zeus::lookAt(zeus::CVector3f::skZero, x0_player.x54c_controlDirFlat);
zeus::CVector3f controlVel = controlXf.transposeRotate(x0_player.GetVelocity());
float f28f = 0.f;
float f27f = 0.f;
if (std::fabs(turn) > 0.1f)
{
float f24 = turn * maxSpeed;
float f27 = f24 - controlVel.x;
float f3 = zeus::clamp(0.f, std::fabs(f27) / maxSpeed, 1.f);
float acc;
if ((controlVel.x > 0.f ? 1.f : -1.f) != (f24 > 0.f ? 1.f : -1.f) && curSpeed > 0.8f * maxSpeed)
acc = g_tweakBall->GetBallForwardBrakingAcceleration(int(x0_player.GetSurfaceRestraint()));
else
acc = g_tweakBall->GetMaxBallTranslationAcceleration(int(x0_player.GetSurfaceRestraint()));
if (f27 < 0.f)
f27f = -acc * f3;
else
f27f = acc * f3;
}
if (std::fabs(forward) > 0.1f)
{
float f24 = forward * maxSpeed;
float f25 = f24 - controlVel.y;
float f3 = zeus::clamp(0.f, std::fabs(f25) / maxSpeed, 1.f);
float acc;
if ((controlVel.y > 0.f ? 1.f : -1.f) != (f24 > 0.f ? 1.f : -1.f) && curSpeed > 0.8f * maxSpeed)
acc = g_tweakBall->GetBallForwardBrakingAcceleration(int(x0_player.GetSurfaceRestraint()));
else
acc = g_tweakBall->GetMaxBallTranslationAcceleration(int(x0_player.GetSurfaceRestraint()));
if (f25 < 0.f)
f28f = -acc * f3;
else
f28f = acc * f3;
}
if (f28f != 0.f || f27f != 0.f || x1de4_24 || GetIsInHalfPipeMode())
{
zeus::CVector3f controlForce = controlXf.rotate({0.f, f28f, 0.f}) + controlXf.rotate({f27f, 0.f, 0.f});
x1c_ = controlForce;
if (x1de4_24 && !GetIsInHalfPipeMode())
controlForce = x1924_surfaceToWorld.rotate({x1924_surfaceToWorld.transposeRotate(controlForce).x, 0.f, 0.f});
if (GetIsInHalfPipeMode() && controlForce.magnitude() > FLT_EPSILON)
{
if (GetIsInHalfPipeModeInAir() && curSpeed <= 15.f &&
controlForce.dot(x1924_surfaceToWorld.basis[2]) / controlForce.magnitude() < -0.85f)
{
DisableHalfPipeStatus();
x1e00_ = 0.2f;
x0_player.ApplyImpulseWR(x1924_surfaceToWorld.basis[2] * (x0_player.GetMass() * -7.5f),
zeus::CAxisAngle::sIdentity);
}
if (GetIsInHalfPipeMode())
{
controlForce -= controlForce.dot(x1924_surfaceToWorld.basis[2]) * x1924_surfaceToWorld.basis[2];
zeus::CVector3f x120 = x1924_surfaceToWorld.transposeRotate(controlForce);
x120.x *= 0.6f;
x120.y *= (x1de4_24 ? 0.f : 0.35f) * 1.4f;
controlForce = x1924_surfaceToWorld.rotate(x120);
if (maxSpeed > 95.f)
x0_player.SetVelocityWR(x0_player.GetVelocity() * 0.99f);
}
}
if (GetTouchedHalfPipeRecently())
{
float f1 = x1e08_.dot(x1e14_);
if (f1 < 0.99f && f1 > 0.5f)
{
zeus::CVector3f x1c8 = x1e08_.cross(x1e14_).normalized();
zeus::CVector3f newVel = x0_player.GetVelocity();
newVel -= x1c8 * x1c8.dot(x0_player.GetVelocity()) * 0.15f;
x0_player.SetVelocityWR(newVel);
}
}
float speedThres = 0.75f * maxSpeed;
if (curSpeed >= speedThres)
{
float dot = controlForce.dot(x0_player.GetVelocity().normalized());
if (dot > 0.f)
{
controlForce -= x0_player.GetVelocity().normalized() *
zeus::clamp(0.f, (curSpeed - speedThres) / (maxSpeed - speedThres), 1.f) * dot;
}
}
x10_ = controlForce;
x0_player.ApplyForceWR(controlForce, zeus::CAxisAngle::sIdentity);
}
ComputeLiftForces(x1c_, x0_player.GetVelocity(), mgr);
}
}
zeus::CTransform CMorphBall::GetSwooshToWorld() const
{
return zeus::CTransform::Translate(x0_player.GetTranslation() + zeus::CVector3f(0.f, 0.f, GetBallRadius())) *
x1924_surfaceToWorld.getRotation() * zeus::CTransform::RotateY(x30_ballTiltAngle);
}
zeus::CTransform CMorphBall::GetBallToWorld() const
@ -451,29 +605,124 @@ zeus::CTransform CMorphBall::GetBallToWorld() const
x0_player.GetTransform().getRotation();
}
void CMorphBall::CalculateSurfaceToWorld(const zeus::CVector3f&, const zeus::CVector3f&, const zeus::CVector3f&) const
zeus::CTransform CMorphBall::CalculateSurfaceToWorld(const zeus::CVector3f& trackNormal,
const zeus::CVector3f& trackPoint,
const zeus::CVector3f& ballDir) const
{
if (ballDir.canBeNormalized())
{
zeus::CVector3f forward = ballDir.normalized();
zeus::CVector3f right = ballDir.cross(trackNormal);
if (right.canBeNormalized())
return zeus::CTransform(right, forward, right.cross(forward).normalized(), trackPoint);
}
return zeus::CTransform::Identity();
}
void CMorphBall::CalculateBallContactInfo(zeus::CVector3f&, zeus::CVector3f&) const
bool CMorphBall::CalculateBallContactInfo(zeus::CVector3f& normal, zeus::CVector3f& point) const
{
if (x74_collisionInfos.GetCount() != 0)
{
normal = x74_collisionInfos.Front().GetNormalLeft();
point = x74_collisionInfos.Front().GetPoint();
return true;
}
return false;
}
void CMorphBall::UpdateBallDynamics(CStateManager&, float)
void CMorphBall::UpdateBallDynamics(CStateManager& mgr, float dt)
{
x0_player.SetAngularVelocityWR(x0_player.GetAngularVelocityWR().getVector() * 0.95f);
x1df8_27_ballCloseToCollision = BallCloseToCollision(mgr, kSpiderBallCollisionRadius,
CMaterialFilter::MakeInclude(EMaterialTypes::Solid));
UpdateHalfPipeStatus(mgr, dt);
x1e00_ -= dt;
x1e00_ = std::max(0.f, x1e00_);
x191c_damageTimer -= dt;
x191c_damageTimer = std::max(0.f, x191c_damageTimer);
if (x187c_spiderBallState == ESpiderBallState::Active)
{
x1924_surfaceToWorld = CalculateSurfaceToWorld(x1880_spiderTrackNormal,
x1890_spiderTrackPoint, x189c_spiderBallDir);
x2c_tireLeanAngle = 0.f;
if (!x28_tireMode)
SwitchToTire();
x1c2c_ = true;
x1c28_ = -1.f;
UpdateMarbleDynamics(mgr, dt, x1890_spiderTrackPoint);
}
else
{
if (x0_player.GetSurfaceRestraint() != CPlayer::ESurfaceRestraints::InAir)
{
zeus::CVector3f normal, point;
if (CalculateBallContactInfo(normal, point))
{
x1924_surfaceToWorld = CalculateSurfaceToWorld(normal, point, x0_player.x500_lookDir);
float speed = x0_player.GetVelocity().magnitude();
if (speed < g_tweakBall->GetTireToMarbleThresholdSpeed() && x28_tireMode)
SwitchToMarble();
if (UpdateMarbleDynamics(mgr, dt, point) &&
speed >= g_tweakBall->GetMarbleToTireThresholdSpeed() && !x28_tireMode)
SwitchToTire();
if (x28_tireMode)
{
x2c_tireLeanAngle = x0_player.GetTransform().transposeRotate(x0_player.GetForceOR()).x /
g_tweakBall->GetMaxBallTranslationAcceleration(int(x0_player.GetSurfaceRestraint())) *
g_tweakBall->GetMaxLeanAngle() * g_tweakBall->GetForceToLeanGain();
x2c_tireLeanAngle =
zeus::clamp(-g_tweakBall->GetMaxLeanAngle(), x2c_tireLeanAngle, g_tweakBall->GetMaxLeanAngle());
if (x0_player.GetTransform().basis[0].dot(x1924_surfaceToWorld.basis[0]) < 0.f)
{
x2c_tireLeanAngle = -x2c_tireLeanAngle;
}
}
}
}
else
{
x2c_tireLeanAngle = 0.f;
}
}
zeus::CRelAngle angle(x2c_tireLeanAngle - x30_ballTiltAngle);
float leanSpeed = std::fabs(angle) * g_tweakBall->GetMaxLeanAngle() * g_tweakBall->GetLeanTrackingGain();
if (angle.asRadians() > 0.05f)
x30_ballTiltAngle += leanSpeed * dt;
else if (angle.asRadians() < -0.05f)
x30_ballTiltAngle -= leanSpeed * dt;
else
x30_ballTiltAngle = x2c_tireLeanAngle;
if (x187c_spiderBallState != ESpiderBallState::Active)
ApplyFriction(CalculateSurfaceFriction());
else
DampLinearAndAngularVelocities(x18b4_, x18b8_);
if (x187c_spiderBallState != ESpiderBallState::Active)
ApplyGravity(mgr);
x74_collisionInfos.Clear();
x1c3c_quats.AddValue(zeus::CQuaternion(GetBallToWorld().basis));
x1c90_vecs.AddValue(GetBallToWorld().origin);
}
void CMorphBall::SwitchToMarble()
{
x0_player.SetTransform(x0_player.GetTransform() * zeus::CQuaternion::fromAxisAngle(
x0_player.GetTransform().transposeRotate(x0_player.x500_lookDir), x30_ballTiltAngle).toTransform());
x28_tireMode = false;
x1c2c_ = true;
x1c28_ = -1.f;
}
void CMorphBall::SwitchToTire()
{
x28_tireMode = true;
x1c2c_ = true;
x30_ballTiltAngle = 0.f;
x1c28_ = 1.f;
}
void CMorphBall::Update(float dt, CStateManager& mgr)
@ -523,42 +772,288 @@ void CMorphBall::Update(float dt, CStateManager& mgr)
UpdateMorphBallSounds(dt);
}
void CMorphBall::UpdateScriptMessage(EScriptObjectMessage, TUniqueId, CStateManager&)
void CMorphBall::DeleteLight(CStateManager& mgr)
{
if (x1c10_ballInnerGlowLight != kInvalidUniqueId)
{
mgr.FreeScriptObject(x1c10_ballInnerGlowLight);
x1c10_ballInnerGlowLight = kInvalidUniqueId;
}
}
void CMorphBall::DeleteLight(CStateManager&)
void CMorphBall::SetBallLightActive(CStateManager& mgr, bool active)
{
if (x1c10_ballInnerGlowLight != kInvalidUniqueId)
if (TCastToPtr<CGameLight> light = mgr.ObjectById(x1c10_ballInnerGlowLight))
light->SetActive(active);
}
void CMorphBall::SetBallLightActive(CStateManager&, bool)
void CMorphBall::EnterMorphBallState(CStateManager& mgr)
{
x1c20_ = 0.f;
UpdateEffects(0.f, mgr);
x187c_spiderBallState = ESpiderBallState::Inactive;
CAnimPlaybackParms parms(0, -1, 1.f, true);
x58_ballModel->AnimationData()->SetAnimation(parms, false);
x1e20_ = 0;
StopEffects();
x1c30_ = 0.f;
x1c34_ = 0.f;
x1c38_ = 0.f;
DisableHalfPipeStatus();
x30_ballTiltAngle = 0.f;
x2c_tireLeanAngle = 0.f;
}
void CMorphBall::EnterMorphBallState(CStateManager&)
void CMorphBall::LeaveMorphBallState(CStateManager& mgr)
{
LeaveBoosting();
CancelBoosting();
CSfxManager::SfxStop(x1e24_boostSfxHandle);
StopEffects();
}
void CMorphBall::LeaveMorphBallState(CStateManager&)
static const u8 skBallInnerGlowColors[9][3] =
{
{0xc2, 0x7e, 0x10},
{0x66, 0xc4, 0xff},
{0x60, 0xff, 0x90},
{0x33, 0x33, 0xff},
{0xff, 0x80, 0x80},
{0x0, 0x9d, 0xb6},
{0xd3, 0xf1, 0x0},
{0x60, 0x33, 0xff},
{0xfb, 0x98, 0x21}
};
void CMorphBall::UpdateEffects(float dt, CStateManager& mgr)
{
zeus::CTransform swooshToWorld = GetSwooshToWorld();
x19b8_slowBlueTailSwooshGen->SetTranslation(swooshToWorld.rotate({0.1f, 0.f, 0.f}) + swooshToWorld.origin);
x19b8_slowBlueTailSwooshGen->SetOrientation(swooshToWorld.getRotation());
x19b8_slowBlueTailSwooshGen->DoBallSwooshWarmup();
x19bc_slowBlueTailSwooshGen2->SetTranslation(swooshToWorld.rotate({-0.1f, 0.f, 0.f}) + swooshToWorld.origin);
x19bc_slowBlueTailSwooshGen2->SetOrientation(swooshToWorld.getRotation());
x19bc_slowBlueTailSwooshGen2->DoBallSwooshWarmup();
x19c0_slowBlueTailSwoosh2Gen->SetTranslation(swooshToWorld.rotate({0.f, 0.f, 0.65f}) + swooshToWorld.origin);
x19c0_slowBlueTailSwoosh2Gen->SetOrientation(swooshToWorld.getRotation());
x19c0_slowBlueTailSwoosh2Gen->DoBallSwooshWarmup();
x19c4_slowBlueTailSwoosh2Gen2->SetTranslation(swooshToWorld.rotate({0.f, 0.f, -0.65f}) + swooshToWorld.origin);
x19c4_slowBlueTailSwoosh2Gen2->SetOrientation(swooshToWorld.getRotation());
x19c4_slowBlueTailSwoosh2Gen2->DoBallSwooshWarmup();
x19c8_jaggyTrailGen->SetTranslation(swooshToWorld.origin);
x19c8_jaggyTrailGen->SetOrientation(swooshToWorld.getRotation());
x19c8_jaggyTrailGen->DoBallSwooshWarmup();
x19cc_wallSparkGen->Update(dt);
x1bcc_[7]->Update(dt);
bool emitRainWake = (x0_player.GetPlayerMovementState() == CPlayer::EPlayerMovementState::OnGround &&
mgr.GetWorld()->GetNeededEnvFx() == EEnvFxType::Rain &&
mgr.GetEnvFxManager()->GetRainMagnitude() > 0.f &&
mgr.GetEnvFxManager()->GetX24());
x1bcc_[7]->SetParticleEmission(emitRainWake);
float rainGenRate = std::min(mgr.GetEnvFxManager()->GetRainMagnitude() * 2.f *
x0_player.x4fc_flatMoveSpeed / x0_player.GetBallMaxVelocity(), 1.f);
x1bcc_[7]->SetGeneratorRate(rainGenRate);
x1bcc_[7]->SetTranslation(x0_player.GetTranslation());
if (emitRainWake)
{
zeus::CTransform rainOrient = zeus::lookAt(x0_player.x50c_moveDir + x0_player.GetTranslation(),
x0_player.GetTranslation());
x1bcc_[7]->SetOrientation(rainOrient);
}
if (x1c0c_wakeEffectIdx != -1)
x1bcc_[x1c0c_wakeEffectIdx]->Update(dt);
if (x1e38_wallSparkFrameCountdown > 0)
{
x1e38_wallSparkFrameCountdown -= 1;
if (x1e38_wallSparkFrameCountdown <= 0)
x19cc_wallSparkGen->SetParticleEmission(false);
}
x19d0_ballInnerGlowGen->SetGlobalTranslation(swooshToWorld.origin);
x19d0_ballInnerGlowGen->Update(dt);
if (x1de8_boostChargeTime == 0.f && x1df4_boostDrainTime == 0.f)
{
x19d8_boostBallGlowGen->SetModulationColor(zeus::CColor::skClear);
}
else
{
x19d8_boostBallGlowGen->SetGlobalTranslation(swooshToWorld.origin);
float t;
if (x1df4_boostDrainTime == 0.f)
t = x1de8_boostChargeTime / g_tweakBall->GetBoostBallMaxChargeTime();
else
t = 1.f - x1df4_boostDrainTime / g_tweakBall->GetBoostBallDrainTime();
x19d8_boostBallGlowGen->SetModulationColor(
zeus::CColor::lerp(zeus::CColor::skBlack, zeus::CColor(1.f, 1.f, 0.4f, 1.f), t));
x19d8_boostBallGlowGen->Update(dt);
}
x19d4_spiderBallMagnetEffectGen->Update(dt);
x1c30_ -= 0.03f;
x1c30_ = std::max(0.f, x1c30_);
if (x1c30_ == 0.f)
{
x1c34_ -= 0.04f;
x1c34_ = std::max(0.f, x1c34_);
}
if (x1de4_24)
{
x1c30_ = 1.f;
x1c34_ = 1.f;
}
else
{
x1c34_ = std::max(x1de8_boostChargeTime / g_tweakBall->GetBoostBallMaxChargeTime(), x1c34_);
x1c34_ = std::min(x1c34_, 1.f);
}
UpdateMorphBallTransitionFlash(dt);
UpdateIceBreakEffect(dt);
if (x1c10_ballInnerGlowLight != kInvalidUniqueId)
{
if (TCastToPtr<CGameLight> light = mgr.ObjectById(x1c10_ballInnerGlowLight))
{
light->SetTranslation(swooshToWorld.origin + zeus::CVector3f(0.f, 0.f, GetBallRadius()));
std::experimental::optional<CLight> lObj;
if (IsMorphBallTransitionFlashValid() && x19dc_morphBallTransitionFlashGen->SystemHasLight())
lObj.emplace(x19dc_morphBallTransitionFlashGen->GetLight());
else if (x19d0_ballInnerGlowGen->SystemHasLight())
lObj.emplace(x19d0_ballInnerGlowGen->GetLight());
if (lObj)
{
const u8* c = skBallInnerGlowColors[x8_ballGlowColorIdx];
zeus::CColor color(c[0] / 255.f, c[1] / 255.f, c[2] / 255.f, 1.f);
lObj->SetColor(lObj->GetColor() * c);
if (x0_player.GetMorphballTransitionState() == CPlayer::EPlayerMorphBallState::Unmorphing)
{
float t = 0.f;
if (x0_player.x578_morphDuration != 0.f)
t = zeus::clamp(0.f, x0_player.x574_morphTime / x0_player.x578_morphDuration, 1.f);
lObj->SetColor(zeus::CColor::lerp(lObj->GetColor(), zeus::CColor::skBlack, t));
}
else if (x0_player.GetMorphballTransitionState() == CPlayer::EPlayerMorphBallState::Morphing)
{
float t = 0.f;
if (x0_player.x578_morphDuration != 0.f)
t = zeus::clamp(0.f, x0_player.x574_morphTime / x0_player.x578_morphDuration, 1.f);
if (t < 0.5f)
lObj->SetColor(zeus::CColor::lerp(zeus::CColor::skBlack, lObj->GetColor(),
std::min(2.f * t, 1.f)));
}
else
{
lObj->SetColor(zeus::CColor::lerp(lObj->GetColor(), zeus::CColor::skWhite, x1c34_));
}
light->SetLight(*lObj);
}
}
}
if (x187c_spiderBallState == ESpiderBallState::Active)
{
AddSpiderBallElectricalEffect();
AddSpiderBallElectricalEffect();
AddSpiderBallElectricalEffect();
AddSpiderBallElectricalEffect();
AddSpiderBallElectricalEffect();
x1c38_ = std::min(x1c38_ + 0.25f, 1.f);
}
else
{
x1c38_ = std::max(0.f, x1c38_ - 0.15f);
}
UpdateSpiderBallElectricalEffects();
}
void CMorphBall::UpdateEffects(float, CStateManager&)
void CMorphBall::ComputeBoostBallMovement(const CFinalInput& input, CStateManager& mgr, float dt)
{
if (!IsMovementAllowed() || !mgr.GetPlayerState()->HasPowerUp(CPlayerState::EItemType::BoostBall))
return;
if (!x1de4_25)
{
CancelBoosting();
LeaveBoosting();
return;
}
if (!x1de4_24)
{
x1dec_ += dt;
if (ControlMapper::GetDigitalInput(ControlMapper::ECommands::JumpOrBoost, input) &&
x187c_spiderBallState != ESpiderBallState::Active)
{
if (x1e20_ == 0)
{
CAnimPlaybackParms parms(1, -1, 1.f, true);
x58_ballModel->AnimationData()->SetAnimation(parms, false);
x1e20_ = 1;
x1e24_boostSfxHandle = CSfxManager::SfxStart(1477, 1.f, 0.f, true, 0x7f, true, kInvalidAreaId);
}
x1de8_boostChargeTime += dt;
if (x1de8_boostChargeTime > g_tweakBall->GetBoostBallMaxChargeTime())
x1de8_boostChargeTime = g_tweakBall->GetBoostBallMaxChargeTime();
}
else
{
if (x1e20_ == 1)
{
CAnimPlaybackParms parms(0, -1, 1.f, true);
x58_ballModel->AnimationData()->SetAnimation(parms, false);
x1e20_ = 0;
CSfxManager::RemoveEmitter(x1e24_boostSfxHandle);
if (x1de8_boostChargeTime >= g_tweakBall->GetBoostBallMinChargeTime())
{
CSfxManager::AddEmitter(1476, x0_player.GetTranslation(), zeus::CVector3f::skZero,
true, false, 0xb4, kInvalidAreaId);
}
}
if (x1de8_boostChargeTime >= g_tweakBall->GetBoostBallMinChargeTime())
{
if (GetBallBoostState() == EBallBoostState::Zero)
{
if (GetIsInHalfPipeMode() || x1df8_27_ballCloseToCollision)
{
EnterBoosting(mgr);
}
else
{
x0_player.ApplyImpulseWR(zeus::CVector3f::skZero,
zeus::CAxisAngle(-x1924_surfaceToWorld.basis[1] * 10000.f));
CancelBoosting();
}
}
else if (GetBallBoostState() == EBallBoostState::One)
{
x0_player.SetTransform(zeus::lookAt(x0_player.GetTranslation(),
x0_player.GetTranslation() + GetBallToWorld().basis[1]));
x0_player.ApplyImpulseWR(zeus::CVector3f::skZero,
zeus::CAxisAngle(-x0_player.GetTransform().basis[0] * 10000.f));
CancelBoosting();
}
}
else if (x1de8_boostChargeTime > 0.f)
{
CancelBoosting();
}
}
}
else
{
x1df4_boostDrainTime += dt;
if (x1df4_boostDrainTime > g_tweakBall->GetBoostBallDrainTime())
LeaveBoosting();
if (!GetIsInHalfPipeMode() && !x1df8_27_ballCloseToCollision)
{
if (x1df4_boostDrainTime / g_tweakBall->GetBoostBallDrainTime() < 0.3f)
DampLinearAndAngularVelocities(0.5f, 0.01f);
else
LeaveBoosting();
}
}
}
void CMorphBall::ComputeBoostBallMovement(const CFinalInput&, const CStateManager&, float)
{
}
void CMorphBall::EnterBoosting()
void CMorphBall::EnterBoosting(CStateManager& mgr)
{
}
@ -573,9 +1068,9 @@ void CMorphBall::CancelBoosting()
}
void CMorphBall::UpdateMarbleDynamics(CStateManager&, float, const zeus::CVector3f&)
bool CMorphBall::UpdateMarbleDynamics(CStateManager& mgr, float dt, const zeus::CVector3f& point)
{
return false;
}
void CMorphBall::ApplyFriction(float)
@ -627,7 +1122,7 @@ void CMorphBall::RenderMorphBallTransitionFlash(const CStateManager&) const
{
if (x19dc_morphBallTransitionFlashGen)
{
const u8* c = BallTransFlashColors[x8_];
const u8* c = BallTransFlashColors[x8_ballGlowColorIdx];
zeus::CColor color = {c[0] / 255.f, c[1] / 255.f, c[2] / 255.f, 1.f};
x19dc_morphBallTransitionFlashGen->SetModulationColor(color);
x19dc_morphBallTransitionFlashGen->Render();
@ -667,8 +1162,25 @@ void CMorphBall::DisableHalfPipeStatus()
x1e14_ = zeus::CVector3f::skZero;
}
bool CMorphBall::BallCloseToCollision(const CStateManager&, float, const CMaterialFilter& filter) const
bool CMorphBall::BallCloseToCollision(const CStateManager& mgr, float dist, const CMaterialFilter& filter) const
{
CMaterialList playerOrSolid(EMaterialTypes::Player, EMaterialTypes::Solid);
CCollidableSphere sphere(zeus::CSphere(x0_player.GetTranslation() +
zeus::CVector3f(0.f, 0.f, GetBallRadius()), dist), playerOrSolid);
rstl::reserved_vector<TUniqueId, 1024> nearList;
mgr.BuildColliderList(nearList, x0_player, sphere.CalculateLocalAABox());
if (CGameCollision::DetectStaticCollisionBoolean(mgr, sphere, zeus::CTransform::Identity(), filter))
return true;
for (TUniqueId id : nearList)
{
if (TCastToConstPtr<CPhysicsActor> act = mgr.GetObjectById(id))
{
if (CCollisionPrimitive::CollideBoolean({sphere, filter, zeus::CTransform::Identity()},
{*act->GetCollisionPrimitive(), CMaterialFilter::skPassEverything,
act->GetPrimitiveTransform()}))
return true;
}
}
return false;
}
@ -697,7 +1209,7 @@ void CMorphBall::CollidedWith(TUniqueId id, const CCollisionInfoList& list, CSta
{
x19cc_wallSparkGen->SetTranslation(info.GetPoint());
x19cc_wallSparkGen->SetParticleEmission(true);
x1e38_ = 7;
x1e38_wallSparkFrameCountdown = 7;
}
}
}
@ -787,7 +1299,7 @@ void CMorphBall::CollidedWith(TUniqueId id, const CCollisionInfoList& list, CSta
}
}
if (x28_ && allMats.HasMaterial(EMaterialTypes::Floor) && allMats.HasMaterial(EMaterialTypes::Wall))
if (x28_tireMode && allMats.HasMaterial(EMaterialTypes::Floor) && allMats.HasMaterial(EMaterialTypes::Wall))
SwitchToMarble();
if (!GetIsInHalfPipeMode() && x1de4_24 && velMag > 3.f)
@ -958,7 +1470,7 @@ void CMorphBall::AddSpiderBallElectricalEffect()
}
void CMorphBall::UpdateSpiderBallElectricalEffect()
void CMorphBall::UpdateSpiderBallElectricalEffects()
{
}
@ -1022,9 +1534,12 @@ void CMorphBall::StopSounds()
}
}
void CMorphBall::ActorAttached()
void CMorphBall::StopEffects()
{
x19cc_wallSparkGen->SetParticleEmission(false);
x1bcc_[7]->SetParticleEmission(false);
if (x1c0c_wakeEffectIdx != -1)
x1bcc_[x1c0c_wakeEffectIdx]->SetParticleEmission(false);
}
}

View File

@ -28,7 +28,8 @@ class CMorphBall
public:
enum class EBallBoostState
{
Zero
Zero,
One
};
enum class ESpiderBallState
@ -45,13 +46,13 @@ public:
private:
CPlayer& x0_player;
s32 x4_ = -1;
u32 x8_ = 0;
u32 x8_ballGlowColorIdx = 0;
float xc_radius;
zeus::CVector3f x10_;
zeus::CVector3f x1c_;
bool x28_ = false;
float x2c_ = 0.f;
float x30_ = 0.f;
bool x28_tireMode = false;
float x2c_tireLeanAngle = 0.f;
float x30_ballTiltAngle = 0.f;
CCollidableSphere x38_collisionSphere;
std::unique_ptr<CModelData> x58_ballModel;
u32 x5c_ballModelShader = 0;
@ -63,11 +64,11 @@ private:
CCollisionInfoList x74_collisionInfos;
u32 xc78_ = 0;
ESpiderBallState x187c_spiderBallState = ESpiderBallState::Inactive;
zeus::CVector3f x1880_;
zeus::CVector3f x1880_spiderTrackNormal;
float x188c_ = 1.f;
zeus::CVector3f x1890_spiderTrackPoint;
zeus::CVector3f x189c_;
zeus::CVector3f x18a8_;
zeus::CVector3f x189c_spiderBallDir;
zeus::CVector3f x18a8_initialSpiderBallUp;
float x18b4_ = 0.f;
float x18b8_ = 0.f;
bool x18bc_ = false;
@ -87,7 +88,7 @@ private:
float x1918_ = 0.f;
float x191c_damageTimer = 0.f;
bool x1920_ = false;
zeus::CTransform x1924_;
zeus::CTransform x1924_surfaceToWorld;
bool x1954_isProjectile = false;
std::vector<CToken> x1958_animationTokens;
TToken<CSwooshDescription> x1968_slowBlueTailSwoosh;
@ -138,14 +139,14 @@ private:
zeus::CVector3f x1dd8_;
bool x1de4_24 : 1;
bool x1de4_25 : 1;
float x1de8_boostTime = 0.f;
float x1de8_boostChargeTime = 0.f;
float x1dec_ = 0.f;
float x1df0_ = 0.f;
float x1df4_ = 0.f;
float x1df4_boostDrainTime = 0.f;
bool x1df8_24_inHalfPipeMode : 1;
bool x1df8_25_inHalfPipeModeInAir : 1;
bool x1df8_26_touchedHalfPipeRecently : 1;
bool x1df8_27 : 1;
bool x1df8_27_ballCloseToCollision : 1;
float x1dfc_ = 0.f;
float x1e00_ = 0.f;
float x1e04_ = 0.f;
@ -158,7 +159,7 @@ private:
CSfxHandle x1e30_spiderSfxHandle;
u16 x1e34_rollSfx = 0xffff;
u16 x1e36_landSfx = 0xffff;
u32 x1e38_ = 0;
u32 x1e38_wallSparkFrameCountdown = 0;
EBallBoostState x1e3c_boostState = EBallBoostState::Zero;
EBombJumpState x1e40_bombJumpState = EBombJumpState::Zero;
float x1e44_ = 0.f;
@ -170,6 +171,8 @@ private:
static std::unique_ptr<CModelData> GetMorphBallModel(const char* name, float radius);
void SelectMorphBallSounds(const CMaterialList& mat);
void UpdateMorphBallSounds(float dt);
static zeus::CVector3f TransformSpiderBallForcesToView(const zeus::CVector2f& forces, CStateManager& mgr);
void ResetSpiderBallForces();
public:
CMorphBall(CPlayer& player, float radius);
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender, CStateManager& mgr);
@ -181,9 +184,9 @@ public:
bool IsBoosting() const { return false; }
float GetBallRadius() const;
float GetBallTouchRadius() const;
void ForwardInput(const CFinalInput& input) const;
void BallTurnInput(const CFinalInput& input) const;
void ComputeBallMovement(const CFinalInput&, CStateManager&, float);
float ForwardInput(const CFinalInput& input) const;
float BallTurnInput(const CFinalInput& input) const;
void ComputeBallMovement(const CFinalInput& input, CStateManager& mgr, float dt);
bool IsMovementAllowed() const;
void UpdateSpiderBall(const CFinalInput&, CStateManager&, float);
void ApplySpiderBallSwingingForces(const CFinalInput&, CStateManager&, float);
@ -200,27 +203,28 @@ public:
void UpdateSpiderBallSwingControllerMovementTimer(float, float);
float GetSpiderBallSwingControllerMovementScalar() const;
void CreateSpiderBallParticles(const zeus::CVector3f&, const zeus::CVector3f&);
void ComputeMarioMovement(const CFinalInput&, CStateManager&, float);
void ComputeMarioMovement(const CFinalInput& input, CStateManager& mgr, float dt);
void SetSpiderBallState(ESpiderBallState state) { x187c_spiderBallState = state; }
void GetSwooshToWorld() const;
zeus::CTransform GetSwooshToWorld() const;
zeus::CTransform GetBallToWorld() const;
void CalculateSurfaceToWorld(const zeus::CVector3f&, const zeus::CVector3f&, const zeus::CVector3f&) const;
void CalculateBallContactInfo(zeus::CVector3f&, zeus::CVector3f&) const;
void UpdateBallDynamics(CStateManager&, float);
zeus::CTransform CalculateSurfaceToWorld(const zeus::CVector3f& trackNormal,
const zeus::CVector3f& trackPoint,
const zeus::CVector3f& ballDir) const;
bool CalculateBallContactInfo(zeus::CVector3f& normal, zeus::CVector3f& point) const;
void UpdateBallDynamics(CStateManager& mgr, float dt);
void SwitchToMarble();
void SwitchToTire();
void Update(float dt, CStateManager& mgr);
void UpdateScriptMessage(EScriptObjectMessage, TUniqueId, CStateManager&);
void DeleteLight(CStateManager&);
void SetBallLightActive(CStateManager&, bool);
void EnterMorphBallState(CStateManager&);
void LeaveMorphBallState(CStateManager&);
void UpdateEffects(float, CStateManager&);
void ComputeBoostBallMovement(const CFinalInput&, const CStateManager&, float);
void EnterBoosting();
void DeleteLight(CStateManager& mgr);
void SetBallLightActive(CStateManager& mgr, bool active);
void EnterMorphBallState(CStateManager& mgr);
void LeaveMorphBallState(CStateManager& mgr);
void UpdateEffects(float dt, CStateManager& mgr);
void ComputeBoostBallMovement(const CFinalInput& input, CStateManager& mgr, float dt);
void EnterBoosting(CStateManager& mgr);
void LeaveBoosting();
void CancelBoosting();
void UpdateMarbleDynamics(CStateManager&, float, const zeus::CVector3f&);
bool UpdateMarbleDynamics(CStateManager& mgr, float dt, const zeus::CVector3f& point);
void ApplyFriction(float);
void DampLinearAndAngularVelocities(float, float);
zeus::CTransform GetPrimitiveTransform() const;
@ -243,7 +247,7 @@ public:
bool GetTouchedHalfPipeRecently() const { return x1df8_26_touchedHalfPipeRecently; }
void SetTouchedHalfPipeRecently(bool b) { x1df8_26_touchedHalfPipeRecently = b; }
void DisableHalfPipeStatus();
bool BallCloseToCollision(const CStateManager&, float, const CMaterialFilter& filter) const;
bool BallCloseToCollision(const CStateManager& mgr, float dist, const CMaterialFilter& filter) const;
void CollidedWith(TUniqueId id, const CCollisionInfoList& list, CStateManager& mgr);
bool IsInFrustum(const zeus::CFrustum& frustum) const;
void ComputeLiftForces(const zeus::CVector3f&, const zeus::CVector3f&, const CStateManager&);
@ -257,7 +261,7 @@ public:
void GetMorphBallModel(const std::string&, float);
void LoadMorphBallModel(CStateManager& mgr);
void AddSpiderBallElectricalEffect();
void UpdateSpiderBallElectricalEffect();
void UpdateSpiderBallElectricalEffects();
void RenderSpiderBallElectricalEffect() const;
void RenderEnergyDrainEffects(const CStateManager&) const;
void TouchModel(const CStateManager& mgr) const;
@ -275,7 +279,7 @@ public:
void SetDamageTimer(float t) { x191c_damageTimer = t; }
void Stop();
void StopSounds();
void ActorAttached();
void StopEffects();
CModelData& GetMorphballModelData() const { return *x58_ballModel; }
u32 GetMorphballModelShader() const { return x5c_ballModelShader; }
bool GetX1DE4_25() const { return x1de4_25; }

View File

@ -154,6 +154,7 @@ public:
zeus::CAxisAngle GetAngularVelocityOR() const;
const zeus::CAxisAngle& GetAngularVelocityWR() const { return x144_angularVelocity; }
void SetAngularVelocityWR(const zeus::CAxisAngle& angVel);
const zeus::CVector3f& GetForceOR() const { return x15c_force; }
void SetVelocityWR(const zeus::CVector3f& vel);
void SetVelocityOR(const zeus::CVector3f& vel);
void SetMomentumWR(const zeus::CVector3f& m) { x150_momentum = m; }

View File

@ -5490,6 +5490,11 @@ void CPlayer::CollidedWith(TUniqueId id, const CCollisionInfoList& list, CStateM
x768_morphball->CollidedWith(id, list, mgr);
}
float CPlayer::GetBallMaxVelocity() const
{
return g_tweakBall->GetBallTranslationMaxSpeed(int(GetSurfaceRestraint()));
}
float CPlayer::GetActualBallMaxVelocity(float dt) const
{
ESurfaceRestraints surf = GetSurfaceRestraint();
@ -6566,7 +6571,7 @@ bool CPlayer::AttachActorToPlayer(TUniqueId id, bool disableGun)
x26c_attachedActor = id;
x270_attachedActorTime = 0.f;
xa28_attachedActorStruggle = 0.f;
x768_morphball->ActorAttached();
x768_morphball->StopEffects();
return true;
}

View File

@ -602,6 +602,7 @@ public:
const CCollidableSphere* GetCollidableSphere() const;
zeus::CTransform GetPrimitiveTransform() const;
void CollidedWith(TUniqueId, const CCollisionInfoList&, CStateManager& mgr);
float GetBallMaxVelocity() const;
float GetActualBallMaxVelocity(float dt) const;
float GetActualFirstPersonMaxVelocity(float dt) const;
void SetMoveState(EPlayerMovementState, CStateManager& mgr);

@ -1 +1 @@
Subproject commit 7301c5de9fff2a924c0bc2cb949bab4505ff042e
Subproject commit 81afe9b52644b13ecac849082d51098a2cfdea20