Files
TeslaRel410/restoration/source410/MUNGA/SCNROLE.CPP
T
CydandClaude Fable 5 5b35eb973c 4.10 reconstruction: BTL4OPT.EXE links clean and BOOTS to the first staged brick
The reconstructed tree now produces a runnable binary with the authentic
1995 toolchain (BC4.52 / tlink32 / DPMI32):

- BTL4.CPP main TU reconstructed from the 4.11 Ghidra decomp (FUN_0040109c)
  + the 4.10 binary's own string pool + surviving RPL4TOOL.CPP house style;
  probe_main.cpp scaffold retired (BTL4.NOTES.md documents every decoded call)
- L4NET.CPP staged: L4NetworkManager ctor/dtor + 10 vtable-pulled virtuals
  (standalone-benign ones no-op, network ones Fail loudly) + NetNub client
  globals (Net_Common_Ptr=NULL routes L4File to its plain-DOS path)
- build410.sh: libs now built in the AUTHENTIC makefile member order
  (MUNGA.MAK / mungal4.mak / BT.MAK / BTL4.MAK). Order is load-bearing:
  tlink emits static-init records in module pull order, and alphabetical
  order booted into a null-vptr crash (IcomManager::ClassDerivations
  constructing before parent NetworkClient::ClassDerivations). Also fixed
  stage_link to the proven 32-bit lib set (SOSDBXC+SOSMBXC, no WATTCPLG)
- BOXTREE.HPP MemoryBlock unify, BTL4GRND notify stubs, remaining engine
  backfills (audio/gauge/resource/stream TUs) that closed the deep ledger

Smoke test (DOSBox-X + 32RTM, copy of the pod BT tree, our exe swapped in):
  BattleTech v4.10
  BTL4Application::BTL4Application
  l4net.cpp(22): L4NetworkManager -- l4net.cpp not yet reconstructed
Static init, main, -egg parse, BTL4.RES load (version 1.0.6 check passes),
ApplicationManager and the BTL4Application ctor chain all execute real
reconstructed code; boot halts at the first staged Fail() as designed.
Next brick: the real l4net.cpp body.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-19 19:05:53 -05:00

244 lines
5.3 KiB
C++

# if !defined(MUNGA_HPP)
# include <munga.hpp>
# endif
#pragma hdrstop
# if !defined(SCNROLE_HPP)
# include <scnrole.hpp>
# endif
# if !defined(APP_HPP)
# include <app.hpp>
# endif
# if !defined(NOTATION_HPP)
# include <notation.hpp>
# endif
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
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;
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;
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
)
)
{
cerr << model_name << "Missing KillBonus" << endl;
Dump_And_Die:
if (!model)
{
Unregister_Pointer(local_model);
delete local_model;
}
return -1;
}
if(
!model_file->GetEntry(
"gamedata",
"DamageReceivedModifier",
&local_model->damageReceivedModifier
)
)
{
cerr << model_name << "Missing DamageReceivedModifier" << endl;
goto Dump_And_Die;
}
if(
!model_file->GetEntry(
"gamedata",
"DamageInflictedModifier",
&local_model->damageInflictedModifier
)
)
{
cerr << model_name << "Missing DamageInflictedModifier" << endl;
goto Dump_And_Die;
}
if(
!model_file->GetEntry(
"gamedata",
"ReturnFromDeath",
&local_model->returnFromDeath
)
)
{
cerr << model_name << "Missing ReturnFromDeath" << endl;
goto Dump_And_Die;
}
if(
!model_file->GetEntry(
"gamedata",
"DamageBias",
&local_model->damageBias
)
)
{
cerr << model_name << "Missing DamageBias" << endl;
goto Dump_And_Die;
}
if(
!model_file->GetEntry(
"gamedata",
"FriendlyFirePenalty",
&local_model->friendlyFirePenalty
)
)
{
cerr << model_name << "Missing FriendlyFirePenalty" << 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;
}
}