Magical macros for handling user input. More...
#include <wiiuse/wpad.h>
#include "defines.h"
Go to the source code of this file.
Defines | |
#define | ALL_ScanPads() |
Scans gamecube and wiimote, then updates ACCEL and EXP data. | |
#define | NUNCHUK_CONNECTED(i) (g_wiiexp[i].type == WPAD_EXP_NUNCHUK) |
#define | NUNCHUK_StickPosX(i) g_wiiexp[i].nunchuk.js.pos.x |
#define | NUNCHUK_StickPosY(i) g_wiiexp[i].nunchuk.js.pos.y |
#define | NUNCHUK_StickCenterX(i) g_wiiexp[i].nunchuk.js.center.x |
#define | NUNCHUK_StickCenterY(i) g_wiiexp[i].nunchuk.js.center.y |
#define | NUNCHUK_StickDX(i) (NUNCHUK_StickPosX(i) - NUNCHUK_StickCenterX(i)) |
#define | NUNCHUK_StickDY(i) (NUNCHUK_StickPosY(i) - NUNCHUK_StickCenterY(i)) |
#define | NUNCHUK_THRESHOLD 65 |
#define | NUNCHUK_LEFT_PRESSED(i) (NUNCHUK_StickDX(i) < -NUNCHUK_THRESHOLD) |
#define | NUNCHUK_RIGHT_PRESSED(i) (NUNCHUK_StickDX(i) > NUNCHUK_THRESHOLD) |
#define | NUNCHUK_UP_PRESSED(i) (NUNCHUK_StickDY(i) > NUNCHUK_THRESHOLD) |
#define | NUNCHUK_DOWN_PRESSED(i) (NUNCHUK_StickDY(i) < -NUNCHUK_THRESHOLD) |
#define | NUNCHUK_ButtonsDown(i) g_wiiexp[i].nunchuk.btns |
#define | NUNCHUK_ButtonsReleased(i) g_wiiexp[i].nunchuk.btns_released |
#define | NUNCHUK_C_PRESSED(i) (NUNCHUK_ButtonsDown(i) & NUNCHUK_BUTTON_C) |
#define | NUNCHUK_Z_PRESSED(i) (NUNCHUK_ButtonsDown(i) & NUNCHUK_BUTTON_Z) |
#define | NUNCHUK_Z_RELEASED(i) (NUNCHUK_ButtonsReleased(i) & NUNCHUK_BUTTON_Z) |
#define | MENU_LEFT_PRESSED(i) |
#define | MENU_RIGHT_PRESSED(i) |
#define | MENU_UP_PRESSED(i) |
#define | MENU_DOWN_PRESSED(i) |
#define | MENU_SELECT_PRESSED(i) |
#define | MENU_EXIT_PRESSED(i) |
#define | A_PRESSED(i) |
#define | B_PRESSED(i) |
#define | LEFT_PRESSED(i) |
#define | RIGHT_PRESSED(i) |
#define | _LEFT_PRESSED(i) |
#define | _RIGHT_PRESSED(i) |
#define | UP_PRESSED(i) |
#define | DOWN_PRESSED(i) |
#define | ROTATE_PRESSED(i) |
#define | ROTATE2_PRESSED(i) |
#define | GRAB_HELD(i) |
#define | PAUSE_PRESSED(i) |
#define | MENU_PRESSED(i) |
#define | LOADER_PRESSED(i) |
#define | ACCEL_Z_THRESHOLD 750 |
#define | ACCEL_Z_PRESSED(i) (g_wiiacc[i].z > ACCEL_Z_THRESHOLD) |
#define | DROP_PRESSED(i) |
#define | PAUSE_HELD(i) |
Functions | |
void | TCYC_ProcessInput () |
Process player input during game mode. | |
void | TCYC_ProcessEditModeInput () |
Process player input during edit mode. | |
bool | PausePressedAnyPlayer () |
Returns true if any player pressed pause. | |
Variables | |
vec3w_t | g_wiiacc [MAX_PLAYERS] |
wiimote acceleration data | |
expansion_t | g_wiiexp [MAX_PLAYERS] |
wiimote expansion-controller data |
Magical macros for handling user input.
Definition in file tcyc_input.h.
#define _LEFT_PRESSED | ( | i | ) |
( \ PAD_ButtonsDown(i) & PAD_BUTTON_LEFT \ || PAD_StickX(i) < -65 \ || (NUNCHUK_CONNECTED(i) ? \ WPAD_ButtonsDown(i) & WPAD_BUTTON_LEFT || NUNCHUK_LEFT_PRESSED(i) \ : \ WPAD_ButtonsHeld(i) & WPAD_BUTTON_UP) \ )
Definition at line 175 of file tcyc_input.h.
#define _RIGHT_PRESSED | ( | i | ) |
( \ PAD_ButtonsDown(i) & PAD_BUTTON_RIGHT \ || PAD_StickX(i) > 65 \ || (NUNCHUK_CONNECTED(i) ? \ WPAD_ButtonsDown(i) & WPAD_BUTTON_RIGHT || NUNCHUK_RIGHT_PRESSED(i) \ : \ WPAD_ButtonsHeld(i) & WPAD_BUTTON_DOWN) \ )
Definition at line 185 of file tcyc_input.h.
#define A_PRESSED | ( | i | ) |
( \ WPAD_ButtonsDown(i) & WPAD_BUTTON_A \ || PAD_ButtonsDown(i) & PAD_BUTTON_A \ )
Definition at line 147 of file tcyc_input.h.
#define ALL_ScanPads | ( | ) |
{ \ PAD_ScanPads(); \ WPAD_ScanPads(); \ for (int i = 0; i < MAX_PLAYERS; ++i) \ { \ WPAD_Accel(i, g_wiiacc + i); \ WPAD_Expansion(i, g_wiiexp + i); \ } \ for (int i = 3; i >= 0; --i) \ { \ userInput[i].pad.btns_d = PAD_ButtonsDown(i); \ userInput[i].pad.btns_u = PAD_ButtonsUp(i); \ userInput[i].pad.btns_h = PAD_ButtonsHeld(i); \ userInput[i].pad.stickX = PAD_StickX(i); \ userInput[i].pad.stickY = PAD_StickY(i); \ userInput[i].pad.substickX = PAD_SubStickX(i); \ userInput[i].pad.substickY = PAD_SubStickY(i); \ userInput[i].pad.triggerL = PAD_TriggerL(i); \ userInput[i].pad.triggerR = PAD_TriggerR(i); \ } \ }
Scans gamecube and wiimote, then updates ACCEL and EXP data.
Definition at line 42 of file tcyc_input.h.
#define B_PRESSED | ( | i | ) |
( \ WPAD_ButtonsDown(i) & WPAD_BUTTON_B \ || PAD_ButtonsDown(i) & PAD_BUTTON_B \ )
Definition at line 153 of file tcyc_input.h.
#define DOWN_PRESSED | ( | i | ) |
( \ PAD_ButtonsHeld(i) & PAD_BUTTON_X \ || PAD_ButtonsHeld(i) & PAD_BUTTON_Y \ || PAD_StickY(i) < -65 \ || (NUNCHUK_CONNECTED(i) ? \ WPAD_ButtonsDown(i) & WPAD_BUTTON_DOWN || NUNCHUK_DOWN_PRESSED(i) \ : \ WPAD_ButtonsHeld(i) & WPAD_BUTTON_LEFT) \ )
Definition at line 205 of file tcyc_input.h.
#define DROP_PRESSED | ( | i | ) |
( \ PAD_ButtonsDown(i) & PAD_BUTTON_DOWN \ || WPAD_ButtonsDown(i) & (NUNCHUK_CONNECTED(i) ? WPAD_BUTTON_DOWN : WPAD_BUTTON_A) \ )
Definition at line 258 of file tcyc_input.h.
#define GRAB_HELD | ( | i | ) |
( \ WPAD_ButtonsHeld(i) & WPAD_BUTTON_A \ )
Definition at line 231 of file tcyc_input.h.
#define LEFT_PRESSED | ( | i | ) |
( \ (g_players[i].rotation != ROTATE_REVERSE ? \ _LEFT_PRESSED(i) \ : \ _RIGHT_PRESSED(i)) \ )
Definition at line 159 of file tcyc_input.h.
#define LOADER_PRESSED | ( | i | ) |
( \ PAD_ButtonsDown(i) & PAD_TRIGGER_R \ || WPAD_ButtonsDown(i) & WPAD_BUTTON_HOME \ )
Definition at line 248 of file tcyc_input.h.
#define MENU_DOWN_PRESSED | ( | i | ) |
( \ PAD_ButtonsDown(i) & PAD_BUTTON_DOWN \ || PAD_StickY(i) < -65 \ || (NUNCHUK_CONNECTED(i) ? \ WPAD_ButtonsDown(i) & WPAD_BUTTON_DOWN || NUNCHUK_DOWN_PRESSED(i) \ : \ WPAD_ButtonsDown(i) & WPAD_BUTTON_LEFT) \ )
Definition at line 125 of file tcyc_input.h.
#define MENU_EXIT_PRESSED | ( | i | ) |
( \ PAD_ButtonsDown(i) & PAD_BUTTON_B \ || WPAD_ButtonsDown(i) & (NUNCHUK_CONNECTED(i) ? WPAD_BUTTON_B : WPAD_BUTTON_1) \ )
Definition at line 141 of file tcyc_input.h.
#define MENU_LEFT_PRESSED | ( | i | ) |
( \ PAD_ButtonsDown(i) & PAD_BUTTON_LEFT \ || PAD_StickX(i) < -65 \ || (NUNCHUK_CONNECTED(i) ? \ WPAD_ButtonsDown(i) & WPAD_BUTTON_LEFT || NUNCHUK_LEFT_PRESSED(i) \ : \ WPAD_ButtonsDown(i) & WPAD_BUTTON_UP) \ )
Definition at line 95 of file tcyc_input.h.
#define MENU_PRESSED | ( | i | ) |
( \ PAD_ButtonsDown(i) & PAD_TRIGGER_Z \ || WPAD_ButtonsDown(i) & WPAD_BUTTON_MINUS \ )
Definition at line 242 of file tcyc_input.h.
#define MENU_RIGHT_PRESSED | ( | i | ) |
( \ PAD_ButtonsDown(i) & PAD_BUTTON_RIGHT \ || PAD_StickX(i) > 65 \ || (NUNCHUK_CONNECTED(i) ? \ WPAD_ButtonsDown(i) & WPAD_BUTTON_RIGHT || NUNCHUK_RIGHT_PRESSED(i) \ : \ WPAD_ButtonsDown(i) & WPAD_BUTTON_DOWN) \ )
Definition at line 105 of file tcyc_input.h.
#define MENU_SELECT_PRESSED | ( | i | ) |
( \ PAD_ButtonsDown(i) & PAD_BUTTON_A \ || WPAD_ButtonsDown(i) & (NUNCHUK_CONNECTED(i) ? WPAD_BUTTON_A : WPAD_BUTTON_2) \ )
Definition at line 135 of file tcyc_input.h.
#define MENU_UP_PRESSED | ( | i | ) |
( \ PAD_ButtonsDown(i) & PAD_BUTTON_UP \ || PAD_StickY(i) > 65 \ || (NUNCHUK_CONNECTED(i) ? \ WPAD_ButtonsDown(i) & WPAD_BUTTON_UP || NUNCHUK_UP_PRESSED(i) \ : \ WPAD_ButtonsDown(i) & WPAD_BUTTON_RIGHT) \ )
Definition at line 115 of file tcyc_input.h.
#define PAUSE_HELD | ( | i | ) |
( \ PAD_ButtonsHeld(i) & PAD_BUTTON_START \ || WPAD_ButtonsHeld(i) & WPAD_BUTTON_PLUS \ )
Definition at line 267 of file tcyc_input.h.
#define PAUSE_PRESSED | ( | i | ) |
( \ PAD_ButtonsDown(i) & PAD_BUTTON_START \ || WPAD_ButtonsDown(i) & WPAD_BUTTON_PLUS \ )
Definition at line 236 of file tcyc_input.h.
#define RIGHT_PRESSED | ( | i | ) |
( \ (g_players[i].rotation != ROTATE_REVERSE ? \ _RIGHT_PRESSED(i) \ : \ _LEFT_PRESSED(i)) \ )
Definition at line 167 of file tcyc_input.h.
#define ROTATE2_PRESSED | ( | i | ) |
( \ PAD_ButtonsDown(i) & PAD_BUTTON_B \ || WPAD_ButtonsDown(i) & (NUNCHUK_CONNECTED(i) ? WPAD_BUTTON_B : WPAD_BUTTON_1) \ )
Definition at line 224 of file tcyc_input.h.
#define ROTATE_PRESSED | ( | i | ) |
( \ PAD_ButtonsDown(i) & PAD_BUTTON_A \ || WPAD_ButtonsDown(i) & (NUNCHUK_CONNECTED(i) ? WPAD_BUTTON_A : WPAD_BUTTON_2) \ )
Definition at line 217 of file tcyc_input.h.
#define UP_PRESSED | ( | i | ) |
( \ PAD_ButtonsDown(i) & PAD_BUTTON_UP \ || PAD_StickY(i) > 65 \ || (NUNCHUK_CONNECTED(i) ? \ WPAD_ButtonsDown(i) & WPAD_BUTTON_UP || NUNCHUK_UP_PRESSED(i) \ : \ WPAD_ButtonsDown(i) & WPAD_BUTTON_RIGHT) \ )
Definition at line 195 of file tcyc_input.h.