Skip to content

Commit

Permalink
Merge pull request #377 from avaraline/constructions
Browse files Browse the repository at this point in the history
Replace several IFunctions with normal constructors
  • Loading branch information
assertivist authored Dec 22, 2023
2 parents 6538f2d + 0028830 commit 262f852
Show file tree
Hide file tree
Showing 46 changed files with 224 additions and 240 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
61 changes: 26 additions & 35 deletions src/game/CAbstractActor.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,66 +84,32 @@ 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;
CAbstractActor *identLink;
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();
Expand Down Expand Up @@ -231,6 +197,31 @@ 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);
};
4 changes: 1 addition & 3 deletions src/game/CAbstractMissile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
#define GROUNDHITSOUNDID 211
#define DEFAULTMISSILESOUND 200

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

CAbstractMissile::CAbstractMissile(CDepot *theDepot) {
isActive = kIsActive;
itsDepot = theDepot;
itsGame = itsDepot->itsGame;
Expand Down
3 changes: 2 additions & 1 deletion src/game/CAbstractMissile.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class CDepot;

class CAbstractMissile : public CAbstractActor {
public:
CAbstractMissile(CDepot *theDepot);
CAbstractMissile *nextMissile;
long ownerIdent;
CDepot *itsDepot;
Expand All @@ -35,7 +36,7 @@ class CAbstractMissile : public CAbstractActor {
short missileKind;
short soundResId;

virtual void IAbstractMissile(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
Loading

0 comments on commit 262f852

Please sign in to comment.