The tlink32 campaign after the checkpoint: eleven engine bodies back-dated from BT412 (rotation player team explode dropzone terrain cultural receiver subsystm app l4gauge - the Application core included), the WinTesla-ectomy handled by backdate.py's new unwrap rules (accessor-fn statics -> 1995 static objects, decl rewrites, pointer->reference Derivation ctor, 2007 windowed- gauge/console-marshal/idle-pump excisions), staged statics TUs opened for the game classes (MECH/BTPLAYER/BTDIRECT/PROJTILE/MISSILE/BTL4MPPR .CPP + L4APP/ NETWORK engine statics). State: every compiled symbol short of the shallow graph RESOLVED (the 52- and 17-symbol ledgers burned to zero); with 32stub.exe in place the linker reaches full vtable closure and emits the deep ledger (~210 symbols, UNRESOLVED- LEDGER.txt): remaining engine bodies (objstrm cstr gauge/gaugrend graphics pixelmap palette resfile ray scnrole explosion-table), the DOS driver extern layer (_SVGA*/_PCSerial*/_PCSPAK*/joystick/netnub/sosMIDI), the full L4App body, and the real game-TU frontier (Mech::Make et al.). Recipe proven for every category. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
306 lines
7.9 KiB
C++
306 lines
7.9 KiB
C++
# if !defined(MUNGA_HPP)
|
|
# include <munga.hpp>
|
|
# endif
|
|
#pragma hdrstop
|
|
|
|
# if !defined(TERRAIN_HPP)
|
|
# include <terrain.hpp>
|
|
# endif
|
|
# if !defined(BOXSOLID_HPP)
|
|
# include <boxsolid.hpp>
|
|
# endif
|
|
# if !defined(APP_HPP)
|
|
# include <app.hpp>
|
|
# endif
|
|
# if !defined(INTEREST_HPP)
|
|
# include <interest.hpp>
|
|
# endif
|
|
|
|
//#############################################################################
|
|
//############################### Terrain #################################
|
|
//#############################################################################
|
|
|
|
//#############################################################################
|
|
// Shared Data Support
|
|
//
|
|
Derivation
|
|
Terrain::ClassDerivations(Entity::ClassDerivations, "Terrain");
|
|
|
|
Terrain::SharedData
|
|
Terrain::DefaultData(
|
|
Terrain::ClassDerivations,
|
|
Terrain::MessageHandlers,
|
|
Terrain::AttributeIndex,
|
|
Terrain::StateCount,
|
|
(Entity::MakeHandler)Terrain::Make
|
|
);
|
|
|
|
//#############################################################################
|
|
// Attribute Support
|
|
//
|
|
const Terrain::IndexEntry
|
|
Terrain::AttributePointers[]=
|
|
{
|
|
{
|
|
Terrain::LocalScaleAttributeID,
|
|
"LocalScale",
|
|
(Entity::AttributePointer)&Terrain::localScale
|
|
}
|
|
};
|
|
|
|
Terrain::AttributeIndexSet
|
|
Terrain::AttributeIndex(ELEMENTS(Terrain::AttributePointers),
|
|
Terrain::AttributePointers,
|
|
Entity::AttributeIndex
|
|
);
|
|
|
|
//#############################################################################
|
|
// Construction and Destruction
|
|
//
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
//
|
|
Terrain::Terrain(
|
|
Terrain::MakeMessage *creation_message,
|
|
Terrain::SharedData &virtual_data
|
|
):
|
|
Entity(creation_message, virtual_data)
|
|
{
|
|
localScale = creation_message->localScale;
|
|
SetValidFlag();
|
|
|
|
//
|
|
//---------------------------------------------------------------------
|
|
// For now, load in the collision resources into the tree pointed to by
|
|
// this resource
|
|
//---------------------------------------------------------------------
|
|
//
|
|
ResourceFile *res_file = application->GetResourceFile();
|
|
Check(res_file);
|
|
ResourceDescription *res =
|
|
res_file->SearchList(
|
|
resourceID,
|
|
ResourceDescription::BoxedSolidStreamResourceType
|
|
);
|
|
|
|
collisionVolumes = NULL;
|
|
if (res)
|
|
{
|
|
Check(res);
|
|
res->Lock();
|
|
InterestManager *interest_mgr =
|
|
application->GetInterestManager();
|
|
Check(interest_mgr);
|
|
InterestZone *zone =
|
|
interest_mgr->GetInterestZone(interestZoneID);
|
|
Check(zone);
|
|
BoxedSolidTree* tree = zone->GetCollisionRoot();
|
|
Check(tree);
|
|
BoxedSolidResource* solids =
|
|
(BoxedSolidResource*)res->resourceAddress;
|
|
int size = res->resourceSize / sizeof(BoxedSolidResource);
|
|
Dump(localOrigin);
|
|
while (size--)
|
|
{
|
|
//
|
|
// Don't forget about scaling...
|
|
//
|
|
BoxedSolidResource rot_box;
|
|
rot_box.Instance(*solids,localOrigin);
|
|
collisionVolumes =
|
|
BoxedSolid::MakeBoxedSolid(&rot_box, this, collisionVolumes);
|
|
Register_Object(collisionVolumes);
|
|
tree->Add(collisionVolumes, rot_box.sliceExtents);
|
|
++solids;
|
|
}
|
|
res->Unlock();
|
|
}
|
|
}
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
//
|
|
Logical
|
|
Terrain::CreateMakeMessage(
|
|
MakeMessage *creation_message,
|
|
NotationFile *model_file,
|
|
const ResourceDirectories *directories
|
|
)
|
|
{
|
|
Check(creation_message);
|
|
Check(model_file);
|
|
|
|
if (!Entity::CreateMakeMessage(creation_message, model_file, directories))
|
|
{
|
|
return False;
|
|
}
|
|
|
|
creation_message->messageLength = sizeof(MakeMessage);
|
|
creation_message->classToCreate = TerrainClassID;
|
|
creation_message->instanceFlags = HermitInstance|TrappedFlag;
|
|
|
|
char *p;
|
|
if ((p = strtok(NULL, " ")) == NULL)
|
|
{
|
|
cerr << "Scale missing!\n";
|
|
return False;
|
|
}
|
|
creation_message->localScale = atof(p);
|
|
return True;
|
|
}
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
//
|
|
Terrain*
|
|
Terrain::Make(Terrain::MakeMessage *creation_message)
|
|
{
|
|
return new Terrain(creation_message);
|
|
}
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
//
|
|
Terrain::~Terrain()
|
|
{
|
|
BoxedSolid *box = collisionVolumes;
|
|
while (box)
|
|
{
|
|
BoxedSolid *next_box = box->GetNextSolid();
|
|
Unregister_Object(box);
|
|
delete box;
|
|
box = next_box;
|
|
}
|
|
}
|
|
|
|
Logical
|
|
Terrain::TestInstance() const
|
|
{
|
|
return IsDerivedFrom(ClassDerivations);
|
|
}
|
|
|
|
//#############################################################################
|
|
//######################### UnscalableTerrain ###########################
|
|
//#############################################################################
|
|
|
|
//#############################################################################
|
|
// Shared Data Support
|
|
//
|
|
Derivation
|
|
UnscalableTerrain::ClassDerivations(Terrain::ClassDerivations, "UnscalableTerrain");
|
|
|
|
|
|
UnscalableTerrain::SharedData
|
|
UnscalableTerrain::DefaultData(
|
|
UnscalableTerrain::ClassDerivations,
|
|
UnscalableTerrain::MessageHandlers,
|
|
UnscalableTerrain::AttributeIndex,
|
|
UnscalableTerrain::StateCount,
|
|
(Entity::MakeHandler)UnscalableTerrain::Make
|
|
);
|
|
|
|
//#############################################################################
|
|
// Construction and Destruction
|
|
//
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
//
|
|
UnscalableTerrain::UnscalableTerrain(
|
|
UnscalableTerrain::MakeMessage *creation_message,
|
|
UnscalableTerrain::SharedData &virtual_data
|
|
):
|
|
Entity(creation_message, virtual_data)
|
|
{
|
|
|
|
//
|
|
//---------------------------------------------------------------------
|
|
// For now, load in the collision resources into the tree pointed to by
|
|
// this resource
|
|
//---------------------------------------------------------------------
|
|
//
|
|
SetValidFlag();
|
|
ResourceFile *res_file = application->GetResourceFile();
|
|
Check(res_file);
|
|
ResourceDescription *res =
|
|
res_file->SearchList(
|
|
resourceID,
|
|
ResourceDescription::BoxedSolidStreamResourceType
|
|
);
|
|
collisionVolumes = NULL;
|
|
|
|
if (res)
|
|
{
|
|
Check(res);
|
|
res->Lock();
|
|
InterestManager *interest_mgr =
|
|
application->GetInterestManager();
|
|
Check(interest_mgr);
|
|
InterestZone *zone =
|
|
interest_mgr->GetInterestZone(interestZoneID);
|
|
Check(zone);
|
|
BoxedSolidTree* tree = zone->GetCollisionRoot();
|
|
Check(tree);
|
|
BoxedSolidResource* solids =
|
|
(BoxedSolidResource*)res->resourceAddress;
|
|
int size = res->resourceSize / sizeof(BoxedSolidResource);
|
|
while (size--)
|
|
{
|
|
BoxedSolidResource rot_box;
|
|
rot_box.Instance(*solids,localOrigin);
|
|
collisionVolumes =
|
|
BoxedSolid::MakeBoxedSolid(&rot_box, this, collisionVolumes);
|
|
Register_Object(collisionVolumes);
|
|
tree->Add(collisionVolumes, rot_box.sliceExtents);
|
|
++solids;
|
|
}
|
|
res->Unlock();
|
|
}
|
|
}
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
//
|
|
Logical
|
|
UnscalableTerrain::CreateMakeMessage(
|
|
MakeMessage *creation_message,
|
|
NotationFile *model_file,
|
|
const ResourceDirectories *directories
|
|
)
|
|
{
|
|
Check(creation_message);
|
|
Check(model_file);
|
|
|
|
if (!Entity::CreateMakeMessage(creation_message, model_file, directories))
|
|
{
|
|
return False;
|
|
}
|
|
|
|
creation_message->classToCreate = UnscalableTerrainClassID;
|
|
creation_message->instanceFlags = HermitInstance|TrappedFlag;
|
|
return True;
|
|
}
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
//
|
|
UnscalableTerrain*
|
|
UnscalableTerrain::Make(UnscalableTerrain::MakeMessage *creation_message)
|
|
{
|
|
return new UnscalableTerrain(creation_message);
|
|
}
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
//
|
|
UnscalableTerrain::~UnscalableTerrain()
|
|
{
|
|
BoxedSolid *box = collisionVolumes;
|
|
while (box)
|
|
{
|
|
BoxedSolid *next_box = box->GetNextSolid();
|
|
Unregister_Object(box);
|
|
delete box;
|
|
box = next_box;
|
|
}
|
|
}
|
|
|
|
Logical
|
|
UnscalableTerrain::TestInstance() const
|
|
{
|
|
return IsDerivedFrom(ClassDerivations);
|
|
}
|