//===========================================================================// // File: audent.cpp // // Project: MUNGA Brick: Model Manager // // Contents: Implementation details of audio entity class // //---------------------------------------------------------------------------// // Date Who Modification // // -------- --- ---------------------------------------------------------- // // 12/20/95 ECH Initial coding. // //---------------------------------------------------------------------------// // Copyright (C) 1995, Virtual World Entertainment, Inc. // // All Rights reserved worldwide // // This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL // //===========================================================================// #include #pragma hdrstop #if !defined(AUDENT_HPP) # include #endif #if !defined(JMOVER_HPP) # include #endif #if !defined(APP_HPP) #include #endif #if !defined(HOSTMGR_HPP) #include #endif //############################################################################# //########################### AudioEntity ############################### //############################################################################# //############################################################################# // Shared Data Support // Derivation AudioEntity::ClassDerivations( Explosion::ClassDerivations, "AudioEntity" ); AudioEntity::SharedData AudioEntity::DefaultData( AudioEntity::ClassDerivations, AudioEntity::MessageHandlers, AudioEntity::AttributeIndex, 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(ClassDerivations)) { 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::ClassDerivations)); 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) { }