Fixes the incorrect DefaultData reuse of Player::MessageHandlers -- BTPlayer now has its own handler table (DropZoneReply, VehicleDead, Score, ScoreInflicted, ScoreUpdate; the last two add BT message IDs) chained onto the base set, matching the .data table recovered in BT411. A mission-start DropZoneReply now routes to BTPlayer::DropZoneReplyMessageHandler (the real spawn/respawn dispatch skeleton) instead of the base "should not be handled by base player class" Fail stub. Boot ladder now runs the full engine + app + network + mission + player path and reaches the spawn handshake, halting at CreatePlayerVehicle -> Mech::Make -- the Mech subsystem frontier (Mech ctor + mech2/3/4 + subsystems + weapons), the next major reconstruction milestone. Scoring/death handlers, PlayerSimulation, and the mech-placement tail staged with documented Fail bodies (BTPLAYER.NOTES.md). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
208 lines
5.1 KiB
C++
208 lines
5.1 KiB
C++
//===========================================================================//
|
|
// File: btplayer.hpp //
|
|
// Project: BattleTech //
|
|
// Contents: Implementation details for the BT player //
|
|
//---------------------------------------------------------------------------//
|
|
// Date Who Modification //
|
|
// -------- --- ---------------------------------------------------------- //
|
|
// //
|
|
//---------------------------------------------------------------------------//
|
|
// Copyright (C) 1995, Virtual World Entertainment, Inc. //
|
|
// All Rights reserved worldwide //
|
|
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL //
|
|
//===========================================================================//
|
|
|
|
#if !defined(BTPLAYER_HPP)
|
|
# define BTPLAYER_HPP
|
|
|
|
# if !defined(PLAYER_HPP)
|
|
# include <player.hpp>
|
|
# endif
|
|
|
|
//##################### Forward Class Declarations #######################
|
|
class Mech;
|
|
class BTTeam;
|
|
class Mission;
|
|
|
|
//###########################################################################
|
|
//####################### BTPlayer Make Message #########################
|
|
//###########################################################################
|
|
|
|
class BTPlayer__MakeMessage:
|
|
public Player__MakeMessage
|
|
{
|
|
public:
|
|
CString roleName;
|
|
CString teamName;
|
|
|
|
BTPlayer__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,
|
|
CString role_name,
|
|
CString team_name
|
|
):
|
|
Player__MakeMessage(
|
|
message_ID,
|
|
length,
|
|
class_ID,
|
|
owner_ID,
|
|
resource_ID,
|
|
instance_flags,
|
|
origin,
|
|
player_bitmap_index
|
|
)
|
|
{
|
|
roleName = role_name;
|
|
teamName = team_name;
|
|
}
|
|
};
|
|
|
|
//###########################################################################
|
|
//############################# BTPlayer ################################
|
|
//###########################################################################
|
|
|
|
class BTPlayer:
|
|
public Player
|
|
{
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Shared Data Support
|
|
//
|
|
public:
|
|
static Derivation ClassDerivations;
|
|
static SharedData DefaultData;
|
|
|
|
static const HandlerEntry
|
|
MessageHandlerEntries[];
|
|
static MessageHandlerSet
|
|
MessageHandlers;
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Message Support
|
|
//
|
|
public:
|
|
enum {
|
|
ScoreInflictedMessageID = Player::NextMessageID,
|
|
ScoreUpdateMessageID,
|
|
NextMessageID
|
|
};
|
|
|
|
protected:
|
|
void
|
|
DropZoneReplyMessageHandler(DropZone__ReplyMessage *message);
|
|
void
|
|
VehicleDeadMessageHandler(VehicleDeadMessage *message);
|
|
void
|
|
ScoreMessageHandler(ScoreMessage *message);
|
|
void
|
|
ScoreInflictedMessageHandler(ScoreMessage *message);
|
|
void
|
|
ScoreUpdateMessageHandler(ScoreMessage *message);
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Vehicle creation
|
|
//
|
|
protected:
|
|
virtual void
|
|
CreatePlayerVehicle(Origin mech_location);
|
|
void
|
|
InitializePlayerLink();
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Construction and Destruction
|
|
//
|
|
public:
|
|
typedef BTPlayer__MakeMessage MakeMessage;
|
|
|
|
static BTPlayer*
|
|
Make(MakeMessage *creation_message);
|
|
|
|
BTPlayer(
|
|
MakeMessage *creation_message,
|
|
SharedData &shared_data = DefaultData
|
|
);
|
|
~BTPlayer();
|
|
|
|
Logical
|
|
TestInstance() const;
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Experience support
|
|
//
|
|
public:
|
|
Enumeration
|
|
GetExperienceLevel();
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Model Support
|
|
//
|
|
public:
|
|
typedef void
|
|
(BTPlayer::*Performance)(Scalar time_slice);
|
|
|
|
void
|
|
SetPerformance(Performance performance)
|
|
{
|
|
Check(this);
|
|
activePerformance = (Simulation::Performance)performance;
|
|
}
|
|
|
|
void
|
|
PlayerSimulation(Scalar time_slice);
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Local Data
|
|
//
|
|
protected:
|
|
Mission
|
|
*btMission;
|
|
char
|
|
teamName[64];
|
|
BTTeam
|
|
*teamEntity;
|
|
Logical
|
|
freeForAll;
|
|
Logical
|
|
consoleAttached;
|
|
Logical
|
|
suppressConsole;
|
|
|
|
//
|
|
// Game-mode flags derived in the constructor from the mission's
|
|
// experience level (novice / standard / veteran / expert) and
|
|
// advanced-damage technician flag. See BTPLAYER.NOTES.md.
|
|
//
|
|
Logical
|
|
showDamageReceived;
|
|
Logical
|
|
showKills;
|
|
Logical
|
|
showDamageInflicted;
|
|
Logical
|
|
showScore;
|
|
Scalar
|
|
roleReturnDelay;
|
|
Scalar
|
|
roleReturnDelay2;
|
|
int
|
|
roleClassIndex;
|
|
|
|
int
|
|
killCount;
|
|
int
|
|
padScore;
|
|
Mech
|
|
*objectiveMech;
|
|
Time
|
|
lastConsoleUpdate;
|
|
Logical
|
|
deathPending;
|
|
};
|
|
|
|
#endif
|