coastline 0.0.4
Loading...
Searching...
No Matches
util.h
Go to the documentation of this file.
1#ifndef COASTLINE_UTIL_H
2#define COASTLINE_UTIL_H
3
9
10#include <PR/gbi.h>
11#include <PR/ultratypes.h>
12
13#include "common/track.h"
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
19/* The blocks of each kind a frame can allocate before they run out. */
20#define FRAME_DISPLAY_LIST_BLOCKS 256
21#define FRAME_HILITE_BLOCKS 20
22#define FRAME_LIGHT_BLOCKS 20
23
25typedef struct {
26#if TGR_BOSS_RALLY
27 union {
28 u64 commands[8];
29 f32 matrix[4][4];
30 };
31#else
33#endif
35
48
60
72
73#if !TGR_BOSS_RALLY
85#endif /* !TGR_BOSS_RALLY */
86
87#if !TGR_BOSS_RALLY
99#endif /* !TGR_BOSS_RALLY */
100
101#if !TGR_BOSS_RALLY
113#endif /* !TGR_BOSS_RALLY */
114
126
128typedef s32 (*CompareFunc)(const void *a, const void *b);
129
131typedef void (*SwapFunc)(void *a, void *b, u32 size);
132
147
160
172
185
198
211
223
238void QuickSort(void *base, u32 count, u32 size, CompareFunc compare);
239
253void ShortSort(u8 *lo, u8 *hi, u32 size, CompareFunc compare, SwapFunc swap);
254
266void ExchangeByteBuffers(u8 *a, u8 *b, u32 size);
267
280
292void ExchangeWordBuffers(u32 *a, u32 *b, u32 size);
293
294#ifdef __cplusplus
295}
296#endif
297
298#endif /* COASTLINE_UTIL_H */
The graphics binary interface types the gu routines fill in for the RSP microcode.
A block of eight display list commands.
Definition util.h:25
u64 commands[8]
Definition util.h:32
The two directions the RSP uses to generate texture coordinates for reflection mapping.
Definition gbi.h:39
A section of the route.
Definition track.h:38
The track data a race loads below the program: its triangles and placed models, and the route the veh...
Integer and floating-point types of libultra.
unsigned int u32
Definition ultratypes.h:20
short s16
Definition ultratypes.h:24
float f32
Definition ultratypes.h:38
int s32
Definition ultratypes.h:25
unsigned long long u64
Definition ultratypes.h:21
unsigned char u8
Definition ultratypes.h:18
The coordinates of two specular highlights, aligned for the RSP.
Definition gbi.h:52
#define FRAME_LIGHT_BLOCKS
Definition util.h:22
void ExchangeByteBuffers(u8 *a, u8 *b, u32 size)
Exchange two buffers byte by byte.
#define FRAME_HILITE_BLOCKS
Definition util.h:21
void ResetFrameBlocks(void)
Start the allocations of a new frame.
s32 g_dwFrameBufferIndex
The frame buffer the current frame draws into.
Hilite g_aHiliteBlocks[2][FRAME_HILITE_BLOCKS+1]
The highlight blocks of the two frames and one spare block per frame.
s32 g_dwHiliteBlockCount
The highlight blocks allocated in the current frame.
s32(* CompareFunc)(const void *a, const void *b)
A routine that orders two elements as strcmp() orders strings.
Definition util.h:128
void ExchangeWordBuffers(u32 *a, u32 *b, u32 size)
Exchange two buffers word by word.
void PrepareTrackSections(void)
Adjust the route of the loaded track for the current track.
DisplayListBlock g_aDisplayListBlocks[2][FRAME_DISPLAY_LIST_BLOCKS+1]
The display list blocks of the two frames.
LookAt * AllocLightBlock(void)
Allocate a block of reflection directions for the current frame.
DisplayListBlock * AllocDisplayListBlock(void)
Allocate a block of display list commands for the current frame.
void ShortSort(u8 *lo, u8 *hi, u32 size, CompareFunc compare, SwapFunc swap)
Sort the elements from lo to hi by selection, for the short ranges of QuickSort().
void ExchangeHalfwordBuffers(s16 *a, s16 *b, u32 size)
Exchange two buffers halfword by halfword.
s32 g_dwLightBlockCount
The light blocks allocated in the current frame.
void QuickSort(void *base, u32 count, u32 size, CompareFunc compare)
Sort count elements of a size with a comparison.
void MarkTrackSections(TrackSection *section)
Mark every section of a tree of the route as visited, skipping sections already visited and alternate...
#define FRAME_DISPLAY_LIST_BLOCKS
Definition util.h:20
void(* SwapFunc)(void *a, void *b, u32 size)
A routine that exchanges two elements of a size.
Definition util.h:131
Hilite * AllocHiliteBlock(void)
Allocate a block of highlight coordinates for the current frame.
LookAt g_aLightBlocks[2][FRAME_LIGHT_BLOCKS+1]
The light blocks of the two frames and one spare block per frame.
s32 g_dwDisplayListBlockCount
The blocks the current frame has allocated.
void UnmarkTrackSections(TrackSection *section)
Clear the visited mark of every section of a tree of the route.