Wing Commander
Reconstructed Win32 source (1996)
Loading...
Searching...
No Matches
mathfp.c File Reference

Random numbers, fixed-point arithmetic and trigonometry computed in floating point, and text-cursor and shape-frame helpers. More...

#include "wc1.h"

Go to the source code of this file.

Functions

short RandomBelow (short n)
void __stdcall SeedRandomFromClock (int seed)
unsigned short RandomWord (void)
short __stdcall RandomInRange (short lo, short hi)
short RandomBelowOrEqual (short n)
long MultiplyFixed (int left, int right)
long DivideFixed (int numerator, int denominator)
long SinFixed (short degrees)
long CosFixed (short degrees)
long ArcSin (int value)
long ArcCos (int value)
long Magnitude (int value)
long PlanarMagnitude (int x, int y)
long Vector_magnitude (const FixedVector *vector)
void __stdcall SetTextCursor (unsigned short a, unsigned short b)
void __stdcall SetTextContext (TextContext *context)
void WaitForVerticalBlankThunk (void)
void *__stdcall IdentityHandle (void *v)
void __stdcall SetWholePaletteFromTriplets (unsigned char *palette)
unsigned short __stdcall FontHeight (const void *p)
unsigned short __stdcall GetFontCharWidth (char i)
void ReleaseVideoResourcesHook (void)
short __stdcall GetShapeFrameBounds (short *bounds, short x, short y, struct Shape *shape, short frame)
short __stdcall IsPointInRect (short x, short y, const short *rect)
void __stdcall SplitPackedPoint (ShortPoint point, short *p)
void __stdcall DrawTextString (const char *text)
void __stdcall DrawTextCharacter (char character)
void __stdcall AppendTextCharacter (char character)
int __stdcall MeasureShapeFrameStorage (struct Shape *shape, short frame)
void ResetTextCursor (void)

Variables

short nPacketDecompressPending
unsigned short wPacketDecompressInputSize
short nCurrentPacketDecompressScratchSegment
volatile int bFrameTickPendingFlag
int bMouseCursorDamagePending
int nMouseCursorDamageRight
int nEventMousePointerDamageBottom
int nSavedDosInterruptVector
short nViewportOriginPositionY
short nViewportOriginPositionX
int nTickCount60Hz
unsigned char bEscapePressedFlag
int nMouseCursorDamageLeft
int nMousePointerDamageTopValue

Detailed Description

Random numbers, fixed-point arithmetic and trigonometry computed in floating point, and text-cursor and shape-frame helpers.

Address range 434cd0-43540f. The preceding smart unit ends at chase_speed (434c70).

Definition in file mathfp.c.

Function Documentation

◆ AppendTextCharacter()

void __stdcall AppendTextCharacter ( char character)

◆ ArcCos()

◆ ArcSin()

long ArcSin ( int value)

Definition at line 101 of file mathfp.c.

References ArcSin().

Referenced by ArcSin(), PlaySfxWaveFileByNumber(), and set_ship_rotation_goals().

◆ CosFixed()

◆ DivideFixed()

◆ DrawTextCharacter()

◆ DrawTextString()

◆ FontHeight()

◆ GetFontCharWidth()

unsigned short __stdcall GetFontCharWidth ( char i)

◆ GetShapeFrameBounds()

short __stdcall GetShapeFrameBounds ( short * bounds,
short x,
short y,
struct Shape * shape,
short frame )

◆ IdentityHandle()

void *__stdcall IdentityHandle ( void * v)

Definition at line 164 of file mathfp.c.

References IdentityHandle().

Referenced by DecompressPacketSection(), IdentityHandle(), and PlaySfxWaveFileByNumber().

◆ IsPointInRect()

short __stdcall IsPointInRect ( short x,
short y,
const short * rect )

◆ Magnitude()

long Magnitude ( int value)

Definition at line 115 of file mathfp.c.

References Magnitude().

Referenced by Magnitude(), and PlaySfxWaveFileByNumber().

◆ MeasureShapeFrameStorage()

int __stdcall MeasureShapeFrameStorage ( struct Shape * shape,
short frame )

◆ MultiplyFixed()

◆ PlanarMagnitude()

long PlanarMagnitude ( int x,
int y )

◆ RandomBelow()

◆ RandomBelowOrEqual()

◆ RandomInRange()

◆ RandomWord()

unsigned short RandomWord ( void )

Definition at line 43 of file mathfp.c.

References RandomWord().

Referenced by PlayScrambleHangarScene(), PlaySfxWaveFileByNumber(), and RandomWord().

◆ ReleaseVideoResourcesHook()

void ReleaseVideoResourcesHook ( void )

◆ ResetTextCursor()

void ResetTextCursor ( void )

◆ SeedRandomFromClock()

void __stdcall SeedRandomFromClock ( int seed)

Definition at line 37 of file mathfp.c.

References SeedRandomFromClock().

Referenced by PlaySfxWaveFileByNumber(), and SeedRandomFromClock().

◆ SetTextContext()

◆ SetTextCursor()

◆ SetWholePaletteFromTriplets()

void __stdcall SetWholePaletteFromTriplets ( unsigned char * palette)

◆ SinFixed()

◆ SplitPackedPoint()

void __stdcall SplitPackedPoint ( ShortPoint point,
short * p )

Definition at line 226 of file mathfp.c.

References IsPointInRect(), SplitPackedPoint(), ShortPoint::x, and ShortPoint::y.

Referenced by PlaySfxWaveFileByNumber(), and SplitPackedPoint().

◆ Vector_magnitude()

◆ WaitForVerticalBlankThunk()

Variable Documentation

◆ bEscapePressedFlag

◆ bFrameTickPendingFlag

volatile int bFrameTickPendingFlag

◆ bMouseCursorDamagePending

int bMouseCursorDamagePending

◆ nCurrentPacketDecompressScratchSegment

short nCurrentPacketDecompressScratchSegment

Definition at line 15 of file mathfp.c.

Referenced by DecompressPacketSection().

◆ nEventMousePointerDamageBottom

int nEventMousePointerDamageBottom

◆ nMouseCursorDamageLeft

int nMouseCursorDamageLeft

◆ nMouseCursorDamageRight

int nMouseCursorDamageRight

◆ nMousePointerDamageTopValue

int nMousePointerDamageTopValue

◆ nPacketDecompressPending

short nPacketDecompressPending

Definition at line 13 of file mathfp.c.

Referenced by DecompressPacketSection().

◆ nSavedDosInterruptVector

int nSavedDosInterruptVector

Definition at line 20 of file mathfp.c.

Referenced by LogMemoryUsage(), and main().

◆ nTickCount60Hz

◆ nViewportOriginPositionX

short nViewportOriginPositionX

Definition at line 22 of file mathfp.c.

Referenced by set_up_screen_viewport().

◆ nViewportOriginPositionY

short nViewportOriginPositionY

Definition at line 21 of file mathfp.c.

Referenced by set_up_screen_viewport().

◆ wPacketDecompressInputSize

unsigned short wPacketDecompressInputSize

Definition at line 14 of file mathfp.c.

Referenced by DecompressPacketSection().