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

Shape decoding, viewport drawing and raster effects. More...

#include "game.h"

Go to the source code of this file.

Macros

#define GR_C

Functions

void CheckHeapBlockSignature (unsigned char *shape)
int HasValidShapeAllocationSignature (unsigned char *shape)
unsigned char * GetPreparedShapeData (unsigned char *shape)
short GetShapeFrameCount (unsigned char *shape)
void GetShapeFrameExtents (unsigned char *shape, short frame, short *width, short *height, short *leftExtent, short *topExtent)
void DecodeShapeFrame (unsigned char *shape, short frame, unsigned char *bitmap, int width, int height, int leftExtent, int topExtent)
int SignExtendClipCoord (volatile short v)
void exit_squadron (const char *msg,...)
void ValidateViewportBounds (Viewport *viewport, RasterSurface *surface, RasterClip *clip)
void ClipViewportToScreen (Viewport *viewport)
void SetSolidColourTranslation (unsigned char colour)
void PrepareShapeRLEData (unsigned char *shape)
void DrawSpriteTransformed (Viewport *viewport, int x, int y, unsigned char *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 EstablishColors (Viewport *viewport, unsigned char *active)
void GetPaletteEntry (short index, unsigned short *rgb)
void SetPaletteEntry (short index, short *rgb)
void DrawSpriteDefault (Viewport *viewport, short x, short y, unsigned char *shape, short frame)
short GetTransformedShapeBounds (Viewport *viewport, short x, short y, unsigned char *shape, short frame, short angle, short scale, short flip, short *bounds)
void FillPolygon (Viewport *viewport, ShortPoint *points, int count, char colour)
void triangle (Viewport *viewport, ShortPoint *points, int colour)
void CaptureSpriteBackground (Viewport *viewport, unsigned char *background, short x, short y, unsigned char *shape, short frame)
void DrawFilledViewportRect (Viewport *viewport, short left, short top, short right, short bottom, short color)
void DrawSpriteScaled (Viewport *viewport, short x, short y, unsigned char *shape, short frame, short angle, short scale, short flip)
void RestoreSpriteBackground (Viewport *viewport, unsigned char *background, short x, short y, unsigned char *shape, short frame)
void DrawSolidColourSprite (Viewport *viewport, short x, short y, unsigned char *shape, short frame, unsigned short colour)
void CopyViewportContents (Viewport *source, Viewport *destination)
void ClearViewport (Viewport *viewport, short colour)
void DrawViewportPixel (Viewport *viewport, short x, short y, short colour)
short GetViewportPixel (Viewport *viewport, short x, short y)
void DrawViewportLine (Viewport *viewport, short x1, short y1, short x2, short y2, short colour)
void shaded_triangle (Viewport *viewport)
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, unsigned char *shape, int frame, int x, int y, int angle, int scale)
void GetShapeFrameCorners (unsigned char *shape, int frame, int x, int y, short *points, int *count)
void DrawSolidColourSpriteScaled (Viewport *viewport, short x, short y, unsigned char *shape, short frame, short angle, short scale, short flip, unsigned short colour)
void CopyViewportRuns (Viewport *source, Viewport *destination, const short *runs)
void fizzle_fade (Viewport *source, Viewport *destination)
void snow_viewport (Viewport *viewport, int effect, unsigned short colour)

Variables

const int g_nViewportStaticRandomRange = 3
unsigned char g_abPaletteTranslation [256]
unsigned short g_awAbsoluteCosine [360]
unsigned short g_awAbsoluteSine [360]
static int g_anPolyExtents [412]
int g_nShapePrepareTicks
int g_1_nShapeClipTicksValue
int g_nShapeDrawTicks

Detailed Description

Shape decoding, viewport drawing and raster effects.

Definition in file gr.c.

Macro Definition Documentation

◆ GR_C

#define GR_C

Definition at line 7 of file gr.c.

Function Documentation

◆ __copyline()

void __copyline ( void )

Definition at line 647 of file gr.c.

References __copyline(), and RasterLineHook().

Referenced by __copyline(), and CollectRasterClipColours().

◆ __wipeline()

void __wipeline ( void )

Definition at line 656 of file gr.c.

References __wipeline(), and RasterLineHook().

Referenced by __wipeline(), and CollectRasterClipColours().

◆ CaptureSpriteBackground()

◆ CheckHeapBlockSignature()

◆ ClearViewport()

◆ ClipViewportToScreen()

◆ CopyViewportContents()

◆ CopyViewportRuns()

void CopyViewportRuns ( Viewport * source,
Viewport * destination,
const short * runs )

◆ DecodeShapeFrame()

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

Definition at line 171 of file gr.c.

References DecodeShapeFrame().

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

◆ DrawFilledViewportRect()

void DrawFilledViewportRect ( Viewport * viewport,
short left,
short top,
short right,
short bottom,
short color )

◆ DrawFontGlyph()

◆ DrawShapeFrameScaled()

void DrawShapeFrameScaled ( Viewport * viewport,
unsigned char * shape,
int frame,
int x,
int y,
int angle,
int scale )

◆ DrawSolidColourSprite()

void DrawSolidColourSprite ( Viewport * viewport,
short x,
short y,
unsigned char * shape,
short frame,
unsigned short colour )

◆ DrawSolidColourSpriteScaled()

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

◆ DrawSpriteDefault()

void DrawSpriteDefault ( Viewport * viewport,
short x,
short y,
unsigned char * shape,
short frame )

◆ DrawSpriteScaled()

void DrawSpriteScaled ( Viewport * viewport,
short x,
short y,
unsigned char * shape,
short frame,
short angle,
short scale,
short flip )

◆ DrawSpriteTransformed()

◆ DrawViewportBorder()

void DrawViewportBorder ( Viewport * viewport,
short left,
short top,
short right,
short bottom,
short colour )

◆ 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()

◆ EstablishColors()

void EstablishColors ( Viewport * viewport,
unsigned char * active )

◆ exit_squadron()

void exit_squadron ( const char * msg,
... )

Definition at line 44 of file message.c.

◆ FillPolygon()

◆ FillViewportEllipse()

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

◆ fizzle_fade()

void fizzle_fade ( Viewport * source,
Viewport * destination )

◆ GetPaletteEntry()

void GetPaletteEntry ( short index,
unsigned short * rgb )

◆ GetPreparedShapeData()

unsigned char * GetPreparedShapeData ( unsigned char * shape)

◆ GetShapeFrameCorners()

void GetShapeFrameCorners ( unsigned char * shape,
int frame,
int x,
int y,
short * points,
int * count )

Definition at line 1461 of file gr.c.

References CheckHeapBlockSignature(), and GetShapeFrameCorners().

Referenced by CollectRasterClipColours(), and GetShapeFrameCorners().

◆ GetShapeFrameCount()

short GetShapeFrameCount ( unsigned char * shape)

◆ GetShapeFrameExtents()

void GetShapeFrameExtents ( unsigned char * shape,
short frame,
short * width,
short * height,
short * leftExtent,
short * topExtent )

Definition at line 144 of file gr.c.

References GetShapeFrameExtents().

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

◆ GetTransformedShapeBounds()

◆ GetViewportPixel()

◆ HasValidShapeAllocationSignature()

◆ PrepareShapeRLEData()

◆ RasterLineHook()

◆ RestoreSpriteBackground()

◆ SetPaletteEntry()

◆ SetSolidColourTranslation()

◆ shaded_triangle()

void shaded_triangle ( Viewport * viewport)

◆ shadow_draw()

void shadow_draw ( Viewport * viewport)

◆ SignExtendClipCoord()

int SignExtendClipCoord ( volatile short v)

Definition at line 297 of file gr.c.

References SignExtendClipCoord().

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

◆ snow_viewport()

◆ triangle()

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

◆ ValidateViewportBounds()

Variable Documentation

◆ g_1_nShapeClipTicksValue

int g_1_nShapeClipTicksValue

Definition at line 1707 of file gr.c.

Referenced by DrawSpriteTransformed().

◆ g_abPaletteTranslation

unsigned char g_abPaletteTranslation[256]

Definition at line 12 of file gr.c.

Referenced by DrawFontGlyph().

◆ g_anPolyExtents

int g_anPolyExtents[412]
static

Definition at line 1075 of file gr.c.

Referenced by FillPolygon().

◆ g_awAbsoluteCosine

unsigned short g_awAbsoluteCosine[360]

Definition at line 46 of file gr.c.

Referenced by GetTransformedShapeBounds().

◆ g_awAbsoluteSine

unsigned short g_awAbsoluteSine[360]

Definition at line 78 of file gr.c.

Referenced by GetTransformedShapeBounds().

◆ g_nShapeDrawTicks

int g_nShapeDrawTicks

Definition at line 1708 of file gr.c.

Referenced by DrawSpriteTransformed().

◆ g_nShapePrepareTicks

int g_nShapePrepareTicks

Definition at line 1706 of file gr.c.

Referenced by DrawSpriteTransformed().

◆ g_nViewportStaticRandomRange

const int g_nViewportStaticRandomRange = 3

Definition at line 10 of file gr.c.

Referenced by snow_viewport().