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>
75 lines
2.2 KiB
C++
75 lines
2.2 KiB
C++
//===========================================================================//
|
|
// File: scalar.hpp //
|
|
// Project: MUNGA Brick: None assigned - coding styles, etc. //
|
|
// Contents: Base information used by all MUNGA source files //
|
|
//---------------------------------------------------------------------------//
|
|
// Date Who Modification //
|
|
// -------- --- ---------------------------------------------------------- //
|
|
//---------------------------------------------------------------------------//
|
|
// Copyright (C) 1994-1995, Virtual World Entertainment, Inc. //
|
|
// PROPRIETARY AND CONFIDENTIAL //
|
|
//===========================================================================//
|
|
|
|
#if !defined(SCALAR_HPP)
|
|
# define SCALAR_HPP
|
|
|
|
# if !defined(MEMSTRM_HPP)
|
|
# include <memstrm.hpp>
|
|
# endif
|
|
|
|
# if !defined(M_PI)
|
|
# define M_PI 3.14159265358979323846
|
|
# endif
|
|
|
|
typedef float Scalar;
|
|
|
|
# define PI ((Scalar)(M_PI))
|
|
# define PI_OVER_2 ((Scalar)(M_PI/2.0))
|
|
# define PI_OVER_3 ((Scalar)(M_PI/3.0))
|
|
# define PI_OVER_4 ((Scalar)(M_PI/4.0))
|
|
# define PI_OVER_6 ((Scalar)(M_PI/6.0))
|
|
# define TWO_PI ((Scalar)(2.0*M_PI))
|
|
# define DEG_PER_RAD ((Scalar)(180.0/M_PI))
|
|
# define RAD_PER_DEG ((Scalar)(M_PI/180.0))
|
|
|
|
inline Scalar Lerp(Scalar a, Scalar b, Scalar t)
|
|
{return a*(1.0f - t) + b*t;}
|
|
inline Logical Small_Enough(Scalar x,Scalar e=SMALL)
|
|
{return fabs(x) <= e;}
|
|
inline Logical Close_Enough(Scalar x,Scalar y,Scalar e=SMALL)
|
|
{return fabs(x-y) <= e;}
|
|
|
|
int
|
|
Round(Scalar value);
|
|
|
|
|
|
|
|
void
|
|
Find_Roots(
|
|
Scalar a, // a*x*x + b*x + c = 0
|
|
Scalar b,
|
|
Scalar c,
|
|
Scalar *center,
|
|
Scalar *range
|
|
);
|
|
|
|
inline MemoryStream&
|
|
MemoryStream_Read(
|
|
MemoryStream* stream,
|
|
Scalar *output
|
|
)
|
|
{return stream->ReadBytes(output, sizeof(*output));}
|
|
inline MemoryStream&
|
|
MemoryStream_Write(
|
|
MemoryStream* stream,
|
|
const Scalar *input
|
|
)
|
|
{return stream->WriteBytes(input, sizeof(*input));}
|
|
|
|
void
|
|
Convert_From_Ascii(const char *str, Scalar *value);
|
|
|
|
|
|
#endif
|
|
|