2019-11-30 14:48:36 +00:00
|
|
|
// Changed from their TH02 values.
|
2021-01-21 13:13:12 +00:00
|
|
|
typedef uint16_t input_t;
|
|
|
|
|
|
|
|
static const input_t INPUT_NONE = 0x0000;
|
|
|
|
static const input_t INPUT_UP = 0x0001;
|
|
|
|
static const input_t INPUT_DOWN = 0x0002;
|
|
|
|
static const input_t INPUT_LEFT = 0x0004;
|
|
|
|
static const input_t INPUT_RIGHT = 0x0008;
|
|
|
|
static const input_t INPUT_BOMB = 0x0010;
|
|
|
|
static const input_t INPUT_SHOT = 0x0020;
|
|
|
|
static const input_t INPUT_UP_LEFT = 0x0100;
|
|
|
|
static const input_t INPUT_DOWN_LEFT = 0x0200;
|
|
|
|
static const input_t INPUT_UP_RIGHT = 0x0400;
|
|
|
|
static const input_t INPUT_DOWN_RIGHT = 0x0800;
|
|
|
|
static const input_t INPUT_CANCEL = 0x1000;
|
|
|
|
static const input_t INPUT_OK = 0x2000;
|
|
|
|
static const input_t INPUT_Q = 0x4000;
|
2019-11-30 14:48:36 +00:00
|
|
|
|
|
|
|
/// Variables
|
|
|
|
/// ---------
|
|
|
|
// Multi-player P1/P2 controls
|
2021-01-21 13:13:12 +00:00
|
|
|
extern input_t input_mp_p1;
|
|
|
|
extern input_t input_mp_p2;
|
2020-09-06 19:55:48 +00:00
|
|
|
// Single-player controls.
|
2021-01-21 13:13:12 +00:00
|
|
|
extern input_t input_sp;
|
2019-11-30 14:48:36 +00:00
|
|
|
/// ---------
|
|
|
|
|
|
|
|
/// Modes
|
|
|
|
/// -----
|
|
|
|
extern farfunc_t_near input_mode;
|
|
|
|
|
|
|
|
// Merges the inputs for the P1 multi-player keys into the single-player state
|
|
|
|
// after sensing.
|
|
|
|
void pascal input_mode_interface();
|
|
|
|
|
|
|
|
void pascal input_mode_key_vs_key(); // Completely ignores joystick input.
|
|
|
|
void pascal input_mode_joy_vs_key();
|
|
|
|
void pascal input_mode_key_vs_joy();
|
|
|
|
|
|
|
|
void pascal input_mode_1p_vs_cpu();
|
|
|
|
void pascal input_mode_cpu_vs_1p();
|
|
|
|
// Just allows quitting via the OK or CANCEL buttons, both of which are mapped
|
|
|
|
// to INPUT_CANCEL.
|
|
|
|
void pascal input_mode_cpu_vs_cpu();
|
|
|
|
// Just allows quitting via pressing any button.
|
|
|
|
void pascal input_mode_attract();
|
|
|
|
/// -----
|
|
|
|
|
|
|
|
// Basic keyboard input function in this game. Resets and updates all three
|
|
|
|
// variables according to the keyboard state, with accurate detection of held
|
|
|
|
// keyboard keys.
|
|
|
|
void input_reset_sense_key_held();
|
|
|
|
|
2020-12-30 11:16:11 +00:00
|
|
|
// Waits the given number of [frames] for OK or SHOT to be pressed. Returns
|
|
|
|
// `true` if that happened, and `false` otherwise.
|
|
|
|
bool16 pascal input_wait_for_ok(unsigned int frames);
|
2019-12-07 07:11:12 +00:00
|
|
|
|
|
|
|
// Waits until BGM playback reached the given [measure] for OK or SHOT to be
|
2020-12-30 11:16:11 +00:00
|
|
|
// pressed. Returns `true` if that happened, and `false` otherwise. Falls back
|
|
|
|
// on input_wait_for_ok() with the given number of [frames] if BGM is disabled.
|
|
|
|
bool16 pascal input_wait_for_ok_or_measure(int measure, unsigned int frames);
|
2019-12-07 07:11:12 +00:00
|
|
|
|
2019-11-30 14:48:36 +00:00
|
|
|
// Waits for all held inputs to be released, then waits the given number of
|
|
|
|
// [frames] for an (interface) input to be pressed. Set [frames] to 0 or 9999
|
|
|
|
// to wait forever.
|
|
|
|
void pascal input_wait_for_change(int frames);
|