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>
168 lines
4.8 KiB
C++
168 lines
4.8 KiB
C++
//===========================================================================//
|
|
// File: collorgn.cc //
|
|
// Project: MUNGA Brick: Collision //
|
|
// Contents: //
|
|
//---------------------------------------------------------------------------//
|
|
// Date Who Modification //
|
|
// -------- --- ---------------------------------------------------------- //
|
|
// 06/01/95 ECH Initial coding //
|
|
//---------------------------------------------------------------------------//
|
|
// Copyright (C) 1994, Virtual World Entertainment, Inc. //
|
|
// All Rights reserved worldwide //
|
|
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL //
|
|
//===========================================================================//
|
|
|
|
#include <munga.hpp>
|
|
#pragma hdrstop
|
|
|
|
#if !defined(COLLORGN_HPP)
|
|
# include <collorgn.hpp>
|
|
#endif
|
|
|
|
#if !defined(MOVER_HPP)
|
|
# include <mover.hpp>
|
|
#endif
|
|
|
|
#if !defined(DOORFRAM_HPP)
|
|
# include <doorfram.hpp>
|
|
#endif
|
|
|
|
//
|
|
//#############################################################################
|
|
// CollisionOrigin
|
|
//#############################################################################
|
|
//
|
|
CollisionOrigin::CollisionOrigin(InterestZoneID interest_zone_ID):
|
|
InterestOrigin(
|
|
interest_zone_ID,
|
|
CollisionInterestType,
|
|
DefaultInterestDepth
|
|
),
|
|
movingEntitySocket(NULL)
|
|
{
|
|
}
|
|
|
|
//
|
|
//#############################################################################
|
|
// ~CollisionOrigin
|
|
//#############################################################################
|
|
//
|
|
CollisionOrigin::~CollisionOrigin()
|
|
{
|
|
}
|
|
|
|
//
|
|
//#############################################################################
|
|
// TestInstance
|
|
//#############################################################################
|
|
//
|
|
Logical
|
|
CollisionOrigin::TestInstance() const
|
|
{
|
|
InterestOrigin::TestInstance();
|
|
Check(&movingEntitySocket);
|
|
return True;
|
|
}
|
|
|
|
//
|
|
//#############################################################################
|
|
// AddInterestingEntity
|
|
//#############################################################################
|
|
//
|
|
void
|
|
CollisionOrigin::AddInterestingEntity(Entity *interesting_entity)
|
|
{
|
|
Check(this);
|
|
Check(interesting_entity);
|
|
|
|
//
|
|
//--------------------------------------------------------------------------
|
|
// Make sure that we don't check against something that doesn't move
|
|
//--------------------------------------------------------------------------
|
|
//
|
|
if (interesting_entity->IsDynamic())
|
|
{
|
|
//
|
|
//-----------------------------------------------------------------------
|
|
// If it is a mover and tangible, or a door, add it to our list
|
|
//-----------------------------------------------------------------------
|
|
//
|
|
if (interesting_entity->IsDerivedFrom(Mover::ClassDerivations))
|
|
{
|
|
Mover *mover = Cast_Object(Mover*, interesting_entity);
|
|
if (mover->IsCollisionTestable())
|
|
{
|
|
movingEntitySocket.Add(interesting_entity);
|
|
}
|
|
}
|
|
else if (interesting_entity->IsDerivedFrom(DoorFrame::ClassDerivations))
|
|
{
|
|
movingEntitySocket.Add(interesting_entity);
|
|
}
|
|
}
|
|
}
|
|
|
|
//
|
|
//#############################################################################
|
|
// RemoveUninterestingEntity
|
|
//#############################################################################
|
|
//
|
|
void
|
|
CollisionOrigin::RemoveUninterestingEntity(Entity *uninteresting_entity)
|
|
{
|
|
Check(this);
|
|
Check(uninteresting_entity);
|
|
|
|
//
|
|
// HACK - ECH The following may not be a legitimate assertion
|
|
//
|
|
#if DEBUG_LEVEL>0 && 0
|
|
{
|
|
SChainIteratorOf<Mover*> iterator(&movingEntitySocket);
|
|
Verify(iterator.IsPlugMember(uninteresting_entity) == True);
|
|
}
|
|
#endif
|
|
|
|
//
|
|
// Remove from socket
|
|
//
|
|
PlugIterator iterator(uninteresting_entity);
|
|
|
|
Check(&iterator);
|
|
iterator.RemoveSocket(&movingEntitySocket);
|
|
}
|
|
|
|
//
|
|
//#############################################################################
|
|
// RemoveUninterestingEntities
|
|
//#############################################################################
|
|
//
|
|
void
|
|
CollisionOrigin::RemoveUninterestingEntities()
|
|
{
|
|
Check(this);
|
|
|
|
SChainIteratorOf<Entity*> iterator(&movingEntitySocket);
|
|
|
|
Check(&iterator);
|
|
while (iterator.GetCurrent() != NULL)
|
|
{
|
|
Check(iterator.GetCurrent());
|
|
iterator.Remove();
|
|
}
|
|
}
|
|
|
|
//~~~~~~~~~~~~~~~~~~~ CollisionOrigin__MovingEntityIterator ~~~~~~~~~~~~~~~~~~~
|
|
|
|
CollisionOrigin__MovingEntityIterator::CollisionOrigin__MovingEntityIterator(
|
|
CollisionOrigin *collision_origin
|
|
):
|
|
SChainIteratorOf<Entity*>(collision_origin->movingEntitySocket)
|
|
{
|
|
}
|
|
|
|
CollisionOrigin__MovingEntityIterator::~CollisionOrigin__MovingEntityIterator()
|
|
{
|
|
}
|
|
|