4.10 reconstruction: BTPlayer message-handler table + DropZone spawn dispatch

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>
This commit is contained in:
Cyd
2026-07-19 20:24:27 -05:00
co-authored by Claude Fable 5
parent c43e6d873a
commit 956fc57681
3 changed files with 177 additions and 12 deletions
+117 -1
View File
@@ -35,6 +35,10 @@
# include <app.hpp>
#endif
#if !defined(DROPZONE_HPP)
# include <dropzone.hpp>
#endif
//
//#############################################################################
// Shared data support
@@ -46,10 +50,27 @@ Derivation
"BTPlayer"
);
const Receiver::HandlerEntry
BTPlayer::MessageHandlerEntries[]=
{
MESSAGE_ENTRY(BTPlayer,DropZoneReply),
MESSAGE_ENTRY(BTPlayer,VehicleDead),
MESSAGE_ENTRY(BTPlayer,Score),
MESSAGE_ENTRY(BTPlayer,ScoreInflicted),
MESSAGE_ENTRY(BTPlayer,ScoreUpdate)
};
BTPlayer::MessageHandlerSet
BTPlayer::MessageHandlers(
ELEMENTS(BTPlayer::MessageHandlerEntries),
BTPlayer::MessageHandlerEntries,
Player::MessageHandlers
);
BTPlayer::SharedData
BTPlayer::DefaultData(
BTPlayer::ClassDerivations,
Player::MessageHandlers,
BTPlayer::MessageHandlers,
Player::AttributeIndex,
1,
(Entity::MakeHandler)BTPlayer::Make
@@ -207,6 +228,101 @@ Enumeration
return Cast_Object(BTMission *, btMission)->ExperienceLevel();
}
//
//#############################################################################
// DropZoneReplyMessageHandler The spawn / respawn handshake: when the drop
// zone replies with our spawn location we create (or, on respawn, reset) the
// player's vehicle there and bind it to us.
//
// The mech placement / respawn-reset tail depends on the Mech subsystem
// (Mech::MechClassID / Mech::Reset), which is not yet reconstructed; the
// dispatch skeleton below halts at CreatePlayerVehicle -> Mech::Make on the
// first (fresh-drop) reply. See BTPLAYER.NOTES.md.
//#############################################################################
//
void
BTPlayer::DropZoneReplyMessageHandler(DropZone__ReplyMessage *message)
{
Check(this);
Check(message);
if (!playerVehicle)
{
CreatePlayerVehicle(message->dropZoneLocation);
InitializePlayerLink();
//
// A piloted mech runs the combat PlayerSimulation and is a scoring
// player; a camera-ship observer runs CameraShipSimulation and never
// ranks. (Vehicle-class dispatch + mech placement deferred with the
// Mech subsystem.)
//
AlwaysExecute();
deathCount = 0;
}
else if (deathCount == message->deathCount)
{
if (GetSimulationState() == MissionEndingState)
{
Check_Fpu();
return;
}
//
// Respawn: reset the existing dead mech in place (deferred with the
// Mech subsystem).
//
}
Check_Fpu();
}
//
//#############################################################################
// Vehicle creation -- pulls in the Mech subsystem (Mech::Make), not yet
// reconstructed. This is the current boot frontier.
//#############################################################################
//
void
BTPlayer::CreatePlayerVehicle(Origin)
{
Fail("BTPlayer::CreatePlayerVehicle -- btplayer.cpp not yet reconstructed");
}
void
BTPlayer::InitializePlayerLink()
{
Fail("BTPlayer::InitializePlayerLink -- btplayer.cpp not yet reconstructed");
}
//
//#############################################################################
// Scoring / death handlers -- exercised in combat, not during bring-up boot.
//#############################################################################
//
void
BTPlayer::VehicleDeadMessageHandler(VehicleDeadMessage *)
{
Fail("BTPlayer::VehicleDeadMessageHandler -- btplayer.cpp not yet reconstructed");
}
void
BTPlayer::ScoreMessageHandler(ScoreMessage *)
{
Fail("BTPlayer::ScoreMessageHandler -- btplayer.cpp not yet reconstructed");
}
void
BTPlayer::ScoreInflictedMessageHandler(ScoreMessage *)
{
Fail("BTPlayer::ScoreInflictedMessageHandler -- btplayer.cpp not yet reconstructed");
}
void
BTPlayer::ScoreUpdateMessageHandler(ScoreMessage *)
{
Fail("BTPlayer::ScoreUpdateMessageHandler -- btplayer.cpp not yet reconstructed");
}
//
//#############################################################################
// PlayerSimulation -- console-update performance (not yet reconstructed).
+31
View File
@@ -82,6 +82,37 @@
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
//
+29 -11
View File
@@ -1,8 +1,26 @@
# BTPLAYER.CPP / .HPP — reconstruction notes
**Status: constructor / dtor / Make / TestInstance / GetExperienceLevel
RECONSTRUCTED; message-handler table + handlers + PlayerSimulation +
CreatePlayerVehicle still staged.**
**Status: constructor / dtor / Make / TestInstance / GetExperienceLevel +
message-handler table + DropZoneReply dispatch RECONSTRUCTED; the scoring/death
handlers, PlayerSimulation, and CreatePlayerVehicle/InitializePlayerLink (the
Mech-subsystem frontier) still staged.**
## Message-handler table (wired 2026-07-19)
DefaultData now uses `BTPlayer::MessageHandlers` (chained onto
`Player::MessageHandlers`) instead of reusing the base set — the earlier reuse
left BTPlayer's own handlers unwired, so a DropZoneReply reached the base
`Player::DropZoneReplyMessageHandler` stub that Fails "should not be handled by
base player class!" (PLAYER.CPP:179). Table entries (BT411 .data @005130c0):
DropZoneReply, VehicleDead, Score, ScoreInflicted, ScoreUpdate. ScoreInflicted/
ScoreUpdate add two BT message IDs (`Player::NextMessageID`+0/+1). MissionStarting/
MissionEnding are inherited from Player unchanged (not re-listed — BT411 lists
them but they point at the same base handlers).
`DropZoneReplyMessageHandler` is the real spawn/respawn dispatch skeleton; its
mech-placement tail (vehicle-class performance select, Mech::Reset respawn) is
deferred with the Mech subsystem. On the first fresh-drop reply it calls
`CreatePlayerVehicle` → the current boot frontier.
## Sources
@@ -60,12 +78,12 @@ not fully located ([T4]). Rename is a follow-up wiring task; the VALUES are corr
## Still staged (next bricks, in boot order)
1. **Message-handler table** — DefaultData currently reuses `Player::MessageHandlers`,
so BTPlayer's own handlers are unwired and the base
`Player::DropZoneReplyMessageHandler` Fails ("should not be handled by base
player class!", PLAYER.CPP:179). Next brick = BTPlayer MessageHandlerEntries[]
+ MessageHandlers + real DropZoneReplyMessageHandler (spawn handshake).
2. **DropZoneReply → CreatePlayerVehicle → Mech::Make** — the spawn chain pulls
in the mech subsystem (Mech::Make still Fail-staged).
1. **CreatePlayerVehicle → Mech::Make** (CURRENT FRONTIER) — the spawn chain
pulls in the whole Mech subsystem: Mech ctor + mech2/mech3/mech4, mechsub,
the subsystems (sensor, gnrator, gyro, torso, hud, myomers), and the weapons
(mechweap, ppc, gauss, projtile, missile...). Mech::Make is still Fail-staged
in MECH.CPP. This is the large game-content frontier — a major milestone, not
a single brick.
2. InitializePlayerLink, the mech-placement tail of DropZoneReply (Mech::Reset).
3. VehicleDead / Score / ScoreInflicted / ScoreUpdate handlers (scoring wave),
PlayerSimulation (console update), InitializePlayerLink, CalcInflictedScore.
PlayerSimulation (console update), CalcInflictedScore.