More work on CBallCamera

This commit is contained in:
Jack Andersen 2017-10-09 17:50:48 -10:00
parent 4c83f521a8
commit 651d0a27c2
23 changed files with 734 additions and 315 deletions

View File

@ -16,18 +16,18 @@ struct ITweakBall : ITweak
virtual float GetBallCameraMinSpeedDistance() const=0; virtual float GetBallCameraMinSpeedDistance() const=0;
virtual float GetBallCameraMaxSpeedDistance() const=0; virtual float GetBallCameraMaxSpeedDistance() const=0;
virtual float GetBallCameraBackwardsDistance() const=0; virtual float GetBallCameraBackwardsDistance() const=0;
virtual float GetBallCameraSpringTardis() const=0;
virtual float GetBallCameraSpringMax() const=0;
virtual float GetBallCameraSpringConstant() const=0; virtual float GetBallCameraSpringConstant() const=0;
virtual float GetBallCameraCentroidSpringTardis() const=0; virtual float GetBallCameraSpringMax() const=0;
virtual float GetBallCameraCentroidSpringMax() const=0; virtual float GetBallCameraSpringTardis() const=0;
virtual float GetBallCameraCentroidSpringConstant() const=0; virtual float GetBallCameraCentroidSpringConstant() const=0;
virtual float GetBallCameraCentroidDistanceSpringTardis() const=0; virtual float GetBallCameraCentroidSpringMax() const=0;
virtual float GetBallCameraCentroidDistanceSpringMax() const=0; virtual float GetBallCameraCentroidSpringTardis() const=0;
virtual float GetBallCameraCentroidDistanceSpringConstant() const=0; virtual float GetBallCameraCentroidDistanceSpringConstant() const=0;
virtual float GetBallCameraLookAtSpringTardis() const=0; virtual float GetBallCameraCentroidDistanceSpringMax() const=0;
virtual float GetBallCameraLookAtSpringMax() const=0; virtual float GetBallCameraCentroidDistanceSpringTardis() const=0;
virtual float GetBallCameraLookAtSpringConstant() const=0; virtual float GetBallCameraLookAtSpringConstant() const=0;
virtual float GetBallCameraLookAtSpringMax() const=0;
virtual float GetBallCameraLookAtSpringTardis() const=0;
virtual float GetBallForwardBrakingAcceleration(int s) const=0; virtual float GetBallForwardBrakingAcceleration(int s) const=0;
virtual float GetBallGravity() const=0; virtual float GetBallGravity() const=0;
virtual float GetBallWaterGravity() const=0; virtual float GetBallWaterGravity() const=0;
@ -38,18 +38,18 @@ struct ITweakBall : ITweak
virtual float GetBallCameraChaseYawSpeed() const=0; virtual float GetBallCameraChaseYawSpeed() const=0;
virtual float GetBallCameraChaseAnglePerSecond() const=0; virtual float GetBallCameraChaseAnglePerSecond() const=0;
virtual const zeus::CVector3f& GetBallCameraChaseLookAtOffset() const=0; virtual const zeus::CVector3f& GetBallCameraChaseLookAtOffset() const=0;
virtual float GetBallCameraChaseSpringTardis() const=0;
virtual float GetBallCameraChaseSpringMax() const=0;
virtual float GetBallCameraChaseSpringConstant() const=0; virtual float GetBallCameraChaseSpringConstant() const=0;
virtual float GetBallCameraChaseSpringMax() const=0;
virtual float GetBallCameraChaseSpringTardis() const=0;
virtual float GetBallCameraBoostElevation() const=0; virtual float GetBallCameraBoostElevation() const=0;
virtual float GetBallCameraBoostDampenAngle() const=0; virtual float GetBallCameraBoostDampenAngle() const=0;
virtual float GetBallCameraBoostDistance() const=0; virtual float GetBallCameraBoostDistance() const=0;
virtual float GetBallCameraBoostYawSpeed() const=0; virtual float GetBallCameraBoostYawSpeed() const=0;
virtual float GetBallCameraBoostAnglePerSecond() const=0; virtual float GetBallCameraBoostAnglePerSecond() const=0;
virtual const zeus::CVector3f& GetBallCameraBoostLookAtOffset() const=0; virtual const zeus::CVector3f& GetBallCameraBoostLookAtOffset() const=0;
virtual float GetBallCameraBoostSpringTardis() const=0;
virtual float GetBallCameraBoostSpringMax() const=0;
virtual float GetBallCameraBoostSpringConstant() const=0; virtual float GetBallCameraBoostSpringConstant() const=0;
virtual float GetBallCameraBoostSpringMax() const=0;
virtual float GetBallCameraBoostSpringTardis() const=0;
virtual float GetMinimumAlignmentSpeed() const=0; virtual float GetMinimumAlignmentSpeed() const=0;
virtual float GetTireness() const=0; virtual float GetTireness() const=0;
virtual float GetMaxLeanAngle() const=0; virtual float GetMaxLeanAngle() const=0;

View File

@ -13,11 +13,11 @@ struct CameraShaker : IScriptObject
{ {
DECL_YAML DECL_YAML
String<-1> name; String<-1> name;
Value<float> xA; Value<float> xMag;
Value<float> xB; Value<float> xB;
Value<float> yA; Value<float> yMag;
Value<float> yB; Value<float> yB;
Value<float> zA; Value<float> zMag;
Value<float> zB; Value<float> zB;
Value<float> duration; Value<float> duration;
Value<bool> active; Value<bool> active;

View File

@ -61,21 +61,23 @@ struct MetroidPrimeStage1 : IScriptObject
struct CameraShakeData : BigYAML struct CameraShakeData : BigYAML
{ {
DECL_YAML DECL_YAML
Value<bool> unknown1; Value<bool> useSfx;
Value<float> duration; Value<float> duration;
Value<float> unknown3; Value<float> sfxDist;
struct CameraShakerComponent : BigYAML struct CameraShakerComponent : BigYAML
{ {
DECL_YAML DECL_YAML
Value<bool> unknown1; Value<bool> useModulation;
struct CameraShakePoint : BigYAML struct CameraShakePoint : BigYAML
{ {
DECL_YAML DECL_YAML
Value<float> unknown2; Value<float> attackTime;
Value<float> unknown3; Value<float> sustainTime;
Value<float> duration; Value<float> duration;
Value<float> magnitude; Value<float> magnitude;
} shakePoints[2]; };
CameraShakePoint am;
CameraShakePoint fm;
} shakerComponents[3]; } shakerComponents[3];
} shakeDatas[3]; } shakeDatas[3];

View File

@ -17,22 +17,23 @@ struct NewCameraShaker : IScriptObject
Value<bool> active; Value<bool> active;
PlayerParameters flags; PlayerParameters flags;
Value<float> duration; Value<float> duration;
Value<float> unknown4; Value<float> sfxDist;
struct CameraShakerParameters : BigYAML struct CameraShakerComponent : BigYAML
{ {
DECL_YAML DECL_YAML
PlayerParameters flags; PlayerParameters flags;
struct ShakerInfo : BigYAML struct CameraShakePoint : BigYAML
{ {
DECL_YAML DECL_YAML
PlayerParameters flags; PlayerParameters flags;
Value<float> unknown1; Value<float> attackTime;
Value<float> unknown2; Value<float> sustainTime;
Value<float> unknown3; Value<float> duration;
Value<float> unknown4; Value<float> magnitude;
}; };
ShakerInfo shakers[2]; CameraShakePoint am;
} cameraShakerParameters1, cameraShakerParameters2, cameraShakerParameters3; CameraShakePoint fm;
} shakerComponents[3];
}; };
} }
} }

View File

@ -115,30 +115,30 @@ void CTweakBall::read(athena::io::IStreamReader& __dna_reader)
x8c_ballCameraBackwardsDistance = __dna_reader.readFloatBig(); x8c_ballCameraBackwardsDistance = __dna_reader.readFloatBig();
/* x90_ */ /* x90_ */
x90_ = __dna_reader.readFloatBig(); x90_ = __dna_reader.readFloatBig();
/* x94_ballCameraSpringTardis */ /* x94_ballCameraSpringConstant */
x94_ballCameraSpringTardis = __dna_reader.readFloatBig(); x94_ballCameraSpringConstant = __dna_reader.readFloatBig();
/* x98_ballCameraSpringMax */ /* x98_ballCameraSpringMax */
x98_ballCameraSpringMax = __dna_reader.readFloatBig(); x98_ballCameraSpringMax = __dna_reader.readFloatBig();
/* x9c_ballCameraSpringConstant */ /* x9c_ballCameraSpringTardis */
x9c_ballCameraSpringConstant = __dna_reader.readFloatBig(); x9c_ballCameraSpringTardis = __dna_reader.readFloatBig();
/* xa0_ballCameraCentroidSpringTardis */ /* xa0_ballCameraCentroidSpringConstant */
xa0_ballCameraCentroidSpringTardis = __dna_reader.readFloatBig(); xa0_ballCameraCentroidSpringConstant = __dna_reader.readFloatBig();
/* xa4_ballCameraCentroidSpringMax */ /* xa4_ballCameraCentroidSpringMax */
xa4_ballCameraCentroidSpringMax = __dna_reader.readFloatBig(); xa4_ballCameraCentroidSpringMax = __dna_reader.readFloatBig();
/* xa8_ballCameraCentroidSpringConstant */ /* xa8_ballCameraCentroidSpringTardis */
xa8_ballCameraCentroidSpringConstant = __dna_reader.readFloatBig(); xa8_ballCameraCentroidSpringTardis = __dna_reader.readFloatBig();
/* xac_ballCameraCentroidDistanceSpringTardis */ /* xac_ballCameraCentroidDistanceSpringConstant */
xac_ballCameraCentroidDistanceSpringTardis = __dna_reader.readFloatBig(); xac_ballCameraCentroidDistanceSpringConstant = __dna_reader.readFloatBig();
/* xb0_ballCameraCentroidDistanceSpringMax */ /* xb0_ballCameraCentroidDistanceSpringMax */
xb0_ballCameraCentroidDistanceSpringMax = __dna_reader.readFloatBig(); xb0_ballCameraCentroidDistanceSpringMax = __dna_reader.readFloatBig();
/* xb4_ballCameraCentroidDistanceSpringConstant */ /* xb4_ballCameraCentroidDistanceSpringTardis */
xb4_ballCameraCentroidDistanceSpringConstant = __dna_reader.readFloatBig(); xb4_ballCameraCentroidDistanceSpringTardis = __dna_reader.readFloatBig();
/* xb8_ballCameraLookAtSpringTardis */ /* xb8_ballCameraLookAtSpringConstant */
xb8_ballCameraLookAtSpringTardis = __dna_reader.readFloatBig(); xb8_ballCameraLookAtSpringConstant = __dna_reader.readFloatBig();
/* xbc_ballCameraLookAtSpringMax */ /* xbc_ballCameraLookAtSpringMax */
xbc_ballCameraLookAtSpringMax = __dna_reader.readFloatBig(); xbc_ballCameraLookAtSpringMax = __dna_reader.readFloatBig();
/* xc0_ballCameraLookAtSpringConstant */ /* xc0_ballCameraLookAtSpringTardis */
xc0_ballCameraLookAtSpringConstant = __dna_reader.readFloatBig(); xc0_ballCameraLookAtSpringTardis = __dna_reader.readFloatBig();
/* x154_ */ /* x154_ */
x154_ = __dna_reader.readFloatBig(); x154_ = __dna_reader.readFloatBig();
/* x15c_ */ /* x15c_ */
@ -167,12 +167,12 @@ void CTweakBall::read(athena::io::IStreamReader& __dna_reader)
x188_ballCameraChaseAnglePerSecond = __dna_reader.readFloatBig(); x188_ballCameraChaseAnglePerSecond = __dna_reader.readFloatBig();
/* x18c_ballCameraChaseLookAtOffset */ /* x18c_ballCameraChaseLookAtOffset */
x18c_ballCameraChaseLookAtOffset = __dna_reader.readVec3fBig(); x18c_ballCameraChaseLookAtOffset = __dna_reader.readVec3fBig();
/* x198_ballCameraChaseSpringTardis */ /* x198_ballCameraChaseSpringConstant */
x198_ballCameraChaseSpringTardis = __dna_reader.readFloatBig(); x198_ballCameraChaseSpringConstant = __dna_reader.readFloatBig();
/* x19c_ballCameraChaseSpringMax */ /* x19c_ballCameraChaseSpringMax */
x19c_ballCameraChaseSpringMax = __dna_reader.readFloatBig(); x19c_ballCameraChaseSpringMax = __dna_reader.readFloatBig();
/* x1a0_ballCameraChaseSpringConstant */ /* x1a0_ballCameraChaseSpringTardis */
x1a0_ballCameraChaseSpringConstant = __dna_reader.readFloatBig(); x1a0_ballCameraChaseSpringTardis = __dna_reader.readFloatBig();
/* x1a4_ballCameraBoostElevation */ /* x1a4_ballCameraBoostElevation */
x1a4_ballCameraBoostElevation = __dna_reader.readFloatBig(); x1a4_ballCameraBoostElevation = __dna_reader.readFloatBig();
/* x1a8_ballCameraBoostDampenAngle */ /* x1a8_ballCameraBoostDampenAngle */
@ -185,12 +185,12 @@ void CTweakBall::read(athena::io::IStreamReader& __dna_reader)
x1b4_ballCameraBoostAnglePerSecond = __dna_reader.readFloatBig(); x1b4_ballCameraBoostAnglePerSecond = __dna_reader.readFloatBig();
/* x1b8_ballCameraBoostLookAtOffset */ /* x1b8_ballCameraBoostLookAtOffset */
x1b8_ballCameraBoostLookAtOffset = __dna_reader.readVec3fBig(); x1b8_ballCameraBoostLookAtOffset = __dna_reader.readVec3fBig();
/* x1c4_ballCameraBoostSpringTardis */ /* x1c4_ballCameraBoostSpringConstant */
x1c4_ballCameraBoostSpringTardis = __dna_reader.readFloatBig(); x1c4_ballCameraBoostSpringConstant = __dna_reader.readFloatBig();
/* x1c8_ballCameraBoostSpringMax */ /* x1c8_ballCameraBoostSpringMax */
x1c8_ballCameraBoostSpringMax = __dna_reader.readFloatBig(); x1c8_ballCameraBoostSpringMax = __dna_reader.readFloatBig();
/* x1cc_ballCameraBoostSpringConstant */ /* x1cc_ballCameraBoostSpringTardis */
x1cc_ballCameraBoostSpringConstant = __dna_reader.readFloatBig(); x1cc_ballCameraBoostSpringTardis = __dna_reader.readFloatBig();
/* x1d0_ballCameraControlDistance */ /* x1d0_ballCameraControlDistance */
x1d0_ballCameraControlDistance = __dna_reader.readFloatBig(); x1d0_ballCameraControlDistance = __dna_reader.readFloatBig();
/* x1d4_ */ /* x1d4_ */
@ -335,30 +335,30 @@ void CTweakBall::write(athena::io::IStreamWriter& __dna_writer) const
__dna_writer.writeFloatBig(x8c_ballCameraBackwardsDistance); __dna_writer.writeFloatBig(x8c_ballCameraBackwardsDistance);
/* x90_ */ /* x90_ */
__dna_writer.writeFloatBig(x90_); __dna_writer.writeFloatBig(x90_);
/* x94_ballCameraSpringTardis */ /* x94_ballCameraSpringConstant */
__dna_writer.writeFloatBig(x94_ballCameraSpringTardis); __dna_writer.writeFloatBig(x94_ballCameraSpringConstant);
/* x98_ballCameraSpringMax */ /* x98_ballCameraSpringMax */
__dna_writer.writeFloatBig(x98_ballCameraSpringMax); __dna_writer.writeFloatBig(x98_ballCameraSpringMax);
/* x9c_ballCameraSpringConstant */ /* x9c_ballCameraSpringTardis */
__dna_writer.writeFloatBig(x9c_ballCameraSpringConstant); __dna_writer.writeFloatBig(x9c_ballCameraSpringTardis);
/* xa0_ballCameraCentroidSpringTardis */ /* xa0_ballCameraCentroidSpringConstant */
__dna_writer.writeFloatBig(xa0_ballCameraCentroidSpringTardis); __dna_writer.writeFloatBig(xa0_ballCameraCentroidSpringConstant);
/* xa4_ballCameraCentroidSpringMax */ /* xa4_ballCameraCentroidSpringMax */
__dna_writer.writeFloatBig(xa4_ballCameraCentroidSpringMax); __dna_writer.writeFloatBig(xa4_ballCameraCentroidSpringMax);
/* xa8_ballCameraCentroidSpringConstant */ /* xa8_ballCameraCentroidSpringTardis */
__dna_writer.writeFloatBig(xa8_ballCameraCentroidSpringConstant); __dna_writer.writeFloatBig(xa8_ballCameraCentroidSpringTardis);
/* xac_ballCameraCentroidDistanceSpringTardis */ /* xac_ballCameraCentroidDistanceSpringConstant */
__dna_writer.writeFloatBig(xac_ballCameraCentroidDistanceSpringTardis); __dna_writer.writeFloatBig(xac_ballCameraCentroidDistanceSpringConstant);
/* xb0_ballCameraCentroidDistanceSpringMax */ /* xb0_ballCameraCentroidDistanceSpringMax */
__dna_writer.writeFloatBig(xb0_ballCameraCentroidDistanceSpringMax); __dna_writer.writeFloatBig(xb0_ballCameraCentroidDistanceSpringMax);
/* xb4_ballCameraCentroidDistanceSpringConstant */ /* xb4_ballCameraCentroidDistanceSpringTardis */
__dna_writer.writeFloatBig(xb4_ballCameraCentroidDistanceSpringConstant); __dna_writer.writeFloatBig(xb4_ballCameraCentroidDistanceSpringTardis);
/* xb8_ballCameraLookAtSpringTardis */ /* xb8_ballCameraLookAtSpringConstant */
__dna_writer.writeFloatBig(xb8_ballCameraLookAtSpringTardis); __dna_writer.writeFloatBig(xb8_ballCameraLookAtSpringConstant);
/* xbc_ballCameraLookAtSpringMax */ /* xbc_ballCameraLookAtSpringMax */
__dna_writer.writeFloatBig(xbc_ballCameraLookAtSpringMax); __dna_writer.writeFloatBig(xbc_ballCameraLookAtSpringMax);
/* xc0_ballCameraLookAtSpringConstant */ /* xc0_ballCameraLookAtSpringTardis */
__dna_writer.writeFloatBig(xc0_ballCameraLookAtSpringConstant); __dna_writer.writeFloatBig(xc0_ballCameraLookAtSpringTardis);
/* x154_ */ /* x154_ */
__dna_writer.writeFloatBig(x154_); __dna_writer.writeFloatBig(x154_);
/* x15c_ */ /* x15c_ */
@ -387,12 +387,12 @@ void CTweakBall::write(athena::io::IStreamWriter& __dna_writer) const
__dna_writer.writeFloatBig(x188_ballCameraChaseAnglePerSecond); __dna_writer.writeFloatBig(x188_ballCameraChaseAnglePerSecond);
/* x18c_ballCameraChaseLookAtOffset */ /* x18c_ballCameraChaseLookAtOffset */
__dna_writer.writeVec3fBig(x18c_ballCameraChaseLookAtOffset); __dna_writer.writeVec3fBig(x18c_ballCameraChaseLookAtOffset);
/* x198_ballCameraChaseSpringTardis */ /* x198_ballCameraChaseSpringConstant */
__dna_writer.writeFloatBig(x198_ballCameraChaseSpringTardis); __dna_writer.writeFloatBig(x198_ballCameraChaseSpringConstant);
/* x19c_ballCameraChaseSpringMax */ /* x19c_ballCameraChaseSpringMax */
__dna_writer.writeFloatBig(x19c_ballCameraChaseSpringMax); __dna_writer.writeFloatBig(x19c_ballCameraChaseSpringMax);
/* x1a0_ballCameraChaseSpringConstant */ /* x1a0_ballCameraChaseSpringTardis */
__dna_writer.writeFloatBig(x1a0_ballCameraChaseSpringConstant); __dna_writer.writeFloatBig(x1a0_ballCameraChaseSpringTardis);
/* x1a4_ballCameraBoostElevation */ /* x1a4_ballCameraBoostElevation */
__dna_writer.writeFloatBig(x1a4_ballCameraBoostElevation); __dna_writer.writeFloatBig(x1a4_ballCameraBoostElevation);
/* x1a8_ballCameraBoostDampenAngle */ /* x1a8_ballCameraBoostDampenAngle */
@ -405,12 +405,12 @@ void CTweakBall::write(athena::io::IStreamWriter& __dna_writer) const
__dna_writer.writeFloatBig(x1b4_ballCameraBoostAnglePerSecond); __dna_writer.writeFloatBig(x1b4_ballCameraBoostAnglePerSecond);
/* x1b8_ballCameraBoostLookAtOffset */ /* x1b8_ballCameraBoostLookAtOffset */
__dna_writer.writeVec3fBig(x1b8_ballCameraBoostLookAtOffset); __dna_writer.writeVec3fBig(x1b8_ballCameraBoostLookAtOffset);
/* x1c4_ballCameraBoostSpringTardis */ /* x1c4_ballCameraBoostSpringConstant */
__dna_writer.writeFloatBig(x1c4_ballCameraBoostSpringTardis); __dna_writer.writeFloatBig(x1c4_ballCameraBoostSpringConstant);
/* x1c8_ballCameraBoostSpringMax */ /* x1c8_ballCameraBoostSpringMax */
__dna_writer.writeFloatBig(x1c8_ballCameraBoostSpringMax); __dna_writer.writeFloatBig(x1c8_ballCameraBoostSpringMax);
/* x1cc_ballCameraBoostSpringConstant */ /* x1cc_ballCameraBoostSpringTardis */
__dna_writer.writeFloatBig(x1cc_ballCameraBoostSpringConstant); __dna_writer.writeFloatBig(x1cc_ballCameraBoostSpringTardis);
/* x1d0_ballCameraControlDistance */ /* x1d0_ballCameraControlDistance */
__dna_writer.writeFloatBig(x1d0_ballCameraControlDistance); __dna_writer.writeFloatBig(x1d0_ballCameraControlDistance);
/* x1d4_ */ /* x1d4_ */
@ -575,30 +575,30 @@ void CTweakBall::read(athena::io::YAMLDocReader& __dna_docin)
x8c_ballCameraBackwardsDistance = __dna_docin.readFloat("x8c_ballCameraBackwardsDistance"); x8c_ballCameraBackwardsDistance = __dna_docin.readFloat("x8c_ballCameraBackwardsDistance");
/* x90_ */ /* x90_ */
x90_ = __dna_docin.readFloat("x90_"); x90_ = __dna_docin.readFloat("x90_");
/* x94_ballCameraSpringTardis */ /* x94_ballCameraSpringConstant */
x94_ballCameraSpringTardis = __dna_docin.readFloat("x94_ballCameraSpringTardis"); x94_ballCameraSpringConstant = __dna_docin.readFloat("x94_ballCameraSpringConstant");
/* x98_ballCameraSpringMax */ /* x98_ballCameraSpringMax */
x98_ballCameraSpringMax = __dna_docin.readFloat("x98_ballCameraSpringMax"); x98_ballCameraSpringMax = __dna_docin.readFloat("x98_ballCameraSpringMax");
/* x9c_ballCameraSpringConstant */ /* x9c_ballCameraSpringTardis */
x9c_ballCameraSpringConstant = __dna_docin.readFloat("x9c_ballCameraSpringConstant"); x9c_ballCameraSpringTardis = __dna_docin.readFloat("x9c_ballCameraSpringTardis");
/* xa0_ballCameraCentroidSpringTardis */ /* xa0_ballCameraCentroidSpringConstant */
xa0_ballCameraCentroidSpringTardis = __dna_docin.readFloat("xa0_ballCameraCentroidSpringTardis"); xa0_ballCameraCentroidSpringConstant = __dna_docin.readFloat("xa0_ballCameraCentroidSpringConstant");
/* xa4_ballCameraCentroidSpringMax */ /* xa4_ballCameraCentroidSpringMax */
xa4_ballCameraCentroidSpringMax = __dna_docin.readFloat("xa4_ballCameraCentroidSpringMax"); xa4_ballCameraCentroidSpringMax = __dna_docin.readFloat("xa4_ballCameraCentroidSpringMax");
/* xa8_ballCameraCentroidSpringConstant */ /* xa8_ballCameraCentroidSpringTardis */
xa8_ballCameraCentroidSpringConstant = __dna_docin.readFloat("xa8_ballCameraCentroidSpringConstant"); xa8_ballCameraCentroidSpringTardis = __dna_docin.readFloat("xa8_ballCameraCentroidSpringTardis");
/* xac_ballCameraCentroidDistanceSpringTardis */ /* xac_ballCameraCentroidDistanceSpringConstant */
xac_ballCameraCentroidDistanceSpringTardis = __dna_docin.readFloat("xac_ballCameraCentroidDistanceSpringTardis"); xac_ballCameraCentroidDistanceSpringConstant = __dna_docin.readFloat("xac_ballCameraCentroidDistanceSpringConstant");
/* xb0_ballCameraCentroidDistanceSpringMax */ /* xb0_ballCameraCentroidDistanceSpringMax */
xb0_ballCameraCentroidDistanceSpringMax = __dna_docin.readFloat("xb0_ballCameraCentroidDistanceSpringMax"); xb0_ballCameraCentroidDistanceSpringMax = __dna_docin.readFloat("xb0_ballCameraCentroidDistanceSpringMax");
/* xb4_ballCameraCentroidDistanceSpringConstant */ /* xb4_ballCameraCentroidDistanceSpringTardis */
xb4_ballCameraCentroidDistanceSpringConstant = __dna_docin.readFloat("xb4_ballCameraCentroidDistanceSpringConstant"); xb4_ballCameraCentroidDistanceSpringTardis = __dna_docin.readFloat("xb4_ballCameraCentroidDistanceSpringTardis");
/* xb8_ballCameraLookAtSpringTardis */ /* xb8_ballCameraLookAtSpringConstant */
xb8_ballCameraLookAtSpringTardis = __dna_docin.readFloat("xb8_ballCameraLookAtSpringTardis"); xb8_ballCameraLookAtSpringConstant = __dna_docin.readFloat("xb8_ballCameraLookAtSpringConstant");
/* xbc_ballCameraLookAtSpringMax */ /* xbc_ballCameraLookAtSpringMax */
xbc_ballCameraLookAtSpringMax = __dna_docin.readFloat("xbc_ballCameraLookAtSpringMax"); xbc_ballCameraLookAtSpringMax = __dna_docin.readFloat("xbc_ballCameraLookAtSpringMax");
/* xc0_ballCameraLookAtSpringConstant */ /* xc0_ballCameraLookAtSpringTardis */
xc0_ballCameraLookAtSpringConstant = __dna_docin.readFloat("xc0_ballCameraLookAtSpringConstant"); xc0_ballCameraLookAtSpringTardis = __dna_docin.readFloat("xc0_ballCameraLookAtSpringTardis");
/* x154_ */ /* x154_ */
x154_ = __dna_docin.readFloat("x154_"); x154_ = __dna_docin.readFloat("x154_");
/* x15c_ */ /* x15c_ */
@ -627,12 +627,12 @@ void CTweakBall::read(athena::io::YAMLDocReader& __dna_docin)
x188_ballCameraChaseAnglePerSecond = __dna_docin.readFloat("x188_ballCameraChaseAnglePerSecond"); x188_ballCameraChaseAnglePerSecond = __dna_docin.readFloat("x188_ballCameraChaseAnglePerSecond");
/* x18c_ballCameraChaseLookAtOffset */ /* x18c_ballCameraChaseLookAtOffset */
x18c_ballCameraChaseLookAtOffset = __dna_docin.readVec3f("x18c_ballCameraChaseLookAtOffset"); x18c_ballCameraChaseLookAtOffset = __dna_docin.readVec3f("x18c_ballCameraChaseLookAtOffset");
/* x198_ballCameraChaseSpringTardis */ /* x198_ballCameraChaseSpringConstant */
x198_ballCameraChaseSpringTardis = __dna_docin.readFloat("x198_ballCameraChaseSpringTardis"); x198_ballCameraChaseSpringConstant = __dna_docin.readFloat("x198_ballCameraChaseSpringConstant");
/* x19c_ballCameraChaseSpringMax */ /* x19c_ballCameraChaseSpringMax */
x19c_ballCameraChaseSpringMax = __dna_docin.readFloat("x19c_ballCameraChaseSpringMax"); x19c_ballCameraChaseSpringMax = __dna_docin.readFloat("x19c_ballCameraChaseSpringMax");
/* x1a0_ballCameraChaseSpringConstant */ /* x1a0_ballCameraChaseSpringTardis */
x1a0_ballCameraChaseSpringConstant = __dna_docin.readFloat("x1a0_ballCameraChaseSpringConstant"); x1a0_ballCameraChaseSpringTardis = __dna_docin.readFloat("x1a0_ballCameraChaseSpringTardis");
/* x1a4_ballCameraBoostElevation */ /* x1a4_ballCameraBoostElevation */
x1a4_ballCameraBoostElevation = __dna_docin.readFloat("x1a4_ballCameraBoostElevation"); x1a4_ballCameraBoostElevation = __dna_docin.readFloat("x1a4_ballCameraBoostElevation");
/* x1a8_ballCameraBoostDampenAngle */ /* x1a8_ballCameraBoostDampenAngle */
@ -645,12 +645,12 @@ void CTweakBall::read(athena::io::YAMLDocReader& __dna_docin)
x1b4_ballCameraBoostAnglePerSecond = __dna_docin.readFloat("x1b4_ballCameraBoostAnglePerSecond"); x1b4_ballCameraBoostAnglePerSecond = __dna_docin.readFloat("x1b4_ballCameraBoostAnglePerSecond");
/* x1b8_ballCameraBoostLookAtOffset */ /* x1b8_ballCameraBoostLookAtOffset */
x1b8_ballCameraBoostLookAtOffset = __dna_docin.readVec3f("x1b8_ballCameraBoostLookAtOffset"); x1b8_ballCameraBoostLookAtOffset = __dna_docin.readVec3f("x1b8_ballCameraBoostLookAtOffset");
/* x1c4_ballCameraBoostSpringTardis */ /* x1c4_ballCameraBoostSpringConstant */
x1c4_ballCameraBoostSpringTardis = __dna_docin.readFloat("x1c4_ballCameraBoostSpringTardis"); x1c4_ballCameraBoostSpringConstant = __dna_docin.readFloat("x1c4_ballCameraBoostSpringConstant");
/* x1c8_ballCameraBoostSpringMax */ /* x1c8_ballCameraBoostSpringMax */
x1c8_ballCameraBoostSpringMax = __dna_docin.readFloat("x1c8_ballCameraBoostSpringMax"); x1c8_ballCameraBoostSpringMax = __dna_docin.readFloat("x1c8_ballCameraBoostSpringMax");
/* x1cc_ballCameraBoostSpringConstant */ /* x1cc_ballCameraBoostSpringTardis */
x1cc_ballCameraBoostSpringConstant = __dna_docin.readFloat("x1cc_ballCameraBoostSpringConstant"); x1cc_ballCameraBoostSpringTardis = __dna_docin.readFloat("x1cc_ballCameraBoostSpringTardis");
/* x1d0_ballCameraControlDistance */ /* x1d0_ballCameraControlDistance */
x1d0_ballCameraControlDistance = __dna_docin.readFloat("x1d0_ballCameraControlDistance"); x1d0_ballCameraControlDistance = __dna_docin.readFloat("x1d0_ballCameraControlDistance");
/* x1d4_ */ /* x1d4_ */
@ -811,30 +811,30 @@ void CTweakBall::write(athena::io::YAMLDocWriter& __dna_docout) const
__dna_docout.writeFloat("x8c_ballCameraBackwardsDistance", x8c_ballCameraBackwardsDistance); __dna_docout.writeFloat("x8c_ballCameraBackwardsDistance", x8c_ballCameraBackwardsDistance);
/* x90_ */ /* x90_ */
__dna_docout.writeFloat("x90_", x90_); __dna_docout.writeFloat("x90_", x90_);
/* x94_ballCameraSpringTardis */ /* x94_ballCameraSpringConstant */
__dna_docout.writeFloat("x94_ballCameraSpringTardis", x94_ballCameraSpringTardis); __dna_docout.writeFloat("x94_ballCameraSpringConstant", x94_ballCameraSpringConstant);
/* x98_ballCameraSpringMax */ /* x98_ballCameraSpringMax */
__dna_docout.writeFloat("x98_ballCameraSpringMax", x98_ballCameraSpringMax); __dna_docout.writeFloat("x98_ballCameraSpringMax", x98_ballCameraSpringMax);
/* x9c_ballCameraSpringConstant */ /* x9c_ballCameraSpringTardis */
__dna_docout.writeFloat("x9c_ballCameraSpringConstant", x9c_ballCameraSpringConstant); __dna_docout.writeFloat("x9c_ballCameraSpringTardis", x9c_ballCameraSpringTardis);
/* xa0_ballCameraCentroidSpringTardis */ /* xa0_ballCameraCentroidSpringConstant */
__dna_docout.writeFloat("xa0_ballCameraCentroidSpringTardis", xa0_ballCameraCentroidSpringTardis); __dna_docout.writeFloat("xa0_ballCameraCentroidSpringConstant", xa0_ballCameraCentroidSpringConstant);
/* xa4_ballCameraCentroidSpringMax */ /* xa4_ballCameraCentroidSpringMax */
__dna_docout.writeFloat("xa4_ballCameraCentroidSpringMax", xa4_ballCameraCentroidSpringMax); __dna_docout.writeFloat("xa4_ballCameraCentroidSpringMax", xa4_ballCameraCentroidSpringMax);
/* xa8_ballCameraCentroidSpringConstant */ /* xa8_ballCameraCentroidSpringTardis */
__dna_docout.writeFloat("xa8_ballCameraCentroidSpringConstant", xa8_ballCameraCentroidSpringConstant); __dna_docout.writeFloat("xa8_ballCameraCentroidSpringTardis", xa8_ballCameraCentroidSpringTardis);
/* xac_ballCameraCentroidDistanceSpringTardis */ /* xac_ballCameraCentroidDistanceSpringConstant */
__dna_docout.writeFloat("xac_ballCameraCentroidDistanceSpringTardis", xac_ballCameraCentroidDistanceSpringTardis); __dna_docout.writeFloat("xac_ballCameraCentroidDistanceSpringConstant", xac_ballCameraCentroidDistanceSpringConstant);
/* xb0_ballCameraCentroidDistanceSpringMax */ /* xb0_ballCameraCentroidDistanceSpringMax */
__dna_docout.writeFloat("xb0_ballCameraCentroidDistanceSpringMax", xb0_ballCameraCentroidDistanceSpringMax); __dna_docout.writeFloat("xb0_ballCameraCentroidDistanceSpringMax", xb0_ballCameraCentroidDistanceSpringMax);
/* xb4_ballCameraCentroidDistanceSpringConstant */ /* xb4_ballCameraCentroidDistanceSpringTardis */
__dna_docout.writeFloat("xb4_ballCameraCentroidDistanceSpringConstant", xb4_ballCameraCentroidDistanceSpringConstant); __dna_docout.writeFloat("xb4_ballCameraCentroidDistanceSpringTardis", xb4_ballCameraCentroidDistanceSpringTardis);
/* xb8_ballCameraLookAtSpringTardis */ /* xb8_ballCameraLookAtSpringConstant */
__dna_docout.writeFloat("xb8_ballCameraLookAtSpringTardis", xb8_ballCameraLookAtSpringTardis); __dna_docout.writeFloat("xb8_ballCameraLookAtSpringConstant", xb8_ballCameraLookAtSpringConstant);
/* xbc_ballCameraLookAtSpringMax */ /* xbc_ballCameraLookAtSpringMax */
__dna_docout.writeFloat("xbc_ballCameraLookAtSpringMax", xbc_ballCameraLookAtSpringMax); __dna_docout.writeFloat("xbc_ballCameraLookAtSpringMax", xbc_ballCameraLookAtSpringMax);
/* xc0_ballCameraLookAtSpringConstant */ /* xc0_ballCameraLookAtSpringTardis */
__dna_docout.writeFloat("xc0_ballCameraLookAtSpringConstant", xc0_ballCameraLookAtSpringConstant); __dna_docout.writeFloat("xc0_ballCameraLookAtSpringTardis", xc0_ballCameraLookAtSpringTardis);
/* x154_ */ /* x154_ */
__dna_docout.writeFloat("x154_", x154_); __dna_docout.writeFloat("x154_", x154_);
/* x15c_ */ /* x15c_ */
@ -863,12 +863,12 @@ void CTweakBall::write(athena::io::YAMLDocWriter& __dna_docout) const
__dna_docout.writeFloat("x188_ballCameraChaseAnglePerSecond", x188_ballCameraChaseAnglePerSecond); __dna_docout.writeFloat("x188_ballCameraChaseAnglePerSecond", x188_ballCameraChaseAnglePerSecond);
/* x18c_ballCameraChaseLookAtOffset */ /* x18c_ballCameraChaseLookAtOffset */
__dna_docout.writeVec3f("x18c_ballCameraChaseLookAtOffset", x18c_ballCameraChaseLookAtOffset); __dna_docout.writeVec3f("x18c_ballCameraChaseLookAtOffset", x18c_ballCameraChaseLookAtOffset);
/* x198_ballCameraChaseSpringTardis */ /* x198_ballCameraChaseSpringConstant */
__dna_docout.writeFloat("x198_ballCameraChaseSpringTardis", x198_ballCameraChaseSpringTardis); __dna_docout.writeFloat("x198_ballCameraChaseSpringConstant", x198_ballCameraChaseSpringConstant);
/* x19c_ballCameraChaseSpringMax */ /* x19c_ballCameraChaseSpringMax */
__dna_docout.writeFloat("x19c_ballCameraChaseSpringMax", x19c_ballCameraChaseSpringMax); __dna_docout.writeFloat("x19c_ballCameraChaseSpringMax", x19c_ballCameraChaseSpringMax);
/* x1a0_ballCameraChaseSpringConstant */ /* x1a0_ballCameraChaseSpringTardis */
__dna_docout.writeFloat("x1a0_ballCameraChaseSpringConstant", x1a0_ballCameraChaseSpringConstant); __dna_docout.writeFloat("x1a0_ballCameraChaseSpringTardis", x1a0_ballCameraChaseSpringTardis);
/* x1a4_ballCameraBoostElevation */ /* x1a4_ballCameraBoostElevation */
__dna_docout.writeFloat("x1a4_ballCameraBoostElevation", x1a4_ballCameraBoostElevation); __dna_docout.writeFloat("x1a4_ballCameraBoostElevation", x1a4_ballCameraBoostElevation);
/* x1a8_ballCameraBoostDampenAngle */ /* x1a8_ballCameraBoostDampenAngle */
@ -881,12 +881,12 @@ void CTweakBall::write(athena::io::YAMLDocWriter& __dna_docout) const
__dna_docout.writeFloat("x1b4_ballCameraBoostAnglePerSecond", x1b4_ballCameraBoostAnglePerSecond); __dna_docout.writeFloat("x1b4_ballCameraBoostAnglePerSecond", x1b4_ballCameraBoostAnglePerSecond);
/* x1b8_ballCameraBoostLookAtOffset */ /* x1b8_ballCameraBoostLookAtOffset */
__dna_docout.writeVec3f("x1b8_ballCameraBoostLookAtOffset", x1b8_ballCameraBoostLookAtOffset); __dna_docout.writeVec3f("x1b8_ballCameraBoostLookAtOffset", x1b8_ballCameraBoostLookAtOffset);
/* x1c4_ballCameraBoostSpringTardis */ /* x1c4_ballCameraBoostSpringConstant */
__dna_docout.writeFloat("x1c4_ballCameraBoostSpringTardis", x1c4_ballCameraBoostSpringTardis); __dna_docout.writeFloat("x1c4_ballCameraBoostSpringConstant", x1c4_ballCameraBoostSpringConstant);
/* x1c8_ballCameraBoostSpringMax */ /* x1c8_ballCameraBoostSpringMax */
__dna_docout.writeFloat("x1c8_ballCameraBoostSpringMax", x1c8_ballCameraBoostSpringMax); __dna_docout.writeFloat("x1c8_ballCameraBoostSpringMax", x1c8_ballCameraBoostSpringMax);
/* x1cc_ballCameraBoostSpringConstant */ /* x1cc_ballCameraBoostSpringTardis */
__dna_docout.writeFloat("x1cc_ballCameraBoostSpringConstant", x1cc_ballCameraBoostSpringConstant); __dna_docout.writeFloat("x1cc_ballCameraBoostSpringTardis", x1cc_ballCameraBoostSpringTardis);
/* x1d0_ballCameraControlDistance */ /* x1d0_ballCameraControlDistance */
__dna_docout.writeFloat("x1d0_ballCameraControlDistance", x1d0_ballCameraControlDistance); __dna_docout.writeFloat("x1d0_ballCameraControlDistance", x1d0_ballCameraControlDistance);
/* x1d4_ */ /* x1d4_ */

View File

@ -25,18 +25,18 @@ struct CTweakBall final : public ITweakBall
Value<float> x88_ballCameraMaxSpeedDistance; Value<float> x88_ballCameraMaxSpeedDistance;
Value<float> x8c_ballCameraBackwardsDistance; Value<float> x8c_ballCameraBackwardsDistance;
Value<float> x90_; Value<float> x90_;
Value<float> x94_ballCameraSpringTardis; Value<float> x94_ballCameraSpringConstant;
Value<float> x98_ballCameraSpringMax; Value<float> x98_ballCameraSpringMax;
Value<float> x9c_ballCameraSpringConstant; Value<float> x9c_ballCameraSpringTardis;
Value<float> xa0_ballCameraCentroidSpringTardis; Value<float> xa0_ballCameraCentroidSpringConstant;
Value<float> xa4_ballCameraCentroidSpringMax; Value<float> xa4_ballCameraCentroidSpringMax;
Value<float> xa8_ballCameraCentroidSpringConstant; Value<float> xa8_ballCameraCentroidSpringTardis;
Value<float> xac_ballCameraCentroidDistanceSpringTardis; Value<float> xac_ballCameraCentroidDistanceSpringConstant;
Value<float> xb0_ballCameraCentroidDistanceSpringMax; Value<float> xb0_ballCameraCentroidDistanceSpringMax;
Value<float> xb4_ballCameraCentroidDistanceSpringConstant; Value<float> xb4_ballCameraCentroidDistanceSpringTardis;
Value<float> xb8_ballCameraLookAtSpringTardis; Value<float> xb8_ballCameraLookAtSpringConstant;
Value<float> xbc_ballCameraLookAtSpringMax; Value<float> xbc_ballCameraLookAtSpringMax;
Value<float> xc0_ballCameraLookAtSpringConstant; Value<float> xc0_ballCameraLookAtSpringTardis;
Value<float> xc4_ballForwardBrakingAcceleration[8]; Value<float> xc4_ballForwardBrakingAcceleration[8];
Value<float> xe4_ballGravity; Value<float> xe4_ballGravity;
Value<float> xe8_ballWaterGravity; Value<float> xe8_ballWaterGravity;
@ -74,18 +74,18 @@ struct CTweakBall final : public ITweakBall
Value<float> x184_ballCameraChaseYawSpeed; Value<float> x184_ballCameraChaseYawSpeed;
Value<float> x188_ballCameraChaseAnglePerSecond; Value<float> x188_ballCameraChaseAnglePerSecond;
Value<zeus::CVector3f> x18c_ballCameraChaseLookAtOffset; Value<zeus::CVector3f> x18c_ballCameraChaseLookAtOffset;
Value<float> x198_ballCameraChaseSpringTardis; Value<float> x198_ballCameraChaseSpringConstant;
Value<float> x19c_ballCameraChaseSpringMax; Value<float> x19c_ballCameraChaseSpringMax;
Value<float> x1a0_ballCameraChaseSpringConstant; Value<float> x1a0_ballCameraChaseSpringTardis;
Value<float> x1a4_ballCameraBoostElevation; Value<float> x1a4_ballCameraBoostElevation;
Value<float> x1a8_ballCameraBoostDampenAngle; Value<float> x1a8_ballCameraBoostDampenAngle;
Value<float> x1ac_ballCameraBoostDistance; Value<float> x1ac_ballCameraBoostDistance;
Value<float> x1b0_ballCameraBoostYawSpeed; Value<float> x1b0_ballCameraBoostYawSpeed;
Value<float> x1b4_ballCameraBoostAnglePerSecond; Value<float> x1b4_ballCameraBoostAnglePerSecond;
Value<zeus::CVector3f> x1b8_ballCameraBoostLookAtOffset; Value<zeus::CVector3f> x1b8_ballCameraBoostLookAtOffset;
Value<float> x1c4_ballCameraBoostSpringTardis; Value<float> x1c4_ballCameraBoostSpringConstant;
Value<float> x1c8_ballCameraBoostSpringMax; Value<float> x1c8_ballCameraBoostSpringMax;
Value<float> x1cc_ballCameraBoostSpringConstant; Value<float> x1cc_ballCameraBoostSpringTardis;
Value<float> x1d0_ballCameraControlDistance; Value<float> x1d0_ballCameraControlDistance;
Value<float> x1d4_; Value<float> x1d4_;
Value<float> x1d8_; Value<float> x1d8_;
@ -139,18 +139,18 @@ struct CTweakBall final : public ITweakBall
float GetBallCameraMinSpeedDistance() const { return x84_ballCameraMinSpeedDistance; } float GetBallCameraMinSpeedDistance() const { return x84_ballCameraMinSpeedDistance; }
float GetBallCameraMaxSpeedDistance() const { return x88_ballCameraMaxSpeedDistance; } float GetBallCameraMaxSpeedDistance() const { return x88_ballCameraMaxSpeedDistance; }
float GetBallCameraBackwardsDistance() const { return x8c_ballCameraBackwardsDistance; } float GetBallCameraBackwardsDistance() const { return x8c_ballCameraBackwardsDistance; }
float GetBallCameraSpringTardis() const { return x94_ballCameraSpringTardis; } float GetBallCameraSpringConstant() const { return x94_ballCameraSpringConstant; }
float GetBallCameraSpringMax() const { return x98_ballCameraSpringMax; } float GetBallCameraSpringMax() const { return x98_ballCameraSpringMax; }
float GetBallCameraSpringConstant() const { return x9c_ballCameraSpringConstant; } float GetBallCameraSpringTardis() const { return x9c_ballCameraSpringTardis; }
float GetBallCameraCentroidSpringTardis() const { return xa0_ballCameraCentroidSpringTardis; } float GetBallCameraCentroidSpringConstant() const { return xa0_ballCameraCentroidSpringConstant; }
float GetBallCameraCentroidSpringMax() const { return xa4_ballCameraCentroidSpringMax; } float GetBallCameraCentroidSpringMax() const { return xa4_ballCameraCentroidSpringMax; }
float GetBallCameraCentroidSpringConstant() const { return xa8_ballCameraCentroidSpringConstant; } float GetBallCameraCentroidSpringTardis() const { return xa8_ballCameraCentroidSpringTardis; }
float GetBallCameraCentroidDistanceSpringTardis() const { return xac_ballCameraCentroidDistanceSpringTardis; } float GetBallCameraCentroidDistanceSpringConstant() const { return xac_ballCameraCentroidDistanceSpringConstant; }
float GetBallCameraCentroidDistanceSpringMax() const { return xb0_ballCameraCentroidDistanceSpringMax; } float GetBallCameraCentroidDistanceSpringMax() const { return xb0_ballCameraCentroidDistanceSpringMax; }
float GetBallCameraCentroidDistanceSpringConstant() const { return xb4_ballCameraCentroidDistanceSpringConstant; } float GetBallCameraCentroidDistanceSpringTardis() const { return xb4_ballCameraCentroidDistanceSpringTardis; }
float GetBallCameraLookAtSpringTardis() const { return xb8_ballCameraLookAtSpringTardis; } float GetBallCameraLookAtSpringConstant() const { return xb8_ballCameraLookAtSpringConstant; }
float GetBallCameraLookAtSpringMax() const { return xbc_ballCameraLookAtSpringMax; } float GetBallCameraLookAtSpringMax() const { return xbc_ballCameraLookAtSpringMax; }
float GetBallCameraLookAtSpringConstant() const { return xc0_ballCameraLookAtSpringConstant; } float GetBallCameraLookAtSpringTardis() const { return xc0_ballCameraLookAtSpringTardis; }
float GetBallForwardBrakingAcceleration(int s) const { return xc4_ballForwardBrakingAcceleration[s]; } float GetBallForwardBrakingAcceleration(int s) const { return xc4_ballForwardBrakingAcceleration[s]; }
float GetBallGravity() const { return xe4_ballGravity; } float GetBallGravity() const { return xe4_ballGravity; }
float GetBallWaterGravity() const { return xe8_ballWaterGravity; } float GetBallWaterGravity() const { return xe8_ballWaterGravity; }
@ -161,18 +161,18 @@ struct CTweakBall final : public ITweakBall
float GetBallCameraChaseYawSpeed() const { return x184_ballCameraChaseYawSpeed; } float GetBallCameraChaseYawSpeed() const { return x184_ballCameraChaseYawSpeed; }
float GetBallCameraChaseAnglePerSecond() const { return x188_ballCameraChaseAnglePerSecond; } float GetBallCameraChaseAnglePerSecond() const { return x188_ballCameraChaseAnglePerSecond; }
const zeus::CVector3f& GetBallCameraChaseLookAtOffset() const { return x18c_ballCameraChaseLookAtOffset; } const zeus::CVector3f& GetBallCameraChaseLookAtOffset() const { return x18c_ballCameraChaseLookAtOffset; }
float GetBallCameraChaseSpringTardis() const { return x198_ballCameraChaseSpringTardis; } float GetBallCameraChaseSpringConstant() const { return x198_ballCameraChaseSpringConstant; }
float GetBallCameraChaseSpringMax() const { return x19c_ballCameraChaseSpringMax; } float GetBallCameraChaseSpringMax() const { return x19c_ballCameraChaseSpringMax; }
float GetBallCameraChaseSpringConstant() const { return x1a0_ballCameraChaseSpringConstant; } float GetBallCameraChaseSpringTardis() const { return x1a0_ballCameraChaseSpringTardis; }
float GetBallCameraBoostElevation() const { return x1a4_ballCameraBoostElevation; } float GetBallCameraBoostElevation() const { return x1a4_ballCameraBoostElevation; }
float GetBallCameraBoostDampenAngle() const { return x1a8_ballCameraBoostDampenAngle; } float GetBallCameraBoostDampenAngle() const { return x1a8_ballCameraBoostDampenAngle; }
float GetBallCameraBoostDistance() const { return x1ac_ballCameraBoostDistance; } float GetBallCameraBoostDistance() const { return x1ac_ballCameraBoostDistance; }
float GetBallCameraBoostYawSpeed() const { return x1b0_ballCameraBoostYawSpeed; } float GetBallCameraBoostYawSpeed() const { return x1b0_ballCameraBoostYawSpeed; }
float GetBallCameraBoostAnglePerSecond() const { return x1b4_ballCameraBoostAnglePerSecond; } float GetBallCameraBoostAnglePerSecond() const { return x1b4_ballCameraBoostAnglePerSecond; }
const zeus::CVector3f& GetBallCameraBoostLookAtOffset() const { return x1b8_ballCameraBoostLookAtOffset; } const zeus::CVector3f& GetBallCameraBoostLookAtOffset() const { return x1b8_ballCameraBoostLookAtOffset; }
float GetBallCameraBoostSpringTardis() const { return x1c4_ballCameraBoostSpringTardis; } float GetBallCameraBoostSpringConstant() const { return x1c4_ballCameraBoostSpringConstant; }
float GetBallCameraBoostSpringMax() const { return x1c8_ballCameraBoostSpringMax; } float GetBallCameraBoostSpringMax() const { return x1c8_ballCameraBoostSpringMax; }
float GetBallCameraBoostSpringConstant() const { return x1cc_ballCameraBoostSpringConstant; } float GetBallCameraBoostSpringTardis() const { return x1cc_ballCameraBoostSpringTardis; }
float GetBallCameraControlDistance() const { return x1d0_ballCameraControlDistance; } float GetBallCameraControlDistance() const { return x1d0_ballCameraControlDistance; }
float GetMinimumAlignmentSpeed() const { return x1dc_minimumAlignmentSpeed; } float GetMinimumAlignmentSpeed() const { return x1dc_minimumAlignmentSpeed; }
float GetTireness() const { return x1e0_tireness; } float GetTireness() const { return x1e0_tireness; }

View File

@ -1488,7 +1488,7 @@ bool CStateManager::TestRayDamage(const zeus::CVector3f& pos, const CActor& dama
float origMag = dir.magnitude(); float origMag = dir.magnitude();
dir = dir * (1.f / origMag); dir = dir * (1.f / origMag);
if (RayCollideWorld(pos, center, nearList, filter, damagee)) if (RayCollideWorld(pos, center, nearList, filter, &damagee))
return true; return true;
zeus::CMRay ray(pos, dir, origMag); zeus::CMRay ray(pos, dir, origMag);
@ -1505,21 +1505,21 @@ bool CStateManager::TestRayDamage(const zeus::CVector3f& pos, const CActor& dama
} }
bool CStateManager::RayCollideWorld(const zeus::CVector3f& start, const zeus::CVector3f& end, bool CStateManager::RayCollideWorld(const zeus::CVector3f& start, const zeus::CVector3f& end,
const CMaterialFilter& filter, const CActor& damagee) const const CMaterialFilter& filter, const CActor* damagee) const
{ {
zeus::CVector3f delta = end - start; zeus::CVector3f delta = end - start;
float mag = delta.magnitude(); float mag = delta.magnitude();
delta = delta / mag; delta = delta / mag;
rstl::reserved_vector<TUniqueId, 1024> nearList; rstl::reserved_vector<TUniqueId, 1024> nearList;
BuildNearList(nearList, start, delta, mag, filter, &damagee); BuildNearList(nearList, start, delta, mag, filter, damagee);
return RayCollideWorldInternal(start, end, filter, nearList, &damagee); return RayCollideWorldInternal(start, end, filter, nearList, damagee);
} }
bool CStateManager::RayCollideWorld(const zeus::CVector3f& start, const zeus::CVector3f& end, bool CStateManager::RayCollideWorld(const zeus::CVector3f& start, const zeus::CVector3f& end,
const rstl::reserved_vector<TUniqueId, 1024>& nearList, const rstl::reserved_vector<TUniqueId, 1024>& nearList,
const CMaterialFilter& filter, const CActor& damagee) const const CMaterialFilter& filter, const CActor* damagee) const
{ {
return RayCollideWorldInternal(start, end, filter, nearList, &damagee); return RayCollideWorldInternal(start, end, filter, nearList, damagee);
} }
bool CStateManager::RayCollideWorldInternal(const zeus::CVector3f& start, const zeus::CVector3f& end, bool CStateManager::RayCollideWorldInternal(const zeus::CVector3f& start, const zeus::CVector3f& end,

View File

@ -308,10 +308,10 @@ public:
bool TestRayDamage(const zeus::CVector3f& pos, const CActor& damagee, bool TestRayDamage(const zeus::CVector3f& pos, const CActor& damagee,
const rstl::reserved_vector<TUniqueId, 1024>& nearList) const; const rstl::reserved_vector<TUniqueId, 1024>& nearList) const;
bool RayCollideWorld(const zeus::CVector3f& start, const zeus::CVector3f& end, bool RayCollideWorld(const zeus::CVector3f& start, const zeus::CVector3f& end,
const CMaterialFilter& filter, const CActor& damagee) const; const CMaterialFilter& filter, const CActor* damagee) const;
bool RayCollideWorld(const zeus::CVector3f& start, const zeus::CVector3f& end, bool RayCollideWorld(const zeus::CVector3f& start, const zeus::CVector3f& end,
const rstl::reserved_vector<TUniqueId, 1024>& nearList, const rstl::reserved_vector<TUniqueId, 1024>& nearList,
const CMaterialFilter& filter, const CActor& damagee) const; const CMaterialFilter& filter, const CActor* damagee) const;
bool RayCollideWorldInternal(const zeus::CVector3f& start, const zeus::CVector3f& end, bool RayCollideWorldInternal(const zeus::CVector3f& start, const zeus::CVector3f& end,
const CMaterialFilter& filter, const CMaterialFilter& filter,
const rstl::reserved_vector<TUniqueId, 1024>& nearList, const rstl::reserved_vector<TUniqueId, 1024>& nearList,

View File

@ -6,27 +6,32 @@
#include "World/CPlayer.hpp" #include "World/CPlayer.hpp"
#include "Input/ControlMapper.hpp" #include "Input/ControlMapper.hpp"
#include "Camera/CFirstPersonCamera.hpp" #include "Camera/CFirstPersonCamera.hpp"
#include "Camera/CPathCamera.hpp"
#include "World/CScriptSpindleCamera.hpp"
#include "World/CScriptCameraHint.hpp"
#include "World/CScriptDoor.hpp"
#include "World/CScriptWater.hpp"
namespace urde namespace urde
{ {
void CCameraSpring::Reset() void CCameraSpring::Reset()
{ {
x4_tardis2Sqrt = 2.f * std::sqrt(x0_tardis); x4_k2Sqrt = 2.f * std::sqrt(x0_k);
x10_dx = 0.f; x10_dx = 0.f;
} }
float CCameraSpring::ApplyDistanceSpringNoMax(float targetX, float curX, float dt) float CCameraSpring::ApplyDistanceSpringNoMax(float targetX, float curX, float dt)
{ {
float usePos = xc_k * x10_dx * dt + curX; float usePos = xc_tardis * x10_dx * dt + curX;
x10_dx += xc_k * (x0_tardis * (targetX - curX) - x4_tardis2Sqrt * x10_dx) * dt; x10_dx += xc_tardis * (x0_k * (targetX - curX) - x4_k2Sqrt * x10_dx) * dt;
return std::max(usePos, targetX); return std::max(usePos, targetX);
} }
float CCameraSpring::ApplyDistanceSpring(float targetX, float curX, float dt) float CCameraSpring::ApplyDistanceSpring(float targetX, float curX, float dt)
{ {
float usePos = xc_k * x10_dx * dt + curX; float usePos = xc_tardis * x10_dx * dt + curX;
x10_dx += xc_k * (x0_tardis * (targetX - curX) - x4_tardis2Sqrt * x10_dx) * dt; x10_dx += xc_tardis * (x0_k * (targetX - curX) - x4_k2Sqrt * x10_dx) * dt;
usePos = std::max(usePos, targetX); usePos = std::max(usePos, targetX);
if (usePos - targetX > x8_max) if (usePos - targetX > x8_max)
usePos = targetX + x8_max; usePos = targetX + x8_max;
@ -38,25 +43,25 @@ CBallCamera::CBallCamera(TUniqueId uid, TUniqueId watchedId, const zeus::CTransf
: CGameCamera(uid, true, "Ball Camera", : CGameCamera(uid, true, "Ball Camera",
CEntityInfo(kInvalidAreaId, CEntity::NullConnectionList), CEntityInfo(kInvalidAreaId, CEntity::NullConnectionList),
xf, fovy, znear, zfar, aspect, watchedId, false, 0), xf, fovy, znear, zfar, aspect, watchedId, false, 0),
x214_ballCameraSpring(g_tweakBall->GetBallCameraSpringTardis(), x214_ballCameraSpring(g_tweakBall->GetBallCameraSpringConstant(),
g_tweakBall->GetBallCameraSpringMax(), g_tweakBall->GetBallCameraSpringMax(),
g_tweakBall->GetBallCameraSpringConstant()), g_tweakBall->GetBallCameraSpringTardis()),
x228_ballCameraCentroidSpring(g_tweakBall->GetBallCameraCentroidSpringTardis(), x228_ballCameraCentroidSpring(g_tweakBall->GetBallCameraCentroidSpringConstant(),
g_tweakBall->GetBallCameraCentroidSpringMax(), g_tweakBall->GetBallCameraCentroidSpringMax(),
g_tweakBall->GetBallCameraCentroidSpringConstant()), g_tweakBall->GetBallCameraCentroidSpringTardis()),
x23c_ballCameraLookAtSpring(g_tweakBall->GetBallCameraLookAtSpringTardis(), x23c_ballCameraLookAtSpring(g_tweakBall->GetBallCameraLookAtSpringConstant(),
g_tweakBall->GetBallCameraLookAtSpringMax(), g_tweakBall->GetBallCameraLookAtSpringMax(),
g_tweakBall->GetBallCameraLookAtSpringConstant()), g_tweakBall->GetBallCameraLookAtSpringTardis()),
x250_ballCameraCentroidDistanceSpring(g_tweakBall->GetBallCameraCentroidDistanceSpringTardis(), x250_ballCameraCentroidDistanceSpring(g_tweakBall->GetBallCameraCentroidDistanceSpringConstant(),
g_tweakBall->GetBallCameraCentroidDistanceSpringMax(), g_tweakBall->GetBallCameraCentroidDistanceSpringMax(),
g_tweakBall->GetBallCameraCentroidDistanceSpringConstant()), g_tweakBall->GetBallCameraCentroidDistanceSpringTardis()),
x37c_camSpline(false), x37c_camSpline(false),
x41c_ballCameraChaseSpring(g_tweakBall->GetBallCameraChaseSpringTardis(), x41c_ballCameraChaseSpring(g_tweakBall->GetBallCameraChaseSpringConstant(),
g_tweakBall->GetBallCameraChaseSpringMax(), g_tweakBall->GetBallCameraChaseSpringMax(),
g_tweakBall->GetBallCameraChaseSpringConstant()), g_tweakBall->GetBallCameraChaseSpringTardis()),
x448_ballCameraBoostSpring(g_tweakBall->GetBallCameraBoostSpringTardis(), x448_ballCameraBoostSpring(g_tweakBall->GetBallCameraBoostSpringConstant(),
g_tweakBall->GetBallCameraBoostSpringMax(), g_tweakBall->GetBallCameraBoostSpringMax(),
g_tweakBall->GetBallCameraBoostSpringConstant()) g_tweakBall->GetBallCameraBoostSpringTardis())
{ {
x18c_24_ = true; x18c_24_ = true;
x18c_25_ = true; x18c_25_ = true;
@ -345,38 +350,317 @@ void CBallCamera::ResetSpline(CStateManager& mgr)
void CBallCamera::BuildSpline(CStateManager& mgr) void CBallCamera::BuildSpline(CStateManager& mgr)
{ {
zeus::CVector3f ballPos = mgr.GetPlayer().GetBallPosition();
x36c_ = 2;
x370_24_ = false;
x37c_camSpline.Reset(4);
x37c_camSpline.AddKnot(GetTranslation(), zeus::CVector3f::skForward);
float elevation = x1a0_elevation;
float distance = x190_curMinDistance;
ConstrainElevationAndDistance(elevation, distance, 0.f, mgr);
zeus::CVector3f f30f31 = (ballPos.toVec2f() - GetTranslation().toVec2f()) * 0.5f + GetTranslation().toVec2f();
f30f31.z = GetTranslation().z;
zeus::CVector3f x978 = GetTranslation() - f30f31;
zeus::CQuaternion rot;
rot.rotateZ(zeus::degToRad(45.f));
if (mgr.GetPlayer().GetMoveDir().cross(x34_transform.basis[1]).z >= 0.f)
{
rot = zeus::CQuaternion();
rot.rotateZ(zeus::degToRad(-45.f));
}
x978 = rot.transform(x978);
zeus::CVector3f x994 = f30f31 + x978;
TUniqueId intersectId = kInvalidUniqueId;
rstl::reserved_vector<TUniqueId, 1024> nearList;
CRayCastResult result =
mgr.RayWorldIntersection(intersectId, x994, -x978.normalized(), x978.magnitude(), BallCameraFilter, nearList);
if (result.IsValid())
x994 = x978.normalized() * 1.5f + result.GetPoint();
else
x994 = f30f31 + x978;
x37c_camSpline.AddKnot(x994, zeus::CVector3f::skForward);
FindDesiredPosition(distance, elevation, mgr.GetPlayer().GetMoveDir(), mgr);
x978 = rot.transform(x978);
zeus::CVector3f x9ac = f30f31 + x978;
result =
mgr.RayWorldIntersection(intersectId, x9ac, -x978.normalized(), x978.magnitude(), BallCameraFilter, nearList);
if (result.IsValid())
x9ac = x978.normalized() * 2.f + result.GetPoint();
else
x9ac = f30f31 + x978;
x37c_camSpline.AddKnot(x9ac, zeus::CVector3f::skForward);
x978 = rot.transform(x978);
zeus::CVector3f x9b8 = x978 + f30f31;
result =
mgr.RayWorldIntersection(intersectId, x9b8, -x978.normalized(), x978.magnitude(), BallCameraFilter, nearList);
if (result.IsValid())
x9b8 = x978.normalized() * 2.f + result.GetPoint();
else
x9b8 = f30f31 + x978;
x37c_camSpline.AddKnot(x9b8, zeus::CVector3f::skForward);
CMaterialList intersectMat;
if (!SplineIntersectTest(intersectMat, mgr) && intersectMat.HasMaterial(EMaterialTypes::Wall))
{
x978 = x994 - f30f31;
result =
mgr.RayWorldIntersection(intersectId, x994, -x978.normalized(), x978.magnitude(), BallCameraFilter, nearList);
if (result.IsValid() && !result.GetMaterial().HasMaterial(EMaterialTypes::Pillar))
x37c_camSpline.SetKnotPosition(1, result.GetPoint() - x978.normalized() * 0.3f * 1.25f);
x978 = x9ac - f30f31;
result =
mgr.RayWorldIntersection(intersectId, x9ac, -x978.normalized(), x978.magnitude(), BallCameraFilter, nearList);
if (result.IsValid() && !result.GetMaterial().HasMaterial(EMaterialTypes::Pillar))
x37c_camSpline.SetKnotPosition(2, result.GetPoint() - x978.normalized() * 0.3f * 1.25f);
x37c_camSpline.x44_ = x37c_camSpline.CalculateSplineLength();
if (!SplineIntersectTest(intersectMat, mgr))
{
x36c_ = 0;
return;
}
}
x374_ = 0.5f;
x378_ = 0.5f;
x37c_camSpline.x44_ = x37c_camSpline.CalculateSplineLength();
x3c8_ = CMaterialList();
} }
bool CBallCamera::ShouldResetSpline(CStateManager& mgr) const bool CBallCamera::ShouldResetSpline(CStateManager& mgr) const
{ {
return false; return x400_state != EBallCameraState::Four && !mgr.GetCameraManager()->IsInterpolationCameraActive() &&
mgr.GetPlayer().GetMorphBall()->GetSpiderBallState() != CMorphBall::ESpiderBallState::Active &&
x36c_ == 0 && (x188_behaviour > EBallCameraBehaviour::Eight || x188_behaviour < EBallCameraBehaviour::Four);
} }
void CBallCamera::UpdatePlayerMovement(float dt, CStateManager& mgr) void CBallCamera::UpdatePlayerMovement(float dt, CStateManager& mgr)
{ {
x2ec_ = std::fabs(mgr.GetPlayer().GetActualBallMaxVelocity(dt));
zeus::CVector3f ballPos = mgr.GetPlayer().GetBallPosition();
x2f0_ = ballPos - x2dc_;
x2fc_ = x2f0_;
x2fc_.z = 0.f;
if (x2fc_.canBeNormalized())
x2e8_ = x2fc_.magnitude() / dt;
else
x2e8_ = 0.f;
x2dc_ = ballPos;
x18d_28_ = false;
zeus::CVector3f x5c = ballPos - GetTranslation();
x5c.z = 0.f;
if (x5c.canBeNormalized())
{
x5c.normalize();
if (std::fabs(std::acos(zeus::clamp(-1.f, x5c.dot(mgr.GetPlayer().GetMoveDir()), 1.f))) >
zeus::degToRad(100.f))
x18d_28_ = true;
}
x308_ = 0.f;
float f3 = x2e8_ - 4.f;
if (f3 > 0.f)
x308_ = zeus::clamp(-1.f, std::fabs(std::sin(zeus::degToRad(f3 / (x2ec_ - 4.f) * 90.f))), 1.f);
x190_curMinDistance = x308_ * (x198_maxDistance - x194_targetMinDistance) + x194_targetMinDistance;
if (x308_ > 0.5f && mgr.GetPlayer().GetPlayerMovementState() == CPlayer::EPlayerMovementState::OnGround)
x30c_ += dt * x308_;
else
x30c_ = 0.f;
x30c_ = zeus::clamp(0.f, x30c_, 3.f);
} }
void CBallCamera::UpdateTransform(const zeus::CVector3f& lookDir, const zeus::CVector3f& pos, void CBallCamera::UpdateTransform(const zeus::CVector3f& lookDir, const zeus::CVector3f& pos,
float dt, CStateManager& mgr) float dt, CStateManager& mgr)
{ {
zeus::CVector3f useLookDir = lookDir;
if (x18d_31_)
if (const CScriptCameraHint* hint = mgr.GetCameraManager()->GetCameraHint(mgr))
useLookDir = hint->GetTransform().basis[1];
zeus::CVector3f lookDirFlat = useLookDir;
lookDirFlat.z = 0.f;
if (!lookDirFlat.canBeNormalized())
{
SetTranslation(pos);
return;
}
zeus::CVector3f curLookDir = x34_transform.basis[1];
if (curLookDir.canBeNormalized())
{
curLookDir.normalize();
}
else
{
SetTransform(zeus::lookAt(pos, pos + lookDir));
return;
}
float lookDirDot = zeus::clamp(-1.f, curLookDir.dot(lookDir), 1.f);
if (std::fabs(lookDirDot) >= 1.f)
{
SetTransform(zeus::lookAt(pos, pos + lookDir));
}
else
{
float f31 = zeus::clamp(0.f, std::acos(lookDirDot) / (zeus::degToRad(60.f) * dt), 1.f);
float x2b0 = dt * x1a4_curAnglePerSecond * f31;
float f29 = std::fabs(zeus::clamp(-1.f, lookDir.dot(zeus::CVector3f::skUp), 1.f));
float f28 = (1.f - f29) * zeus::degToRad(720.f) * dt;
if (x36c_ == 1)
{
f28 = zeus::degToRad(240.f) * dt;
if (x2b0 > f28)
x2b0 = f28;
}
if (x2b0 > f28 && !mgr.GetPlayer().IsMorphBallTransitioning() && f29 > 1.f)
x2b0 = f28;
switch (x400_state)
{
case EBallCameraState::Two:
if (x18c_25_)
x2b0 = dt * x40c_chaseAnglePerSecond * f31;
break;
case EBallCameraState::Three:
x2b0 = dt * x438_boostAnglePerSecond * f31;
break;
default:
break;
}
if (x18d_26_ || mgr.GetCameraManager()->IsInterpolationCameraActive())
{
x18d_26_ = false;
SetTransform(zeus::CQuaternion::lookAt(curLookDir, lookDir, 2.f * M_PIF).toTransform() *
x34_transform.getRotation());
}
else
{
SetTransform(zeus::CQuaternion::lookAt(curLookDir, lookDir, x2b0).toTransform() *
x34_transform.getRotation());
}
}
SetTranslation(pos);
} }
zeus::CVector3f CBallCamera::ConstrainYawAngle(const CPlayer& player, float f1, float f2, float dt) const zeus::CVector3f CBallCamera::ConstrainYawAngle(const CPlayer& player, float angleVel, float maxAngle, float dt,
CStateManager& mgr) const
{ {
return {}; zeus::CVector3f playerToCamFlat = GetTranslation() - player.GetTranslation();
playerToCamFlat.z = 0.f;
zeus::CVector3f lookDir = player.GetTransform().basis[1];
if (player.GetMorphballTransitionState() == CPlayer::EPlayerMorphBallState::Morphed)
{
lookDir = player.GetMoveDir();
TCastToConstPtr<CScriptDoor> door = mgr.GetObjectById(x3dc_tooCloseActorId);
if ((!door || !door->x2a8_26_) &&
(x400_state == EBallCameraState::Three || x400_state == EBallCameraState::Two))
lookDir = player.GetLeaveMorphDir();
}
if (player.GetMorphballTransitionState() == CPlayer::EPlayerMorphBallState::Unmorphing)
lookDir = player.GetLeaveMorphDir();
if (lookDir.canBeNormalized())
lookDir.normalize();
else
lookDir = -playerToCamFlat;
if (playerToCamFlat.canBeNormalized())
playerToCamFlat.normalize();
else
return -lookDir;
float angleProj = zeus::clamp(-1.f, playerToCamFlat.dot(-lookDir), 1.f);
if (angleProj >= 1.f)
return -lookDir;
return zeus::CQuaternion::lookAt(playerToCamFlat, -lookDir, angleVel * dt *
zeus::clamp(0.f, std::acos(angleProj) / maxAngle, 1.f)).transform(playerToCamFlat);
} }
void CBallCamera::CheckFailsafe(float dt, CStateManager& mgr) void CBallCamera::CheckFailsafe(float dt, CStateManager& mgr)
{ {
zeus::CVector3f ballPos = mgr.GetPlayer().GetBallPosition();
x18d_24_ = x18c_31_;
zeus::CVector3f camToBall = ballPos - GetTranslation();
float camToBallMag = camToBall.magnitude();
camToBall.normalize();
rstl::reserved_vector<TUniqueId, 1024> nearList;
mgr.BuildNearList(nearList, GetTranslation(), camToBall, camToBallMag, BallCameraFilter, nullptr);
CRayCastResult result =
mgr.RayWorldIntersection(x368_, GetTranslation(), camToBall, camToBallMag, BallCameraFilter, nearList);
if (result.IsValid())
{
x350_ = result.GetMaterial();
if (!mgr.RayCollideWorld(GetTranslation(), ballPos, nearList, BallCameraFilter, &mgr.GetPlayer()) &&
!mgr.RayCollideWorld(GetTranslation(), mgr.GetPlayer().GetTranslation(), nearList,
BallCameraFilter, &mgr.GetPlayer()))
{
x18c_31_ = false;
if (x18d_24_)
{
x35c_ = ballPos;
if (ShouldResetSpline(mgr) && !x18e_25_ && x350_.HasMaterial(EMaterialTypes::Floor) &&
mgr.RayCollideWorld(ballPos, ballPos + zeus::CVector3f(0.f, 0.f, -2.5f),
nearList, BallCameraFilter, nullptr))
ResetSpline(mgr);
}
}
}
else
{
x18c_31_ = true;
x350_ = CMaterialList(EMaterialTypes::Unknown);
}
if (!x18c_31_)
{
x34c_ += dt;
if (ShouldResetSpline(mgr) && !x18e_25_ && x350_.HasMaterial(EMaterialTypes::Pillar))
BuildSpline(mgr);
}
else
{
x34c_ = 0.f;
}
x358_ = zeus::clamp(0.f, x34c_ * 0.5f, 1.f);
x3e4_ = x18c_27_ && (x34c_ > 2.f || (x3dc_tooCloseActorId != kInvalidUniqueId && x34c_ > 1.f)) &&
!x18c_31_ && x36c_ == 0;
bool doFailsafe = x3e4_;
if ((GetTranslation() - ballPos).magnitude() < 0.3f + g_tweakPlayer->GetPlayerBallHalfExtent())
doFailsafe = true;
if (x18e_27_nearbyDoorClosed)
{
x18e_27_nearbyDoorClosed = false;
if (result.IsValid())
doFailsafe = true;
}
if (x18e_28_nearbyDoorClosing)
{
x18e_28_nearbyDoorClosing = false;
if (IsBallNearDoor(GetTranslation(), mgr))
doFailsafe = true;
}
if (doFailsafe)
ActivateFailsafe(dt, mgr);
} }
void CBallCamera::UpdateObjectTooCloseId(CStateManager& mgr) void CBallCamera::UpdateObjectTooCloseId(CStateManager& mgr)
{ {
x3e0_tooCloseActorDist = 1000000.f;
x3dc_tooCloseActorId = kInvalidUniqueId;
zeus::CVector3f ballPos = mgr.GetPlayer().GetBallPosition();
for (CEntity* ent : mgr.GetPlatformAndDoorObjectList())
{
if (TCastToPtr<CScriptDoor> door = ent)
{
if (mgr.GetPlayer().GetAreaIdAlways() == door->GetAreaIdAlways())
{
door->GetBoundingBox();
float minMag = std::min((door->GetTranslation() - GetTranslation()).magnitude(),
(door->GetTranslation() - ballPos).magnitude());
if (minMag < 30.f && minMag < x3e0_tooCloseActorDist)
{
x3dc_tooCloseActorId = door->GetUniqueId();
x3e0_tooCloseActorDist = minMag;
}
}
}
}
} }
void CBallCamera::UpdateAnglePerSecond(float dt) void CBallCamera::UpdateAnglePerSecond(float dt)
@ -390,22 +674,102 @@ void CBallCamera::UpdateAnglePerSecond(float dt)
void CBallCamera::UpdateUsingPathCameras(float dt, CStateManager& mgr) void CBallCamera::UpdateUsingPathCameras(float dt, CStateManager& mgr)
{ {
if (TCastToPtr<CPathCamera> cam = mgr.ObjectById(mgr.GetCameraManager()->GetPathCameraId()))
{
TeleportCamera(cam->GetTransform(), mgr);
x18d_26_ = true;
}
} }
zeus::CVector3f CBallCamera::GetFixedLookTarget(const zeus::CVector3f& pos, CStateManager& mgr) const zeus::CVector3f CBallCamera::GetFixedLookTarget(const zeus::CVector3f& pos, CStateManager& mgr) const
{ {
return {}; const CScriptCameraHint* hint = mgr.GetCameraManager()->GetCameraHint(mgr);
if (!hint)
return pos;
zeus::CVector3f lookDir = hint->GetTransform().basis[1];
zeus::CVector3f lookDirFlat = lookDir;
lookDirFlat.z = 0.f;
if (lookDir.canBeNormalized() && lookDirFlat.canBeNormalized())
{
lookDir.normalize();
lookDirFlat.normalize();
}
else
{
lookDir = zeus::CVector3f::skForward;
lookDirFlat = zeus::CVector3f::skForward;
}
zeus::CVector3f posFlat = pos;
posFlat.z = 0.f;
if (pos.canBeNormalized() && posFlat.canBeNormalized())
posFlat.normalize();
else
posFlat = lookDirFlat;
float f31 = std::acos(zeus::clamp(-1.f, pos.dot(posFlat), 1.f));
if (x18c_29_)
{
float f1 = std::acos(zeus::clamp(-1.f, lookDir.dot(lookDirFlat), 1.f));
f31 = f1 + zeus::clamp(-x1ac_, f31 - f1, x1ac_);
}
if (pos.z >= 0.f)
f31 = -f31;
float f4 = std::acos(zeus::clamp(-1.f, posFlat.dot(lookDirFlat), 1.f));
if (x18c_30_)
f4 = zeus::clamp(-x1b0_, f4, x1b0_);
if (posFlat.x * lookDirFlat.y - lookDirFlat.x * posFlat.y >= 0.f)
f4 = -f4;
zeus::CQuaternion quat;
quat.rotateZ(f4);
zeus::CVector3f x6c = quat.transform(lookDirFlat);
zeus::CVector3f x78(x6c.y, -x6c.x, 0.f);
x78.normalize();
return zeus::CQuaternion::fromAxisAngle(x78, -f31).transform(x6c);
} }
void CBallCamera::UpdateUsingFixedCameras(float dt, CStateManager& mgr) void CBallCamera::UpdateUsingFixedCameras(float dt, CStateManager& mgr)
{ {
if (const CScriptCameraHint* hint = mgr.GetCameraManager()->GetCameraHint(mgr))
{
switch (x188_behaviour)
{
case EBallCameraBehaviour::Four:
{
zeus::CVector3f hintToPos = x1d8_ - hint->GetTranslation();
if (hintToPos.canBeNormalized())
{
hintToPos = GetFixedLookTarget(hintToPos.normalized(), mgr);
if ((hint->GetHint().GetOverrideFlags() & 0x40) != 0)
x18d_26_ = true;
UpdateTransform(hintToPos, hint->GetTranslation(), dt, mgr);
}
break;
}
case EBallCameraBehaviour::Five:
SetTransform(hint->GetTransform());
break;
default:
break;
}
TeleportCamera(GetTranslation(), mgr);
}
} }
zeus::CVector3f CBallCamera::ComputeVelocity(const zeus::CVector3f& curVel, const zeus::CVector3f& posDelta) const zeus::CVector3f CBallCamera::ComputeVelocity(const zeus::CVector3f& curVel, const zeus::CVector3f& posDelta) const
{ {
return {}; zeus::CVector3f ret = posDelta;
if (x470_ > 0.f && ret.canBeNormalized() && !x18d_28_)
{
float mag = ret.magnitude();
mag = zeus::clamp(-x474_, mag, x474_);
ret = ret.normalized() * mag;
}
return ret;
} }
zeus::CVector3f CBallCamera::TweenVelocity(const zeus::CVector3f& curVel, const zeus::CVector3f& newVel, zeus::CVector3f CBallCamera::TweenVelocity(const zeus::CVector3f& curVel, const zeus::CVector3f& newVel,
@ -485,12 +849,25 @@ void CBallCamera::UpdateUsingColliders(float dt, CStateManager& mgr)
void CBallCamera::UpdateUsingSpindleCameras(float dt, CStateManager& mgr) void CBallCamera::UpdateUsingSpindleCameras(float dt, CStateManager& mgr)
{ {
if (TCastToPtr<CScriptSpindleCamera> cam = mgr.ObjectById(mgr.GetCameraManager()->GetSpindleCameraId()))
{
TeleportCamera(cam->GetTransform(), mgr);
x18d_26_ = true;
}
} }
zeus::CVector3f CBallCamera::ClampElevationToWater(zeus::CVector3f& pos, CStateManager& mgr) const zeus::CVector3f CBallCamera::ClampElevationToWater(zeus::CVector3f& pos, CStateManager& mgr) const
{ {
return {}; zeus::CVector3f ret = pos;
if (TCastToConstPtr<CScriptWater> water = mgr.GetObjectById(mgr.GetPlayer().GetFluidId()))
{
float waterZ = water->GetTriggerBoundsWR().max.z;
if (pos.z >= waterZ && pos.z - waterZ <= 0.25f)
ret.z = 0.25f + waterZ;
else if (pos.z < waterZ && pos.z - waterZ >= -0.12f)
ret.z = waterZ - 0.12f;
}
return ret;
} }
void CBallCamera::UpdateUsingTransitions(float dt, CStateManager& mgr) void CBallCamera::UpdateUsingTransitions(float dt, CStateManager& mgr)
@ -514,7 +891,7 @@ bool CBallCamera::SplineIntersectTest(CMaterialList& intersectMat, CStateManager
return false; return false;
} }
bool CBallCamera::IsBallNearDoor(CStateManager& mgr) const bool CBallCamera::IsBallNearDoor(const zeus::CVector3f& pos, CStateManager& mgr)
{ {
return false; return false;
} }
@ -619,14 +996,30 @@ bool CBallCamera::TransitionFromMorphBallState(CStateManager& mgr)
return false; return false;
} }
void CBallCamera::TeleportColliders(std::vector<CCameraCollider>& colliderList, const zeus::CVector3f& pos)
{
for (CCameraCollider& collider : colliderList)
{
collider.x2c_ = pos;
collider.x14_ = pos;
collider.x20_ = pos;
}
}
void CBallCamera::TeleportCamera(const zeus::CVector3f& pos, CStateManager& mgr) void CBallCamera::TeleportCamera(const zeus::CVector3f& pos, CStateManager& mgr)
{ {
x294_ = pos;
TeleportColliders(x264_smallColliders, pos);
TeleportColliders(x274_mediumColliders, pos);
TeleportColliders(x284_largeColliders, pos);
if (TCastToPtr<CCollisionActor> act = mgr.ObjectById(x46c_collisionActorId))
act->SetTranslation(pos);
} }
void CBallCamera::TeleportCamera(const zeus::CTransform& xf, CStateManager& mgr) void CBallCamera::TeleportCamera(const zeus::CTransform& xf, CStateManager& mgr)
{ {
SetTransform(xf);
TeleportCamera(xf.origin, mgr);
} }
void CBallCamera::ResetToTweaks(CStateManager& mgr) void CBallCamera::ResetToTweaks(CStateManager& mgr)

View File

@ -10,14 +10,14 @@ class CPlayer;
class CCameraSpring class CCameraSpring
{ {
float x0_tardis; float x0_k;
float x4_tardis2Sqrt; float x4_k2Sqrt;
float x8_max; float x8_max;
float xc_k; float xc_tardis;
float x10_dx = 0.f; float x10_dx = 0.f;
public: public:
CCameraSpring(float tardis, float max, float k) CCameraSpring(float k, float max, float tardis)
: x0_tardis(tardis), x4_tardis2Sqrt(2.f * std::sqrt(tardis)), x8_max(max), xc_k(k) {} : x0_k(k), x4_k2Sqrt(2.f * std::sqrt(k)), x8_max(max), xc_tardis(tardis) {}
void Reset(); void Reset();
float ApplyDistanceSpringNoMax(float targetX, float curX, float dt); float ApplyDistanceSpringNoMax(float targetX, float curX, float dt);
float ApplyDistanceSpring(float targetX, float curX, float dt); float ApplyDistanceSpring(float targetX, float curX, float dt);
@ -158,7 +158,7 @@ private:
float x3d4_ = 0.f; float x3d4_ = 0.f;
float x3d8_ = 0.f; float x3d8_ = 0.f;
TUniqueId x3dc_tooCloseActorId = kInvalidUniqueId; TUniqueId x3dc_tooCloseActorId = kInvalidUniqueId;
float x3e0_ = 10000.f; float x3e0_tooCloseActorDist = 10000.f;
bool x3e4_ = false; bool x3e4_ = false;
float x3e8_ = 0.f; float x3e8_ = 0.f;
float x3ec_ = 0.f; float x3ec_ = 0.f;
@ -193,7 +193,8 @@ private:
bool ShouldResetSpline(CStateManager& mgr) const; bool ShouldResetSpline(CStateManager& mgr) const;
void UpdatePlayerMovement(float dt, CStateManager& mgr); void UpdatePlayerMovement(float dt, CStateManager& mgr);
void UpdateTransform(const zeus::CVector3f& lookDir, const zeus::CVector3f& pos, float dt, CStateManager& mgr); void UpdateTransform(const zeus::CVector3f& lookDir, const zeus::CVector3f& pos, float dt, CStateManager& mgr);
zeus::CVector3f ConstrainYawAngle(const CPlayer& player, float f1, float f2, float dt) const; zeus::CVector3f ConstrainYawAngle(const CPlayer& player, float angleVel, float maxAngle, float dt,
CStateManager& mgr) const;
void CheckFailsafe(float dt, CStateManager& mgr); void CheckFailsafe(float dt, CStateManager& mgr);
void UpdateObjectTooCloseId(CStateManager& mgr); void UpdateObjectTooCloseId(CStateManager& mgr);
void UpdateAnglePerSecond(float dt); void UpdateAnglePerSecond(float dt);
@ -225,12 +226,13 @@ private:
zeus::CTransform UpdateCameraPositions(float dt, const zeus::CTransform& oldXf, const zeus::CTransform& newXf); zeus::CTransform UpdateCameraPositions(float dt, const zeus::CTransform& oldXf, const zeus::CTransform& newXf);
bool CheckFailsafeFromMorphBallState(CStateManager& mgr) const; bool CheckFailsafeFromMorphBallState(CStateManager& mgr) const;
bool SplineIntersectTest(CMaterialList& intersectMat, CStateManager& mgr) const; bool SplineIntersectTest(CMaterialList& intersectMat, CStateManager& mgr) const;
bool IsBallNearDoor(CStateManager& mgr) const; static bool IsBallNearDoor(const zeus::CVector3f& pos, CStateManager& mgr);
void ActivateFailsafe(float dt, CStateManager& mgr); void ActivateFailsafe(float dt, CStateManager& mgr);
void ConstrainElevationAndDistance(float& elevation, float& distance, float f1, CStateManager& mgr); void ConstrainElevationAndDistance(float& elevation, float& distance, float f1, CStateManager& mgr);
zeus::CVector3f FindDesiredPosition(float distance, float elevation, const zeus::CVector3f& dir, CStateManager& mgr); zeus::CVector3f FindDesiredPosition(float distance, float elevation, const zeus::CVector3f& dir, CStateManager& mgr);
static bool DetectCollision(const zeus::CVector3f& from, const zeus::CVector3f& to, float margin, static bool DetectCollision(const zeus::CVector3f& from, const zeus::CVector3f& to, float margin,
float& d, CStateManager& mgr); float& d, CStateManager& mgr);
void TeleportColliders(std::vector<CCameraCollider>& colliderList, const zeus::CVector3f& pos);
public: public:
CBallCamera(TUniqueId uid, TUniqueId watchedId, const zeus::CTransform& xf, CBallCamera(TUniqueId uid, TUniqueId watchedId, const zeus::CTransform& xf,
@ -246,7 +248,7 @@ public:
void Think(float dt, CStateManager& mgr); void Think(float dt, CStateManager& mgr);
bool TransitionFromMorphBallState(CStateManager& mgr); bool TransitionFromMorphBallState(CStateManager& mgr);
TUniqueId GetTooCloseActorId() const { return x3dc_tooCloseActorId; } TUniqueId GetTooCloseActorId() const { return x3dc_tooCloseActorId; }
float GetX3E0() const { return x3e0_; } float GetX3E0() const { return x3e0_tooCloseActorDist; }
void TeleportCamera(const zeus::CVector3f& pos, CStateManager& mgr); void TeleportCamera(const zeus::CVector3f& pos, CStateManager& mgr);
void TeleportCamera(const zeus::CTransform& xf, CStateManager& mgr); void TeleportCamera(const zeus::CTransform& xf, CStateManager& mgr);
const zeus::CVector3f& GetX1D8() const { return x1d8_; } const zeus::CVector3f& GetX1D8() const { return x1d8_; }

View File

@ -67,7 +67,8 @@ int CCameraManager::AddCameraShaker(const CCameraShakeData& data, bool sfx)
} }
if (sfx && data.x0_duration > 0.f) if (sfx && data.x0_duration > 0.f)
{ {
float vol =zeus::clamp(100.f, std::max(data.GetSomething(), data.GetSomething2()) * 9.f + 100.f, 127.f); float vol =
zeus::clamp(100.f, std::max(data.GetMaxAMComponent(), data.GetMaxFMComponent()) * 9.f + 100.f, 127.f);
CSfxHandle sfxHandle; CSfxHandle sfxHandle;
if (data.xc0_flags & 0x1) if (data.xc0_flags & 0x1)
sfxHandle = CSfxManager::AddEmitter(1133, data.xc4_sfxPos, zeus::CVector3f::skZero, sfxHandle = CSfxManager::AddEmitter(1133, data.xc4_sfxPos, zeus::CVector3f::skZero,
@ -762,4 +763,6 @@ bool CCameraManager::HasCameraHint(CStateManager& mgr) const
return false; return false;
return mgr.GetObjectById(xa6_camHintId) != nullptr; return mgr.GetObjectById(xa6_camHintId) != nullptr;
} }
bool CCameraManager::IsInterpolationCameraActive() const { return x88_interpCamera->GetActive(); }
} }

View File

@ -154,7 +154,7 @@ public:
const CCinematicCamera* GetLastCineCamera(CStateManager& mgr) const; const CCinematicCamera* GetLastCineCamera(CStateManager& mgr) const;
const CScriptCameraHint* GetCameraHint(CStateManager& mgr) const; const CScriptCameraHint* GetCameraHint(CStateManager& mgr) const;
bool HasCameraHint(CStateManager& mgr) const; bool HasCameraHint(CStateManager& mgr) const;
bool IsInterpolationCameraActive() const;
}; };
} }

View File

@ -1,33 +1,34 @@
#include "CCameraShakeData.hpp" #include "CCameraShakeData.hpp"
#include "CRandom16.hpp"
#include "World/ScriptLoader.hpp" #include "World/ScriptLoader.hpp"
#include "CStateManager.hpp"
#include "World/CPlayer.hpp"
namespace urde namespace urde
{ {
SCameraShakePoint SCameraShakePoint::LoadCameraShakePoint(CInputStream& in) SCameraShakePoint SCameraShakePoint::LoadCameraShakePoint(CInputStream& in)
{ {
u32 flags = ScriptLoader::LoadParameterFlags(in); u32 useEnvelope = ScriptLoader::LoadParameterFlags(in);
float f1 = in.readFloatBig(); float attackTime = in.readFloatBig();
float f2 = in.readFloatBig(); float sustainTime = in.readFloatBig();
float f3 = in.readFloatBig(); float duration = in.readFloatBig();
float f4 = in.readFloatBig(); float magnitude = in.readFloatBig();
return {flags, f1, f2, f3, f4}; return {useEnvelope != 0, attackTime, sustainTime, duration, magnitude};
} }
CCameraShakerComponent CCameraShakerComponent::LoadNewCameraShakerComponent(CInputStream& in) CCameraShakerComponent CCameraShakerComponent::LoadNewCameraShakerComponent(CInputStream& in)
{ {
u32 flags = ScriptLoader::LoadParameterFlags(in); u32 useModulation = ScriptLoader::LoadParameterFlags(in);
SCameraShakePoint sp1 = SCameraShakePoint::LoadCameraShakePoint(in); SCameraShakePoint am = SCameraShakePoint::LoadCameraShakePoint(in);
SCameraShakePoint sp2 = SCameraShakePoint::LoadCameraShakePoint(in); SCameraShakePoint fm = SCameraShakePoint::LoadCameraShakePoint(in);
return {flags, sp1, sp2}; return {useModulation != 0, am, fm};
} }
CCameraShakeData::CCameraShakeData(float duration, float sfxDist, u32 w1, const zeus::CVector3f& sfxPos, CCameraShakeData::CCameraShakeData(float duration, float sfxDist, u32 flags, const zeus::CVector3f& sfxPos,
const CCameraShakerComponent& shaker1, const CCameraShakerComponent& shaker2, const CCameraShakerComponent& shaker1, const CCameraShakerComponent& shaker2,
const CCameraShakerComponent& shaker3) const CCameraShakerComponent& shaker3)
: x0_duration(duration), x8_shaker1(shaker1), x44_shaker2(shaker2), x80_shaker3(shaker3), : x0_duration(duration), x8_shakerX(shaker1), x44_shakerY(shaker2), x80_shakerZ(shaker3),
xc0_flags(w1), xc4_sfxPos(sfxPos), xd0_sfxDist(sfxDist) xc0_flags(flags), xc4_sfxPos(sfxPos), xd0_sfxDist(sfxDist)
{} {}
CCameraShakeData::CCameraShakeData(float duration, float magnitude) CCameraShakeData::CCameraShakeData(float duration, float magnitude)
@ -79,90 +80,94 @@ CCameraShakeData CCameraShakeData::BuildPhazonCameraShakeData(float duration, fl
SCameraShakePoint(1, 0.f, 0.f, 0.5f * duration, 0.5f))}; SCameraShakePoint(1, 0.f, 0.f, 0.5f * duration, 0.5f))};
} }
void SCameraShakePoint::Update(float curTime)
{
float offTimePoint = xc_attackTime + x10_sustainTime;
float factor = 1.f;
if (curTime < xc_attackTime && xc_attackTime > 0.f)
factor = zeus::clamp(0.f, curTime / xc_attackTime, 1.f);
if (curTime >= offTimePoint && x14_duration > 0.f)
factor = 1.f - (curTime - offTimePoint) / x14_duration;
x4_value = x8_magnitude * factor;
}
void CCameraShakerComponent::Update(float curTime, float duration, float distAtt)
{
if (std::fabs(duration) < 0.00001f || !x4_useModulation)
{
x38_value = 0.f;
return;
}
x20_fm.Update(curTime);
float freq = 1.f + x20_fm.GetValue();
x8_am.Update(curTime);
x38_value = x8_am.GetValue() * std::sin(2.f * M_PIF * (duration - curTime) * freq);
x38_value *= distAtt;
}
void CCameraShakeData::Update(float dt, CStateManager& mgr) void CCameraShakeData::Update(float dt, CStateManager& mgr)
{ {
x4_curTime += dt;
float distAtt = 1.f;
if (xc0_flags & 0x1)
distAtt = 1.f - zeus::clamp(0.f, (xc4_sfxPos - mgr.GetPlayer().GetTranslation()).magnitude() / xd0_sfxDist, 1.f);
x8_shakerX.Update(x4_curTime, x0_duration, distAtt);
x44_shakerY.Update(x4_curTime, x0_duration, distAtt);
x80_shakerZ.Update(x4_curTime, x0_duration, distAtt);
} }
zeus::CVector3f CCameraShakeData::GetPoint() const zeus::CVector3f CCameraShakeData::GetPoint() const
{ {
return {x8_shaker1.x38_value, x44_shaker2.x38_value, x80_shaker3.x38_value}; return {x8_shakerX.GetValue(), x44_shakerY.GetValue(), x80_shakerZ.GetValue()};
} }
float CCameraShakeData::GetSomething() const float CCameraShakeData::GetMaxAMComponent() const
{ {
float ret = 0.f; float ret = 0.f;
if (x8_shaker1.x4_w1) if (x8_shakerX.x4_useModulation)
ret = x8_shaker1.x8_sp1.GetSomething(); ret = x8_shakerX.x8_am.GetValue();
if (x44_shaker2.x4_w1) if (x44_shakerY.x4_useModulation)
ret = std::max(ret, x44_shaker2.x8_sp1.GetSomething()); ret = std::max(ret, x44_shakerY.x8_am.GetValue());
if (x80_shaker3.x4_w1) if (x80_shakerZ.x4_useModulation)
ret = std::max(ret, x80_shaker3.x8_sp1.GetSomething()); ret = std::max(ret, x80_shakerZ.x8_am.GetValue());
return ret; return ret;
} }
float CCameraShakeData::GetSomething2() const float CCameraShakeData::GetMaxFMComponent() const
{ {
float ret = 0.f; float ret = 0.f;
if (x8_shaker1.x4_w1) if (x8_shakerX.x4_useModulation)
ret = x8_shaker1.x20_sp2.GetSomething(); ret = x8_shakerX.x20_fm.GetValue();
if (x44_shaker2.x4_w1) if (x44_shakerY.x4_useModulation)
ret = std::max(ret, x44_shaker2.x20_sp2.GetSomething()); ret = std::max(ret, x44_shakerY.x20_fm.GetValue());
if (x80_shaker3.x4_w1) if (x80_shakerZ.x4_useModulation)
ret = std::max(ret, x80_shaker3.x20_sp2.GetSomething()); ret = std::max(ret, x80_shakerZ.x20_fm.GetValue());
return ret; return ret;
} }
#if 0
zeus::CVector3f CCameraShakeData::GeneratePoint(float dt, CRandom16& r)
{
x3c_cycleTimeLeft -= dt;
if (x3c_cycleTimeLeft <= 0.f)
{
x3c_cycleTimeLeft = r.Range(1.f / 60.f, 0.1f);
float zVal = r.Range(-1.f, 1.f);
float yVal = 0.f;
if (x40_shakeY)
yVal = r.Range(-1.f, 1.f);
float xVal = r.Range(-1.f, 1.f);
zeus::CVector3f shakeVec(xVal, yVal, zVal);
if (!shakeVec.canBeNormalized())
shakeVec = {0.f, 0.f, 1.f};
else
shakeVec.normalize();
x30_velocity = (shakeVec - x24_position) / x3c_cycleTimeLeft;
}
x24_position += x30_velocity * dt;
float interp = zeus::clamp(0.f, 1.f - (x18_duration - x1c_curTime) / x18_duration, 1.f);
x1c_curTime += dt;
return x24_position * zeus::CVector3f::lerp(x0_pointA, xc_pointB, interp);
}
#endif
CCameraShakeData CCameraShakeData::LoadCameraShakeData(CInputStream& in) CCameraShakeData CCameraShakeData::LoadCameraShakeData(CInputStream& in)
{ {
float f1 = in.readFloatBig(); float xMag = in.readFloatBig();
float f2 = in.readFloatBig(); float f2 = in.readFloatBig();
float f3 = in.readFloatBig(); float yMag = in.readFloatBig();
float f4 = in.readFloatBig(); float f4 = in.readFloatBig();
float f5 = in.readFloatBig(); float zMag = in.readFloatBig();
float f6 = in.readFloatBig(); float f6 = in.readFloatBig();
float duration = in.readFloatBig(); float duration = in.readFloatBig();
SCameraShakePoint sp1(0, 0.f, 0.f, duration, 2.f * f1); SCameraShakePoint xAM(0, 0.f, 0.f, duration, 2.f * xMag);
SCameraShakePoint sp2(0, 0.f, 0.f, duration, 2.f * f3); SCameraShakePoint yAM(0, 0.f, 0.f, duration, 2.f * yMag);
SCameraShakePoint sp3(0, 0.f, 0.f, duration, 2.f * f5); SCameraShakePoint zAM(0, 0.f, 0.f, duration, 2.f * zMag);
SCameraShakePoint sp4(0, 0.f, 0.f, 0.5f * duration, 3.f); SCameraShakePoint xFM(0, 0.f, 0.f, 0.5f * duration, 3.f);
SCameraShakePoint sp5(0, 0.f, 0.f, 0.5f * duration, 0.f); SCameraShakePoint yFM(0, 0.f, 0.f, 0.5f * duration, 0.f);
SCameraShakePoint sp6(0, 0.f, 0.f, 0.5f * duration, 3.f); SCameraShakePoint zFM(0, 0.f, 0.f, 0.5f * duration, 3.f);
CCameraShakerComponent shaker1(1, sp1, sp4); CCameraShakerComponent shakerX(1, xAM, xFM);
CCameraShakerComponent shaker2; CCameraShakerComponent shakerY;
CCameraShakerComponent shaker3(1, sp3, sp6); CCameraShakerComponent shakerZ(1, zAM, zFM);
return {duration, 100.f, 0, zeus::CVector3f::skZero, shaker1, shaker2, shaker3}; return {duration, 100.f, 0, zeus::CVector3f::skZero, shakerX, shakerY, shakerZ};
} }
const CCameraShakeData CCameraShakeData::skChargedShotCameraShakeData = const CCameraShakeData CCameraShakeData::skChargedShotCameraShakeData =

View File

@ -12,30 +12,34 @@ class CStateManager;
struct SCameraShakePoint struct SCameraShakePoint
{ {
friend class CCameraShakeData; friend class CCameraShakeData;
u32 x0_w1 = 0; bool x0_useEnvelope = false;
float x4_ = 0.f; float x4_value = 0.f;
float x8_magnitude = 0.f; float x8_magnitude = 0.f;
float xc_f1 = 0.f; float xc_attackTime = 0.f;
float x10_f2 = 0.f; float x10_sustainTime = 0.f;
float x14_duration = 0.f; float x14_duration = 0.f;
SCameraShakePoint() = default; SCameraShakePoint() = default;
SCameraShakePoint(u32 w1, float f1, float f2, float duration, float magnitude) SCameraShakePoint(bool useEnvelope, float attackTime, float sustainTime, float duration, float magnitude)
: x0_w1(w1), x8_magnitude(magnitude), xc_f1(f1), x10_f2(f2), x14_duration(duration) {} : x0_useEnvelope(useEnvelope), x8_magnitude(magnitude), xc_attackTime(attackTime),
float GetSomething() const { return x0_w1 ? x8_magnitude : x4_; } x10_sustainTime(sustainTime), x14_duration(duration) {}
float GetValue() const { return x0_useEnvelope ? x8_magnitude : x4_value; }
static SCameraShakePoint LoadCameraShakePoint(CInputStream& in); static SCameraShakePoint LoadCameraShakePoint(CInputStream& in);
void Update(float curTime);
}; };
class CCameraShakerComponent class CCameraShakerComponent
{ {
friend class CCameraShakeData; friend class CCameraShakeData;
u32 x4_w1 = 0; bool x4_useModulation = false;
SCameraShakePoint x8_sp1, x20_sp2; SCameraShakePoint x8_am, x20_fm;
float x38_value = 0.f; float x38_value = 0.f;
public: public:
CCameraShakerComponent() = default; CCameraShakerComponent() = default;
CCameraShakerComponent(u32 w1, const SCameraShakePoint& sp1, const SCameraShakePoint& sp2) CCameraShakerComponent(bool useModulation, const SCameraShakePoint& am, const SCameraShakePoint& fm)
: x4_w1(w1), x8_sp1(sp1), x20_sp2(sp2) {} : x4_useModulation(useModulation), x8_am(am), x20_fm(fm) {}
static CCameraShakerComponent LoadNewCameraShakerComponent(CInputStream& in); static CCameraShakerComponent LoadNewCameraShakerComponent(CInputStream& in);
void Update(float curTime, float duration, float distAtt);
float GetValue() const { return x38_value; }
}; };
class CCameraShakeData class CCameraShakeData
@ -43,9 +47,9 @@ class CCameraShakeData
friend class CCameraManager; friend class CCameraManager;
float x0_duration; float x0_duration;
float x4_curTime = 0.f; float x4_curTime = 0.f;
CCameraShakerComponent x8_shaker1; CCameraShakerComponent x8_shakerX;
CCameraShakerComponent x44_shaker2; CCameraShakerComponent x44_shakerY;
CCameraShakerComponent x80_shaker3; CCameraShakerComponent x80_shakerZ;
u32 xbc_shakerId = 0; u32 xbc_shakerId = 0;
u32 xc0_flags; // 0x1: positional sfx u32 xc0_flags; // 0x1: positional sfx
zeus::CVector3f xc4_sfxPos; zeus::CVector3f xc4_sfxPos;
@ -53,7 +57,7 @@ class CCameraShakeData
public: public:
static const CCameraShakeData skChargedShotCameraShakeData; static const CCameraShakeData skChargedShotCameraShakeData;
CCameraShakeData(float duration, float sfxDist, u32 w1, const zeus::CVector3f& sfxPos, CCameraShakeData(float duration, float sfxDist, u32 flags, const zeus::CVector3f& sfxPos,
const CCameraShakerComponent& shaker1, const CCameraShakerComponent& shaker2, const CCameraShakerComponent& shaker1, const CCameraShakerComponent& shaker2,
const CCameraShakerComponent& shaker3); const CCameraShakerComponent& shaker3);
CCameraShakeData(float duration, float magnitude); CCameraShakeData(float duration, float magnitude);
@ -62,11 +66,10 @@ public:
static CCameraShakeData BuildMissileCameraShake(float duration, float magnitude, float sfxDistance, static CCameraShakeData BuildMissileCameraShake(float duration, float magnitude, float sfxDistance,
const zeus::CVector3f& sfxPos); const zeus::CVector3f& sfxPos);
static CCameraShakeData BuildPhazonCameraShakeData(float duration, float magnitude); static CCameraShakeData BuildPhazonCameraShakeData(float duration, float magnitude);
//zeus::CVector3f GeneratePoint(float dt, CRandom16& r);
void Update(float dt, CStateManager& mgr); void Update(float dt, CStateManager& mgr);
zeus::CVector3f GetPoint() const; zeus::CVector3f GetPoint() const;
float GetSomething() const; float GetMaxAMComponent() const;
float GetSomething2() const; float GetMaxFMComponent() const;
void SetShakerId(u32 id) { xbc_shakerId = id; } void SetShakerId(u32 id) { xbc_shakerId = id; }
u32 GetShakerId() const { return xbc_shakerId; } u32 GetShakerId() const { return xbc_shakerId; }
static CCameraShakeData LoadCameraShakeData(CInputStream& in); static CCameraShakeData LoadCameraShakeData(CInputStream& in);

View File

@ -26,21 +26,28 @@ void CCameraSpline::CalculateKnots(TUniqueId cameraId, const std::vector<SConnec
void CCameraSpline::Reset(int size) void CCameraSpline::Reset(int size)
{ {
x4_.clear(); x4_positions.clear();
x24_.clear(); x24_.clear();
x34_.clear(); x34_directions.clear();
if (size != 0) if (size != 0)
{ {
x4_.reserve(size); x4_positions.reserve(size);
x24_.reserve(size); x24_.reserve(size);
x34_.reserve(size); x34_directions.reserve(size);
} }
} }
void CCameraSpline::AddKnot(const zeus::CVector3f& v0, const zeus::CVector3f& v1) void CCameraSpline::AddKnot(const zeus::CVector3f& pos, const zeus::CVector3f& dir)
{ {
x4_.push_back(v0); x4_positions.push_back(pos);
x34_.push_back(v1); x34_directions.push_back(dir);
}
void CCameraSpline::SetKnotPosition(int idx, const zeus::CVector3f& pos)
{
if (idx >= x4_positions.size())
return;
x4_positions[idx] = pos;
} }
float CCameraSpline::CalculateSplineLength() float CCameraSpline::CalculateSplineLength()

View File

@ -9,10 +9,10 @@ class CStateManager;
class CCameraSpline class CCameraSpline
{ {
friend class CBallCamera; friend class CBallCamera;
std::vector<zeus::CVector3f> x4_; std::vector<zeus::CVector3f> x4_positions;
std::vector<TUniqueId> x14_; std::vector<TUniqueId> x14_;
std::vector<float> x24_; std::vector<float> x24_;
std::vector<zeus::CVector3f> x34_; std::vector<zeus::CVector3f> x34_directions;
float x44_ = 0.f; float x44_ = 0.f;
bool x48_ = false; bool x48_ = false;
public: public:
@ -20,7 +20,8 @@ public:
void CalculateKnots(TUniqueId, const std::vector<SConnection>&, CStateManager&); void CalculateKnots(TUniqueId, const std::vector<SConnection>&, CStateManager&);
void Initialize(TUniqueId, const std::vector<SConnection>&, CStateManager&); void Initialize(TUniqueId, const std::vector<SConnection>&, CStateManager&);
void Reset(int size); void Reset(int size);
void AddKnot(const zeus::CVector3f& v0, const zeus::CVector3f& v1); void AddKnot(const zeus::CVector3f& pos, const zeus::CVector3f& dir);
void SetKnotPosition(int idx, const zeus::CVector3f& pos);
float CalculateSplineLength(); float CalculateSplineLength();
}; };
} }

View File

@ -1125,7 +1125,7 @@ CGameCollision::FindNonIntersectingVector(const CStateManager& mgr, CAreaCollisi
if (mgr.GetWorld()->GetAreaAlways(mgr.GetNextAreaId())->GetAABB().pointInside(worldPoint)) if (mgr.GetWorld()->GetAreaAlways(mgr.GetNextAreaId())->GetAABB().pointInside(worldPoint))
{ {
if (mgr.RayCollideWorld(center, center + vec, nearList, if (mgr.RayCollideWorld(center, center + vec, nearList,
CMaterialFilter::skPassEverything, actor)) CMaterialFilter::skPassEverything, &actor))
{ {
if (!DetectCollisionBoolean_Cached(mgr, cache, prim, xf, actor.GetMaterialFilter(), nearList)) if (!DetectCollisionBoolean_Cached(mgr, cache, prim, xf, actor.GetMaterialFilter(), nearList))
return {vec}; return {vec};

View File

@ -76,20 +76,20 @@ using CameraShakeData = DataSpec::DNAMP1::MetroidPrimeStage1::MassivePrimeStruct
static SCameraShakePoint BuildCameraShakePoint(CameraShakeData::CameraShakerComponent::CameraShakePoint& sp) static SCameraShakePoint BuildCameraShakePoint(CameraShakeData::CameraShakerComponent::CameraShakePoint& sp)
{ {
return SCameraShakePoint(0, sp.unknown2, sp.unknown3, sp.duration, sp.magnitude); return SCameraShakePoint(false, sp.attackTime, sp.sustainTime, sp.duration, sp.magnitude);
} }
static CCameraShakerComponent BuildCameraShakerComponent(CameraShakeData::CameraShakerComponent& comp) static CCameraShakerComponent BuildCameraShakerComponent(CameraShakeData::CameraShakerComponent& comp)
{ {
return CCameraShakerComponent(u32(comp.unknown1), BuildCameraShakePoint(comp.shakePoints[0]), return CCameraShakerComponent(comp.useModulation, BuildCameraShakePoint(comp.am),
BuildCameraShakePoint(comp.shakePoints[1])); BuildCameraShakePoint(comp.fm));
} }
static CCameraShakeData LoadCameraShakeData(CInputStream& in) static CCameraShakeData LoadCameraShakeData(CInputStream& in)
{ {
CameraShakeData shakeData; CameraShakeData shakeData;
shakeData.read(in); shakeData.read(in);
return CCameraShakeData(shakeData.duration, shakeData.unknown3, u32(shakeData.unknown1), return CCameraShakeData(shakeData.duration, shakeData.sfxDist, u32(shakeData.useSfx),
zeus::CVector3f::skZero, zeus::CVector3f::skZero,
BuildCameraShakerComponent(shakeData.shakerComponents[0]), BuildCameraShakerComponent(shakeData.shakerComponents[0]),
BuildCameraShakerComponent(shakeData.shakerComponents[1]), BuildCameraShakerComponent(shakeData.shakerComponents[1]),

View File

@ -190,6 +190,7 @@ public:
void SetDrawFlags(const CModelFlags& flags) { xb4_drawFlags = flags; } void SetDrawFlags(const CModelFlags& flags) { xb4_drawFlags = flags; }
void SetModelData(std::unique_ptr<CModelData>&& mData); void SetModelData(std::unique_ptr<CModelData>&& mData);
u8 GetFluidCounter() const { return xe6_24_fluidCounter; } u8 GetFluidCounter() const { return xe6_24_fluidCounter; }
TUniqueId GetFluidId() const { return xc4_fluidId; }
}; };
} }

View File

@ -216,7 +216,7 @@ void CPlayer::TransitionFromMorphBallState(CStateManager& mgr)
if (x258_movementState != EPlayerMovementState::OnGround) if (x258_movementState != EPlayerMovementState::OnGround)
{ {
zeus::CVector3f ballPos = GetBallPosition(); zeus::CVector3f ballPos = GetBallPosition();
if (mgr.RayCollideWorld(ballPos, ballPos + zeus::CVector3f(0.f, 0.f, -7.f), BallTransitionCollide, *this)) if (mgr.RayCollideWorld(ballPos, ballPos + zeus::CVector3f(0.f, 0.f, -7.f), BallTransitionCollide, this))
x584_ballTransitionAnim = 7; // B_balljumptoairpose x584_ballTransitionAnim = 7; // B_balljumptoairpose
} }

View File

@ -676,6 +676,7 @@ public:
TUniqueId GetRidingPlatformId() const { return x82e_ridingPlatform; } TUniqueId GetRidingPlatformId() const { return x82e_ridingPlatform; }
const zeus::CVector3f& GetLastVelocity() const { return x794_lastVelocity; } const zeus::CVector3f& GetLastVelocity() const { return x794_lastVelocity; }
const zeus::CVector3f& GetMoveDir() const { return x50c_moveDir; } const zeus::CVector3f& GetMoveDir() const { return x50c_moveDir; }
const zeus::CVector3f& GetLeaveMorphDir() const { return x518_leaveMorphDir; }
u32 GetBombJumpCount() const { return x9d0_bombJumpCount; } u32 GetBombJumpCount() const { return x9d0_bombJumpCount; }
}; };
} }

View File

@ -2539,16 +2539,16 @@ CEntity* ScriptLoader::LoadNewCameraShaker(CStateManager& mgr, CInputStream& in,
return nullptr; return nullptr;
std::string name = mgr.HashInstanceName(in); std::string name = mgr.HashInstanceName(in);
zeus::CVector3f v1 = zeus::CVector3f::ReadBig(in); zeus::CVector3f sfxPos = zeus::CVector3f::ReadBig(in);
bool active = in.readBool(); bool active = in.readBool();
u32 flags = LoadParameterFlags(in); u32 flags = LoadParameterFlags(in);
float f1 = in.readFloatBig(); float duration = in.readFloatBig();
float f2 = in.readFloatBig(); float sfxDist = in.readFloatBig();
CCameraShakerComponent shaker1 = CCameraShakerComponent::LoadNewCameraShakerComponent(in); CCameraShakerComponent shakerX = CCameraShakerComponent::LoadNewCameraShakerComponent(in);
CCameraShakerComponent shaker2 = CCameraShakerComponent::LoadNewCameraShakerComponent(in); CCameraShakerComponent shakerY = CCameraShakerComponent::LoadNewCameraShakerComponent(in);
CCameraShakerComponent shaker3 = CCameraShakerComponent::LoadNewCameraShakerComponent(in); CCameraShakerComponent shakerZ = CCameraShakerComponent::LoadNewCameraShakerComponent(in);
CCameraShakeData shakeData(f1, f2, flags, v1, shaker1, shaker2, shaker3); CCameraShakeData shakeData(duration, sfxDist, flags, sfxPos, shakerX, shakerY, shakerZ);
return new CScriptCameraShaker(mgr.AllocateUniqueId(), name, info, active, shakeData); return new CScriptCameraShaker(mgr.AllocateUniqueId(), name, info, active, shakeData);
} }

@ -1 +1 @@
Subproject commit 02e557c7df6304e1f6143ef2f6ecae0fb152c6e1 Subproject commit 1d44b04638cf1ce3947477254ac3255868b650d2