Files
BT411/engine/MUNGA/SCNROLE.cpp
T
Joe DiPrimaandClaude Fable 5 1efe8efc68 #118 tails: death score cost + the DeathWithoutHonor console notice
* SpecialCaseDeathPenalty restored to the engine ScenarioRole (SCNROLE.h/
  .cpp) -- the 4.10-only role field the 2007 WinTesla source dropped
  (record slot [1] after KillBonus, fail-hard read; role+0x20; the
  DefaultRendererRate pattern). Its consumer decoded from the @004c05c4
  export gap (@004c07cd, missing from the #52 reconstruction): every
  death with advancedDamageOn hands the ENGINE base ScoreMessageHandler
  (@0042da20 == PLAYER.cpp:138, a DIRECT call bypassing the BT type
  Verifies) a type-1 award of -penalty. Wired verbatim. Shipped content
  authors the key nowhere -> cost 0 in the field. NUANCE [T4]: the 1995
  engine adds at Player+0x1c8, which no BT scoreboard reads (+0x278) --
  the pod's cost may never have displayed; our single-cell port shows it.

* The eject console notice: FUN_004c198c IS the
  ConsolePlayerMechDeathWithoutHonorMessage ctor (T0 BTCNSL.CPP survives
  and is compiled) -- "death without honor" is the punch-out record.
  BTPlayerEjectBookkeeping now sends it to the console host through the
  same ConsoleClientID path as the VTVDamaged notify, then latches
  suppressConsole: the eject notice REPLACES the death notify. Verified
  two-node: "notice -> console host 1" fires on the ejecting node; the
  relay-side delivery of client-5 traffic is a pre-existing question
  shared with the never-observed VTVDamaged sibling (operator-console
  workstream).

* Eject alarm-10 audio: resolved NEGATIVE -- the five Eject*.wav ship in
  AUDIO/ but BTL4.RES references them nowhere (orphaned like the SQUAT
  clips); wiring them would be a stand-in. Operator-optional deviation.

* RIO 0x38 panic control: deferred with the plumbing documented (the
  glass Flight-Controls window already renders the 0x38 bank; consumer =
  read buttonGroup[ButtonPanic] alongside the binding-engine edge) --
  pod-hardware-only, untestable on this bench.

Two-node verify (fresh-exe rerun after a stale-exe trap): REFUSED
healthy, PUNCH-OUT after generator kill, death + wreck swap + smoke +
un-wreck warp all replicated on the observer, respawned mech refuses
again, console notice fired.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-02 17:12:48 -05:00

252 lines
5.5 KiB
C++

#include "munga.h"
#pragma hdrstop
#include "scnrole.h"
#include "app.h"
#include "notation.h"
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
ScenarioRole::ScenarioRole(const CString &role_name)
{
damageReceivedModifier = 0.0f;
damageInflictedModifier = 0.0f;
damageBias = 0.0f;
friendlyFirePenalty = 0.0f;
killBonus = 0.0f;
roleName = role_name;
returnFromDeath = 0;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
ScenarioRole::ScenarioRole(const CString &role_name, const CString &model_file)
{
Check_Pointer(&role_name);
Check_Pointer(&model_file);
roleName = role_name;
//
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Truncate the Role:: from roleName
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
ResourceFile
*res = application->GetResourceFile();
ResourceDescription
*player_res_des;
player_res_des = res->FindResourceDescription(
model_file,
ResourceDescription::GameModelResourceType
);
if (player_res_des)
{
player_res_des->Lock();
ModelResource
*player_data = (ModelResource *)player_res_des->
resourceAddress;
killBonus = player_data->killBonus;
specialCaseDeathPenalty = player_data->specialCaseDeathPenalty; // BT 4.10 (restored)
returnFromDeath = player_data->returnFromDeath;
damageReceivedModifier = player_data->damageReceivedModifier;
damageInflictedModifier = player_data->damageInflictedModifier;
damageBias = player_data->damageBias;
friendlyFirePenalty = player_data->friendlyFirePenalty;
player_res_des->Unlock();
}
else
{
Tell(role_name);
Warn(" does not exists in resource! ");
damageReceivedModifier = 0.0f;
damageInflictedModifier = 0.0f;
damageBias = 0.0f;
friendlyFirePenalty = 0.0f;
killBonus = 0.0f;
specialCaseDeathPenalty = 0.0f; // BT 4.10 (restored)
returnFromDeath = 0;
}
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
Scalar
ScenarioRole::CalcDamageReceivedScore(const Scalar &damage_received)
{
Check(this);
// ]
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Calculate modified score for the player receiving damage
// damageReceived * damageReceivedModifier
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
Check(this);
Check_Fpu();
return -(damage_received * GetDamageReceivedModifier());
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
ScenarioRole::~ScenarioRole()
{
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
ResourceDescription::ResourceID
ScenarioRole::CreateModelResource(
#if DEBUG_LEVEL>0
ResourceFile *resource_file,
const char* model_name,
NotationFile * model_file,
const ResourceDirectories *directories,
ModelResource *model
#else
ResourceFile *resource_file,
const char* model_name,
NotationFile * model_file,
const ResourceDirectories *,
ModelResource *model
#endif
)
{
Check(resource_file);
Check_Pointer(model_name);
Check_Pointer(directories);
//
// If we were not provided a buffer to write the model data into, we must
// create it ourselves. Then make sure that the model stuff is read in
//
ModelResource *local_model = model;
if (!local_model)
{
local_model = new ModelResource;
Register_Pointer(local_model);
}
//----------------------------------------
// Read in the data from notation file
//----------------------------------------
//
// Get PointValue assigned to this ScoreZone
//
if(
!model_file->GetEntry(
"gamedata",
"KillBonus",
&local_model->killBonus
)
)
{
std::cerr << model_name << "Missing KillBonus" << std::endl;
Dump_And_Die:
if (!model)
{
Unregister_Pointer(local_model);
delete local_model;
}
return -1;
}
// BT 4.10: read right after KillBonus, fail-hard like every other key
// (binary role reader @00429bec, dest = record slot [1]).
if(
!model_file->GetEntry(
"gamedata",
"SpecialCaseDeathPenalty",
&local_model->specialCaseDeathPenalty
)
)
{
std::cerr << model_name << "Missing SpecialCaseDeathPenalty" << std::endl;
goto Dump_And_Die;
}
if(
!model_file->GetEntry(
"gamedata",
"DamageReceivedModifier",
&local_model->damageReceivedModifier
)
)
{
std::cerr << model_name << "Missing DamageReceivedModifier" << std::endl;
goto Dump_And_Die;
}
if(
!model_file->GetEntry(
"gamedata",
"DamageInflictedModifier",
&local_model->damageInflictedModifier
)
)
{
std::cerr << model_name << "Missing DamageInflictedModifier" << std::endl;
goto Dump_And_Die;
}
if(
!model_file->GetEntry(
"gamedata",
"ReturnFromDeath",
&local_model->returnFromDeath
)
)
{
std::cerr << model_name << "Missing ReturnFromDeath" << std::endl;
goto Dump_And_Die;
}
if(
!model_file->GetEntry(
"gamedata",
"DamageBias",
&local_model->damageBias
)
)
{
std::cerr << model_name << "Missing DamageBias" << std::endl;
goto Dump_And_Die;
}
if(
!model_file->GetEntry(
"gamedata",
"FriendlyFirePenalty",
&local_model->friendlyFirePenalty
)
)
{
std::cerr << model_name << "Missing FriendlyFirePenalty" << std::endl;
goto Dump_And_Die;
}
if (!model)
{
ResourceDescription *new_res =
resource_file->AddResource(
model_name,
ResourceDescription::GameModelResourceType,
1,
ResourceDescription::Preload,
local_model,
sizeof(*local_model)
);
Unregister_Pointer(local_model);
delete local_model;
Check_Fpu();
Check(new_res);
return new_res->resourceID;
}
else
{
Check_Fpu();
return 0;
}
}