coastline 0.0.4
Loading...
Searching...
No Matches
input.h
Go to the documentation of this file.
1#ifndef COASTLINE_INPUT_H
2#define COASTLINE_INPUT_H
3
8
9#include <PR/os_cont.h>
10#include <PR/ultratypes.h>
11
12#include "common/game.h"
13#include "common/playerinput.h"
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
19/* The buttons of the input, which the menus read. The stick also presses the four directions. */
20#define INPUT_RIGHT 0x0001
21#define INPUT_DOWN 0x0002
22#define INPUT_LEFT 0x0004
23#define INPUT_UP 0x0008
24#define INPUT_A 0x0010
25#define INPUT_B 0x0020
26#define INPUT_C_UP 0x0100
27#define INPUT_C_RIGHT 0x0200
28#define INPUT_C_DOWN 0x0400
29#define INPUT_C_LEFT 0x0800
30#define INPUT_L 0x1000
31#define INPUT_R 0x2000
32#define INPUT_START 0x4000
33#define INPUT_Z 0x8000
34
35/* The actions of a race, which the button layout maps the buttons to. */
36#define INPUT_ACCELERATE 0x00010000
37#define INPUT_REVERSE 0x00020000
38#define INPUT_BRAKE 0x00040000
39#define INPUT_EBRAKE 0x00080000
40#define INPUT_GEAR_UP 0x00100000
41#define INPUT_GEAR_DOWN 0x00200000
42/* The views the C buttons choose: the cockpit, the trackside camera, the chase camera and the
43 * bumper. The computer's drivers request the trackside camera. */
44#define INPUT_VIEW_COCKPIT 0x01000000
45#define INPUT_VIEW_TRACKSIDE 0x02000000
46#define INPUT_VIEW_CHASE 0x04000000
47#define INPUT_VIEW_BUMPER 0x08000000
48#define INPUT_VIEWS 0x0F000000
49
51#define INPUT_RECORDED_ACTIONS 0x003F0000
52
54#define CONTROLLER_LAYOUTS 5
55
57typedef struct {
58 void (*apply)(void);
60} CheatCode;
61
71
81
91
103
113
114#if TGR_REGION == TGR_REGION_JP || TGR_REGION == TGR_REGION_EU
122
130#endif /* TGR_REGION == TGR_REGION_JP || TGR_REGION == TGR_REGION_EU */
131
141
151
161
171
181
191
201
211
221
231
242
243#if !TGR_BOSS_RALLY
255#endif /* !TGR_BOSS_RALLY */
256
270void CheckAnalogStickPositive(PlayerInputState *state, s32 *timer, f32 *axis, u32 button);
271
284void CheckAnalogStickNegative(PlayerInputState *state, s32 *timer, f32 *axis, u32 button);
285
296
297#if !TGR_BOSS_RALLY
309#endif /* !TGR_BOSS_RALLY */
310
320
332
344
356
370
371#ifdef __cplusplus
372}
373#endif
374
375#endif /* COASTLINE_INPUT_H */
void CheatToggleMultiplayerMode(void)
Toggle the multiplayer mode selected by the cheat sequence.
void CheatFinishRace(void)
Request that the race finish.
void CheckAnalogStickNegative(PlayerInputState *state, s32 *timer, f32 *axis, u32 button)
The same as CheckAnalogStickPositive() for the negative side of an axis.
CheatCode g_aCheatCodes[]
The cheats, ending with a NULL sequence.
void CheatSetUnlockBit8000(void)
Set bit 15 of the unlocks of the profile.
void CheatSetUnlockBit800(void)
Set bit 11 of the unlocks of the profile.
void CheatUnlockTracks5To9(void)
Unlock tracks 5 to 9.
s32 g_dwContReadPending
Whether a read of the controllers is started and not yet received.
void InitControllersAndPaks(void)
Probe the controllers and the Controller and Rumble Paks, running the controller check until each war...
void CheatUnlockTracks0To4(void)
Unlock the first five tracks.
s32 g_dwMultiplayerMode
Whether the credits race scrolls the credits rather than displaying captions.
void UpdateControllerState(void)
Read the controllers and turn their state into the input of the players.
void StartControllerRead(void)
Start a read of the controllers, unless one is already pending.
void CheckAnalogStickPositive(PlayerInputState *state, s32 *timer, f32 *axis, u32 button)
Press a direction when a stick axis passes 0.6, then again after half a second and every 0....
void CheatSetUnlockBit200(void)
Set bit 9 of the unlocks of the profile.
void CheatSetUnlockBit400(void)
Set bit 10 of the unlocks of the profile.
void CheatUnlockCars0To8(void)
Unlock the first nine cars.
void CheatToggleBilinearFilter(void)
Toggle bilinear texture filtering selected by the cheat sequence.
void ProcessInputCommandBuffer(PlayerInputState *state)
Remember a change of the buttons and apply each cheat whose sequence the latest changes match.
void TranslateControllerInput(PlayerInputState *state)
Read the pad of a player into buttons, race actions for the button layout, and the stick,...
s32 g_bBilinearFiltering
Whether textures are filtered.
void CheatSetUnlockBit1000(void)
Set bit 12 of the unlocks of the profile.
u8 g_bPakPort0Initialized
Whether InitControllersAndPaks() has mounted the Controller Pak of the first controller.
void CheatToggleRamView(void)
Toggle the view of memory.
s32 g_bShowDepthBuffer
Whether each frame shows the depth buffer, at the start of memory, in place of the picture.
void ReadControllers(void)
Wait for a read of the controllers, starting one if none is pending, and fill the pads.
void UpdateStickRepeat(PlayerInputState *state)
Press the directions of the stick with repeat, as the menus read them.
s32 g_dwCheatFinishRacePending
Set by CheatFinishRace() to finish the race.
The main thread of the game, the weather of a race, and the player slots.
The controllers and the Controller Pak file system.
A cheat: the sequence of button changes that applies it, newest first, ending in 0xFFFF.
Definition input.h:57
u16 * sequence
Definition input.h:59
void(* apply)(void)
Definition input.h:58
The input of one player.
Definition playerinput.h:32
Integer and floating-point types of libultra.
unsigned int u32
Definition ultratypes.h:20
float f32
Definition ultratypes.h:38
unsigned short u16
Definition ultratypes.h:19
int s32
Definition ultratypes.h:25
unsigned char u8
Definition ultratypes.h:18