Files
RP412/MUNGA/SCALAR.h
T
CydandClaude Opus 4.8 4abbf8879f Initial import of Red Planet v4.10 Win32 source
Imports the current Win32 source for the pod-racing game 'Red Planet',
built on the MUNGA engine and its L4 (Win32/DirectX) platform layer:

- MUNGA / MUNGA_L4: cross-platform engine core and Win32 backend
- RP / RP_L4: Red Planet game logic and Win32 application
- DivLoader, Setup1: asset loader and installer project
- lib, MUNGA_L4/openal, MUNGA_L4/sos: third-party audio dependencies

Removed stale Subversion metadata and added .gitignore/.gitattributes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-30 07:59:51 -05:00

31 lines
1.1 KiB
C

#pragma once
#include <math.h>
#include "style.h"
#include "memstrm.h"
#define M_PI 3.14159265358979323846
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, 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);