#include "munga.h" #pragma hdrstop #include "audent.h" #include "jmover.h" #include "app.h" #include "hostmgr.h" //############################################################################# //########################### AudioEntity ############################### //############################################################################# //############################################################################# // Shared Data Support // Derivation* AudioEntity::GetClassDerivations() { static Derivation classDerivations(Explosion::GetClassDerivations(), "AudioEntity"); return &classDerivations; } AudioEntity::SharedData AudioEntity::DefaultData( AudioEntity::GetClassDerivations(), AudioEntity::GetMessageHandlers(), AudioEntity::GetAttributeIndex(), AudioEntity::StateCount, (Entity::MakeHandler)AudioEntity::Make ); // //############################################################################# //############################################################################# // AudioEntity::AudioEntity( AudioEntity::MakeMessage *creation_message, AudioEntity::SharedData &shared_data ): Explosion(creation_message, shared_data), parentEntitySocket(NULL) { Check_Pointer(this); Check_Pointer(creation_message); // // Get the parent entity // Entity *parent_entity; parent_entity = application->GetHostManager()->GetEntityPointer( creation_message->parentEntityID ); if (parent_entity != NULL) { parentEntitySocket.Add(parent_entity); parentEntitySegment = creation_message->parentEntitySegment; } else { parentEntitySegment = NULL; } // // Set simulation // SetPerformance(&AudioEntity::AudioEntitySimulation); SetValidFlag(); } // //############################################################################# //############################################################################# // AudioEntity::~AudioEntity() { } // //############################################################################# //############################################################################# // Logical AudioEntity::TestInstance() const { if (!IsDerivedFrom(*GetClassDerivations())) { return False; } Check(&parentEntitySocket); if (parentEntitySegment != NULL) { Check(parentEntitySegment); } return True; } // //############################################################################# //############################################################################# // AudioEntity* AudioEntity::Make(AudioEntity::MakeMessage *creation_message) { return new AudioEntity(creation_message); } // //############################################################################# //############################################################################# // void AudioEntity::AudioEntitySimulation(Scalar time_slice) { Check(this); // // Get the parent entity, if it does not exist, condemn to death row // Entity *parent_entity; if ((parent_entity = parentEntitySocket.GetCurrent()) == NULL) { CondemnToDeathRow(); return; } // // Get the orign of the parent entities segment // JointedMover *jointed_mover; Verify(parent_entity->IsDerivedFrom(JointedMover::GetClassDerivations())); jointed_mover = Cast_Object(JointedMover*, parent_entity); Check(jointed_mover); Check(parentEntitySegment); jointed_mover->GetSegmentToWorld( *parentEntitySegment, &localToWorld ); // // Set the origin of this entity // localOrigin = localToWorld; updateOrigin = localOrigin; // // Call inherited simulation // Explosion::ExplosionSimulation(time_slice); } //############################################################################# //##################### AudioEntity__MakeMessage ######################## //############################################################################# AudioEntity__MakeMessage::AudioEntity__MakeMessage( ResourceDescription::ResourceID resource_ID, Entity *parent_entity, EntitySegment *parent_entity_segment ): Explosion::MakeMessage( AudioEntity::MakeMessageID, sizeof(AudioEntity__MakeMessage), RegisteredClass::AudioEntityClassID, EntityID::Null, resource_ID, Entity::HermitInstance|Entity::DynamicFlag, parent_entity->localOrigin, parent_entity->GetEntityID(), EntityID::Null ), parentEntityID(parent_entity->GetEntityID()), parentEntitySegment(parent_entity_segment) { }