coastline 0.0.4
Loading...
Searching...
No Matches
qualityoflife.h File Reference

The arithmetic and the parsing of the quality of life changes of the patched PC libraries. More...

#include <stdbool.h>
Include dependency graph for qualityoflife.h:

Go to the source code of this file.

Functions

bool IsSecondPressWithin (unsigned *pLastPress, unsigned now, unsigned window)
 Record a press and report whether it follows an earlier press within a window.
float GetHorPlusFovY (float fov, float width, float height)
 Return the vertical field of view of a camera for the shape of its viewport.
void GetHudCanvasSize (int width, int height, int *pCanvasWidth, int *pCanvasHeight)
 Return the size of the canvas the HUD of a race is laid out on.
int ParseTestScene (const char *pszValue)
 Return the mode of play of the value of scene= on the command line.

Detailed Description

The arithmetic and the parsing of the quality of life changes of the patched PC libraries.

Function Documentation

◆ IsSecondPressWithin()

bool IsSecondPressWithin ( unsigned * pLastPress,
unsigned now,
unsigned window )

Record a press and report whether it follows an earlier press within a window.

A second press consumes both presses, and the next press starts a new pair.

Parameters
pLastPressThe time of the unpaired earlier press, or 0 for none. Updated.
nowThe time of this press.
windowThe most time between the two presses, in the unit of the times.
Returns
Whether this press is the second of a pair.

◆ GetHorPlusFovY()

float GetHorPlusFovY ( float fov,
float width,
float height )

Return the vertical field of view of a camera for the shape of its viewport.

At 4:3 and wider the vertical angle is preserved and the view widens. Narrower viewports retain the horizontal angle of 4:3 and grow taller.

Parameters
fovThe vertical field of view at 4:3, in radians.
widthThe width of the viewport.
heightThe height of the viewport.
Returns
The vertical field of view, in radians.

◆ GetHudCanvasSize()

void GetHudCanvasSize ( int width,
int height,
int * pCanvasWidth,
int * pCanvasHeight )

Return the size of the canvas the HUD of a race is laid out on.

The canvas has the shape of the frame buffer. At 4:3 and wider it is at most 480 units tall, and narrower frame buffers get a canvas at most 640 units wide, so the 640 by 480 layout of the HUD always fits. The routines that draw the HUD anchor it to the edges and the centre.

Parameters
widthThe width of the frame buffer, in pixels.
heightThe height of the frame buffer, in pixels.
pCanvasWidthReceives the width of the canvas.
pCanvasHeightReceives the height of the canvas.

◆ ParseTestScene()

int ParseTestScene ( const char * pszValue)

Return the mode of play of the value of scene= on the command line.

The scenes are arcade, demo, practice, seasonwinner, and timeattack. The value ends at the end of the string or at white space.

Parameters
pszValueThe text after scene=.
Returns
The mode of play, or -1 when the value is not a scene.