Files
TeslaRel410/CODE/RP/MUNGA/AUDENT.CPP
T
CydandClaude Fable 5 fdd9ac9d97 Initial import: Tesla Release 4.10 (Tesla:BattleTech & Tesla:Red Planet)
Archival snapshot of the Virtual World Entertainment Tesla cockpit
software, 1994-1996: MUNGA engine and L4 pod layer source (Borland
C++ 5.0), BT/RP game code, and game content (models, audio, maps,
gauges, Division renderer data). Includes third-party libraries:
Division dVS/DPL graphics, HMI SOS audio, WATTCP networking.

Files are preserved byte-for-byte (.gitattributes disables all
line-ending conversion). README.md documents the layout, target
hardware, and toolchain.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 13:21:58 -05:00

204 lines
5.5 KiB
C++

//===========================================================================//
// 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 <munga.hpp>
#pragma hdrstop
#if !defined(AUDENT_HPP)
# include <audent.hpp>
#endif
#if !defined(JMOVER_HPP)
# include <jmover.hpp>
#endif
#if !defined(APP_HPP)
#include <app.hpp>
#endif
#if !defined(HOSTMGR_HPP)
#include <hostmgr.hpp>
#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)
{
}