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>
145 lines
3.8 KiB
Plaintext
145 lines
3.8 KiB
Plaintext
//==========================================================================//
|
|
// File: gauge.tst //
|
|
// Project: MUNGA Brick: Gauge module //
|
|
// Contents: Test code for gauge classes //
|
|
//--------------------------------------------------------------------------//
|
|
// Date Who Modification //
|
|
// -------- --- ----------------------------------------------------------//
|
|
// 02/10/95 CPB Initial coding. //
|
|
//--------------------------------------------------------------------------//
|
|
// Copyright (C) 1995, Virtual World Entertainment, Inc. //
|
|
// All Rights reserved worldwide //
|
|
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL //
|
|
//==========================================================================//
|
|
|
|
class FakeGauge :
|
|
public Gauge
|
|
{
|
|
public:
|
|
FakeGauge(GaugeRenderer *renderer, unsigned int owner_ID);
|
|
~FakeGauge();
|
|
|
|
void
|
|
Execute();
|
|
|
|
Scalar
|
|
myScalar;
|
|
};
|
|
|
|
FakeGauge::FakeGauge(GaugeRenderer *renderer, unsigned int owner_ID) :
|
|
Gauge((GaugeRate) gaugeRate_A, (ModeMask) -1L, renderer, owner_ID)
|
|
{
|
|
myScalar = 0.0f;
|
|
}
|
|
|
|
FakeGauge::~FakeGauge()
|
|
{
|
|
}
|
|
|
|
void
|
|
FakeGauge::Execute()
|
|
{
|
|
myScalar = 2.0f;
|
|
}
|
|
|
|
//
|
|
//###########################################################################
|
|
//###########################################################################
|
|
//
|
|
Logical
|
|
Gauge::TestClass()
|
|
{
|
|
#if 0
|
|
Tell("Starting Gauge test...\n");
|
|
unsigned int fakeOwnerID(1);
|
|
|
|
//
|
|
//--------------------------------------------------------
|
|
// Test GaugeConnectionDirectOf...
|
|
//--------------------------------------------------------
|
|
//
|
|
{
|
|
Scalar scalar1(0.0);
|
|
Scalar scalar2(1.5f);
|
|
//
|
|
// Create a GaugeConnection
|
|
//
|
|
GaugeConnectionDirectOf<Scalar> *instance1;
|
|
instance1 = new GaugeConnectionDirectOf<Scalar>(0, &scalar2, &scalar1);
|
|
Check(instance1);
|
|
Register_Object(instance1);
|
|
//
|
|
// Try it out
|
|
//
|
|
instance1->Update();
|
|
Test(scalar2 == 0.0f);
|
|
//
|
|
// Destroy it
|
|
//
|
|
Unregister_Object(instance1);
|
|
delete instance1;
|
|
}
|
|
//
|
|
//--------------------------------------------------------
|
|
// Test Gauge
|
|
//--------------------------------------------------------
|
|
//
|
|
{
|
|
Scalar source(1.5f);
|
|
//
|
|
// Create a gauge
|
|
//
|
|
FakeGauge testGauge(NULL, fakeOwnerID);
|
|
Check(&testGauge);
|
|
Register_Object(&testGauge);
|
|
//
|
|
// Create a connection and add it to the gauge
|
|
//
|
|
GaugeConnectionDirectOf<Scalar> *instance1;
|
|
instance1 = new GaugeConnectionDirectOf<Scalar>(
|
|
0,
|
|
&testGauge.myScalar,
|
|
&source
|
|
);
|
|
Check(instance1);
|
|
Register_Object(instance1);
|
|
|
|
testGauge.AddConnection(instance1);
|
|
#if 0
|
|
//
|
|
// See if the connection works
|
|
//
|
|
Test(testGauge.myScalar == 0.0f);
|
|
testGauge.UpdateParameters();
|
|
Test(testGauge.myScalar == 1.5f);
|
|
//
|
|
// See if Execute() occurs
|
|
//
|
|
testGauge.Execute();
|
|
Test(testGauge.myScalar == 2.0f);
|
|
//
|
|
// Remove the connection, and ensure that the value doesn't change
|
|
//
|
|
testGauge.RemoveConnection(0);
|
|
source = 3.0f;
|
|
testGauge.UpdateParameters();
|
|
Test(testGauge.myScalar == 2.0f);
|
|
#endif
|
|
//
|
|
// Everything seems ok! Unregister the gauge and delete it
|
|
// Note that RemoveConnection should have deleted the GaugeConnection.
|
|
// If it didn't, we'll hear about it when we check the
|
|
// remaining registered objects.
|
|
//
|
|
Unregister_Object(&testGauge);
|
|
}
|
|
//
|
|
//--------------------------------------------------------
|
|
// Return test result
|
|
//--------------------------------------------------------
|
|
//
|
|
#endif
|
|
return True;
|
|
}
|
|
|