From 46bc2578fe0dd13d6728aa99922073f04340b6d5 Mon Sep 17 00:00:00 2001 From: Jonathan Voss <658471+jonathan-voss@users.noreply.github.com> Date: Tue, 2 Jan 2024 19:57:56 -0600 Subject: [PATCH] Revert "Convert IAbstractActor to a normal constructor" This reverts commit aa7a705e564d0e68177c750cb4c6dc82be7cb703. --- src/game/CAbstractActor.cpp | 2 +- src/game/CAbstractActor.h | 61 +++++---- src/game/CAbstractMissile.cpp | 4 +- src/game/CAbstractMissile.h | 3 +- src/game/CAbstractMovers.cpp | 4 +- src/game/CAbstractMovers.h | 2 +- src/game/CAbstractPlayer.cpp | 3 +- src/game/CAbstractPlayer.h | 232 +++++++++++++++------------------- src/game/CBall.cpp | 4 +- src/game/CBall.h | 2 +- src/game/CDepot.cpp | 13 +- src/game/CFreeSolid.h | 14 +- src/game/CGlowActors.cpp | 4 +- src/game/CGlowActors.h | 4 +- src/game/CGrenade.cpp | 4 +- src/game/CGrenade.h | 2 +- src/game/CMarkerActor.cpp | 4 +- src/game/CMarkerActor.h | 2 +- src/game/CMissile.cpp | 4 +- src/game/CMissile.h | 2 +- src/game/CParasite.h | 17 ++- src/game/CPill.cpp | 4 +- src/game/CPill.h | 2 +- src/game/CPlacedActors.cpp | 4 +- src/game/CPlacedActors.h | 2 +- src/game/CPlayerManager.cpp | 2 + src/game/CPlayerMissile.cpp | 4 +- src/game/CPlayerMissile.h | 2 +- src/game/CRealMovers.cpp | 4 +- src/game/CRealMovers.h | 2 +- src/game/CRealShooters.cpp | 4 +- src/game/CRealShooters.h | 2 +- src/game/CScout.cpp | 4 +- src/game/CScout.h | 11 +- src/game/CShuriken.cpp | 4 +- src/game/CShuriken.h | 3 +- src/game/CSmart.cpp | 4 +- src/game/CSmart.h | 2 +- src/game/CSphereActor.cpp | 4 +- src/game/CSphereActor.h | 2 +- src/game/CWallActor.cpp | 1 + src/game/CWeapon.cpp | 4 +- src/game/CWeapon.h | 2 +- src/level/LevelLoader.cpp | 1 + src/level/Parser.cpp | 2 + src/tests.cpp | 1 + 46 files changed, 240 insertions(+), 224 deletions(-) diff --git a/src/game/CAbstractActor.cpp b/src/game/CAbstractActor.cpp index 24a0b21ee..7dfd49cb4 100644 --- a/src/game/CAbstractActor.cpp +++ b/src/game/CAbstractActor.cpp @@ -201,7 +201,7 @@ void CAbstractActor::BuildPartSpheresProximityList(MaskType filterMask) { BuildPartProximityList(minPoint, FDistanceOverEstimate(maxPoint[0], maxPoint[1], maxPoint[2]), filterMask); } -CAbstractActor::CAbstractActor() { +void CAbstractActor::IAbstractActor() { short i; proximityList.p = NULL; diff --git a/src/game/CAbstractActor.h b/src/game/CAbstractActor.h index 311cc9275..daa5ab4c6 100644 --- a/src/game/CAbstractActor.h +++ b/src/game/CAbstractActor.h @@ -85,10 +85,18 @@ typedef union { class CAbstractActor : public CDirectObject { public: - CAbstractActor(); CAvaraGame *itsGame; + unsigned long searchCount; + ActorLocator locLinks[4]; // Location link table. + CSmartPart *partList[MAXPARTS + 1]; + CSmartPart *cachePart; // Collision detection cache part. + Fixed partScale; + Fixed partYon; + + ActorAttachment *attachmentList; + ActorOrPartLink proximityList; CAbstractActor *nextActor; @@ -96,21 +104,47 @@ class CAbstractActor : public CDirectObject { long ident; FrameNumber sleepTimer; + CAbstractActor *postMortemLink; + Fixed blastPower; + MaskType maskBits; + Fixed mass; Fixed shields; + SoundLink *itsSoundLink; short partCount; short isActive; + short blastSound; + Fixed blastVolume; + short teamMask; short teamColor; + long hitScore; + short hitSoundId; + short hitSoundVolume; + + long destructScore; + short stepSound; + MsgType hitMessage; + MsgType destructMessage; + MsgType stepOnMessage; + + short sliverCounts[kSliverSizes]; + short sliverLives[kSliverSizes]; + Boolean isInGame; + + Fixed traction; + Fixed friction; + virtual void LoadPart(short ind, short resId); virtual void LoadPartWithColors(short ind, short resId); + virtual void IAbstractActor(); virtual void BeginScript(); virtual CAbstractActor *EndScript(); virtual void AdaptableSettings(); @@ -198,31 +232,6 @@ class CAbstractActor : public CDirectObject { Fixed FpsOffset(Fixed classicCoeff2); FrameNumber FpsFramesPerClassic(FrameNumber classicFrames = 1); Fixed ClassicCoefficient2(Fixed fpsValue); -protected: - ActorLocator locLinks[4]; // Location link table. - CSmartPart *cachePart; // Collision detection cache part. - Fixed partScale; - Fixed partYon; - ActorAttachment *attachmentList; - CAbstractActor *postMortemLink; - Fixed blastPower; - Fixed mass; - - SoundLink *itsSoundLink; - short blastSound; - Fixed blastVolume; - long hitScore; - short hitSoundId; - short hitSoundVolume; - long destructScore; - MsgType hitMessage; - MsgType destructMessage; - MsgType stepOnMessage; - short sliverCounts[kSliverSizes]; - short sliverLives[kSliverSizes]; - Fixed traction; - Fixed friction; - private: virtual double FpsCoefficient1(double classicCoeef1, double fpsScale); }; diff --git a/src/game/CAbstractMissile.cpp b/src/game/CAbstractMissile.cpp index e35691aa2..fb7e22122 100644 --- a/src/game/CAbstractMissile.cpp +++ b/src/game/CAbstractMissile.cpp @@ -14,7 +14,9 @@ #define GROUNDHITSOUNDID 211 #define DEFAULTMISSILESOUND 200 -CAbstractMissile::CAbstractMissile(CDepot *theDepot) { +void CAbstractMissile::IAbstractMissile(CDepot *theDepot) { + IAbstractActor(); + isActive = kIsActive; itsDepot = theDepot; itsGame = itsDepot->itsGame; diff --git a/src/game/CAbstractMissile.h b/src/game/CAbstractMissile.h index 01a4ac570..d3ead54e2 100644 --- a/src/game/CAbstractMissile.h +++ b/src/game/CAbstractMissile.h @@ -19,7 +19,6 @@ class CDepot; class CAbstractMissile : public CAbstractActor { public: - CAbstractMissile(CDepot *theDepot); CAbstractMissile *nextMissile; long ownerIdent; CDepot *itsDepot; @@ -36,7 +35,7 @@ class CAbstractMissile : public CAbstractActor { short missileKind; short soundResId; - + virtual void IAbstractMissile(CDepot *theDepot); virtual void Deactivate(); virtual void Launch(Matrix *startMatrix, RayHitRecord *target, diff --git a/src/game/CAbstractMovers.cpp b/src/game/CAbstractMovers.cpp index 231815a8f..be3d9b6c6 100644 --- a/src/game/CAbstractMovers.cpp +++ b/src/game/CAbstractMovers.cpp @@ -9,7 +9,9 @@ #include "CAbstractMovers.h" -CAbstractMovers::CAbstractMovers() { +void CAbstractMovers::IAbstractActor() { + CGlowActors::IAbstractActor(); + mass = FIX(50); // Some default mass speed[0] = 0; speed[1] = 0; diff --git a/src/game/CAbstractMovers.h b/src/game/CAbstractMovers.h index 849d8fc4e..a4a3b718f 100644 --- a/src/game/CAbstractMovers.h +++ b/src/game/CAbstractMovers.h @@ -17,7 +17,7 @@ class CAbstractMovers : public CGlowActors { Fixed internalImpulse[3]; Fixed impulseSlowDown; - CAbstractMovers(); + virtual void IAbstractActor(); virtual void GetSpeedEstimate(Fixed *theSpeed); virtual void FrameAction(); virtual void Push(Fixed *direction); diff --git a/src/game/CAbstractPlayer.cpp b/src/game/CAbstractPlayer.cpp index ee7e34e7a..81273e62f 100644 --- a/src/game/CAbstractPlayer.cpp +++ b/src/game/CAbstractPlayer.cpp @@ -189,7 +189,8 @@ void CAbstractPlayer::LevelReset() { void CAbstractPlayer::LoadScout() { scoutCommand = kScoutNullCommand; - itsScout = new CScout(this, teamColor, GetTeamColorOr(ColorManager::getDefaultTeamColor())); + itsScout = new CScout; + itsScout->IScout(this, teamColor, GetTeamColorOr(ColorManager::getDefaultTeamColor())); itsScout->BeginScript(); FreshCalc(); itsScout->EndScript(); diff --git a/src/game/CAbstractPlayer.h b/src/game/CAbstractPlayer.h index 5e588761d..11c10eb65 100644 --- a/src/game/CAbstractPlayer.h +++ b/src/game/CAbstractPlayer.h @@ -62,6 +62,7 @@ class CAbstractPlayer : public CRealMovers { public: std::shared_ptr itsManager; CAbstractPlayer *nextPlayer = 0; + PlayerConfigRecord defaultConfig {}; HullConfigRecord hullConfig {}; ARGBColor longTeamColor = 0; @@ -70,14 +71,17 @@ class CAbstractPlayer : public CRealMovers { // Shields & energy: Fixed energy = 0; Fixed maxEnergy = 0; // Maximum stored energy level - Fixed classicGeneratorPower; // Energy gain/frame + Fixed classicGeneratorPower, generatorPower = 0; // Energy gain/frame + FrameNumber boostEndFrame = 0; long boostsRemaining = 0; Fixed maxShields = 0; // Maximum shield energy - Fixed classicShieldRegen; + Fixed classicShieldRegen, shieldRegen = 0; // Shield regeneration rate short missileCount = 0; short grenadeCount = 0; + FrameNumber nextGrenadeLoad = 0; + FrameNumber nextMissileLoad = 0; short missileLimit = 0; short grenadeLimit = 0; @@ -88,8 +92,15 @@ class CAbstractPlayer : public CRealMovers { Fixed motors[2] = {0, 0}; // Left/right speed Fixed maxAcceleration = 0; Fixed classicMotorFriction = 0; + Fixed motorFriction = 0; + Fixed classicMotorAcceleration = 0; + Fixed motorAcceleration = 0; + Fixed fpsMotorOffset = 0; + Fixed turningEffect = 0; // How far apart are the legs or wheels? + Fixed movementCost = 0; // Cost of acceleration Fixed proximityRadius = 0; + Vector groundSlide = {0}; Fixed distance = 0; // Movement within one frame Fixed headChange = 0; @@ -99,47 +110,134 @@ class CAbstractPlayer : public CRealMovers { Fixed gunEnergy[2] = {0, 0}; // Left/right guns Fixed fullGunEnergy = 0; Fixed activeGunEnergy = 0; - Fixed classicChargeGunPerFrame; + Fixed classicChargeGunPerFrame, chargeGunPerFrame = 0; + long mouseShootTime = 0; // To pace mouse button autofire. + Vector gunOffset = {0}; + Boolean fireGun = 0; // Weapons (Grenades & missiles) + long weaponIdent = 0; // View related variables: CSmartPart *viewPortPart = 0; // We look out from this one. + CScout *itsScout = 0; // + short scoutCommand = 0; // Control module (and view) orientation: Fixed viewYaw = 0; + Fixed dYaw = 0; // Delta Yaw - How far the yaw changed since the last frame Fixed viewPitch = 0; + Fixed dPitch = 0; // Delta Pitch - How far the pitch changed since the last frame Fixed oldElevation = 0; Fixed dElevation = 0; + Vector viewOffset = {0}; + Fixed lookDirection = 0; Fixed minPitch = 0; Fixed maxPitch = 0; + Fixed maxYaw = 0; Fixed oldYaw = 0; // We have to be able to undo the motion. Fixed oldPitch = 0; + Fixed yonBound = 0; + Fixed maxFOV = 0; + Fixed fieldOfView = 0; // Angle of field of view. Fixed scoutBaseHeight = 0; + SoundLink *teleportSoundLink = 0; + SoundLink *boostControlLink = 0; // Reincarnation: long limboCount = 0; + Fixed incarnateVolume = 0; + short incarnateSound = 0; + Boolean doIncarnateSound = 0; + Boolean reEnergize = 0; + Boolean didSelfDestruct = 0; bool didIncarnateMasked = false; // Winning/loosing: FrameNumber winFrame = 0; + Quaternion winStart = {0}; + Quaternion winEnd = {0}; Boolean isOut = 0; short lives = 0; + short winSound = 0; + Fixed winVolume = 0; + + short loseSound = 0; + Fixed loseVolume = 0; short chatMode = 0; long scoutIdent = 0; // true, if scout is out. Boolean scoutView = 0; // true = scout view, false = normal view Boolean isInLimbo = 0; + Boolean debugView = 0; Boolean netDestruct = 0; Fixed supportTraction = 0; Fixed supportFriction = 0; + // Hud parts: + CBSPPart *dirArrow = 0; + Fixed dirArrowHeight = 0; + + CBSPPart *targetOffs[2] = {0, 0}; + CBSPPart *targetOns[2] = {0, 0}; + + // Dashboard HUD + RayHitRecord dashboardOrigin; + Fixed dashboardSpinHeading; + Fixed dashboardSpinSpeed; + float hudRestingX; + float hudRestingY; + float hudTargetX; + float hudTargetY; + PidMotion pMotionX; + PidMotion pMotionY; + CScaledBSP *lockLight = 0; + CScaledBSP *groundDirArrow = 0; + CScaledBSP *groundDirArrowSlow = 0; + CScaledBSP *groundDirArrowFast = 0; + CScaledBSP *shieldGauge = 0; + CScaledBSP *shieldGaugeBackLight = 0; + CScaledBSP *energyGauge = 0; + CScaledBSP *energyGaugeBackLight = 0; + CScaledBSP *energyLabel = 0; + CScaledBSP *shieldLabel = 0; + CScaledBSP *grenadeLabel = 0; + CScaledBSP *missileLabel = 0; + CScaledBSP *boosterLabel = 0; + CScaledBSP *livesLabel = 0; + CScaledBSP *grenadeBox[4] = {0, 0, 0, 0}; + CScaledBSP *missileBox[4] = {0, 0, 0, 0}; + CScaledBSP *boosterBox[4] = {0, 0, 0, 0}; + CScaledBSP *livesBox[4] = {0, 0, 0, 0}; + CScaledBSP *grenadeMeter[4] = {0, 0, 0, 0}; + CScaledBSP *missileMeter[4] = {0, 0, 0, 0}; + CScaledBSP *boosterMeter[4] = {0, 0, 0, 0}; + CScaledBSP *livesMeter[4] = {0, 0, 0, 0}; + + // HUD Layout Prefs + int layout; + float layoutScale; + Fixed hudAlpha; + int gaugeBSP; + float arrowDistance; + float arrowScale; + float livesPosition[2]; + float boosterPosition[2]; + float grenadePosition[2]; + float missilePosition[2]; + float shieldPosition[2]; + float energyPosition[2]; + float offsetMultiplier; + float boosterSpacing; + float livesSpacing; + float weaponSpacing; + virtual void BeginScript(); virtual CAbstractActor *EndScript(); virtual void AdaptableSettings(); @@ -224,132 +322,4 @@ class CAbstractPlayer : public CRealMovers { virtual void WasHit(RayHitRecord *theHit, Fixed hitEnergy); virtual bool HandlesFastFPS() { return true; } -private: - PlayerConfigRecord defaultConfig {}; - - // Shields & energy: - Fixed generatorPower = 0; // Energy gain/frame - FrameNumber boostEndFrame = 0; - - Fixed shieldRegen = 0; // Shield regeneration rate - - FrameNumber nextGrenadeLoad = 0; - FrameNumber nextMissileLoad = 0; - - // Movement related variables: - Fixed motorFriction = 0; - Fixed classicMotorAcceleration = 0; - Fixed motorAcceleration = 0; - Fixed fpsMotorOffset = 0; - Fixed turningEffect = 0; // How far apart are the legs or wheels? - Fixed movementCost = 0; // Cost of acceleration - - Vector groundSlide = {0}; - // Guns: - Fixed chargeGunPerFrame = 0; - long mouseShootTime = 0; // To pace mouse button autofire. - Vector gunOffset = {0}; - Boolean fireGun = 0; - - // Weapons (Grenades & missiles) - long weaponIdent = 0; - - // View related variables: - - CScout *itsScout = 0; // - short scoutCommand = 0; - - // Control module (and view) orientation: - Fixed dYaw = 0; // Delta Yaw - How far the yaw changed since the last frame - Fixed dPitch = 0; // Delta Pitch - How far the pitch changed since the last frame - Vector viewOffset = {0}; - Fixed lookDirection = 0; - - Fixed maxYaw = 0; - - Fixed yonBound = 0; - Fixed maxFOV = 0; - Fixed fieldOfView = 0; // Angle of field of view. - - SoundLink *teleportSoundLink = 0; - SoundLink *boostControlLink = 0; - - // Reincarnation: - Fixed incarnateVolume = 0; - short incarnateSound = 0; - Boolean doIncarnateSound = 0; - Boolean reEnergize = 0; - Boolean didSelfDestruct = 0; - - // Winning/loosing: - - Quaternion winStart = {0}; - Quaternion winEnd = {0}; - - short winSound = 0; - Fixed winVolume = 0; - - short loseSound = 0; - Fixed loseVolume = 0; - - Boolean debugView = 0; - - // Hud parts: - CBSPPart *dirArrow = 0; - Fixed dirArrowHeight = 0; - - CBSPPart *targetOffs[2] = {0, 0}; - CBSPPart *targetOns[2] = {0, 0}; - - // Dashboard HUD - RayHitRecord dashboardOrigin; - Fixed dashboardSpinHeading; - Fixed dashboardSpinSpeed; - float hudRestingX; - float hudRestingY; - float hudTargetX; - float hudTargetY; - PidMotion pMotionX; - PidMotion pMotionY; - CScaledBSP *lockLight = 0; - CScaledBSP *groundDirArrow = 0; - CScaledBSP *groundDirArrowSlow = 0; - CScaledBSP *groundDirArrowFast = 0; - CScaledBSP *shieldGauge = 0; - CScaledBSP *shieldGaugeBackLight = 0; - CScaledBSP *energyGauge = 0; - CScaledBSP *energyGaugeBackLight = 0; - CScaledBSP *energyLabel = 0; - CScaledBSP *shieldLabel = 0; - CScaledBSP *grenadeLabel = 0; - CScaledBSP *missileLabel = 0; - CScaledBSP *boosterLabel = 0; - CScaledBSP *livesLabel = 0; - CScaledBSP *grenadeBox[4] = {0, 0, 0, 0}; - CScaledBSP *missileBox[4] = {0, 0, 0, 0}; - CScaledBSP *boosterBox[4] = {0, 0, 0, 0}; - CScaledBSP *livesBox[4] = {0, 0, 0, 0}; - CScaledBSP *grenadeMeter[4] = {0, 0, 0, 0}; - CScaledBSP *missileMeter[4] = {0, 0, 0, 0}; - CScaledBSP *boosterMeter[4] = {0, 0, 0, 0}; - CScaledBSP *livesMeter[4] = {0, 0, 0, 0}; - - // HUD Layout Prefs - int layout; - float layoutScale; - Fixed hudAlpha; - int gaugeBSP; - float arrowDistance; - float arrowScale; - float livesPosition[2]; - float boosterPosition[2]; - float grenadePosition[2]; - float missilePosition[2]; - float shieldPosition[2]; - float energyPosition[2]; - float offsetMultiplier; - float boosterSpacing; - float livesSpacing; - float weaponSpacing; - }; diff --git a/src/game/CBall.cpp b/src/game/CBall.cpp index 79af22d9d..f60dd7e1e 100644 --- a/src/game/CBall.cpp +++ b/src/game/CBall.cpp @@ -21,7 +21,9 @@ #define kStandardBallMass FIX(30); #define kBallBaseMass FIX(50); -CBall::CBall() { +void CBall::IAbstractActor() { + CRealShooters::IAbstractActor(); + mass = kStandardBallMass; baseMass = kStandardBallMass; diff --git a/src/game/CBall.h b/src/game/CBall.h index 2e4d7888a..30c011616 100644 --- a/src/game/CBall.h +++ b/src/game/CBall.h @@ -79,7 +79,7 @@ class CBall : public CRealShooters { Boolean playerAttach; - CBall(); + virtual void IAbstractActor(); virtual void BeginScript(); virtual CAbstractActor *EndScript(); virtual void Dispose(); diff --git a/src/game/CDepot.cpp b/src/game/CDepot.cpp index 4803a9d3f..6f152e76d 100644 --- a/src/game/CDepot.cpp +++ b/src/game/CDepot.cpp @@ -168,18 +168,19 @@ CAbstractMissile *CDepot::MakeMissile(short kind) { switch (kind) { case kmiFlat: - newMissile = new CMissile(this); + newMissile = new CMissile; break; case kmiTurning: - newMissile = new CPlayerMissile(this); + newMissile = new CPlayerMissile; break; case kmiShuriken: - newMissile = new CShuriken(this); + newMissile = new CShuriken; break; default: return newMissile; } + newMissile->IAbstractMissile(this); newMissile->missileKind = kind; return newMissile; @@ -320,14 +321,16 @@ CWeapon *CDepot::MakeWeapon(short kind) { switch (kind) { case kweGrenade: - newWeapon = new CGrenade(this); + newWeapon = new CGrenade; break; case kweSmart: - newWeapon = new CSmart(this); + newWeapon = new CSmart; break; default: return newWeapon; } + + newWeapon->IWeapon(this); newWeapon->weaponKind = kind; return newWeapon; diff --git a/src/game/CFreeSolid.h b/src/game/CFreeSolid.h index dd7ec45f4..80ddb4a4b 100644 --- a/src/game/CFreeSolid.h +++ b/src/game/CFreeSolid.h @@ -12,13 +12,6 @@ class CFreeSolid : public CRealMovers { public: - virtual void BeginScript(); // Write default param values - virtual CAbstractActor *EndScript(); // Read back values changed by user script - virtual void AdaptableSettings(); // Read settings that can change with frame rate - virtual void PlaceParts(); // Move our single BSP part into place/orientation - virtual void FrameAction(); // Action for each frame of simulation - virtual bool HandlesFastFPS() { return true; } -private: Fixed hitPower; // Collisions cause damage relative to shotPower Fixed classicGravity, customGravity; // Private gravity/frame Fixed classicAcceleration, acceleration; // Private slowdown/frame while moving @@ -26,4 +19,11 @@ class CFreeSolid : public CRealMovers { MessageRecord startMsg; // Message to enable object (otherwise motionless) MessageRecord stopMsg; // Message to disable object (to stop it) short status; // Status is either active or stopped + + virtual void BeginScript(); // Write default param values + virtual CAbstractActor *EndScript(); // Read back values changed by user script + virtual void AdaptableSettings(); // Read settings that can change with frame rate + virtual void PlaceParts(); // Move our single BSP part into place/orientation + virtual void FrameAction(); // Action for each frame of simulation + virtual bool HandlesFastFPS() { return true; } }; diff --git a/src/game/CGlowActors.cpp b/src/game/CGlowActors.cpp index fa630d809..b3f2fcefb 100644 --- a/src/game/CGlowActors.cpp +++ b/src/game/CGlowActors.cpp @@ -13,11 +13,11 @@ extern Fixed FRandSeed; -CGlowActors::CGlowActors() { +void CGlowActors::IAbstractActor() { + CPlacedActors::IAbstractActor(); canGlow = true; glow = 0; } - void CGlowActors::BeginScript() { CPlacedActors::BeginScript(); diff --git a/src/game/CGlowActors.h b/src/game/CGlowActors.h index 3019de431..470beb32b 100644 --- a/src/game/CGlowActors.h +++ b/src/game/CGlowActors.h @@ -14,10 +14,10 @@ class CGlowActors : public CPlacedActors { public: Fixed glow; Boolean canGlow; - CGlowActors(); + virtual void BeginScript(); virtual CAbstractActor *EndScript(); virtual void FrameAction(); virtual void WasHit(RayHitRecord *theHit, Fixed hitEnergy); - + virtual void IAbstractActor(); }; diff --git a/src/game/CGrenade.cpp b/src/game/CGrenade.cpp index 3818ead9b..df519026d 100644 --- a/src/game/CGrenade.cpp +++ b/src/game/CGrenade.cpp @@ -19,7 +19,9 @@ #define kGravity FIX3(120) #define kGrenadeFriction FIX3(10) -CGrenade::CGrenade(CDepot *theDepot) : CWeapon(theDepot) { +void CGrenade::IWeapon(CDepot *theDepot) { + CWeapon::IWeapon(theDepot); + blastSound = 231; partCount = 1; diff --git a/src/game/CGrenade.h b/src/game/CGrenade.h index eb850b756..6e802db51 100644 --- a/src/game/CGrenade.h +++ b/src/game/CGrenade.h @@ -19,7 +19,7 @@ class CGrenade : public CWeapon { Fixed friction, classicFriction; Fixed speedOffset; - CGrenade(CDepot *theDepot); + virtual void IWeapon(CDepot *theDepot); virtual void PlaceParts(); virtual void AdaptableSettings(); virtual long Arm(CSmartPart *aPart); diff --git a/src/game/CMarkerActor.cpp b/src/game/CMarkerActor.cpp index 04ecf35fc..71aaed9a1 100644 --- a/src/game/CMarkerActor.cpp +++ b/src/game/CMarkerActor.cpp @@ -11,8 +11,8 @@ #include "CSmartPart.h" -CMarkerActor::CMarkerActor() { - +void CMarkerActor::IAbstractActor() { + CGlowActors::IAbstractActor(); isActive = kIsActive; maskBits = kTargetBit; // + kMarkerBit; // TODO: what is this?? } diff --git a/src/game/CMarkerActor.h b/src/game/CMarkerActor.h index 50308374f..e9144316e 100644 --- a/src/game/CMarkerActor.h +++ b/src/game/CMarkerActor.h @@ -17,7 +17,7 @@ class CMarkerActor : public CGlowActors { public: short markerColor; - CMarkerActor(); + virtual void IAbstractActor(); virtual CAbstractActor *EndScript(); virtual void FrameAction(); }; diff --git a/src/game/CMissile.cpp b/src/game/CMissile.cpp index b9f284863..4774f3307 100644 --- a/src/game/CMissile.cpp +++ b/src/game/CMissile.cpp @@ -9,7 +9,9 @@ #include "CMissile.h" -CMissile::CMissile(CDepot *theDepot) : CAbstractMissile(theDepot) { +void CMissile::IAbstractMissile(CDepot *theDepot) { + CAbstractMissile::IAbstractMissile(theDepot); + partCount = 1; LoadPart(0, kMissileBSP); } diff --git a/src/game/CMissile.h b/src/game/CMissile.h index 4fde96ce8..d9649f572 100644 --- a/src/game/CMissile.h +++ b/src/game/CMissile.h @@ -14,6 +14,6 @@ class CMissile : public CAbstractMissile { public: - CMissile(CDepot *theDepot); + virtual void IAbstractMissile(CDepot *theDepot); virtual bool HandlesFastFPS() { return true; } }; diff --git a/src/game/CParasite.h b/src/game/CParasite.h index d13ee23d7..557595c02 100644 --- a/src/game/CParasite.h +++ b/src/game/CParasite.h @@ -14,15 +14,6 @@ class CAbstractPlayer; class CParasite : public CRealMovers { public: - virtual void PlaceParts(); - virtual void BeginScript(); - virtual CAbstractActor *EndScript(); - virtual void ReleaseAttachment(); - virtual void Dispose(); - virtual void CourseCheck(); - virtual void FrameAction(); - virtual void ClampOn(CSmartPart *clampTo); -private: Fixed maxPower; Fixed energyDrain; Fixed range; @@ -45,4 +36,12 @@ class CParasite : public CRealMovers { Boolean isTracking; + virtual void PlaceParts(); + virtual void BeginScript(); + virtual CAbstractActor *EndScript(); + virtual void ReleaseAttachment(); + virtual void Dispose(); + virtual void CourseCheck(); + virtual void FrameAction(); + virtual void ClampOn(CSmartPart *clampTo); }; diff --git a/src/game/CPill.cpp b/src/game/CPill.cpp index 61c609423..79b0ca8f2 100644 --- a/src/game/CPill.cpp +++ b/src/game/CPill.cpp @@ -14,7 +14,9 @@ #define kPillGravity FIX3(120) #define kFriction FIX3(800) -CPill::CPill() { +void CPill::IAbstractActor() { + CBall::IAbstractActor(); + mass = kStandardPillMass; shieldsCharge = FIX3(5); diff --git a/src/game/CPill.h b/src/game/CPill.h index 43d1c40e5..02e957b2c 100644 --- a/src/game/CPill.h +++ b/src/game/CPill.h @@ -12,5 +12,5 @@ class CPill : public CBall { public: - CPill(); + virtual void IAbstractActor(); }; diff --git a/src/game/CPlacedActors.cpp b/src/game/CPlacedActors.cpp index c4d46c38a..7ea058458 100644 --- a/src/game/CPlacedActors.cpp +++ b/src/game/CPlacedActors.cpp @@ -11,10 +11,12 @@ #include "CSmartPart.h" -CPlacedActors::CPlacedActors() { +void CPlacedActors::IAbstractActor() { location[0] = 0; location[1] = 0; location[2] = 0; + + CAbstractActor::IAbstractActor(); } void CPlacedActors::BeginScript() { diff --git a/src/game/CPlacedActors.h b/src/game/CPlacedActors.h index eef05be4c..4dfe394a4 100644 --- a/src/game/CPlacedActors.h +++ b/src/game/CPlacedActors.h @@ -16,7 +16,7 @@ class CPlacedActors : public CAbstractActor { Vector location; Fixed heading; - CPlacedActors(); + virtual void IAbstractActor(); virtual void BeginScript(); virtual CAbstractActor *EndScript(); virtual bool UseForRandomIncarnator() { return false; } diff --git a/src/game/CPlayerManager.cpp b/src/game/CPlayerManager.cpp index 39b9bebea..2d67e7faf 100644 --- a/src/game/CPlayerManager.cpp +++ b/src/game/CPlayerManager.cpp @@ -1032,6 +1032,7 @@ CAbstractPlayer *CPlayerManagerImpl::ChooseActor(CAbstractPlayer *actorList, sho if (itsPlayer == NULL) { itsPlayer = new CWalkerActor; + itsPlayer->IAbstractActor(); itsPlayer->BeginScript(); ProgramLongVar(iTeam, myTeamColor); FreshCalc(); // Parser call. @@ -1057,6 +1058,7 @@ CAbstractPlayer *CPlayerManagerImpl::ChooseActor(CAbstractPlayer *actorList, sho Boolean CPlayerManagerImpl::IncarnateInAnyColor() { for (short i = 1; i <= kMaxTeamColors; i++) { itsPlayer = new CWalkerActor; + itsPlayer->IAbstractActor(); itsPlayer->BeginScript(); ProgramLongVar(iTeam, i); FreshCalc(); // Parser call. diff --git a/src/game/CPlayerMissile.cpp b/src/game/CPlayerMissile.cpp index ece56475b..2564ac4bf 100644 --- a/src/game/CPlayerMissile.cpp +++ b/src/game/CPlayerMissile.cpp @@ -13,7 +13,9 @@ #define kPlayerMissileBSP 203 #define MISSILESPIN FpsCoefficient2(FIX(17)) -CPlayerMissile::CPlayerMissile(CDepot *theDepot) : CAbstractMissile(theDepot) { +void CPlayerMissile::IAbstractMissile(CDepot *theDepot) { + CAbstractMissile::IAbstractMissile(theDepot); + speed = PLAYERMISSILESPEED; maxFrameCount = FpsFramesPerClassic(PLAYERMISSILELIFE); diff --git a/src/game/CPlayerMissile.h b/src/game/CPlayerMissile.h index 63c1b089b..2f3b619a5 100644 --- a/src/game/CPlayerMissile.h +++ b/src/game/CPlayerMissile.h @@ -19,7 +19,7 @@ class CPlayerMissile : public CAbstractMissile { Fixed rotation; Fixed spin; - CPlayerMissile(CDepot *theDepot); + virtual void IAbstractMissile(CDepot *theDepot); virtual void SetSpin(Boolean spinDirection); virtual void MoveForward(); virtual bool HandlesFastFPS() { return true; } diff --git a/src/game/CRealMovers.cpp b/src/game/CRealMovers.cpp index d86632bc6..6c82fa06e 100644 --- a/src/game/CRealMovers.cpp +++ b/src/game/CRealMovers.cpp @@ -12,7 +12,9 @@ #include "CSmartPart.h" -CRealMovers::CRealMovers() { +void CRealMovers::IAbstractActor() { + CGlowActors::IAbstractActor(); + maskBits |= kCanPushBit; baseMass = FIX(300); mass = FIX(50); // Some default mass diff --git a/src/game/CRealMovers.h b/src/game/CRealMovers.h index be1568ee1..59f28151f 100644 --- a/src/game/CRealMovers.h +++ b/src/game/CRealMovers.h @@ -16,7 +16,7 @@ class CRealMovers : public CGlowActors { Vector speed = {0, 0, 0, 0}; // Track speed when Hector gets hit Vector dSpeed = {0, 0, 0, 0}; // Track delta velocity when Hector gets hit - CRealMovers(); + virtual void IAbstractActor(); virtual void GetSpeedEstimate(Fixed *theSpeed); virtual void Push(Fixed *direction); virtual void Accelerate(Fixed *direction); diff --git a/src/game/CRealShooters.cpp b/src/game/CRealShooters.cpp index 97f45acad..377ca4eda 100644 --- a/src/game/CRealShooters.cpp +++ b/src/game/CRealShooters.cpp @@ -13,7 +13,9 @@ #include "CShuriken.h" #include "CSmartPart.h" -CRealShooters::CRealShooters() { +void CRealShooters::IAbstractActor() { + CRealMovers::IAbstractActor(); + visionRange = FIX(100); shotPower = FIX3(500); burstLength = 2; diff --git a/src/game/CRealShooters.h b/src/game/CRealShooters.h index 1f7c5f205..369ca18bb 100644 --- a/src/game/CRealShooters.h +++ b/src/game/CRealShooters.h @@ -28,7 +28,7 @@ class CRealShooters : public CRealMovers { MaskType watchMask; short watchTeams; - CRealShooters(); + virtual void IAbstractActor(); virtual void BeginScript(); virtual CAbstractActor *EndScript(); diff --git a/src/game/CScout.cpp b/src/game/CScout.cpp index 3da32fbfd..00c1245be 100644 --- a/src/game/CScout.cpp +++ b/src/game/CScout.cpp @@ -27,7 +27,9 @@ #define FOLLOWRADIUS 10 -CScout::CScout(CAbstractPlayer *thePlayer, short theTeam, ARGBColor longTeamColor) { +void CScout::IScout(CAbstractPlayer *thePlayer, short theTeam, ARGBColor longTeamColor) { + IAbstractActor(); + mass = FIX(20); baseMass = FIX(40); teamColor = theTeam; diff --git a/src/game/CScout.h b/src/game/CScout.h index 9eda591a8..cc03cf39a 100644 --- a/src/game/CScout.h +++ b/src/game/CScout.h @@ -28,8 +28,12 @@ enum { class CScout : public CRealMovers { public: + Vector targetPosition; + CAbstractPlayer *itsPlayer; + short action; + Boolean nextRotateFlag; - CScout(CAbstractPlayer *thePlayer, short theTeam, ARGBColor longTeamColor); + virtual void IScout(CAbstractPlayer *thePlayer, short theTeam, ARGBColor longTeamColor); virtual void PlaceParts(); virtual void FrameAction(); virtual void ControlViewPoint(); @@ -37,9 +41,4 @@ class CScout : public CRealMovers { virtual Fixed MoveToTarget(); virtual bool HandlesFastFPS() { return true; } -private: - Vector targetPosition; - CAbstractPlayer *itsPlayer; - short action; - Boolean nextRotateFlag; }; diff --git a/src/game/CShuriken.cpp b/src/game/CShuriken.cpp index 509c789ce..247ee3264 100644 --- a/src/game/CShuriken.cpp +++ b/src/game/CShuriken.cpp @@ -13,7 +13,9 @@ #define SHURIKENSPIN FpsCoefficient2(2621) #define SHURIKENLIFE FpsFramesPerClassic(100) -CShuriken::CShuriken(CDepot *theDepot) : CAbstractMissile(theDepot) { +void CShuriken::IAbstractMissile(CDepot *theDepot) { + CAbstractMissile::IAbstractMissile(theDepot); + speed = SHURIKENSPEED; maxFrameCount = SHURIKENLIFE; diff --git a/src/game/CShuriken.h b/src/game/CShuriken.h index 65d359cfa..0721dc2a7 100644 --- a/src/game/CShuriken.h +++ b/src/game/CShuriken.h @@ -14,8 +14,9 @@ class CShuriken : public CAbstractMissile { public: - CShuriken(CDepot *theDepot); Fixed rotation; + + virtual void IAbstractMissile(CDepot *theDepot); virtual void MoveForward(); virtual bool HandlesFastFPS() { return true; } }; diff --git a/src/game/CSmart.cpp b/src/game/CSmart.cpp index f125d0811..73e913887 100644 --- a/src/game/CSmart.cpp +++ b/src/game/CSmart.cpp @@ -18,7 +18,9 @@ #define kSmartAccel itsDepot->missileAcceleration #define kSmartFriction FIX3(50) -CSmart::CSmart(CDepot *theDepot) : CWeapon(theDepot) { +void CSmart::IWeapon(CDepot *theDepot) { + CWeapon::IWeapon(theDepot); + partCount = 1; LoadPart(0, 802); partList[0]->usesPrivateHither = true; diff --git a/src/game/CSmart.h b/src/game/CSmart.h index 6889d6c55..7780ff560 100644 --- a/src/game/CSmart.h +++ b/src/game/CSmart.h @@ -26,7 +26,7 @@ class CSmart : public CWeapon { short inSight; FrameNumber fireFrame; - CSmart(CDepot *theDepot); + virtual void IWeapon(CDepot *theDepot); virtual void ResetWeapon(); virtual void PlaceParts(); diff --git a/src/game/CSphereActor.cpp b/src/game/CSphereActor.cpp index 7b277b4e2..aa70dff56 100644 --- a/src/game/CSphereActor.cpp +++ b/src/game/CSphereActor.cpp @@ -11,7 +11,9 @@ #include "CSmartPart.h" -CSphereActor::CSphereActor() { +void CSphereActor::IAbstractActor() { + CGlowActors::IAbstractActor(); + maskBits |= kTargetBit + kSolidBit; } CAbstractActor *CSphereActor::EndScript() { diff --git a/src/game/CSphereActor.h b/src/game/CSphereActor.h index b58bfcdc6..f3e5c2126 100644 --- a/src/game/CSphereActor.h +++ b/src/game/CSphereActor.h @@ -15,7 +15,7 @@ class CSphereActor : public CGlowActors { public: - CSphereActor(); + virtual void IAbstractActor(); virtual CAbstractActor *EndScript(); virtual void WasHit(RayHitRecord *theHit, Fixed hitEnergy); }; diff --git a/src/game/CWallActor.cpp b/src/game/CWallActor.cpp index 7cc3332d8..3e7ecf698 100644 --- a/src/game/CWallActor.cpp +++ b/src/game/CWallActor.cpp @@ -62,6 +62,7 @@ void CWallActor::MakeWallFromRect(Rect *theRect, Fixed height, short decimateWal } otherWall = new CWallActor; + otherWall->IAbstractActor(); otherWall->MakeWallFromRect(&smallRect, height, newDecim, false); } } while (tooBig); diff --git a/src/game/CWeapon.cpp b/src/game/CWeapon.cpp index 240c78a9e..5ea3430bb 100644 --- a/src/game/CWeapon.cpp +++ b/src/game/CWeapon.cpp @@ -16,8 +16,8 @@ #define DEFAULTMISSILESOUND 200 #define MINEBLOWSOUND 301 -CWeapon::CWeapon(CDepot *theDepot) { - +void CWeapon::IWeapon(CDepot *theDepot) { + IAbstractActor(); nextWeapon = NULL; diff --git a/src/game/CWeapon.h b/src/game/CWeapon.h index 5a47f1b55..aa48733a3 100644 --- a/src/game/CWeapon.h +++ b/src/game/CWeapon.h @@ -35,7 +35,7 @@ class CWeapon : public CAbstractActor { Boolean doExplode; Boolean isTargetLocked; - CWeapon(CDepot *theDepot); + virtual void IWeapon(CDepot *theDepot); virtual void ResetWeapon(); virtual void LevelReset(); diff --git a/src/level/LevelLoader.cpp b/src/level/LevelLoader.cpp index 3d4283cdc..7a6f8df72 100644 --- a/src/level/LevelLoader.cpp +++ b/src/level/LevelLoader.cpp @@ -323,6 +323,7 @@ struct ALFWalker: pugi::xml_tree_walker { RunThis(script.str()); } CWallActor *theWall = new CWallActor; + theWall->IAbstractActor(); theWall->MakeWallFromRect(&gLastBoxRect, gLastBoxRounding, 0, true); } diff --git a/src/level/Parser.cpp b/src/level/Parser.cpp index 2538f0b4f..4558c1a45 100644 --- a/src/level/Parser.cpp +++ b/src/level/Parser.cpp @@ -73,6 +73,7 @@ void CreateTheObject() { currentActor = (CAbstractActor *)CreateNamedObject(nameBuf); if (currentActor) { + currentActor->IAbstractActor(); currentActor->BeginScript(); currentLevel++; } @@ -89,6 +90,7 @@ void CreateTheAdjuster() { currentActor = (CAbstractActor *)CreateNamedObject(nameBuf); if (currentActor) { + currentActor->IAbstractActor(); currentActor->BeginScript(); currentLevel++; } diff --git a/src/tests.cpp b/src/tests.cpp index 5b4269e54..298919c4e 100644 --- a/src/tests.cpp +++ b/src/tests.cpp @@ -204,6 +204,7 @@ class HectorTestScenario { app.GetNet()->ChangeNet(kNullNet, ""); game->LevelReset(false); hector = new CWalkerActor(); + hector->IAbstractActor(); hector->BeginScript(); hector->EndScript(); game->itsNet->playerTable[0]->SetPlayer(hector);