//===========================================================================// // File: btl4grnd.cpp // // Project: BattleTech Brick: Gauge Renderer Manager // // Contents: BTL4GaugeRenderer -- the BT cockpit gauge renderer // //---------------------------------------------------------------------------// // Copyright (C) 1995, Virtual World Entertainment, Inc. // // All Rights reserved worldwide // // This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL // //===========================================================================// // // RECONSTRUCTED against the authentic surviving BTL4GRND.HPP (5 members, no // data -- all state inherited). Binary anchors: ctor @004cbea0 (vtable // 0051cebc), dtor @004cbf40, TestInstance @004cbf90, NotifyOfNew @004cbfa0, // NotifyOfBecoming @004cc028; the BT registration table @0051c910. // #include #pragma hdrstop #if !defined(BTL4GRND_HPP) # include #endif #if !defined(BTL4GAUG_HPP) # include #endif #if !defined(BTL4GAU2_HPP) # include #endif #if !defined(BTL4GAU3_HPP) # include #endif #if !defined(BTL4RDR_HPP) # include #endif #if !defined(L4WRHOUS_HPP) # include #endif #if !defined(L4LAMP_HPP) # include #endif #if !defined(APP_HPP) # include #endif #if !defined(MOVER_HPP) # include #endif #if !defined(TERRAIN_HPP) # include #endif #if !defined(RESOURCE_HPP) # include #endif // //############################################################################# // The BT gauge primitive registry (.data @0051c910): every L4GAUGE.CFG // keyword the BT cockpit adds, chained onto the engine L4MethodDescription // table so unmatched keywords (bgPixelMap / numeric / rankAndScore / ...) // fall through to the base widgets. The CHAIN entry MUST stay LAST, and // every listed methodDescription's Make must be real code -- the // interpreter assigns opcodes by flattened table index and calls Make at // Interpret time. //############################################################################# // extern MethodDescription *L4MethodDescription[]; static MethodDescription BTL4ChainToPrevious = METHOD_DESCRIPTION_CHAIN(L4MethodDescription); MethodDescription *BTL4MethodDescription[] = { &ColorMapperHeat::methodDescription, // "cmHeat" &HeadingPointer::methodDescription, // "headingPointer" &ColorMapperArmor::methodDescription, // "cmArmor" &ColorMapperMultiArmor::methodDescription, // "colorMapperMultiArmor" &ColorMapperCritical::methodDescription, // "cmCrit" &VertTwoPartBar::methodDescription, // "vertBar" &SegmentArcRatio::methodDescription, // "segmentArcRatio" &OneOfSeveralPixInt::methodDescription, // "oneOfSeveralPixInt" &MapDisplay::methodDescription, // "map" &PlayerStatus::methodDescription, // "PlayerStatus" &VehicleSubSystems::methodDescription, // "vehicleSubSystems" &BitMapInverseWipe::methodDescription, // "LeakGauge" &VertNormalSlider::methodDescription, // "vertNormalSlider" &PilotList::methodDescription, // "pilotList" &GeneratorCluster::methodDescription, // "GeneratorCluster" &SectorDisplay::methodDescription, // "sectorDisplay" &PrepEngrScreen::methodDescription, // "prepEngr" &MessageBoard::methodDescription, // "messageBoard" &BTL4ChainToPrevious }; // //############################################################################# // Construction (binary @004cbea0): the lamp manager, the warehouse, then // the configuration build -- BuildConfigurationFile parses the ENTIRE // gauge\l4gauge.cfg to bytecode against the registry and immediately runs // the cfg's `Initialization` procedure (ports / global gauges, entity == // NULL). The per-mech gauges instantiate later via ConfigureForModel // ("Init") from MakeViewpointEntity. //############################################################################# // BTL4GaugeRenderer::BTL4GaugeRenderer(): L4GaugeRenderer() { Check(this); lampManager = new L4LampManager( (LBE4ControlsManager *)application->GetControlsManager()); Register_Object(lampManager); warehousePointer = new L4Warehouse(); Register_Object(warehousePointer); BuildConfigurationFile("gauge\\l4gauge.cfg", BTL4MethodDescription); Check_Fpu(); } // //############################################################################# // Destruction (binary @004cbf40): remove every gauge BEFORE the warehouse // dies (gauge dtors release warehouse resources). //############################################################################# // BTL4GaugeRenderer::~BTL4GaugeRenderer() { Check(this); Remove(0); if (warehousePointer != NULL) { Unregister_Object(warehousePointer); delete warehousePointer; warehousePointer = NULL; } } Logical BTL4GaugeRenderer::TestInstance() const { return True; } // //############################################################################# // The radar feed (binary @004cbfa0 / @004cc028): an interesting entity with // a gauge-image (pip) resource joins the moving (Mover) or static (Terrain) // list; everything ALWAYS chains to the base (the engine forwards the // notification to every live gauge -- "all descendents MUST chain back"). //############################################################################# // void BTL4GaugeRenderer::NotifyOfNewInterestingEntity(Entity *entity) { Check(this); Check(entity); ResourceDescription *pip = application->GetResourceFile()->SearchList( entity->GetResourceID(), ResourceDescription::GaugeImageStreamResourceType ); if (pip != NULL) { if (entity->IsDerivedFrom(Mover::ClassDerivations)) { movingEntities.Add(entity); } else if (entity->IsDerivedFrom(Terrain::ClassDerivations)) { staticEntities.Add(entity); } } L4GaugeRenderer::NotifyOfNewInterestingEntity(entity); } void BTL4GaugeRenderer::NotifyOfBecomingUninterestingEntity(Entity *entity) { Check(this); Check(entity); ResourceDescription *pip = application->GetResourceFile()->SearchList( entity->GetResourceID(), ResourceDescription::GaugeImageStreamResourceType ); if (pip != NULL) { if (entity->IsDerivedFrom(Mover::ClassDerivations)) { movingEntities.Remove(entity); } else if (entity->IsDerivedFrom(Terrain::ClassDerivations)) { staticEntities.Remove(entity); } } L4GaugeRenderer::NotifyOfBecomingUninterestingEntity(entity); }