Initial commit: bt411 -- standalone Windows BattleTech (Tesla 4.10 port)
Clean, self-contained extraction of the BattleTech-specific work from the
reverse-engineering workspace -- engine + game + content + build, with nothing
from Red Planet or the raw archive dumps. Builds green (Win32) and runs the
single-player drive->animate->target->fire->damage->destroy loop out of the box.
Layout:
engine/ MUNGA + MUNGA_L4 shared 2007 engine, carrying our BT render/loader
work (bgfload/L4D3D/L4VIDEO: BSL bit-slice decode, LOD/ground/shadow
models) + image codec; the minimal rp/ headers the audio HAL needs
game/ reconstructed BT logic + surviving-original BT source + fwd shims
+ WinMain launcher
content/ full runtime tree (BTL4.RES, VIDEO/, GAUGE/, AUDIO/, eggs, BTDPL.INI)
docs/ format specs + reconstruction ledgers
reference/ raw Ghidra pseudocode (recon source-of-truth) + decomp exporter
tools/ MP console emulator + map/resource scanners
One top-level CMake builds munga_engine lib + bt410_l4 game lib + btl4.exe.
All paths relativized (186 fwd shims + ~437 CMake abs paths -> repo-relative);
DXSDK is the one external, overridable via -DDXSDK. Verified: builds to a
byte-identical 2.27MB exe and runs combat (TARGET DESTROYED, 0 crashes) against
the bundled content.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
#pragma once
|
||||
|
||||
#include "crusher.h"
|
||||
|
||||
//##########################################################################
|
||||
//########################### Blocker ################################
|
||||
//##########################################################################
|
||||
class Blocker:
|
||||
public Crusher
|
||||
{
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Shared Data support
|
||||
//
|
||||
public:
|
||||
static Derivation *GetClassDerivations();
|
||||
static SharedData DefaultData;
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Message Support
|
||||
//
|
||||
private:
|
||||
static const HandlerEntry MessageHandlerEntries[];
|
||||
|
||||
protected:
|
||||
static MessageHandlerSet MessageHandlers;
|
||||
|
||||
public:
|
||||
void
|
||||
DropZoneReplyMessageHandler(DropZone__ReplyMessage *message);
|
||||
void
|
||||
ScoreMessageHandler(RPPlayer::ScoreMessage *message);
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Model Support
|
||||
//
|
||||
public:
|
||||
|
||||
typedef void
|
||||
(Blocker::*Performance)(Scalar time_slice);
|
||||
|
||||
void
|
||||
SetPerformance(Performance performance)
|
||||
{
|
||||
Check(this);
|
||||
activePerformance = (Simulation::Performance)performance;
|
||||
}
|
||||
|
||||
void
|
||||
PlayerSimulation(Scalar time_slice);
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Construction and Destruction
|
||||
//
|
||||
public:
|
||||
|
||||
static Blocker*
|
||||
Make(MakeMessage *creation_message);
|
||||
|
||||
Blocker(
|
||||
MakeMessage *creation_message,
|
||||
SharedData &shared_data = DefaultData
|
||||
);
|
||||
~Blocker();
|
||||
|
||||
Logical
|
||||
TestInstance() const;
|
||||
|
||||
void
|
||||
AddOffensivePlayer(OffensivePlayer &offensive_player);
|
||||
|
||||
|
||||
};
|
||||
@@ -0,0 +1,156 @@
|
||||
#pragma once
|
||||
|
||||
#include "vtvsub.h"
|
||||
|
||||
//##########################################################################
|
||||
//##################### Booster::SubsystemResource ###################
|
||||
//##########################################################################
|
||||
|
||||
struct Booster__SubsystemResource:
|
||||
public VTVSubsystem::SubsystemResource
|
||||
{
|
||||
int boosterCount;
|
||||
Scalar
|
||||
burnTime,
|
||||
boosterAcceleration;
|
||||
};
|
||||
|
||||
//##########################################################################
|
||||
//############################ Booster ###############################
|
||||
//##########################################################################
|
||||
|
||||
class Booster:
|
||||
public VTVSubsystem
|
||||
{
|
||||
friend class VTV;
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Messageing Support
|
||||
//
|
||||
public:
|
||||
enum {
|
||||
ActivateMessageID = VTVSubsystem::NextMessageID,
|
||||
ConfigureMappablesMessageID,
|
||||
ChooseButtonMessageID,
|
||||
NextMessageID
|
||||
};
|
||||
|
||||
void
|
||||
ActivateMessageHandler(
|
||||
ReceiverDataMessageOf<ControlsButton> *message
|
||||
);
|
||||
void
|
||||
ConfigureMappablesMessageHandler(
|
||||
ReceiverDataMessageOf<ControlsButton> *message
|
||||
);
|
||||
void
|
||||
ChooseButtonMessageHandler(
|
||||
ReceiverDataMessageOf<ControlsButton> *message
|
||||
);
|
||||
|
||||
protected:
|
||||
static const HandlerEntry
|
||||
MessageHandlerEntries[];
|
||||
static MessageHandlerSet
|
||||
MessageHandlers;
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Shared Data support
|
||||
//
|
||||
public:
|
||||
static Derivation *GetClassDerivations();
|
||||
static SharedData DefaultData;
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Attribute Support
|
||||
//
|
||||
public:
|
||||
enum {
|
||||
BurnTimeRemainingAttributeID = VTVSubsystem::NextAttributeID,
|
||||
BoostersRemainingAttributeID,
|
||||
ScaleFactorAttributeID,
|
||||
SmokeDensityAttributeID,
|
||||
PercentDoneAttributeID,
|
||||
NextAttributeID
|
||||
};
|
||||
|
||||
private:
|
||||
static const IndexEntry AttributePointers[];
|
||||
|
||||
protected:
|
||||
////static AttributeIndexSet AttributeIndex
|
||||
static AttributeIndexSet& GetAttributeIndex();
|
||||
|
||||
//
|
||||
// public attribute declarations go here
|
||||
//
|
||||
public:
|
||||
Scalar burnTimeRemaining;
|
||||
Scalar boostersRemaining;
|
||||
Vector3D scaleFactor;
|
||||
Scalar smokeDensity;
|
||||
Scalar percentDone;
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Model Support
|
||||
//
|
||||
public:
|
||||
enum {
|
||||
BoosterBurning = Subsystem::StateCount,
|
||||
StateCount
|
||||
};
|
||||
|
||||
typedef void
|
||||
(Booster::*Performance)(Scalar time_slice);
|
||||
|
||||
void
|
||||
BoosterSimulation(Scalar time_slice);
|
||||
|
||||
void
|
||||
SetPerformance(Performance performance)
|
||||
{
|
||||
Check(this);
|
||||
activePerformance = (Simulation::Performance)performance;
|
||||
}
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Damage Support
|
||||
//
|
||||
void
|
||||
DeathReset(int reset_command);
|
||||
void
|
||||
DeathShutdown(int shutdown_command);
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Construction and Destruction
|
||||
//
|
||||
public:
|
||||
typedef Booster__SubsystemResource SubsystemResource;
|
||||
|
||||
static int
|
||||
CreateStreamedSubsystem(
|
||||
NotationFile *model_file,
|
||||
const char *model_name,
|
||||
const char *subsystem_name,
|
||||
SubsystemResource *subsystem_resource,
|
||||
NotationFile *subsystem_file,
|
||||
const ResourceDirectories *directories
|
||||
);
|
||||
|
||||
Booster(
|
||||
VTV *owner,
|
||||
int subsystem_ID,
|
||||
SubsystemResource *subsystem_resource
|
||||
);
|
||||
~Booster();
|
||||
|
||||
Logical
|
||||
TestInstance() const;
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Local data for the Booster class
|
||||
//
|
||||
protected:
|
||||
Scalar burnTimeMax;
|
||||
Scalar acceleration;
|
||||
int maxBoosters;
|
||||
};
|
||||
@@ -0,0 +1,230 @@
|
||||
#pragma once
|
||||
|
||||
#include "vtvsub.h"
|
||||
#include "..\munga\rotation.h"
|
||||
|
||||
//##########################################################################
|
||||
//##################### Chute::UpdateRecord #####################
|
||||
//##########################################################################
|
||||
|
||||
struct Chute__UpdateRecord :
|
||||
public VTVSubsystem::UpdateRecord
|
||||
{
|
||||
Quaternion
|
||||
chuteDirection;
|
||||
Vector3D
|
||||
scaleFactor;
|
||||
int
|
||||
chuteOn;
|
||||
};
|
||||
|
||||
//##########################################################################
|
||||
//##################### Chute::SubsystemResource #####################
|
||||
//##########################################################################
|
||||
|
||||
struct Chute__SubsystemResource:
|
||||
public VTVSubsystem::SubsystemResource
|
||||
{
|
||||
int chuteCount;
|
||||
Scalar
|
||||
reloadTime,
|
||||
dragForce,
|
||||
minVelocity;
|
||||
|
||||
Scalar
|
||||
deployTime;
|
||||
Scalar
|
||||
zDeviation;
|
||||
};
|
||||
|
||||
//##########################################################################
|
||||
//############################ Chute ###############################
|
||||
//##########################################################################
|
||||
|
||||
class Chute:
|
||||
public VTVSubsystem
|
||||
{
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Messageing Support
|
||||
//
|
||||
public:
|
||||
enum {
|
||||
ActivateMessageID = VTVSubsystem::NextMessageID,
|
||||
ConfigureMappablesMessageID,
|
||||
ChooseButtonMessageID,
|
||||
NextMessageID
|
||||
};
|
||||
|
||||
void
|
||||
ActivateMessageHandler(
|
||||
ReceiverDataMessageOf<ControlsButton> *message
|
||||
);
|
||||
void
|
||||
ConfigureMappablesMessageHandler(
|
||||
ReceiverDataMessageOf<ControlsButton> *message
|
||||
);
|
||||
void
|
||||
ChooseButtonMessageHandler(
|
||||
ReceiverDataMessageOf<ControlsButton> *message
|
||||
);
|
||||
|
||||
protected:
|
||||
|
||||
static const HandlerEntry
|
||||
MessageHandlerEntries[];
|
||||
static MessageHandlerSet
|
||||
MessageHandlers;
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Shared Data support
|
||||
//
|
||||
public:
|
||||
static Derivation *GetClassDerivations();
|
||||
static SharedData DefaultData;
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Attribute Support
|
||||
//
|
||||
public:
|
||||
enum {
|
||||
TimeToReadyAttributeID = VTVSubsystem::NextAttributeID,
|
||||
ChutesRemainingAttributeID,
|
||||
ChuteDirectionAttributeID,
|
||||
ScaleFactorAttributeID,
|
||||
ChuteOnAttributeID,
|
||||
PercentDoneAttributeID,
|
||||
NextAttributeID
|
||||
};
|
||||
|
||||
private:
|
||||
static const IndexEntry AttributePointers[];
|
||||
|
||||
protected:
|
||||
//static AttributeIndexSet AttributeIndex
|
||||
static AttributeIndexSet& GetAttributeIndex();
|
||||
|
||||
//
|
||||
// public attribute declarations go here
|
||||
//
|
||||
public:
|
||||
Scalar
|
||||
timeToReady;
|
||||
Scalar
|
||||
chutesRemaining;
|
||||
Quaternion
|
||||
chuteDirection;
|
||||
Vector3D
|
||||
scaleFactor;
|
||||
int
|
||||
chuteOn;
|
||||
Scalar
|
||||
percentDone;
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Model Support
|
||||
//
|
||||
public:
|
||||
enum {
|
||||
Released = VTVSubsystem::StateCount,
|
||||
Deploy,
|
||||
Loading,
|
||||
Ready,
|
||||
Dragging,
|
||||
StateCount
|
||||
};
|
||||
typedef Chute__UpdateRecord UpdateRecord;
|
||||
|
||||
typedef void
|
||||
(Chute::*Performance)(Scalar time_slice);
|
||||
|
||||
void
|
||||
ChuteSimulation(Scalar time_slice);
|
||||
void
|
||||
PointChute(Scalar time_slice);
|
||||
|
||||
void
|
||||
SetPerformance(Performance performance)
|
||||
{
|
||||
Check(this);
|
||||
activePerformance = (Simulation::Performance)performance;
|
||||
}
|
||||
|
||||
VTV*
|
||||
GetEntity()
|
||||
{Check(this); return Cast_Object(VTV*, Subsystem::GetEntity());}
|
||||
|
||||
protected:
|
||||
void
|
||||
WriteUpdateRecord(Simulation::UpdateRecord *message, int update_model);
|
||||
void
|
||||
ReadUpdateRecord(Simulation::UpdateRecord *message);
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Damage Support
|
||||
//
|
||||
void
|
||||
DeathReset(int reset_command);
|
||||
void
|
||||
DeathShutdown(int shutdown_command);
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Construction and Destruction
|
||||
//
|
||||
public:
|
||||
typedef Chute__SubsystemResource SubsystemResource;
|
||||
|
||||
static int
|
||||
CreateStreamedSubsystem(
|
||||
NotationFile *model_file,
|
||||
const char *model_name,
|
||||
const char *subsystem_name,
|
||||
SubsystemResource *subsystem_resource,
|
||||
NotationFile *subsystem_file,
|
||||
const ResourceDirectories *directories
|
||||
);
|
||||
|
||||
Chute(
|
||||
VTV *owner,
|
||||
int subsystem_ID,
|
||||
SubsystemResource *subsystem_resource
|
||||
);
|
||||
~Chute();
|
||||
|
||||
Logical
|
||||
TestInstance() const;
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Local data for the Chute class
|
||||
//
|
||||
private:
|
||||
int chuteCount;
|
||||
Scalar reloadTime;
|
||||
Scalar dragForce;
|
||||
Scalar minVelocity;
|
||||
|
||||
Point3D
|
||||
chuteOffset;
|
||||
|
||||
Scalar
|
||||
deployTime,
|
||||
deployTimeUsed;
|
||||
|
||||
Scalar
|
||||
zDeviation;
|
||||
|
||||
void
|
||||
ApplyDrag(Scalar time_slice);
|
||||
|
||||
int
|
||||
DeviantChute();
|
||||
|
||||
void
|
||||
ReleaseChute();
|
||||
|
||||
|
||||
Scalar
|
||||
ScaleZ();
|
||||
|
||||
Scalar
|
||||
ScaleXY();
|
||||
|
||||
};
|
||||
@@ -0,0 +1,81 @@
|
||||
#pragma once
|
||||
|
||||
#include "rpplayer.h"
|
||||
|
||||
//##########################################################################
|
||||
//########################### Crusher ################################
|
||||
//##########################################################################
|
||||
class Crusher:
|
||||
public RPPlayer
|
||||
{
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Shared Data support
|
||||
//
|
||||
public:
|
||||
static Derivation *GetClassDerivations();
|
||||
static SharedData DefaultData;
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Message Support
|
||||
//
|
||||
private:
|
||||
static const HandlerEntry MessageHandlerEntries[];
|
||||
|
||||
protected:
|
||||
//static MessageHandlerSet MessageHandlers;
|
||||
static MessageHandlerSet& GetMessageHandlers();
|
||||
|
||||
public:
|
||||
void
|
||||
DropZoneReplyMessageHandler(DropZone__ReplyMessage *message);
|
||||
void
|
||||
ScoreZoneReplyMessageHandler(ScoreZone__ReplyMessage *message);
|
||||
void
|
||||
ScoreMessageHandler(RPPlayer::ScoreMessage *message);
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Model Support
|
||||
//
|
||||
public:
|
||||
|
||||
typedef void
|
||||
(Crusher::*Performance)(Scalar time_slice);
|
||||
|
||||
void
|
||||
SetPerformance(Performance performance)
|
||||
{
|
||||
Check(this);
|
||||
activePerformance = (Simulation::Performance)performance;
|
||||
}
|
||||
|
||||
void
|
||||
PlayerSimulation(Scalar time_slice);
|
||||
|
||||
RPPlayer
|
||||
*teamRunner,
|
||||
*enemyRunner;
|
||||
|
||||
void
|
||||
InitTeamRunner();
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Construction and Destruction
|
||||
//
|
||||
public:
|
||||
static Crusher*
|
||||
Make(MakeMessage *creation_message);
|
||||
|
||||
Crusher(
|
||||
MakeMessage *creation_message,
|
||||
SharedData &shared_data = DefaultData
|
||||
);
|
||||
~Crusher();
|
||||
|
||||
Logical
|
||||
TestInstance() const;
|
||||
|
||||
void
|
||||
AddOffensivePlayer(OffensivePlayer &offensive_player);
|
||||
|
||||
void
|
||||
PointVTVTowardGoal();
|
||||
};
|
||||
@@ -0,0 +1,121 @@
|
||||
#pragma once
|
||||
|
||||
#include "rivet.h"
|
||||
|
||||
struct DemolitionPack__ModelResource :
|
||||
public Rivet::ModelResource
|
||||
{
|
||||
Scalar
|
||||
blastRadiusSquared;
|
||||
Scalar
|
||||
detectionRadiusSquared;
|
||||
Scalar
|
||||
fuseTime;
|
||||
Scalar
|
||||
concussiveForce;
|
||||
};
|
||||
|
||||
//##########################################################################
|
||||
//#################### DemolitionPack #############################
|
||||
//##########################################################################
|
||||
|
||||
class DemolitionPack :
|
||||
public Rivet
|
||||
{
|
||||
public:
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Shared Data support
|
||||
//
|
||||
public:
|
||||
static Derivation *GetClassDerivations();
|
||||
static SharedData DefaultData;
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Attribute Support
|
||||
//
|
||||
#if 0
|
||||
public:
|
||||
enum {
|
||||
NextAttributeID
|
||||
};
|
||||
|
||||
private:
|
||||
static const IndexEntry AttributePointers[];
|
||||
|
||||
protected:
|
||||
//static AttributeIndexSet AttributeIndex
|
||||
static AttributeIndexSet& GetAttributeIndex();
|
||||
#endif
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Model support
|
||||
//
|
||||
public:
|
||||
enum {
|
||||
DefaultFlags = Mover::DefaultFlags|NoCollisionTestFlag
|
||||
};
|
||||
|
||||
typedef void (DemolitionPack::*Performance)(Scalar time_slice);
|
||||
|
||||
void
|
||||
SetPerformance(Performance performance)
|
||||
{
|
||||
Check(this);
|
||||
activePerformance = (Simulation::Performance)performance;
|
||||
}
|
||||
|
||||
void
|
||||
MoveAndHunt(Scalar time_slice);
|
||||
void
|
||||
Hunt(Scalar time_slice);
|
||||
void
|
||||
ProcessCollision(
|
||||
Scalar time_slice,
|
||||
BoxedSolidCollision &collision,
|
||||
const Point3D &old_position,
|
||||
Damage *damage
|
||||
);
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Construction and Destruction
|
||||
//
|
||||
public:
|
||||
typedef DemolitionPack__ModelResource ModelResource;
|
||||
|
||||
static DemolitionPack*
|
||||
Make(MakeMessage *creation_message);
|
||||
|
||||
DemolitionPack(
|
||||
MakeMessage *creation_message,
|
||||
SharedData &virtual_data = DefaultData
|
||||
);
|
||||
~DemolitionPack();
|
||||
|
||||
Logical
|
||||
TestInstance() const;
|
||||
|
||||
static int
|
||||
CreateModelResource(
|
||||
ResourceFile *resource_file,
|
||||
const char *model_name,
|
||||
NotationFile *model_file,
|
||||
const ResourceDirectories *directories,
|
||||
ModelResource* model = NULL
|
||||
);
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Local Data
|
||||
//
|
||||
public:
|
||||
Scalar
|
||||
blastRadiusSquared;
|
||||
|
||||
Scalar
|
||||
detectionRadiusSquared;
|
||||
|
||||
Scalar
|
||||
fuseTime;
|
||||
|
||||
Scalar
|
||||
concussiveForce;
|
||||
};
|
||||
@@ -0,0 +1,178 @@
|
||||
#pragma once
|
||||
|
||||
#include "..\munga\mover.h"
|
||||
|
||||
#define RIVET_MAXIMUM_LIFETIME 5.0f
|
||||
|
||||
//###################### Rivet ModelResource ####################
|
||||
|
||||
struct Rivet__ModelResource :
|
||||
public Mover::ModelResource
|
||||
{
|
||||
Damage
|
||||
damageData;
|
||||
ResourceDescription::ResourceID
|
||||
explosionResourceID;
|
||||
};
|
||||
|
||||
//##########################################################################
|
||||
//##################### Mover::MakeMessage ##########################
|
||||
//##########################################################################
|
||||
|
||||
class Rivet__MakeMessage:
|
||||
public Mover::MakeMessage
|
||||
{
|
||||
public:
|
||||
EntityID
|
||||
shootingEntity;
|
||||
|
||||
Rivet__MakeMessage(
|
||||
Receiver::MessageID message_ID,
|
||||
size_t length,
|
||||
Entity::ClassID class_ID,
|
||||
const EntityID &owner_ID,
|
||||
ResourceDescription::ResourceID resource_ID,
|
||||
LWord instance_flags,
|
||||
const Origin &origin,
|
||||
const Motion &velocity,
|
||||
const Motion &acceleration,
|
||||
const EntityID &shooter
|
||||
):
|
||||
Mover::MakeMessage(
|
||||
message_ID,
|
||||
length,
|
||||
class_ID,
|
||||
owner_ID,
|
||||
resource_ID,
|
||||
instance_flags,
|
||||
origin,
|
||||
velocity,
|
||||
acceleration
|
||||
),
|
||||
shootingEntity(shooter)
|
||||
{}
|
||||
Rivet__MakeMessage(
|
||||
Receiver::MessageID message_ID,
|
||||
size_t length,
|
||||
const EntityID &entity_ID,
|
||||
Entity::ClassID class_ID,
|
||||
const EntityID &owner_ID,
|
||||
ResourceDescription::ResourceID resource_ID,
|
||||
LWord instance_flags,
|
||||
const Origin &origin,
|
||||
const Motion &velocity,
|
||||
const Motion &acceleration,
|
||||
const EntityID &shooter
|
||||
):
|
||||
Mover::MakeMessage(
|
||||
message_ID,
|
||||
length,
|
||||
entity_ID,
|
||||
class_ID,
|
||||
owner_ID,
|
||||
resource_ID,
|
||||
instance_flags,
|
||||
origin,
|
||||
velocity,
|
||||
acceleration
|
||||
),
|
||||
shootingEntity(shooter)
|
||||
{}
|
||||
};
|
||||
|
||||
//##########################################################################
|
||||
//############################# Rivet ################################
|
||||
//##########################################################################
|
||||
|
||||
class Rivet :
|
||||
public Mover
|
||||
{
|
||||
public:
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Shared Data support
|
||||
//
|
||||
public:
|
||||
static Derivation *GetClassDerivations();
|
||||
static SharedData DefaultData;
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Attribute Support
|
||||
//
|
||||
public:
|
||||
enum {
|
||||
DamageDataAttributeID = Mover::NextAttributeID,
|
||||
NextAttributeID
|
||||
};
|
||||
|
||||
private:
|
||||
static const IndexEntry AttributePointers[];
|
||||
|
||||
protected:
|
||||
//static AttributeIndexSet AttributeIndex
|
||||
static AttributeIndexSet& GetAttributeIndex();
|
||||
|
||||
//
|
||||
// public attribute declarations go here
|
||||
//
|
||||
public:
|
||||
Damage
|
||||
damageData;
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Model support
|
||||
//
|
||||
public:
|
||||
enum {
|
||||
DefaultFlags =
|
||||
Mover::DefaultFlags|NoCollisionVolumeFlag|NoCollisionTestFlag
|
||||
};
|
||||
|
||||
typedef void (Rivet::*Performance)(Scalar time_slice);
|
||||
|
||||
void
|
||||
SetPerformance(Performance performance)
|
||||
{
|
||||
Check(this);
|
||||
activePerformance = (Simulation::Performance)performance;
|
||||
}
|
||||
|
||||
void
|
||||
MoveToTarget(Scalar time_slice);
|
||||
|
||||
public:
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Construction and Destruction
|
||||
//
|
||||
public:
|
||||
typedef Rivet__ModelResource ModelResource;
|
||||
typedef Rivet__MakeMessage MakeMessage;
|
||||
|
||||
static Rivet*
|
||||
Make(MakeMessage *creation_message);
|
||||
|
||||
Rivet(
|
||||
MakeMessage *creation_message,
|
||||
SharedData &virtual_data = DefaultData
|
||||
);
|
||||
~Rivet();
|
||||
|
||||
Logical
|
||||
TestInstance() const;
|
||||
|
||||
static ResourceDescription::ResourceID
|
||||
CreateModelResource(
|
||||
ResourceFile *resource_file,
|
||||
const char *model_name,
|
||||
NotationFile *notation_file,
|
||||
const ResourceDirectories *directories,
|
||||
ModelResource *model = NULL
|
||||
);
|
||||
|
||||
protected:
|
||||
ResourceDescription::ResourceID
|
||||
explosionResourceID;
|
||||
Entity
|
||||
*shootingEntity;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include "..\munga\munga.h"
|
||||
|
||||
#if !defined(NO_PRECOMPILED_HEADERS)
|
||||
#include "vtvsub.h"
|
||||
#include "vtv.h"
|
||||
#include "vtvmppr.h"
|
||||
#endif
|
||||
@@ -0,0 +1,280 @@
|
||||
#pragma once
|
||||
|
||||
#if defined(MAC)
|
||||
#include "NetworkEndpoint.h"
|
||||
#include "Participant.h"
|
||||
#else
|
||||
#include "..\munga\console.h"
|
||||
#endif
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~ Console Message IDs ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
enum
|
||||
{
|
||||
ConsolePlayerVTVScoredMessageID = 2,
|
||||
ConsolePlayerVTVKilledMessageID = 3,
|
||||
ConsolePlayerVTVBoosterMessageID = 4,
|
||||
ConsolePlayerVTVScoreUpdateMessageID = 5,
|
||||
ConsolePlayerVTVDamagedMessageID = 6
|
||||
};
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~ ConsolePlayerVTVScoredMessage ~~~~~~~~~~~~~~~~~~~
|
||||
#ifdef MAC
|
||||
#pragma options align=mac68k4byte
|
||||
class ConsolePlayerVTVScoredMessage:
|
||||
public NetworkEndpoint::Message
|
||||
{
|
||||
public:
|
||||
ConsolePlayerVTVScoredMessage(HostID player_host_ID);
|
||||
|
||||
long
|
||||
GetPlayerHostID()
|
||||
{return playerHostID.value();}
|
||||
|
||||
private:
|
||||
HostID
|
||||
playerHostID;
|
||||
};
|
||||
#pragma options align=reset
|
||||
#else
|
||||
class ConsolePlayerVTVScoredMessage:
|
||||
public NetworkClient::Message
|
||||
{
|
||||
public:
|
||||
ConsolePlayerVTVScoredMessage(HostID player_host_ID);
|
||||
|
||||
HostID
|
||||
GetPlayerHostID()
|
||||
{return playerHostID;}
|
||||
|
||||
private:
|
||||
HostID
|
||||
playerHostID;
|
||||
};
|
||||
#endif
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~ ConsolePlayerVTVKilledMessage ~~~~~~~~~~~~~~~~~~~
|
||||
#ifdef MAC
|
||||
#pragma options align=mac68k4byte
|
||||
class ConsolePlayerVTVKilledMessage:
|
||||
public NetworkEndpoint::Message
|
||||
{
|
||||
public:
|
||||
ConsolePlayerVTVKilledMessage(
|
||||
HostID player_host_ID,
|
||||
HostID killer_host_ID
|
||||
);
|
||||
|
||||
long
|
||||
GetPlayerHostID()
|
||||
{return playerHostID.value();}
|
||||
long
|
||||
GetKillerHostID()
|
||||
{return killerHostID.value();}
|
||||
|
||||
private:
|
||||
HostID
|
||||
playerHostID;
|
||||
HostID
|
||||
killerHostID;
|
||||
};
|
||||
#pragma options align=reset
|
||||
#else
|
||||
class ConsolePlayerVTVKilledMessage:
|
||||
public NetworkClient::Message
|
||||
{
|
||||
public:
|
||||
ConsolePlayerVTVKilledMessage(
|
||||
HostID player_host_ID,
|
||||
HostID killer_host_ID
|
||||
);
|
||||
|
||||
HostID
|
||||
GetPlayerHostID()
|
||||
{return playerHostID;}
|
||||
HostID
|
||||
GetKillerHostID()
|
||||
{return killerHostID;}
|
||||
|
||||
private:
|
||||
HostID
|
||||
playerHostID,
|
||||
killerHostID;
|
||||
};
|
||||
#endif
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~ ConsolePlayerVTVBoosterMessage ~~~~~~~~~~~~~~~~~~~
|
||||
#ifdef MAC
|
||||
#pragma options align=mac68k4byte
|
||||
class ConsolePlayerVTVBoosterMessage:
|
||||
public NetworkEndpoint::Message
|
||||
{
|
||||
public:
|
||||
ConsolePlayerVTVBoosterMessage(
|
||||
HostID player_host_ID,
|
||||
LEDWORD booster_on
|
||||
);
|
||||
|
||||
long
|
||||
GetPlayerHostID()
|
||||
{return playerHostID.value();}
|
||||
long
|
||||
GetBoosterOn()
|
||||
{return boosterOn.value();}
|
||||
|
||||
private:
|
||||
HostID
|
||||
playerHostID;
|
||||
LEDWORD
|
||||
boosterOn;
|
||||
};
|
||||
#pragma options align=reset
|
||||
#else
|
||||
class ConsolePlayerVTVBoosterMessage:
|
||||
public NetworkClient::Message
|
||||
{
|
||||
public:
|
||||
ConsolePlayerVTVBoosterMessage(
|
||||
HostID player_host_ID,
|
||||
int booster_on
|
||||
);
|
||||
|
||||
HostID
|
||||
GetPlayerHostID()
|
||||
{return playerHostID;}
|
||||
int
|
||||
GetBoosterOn()
|
||||
{return boosterOn;}
|
||||
|
||||
private:
|
||||
HostID
|
||||
playerHostID;
|
||||
int
|
||||
boosterOn;
|
||||
};
|
||||
#endif
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~ ConsolePlayerVTVScoreUpdateMessage ~~~~~~~~~~~~~~~~~~~
|
||||
#ifdef MAC
|
||||
#pragma options align=mac68k4byte
|
||||
class ConsolePlayerVTVScoreUpdateMessage:
|
||||
public NetworkEndpoint::Message
|
||||
{
|
||||
public:
|
||||
ConsolePlayerVTVScoreUpdateMessage(
|
||||
HostID player_host_ID,
|
||||
LEDWORD score
|
||||
);
|
||||
|
||||
long
|
||||
GetPlayerHostID()
|
||||
{return playerHostID.value();}
|
||||
long
|
||||
GetPlayerScore()
|
||||
{return playerScore.value();}
|
||||
|
||||
private:
|
||||
HostID
|
||||
playerHostID;
|
||||
LEDWORD
|
||||
playerScore;
|
||||
};
|
||||
#pragma options align=reset
|
||||
#else
|
||||
class ConsolePlayerVTVScoreUpdateMessage:
|
||||
public NetworkClient::Message
|
||||
{
|
||||
public:
|
||||
ConsolePlayerVTVScoreUpdateMessage(
|
||||
HostID player_host_ID,
|
||||
int score
|
||||
);
|
||||
|
||||
HostID
|
||||
GetPlayerHostID()
|
||||
{return playerHostID;}
|
||||
int
|
||||
GetPlayerScore()
|
||||
{return playerScore;}
|
||||
|
||||
private:
|
||||
HostID
|
||||
playerHostID;
|
||||
int
|
||||
playerScore;
|
||||
};
|
||||
#endif
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~ ConsolePlayerVTVDamagedMessage ~~~~~~~~~~~~~~~~~~~
|
||||
#ifdef MAC
|
||||
#pragma options align=mac68k4byte
|
||||
class ConsolePlayerVTVDamagedMessage:
|
||||
public NetworkEndpoint::Message
|
||||
{
|
||||
public:
|
||||
ConsolePlayerVTVDamagedMessage(
|
||||
HostID player_host_ID,
|
||||
HostID damager_host_ID,
|
||||
LEDWORD loss,
|
||||
LEDWORD points_transfered
|
||||
);
|
||||
|
||||
long
|
||||
GetPlayerHostID()
|
||||
{return playerHostID.value();}
|
||||
long
|
||||
GetDamagerHostID()
|
||||
{return damagerHostID.value();}
|
||||
long
|
||||
GetDamageLoss()
|
||||
{return damageLoss.value();}
|
||||
long
|
||||
GetPointsTransfered()
|
||||
{return pointsTransfered.value();}
|
||||
|
||||
private:
|
||||
HostID
|
||||
playerHostID;
|
||||
HostID
|
||||
damagerHostID;
|
||||
LEDWORD
|
||||
damageLoss;
|
||||
LEDWORD
|
||||
pointsTransfered;
|
||||
};
|
||||
#pragma options align=reset
|
||||
#else
|
||||
class ConsolePlayerVTVDamagedMessage:
|
||||
public NetworkClient::Message
|
||||
{
|
||||
public:
|
||||
ConsolePlayerVTVDamagedMessage(
|
||||
HostID player_host_ID,
|
||||
HostID damager_host_ID,
|
||||
int loss,
|
||||
int points_transfered
|
||||
);
|
||||
|
||||
HostID
|
||||
GetPlayerHostID()
|
||||
{return playerHostID;}
|
||||
HostID
|
||||
GetDamagerHostID()
|
||||
{return damagerHostID;}
|
||||
int
|
||||
GetDamageLoss()
|
||||
{return damageLoss;}
|
||||
int
|
||||
GetPointsTransfered()
|
||||
{return pointsTransfered;}
|
||||
|
||||
private:
|
||||
HostID
|
||||
playerHostID;
|
||||
HostID
|
||||
damagerHostID;
|
||||
int
|
||||
damageLoss;
|
||||
int
|
||||
pointsTransfered;
|
||||
};
|
||||
#endif
|
||||
@@ -0,0 +1,60 @@
|
||||
#pragma once
|
||||
|
||||
#include "..\munga\director.h"
|
||||
|
||||
class RPPlayer;
|
||||
|
||||
class RPCameraDirector :
|
||||
public CameraDirector
|
||||
{
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Shared Data support
|
||||
//
|
||||
public:
|
||||
|
||||
static Derivation *GetClassDerivations();
|
||||
static SharedData DefaultData;
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Simulation Support
|
||||
//
|
||||
public:
|
||||
typedef void
|
||||
(RPCameraDirector::*Performance)(Scalar time_slice);
|
||||
|
||||
void
|
||||
SetPerformance(Performance performance)
|
||||
{
|
||||
Check(this);
|
||||
activePerformance = (Simulation::Performance)performance;
|
||||
}
|
||||
|
||||
void
|
||||
CreateRPCameraShip(Scalar);
|
||||
|
||||
void
|
||||
BeARPDirector(Scalar);
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Construction and Destruction Support
|
||||
//
|
||||
RPCameraDirector(
|
||||
MakeMessage *creation_message,
|
||||
SharedData &virtual_data = DefaultData
|
||||
);
|
||||
|
||||
static RPCameraDirector*
|
||||
RPCameraDirector::Make(CameraDirector::MakeMessage *creation_message);
|
||||
|
||||
~RPCameraDirector();
|
||||
|
||||
Logical
|
||||
TestInstance() const;
|
||||
|
||||
protected:
|
||||
RPPlayer
|
||||
*currentWatchedPlayer;
|
||||
|
||||
Logical
|
||||
martianFootball;
|
||||
};
|
||||
@@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
|
||||
#include "..\munga\mission.h"
|
||||
|
||||
//##########################################################################
|
||||
//########################### Mission ################################
|
||||
//##########################################################################
|
||||
|
||||
|
||||
class RPMission : public Mission
|
||||
{
|
||||
public:
|
||||
RPMission(NotationFile *notation_file, ResourceFile *resources);
|
||||
~RPMission();
|
||||
|
||||
void SetPlayerData(NotationFile *notation_file);
|
||||
|
||||
Logical ScoreCompressionOn()
|
||||
{
|
||||
Check(this);
|
||||
return scoreCompression;
|
||||
}
|
||||
|
||||
protected:
|
||||
Logical scoreCompression;
|
||||
};
|
||||
@@ -0,0 +1,417 @@
|
||||
#pragma once
|
||||
|
||||
#include "..\munga\player.h"
|
||||
#include "..\munga\damage.h"
|
||||
#include "..\munga\vchain.h"
|
||||
|
||||
#define POINTS_SPEED_RATIO 400
|
||||
|
||||
class ScoreZone__ReplyMessage;
|
||||
class DropZone__ReplyMessage;
|
||||
class RPPlayer;
|
||||
|
||||
//##########################################################################
|
||||
// struct Offensive Player
|
||||
//
|
||||
|
||||
class RPPlayer__OffensivePlayer:
|
||||
public Node
|
||||
{
|
||||
public:
|
||||
RPPlayer__OffensivePlayer()
|
||||
{}
|
||||
RPPlayer__OffensivePlayer(
|
||||
RPPlayer *offensive_player,
|
||||
int damage_type,
|
||||
Time time_stamp
|
||||
);
|
||||
|
||||
//
|
||||
//-----------------------------------
|
||||
// The player who caused the damage
|
||||
//-----------------------------------
|
||||
//
|
||||
RPPlayer
|
||||
*offensivePlayer;
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
// How many points the offensive player gets if this players dies
|
||||
//---------------------------------------------------------------
|
||||
//
|
||||
Scalar
|
||||
deathBonus;
|
||||
//
|
||||
//------------------------------------------------
|
||||
// The type of damage the offensive player caused
|
||||
//------------------------------------------------
|
||||
//
|
||||
int
|
||||
damageType;
|
||||
//
|
||||
//-------------------------------
|
||||
// Time the damage was inflicted
|
||||
//-------------------------------
|
||||
//
|
||||
Time
|
||||
timeStamp;
|
||||
};
|
||||
|
||||
//##########################################################################
|
||||
//#################### RPPlayer::StatusMessage #########################
|
||||
//##########################################################################
|
||||
|
||||
class RPPlayer__StatusMessage:
|
||||
public Player__StatusMessage
|
||||
{
|
||||
public:
|
||||
RPPlayer__StatusMessage();
|
||||
|
||||
RPPlayer__StatusMessage(
|
||||
RPPlayer *player_involved,
|
||||
int message_type,
|
||||
Scalar display_time,
|
||||
Scalar damage_amount = 0.0f
|
||||
);
|
||||
|
||||
enum {
|
||||
DestroyedMessage = Player__StatusMessage::NextMessageType,
|
||||
DestroyedByMessage,
|
||||
RunnerMessage,
|
||||
BlockerMessage,
|
||||
CrusherMessage,
|
||||
ScoreZoneMessage,
|
||||
PilotErrorMessage,
|
||||
Score2xMessage,
|
||||
Score4xMessage,
|
||||
Score8xMessage,
|
||||
Score16xMessage,
|
||||
CrushedMessage = Player__StatusMessage::NextMessageType,
|
||||
CrushedByMessage,
|
||||
BlockedMessage = Player__StatusMessage::NextMessageType,
|
||||
BlockedByMessage,
|
||||
DingedMessage = Player__StatusMessage::NextMessageType,
|
||||
DingedByMessage,
|
||||
NextMessageType
|
||||
};
|
||||
|
||||
Scalar
|
||||
damageAmount;
|
||||
|
||||
//------------------------------------------------------
|
||||
// Memory block utilization
|
||||
//------------------------------------------------------
|
||||
private:
|
||||
static MemoryBlock* GetAllocatedMemory();
|
||||
enum
|
||||
{
|
||||
numberOfAllocatedBlocks=8 // seven kills and a suicide!!!
|
||||
};
|
||||
|
||||
public:
|
||||
void*
|
||||
operator new(size_t)
|
||||
{return GetAllocatedMemory()->New();}
|
||||
void
|
||||
operator delete(void *where)
|
||||
{ GetAllocatedMemory()->Delete(where);}
|
||||
};
|
||||
|
||||
//##########################################################################
|
||||
//##################### RPPlayer::MakeMessage ########################
|
||||
//##########################################################################
|
||||
|
||||
class RPPlayer__MakeMessage:
|
||||
public Player::MakeMessage
|
||||
{
|
||||
public:
|
||||
int
|
||||
teamID;
|
||||
|
||||
Enumeration
|
||||
playerType;
|
||||
|
||||
Logical
|
||||
scoreCompression;
|
||||
|
||||
RPPlayer__MakeMessage(
|
||||
Receiver::MessageID message_ID,
|
||||
size_t length,
|
||||
Entity::ClassID class_ID,
|
||||
const EntityID &owner_ID,
|
||||
ResourceDescription::ResourceID resource_ID,
|
||||
LWord instance_flags,
|
||||
const Origin &origin,
|
||||
int player_bitmap_index,
|
||||
int player_type,
|
||||
int team_ID,
|
||||
Logical score_compression
|
||||
):
|
||||
Player::MakeMessage(
|
||||
message_ID,
|
||||
length,
|
||||
class_ID,
|
||||
owner_ID,
|
||||
resource_ID,
|
||||
instance_flags,
|
||||
origin,
|
||||
player_bitmap_index
|
||||
),
|
||||
teamID(team_ID)
|
||||
{ playerType = player_type; scoreCompression = score_compression;}
|
||||
|
||||
RPPlayer__MakeMessage(
|
||||
Receiver::MessageID message_ID,
|
||||
size_t length,
|
||||
const EntityID &entity_ID,
|
||||
Entity::ClassID class_ID,
|
||||
const EntityID &owner_ID,
|
||||
ResourceDescription::ResourceID resource_ID,
|
||||
LWord instance_flags,
|
||||
const Origin &origin,
|
||||
int player_bitmap_index,
|
||||
int player_type,
|
||||
int team_ID,
|
||||
Logical score_compression
|
||||
):
|
||||
Player::MakeMessage(
|
||||
message_ID,
|
||||
length,
|
||||
entity_ID,
|
||||
class_ID,
|
||||
owner_ID,
|
||||
resource_ID,
|
||||
instance_flags,
|
||||
origin,
|
||||
player_bitmap_index
|
||||
),
|
||||
teamID(team_ID)
|
||||
{ playerType = player_type; scoreCompression = score_compression;}
|
||||
};
|
||||
|
||||
class RPPlayer__ScoreMessage:
|
||||
public Player::ScoreMessage
|
||||
{
|
||||
public:
|
||||
int
|
||||
scoreType;
|
||||
|
||||
EntityID
|
||||
pointSender;
|
||||
|
||||
RPPlayer__ScoreMessage(
|
||||
Receiver::MessageID message_ID,
|
||||
size_t length,
|
||||
int score_type,
|
||||
Scalar score_award,
|
||||
EntityID point_sender
|
||||
):
|
||||
Player::ScoreMessage(message_ID, length, score_award)
|
||||
{
|
||||
scoreType = score_type;
|
||||
pointSender = point_sender;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//##########################################################################
|
||||
//########################### Player ################################
|
||||
//##########################################################################
|
||||
|
||||
class RPPlayer:
|
||||
public Player
|
||||
{
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Shared Data support
|
||||
//
|
||||
public:
|
||||
static Derivation *GetClassDerivations();
|
||||
static SharedData DefaultData;
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Message Support
|
||||
//
|
||||
enum {
|
||||
ScoreZoneReplyMessageID = Player::NextMessageID,
|
||||
NextMessageID
|
||||
};
|
||||
private:
|
||||
static const HandlerEntry MessageHandlerEntries[];
|
||||
|
||||
protected:
|
||||
//static MessageHandlerSet MessageHandlers;
|
||||
static MessageHandlerSet& GetMessageHandlers();
|
||||
void MissionEndingMessageHandler(Message *message);
|
||||
void MissionStartingMessageHandler(Message *message);
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Vehicle creation
|
||||
//
|
||||
public:
|
||||
typedef RPPlayer__ScoreMessage ScoreMessage;
|
||||
typedef RPPlayer__OffensivePlayer OffensivePlayer;
|
||||
typedef RPPlayer__MakeMessage MakeMessage;
|
||||
typedef RPPlayer__StatusMessage RPStatusMessage;
|
||||
|
||||
protected:
|
||||
virtual void
|
||||
DropZoneReplyMessageHandler(
|
||||
DropZone__ReplyMessage *message
|
||||
);
|
||||
|
||||
virtual void
|
||||
ScoreZoneReplyMessageHandler(
|
||||
ScoreZone__ReplyMessage *message
|
||||
);
|
||||
|
||||
void
|
||||
VehicleDeadMessageHandler (VehicleDeadMessage *message);
|
||||
|
||||
virtual void
|
||||
TakeDamageMessageHandler (TakeDamageMessage *message);
|
||||
|
||||
virtual void
|
||||
ScoreMessageHandler(ScoreMessage *message);
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Damage Points Support
|
||||
//
|
||||
|
||||
VChainOf<OffensivePlayer*, Enumeration>
|
||||
offensivePlayerList;
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Attribute Support
|
||||
//
|
||||
public:
|
||||
enum{
|
||||
GoalEntityAttributeID = Player::NextAttributeID,
|
||||
NextAttributeID
|
||||
};
|
||||
|
||||
Entity
|
||||
*goalEntity;
|
||||
|
||||
private:
|
||||
|
||||
static const IndexEntry AttributePointers[];
|
||||
|
||||
protected:
|
||||
|
||||
//static AttributeIndexSet AttributeIndex
|
||||
static AttributeIndexSet& GetAttributeIndex();
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Model Support
|
||||
//
|
||||
public:
|
||||
typedef void
|
||||
(RPPlayer::*Performance)(Scalar time_slice);
|
||||
|
||||
void
|
||||
SetPerformance(Performance performance)
|
||||
{
|
||||
Check(this);
|
||||
activePerformance = (Simulation::Performance)performance;
|
||||
}
|
||||
|
||||
void
|
||||
PlayerSimulation(Scalar time_slice);
|
||||
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Construction and Destruction
|
||||
//
|
||||
public:
|
||||
static RPPlayer*
|
||||
Make(MakeMessage *creation_message);
|
||||
|
||||
RPPlayer(
|
||||
MakeMessage *creation_message,
|
||||
SharedData &shared_data = DefaultData
|
||||
);
|
||||
~RPPlayer();
|
||||
|
||||
Logical
|
||||
TestInstance() const;
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Local data
|
||||
//
|
||||
public:
|
||||
enum PlayerType{
|
||||
GeneralPlayerType,
|
||||
RunnerPlayerType,
|
||||
CrusherPlayerType,
|
||||
BlockerPlayerType,
|
||||
CameraShipPlayerType
|
||||
} playerType;
|
||||
|
||||
enum {
|
||||
NullPointType = 0,
|
||||
ScoreZonePointType,
|
||||
DeathBonusPointType,
|
||||
DeathScoreLossPointType,
|
||||
DamageBonusPointType,
|
||||
DamageScoreLossPointType,
|
||||
SpeedBonusPointType,
|
||||
CrusherScorePointType,
|
||||
DropZoneHitType,
|
||||
DropZoneKillType,
|
||||
OutOfBoundsType,
|
||||
PointTypeCount
|
||||
};
|
||||
|
||||
virtual void
|
||||
AddOffensivePlayer(OffensivePlayer &offensive_player);
|
||||
|
||||
int
|
||||
teamID;
|
||||
|
||||
int
|
||||
CalcRanking();
|
||||
|
||||
void
|
||||
CalcFootballRanking();
|
||||
|
||||
virtual Vector3D
|
||||
GetWorldLinearVelocity()
|
||||
{return Vector3D(0,0,0);}
|
||||
|
||||
protected:
|
||||
//
|
||||
// protected Interface
|
||||
//
|
||||
|
||||
void
|
||||
DeleteAllOffensivePlayers();
|
||||
|
||||
RPPlayer*
|
||||
GetPlayer(EntityID playerID);
|
||||
|
||||
void
|
||||
CleanUpOffensivePlayers();
|
||||
|
||||
void
|
||||
CreatePlayerVehicle(Origin);
|
||||
|
||||
void
|
||||
ResetAfterDeath(DropZone__ReplyMessage *message);
|
||||
|
||||
void
|
||||
InitializePlayerLink();
|
||||
|
||||
void
|
||||
SetGoalToFirstScoreZone();
|
||||
|
||||
virtual void
|
||||
PointVTVTowardGoal();
|
||||
|
||||
void
|
||||
AccumulateSpeedPoints(Scalar time_slice);
|
||||
|
||||
Logical
|
||||
scoreCompression;
|
||||
|
||||
Time
|
||||
lastConsoleUpdate;
|
||||
};
|
||||
@@ -0,0 +1,51 @@
|
||||
#pragma once
|
||||
|
||||
#include "..\munga\registry.h"
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Registry ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
//
|
||||
//--------------------------------------------------------------------
|
||||
// Registry
|
||||
//
|
||||
// Provides construction methods for entities.
|
||||
// Provides access to a classes static data.
|
||||
//--------------------------------------------------------------------
|
||||
//
|
||||
|
||||
class RPRegistry : public Registry
|
||||
{
|
||||
public:
|
||||
//
|
||||
//--------------------------------------------------------------------
|
||||
//--------------------------------------------------------------------
|
||||
// Public interface
|
||||
//--------------------------------------------------------------------
|
||||
//--------------------------------------------------------------------
|
||||
//
|
||||
|
||||
//
|
||||
//--------------------------------------------------------------------
|
||||
// Construction, Destruction, and testing
|
||||
//--------------------------------------------------------------------
|
||||
//
|
||||
RPRegistry(ResourceFile *resources);
|
||||
~RPRegistry();
|
||||
|
||||
//
|
||||
//--------------------------------------------------------------
|
||||
// GetStaticData
|
||||
//
|
||||
// Provides an interface by which the static data for a class
|
||||
// may be accessed.
|
||||
//--------------------------------------------------------------
|
||||
//
|
||||
Entity__SharedData* GetStaticData(ClassID entity_class);
|
||||
|
||||
//
|
||||
//-------------------------
|
||||
// Create the player object
|
||||
//-------------------------
|
||||
//
|
||||
Player* MakePlayer(Mission *mission);
|
||||
};
|
||||
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
|
||||
#include "..\munga\tool.h"
|
||||
|
||||
//##########################################################################
|
||||
//############################ RPTool ################################
|
||||
//##########################################################################
|
||||
|
||||
class RPTool : public ApplicationTool
|
||||
{
|
||||
protected:
|
||||
Logical CreateMakeMessage(const char* class_name, Entity::MakeMessage *creation_message, NotationFile *model_file, const ResourceDirectories *directories);
|
||||
|
||||
void CreateModelResource(ModelData &model_resources, const char *model_class, ResourceFile *resource_file, const char *model_name, NotationFile *model_file, const ResourceDirectories *directories);
|
||||
|
||||
ResourceDescription::ResourceID CreateControlMappingStream(const char *model_class, const char *mapping_name, NotationFile *mapping_file, ResourceFile *resource_file, const char *model_name, NotationFile *model_file, const ResourceDirectories *directories, PlatformTool *current_tool);
|
||||
|
||||
public:
|
||||
RPTool(PlatformTool *platform) : ApplicationTool(platform) {}
|
||||
};
|
||||
@@ -0,0 +1,61 @@
|
||||
#pragma once
|
||||
|
||||
#include "rpplayer.h"
|
||||
|
||||
//##########################################################################
|
||||
//########################### Runner ################################
|
||||
//##########################################################################
|
||||
class Runner : public RPPlayer
|
||||
{
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Shared Data support
|
||||
//
|
||||
public:
|
||||
static Derivation *GetClassDerivations();
|
||||
static SharedData DefaultData;
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Message Support
|
||||
//
|
||||
private:
|
||||
static const HandlerEntry MessageHandlerEntries[];
|
||||
|
||||
protected:
|
||||
static MessageHandlerSet MessageHandlers;
|
||||
|
||||
public:
|
||||
void ScoreZoneReplyMessageHandler(ScoreZone__ReplyMessage *message);
|
||||
void ScoreMessageHandler(ScoreMessage *message);
|
||||
void VehicleDeadMessageHandler(VehicleDeadMessage *message);
|
||||
void DropZoneReplyMessageHandler(DropZone__ReplyMessage *message);
|
||||
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Model Support
|
||||
//
|
||||
public:
|
||||
|
||||
typedef void (Runner::*Performance)(Scalar time_slice);
|
||||
|
||||
void SetPerformance(Performance performance)
|
||||
{
|
||||
Check(this);
|
||||
activePerformance = (Simulation::Performance)performance;
|
||||
}
|
||||
|
||||
Time dropZonePenaltyOver;
|
||||
Scalar scoreMultiplier;
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Construction and Destruction
|
||||
//
|
||||
public:
|
||||
Runner(MakeMessage *creation_message, SharedData &shared_data = DefaultData);
|
||||
~Runner() {}
|
||||
|
||||
Logical TestInstance() const;
|
||||
|
||||
static Runner* Make(MakeMessage *creation_message);
|
||||
|
||||
void AddOffensivePlayer(OffensivePlayer &offensive_player);
|
||||
|
||||
};
|
||||
@@ -0,0 +1,271 @@
|
||||
#pragma once
|
||||
|
||||
#include "..\munga\entity.h"
|
||||
#include "..\munga\boxsolid.h"
|
||||
|
||||
enum ScoreZone__ScoreZoneType {
|
||||
GlobalOneTime,
|
||||
LocalOneTime,
|
||||
GlobalSequential,
|
||||
LocalSequential
|
||||
} ;
|
||||
|
||||
//##########################################################################
|
||||
//##################### ScoreZone::ModelResource #####################
|
||||
//##########################################################################
|
||||
|
||||
struct ScoreZone__ModelResource
|
||||
{
|
||||
ExtentBox
|
||||
extentBox;
|
||||
|
||||
ScoreZone__ScoreZoneType
|
||||
scoreZoneType;
|
||||
|
||||
Scalar
|
||||
pointValue;
|
||||
|
||||
};
|
||||
|
||||
//##########################################################################
|
||||
//#################### ScoreZone::MakeMessage ########################
|
||||
//##########################################################################
|
||||
|
||||
class ScoreZone__MakeMessage:
|
||||
public Entity::MakeMessage
|
||||
{
|
||||
public:
|
||||
int
|
||||
sequenceNumber;
|
||||
|
||||
ScoreZone__MakeMessage(
|
||||
Receiver::MessageID message_ID,
|
||||
size_t length,
|
||||
Entity::ClassID class_ID,
|
||||
const EntityID &owner_ID,
|
||||
ResourceDescription::ResourceID resource_ID,
|
||||
LWord instance_flags,
|
||||
const Origin &origin,
|
||||
int sequence
|
||||
):
|
||||
Entity::MakeMessage(
|
||||
message_ID,
|
||||
length,
|
||||
class_ID,
|
||||
owner_ID,
|
||||
resource_ID,
|
||||
instance_flags,
|
||||
origin
|
||||
),
|
||||
sequenceNumber(sequence)
|
||||
{}
|
||||
ScoreZone__MakeMessage(
|
||||
Receiver::MessageID message_ID,
|
||||
size_t length,
|
||||
const EntityID &entity_ID,
|
||||
Entity::ClassID class_ID,
|
||||
const EntityID &owner_ID,
|
||||
ResourceDescription::ResourceID resource_ID,
|
||||
LWord instance_flags,
|
||||
const Origin &origin,
|
||||
int sequence
|
||||
):
|
||||
Entity::MakeMessage(
|
||||
message_ID,
|
||||
length,
|
||||
entity_ID,
|
||||
class_ID,
|
||||
owner_ID,
|
||||
resource_ID,
|
||||
instance_flags,
|
||||
origin
|
||||
),
|
||||
sequenceNumber(sequence)
|
||||
{}
|
||||
};
|
||||
|
||||
//##########################################################################
|
||||
//############ ScoreZone::ProcessScoreRequestMessage #################
|
||||
//##########################################################################
|
||||
|
||||
class ScoreZone__ProcessScoreZoneRequestMessage :
|
||||
public Entity::Message
|
||||
{
|
||||
public:
|
||||
EntityID
|
||||
requestingEntity;
|
||||
|
||||
Receiver::MessageID
|
||||
replyMessageID;
|
||||
|
||||
Vector3D
|
||||
linearPosition;
|
||||
|
||||
ScoreZone__ProcessScoreZoneRequestMessage(
|
||||
Receiver::MessageID message_ID,
|
||||
size_t length,
|
||||
const EntityID &reply_to,
|
||||
Receiver::MessageID reply_ID,
|
||||
Vector3D vtv_pos
|
||||
):
|
||||
Entity::Message(message_ID, length),
|
||||
requestingEntity(reply_to),
|
||||
replyMessageID(reply_ID)
|
||||
{
|
||||
linearPosition = vtv_pos;
|
||||
}
|
||||
};
|
||||
|
||||
//##########################################################################
|
||||
//################# ScoreZone::ReplyMessage ##########################
|
||||
//##########################################################################
|
||||
|
||||
class ScoreZone__ReplyMessage:
|
||||
public Entity::Message
|
||||
{
|
||||
public:
|
||||
Scalar
|
||||
pointValue;
|
||||
|
||||
ScoreZone__ReplyMessage(
|
||||
Receiver::MessageID message_ID,
|
||||
size_t length,
|
||||
const Scalar point_value=0.0f
|
||||
):
|
||||
Entity::Message(message_ID, length)
|
||||
{
|
||||
pointValue = point_value;
|
||||
}
|
||||
};
|
||||
|
||||
//##########################################################################
|
||||
//########################## ScoreZone ################################
|
||||
//##########################################################################
|
||||
|
||||
class ScoreZone:
|
||||
public Entity
|
||||
{
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Shared Data support
|
||||
//
|
||||
public:
|
||||
static Derivation *GetClassDerivations();
|
||||
|
||||
static SharedData DefaultData;
|
||||
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Message Support
|
||||
//
|
||||
public:
|
||||
enum {
|
||||
ProcessScoreZoneRequestMessageID = Entity::NextMessageID,
|
||||
NextMessageID
|
||||
};
|
||||
|
||||
typedef ScoreZone__MakeMessage MakeMessage;
|
||||
|
||||
private:
|
||||
static const HandlerEntry MessageHandlerEntries[];
|
||||
|
||||
protected:
|
||||
static MessageHandlerSet MessageHandlers;
|
||||
|
||||
public:
|
||||
|
||||
void
|
||||
Dispatch(Receiver::Message *message);
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Attribute Support
|
||||
//
|
||||
|
||||
enum{
|
||||
ScoreZoneTypeAttributeID = Entity::NextAttributeID,
|
||||
PointValueAttributeID,
|
||||
NextAttributeID
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
static const IndexEntry AttributePointers[];
|
||||
|
||||
protected:
|
||||
|
||||
//static AttributeIndexSet AttributeIndex
|
||||
static AttributeIndexSet& GetAttributeIndex();
|
||||
|
||||
public:
|
||||
|
||||
Scalar
|
||||
pointValue;
|
||||
|
||||
typedef ScoreZone__ScoreZoneType ScoreZoneType;
|
||||
ScoreZoneType
|
||||
scoreZoneType;
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Model Support
|
||||
//
|
||||
|
||||
|
||||
enum ScoreZoneState{
|
||||
Active = Entity::StateCount,
|
||||
InActive,
|
||||
StateCount
|
||||
};
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Construction and Destruction
|
||||
//
|
||||
public:
|
||||
typedef ScoreZone__ModelResource ModelResource;
|
||||
|
||||
static ScoreZone*
|
||||
Make(MakeMessage *creation_message);
|
||||
|
||||
static Logical
|
||||
CreateMakeMessage(
|
||||
MakeMessage *creation_stream,
|
||||
NotationFile *model_file,
|
||||
const ResourceDirectories *directories
|
||||
);
|
||||
static ResourceDescription::ResourceID
|
||||
CreateModelResource(
|
||||
ResourceFile *resource_file,
|
||||
const char* model_name,
|
||||
NotationFile *model_file,
|
||||
const ResourceDirectories *directories,
|
||||
ModelResource *model=NULL
|
||||
);
|
||||
|
||||
ScoreZone(
|
||||
MakeMessage *creation_message,
|
||||
SharedData &virtual_data = DefaultData
|
||||
);
|
||||
~ScoreZone();
|
||||
|
||||
Logical
|
||||
TestInstance() const;
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Scorezone assignment
|
||||
//
|
||||
|
||||
public:
|
||||
typedef ScoreZone__ProcessScoreZoneRequestMessage
|
||||
ProcessScoreZoneRequestMessage;
|
||||
typedef ScoreZone__ReplyMessage ReplyMessage;
|
||||
|
||||
ExtentBox
|
||||
extentBox;
|
||||
int
|
||||
sequenceNumber;
|
||||
|
||||
protected:
|
||||
|
||||
void
|
||||
ProcessScoreZoneRequestMessageHandler(
|
||||
ProcessScoreZoneRequestMessage *message
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,143 @@
|
||||
#pragma once
|
||||
|
||||
#include "vtvsub.h"
|
||||
|
||||
class Joint;
|
||||
|
||||
//##########################################################################
|
||||
//################## Thruster::SubsystemResource #####################
|
||||
//##########################################################################
|
||||
|
||||
struct Thruster__SubsystemResource:
|
||||
public Subsystem::SubsystemResource
|
||||
{
|
||||
int jointIndex;
|
||||
Scalar maxThrusterRotationRate;
|
||||
Logical primeThruster;
|
||||
};
|
||||
|
||||
//##########################################################################
|
||||
//################### Thruster::UpdateRecord ####################
|
||||
//##########################################################################
|
||||
|
||||
struct Thruster__UpdateRecord :
|
||||
public VTVSubsystem::UpdateRecord
|
||||
{
|
||||
Scalar
|
||||
thrusterRotation;
|
||||
};
|
||||
|
||||
//##########################################################################
|
||||
//############################ Thruster ##############################
|
||||
//##########################################################################
|
||||
|
||||
class Thruster:
|
||||
public Subsystem
|
||||
{
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Shared Data support
|
||||
//
|
||||
public:
|
||||
static Derivation *GetClassDerivations();
|
||||
static SharedData DefaultData;
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Message Support
|
||||
//
|
||||
#if 0
|
||||
private:
|
||||
static const HandlerEntry MessageHandlerEntries[];
|
||||
|
||||
protected:
|
||||
static MessageHandlerSet MessageHandlers;
|
||||
#endif
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Attribute Support
|
||||
//
|
||||
public:
|
||||
enum {
|
||||
ThrusterOffsetAttributeID = Subsystem::NextAttributeID,
|
||||
ThrusterPositionAttributeID,
|
||||
CurrentAccelerationAttributeID,
|
||||
CurrentHeightAttributeID,
|
||||
MaxThrusterRotationRateAttributeID,
|
||||
MomentArmAttributeID,
|
||||
MomentArmLengthAttributeID,
|
||||
NextAttributeID
|
||||
};
|
||||
|
||||
private:
|
||||
static const IndexEntry AttributePointers[];
|
||||
|
||||
protected:
|
||||
//static AttributeIndexSet AttributeIndex
|
||||
static AttributeIndexSet& GetAttributeIndex();
|
||||
|
||||
//
|
||||
// public attribute declarations go here
|
||||
//
|
||||
public:
|
||||
Point3D thrusterOffset;
|
||||
Joint *thrusterPosition;
|
||||
Scalar
|
||||
currentAcceleration,
|
||||
currentHeight,
|
||||
maxThrusterRotationRate,
|
||||
powerScale,
|
||||
momentArmLength;
|
||||
Vector3D
|
||||
momentArm;
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Model Support
|
||||
//
|
||||
public:
|
||||
typedef void
|
||||
(Thruster::*Performance)(Scalar time_slice);
|
||||
typedef Thruster__UpdateRecord UpdateRecord;
|
||||
|
||||
void
|
||||
PrimeThruster(Scalar time_slice);
|
||||
void
|
||||
SlaveThruster(Scalar time_slice);
|
||||
void
|
||||
PrimeDeadReckon(Scalar time_slice);
|
||||
void
|
||||
SlaveDeadReckon(Scalar time_slice);
|
||||
|
||||
void
|
||||
SetPerformance(Performance performance)
|
||||
{
|
||||
Check(this);
|
||||
activePerformance = (Simulation::Performance)performance;
|
||||
}
|
||||
|
||||
VTV*
|
||||
GetEntity()
|
||||
{Check(this); return Cast_Object(VTV*, Subsystem::GetEntity());}
|
||||
|
||||
protected:
|
||||
void
|
||||
WriteUpdateRecord(Simulation::UpdateRecord *message, int update_model);
|
||||
void
|
||||
ReadUpdateRecord(Simulation::UpdateRecord *message);
|
||||
|
||||
Scalar
|
||||
updatedPosition;
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Construction and Destruction
|
||||
//
|
||||
public:
|
||||
typedef Thruster__SubsystemResource SubsystemResource;
|
||||
Thruster(
|
||||
VTV *owner,
|
||||
int subsystem_ID,
|
||||
SubsystemResource *subsystem_resource
|
||||
);
|
||||
~Thruster();
|
||||
|
||||
Logical
|
||||
TestInstance() const;
|
||||
};
|
||||
+524
@@ -0,0 +1,524 @@
|
||||
#pragma once
|
||||
|
||||
#include "..\munga\jmover.h"
|
||||
#include "..\munga\vector2d.h"
|
||||
#include "..\munga\controls.h"
|
||||
#include "..\munga\normal.h"
|
||||
#include "..\munga\damage.h"
|
||||
#include "..\munga\reticle.h"
|
||||
#include "rptool.h"
|
||||
|
||||
class VTVControlsMapper;
|
||||
class VTV;
|
||||
class RPPlayer;
|
||||
|
||||
#define ZIPPY 2.3f
|
||||
#define MAX_THRUSTERS 6
|
||||
//##########################################################################
|
||||
//#################### VTV::DamageZone ############################
|
||||
//##########################################################################
|
||||
|
||||
class VTV__DamageZone :
|
||||
public DamageZone
|
||||
{
|
||||
public:
|
||||
VTV__DamageZone(
|
||||
VTV *vtv,
|
||||
int damage_zone_index,
|
||||
MemoryStream *damage_zone_stream
|
||||
);
|
||||
|
||||
static Logical
|
||||
CreateStreamedDamageZone(
|
||||
NotationFile *model_file,
|
||||
const char *model_name,
|
||||
NotationFile *skl_file,
|
||||
const char *damage_zone_name,
|
||||
MemoryStream *damage_zone_stream,
|
||||
NotationFile *dmg_file,
|
||||
const ResourceDirectories *directories
|
||||
);
|
||||
|
||||
void
|
||||
TakeDamage(Damage& damage);
|
||||
|
||||
};
|
||||
|
||||
//##########################################################################
|
||||
//#################### VTV::UpdateMessage ############################
|
||||
//##########################################################################
|
||||
|
||||
struct VTV__UpdateRecord:
|
||||
public JointedMover::UpdateRecord
|
||||
{
|
||||
public:
|
||||
Enumeration
|
||||
collisionState,
|
||||
collisionMaterialType;
|
||||
Normal
|
||||
collisionNormal;
|
||||
Scalar
|
||||
collisionSpeed;
|
||||
Logical
|
||||
boosterOn;
|
||||
Vector3D
|
||||
boosterScale;
|
||||
Scalar
|
||||
boosterSmokeDensity;
|
||||
int
|
||||
hornBlast; // HACK - ECH 7/31/95 - For replicants
|
||||
};
|
||||
|
||||
//##########################################################################
|
||||
//###################### VTV::ModelResource ##########################
|
||||
//##########################################################################
|
||||
|
||||
struct VTV__ModelResource:
|
||||
public JointedMover::ModelResource
|
||||
{
|
||||
|
||||
Scalar
|
||||
maxAcceleration,
|
||||
groundEffectDomainSquared,
|
||||
groundEffectRange,
|
||||
maxThrusterRotationRate,
|
||||
maxYawVelocity,
|
||||
angularSpringFactor,
|
||||
bankFactor,
|
||||
deathSpeed,
|
||||
deathScoreLoss,
|
||||
maxImpactSpeed,
|
||||
bottomArmorScale,
|
||||
powerDive;
|
||||
|
||||
Vector3D
|
||||
maxAngularAcceleration;
|
||||
|
||||
int
|
||||
jointIndex[MAX_THRUSTERS],
|
||||
segmentIndex[MAX_THRUSTERS];
|
||||
|
||||
Reticle::ModelResource
|
||||
reticleResource;
|
||||
};
|
||||
|
||||
//##########################################################################
|
||||
//##################### Mover::MakeMessage ##########################
|
||||
//##########################################################################
|
||||
|
||||
class VTV__MakeMessage:
|
||||
public JointedMover::MakeMessage
|
||||
{
|
||||
public:
|
||||
char
|
||||
vehicleBadge[20],
|
||||
vehicleColor[20];
|
||||
|
||||
VTV__MakeMessage(
|
||||
Receiver::MessageID message_ID,
|
||||
size_t length,
|
||||
Entity::ClassID class_ID,
|
||||
const EntityID &owner_ID,
|
||||
ResourceDescription::ResourceID resource_ID,
|
||||
LWord instance_flags,
|
||||
const Origin &origin,
|
||||
const Motion &velocity,
|
||||
const Motion &acceleration,
|
||||
const char* badge,
|
||||
const char* color
|
||||
):
|
||||
JointedMover::MakeMessage(
|
||||
message_ID,
|
||||
length,
|
||||
class_ID,
|
||||
owner_ID,
|
||||
resource_ID,
|
||||
instance_flags,
|
||||
origin,
|
||||
velocity,
|
||||
acceleration
|
||||
)
|
||||
{
|
||||
Str_Copy(vehicleBadge, badge, sizeof(vehicleBadge));
|
||||
Str_Copy(vehicleColor, color, sizeof(vehicleColor));
|
||||
}
|
||||
|
||||
VTV__MakeMessage(
|
||||
Receiver::MessageID message_ID,
|
||||
size_t length,
|
||||
const EntityID &entity_ID,
|
||||
Entity::ClassID class_ID,
|
||||
const EntityID &owner_ID,
|
||||
ResourceDescription::ResourceID resource_ID,
|
||||
LWord instance_flags,
|
||||
const Origin &origin,
|
||||
const Motion &velocity,
|
||||
const Motion &acceleration,
|
||||
const char* badge,
|
||||
const char* color
|
||||
):
|
||||
JointedMover::MakeMessage(
|
||||
message_ID,
|
||||
length,
|
||||
entity_ID,
|
||||
class_ID,
|
||||
owner_ID,
|
||||
resource_ID,
|
||||
instance_flags,
|
||||
origin,
|
||||
velocity,
|
||||
acceleration
|
||||
)
|
||||
{
|
||||
Str_Copy(vehicleBadge, badge, sizeof(vehicleBadge));
|
||||
Str_Copy(vehicleColor, color, sizeof(vehicleColor));
|
||||
}
|
||||
};
|
||||
|
||||
//##########################################################################
|
||||
//############################# VTV ##################################
|
||||
//##########################################################################
|
||||
|
||||
class VTV:
|
||||
public JointedMover
|
||||
{
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Shared Data support
|
||||
//
|
||||
public:
|
||||
static Derivation *GetClassDerivations();
|
||||
static SharedData DefaultData;
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Message Support
|
||||
//
|
||||
public:
|
||||
enum {
|
||||
KavorkianMessageID = JointedMover::NextMessageID,
|
||||
MarkSpotMessageID,
|
||||
RestoreToSpotMessageID,
|
||||
ZoomInMessageID,
|
||||
ZoomOutMessageID,
|
||||
NextMessageID
|
||||
};
|
||||
|
||||
private:
|
||||
static const HandlerEntry MessageHandlerEntries[];
|
||||
|
||||
protected:
|
||||
static MessageHandlerSet MessageHandlers;
|
||||
|
||||
void
|
||||
TakeDamageMessageHandler(TakeDamageMessage *message);
|
||||
void
|
||||
ZoomInMessageHandler(
|
||||
ReceiverDataMessageOf<ControlsButton> *message
|
||||
);
|
||||
void
|
||||
ZoomOutMessageHandler(
|
||||
ReceiverDataMessageOf<ControlsButton> *message
|
||||
);
|
||||
void
|
||||
KavorkianMessageHandler(
|
||||
ReceiverDataMessageOf<ControlsButton> *message
|
||||
);
|
||||
void
|
||||
MarkSpotMessageHandler(
|
||||
ReceiverDataMessageOf<ControlsButton> *message
|
||||
);
|
||||
void
|
||||
RestoreToSpotMessageHandler(
|
||||
ReceiverDataMessageOf<ControlsButton> *message
|
||||
);
|
||||
|
||||
void
|
||||
PlayerLinkMessageHandler(PlayerLinkMessage *message);
|
||||
|
||||
Origin savedOrigin;
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Attribute Support
|
||||
//
|
||||
public:
|
||||
enum {
|
||||
HeightAboveTerrainAttributeID = JointedMover::NextAttributeID,
|
||||
ThrusterPitchAttributeID,
|
||||
CollisionStateAttributeID,
|
||||
CollisionMaterialTypeAttributeID,
|
||||
CollisionNormalAttributeID,
|
||||
CollisionSpeedAttributeID,
|
||||
EyepointRotationAttributeID,
|
||||
BoosterOnAttributeID,
|
||||
BoosterScaleAttributeID,
|
||||
BoosterSmokeDensityAttributeID,
|
||||
ForwardVelocityAttributeID,
|
||||
CompassHeadingAttributeID,
|
||||
TargetReticleAttributeID,
|
||||
NavigationRangeAttributeID,
|
||||
NavigationLinearPositionAttributeID,
|
||||
NavigationAngularPositionAttributeID,
|
||||
ScoreStateAttributeID,
|
||||
ScoreTypeAttributeID,
|
||||
HornBlastAttributeID, // HACK - ECH 7/31/95 - For replicants
|
||||
NextAttributeID
|
||||
};
|
||||
|
||||
virtual Vector3D
|
||||
GetWorldLinearVelocity()
|
||||
{return worldLinearVelocity;}
|
||||
|
||||
private:
|
||||
static const IndexEntry AttributePointers[];
|
||||
|
||||
protected:
|
||||
//static AttributeIndexSet AttributeIndex
|
||||
static AttributeIndexSet& GetAttributeIndex();
|
||||
|
||||
//
|
||||
// public attribute declarations go here
|
||||
//
|
||||
public:
|
||||
int hornBlast; // HACK - ECH 7/31/95 - For replicants
|
||||
Scalar heightAboveTerrain;
|
||||
Hinge thrusterPitch;
|
||||
EulerAngles eyepointRotation;
|
||||
Logical boosterOn;
|
||||
Vector3D boosterScale;
|
||||
Scalar boosterSmokeDensity;
|
||||
Scalar forwardVelocity;
|
||||
YawPitchRoll compassHeading;
|
||||
Reticle targetReticle;
|
||||
|
||||
Scalar navigationRange;
|
||||
Point3D
|
||||
*navigationLinearPosition; // ptr to linear pos of object or NULL
|
||||
Quaternion
|
||||
*navigationAngularPosition; // ptr to angular pos of object or NULL
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Model support
|
||||
//
|
||||
public:
|
||||
enum {
|
||||
BurningState = JointedMover::StateCount,
|
||||
StateCount
|
||||
};
|
||||
|
||||
enum {
|
||||
ControlsMapperSubsystem,
|
||||
PowerSubsystem,
|
||||
Thruster1Subsystem,
|
||||
Thruster2Subsystem,
|
||||
Thruster3Subsystem,
|
||||
Thruster4Subsystem,
|
||||
Thruster5Subsystem,
|
||||
Thruster6Subsystem,
|
||||
JointSubsystemID,
|
||||
BasicSubsystemCount
|
||||
};
|
||||
|
||||
typedef void
|
||||
(VTV::*Performance)(Scalar time_slice);
|
||||
|
||||
void
|
||||
SetPerformance(Performance performance)
|
||||
{
|
||||
Check(this);
|
||||
activePerformance = (Simulation::Performance)performance;
|
||||
}
|
||||
void
|
||||
SetMappingSubsystem(VTVControlsMapper *mapper);
|
||||
|
||||
void
|
||||
MoveAndCollide(Scalar time_slice);
|
||||
|
||||
Logical
|
||||
BoosterOn();
|
||||
|
||||
protected:
|
||||
typedef VTV__UpdateRecord UpdateRecord;
|
||||
|
||||
void
|
||||
WriteUpdateRecord(
|
||||
Simulation::UpdateRecord *message,
|
||||
int update_model
|
||||
);
|
||||
void
|
||||
ReadUpdateRecord(Simulation::UpdateRecord *message);
|
||||
|
||||
public:
|
||||
Scalar
|
||||
groundEffectDomainSquared,
|
||||
groundEffectRange,
|
||||
angularSpringFactor,
|
||||
bankFactor,
|
||||
maxYawVelocity,
|
||||
powerDive,
|
||||
thrusterAngle;
|
||||
Vector3D
|
||||
maxAngularAcceleration;
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Collision support
|
||||
//
|
||||
public:
|
||||
enum {
|
||||
NoCollisionState = 0,
|
||||
InitialHitState,
|
||||
SlideState,
|
||||
RestState,
|
||||
CollisionStateCount
|
||||
};
|
||||
|
||||
Enumeration
|
||||
collisionTemporaryState;
|
||||
StateIndicator
|
||||
collisionState;
|
||||
Enumeration
|
||||
collisionMaterialType;
|
||||
Normal
|
||||
collisionNormal;
|
||||
Scalar
|
||||
collisionSpeed,
|
||||
bottomArmorScale;
|
||||
|
||||
protected:
|
||||
void
|
||||
PerformAndWatch(
|
||||
const Time& till,
|
||||
MemoryStream *update_stream
|
||||
);
|
||||
|
||||
void
|
||||
ProcessCollision(
|
||||
Scalar time_slice,
|
||||
BoxedSolidCollision &collision,
|
||||
const Point3D &old_position,
|
||||
Damage *damage
|
||||
);
|
||||
|
||||
Time
|
||||
lastDoorHit;
|
||||
Vector3D
|
||||
doorHitNormal;
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Damage support
|
||||
//
|
||||
public:
|
||||
Scalar
|
||||
deathSpeed,
|
||||
deathScoreLoss;
|
||||
|
||||
Scalar
|
||||
deathConstant;
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Scoring support
|
||||
//
|
||||
public:
|
||||
//
|
||||
// HACK - ECH 7/6/95 - Allow the player vehicle to respond to score
|
||||
// messages, allows attribute system to be used for scoring
|
||||
//
|
||||
void
|
||||
RespondToScoreMessage(Message *message);
|
||||
|
||||
StateIndicator
|
||||
scoreState;
|
||||
|
||||
Enumeration
|
||||
scoreType;
|
||||
|
||||
Logical
|
||||
insideWorld;
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Construction and Destruction
|
||||
//
|
||||
public:
|
||||
typedef VTV__ModelResource ModelResource;
|
||||
typedef VTV__MakeMessage MakeMessage;
|
||||
typedef VTV__DamageZone DamageZone;
|
||||
|
||||
static VTV*
|
||||
Make(MakeMessage *creation_message);
|
||||
|
||||
static ResourceDescription::ResourceID
|
||||
CreateModelResource(
|
||||
ResourceFile *resource_file,
|
||||
const char *model_name,
|
||||
NotationFile *model_file,
|
||||
const ResourceDirectories *directories,
|
||||
ModelResource* model=NULL
|
||||
);
|
||||
static ResourceDescription::ResourceID
|
||||
CreateSubsystemStream(
|
||||
ResourceFile *resource_file,
|
||||
const char *model_name,
|
||||
NotationFile *model_file,
|
||||
const ResourceDirectories *directories
|
||||
);
|
||||
static ResourceDescription::ResourceID
|
||||
CreateDamageZoneStream(
|
||||
ResourceFile *resource_file,
|
||||
const char *dzone_name,
|
||||
NotationFile *dmg_file,
|
||||
const ResourceDirectories *directories
|
||||
);
|
||||
typedef Logical
|
||||
(*FindNameFunction)(
|
||||
const char *control_name,
|
||||
ControlsMapping *mapping
|
||||
);
|
||||
static Simulation::SharedData*
|
||||
GetSubsystemSharedData(const char *name);
|
||||
|
||||
static ResourceDescription::ResourceID
|
||||
CreateControlMappingStream(
|
||||
const char *mapping_name,
|
||||
NotationFile *mapping_file,
|
||||
FindNameFunction find_name,
|
||||
ResourceFile *resource_file,
|
||||
const char *model_name,
|
||||
NotationFile *model_file,
|
||||
const ResourceDirectories *directories,
|
||||
PlatformTool *current_tool
|
||||
);
|
||||
|
||||
VTV(
|
||||
MakeMessage *creation_message,
|
||||
SharedData &virtual_data = DefaultData
|
||||
);
|
||||
~VTV();
|
||||
|
||||
Logical
|
||||
TestInstance() const;
|
||||
|
||||
enum {
|
||||
RegularReset,
|
||||
FootballReset,
|
||||
MissionReviewReset
|
||||
};
|
||||
|
||||
void
|
||||
Reset(const Origin &new_origin, int reset_command);
|
||||
|
||||
void
|
||||
DeathShutdown(int shutdown_command);
|
||||
|
||||
char
|
||||
vehicleBadge[20],
|
||||
vehicleColor[20];
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Navigation support
|
||||
protected:
|
||||
Scalar
|
||||
targetRangeExponent,
|
||||
currentRangeExponent;
|
||||
public:
|
||||
|
||||
Scalar
|
||||
maxImpactSpeed;
|
||||
};
|
||||
@@ -0,0 +1,245 @@
|
||||
#pragma once
|
||||
|
||||
#include "vtvsub.h"
|
||||
#include "..\munga\average.h"
|
||||
|
||||
//##########################################################################
|
||||
//################ VTVControlsMapper::ModelResource ##################
|
||||
//##########################################################################
|
||||
|
||||
class VTVControlsMapper:
|
||||
public VTVSubsystem
|
||||
{
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Shared Data support
|
||||
//
|
||||
public:
|
||||
static Derivation *GetClassDerivations();
|
||||
static SharedData DefaultData;
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Messaging Support
|
||||
//
|
||||
public:
|
||||
enum {
|
||||
ConfigureControlsMessageID = VTVSubsystem::NextMessageID,
|
||||
ConfigureSideSlipMappablesMessageID,
|
||||
ChooseSideSlipMessageID,
|
||||
ConfigureLiftCutMappablesMessageID,
|
||||
ChooseLiftCutMessageID,
|
||||
ConfigureHornMappablesMessageID,
|
||||
ChooseHornMessageID,
|
||||
ActivateHornMessageID,
|
||||
ConfigurePTTMappablesMessageID,
|
||||
ChoosePTTMessageID,
|
||||
ActivatePTTMessageID,
|
||||
ToggleReticleMessageID,
|
||||
NextMessageID
|
||||
};
|
||||
|
||||
void
|
||||
ConfigureControlsMessageHandler(
|
||||
ReceiverDataMessageOf<ControlsButton> *message
|
||||
);
|
||||
void
|
||||
ConfigureSideSlipMappablesMessageHandler(
|
||||
ReceiverDataMessageOf<ControlsButton> *message
|
||||
);
|
||||
void
|
||||
ChooseSideSlipMessageHandler(
|
||||
ReceiverDataMessageOf<ControlsButton> *message
|
||||
);
|
||||
void
|
||||
ConfigureLiftCutMappablesMessageHandler(
|
||||
ReceiverDataMessageOf<ControlsButton> *message
|
||||
);
|
||||
void
|
||||
ChooseLiftCutMessageHandler(
|
||||
ReceiverDataMessageOf<ControlsButton> *message
|
||||
);
|
||||
void
|
||||
ConfigureHornMappablesMessageHandler(
|
||||
ReceiverDataMessageOf<ControlsButton> *message
|
||||
);
|
||||
void
|
||||
ChooseHornMessageHandler(
|
||||
ReceiverDataMessageOf<ControlsButton> *message
|
||||
);
|
||||
void
|
||||
ActivateHornMessageHandler(
|
||||
ReceiverDataMessageOf<ControlsButton> *message
|
||||
);
|
||||
void
|
||||
ConfigurePTTMappablesMessageHandler(
|
||||
ReceiverDataMessageOf<ControlsButton> *message
|
||||
);
|
||||
void
|
||||
ChoosePTTMessageHandler(
|
||||
ReceiverDataMessageOf<ControlsButton> *message
|
||||
);
|
||||
void
|
||||
ActivatePTTMessageHandler(
|
||||
ReceiverDataMessageOf<ControlsButton> *message
|
||||
);
|
||||
void
|
||||
ToggleReticleMessageHandler(
|
||||
ReceiverDataMessageOf<ControlsButton> *message
|
||||
);
|
||||
|
||||
private:
|
||||
static const HandlerEntry MessageHandlerEntries[];
|
||||
|
||||
protected:
|
||||
//static MessageHandlerSet MessageHandlers;
|
||||
static MessageHandlerSet& GetMessageHandlers();
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Attribute Support
|
||||
//
|
||||
public:
|
||||
enum {
|
||||
StickPositionAttributeID = VTVSubsystem::NextAttributeID,
|
||||
ThrottlePositionAttributeID,
|
||||
PedalsPositionAttributeID,
|
||||
ReverseThrustAttributeID,
|
||||
LiftCutAttributeID,
|
||||
SideSlipAttributeID,
|
||||
PowerDemandAttributeID,
|
||||
AngularVelocityDemandAttributeID,
|
||||
BrakeLightsAttributeID,
|
||||
LookLeftAttributeID,
|
||||
LookRightAttributeID,
|
||||
LookBehindAttributeID,
|
||||
LookUpAttributeID,
|
||||
ControlModeAttributeID,
|
||||
HornBlastAttributeID,
|
||||
MustMatchAttributeID,
|
||||
ReverseThrustEngagedAttributeID, // ECH 8/3/95 - HACK - deal with thrust
|
||||
LiftCutEngagedAttributeID,
|
||||
PTTStatusAttributeID,
|
||||
NextAttributeID
|
||||
};
|
||||
|
||||
private:
|
||||
static const IndexEntry AttributePointers[];
|
||||
|
||||
protected:
|
||||
//static AttributeIndexSet AttributeIndex
|
||||
static AttributeIndexSet& GetAttributeIndex();
|
||||
|
||||
//
|
||||
// public attribute declarations go here
|
||||
//
|
||||
public:
|
||||
ControlsJoystick stickPosition;
|
||||
Scalar throttlePosition;
|
||||
Scalar pedalsPosition;
|
||||
ControlsButton
|
||||
reverseThrust,
|
||||
liftCut,
|
||||
sideSlip,
|
||||
rollLeft,
|
||||
rollRight,
|
||||
pitchUp,
|
||||
pitchDown;
|
||||
Vector3D
|
||||
powerDemand,
|
||||
angularVelocityDemand;
|
||||
|
||||
int brakeLights;
|
||||
ControlsButton
|
||||
lookLeft,
|
||||
lookRight,
|
||||
lookBehind,
|
||||
lookUp,
|
||||
hornBlast,
|
||||
pttStatus;
|
||||
|
||||
// ECH 8/3/95 - HACK - deal with thrust
|
||||
AverageOf<Scalar>
|
||||
averageOfForwardThrustDemand;
|
||||
Scalar
|
||||
forwardThrustDemand;
|
||||
Logical
|
||||
reverseThrustEngaged;
|
||||
|
||||
Logical
|
||||
liftCutEngaged;
|
||||
|
||||
enum {
|
||||
BasicMode = 0,
|
||||
StandardMode,
|
||||
VeteranMode,
|
||||
MasterMode
|
||||
}
|
||||
controlMode;
|
||||
|
||||
unsigned int
|
||||
mustMatch,
|
||||
mayMatch;
|
||||
|
||||
protected:
|
||||
ControlsButton
|
||||
previousPTTStatus; // used to detect change in PTT status
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Model Support
|
||||
//
|
||||
public:
|
||||
enum {
|
||||
ConfigurationState = VTVSubsystem::StateCount,
|
||||
StateCount
|
||||
};
|
||||
|
||||
typedef void
|
||||
(VTVControlsMapper::*Performance)(Scalar time_slice);
|
||||
|
||||
void
|
||||
SetPerformance(Performance performance)
|
||||
{
|
||||
Check(this);
|
||||
activePerformance = (Simulation::Performance)performance;
|
||||
}
|
||||
|
||||
void
|
||||
InterpretControls(Scalar time_slice);
|
||||
void
|
||||
SetConfigurationState(Logical enter_config);
|
||||
|
||||
virtual void
|
||||
CreateTemporaryEventMappings(
|
||||
Receiver *receiver,
|
||||
Receiver::MessageID config_message_id
|
||||
),
|
||||
RemoveTemporaryEventMappings(),
|
||||
AddOrErase(
|
||||
unsigned int button_ID,
|
||||
Receiver *target,
|
||||
Receiver::MessageID message_ID
|
||||
),
|
||||
AddOrErase(
|
||||
unsigned int button_ID,
|
||||
ControlsButton *destination
|
||||
);
|
||||
|
||||
virtual void
|
||||
NotifyOfControlModeChange(int new_mode);
|
||||
|
||||
virtual void
|
||||
NotifyOfConfigurationModeChange(Logical new_state);
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Construction and Destruction
|
||||
//
|
||||
public:
|
||||
VTVControlsMapper(
|
||||
VTV *owner,
|
||||
int subsystem_ID,
|
||||
SubsystemResource *subsystem_resource,
|
||||
SharedData &shared_data
|
||||
);
|
||||
~VTVControlsMapper();
|
||||
|
||||
Logical
|
||||
TestInstance() const;
|
||||
};
|
||||
@@ -0,0 +1,100 @@
|
||||
#pragma once
|
||||
|
||||
#include "vtvsub.h"
|
||||
|
||||
//##########################################################################
|
||||
//#################### Subsystem::SubsystemResource ##################
|
||||
//##########################################################################
|
||||
|
||||
struct VTVPower__SubsystemResource:
|
||||
public Subsystem::SubsystemResource
|
||||
{
|
||||
Scalar
|
||||
maxAcceleration;
|
||||
};
|
||||
|
||||
//##########################################################################
|
||||
//############################ VTVPower ##############################
|
||||
//##########################################################################
|
||||
|
||||
class VTVPower:
|
||||
public Subsystem
|
||||
{
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Shared Data support
|
||||
//
|
||||
public:
|
||||
static Derivation *GetClassDerivations();
|
||||
static SharedData DefaultData;
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Message Support
|
||||
//
|
||||
#if 0
|
||||
private:
|
||||
static const HandlerEntry MessageHandlerEntries[];
|
||||
|
||||
protected:
|
||||
static MessageHandlerSet MessageHandlers;
|
||||
#endif
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Attribute Support
|
||||
//
|
||||
public:
|
||||
enum {
|
||||
MaxAccelerationOutputAttributeID = Subsystem::NextAttributeID,
|
||||
NextAttributeID
|
||||
};
|
||||
|
||||
private:
|
||||
static const IndexEntry AttributePointers[];
|
||||
|
||||
protected:
|
||||
//static AttributeIndexSet AttributeIndex
|
||||
static AttributeIndexSet& GetAttributeIndex();
|
||||
|
||||
//
|
||||
// public attribute declarations go here
|
||||
//
|
||||
public:
|
||||
Scalar
|
||||
maxAccelerationOutput;
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Model Support
|
||||
//
|
||||
public:
|
||||
typedef void
|
||||
(VTVPower::*Performance)(Scalar time_slice);
|
||||
|
||||
void
|
||||
PowerSimulation(Scalar time_slice);
|
||||
|
||||
void
|
||||
SetPerformance(Performance performance)
|
||||
{
|
||||
Check(this);
|
||||
activePerformance = (Simulation::Performance)performance;
|
||||
}
|
||||
|
||||
VTV*
|
||||
GetEntity()
|
||||
{Check(this); return Cast_Object(VTV*, Subsystem::GetEntity());}
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Construction and Destruction
|
||||
//
|
||||
public:
|
||||
typedef VTVPower__SubsystemResource SubsystemResource;
|
||||
|
||||
VTVPower(
|
||||
VTV *owner,
|
||||
int subsystem_ID,
|
||||
SubsystemResource *subsystem
|
||||
);
|
||||
~VTVPower();
|
||||
|
||||
Logical
|
||||
TestInstance() const;
|
||||
};
|
||||
@@ -0,0 +1,61 @@
|
||||
#pragma once
|
||||
|
||||
#include "..\munga\subsystm.h"
|
||||
#include "..\munga\controls.h"
|
||||
|
||||
class VTV;
|
||||
|
||||
//##########################################################################
|
||||
//######################## Subsystem #################################
|
||||
//##########################################################################
|
||||
|
||||
class VTVSubsystem : public Subsystem
|
||||
{
|
||||
friend class VTV;
|
||||
|
||||
//##########################################################################
|
||||
// Shared Data Support
|
||||
//
|
||||
public:
|
||||
static Derivation *GetClassDerivations();
|
||||
static SharedData DefaultData;
|
||||
|
||||
//##########################################################################
|
||||
// Messaging support
|
||||
//
|
||||
|
||||
// No messages handled here
|
||||
|
||||
//##########################################################################
|
||||
// Construction and Destruction Support
|
||||
//
|
||||
public:
|
||||
~VTVSubsystem();
|
||||
|
||||
Logical TestInstance() const;
|
||||
|
||||
protected:
|
||||
VTVSubsystem(VTV *entity, int subsystem_id, SubsystemResource *model, SharedData &shared_data, void *control_destination = NULL, Receiver::MessageID message_id = (Receiver::MessageID) 0);
|
||||
|
||||
//##########################################################################
|
||||
// Model support
|
||||
//
|
||||
public:
|
||||
VTV* GetEntity() { return (VTV*)Subsystem::GetEntity(); }
|
||||
|
||||
//##########################################################################
|
||||
// Mapping support
|
||||
//
|
||||
protected:
|
||||
void EnterConfiguration(ControlsButton *direct_target, Receiver *receiver, Receiver::MessageID active_message_id, Receiver::MessageID config_message_id);
|
||||
void ExitConfiguration();
|
||||
|
||||
// 'controlDestination' is a pointer to the "thing" that a button
|
||||
// is mapped to (if 'direct-mapped'), and 'controlMessageID' indicates
|
||||
// the message ID that the button is mapped to (if 'event-mapped').
|
||||
// These values must be set appropriately in order for gauges to be
|
||||
// able to determine ownership of mapped buttons.
|
||||
void *controlDestination; // OBSOLETE?
|
||||
|
||||
Receiver::MessageID controlMessageID; // OBSOLETE?
|
||||
};
|
||||
@@ -0,0 +1,548 @@
|
||||
#pragma once
|
||||
|
||||
#include "vtvsub.h"
|
||||
#include "..\munga\linmtrx.h"
|
||||
|
||||
class Motion;
|
||||
|
||||
//############################################################################
|
||||
//Generic Gun Subsystem Resource
|
||||
|
||||
struct GenericGun__SubsystemResource :
|
||||
public VTVSubsystem::SubsystemResource
|
||||
{
|
||||
ResourceDescription::ResourceID ammoVideoResourceID;
|
||||
|
||||
int
|
||||
rearSiteIndex;
|
||||
};
|
||||
|
||||
//############################################################################
|
||||
//############### Class Generic Gun ##################################
|
||||
//############################################################################
|
||||
|
||||
class GenericGun:
|
||||
public VTVSubsystem
|
||||
{
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Shared Data Support
|
||||
//
|
||||
public:
|
||||
static Derivation *GetClassDerivations();
|
||||
static SharedData DefaultData;
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Messaging Support
|
||||
//
|
||||
public:
|
||||
enum {
|
||||
ConfigureMappablesMessageID = VTVSubsystem::NextMessageID,
|
||||
ChooseButtonMessageID,
|
||||
NextMessageID
|
||||
};
|
||||
|
||||
void
|
||||
ConfigureMappablesMessageHandler(
|
||||
ReceiverDataMessageOf<ControlsButton> *message
|
||||
);
|
||||
void
|
||||
ChooseButtonMessageHandler(
|
||||
ReceiverDataMessageOf<ControlsButton> *message
|
||||
);
|
||||
|
||||
protected:
|
||||
static const HandlerEntry
|
||||
MessageHandlerEntries[];
|
||||
static MessageHandlerSet
|
||||
MessageHandlers;
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Attribute Support
|
||||
//
|
||||
public:
|
||||
enum {
|
||||
TriggerStateAttributeID = VTVSubsystem::NextAttributeID,
|
||||
PercentDoneAttributeID,
|
||||
NextAttributeID
|
||||
};
|
||||
|
||||
private:
|
||||
static const IndexEntry AttributePointers[];
|
||||
|
||||
public:
|
||||
//static AttributeIndexSet AttributeIndex
|
||||
static AttributeIndexSet& GetAttributeIndex();
|
||||
|
||||
//
|
||||
// public attribute std::declarations go here
|
||||
//
|
||||
public:
|
||||
int
|
||||
triggerState;
|
||||
Scalar
|
||||
percentDone;
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Model Support
|
||||
//
|
||||
public:
|
||||
|
||||
enum {
|
||||
Firing = VTVSubsystem::StateCount,
|
||||
StateCount
|
||||
};
|
||||
|
||||
typedef void (GenericGun::*Performance)(Scalar time_slice);
|
||||
|
||||
void
|
||||
GenericGunSimulation(Scalar time_slice);
|
||||
|
||||
void
|
||||
SetPerformance(Performance performance)
|
||||
{
|
||||
Check(this);
|
||||
activePerformance = (Simulation::Performance)performance;
|
||||
}
|
||||
|
||||
virtual int
|
||||
Fire() {std::cout<<"GenericGun::Fire() Should not be here!"<<std::endl; return False;}
|
||||
|
||||
void
|
||||
CalcAmmoOrigin(Origin *);
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Construction and Destruction
|
||||
//
|
||||
public:
|
||||
typedef GenericGun__SubsystemResource SubsystemResource;
|
||||
|
||||
static int
|
||||
CreateStreamedSubsystem(
|
||||
NotationFile *model_file,
|
||||
const char *model_name,
|
||||
const char *subsystem_name,
|
||||
SubsystemResource *subsystem_resource,
|
||||
NotationFile *subsystem_file,
|
||||
ResourceFile *resource_file,
|
||||
const ResourceDirectories *directories
|
||||
);
|
||||
|
||||
protected:
|
||||
GenericGun(
|
||||
VTV *owner,
|
||||
int subsystem_ID,
|
||||
SubsystemResource *sub_res,
|
||||
SharedData &shared_data=DefaultData
|
||||
);
|
||||
~GenericGun();
|
||||
|
||||
Logical
|
||||
TestInstance() const;
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Local data for the gun class
|
||||
//
|
||||
|
||||
protected:
|
||||
int
|
||||
oldTriggerState;
|
||||
ResourceDescription::ResourceID
|
||||
ammoVideoResourceID;
|
||||
|
||||
LinearMatrix
|
||||
siteFrontTransform,
|
||||
siteRearTransform;
|
||||
};
|
||||
|
||||
//############################################################################
|
||||
//Rivet Gun Subsystem Resource
|
||||
struct RivetGun__SubsystemResource :
|
||||
public GenericGun::SubsystemResource
|
||||
{
|
||||
Scalar
|
||||
loadTime;
|
||||
Scalar
|
||||
ammoCount;
|
||||
Vector3D
|
||||
muzzleVelocity;
|
||||
};
|
||||
|
||||
//############################################################################
|
||||
//################ Class Rivet Gun ##################################
|
||||
//############################################################################
|
||||
|
||||
class RivetGun :
|
||||
public GenericGun
|
||||
{
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Shared Data Support
|
||||
//
|
||||
|
||||
public:
|
||||
static Derivation *GetClassDerivations();
|
||||
static SharedData DefaultData;
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Attribute Support
|
||||
//
|
||||
public:
|
||||
enum {
|
||||
TimeToLoadedAttributeID = GenericGun::NextAttributeID,
|
||||
AmmoCountAttributeID,
|
||||
NextAttributeID
|
||||
};
|
||||
|
||||
private:
|
||||
static const IndexEntry AttributePointers[];
|
||||
|
||||
public:
|
||||
//static AttributeIndexSet AttributeIndex
|
||||
static AttributeIndexSet& GetAttributeIndex();
|
||||
|
||||
//
|
||||
// public attribute std::declarations go here
|
||||
//
|
||||
public:
|
||||
Scalar
|
||||
timeToLoaded;
|
||||
Scalar
|
||||
ammoCount;
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Model Support
|
||||
//
|
||||
public:
|
||||
enum {
|
||||
MisFire = GenericGun::StateCount,
|
||||
NoAmmo,
|
||||
Loaded,
|
||||
Loading,
|
||||
StateCount
|
||||
};
|
||||
|
||||
typedef void (RivetGun::*Performance)(Scalar time_slice);
|
||||
|
||||
void
|
||||
RivetGunSimulation(Scalar time_slice);
|
||||
|
||||
void
|
||||
SetPerformance(Performance performance)
|
||||
{
|
||||
Check(this);
|
||||
activePerformance = (Simulation::Performance)performance;
|
||||
}
|
||||
|
||||
VTV*
|
||||
GetEntity()
|
||||
{Check(this); return Cast_Object(VTV*, Subsystem::GetEntity());}
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Damage Support
|
||||
//
|
||||
void
|
||||
DeathReset(int reset_command);
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Construction and Destruction
|
||||
//
|
||||
public:
|
||||
typedef RivetGun__SubsystemResource SubsystemResource;
|
||||
|
||||
RivetGun(
|
||||
VTV *owner,
|
||||
int subsystem_ID,
|
||||
SubsystemResource *sub_res,
|
||||
SharedData &shared_data=DefaultData
|
||||
);
|
||||
~RivetGun();
|
||||
|
||||
Logical
|
||||
TestInstance() const;
|
||||
|
||||
static int
|
||||
CreateStreamedSubsystem(
|
||||
NotationFile *model_file,
|
||||
const char *model_name,
|
||||
const char *subsystem_name,
|
||||
SubsystemResource *subsystem_resource,
|
||||
NotationFile *subsystem_file,
|
||||
ResourceFile *resource_file,
|
||||
const ResourceDirectories *directories
|
||||
);
|
||||
protected:
|
||||
|
||||
int
|
||||
Fire();
|
||||
|
||||
Scalar
|
||||
loadTime;
|
||||
Vector3D
|
||||
muzzleVelocity;
|
||||
|
||||
Scalar
|
||||
maxAmmoCount;
|
||||
|
||||
void
|
||||
CalcAmmoMotion(Motion *);
|
||||
};
|
||||
//##########################################################################
|
||||
//##################### LaserGun::UpdateRecord #####################
|
||||
//##########################################################################
|
||||
|
||||
struct LaserGun__UpdateRecord :
|
||||
public GenericGun::UpdateRecord
|
||||
{
|
||||
Vector3D
|
||||
laserScale;
|
||||
|
||||
Logical
|
||||
frontLaserOn,
|
||||
rearLaserOn;
|
||||
|
||||
};
|
||||
//############################################################################
|
||||
// Laser Gun Subsystem Resource
|
||||
struct LaserGun__SubsystemResource :
|
||||
public GenericGun::SubsystemResource
|
||||
{
|
||||
Scalar
|
||||
fullChargeDuration;
|
||||
|
||||
Scalar
|
||||
laserDuration;
|
||||
|
||||
Scalar
|
||||
chargeLevel;
|
||||
|
||||
Scalar
|
||||
chargePerSecond;
|
||||
|
||||
Scalar
|
||||
drainPerSecond;
|
||||
|
||||
Scalar
|
||||
laserLength;
|
||||
|
||||
ResourceDescription::ResourceID
|
||||
explosionResourceID;
|
||||
|
||||
Damage
|
||||
damageData;
|
||||
|
||||
Scalar
|
||||
pulseDuration;
|
||||
};
|
||||
|
||||
//############################################################################
|
||||
//################ Class Laser Gun ##################################
|
||||
//############################################################################
|
||||
|
||||
class LaserGun :
|
||||
public GenericGun
|
||||
{
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Shared Data Support
|
||||
//
|
||||
|
||||
public:
|
||||
static Derivation *GetClassDerivations();
|
||||
static SharedData DefaultData;
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Attribute Support
|
||||
//
|
||||
public:
|
||||
enum {
|
||||
FrontLaserOnAttributeID = GenericGun::NextAttributeID,
|
||||
RearLaserOnAttributeID,
|
||||
LaserScaleAttributeID,
|
||||
NextAttributeID
|
||||
};
|
||||
|
||||
private:
|
||||
static const IndexEntry AttributePointers[];
|
||||
|
||||
public:
|
||||
//static AttributeIndexSet AttributeIndex
|
||||
static AttributeIndexSet& GetAttributeIndex();
|
||||
|
||||
//
|
||||
// public attribute std::declarations go here
|
||||
//
|
||||
public:
|
||||
|
||||
Logical
|
||||
frontLaserOn,
|
||||
rearLaserOn;
|
||||
|
||||
Vector3D
|
||||
laserScale;
|
||||
|
||||
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Model Support
|
||||
//
|
||||
public:
|
||||
enum{
|
||||
Charging = GenericGun::StateCount,
|
||||
Misfire,
|
||||
PulseFiring,
|
||||
StateCount
|
||||
};
|
||||
typedef void (LaserGun::*Performance)(Scalar time_slice);
|
||||
|
||||
void
|
||||
ChargingSimulation(Scalar time_slice);
|
||||
|
||||
void
|
||||
FiringSimulation(Scalar time_slice);
|
||||
|
||||
void
|
||||
PulseFiringSimulation(Scalar time_slice);
|
||||
|
||||
void
|
||||
SetPerformance(Performance performance)
|
||||
{
|
||||
Check(this);
|
||||
activePerformance = (Simulation::Performance)performance;
|
||||
}
|
||||
|
||||
VTV*
|
||||
GetEntity()
|
||||
{Check(this); return Cast_Object(VTV*, Subsystem::GetEntity());}
|
||||
|
||||
|
||||
protected:
|
||||
typedef LaserGun__UpdateRecord UpdateRecord;
|
||||
|
||||
void
|
||||
WriteUpdateRecord(Simulation::UpdateRecord *message, int update_model);
|
||||
void
|
||||
ReadUpdateRecord(Simulation::UpdateRecord *message);
|
||||
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Damage Support
|
||||
//
|
||||
|
||||
Damage
|
||||
damageData;
|
||||
void
|
||||
DeathReset(int reset_command);
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Construction and Destruction
|
||||
//
|
||||
public:
|
||||
typedef LaserGun__SubsystemResource SubsystemResource;
|
||||
|
||||
LaserGun(
|
||||
VTV *owner,
|
||||
int subsystem_ID,
|
||||
SubsystemResource *sub_res,
|
||||
SharedData &shared_data=DefaultData
|
||||
);
|
||||
~LaserGun();
|
||||
|
||||
Logical
|
||||
TestInstance() const;
|
||||
|
||||
static int
|
||||
CreateStreamedSubsystem(
|
||||
NotationFile *model_file,
|
||||
const char *model_name,
|
||||
const char *subsystem_name,
|
||||
SubsystemResource *subsystem_resource,
|
||||
NotationFile *subsystem_file,
|
||||
ResourceFile *resource_file,
|
||||
const ResourceDirectories *directories
|
||||
);
|
||||
|
||||
protected:
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Local Support
|
||||
//
|
||||
int
|
||||
Fire();
|
||||
|
||||
Scalar
|
||||
fullChargeDuration,
|
||||
maxChargeLevel,
|
||||
chargeLevel;
|
||||
|
||||
Scalar
|
||||
maxLaserDuration,
|
||||
laserDuration,
|
||||
pulseDuration,
|
||||
maxPulseDuration;
|
||||
|
||||
Scalar
|
||||
chargePerSecond,
|
||||
drainPerSecond;
|
||||
|
||||
Scalar
|
||||
maxLaserLength;
|
||||
|
||||
ResourceDescription::ResourceID
|
||||
explosionResourceID;
|
||||
|
||||
void
|
||||
CalcPercentDone();
|
||||
|
||||
Logical
|
||||
hitSomething;
|
||||
};
|
||||
|
||||
//############################################################################
|
||||
//################ Class DemolitionPackDropper ##########################
|
||||
//############################################################################
|
||||
|
||||
class DemolitionPackDropper :
|
||||
public RivetGun
|
||||
{
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Shared Data Support
|
||||
//
|
||||
|
||||
public:
|
||||
static Derivation *GetClassDerivations();
|
||||
static SharedData DefaultData;
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Construction and Destruction
|
||||
//
|
||||
public:
|
||||
|
||||
DemolitionPackDropper(
|
||||
VTV *owner,
|
||||
int subsystem_ID,
|
||||
SubsystemResource *sub_res,
|
||||
SharedData &shared_data=DefaultData
|
||||
);
|
||||
~DemolitionPackDropper();
|
||||
|
||||
Logical
|
||||
TestInstance() const;
|
||||
|
||||
static int
|
||||
CreateStreamedSubsystem(
|
||||
NotationFile *model_file,
|
||||
const char *model_name,
|
||||
const char *subsystem_name,
|
||||
SubsystemResource *subsystem_resource,
|
||||
NotationFile *subsystem_file,
|
||||
ResourceFile *resource_file,
|
||||
const ResourceDirectories *directories
|
||||
);
|
||||
|
||||
void
|
||||
DeathReset(int reset_command);
|
||||
|
||||
protected:
|
||||
int
|
||||
Fire();
|
||||
};
|
||||
Reference in New Issue
Block a user