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

Rasteriser primitives, screen-space effects and the music streamer's wrappers. More...

#include <stdio.h>
#include "wc1.h"

Go to the source code of this file.

Data Structures

struct  ShapeFrameExtents

Typedefs

typedef struct ShapeFrameExtents ShapeFrameExtents

Functions

void CheckHeapBlockSignature (struct Shape *shape)
struct RLEShape * GetPreparedShapeData (struct Shape *shape)
short __stdcall GetShapeFrameCount (struct Shape *shape)
void GetShapeFrameExtents (struct Shape *shape, short frame, short *width, short *height, short *leftExtent, short *topExtent)
void DecodeShapeFrame (struct Shape *shape, short frame, unsigned char *bitmap, int width, int height, int leftExtent, int topExtent)
int SignExtendClipCoord (volatile short v)
void ValidateViewportBounds (Viewport *viewport, RasterSurface *surface, RasterClip *clip)
void ClipViewportToScreen (Viewport *viewport)
void SetSolidColourTranslation (unsigned char colour)
void PrepareShapeRLEData (struct Shape *shape)
void DrawSpriteTransformed (Viewport *viewport, int x, int y, struct Shape *shape, int frame, int angle, int scaleX, int scaleY, int flip, int blendMode)
void RasterLineHook (const void *marker)
void DrawFontGlyph (char character, TextContext *context, int height, int width, int y)
void __copyline (void)
void __wipeline (void)
void __stdcall MarkActivePaletteEntries (Viewport *viewport, unsigned char *active)
void __stdcall GetPaletteEntry (short index, short *rgb)
void __stdcall SetPaletteEntry (short index, short *rgb)
void DrawSpriteDefault (Viewport *viewport, short x, short y, struct Shape *shape, short frame)
void CaptureSpriteBackground (Viewport *viewport, unsigned char *background, short x, short y, struct Shape *shape, short frame)
void RestoreSpriteBackground (Viewport *viewport, unsigned char *background, short x, short y, struct Shape *shape, short frame)
void DrawSolidColourSprite (Viewport *viewport, short x, short y, struct Shape *shape, short frame, short colour)
void CopyViewportContents (Viewport *source, Viewport *destination)
void ClearViewport (Viewport *viewport, short colour)
void DrawViewportPixel (Viewport *viewport, short x, short y, short colour)
int GetViewportPixel (Viewport *viewport, short x, short y)
void DrawViewportLine (Viewport *viewport, short x1, short y1, short x2, short y2, short colour)
void DrawViewportPolygonHook (Viewport *viewport, const ShortPoint *points, int count, int colour)
void triangle (Viewport *viewport, const ShortPoint *points, int colour)
void shaded_triangle (Viewport *viewport)
void DrawFilledViewportRect (Viewport *viewport, short left, short top, short right, short bottom, short colour)
void DrawViewportBorder (Viewport *viewport, short left, short top, short right, short bottom, short colour)
void DrawViewportEllipse (Viewport *viewport, short x, short y, short verticalRadius, short horizontalRadius, short colour)
void FillViewportEllipse (Viewport *viewport, short x, short y, short verticalRadius, short horizontalRadius, short colour)
void DrawViewportEllipseShadow (Viewport *viewport, short x, short y, short verticalRadius, short horizontalRadius, short colour)
void shadow_draw (Viewport *viewport)
void DrawShapeFrameScaled (Viewport *viewport, struct Shape *shape, int frame, int x, int y, int angle, int scale)
void GetShapeFrameCorners (unsigned char *shape, int frame, int x, int y, ShortPoint *corners, int *cornerCount)
void DrawSpriteScaled (Viewport *viewport, short x, short y, struct Shape *shape, short frame, short angle, short scale, short flip)
void DrawSolidColourSpriteScaled (Viewport *viewport, short x, short y, struct Shape *shape, short frame, short angle, short scale, short flip, short colour)
short GetTransformedShapeBounds (Viewport *viewport, short x, short y, struct Shape *shape, short frame, short angle, short scale, short flip, ShortRect *bounds)
void BlitViewportScanlineRuns (Viewport *source, Viewport *destination, const ScreenViewportGeometry *geometry)
void fizzle_fade (Viewport *source, Viewport *destination)
void snow_viewport (Viewport *viewport, int effect, unsigned short colour)
void UpdateStreamerStoppedFlag (void)
void SignalAudioMixerWakeEvent (void)
void InitializeAudioStreamer (HWND window)
void Streamer_open (const char *streamName)
void Streamer_play (void)
void Streamer_stop (void)
int GetStreamerTrigger (void)
void ClearStreamerTrigger (void)
void Streamer_trigger (int trigger)
void SetStreamerIntensity (unsigned char intensity)
void ForceStreamerTrigger (int trigger)
void SetMusicStreamVolume (unsigned short volume)
unsigned int GetMusicStreamVolume (void)
void Streamer_close (void)
void ShutdownAudioStreamer (void)
int ReadCheaterFlagFromRegistry (void)

Variables

static unsigned char abPaletteTranslation [256]
static unsigned short aawAbsoluteTrig [2][360]
static RasterSurface stRasterTarget
static unsigned char abShapeTransformPixels [0xfa00]
static RasterClip stRasterClip
static unsigned char abUnusedGrTable [0x670]
static unsigned char abSolidColourLookup [256]
static unsigned char abShapeRLEBuffer [0x100000]
static int bStreamerAudioRunning
static char szStreamerPathBuffer [128]
const char szGameRegistryKey [42]
const char szCheaterRegistryValue [8] = "Cheater"
int nUnusedFlightProfileTicksA
int nUnusedFlightProfileTicksB
int nUnusedFlightProfileTicksC
Viewport stRoomScreenViewport
short nSavedRoomCtrlX
unsigned char * pRecRoomRoster
unsigned char * pMissionCampaignInfo
struct Shape * apRecRoomFigureShapes [3]
PilotRecord aPilotEntriesList [9]
ConstellationObjectDefinition * pConstellationDefinitionsPtr
PilotRecord * apWingmanPilotsList [8]

Detailed Description

Rasteriser primitives, screen-space effects and the music streamer's wrappers.

Address range 4408a0-44269f. The routines print some of their names: shadow_draw, fizzle_fade and snow_viewport.

Definition in file gr.c.

Typedef Documentation

◆ ShapeFrameExtents

typedef struct ShapeFrameExtents ShapeFrameExtents

Function Documentation

◆ __copyline()

void __copyline ( void )

Definition at line 621 of file gr.c.

References __copyline(), and RasterLineHook().

Referenced by __copyline(), and CollectRasterClipColours().

◆ __wipeline()

void __wipeline ( void )

Definition at line 627 of file gr.c.

References __wipeline(), and RasterLineHook().

Referenced by __wipeline(), and CollectRasterClipColours().

◆ BlitViewportScanlineRuns()

◆ CaptureSpriteBackground()

◆ CheckHeapBlockSignature()

◆ ClearStreamerTrigger()

void ClearStreamerTrigger ( void )

◆ ClearViewport()

◆ ClipViewportToScreen()

◆ CopyViewportContents()

◆ DecodeShapeFrame()

void DecodeShapeFrame ( struct Shape * shape,
short frame,
unsigned char * bitmap,
int width,
int height,
int leftExtent,
int topExtent )

Definition at line 175 of file gr.c.

References DecodeShapeFrame(), and Shape::frameOffsets.

Referenced by CollectRasterClipColours(), DecodeShapeFrame(), and PrepareShapeRLEData().

◆ DrawFilledViewportRect()

◆ DrawFontGlyph()

◆ DrawShapeFrameScaled()

void DrawShapeFrameScaled ( Viewport * viewport,
struct Shape * shape,
int frame,
int x,
int y,
int angle,
int scale )

Definition at line 1119 of file gr.c.

References DrawShapeFrameScaled(), and DrawSpriteTransformed().

Referenced by CollectRasterClipColours(), and DrawShapeFrameScaled().

◆ DrawSolidColourSprite()

void DrawSolidColourSprite ( Viewport * viewport,
short x,
short y,
struct Shape * shape,
short frame,
short colour )

◆ DrawSolidColourSpriteScaled()

void DrawSolidColourSpriteScaled ( Viewport * viewport,
short x,
short y,
struct Shape * shape,
short frame,
short angle,
short scale,
short flip,
short colour )

◆ DrawSpriteDefault()

void DrawSpriteDefault ( Viewport * viewport,
short x,
short y,
struct Shape * shape,
short frame )

◆ DrawSpriteScaled()

◆ DrawSpriteTransformed()

◆ DrawViewportBorder()

◆ DrawViewportEllipse()

void DrawViewportEllipse ( Viewport * viewport,
short x,
short y,
short verticalRadius,
short horizontalRadius,
short colour )

◆ DrawViewportEllipseShadow()

void DrawViewportEllipseShadow ( Viewport * viewport,
short x,
short y,
short verticalRadius,
short horizontalRadius,
short colour )

◆ DrawViewportLine()

◆ DrawViewportPixel()

◆ DrawViewportPolygonHook()

void DrawViewportPolygonHook ( Viewport * viewport,
const ShortPoint * points,
int count,
int colour )

Definition at line 1006 of file gr.c.

References DrawViewportPolygonHook(), and void().

Referenced by CollectRasterClipColours(), DrawViewportPolygonHook(), and triangle().

◆ FillViewportEllipse()

void FillViewportEllipse ( Viewport * viewport,
short x,
short y,
short verticalRadius,
short horizontalRadius,
short colour )

◆ fizzle_fade()

void fizzle_fade ( Viewport * source,
Viewport * destination )

Definition at line 1322 of file gr.c.

References DIBslam(), fizzle_fade(), Viewport::pixels, RasterLineHook(), stScreenView, and void().

Referenced by CollectRasterClipColours(), and fizzle_fade().

◆ ForceStreamerTrigger()

◆ GetMusicStreamVolume()

unsigned int GetMusicStreamVolume ( void )

◆ GetPaletteEntry()

void __stdcall GetPaletteEntry ( short index,
short * rgb )

◆ GetPreparedShapeData()

struct RLEShape * GetPreparedShapeData ( struct Shape * shape)

◆ GetShapeFrameCorners()

void GetShapeFrameCorners ( unsigned char * shape,
int frame,
int x,
int y,
ShortPoint * corners,
int * cornerCount )

◆ GetShapeFrameCount()

short __stdcall GetShapeFrameCount ( struct Shape * shape)

◆ GetShapeFrameExtents()

void GetShapeFrameExtents ( struct Shape * shape,
short frame,
short * width,
short * height,
short * leftExtent,
short * topExtent )

◆ GetStreamerTrigger()

int GetStreamerTrigger ( void )

◆ GetTransformedShapeBounds()

◆ GetViewportPixel()

int GetViewportPixel ( Viewport * viewport,
short x,
short y )

◆ InitializeAudioStreamer()

void InitializeAudioStreamer ( HWND window)

◆ MarkActivePaletteEntries()

void __stdcall MarkActivePaletteEntries ( Viewport * viewport,
unsigned char * active )

◆ PrepareShapeRLEData()

◆ RasterLineHook()

void RasterLineHook ( const void * marker)

◆ ReadCheaterFlagFromRegistry()

int ReadCheaterFlagFromRegistry ( void )

◆ RestoreSpriteBackground()

◆ SetMusicStreamVolume()

void SetMusicStreamVolume ( unsigned short volume)

◆ SetPaletteEntry()

void __stdcall SetPaletteEntry ( short index,
short * rgb )

◆ SetSolidColourTranslation()

void SetSolidColourTranslation ( unsigned char colour)

◆ SetStreamerIntensity()

void SetStreamerIntensity ( unsigned char intensity)

◆ shaded_triangle()

void shaded_triangle ( Viewport * viewport)

◆ shadow_draw()

void shadow_draw ( Viewport * viewport)

Definition at line 1111 of file gr.c.

References DIBslam(), Viewport::pixels, RasterLineHook(), shadow_draw(), and stScreenView.

Referenced by CollectRasterClipColours(), and shadow_draw().

◆ ShutdownAudioStreamer()

void ShutdownAudioStreamer ( void )

◆ SignalAudioMixerWakeEvent()

void SignalAudioMixerWakeEvent ( void )

◆ SignExtendClipCoord()

int SignExtendClipCoord ( volatile short v)

Definition at line 300 of file gr.c.

References SignExtendClipCoord().

Referenced by CollectRasterClipColours(), SignExtendClipCoord(), and ValidateViewportBounds().

◆ snow_viewport()

void snow_viewport ( Viewport * viewport,
int effect,
unsigned short colour )

◆ Streamer_close()

◆ Streamer_open()

◆ Streamer_play()

◆ Streamer_stop()

◆ Streamer_trigger()

◆ triangle()

void triangle ( Viewport * viewport,
const ShortPoint * points,
int colour )

◆ UpdateStreamerStoppedFlag()

void UpdateStreamerStoppedFlag ( void )

◆ ValidateViewportBounds()

Variable Documentation

◆ aawAbsoluteTrig

unsigned short aawAbsoluteTrig[2][360]
static

Definition at line 51 of file gr.c.

Referenced by GetTransformedShapeBounds().

◆ abPaletteTranslation

unsigned char abPaletteTranslation[256]
static

Definition at line 14 of file gr.c.

Referenced by DrawFontGlyph().

◆ abShapeRLEBuffer

unsigned char abShapeRLEBuffer[0x100000]
static

Definition at line 366 of file gr.c.

Referenced by PrepareShapeRLEData().

◆ abShapeTransformPixels

unsigned char abShapeTransformPixels[0xfa00]
static

Definition at line 344 of file gr.c.

Referenced by DrawSpriteTransformed().

◆ abSolidColourLookup

unsigned char abSolidColourLookup[256]
static

Definition at line 356 of file gr.c.

Referenced by SetSolidColourTranslation().

◆ abUnusedGrTable

unsigned char abUnusedGrTable[0x670]
static

Definition at line 347 of file gr.c.

◆ aPilotEntriesList

PilotRecord aPilotEntriesList[9]

◆ apRecRoomFigureShapes

struct Shape* apRecRoomFigureShapes[3]

Definition at line 1530 of file gr.c.

Referenced by RecRoom().

◆ apWingmanPilotsList

◆ bStreamerAudioRunning

int bStreamerAudioRunning
static

◆ nSavedRoomCtrlX

short nSavedRoomCtrlX

Definition at line 1527 of file gr.c.

Referenced by BarracksScreen(), InitializeRoomViewports(), and RecRoom().

◆ nUnusedFlightProfileTicksA

int nUnusedFlightProfileTicksA

Definition at line 1523 of file gr.c.

Referenced by RunSpaceFlight().

◆ nUnusedFlightProfileTicksB

int nUnusedFlightProfileTicksB

Definition at line 1524 of file gr.c.

Referenced by RunSpaceFlight().

◆ nUnusedFlightProfileTicksC

int nUnusedFlightProfileTicksC

Definition at line 1525 of file gr.c.

Referenced by RunSpaceFlight().

◆ pConstellationDefinitionsPtr

ConstellationObjectDefinition* pConstellationDefinitionsPtr

Definition at line 1532 of file gr.c.

Referenced by init_constellation(), LoadGameFromSlot(), and LoadOriginFxDrivers().

◆ pMissionCampaignInfo

unsigned char* pMissionCampaignInfo

◆ pRecRoomRoster

unsigned char* pRecRoomRoster

Definition at line 1528 of file gr.c.

Referenced by RecRoom().

◆ stRasterClip

◆ stRasterTarget

RasterSurface stRasterTarget
static

Definition at line 343 of file gr.c.

Referenced by ClipViewportToScreen().

◆ stRoomScreenViewport

Viewport stRoomScreenViewport

◆ szCheaterRegistryValue

const char szCheaterRegistryValue[8] = "Cheater"

Definition at line 1496 of file gr.c.

Referenced by ReadCheaterFlagFromRegistry().

◆ szGameRegistryKey

const char szGameRegistryKey[42]
Initial value:
=
"Software\\Origin Systems\\WC: Kilrathi Saga"

Definition at line 1494 of file gr.c.

Referenced by ReadCheaterFlagFromRegistry().

◆ szStreamerPathBuffer

char szStreamerPathBuffer[128]
static

Definition at line 1367 of file gr.c.

Referenced by Streamer_open().