The player-experience system now gates the entire heat/jam economy, verified in BOTH directions with a one-token egg edit (TESTNOV.EGG, experience=novice): NOVICE = 212 fire cycles all pinned at T=77, zero jams, zero shutdowns (the heat model authentically absent); EXPERT = the full economy (duty cycles, 119 shutdowns + 2 authentic jams under forced fire). Zero Fail in both. - BTPLAYER: the flag block renamed to its TRUE semantics (simLive @0x25c, heatModelOn @0x260 -- the FUN_004ad7d4 master switch, advancedDamageOn pair, levelFlag26c/270, experienceLevel); the ctor rows were already binary-accurate (nov 0000 / std 1011 / vet 1111 / exp 1101); accessors + [exp] sentinel. - HeatSink::HeatModelActive() + ProjectileWeapon::LiveFireEnabled(): owner mech -> Entity::GetPlayerLink() -> the BTPlayer flags, NULL-permissive. Gates: both HeatSinkSimulation phases, every weapon fire-heat dump, and CheckForJam is now the AUTHENTIC form (LiveFireEnabled + heatLoad<=0 early-outs + the minJamChance floor; the interim heat-degraded gate retired). - THE LOAD-BEARING FIX: Mech ctor SetValidFlag(). Every 1995 entity ctor tail marks itself valid; ours didn't -- Entity::Dispatch routes messages to an INVALID entity into the deferred event queue, so the PlayerLink bind (and every directly-dispatched mech message) silently never landed and the gates read a NULL player forever. - THE COOLANT SYSTEM (authentic bodies, byte-verified constants: HeatLoadScale 0.002 -> heatLoad now in [0,1]; equalize eps 1e-4; draw floor/ON 0.0025/0.003): UpdateCoolant (damage-scaled draw -- an undamaged mech leaks nothing), BalanceCoolant (full clamp chain from ConductHeat), DrawCoolant base=0 with the RESERVOIR override as THE SOURCE; Reservoir reconstructed (capacity overlays thermalCapacity, CoolantSimulation + the full InjectCoolant flush distribution, BT_FORCE_FLUSH dev hook); Condenser RefrigerationSimulation (massScale = (1-damage)*refrigerationFactor >= 1 -- the heat pump that chills the bank; valveState inits 1; digit-suffix number fix). Deferred: AggregateHeatSink family, cockpit-button handlers (MoveValve/ToggleCooling/InjectCoolant), TrackSeekVoltage charge model. Research driven by a 4-agent workflow dossier over the BT411 RE (verbatim bodies for every function above + the egg experience plumbing). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
230 lines
6.2 KiB
C++
230 lines
6.2 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;
|
|
|
|
//
|
|
// EXPERIENCE-LEVEL game-mode flags, derived in the constructor from the
|
|
// mission's experience level (novice / standard / veteran / expert) and
|
|
// advanced-damage technician flag. TRUE SEMANTICS (the early "display
|
|
// toggles" reading of this block was wrong -- see BTPLAYER.NOTES.md):
|
|
// binary rows for (simLive, heatModelOn, levelFlag26c, levelFlag270) =
|
|
// nov 0,0,0,0 / std 1,0,1,1 / vet 1,1,1,1 / exp 1,1,0,1.
|
|
// simLive -- the novice lockout: jams, searchlight, powersub
|
|
// short events (CheckForJam's LiveFireEnabled gate);
|
|
// heatModelOn -- THE heat-model master switch (HeatModelActive):
|
|
// weapon-fire heat, the heat sim, coolant, movement
|
|
// heat. Standard mode has NO heat consequences --
|
|
// authentic, not a gap;
|
|
// advancedDamageOn/2 -- the egg's technician flag (an int pair in the
|
|
// binary; NOT part of the level switch);
|
|
// experienceLevel -- the raw 0..3 (the ==0 novice-lockout predicate).
|
|
//
|
|
Logical
|
|
simLive;
|
|
Logical
|
|
heatModelOn;
|
|
Logical
|
|
advancedDamageOn;
|
|
Logical
|
|
advancedDamageOn2;
|
|
Logical
|
|
levelFlag26c;
|
|
Logical
|
|
levelFlag270;
|
|
int
|
|
experienceLevel;
|
|
|
|
public:
|
|
Logical
|
|
IsSimLive() const { Check(this); return simLive; }
|
|
Logical
|
|
IsHeatModelOn() const { Check(this); return heatModelOn; }
|
|
Logical
|
|
IsAdvancedDamageOn() const { Check(this); return advancedDamageOn; }
|
|
|
|
protected:
|
|
|
|
int
|
|
killCount;
|
|
int
|
|
padScore;
|
|
Mech
|
|
*objectiveMech;
|
|
Time
|
|
lastConsoleUpdate;
|
|
Logical
|
|
deathPending;
|
|
};
|
|
|
|
#endif
|