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>
167 lines
4.4 KiB
C++
167 lines
4.4 KiB
C++
//===========================================================================//
|
|
// File: style.hh //
|
|
// Project: MUNGA Brick: None assigned - coding styles, etc. //
|
|
// Contents: Base information used by all MUNGA source files //
|
|
//---------------------------------------------------------------------------//
|
|
// Date Who Modification //
|
|
// -------- --- ---------------------------------------------------------- //
|
|
// 10/14/94 JMA Initial coding. //
|
|
// 11/03/94 ECH Made compatible with BC4.0 //
|
|
//---------------------------------------------------------------------------//
|
|
// Copyright (C) 1994-1995, Virtual World Entertainment, Inc. //
|
|
// PROPRIETARY AND CONFIDENTIAL //
|
|
//===========================================================================//
|
|
|
|
#if !defined(STYLE_HPP)
|
|
# define STYLE_HPP
|
|
|
|
# if !defined(DEBUG_STREAM)
|
|
# define DEBUG_STREAM cout
|
|
# endif
|
|
|
|
# if !defined(Verify)
|
|
# if !defined(DEBUG_LEVEL)
|
|
# define DEBUG_LEVEL 0
|
|
# endif
|
|
# if DEBUG_LEVEL<1
|
|
# include <debugoff.hpp>
|
|
# elif DEBUG_LEVEL<2
|
|
# include <debug1on.hpp>
|
|
# elif DEBUG_LEVEL<3
|
|
# include <debug2on.hpp>
|
|
# else
|
|
# include <debug3on.hpp>
|
|
# endif
|
|
# endif
|
|
|
|
# if defined(__BCPLUSPLUS__)
|
|
extern int
|
|
_matherr(struct exception *a);
|
|
# endif
|
|
|
|
extern int
|
|
Fpu_Ok();
|
|
extern void
|
|
Verify_Failed(char *message, char *file, int line);
|
|
extern void
|
|
Fail_To_Debugger(char *message, char *file, int line);
|
|
extern void
|
|
Exit(int exit_code);
|
|
|
|
class Signature
|
|
{
|
|
private:
|
|
# if DEBUG_LEVEL>0
|
|
enum Mark
|
|
{
|
|
ok,
|
|
destroyed,
|
|
corrupted,
|
|
noMagic=(int)0xAB135795L,
|
|
magic=(int)0xFFED1231L
|
|
} mark;
|
|
# endif
|
|
|
|
protected:
|
|
Signature();
|
|
~Signature();
|
|
|
|
public:
|
|
friend int
|
|
Is_Signature_Bad(const volatile Signature *p);
|
|
};
|
|
|
|
# if defined(USE_SIGNATURE)
|
|
# define SIGNATURED : public Signature
|
|
# else
|
|
# define SIGNATURED
|
|
# define Is_Signature_Bad(p) (False)
|
|
# endif
|
|
|
|
//##########~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
//# MACROS #
|
|
//##########
|
|
|
|
# define ELEMENTS(Array) (sizeof(Array)/sizeof(*Array))
|
|
|
|
# if defined(TEST_CLASS)
|
|
# define Test(c)\
|
|
if (!(c)) {\
|
|
DEBUG_STREAM << __FILE__"(" << __LINE__ << "): "#c" failed!\07\n";\
|
|
return False;\
|
|
}
|
|
|
|
# define Test_And_Dump(c,v)\
|
|
if (!(c)) {\
|
|
DEBUG_STREAM << __FILE__"(" << __LINE__ << "): "#c" failed!\07\n";\
|
|
DEBUG_STREAM << __FILE__"(" << __LINE__ << "): "#v" = " << (v) << '\n';\
|
|
return False;\
|
|
}
|
|
|
|
# define Test_Message(m)\
|
|
(DEBUG_STREAM << m)
|
|
|
|
# define Test_Branch_On()\
|
|
Fail("First visit of branch")
|
|
# define Test_Branch_Off()
|
|
|
|
# else
|
|
# define Test(c)
|
|
# define Test_And_Dump(c,v)
|
|
# define Test_Message(m)
|
|
# endif
|
|
|
|
# if defined(__sgi__)
|
|
# define stricmp(s1, s2) (strcasecmp(s1, s2))
|
|
# define strnicmp(s1, s2, n) (strncasecmp(s1, s2, n))
|
|
# endif
|
|
|
|
//################~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
//# ENUMERATIONS #
|
|
//################
|
|
|
|
enum {
|
|
False = 0,
|
|
True = 1
|
|
};
|
|
|
|
//###########~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
//# CASTING #
|
|
//###########
|
|
|
|
# define SKIPPY_CAST(Type,var) (*((Type*)&(var)))
|
|
|
|
//#############~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
//# TEMPLATES #
|
|
//#############
|
|
|
|
# define SMALL (1e-4f)
|
|
|
|
# define Abs(value) ((value>0) ? value : -value)
|
|
# define Clamp(v,f,c) (v = ((v<f) ? f : ((v>c) ? c : v)))
|
|
# define Max_Clamp(v,c) (v = ((v>c) ? c : v))
|
|
# define Is_Many_Bits(value) (Lowbit(value)^value)
|
|
# define Low_Bit(value) (value & (-value))
|
|
# define Min_Clamp(v,f) (v = ((v<f) ? f : v))
|
|
# define Max(a,b) ((a>b) ? a : b)
|
|
# define Min(a,b) ((a<b) ? a : b)
|
|
# define Sgn(value) ((value<-SMALL) ? -1 : value>SMALL)
|
|
|
|
//############~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
//# TYPEDEFS #
|
|
//############
|
|
|
|
typedef int Logical; // machine dependant zero/not-zero
|
|
typedef unsigned char Byte; // 8 bits unsigned
|
|
typedef unsigned short Word; // 16 bits unsigned
|
|
typedef unsigned long LWord; // 32 bits unsigned
|
|
|
|
typedef int Enumeration;
|
|
|
|
# if !defined(HEAP_HPP)
|
|
# include <heap.hpp>
|
|
# endif
|
|
|
|
#endif
|
|
|