diff --git a/restoration/source410/BT/BTPLAYER.CPP b/restoration/source410/BT/BTPLAYER.CPP index fcc9efc4..8470463e 100644 --- a/restoration/source410/BT/BTPLAYER.CPP +++ b/restoration/source410/BT/BTPLAYER.CPP @@ -35,6 +35,10 @@ # include #endif +#if !defined(DROPZONE_HPP) +# include +#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). diff --git a/restoration/source410/BT/BTPLAYER.HPP b/restoration/source410/BT/BTPLAYER.HPP index 1ec0151c..df349d32 100644 --- a/restoration/source410/BT/BTPLAYER.HPP +++ b/restoration/source410/BT/BTPLAYER.HPP @@ -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 // diff --git a/restoration/source410/BT/BTPLAYER.NOTES.md b/restoration/source410/BT/BTPLAYER.NOTES.md index 47568293..122b9435 100644 --- a/restoration/source410/BT/BTPLAYER.NOTES.md +++ b/restoration/source410/BT/BTPLAYER.NOTES.md @@ -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.