Skip to content

Commit

Permalink
Merge pull request #380 from avaraline/constructions
Browse files Browse the repository at this point in the history
Reconvert IAbstractActor to normal constructor
  • Loading branch information
assertivist authored Jan 4, 2024
2 parents 6343522 + 321dbc2 commit e7657df
Show file tree
Hide file tree
Showing 43 changed files with 53 additions and 92 deletions.
2 changes: 1 addition & 1 deletion src/game/CAbstractActor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ void CAbstractActor::BuildPartSpheresProximityList(MaskType filterMask) {
BuildPartProximityList(minPoint, FDistanceOverEstimate(maxPoint[0], maxPoint[1], maxPoint[2]), filterMask);
}

void CAbstractActor::IAbstractActor() {
CAbstractActor::CAbstractActor() {
short i;

proximityList.p = NULL;
Expand Down
5 changes: 3 additions & 2 deletions src/game/CAbstractActor.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ typedef union {

class CAbstractActor : public CDirectObject {
public:
CAbstractActor();
CAvaraGame *itsGame;

unsigned long searchCount;
Expand Down Expand Up @@ -144,7 +145,7 @@ class CAbstractActor : public CDirectObject {

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();
Expand Down Expand Up @@ -204,7 +205,7 @@ class CAbstractActor : public CDirectObject {
virtual void GetFrictionTraction(Fixed *tract, Fixed *frict);

// Location link entry handling.
virtual void InitLocationLinks();
void InitLocationLinks();
void LinkSphere(Fixed *origin, Fixed range);
void LinkBox(Fixed minX, Fixed minZ, Fixed maxX, Fixed maxZ);
void LinkPartBoxes();
Expand Down
6 changes: 2 additions & 4 deletions src/game/CAbstractMissile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,13 @@
#define GROUNDHITSOUNDID 211
#define DEFAULTMISSILESOUND 200

void CAbstractMissile::IAbstractMissile(CDepot *theDepot) {
IAbstractActor();

CAbstractMissile::CAbstractMissile(CDepot *theDepot) {
isActive = kIsActive;
itsDepot = theDepot;
itsGame = itsDepot->itsGame;

speed = FIX3(2000);
maxFrameCount = FpsFramesPerClassic(50);

energy = 0;

nextMissile = NULL;
Expand Down
2 changes: 1 addition & 1 deletion src/game/CAbstractMissile.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class CAbstractMissile : public CAbstractActor {
short missileKind;
short soundResId;

virtual void IAbstractMissile(CDepot *theDepot);
CAbstractMissile(CDepot *theDepot);
virtual void Deactivate();
virtual void Launch(Matrix *startMatrix,
RayHitRecord *target,
Expand Down
4 changes: 1 addition & 3 deletions src/game/CAbstractMovers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@

#include "CAbstractMovers.h"

void CAbstractMovers::IAbstractActor() {
CGlowActors::IAbstractActor();

CAbstractMovers::CAbstractMovers() {
mass = FIX(50); // Some default mass
speed[0] = 0;
speed[1] = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/game/CAbstractMovers.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class CAbstractMovers : public CGlowActors {
Fixed internalImpulse[3];
Fixed impulseSlowDown;

virtual void IAbstractActor();
CAbstractMovers();
virtual void GetSpeedEstimate(Fixed *theSpeed);
virtual void FrameAction();
virtual void Push(Fixed *direction);
Expand Down
3 changes: 1 addition & 2 deletions src/game/CAbstractPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,7 @@ void CAbstractPlayer::LevelReset() {
void CAbstractPlayer::LoadScout() {
scoutCommand = kScoutNullCommand;

itsScout = new CScout;
itsScout->IScout(this, teamColor, GetTeamColorOr(ColorManager::getDefaultTeamColor()));
itsScout = new CScout(this, teamColor, GetTeamColorOr(ColorManager::getDefaultTeamColor()));
itsScout->BeginScript();
FreshCalc();
itsScout->EndScript();
Expand Down
4 changes: 1 addition & 3 deletions src/game/CBall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
#define kStandardBallMass FIX(30);
#define kBallBaseMass FIX(50);

void CBall::IAbstractActor() {
CRealShooters::IAbstractActor();

CBall::CBall() {
mass = kStandardBallMass;
baseMass = kStandardBallMass;

Expand Down
2 changes: 1 addition & 1 deletion src/game/CBall.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class CBall : public CRealShooters {

Boolean playerAttach;

virtual void IAbstractActor();
CBall();
virtual void BeginScript();
virtual CAbstractActor *EndScript();
virtual void Dispose();
Expand Down
12 changes: 5 additions & 7 deletions src/game/CDepot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,19 +168,18 @@ CAbstractMissile *CDepot::MakeMissile(short kind) {

switch (kind) {
case kmiFlat:
newMissile = new CMissile;
newMissile = new CMissile(this);
break;
case kmiTurning:
newMissile = new CPlayerMissile;
newMissile = new CPlayerMissile(this);
break;
case kmiShuriken:
newMissile = new CShuriken;
newMissile = new CShuriken(this);
break;
default:
return newMissile;
}

newMissile->IAbstractMissile(this);
newMissile->missileKind = kind;

return newMissile;
Expand Down Expand Up @@ -321,16 +320,15 @@ CWeapon *CDepot::MakeWeapon(short kind) {

switch (kind) {
case kweGrenade:
newWeapon = new CGrenade;
newWeapon = new CGrenade(this);
break;
case kweSmart:
newWeapon = new CSmart;
newWeapon = new CSmart(this);
break;
default:
return newWeapon;
}

newWeapon->IWeapon(this);
newWeapon->weaponKind = kind;

return newWeapon;
Expand Down
3 changes: 1 addition & 2 deletions src/game/CGlowActors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@

extern Fixed FRandSeed;

void CGlowActors::IAbstractActor() {
CPlacedActors::IAbstractActor();
CGlowActors::CGlowActors() {
canGlow = true;
glow = 0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/game/CGlowActors.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ class CGlowActors : public CPlacedActors {
virtual CAbstractActor *EndScript();
virtual void FrameAction();
virtual void WasHit(RayHitRecord *theHit, Fixed hitEnergy);
virtual void IAbstractActor();
CGlowActors();
};
4 changes: 1 addition & 3 deletions src/game/CGrenade.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@
#define kGravity FIX3(120)
#define kGrenadeFriction FIX3(10)

void CGrenade::IWeapon(CDepot *theDepot) {
CWeapon::IWeapon(theDepot);

CGrenade::CGrenade(CDepot *theDepot) : CWeapon(theDepot) {
blastSound = 231;

partCount = 1;
Expand Down
4 changes: 2 additions & 2 deletions src/game/CGrenade.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@

class CDepot;

class CGrenade : public CWeapon {
class CGrenade final : public CWeapon {
public:
Fixed gravity, classicGravity;
Fixed friction, classicFriction;
Fixed speedOffset;

virtual void IWeapon(CDepot *theDepot);
CGrenade(CDepot *theDepot);
virtual void PlaceParts();
virtual void AdaptableSettings();
virtual long Arm(CSmartPart *aPart);
Expand Down
3 changes: 1 addition & 2 deletions src/game/CMarkerActor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@

#include "CSmartPart.h"

void CMarkerActor::IAbstractActor() {
CGlowActors::IAbstractActor();
CMarkerActor::CMarkerActor() {
isActive = kIsActive;
maskBits = kTargetBit; // + kMarkerBit; // TODO: what is this??
}
Expand Down
2 changes: 1 addition & 1 deletion src/game/CMarkerActor.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class CMarkerActor : public CGlowActors {
public:
short markerColor;

virtual void IAbstractActor();
CMarkerActor();
virtual CAbstractActor *EndScript();
virtual void FrameAction();
};
5 changes: 2 additions & 3 deletions src/game/CMissile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@

#include "CMissile.h"

void CMissile::IAbstractMissile(CDepot *theDepot) {
CAbstractMissile::IAbstractMissile(theDepot);

CMissile::CMissile(CDepot *theDepot) : CAbstractMissile(theDepot) {
maxFrameCount = FpsFramesPerClassic(50);
partCount = 1;
LoadPart(0, kMissileBSP);
}
4 changes: 2 additions & 2 deletions src/game/CMissile.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@

#define kMissileBSP 801

class CMissile : public CAbstractMissile {
class CMissile final : public CAbstractMissile {
public:
virtual void IAbstractMissile(CDepot *theDepot);
CMissile(CDepot *theDepot);
virtual bool HandlesFastFPS() { return true; }
};
4 changes: 1 addition & 3 deletions src/game/CPill.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
#define kPillGravity FIX3(120)
#define kFriction FIX3(800)

void CPill::IAbstractActor() {
CBall::IAbstractActor();

CPill::CPill() {
mass = kStandardPillMass;

shieldsCharge = FIX3(5);
Expand Down
2 changes: 1 addition & 1 deletion src/game/CPill.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@

class CPill : public CBall {
public:
virtual void IAbstractActor();
CPill();
};
4 changes: 1 addition & 3 deletions src/game/CPlacedActors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@

#include "CSmartPart.h"

void CPlacedActors::IAbstractActor() {
CPlacedActors::CPlacedActors() {
location[0] = 0;
location[1] = 0;
location[2] = 0;

CAbstractActor::IAbstractActor();
}

void CPlacedActors::BeginScript() {
Expand Down
2 changes: 1 addition & 1 deletion src/game/CPlacedActors.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class CPlacedActors : public CAbstractActor {
Vector location;
Fixed heading;

virtual void IAbstractActor();
CPlacedActors();
virtual void BeginScript();
virtual CAbstractActor *EndScript();
virtual bool UseForRandomIncarnator() { return false; }
Expand Down
2 changes: 0 additions & 2 deletions src/game/CPlayerManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1032,7 +1032,6 @@ CAbstractPlayer *CPlayerManagerImpl::ChooseActor(CAbstractPlayer *actorList, sho

if (itsPlayer == NULL) {
itsPlayer = new CWalkerActor;
itsPlayer->IAbstractActor();
itsPlayer->BeginScript();
ProgramLongVar(iTeam, myTeamColor);
FreshCalc(); // Parser call.
Expand All @@ -1058,7 +1057,6 @@ 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.
Expand Down
4 changes: 1 addition & 3 deletions src/game/CPlayerMissile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
#define kPlayerMissileBSP 203
#define MISSILESPIN FpsCoefficient2(FIX(17))

void CPlayerMissile::IAbstractMissile(CDepot *theDepot) {
CAbstractMissile::IAbstractMissile(theDepot);

CPlayerMissile::CPlayerMissile(CDepot *theDepot) : CAbstractMissile(theDepot){
speed = PLAYERMISSILESPEED;
maxFrameCount = FpsFramesPerClassic(PLAYERMISSILELIFE);

Expand Down
4 changes: 2 additions & 2 deletions src/game/CPlayerMissile.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
#define PLAYERMISSILELIFE 25
#define PLAYERMISSILERANGE (PLAYERMISSILELIFE * PLAYERMISSILESPEED)

class CPlayerMissile : public CAbstractMissile {
class CPlayerMissile final : public CAbstractMissile {
public:
Fixed rotation;
Fixed spin;

virtual void IAbstractMissile(CDepot *theDepot);
CPlayerMissile(CDepot *theDepot);
virtual void SetSpin(Boolean spinDirection);
virtual void MoveForward();
virtual bool HandlesFastFPS() { return true; }
Expand Down
4 changes: 1 addition & 3 deletions src/game/CRealMovers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@

#include "CSmartPart.h"

void CRealMovers::IAbstractActor() {
CGlowActors::IAbstractActor();

CRealMovers::CRealMovers() {
maskBits |= kCanPushBit;
baseMass = FIX(300);
mass = FIX(50); // Some default mass
Expand Down
2 changes: 1 addition & 1 deletion src/game/CRealMovers.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

virtual void IAbstractActor();
CRealMovers();
virtual void GetSpeedEstimate(Fixed *theSpeed);
virtual void Push(Fixed *direction);
virtual void Accelerate(Fixed *direction);
Expand Down
5 changes: 2 additions & 3 deletions src/game/CRealShooters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
#include "CShuriken.h"
#include "CSmartPart.h"

void CRealShooters::IAbstractActor() {
CRealMovers::IAbstractActor();

CRealShooters::CRealShooters() {
visionRange = FIX(100);
shotPower = FIX3(500);
burstLength = 2;
Expand All @@ -25,6 +23,7 @@ void CRealShooters::IAbstractActor() {
watchTeams = -2;
watchMask = kPlayerBit;
}

void CRealShooters::BeginScript() {
CRealMovers::BeginScript();

Expand Down
2 changes: 1 addition & 1 deletion src/game/CRealShooters.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class CRealShooters : public CRealMovers {
MaskType watchMask;
short watchTeams;

virtual void IAbstractActor();
CRealShooters();
virtual void BeginScript();
virtual CAbstractActor *EndScript();

Expand Down
4 changes: 1 addition & 3 deletions src/game/CScout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@

#define FOLLOWRADIUS 10

void CScout::IScout(CAbstractPlayer *thePlayer, short theTeam, ARGBColor longTeamColor) {
IAbstractActor();

CScout::CScout(CAbstractPlayer *thePlayer, short theTeam, ARGBColor longTeamColor) {
mass = FIX(20);
baseMass = FIX(40);
teamColor = theTeam;
Expand Down
4 changes: 2 additions & 2 deletions src/game/CScout.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ enum {
kScoutInactive
};

class CScout : public CRealMovers {
class CScout final : public CRealMovers {
public:
Vector targetPosition;
CAbstractPlayer *itsPlayer;
short action;
Boolean nextRotateFlag;

virtual void IScout(CAbstractPlayer *thePlayer, short theTeam, ARGBColor longTeamColor);
CScout(CAbstractPlayer *thePlayer, short theTeam, ARGBColor longTeamColor);
virtual void PlaceParts();
virtual void FrameAction();
virtual void ControlViewPoint();
Expand Down
Loading

0 comments on commit e7657df

Please sign in to comment.