Wing Commander
Reconstructed Win32 source (1996)
Loading...
Searching...
No Matches
mathutil.c
Go to the documentation of this file.
1/**
2 * @file
3 * @ingroup data
4 * @brief Integer min and max, a packet-release helper, and the
5 * single-precision angular constants.
6 *
7 * Address range 41d0c0-41d11f. MinShort and MaxShort have 94 call sites
8 * across the game core. The constants' read-only data follows the barracks
9 * menu regions and precedes the DirectDraw GUIDs, as only a unit linked
10 * between those two can place it.
11 */
12#include "wc1.h"
13
14/* Nothing in the shipped executable references these three values. */
15const float fPi = 3.1415927410125732421875f; /* 0x004630dc */
16const float fDegreesPerRadian = 57.295780181884765625f; /* 0x004630e0 */
17const float fRadiansPerDegree = 0.01745329238474369049072265625f; /* 0x004630e4 */
18
19/* Function start: 0x41D0C0 */
20short MinShort(short a, short b)
21{
22 if (a < b)
23 return a;
24 return b;
25}
26
27/* One cockpit sizing call supplies a third argument; only the first two are read. */
28/* Function start: 0x41D0E0 */
29short MaxShort(short a, short b, ...)
30{
31 if (a > b)
32 return a;
33 return b;
34}
35
36/* Function start: 0x41D100 */
37void FreePacketAndClear(void *slot, unsigned short releaseFlags)
38{
39 void **p;
40
41 p = (void **)slot;
42 if (*p != 0) {
44 *p = 0;
45 }
46}
const float fRadiansPerDegree
Definition mathutil.c:17
const float fPi
Definition mathutil.c:15
const float fDegreesPerRadian
Definition mathutil.c:16
Umbrella header for the game core.
short MinShort(short a, short b)
Definition mathutil.c:20
void ReleasePacketHandle(void *handle)
Definition ending.c:50
short MaxShort(short a, short b,...)
Definition mathutil.c:29
void FreePacketAndClear(void *slot, unsigned short releaseFlags)
Definition mathutil.c:37