//===========================================================================// // File: messmgr.hh // // Project: BattleTech // // Contents: Consolidates Messages from Subsystems and Graphics Generation // //---------------------------------------------------------------------------// // Date Who Modification // // -------- --- ---------------------------------------------------------- // // 09/30/95 JM Initial coding. // //---------------------------------------------------------------------------// // Copyright (C) 1995, Virtual World Entertainment, Inc. All Rights reserved // // PROPRIETARY AND CONFIDENTIAL // //===========================================================================// #if !defined (MESSMGR_HPP) # define MESSMGR_HPP #if !defined (SUBSYSTM_HPP) # include #endif #if !defined (RESOURCE_HPP) # include #endif #if !defined (VCHAIN_HPP) # include #endif #if !defined (PLUG_HPP) # include #endif #if !defined(ENTITYID_HPP) # include #endif class Entity; class Mech; class Entity__TakeDamageMessage; //########################################################################## //########## SubsystemMessageManager::SubsystemResource ############### //########################################################################## struct SubsystemMessageManager__SubsystemResource : public Subsystem::SubsystemResource { ResourceDescription::ResourceID terrainHitExplosionID; Scalar rendererCompensateTime; }; //########################################################################## //##################### SubsystemMessageManager ################### //########################################################################## class SubsystemMessageManager : public Subsystem { //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Shared Data Support // public: static Derivation ClassDerivations; static SharedData DefaultData; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Death and Damage Support // public: void DeathReset(Logical) {} //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Model Support // protected: struct CommonDamageInformation { Entity *entityHit; int damageZoneIndex; Point3D impactPoint; } commonDamageInformation; public: struct DamageInformation : public Plug { Enumeration damageType; int subsystemID; }; typedef void (SubsystemMessageManager::*Performance)(Scalar time_slice); void SetPerformance(Performance performance) { Check(this); activePerformance = (Simulation::Performance)performance; } void ConsolidateAndSendDamage(Scalar time_slice); Mech* GetEntity() {Check(this); return Cast_Object(Mech*, Subsystem::GetEntity());} protected: Scalar rendererCompensateTime; typedef PlugOf ResourceIDPlug; VChainOf weaponExplosions; VChainOf damageInformation; ResourceDescription::ResourceID terrainHitExplosionID; void CreateWeaponExplosions( Logical terrain_hit, EntityID entity_hit, Point3D explode_position ); public: void AddDamageMessage( Entity *damaged_entity, Entity__TakeDamageMessage *message ); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Construction and Destruction Support // public: typedef SubsystemMessageManager__SubsystemResource SubsystemResource; SubsystemMessageManager( Mech *owner, int subsystem_ID, SubsystemResource *sub_res, SharedData &shared_data=DefaultData ); ~SubsystemMessageManager(); Logical TestInstance() const; static Logical CreateStreamedSubsystem( ResourceFile *resource_file, NotationFile *model_file, const char *model_name, const char *subsystem_name, SubsystemResource *subsystem_resource, NotationFile *subsystem_file, const ResourceDirectories *directories ); }; #endif