102 Dalmatians: Puppies to the Rescue
Decompilation Source Reference | GitLab repository
Loading...
Searching...
No Matches
state.c
Go to the documentation of this file.
1/* Recovered game implementation; original addresses identify provenance. */
8#include "pcdogs/game/types.h"
14#include "pcdogs/input/types.h"
16#include "pcdogs/math/types.h"
21#include <math.h>
22#include <stdarg.h>
23#include <string.h>
24
25// Original pcdogs.exe: 0x4040d0
26// Queries digital or analog control strength, including thresholded axes and mode-zero release checks. Results are not boolean, neutral analog release can return 200, and signed slot checks do not reject negative indices. A disabled-slot sentinel selects slot zero or returns zero when that slot is also disabled.
27int32_t Input_CheckButtonState(int32_t state_index, struct Input_State const *state_table, int32_t control_code, int32_t mode_or_threshold)
28{
29 int32_t selected_state_index = state_index;
30
31 if (selected_state_index >= INPUT_PLAYER_COUNT || state_table[selected_state_index].button_bits == INPUT_STATE_DISABLED)
32 selected_state_index = 0;
33
34 struct Input_State const *selected_input = &state_table[selected_state_index];
35 int32_t selected_buttons = selected_input->button_bits;
36
37 if (selected_buttons != INPUT_STATE_DISABLED)
38 {
39 if (control_code < INPUT_BIT_COUNT)
40 {
41 char button_bit_index = (uint8_t)control_code;
42
43 if (!mode_or_threshold)
44 {
45 if (!(selected_buttons & 1 << (button_bit_index & INPUT_BIT_INDEX_MASK)))
47 }
48 else if (selected_buttons & 1 << (button_bit_index & INPUT_BIT_INDEX_MASK))
50 }
52 {
53 int32_t axis_dispatch_case = Input_AxisDispatchCases[control_code - INPUT_ANALOG_COMBINED_POSITIVE_X];
54 int16_t negative_axis_strength;
55 int16_t positive_axis_strength;
56 int32_t axis_threshold_q12;
57 int32_t axis_strength_q12;
58
59 switch (axis_dispatch_case)
60 {
62 {
63 if (selected_buttons & 1 << ((control_code - INPUT_ANALOG_COMBINED_POSITIVE_X) & INPUT_BIT_INDEX_MASK))
64 return ((mode_or_threshold) ? INPUT_DIGITAL_STRENGTH : 0);
65
66 int16_t combined_axis_strength;
67
68 if (control_code == INPUT_ANALOG_COMBINED_POSITIVE_X)
69 {
70 combined_axis_strength = selected_input->axis.x;
71
72 int16_t aux_x_positive = selected_input->axis_aux.x;
73
74 if (combined_axis_strength < aux_x_positive)
75 combined_axis_strength = aux_x_positive;
76 }
77 else if (control_code != INPUT_ANALOG_COMBINED_NEGATIVE_X)
78 {
79 combined_axis_strength = selected_input->axis.y;
80
81 if (control_code != INPUT_ANALOG_COMBINED_POSITIVE_Y)
82 {
83 int16_t aux_y_negative = selected_input->axis_aux.y;
84
85 combined_axis_strength = -(combined_axis_strength);
86
87 if ((int32_t)combined_axis_strength < -((int32_t)aux_y_negative))
88 combined_axis_strength = -(aux_y_negative);
89 }
90 else
91 {
92 int16_t aux_y_positive = selected_input->axis_aux.y;
93
94 if (combined_axis_strength < aux_y_positive)
95 combined_axis_strength = aux_y_positive;
96 }
97 }
98 else
99 {
100 combined_axis_strength = selected_input->axis.x;
101
102 int16_t aux_x_negative = selected_input->axis_aux.x;
103
104 combined_axis_strength = -(combined_axis_strength);
105
106 if ((int32_t)combined_axis_strength < -((int32_t)aux_x_negative))
107 combined_axis_strength = -(aux_x_negative);
108 }
109
110 if (combined_axis_strength <= 0)
111 {
112 return mode_or_threshold ? 0 : INPUT_ANALOG_STRENGTH_MAX;
113 }
114
115 if (mode_or_threshold)
116 return ((int32_t)combined_axis_strength * INPUT_ANALOG_STRENGTH_MAX) >> INPUT_Q12_SHIFT;
117
118 break;
119 }
120
122 {
123 int16_t x = selected_input->axis.x;
124
125 if (x >= 0)
126 {
127 int32_t positive_x_axis_strength = (int32_t)x;
128
129 if (positive_x_axis_strength >= (mode_or_threshold << INPUT_Q12_SHIFT) / INPUT_DIGITAL_STRENGTH)
130 return (positive_x_axis_strength * INPUT_ANALOG_STRENGTH_MAX) >> INPUT_Q12_SHIFT;
131 }
132
133 break;
134 }
135
140 {
141 if (axis_dispatch_case == INPUT_AXIS_PRIMARY_NEGATIVE_X)
142 negative_axis_strength = selected_input->axis.x;
143 else if (axis_dispatch_case == INPUT_AXIS_PRIMARY_NEGATIVE_Y)
144 negative_axis_strength = selected_input->axis.y;
145 else if (axis_dispatch_case == INPUT_AXIS_AUX_NEGATIVE_X)
146 negative_axis_strength = selected_input->axis_aux.x;
147 else
148 negative_axis_strength = selected_input->axis_aux.y;
149
150 negative_axis_strength = -(negative_axis_strength);
151
152 if (negative_axis_strength >= 0)
153 {
154 axis_strength_q12 = (int32_t)negative_axis_strength;
155 axis_threshold_q12 = (mode_or_threshold << INPUT_Q12_SHIFT) / INPUT_DIGITAL_STRENGTH;
156
157 if (axis_strength_q12 >= axis_threshold_q12)
158 return (axis_strength_q12 * INPUT_ANALOG_STRENGTH_MAX) >> INPUT_Q12_SHIFT;
159 }
160
161 break;
162 }
163
167 {
168 if (axis_dispatch_case == INPUT_AXIS_PRIMARY_POSITIVE_Y)
169 positive_axis_strength = selected_input->axis.y;
170 else if (axis_dispatch_case == INPUT_AXIS_AUX_POSITIVE_X)
171 positive_axis_strength = selected_input->axis_aux.x;
172 else
173 positive_axis_strength = selected_input->axis_aux.y;
174
175 if (positive_axis_strength >= 0)
176 {
177 axis_strength_q12 = (int32_t)positive_axis_strength;
178 axis_threshold_q12 = (mode_or_threshold << INPUT_Q12_SHIFT) / INPUT_DIGITAL_STRENGTH;
179
180 if (axis_strength_q12 >= axis_threshold_q12)
181 return (axis_strength_q12 * INPUT_ANALOG_STRENGTH_MAX) >> INPUT_Q12_SHIFT;
182 }
183
184 break;
185 }
186 }
187 }
188 }
189
190 return 0;
191}
192
193// Original pcdogs.exe: 0x43d740
194// Clears input state, initializes the joystick subsystem, stores its availability, and sets force-feedback scale to 0.75.
201
202// Original pcdogs.exe: 0x43d780
203// Merges active keyboard mappings into the input button mask. Holding F10 also requests a screenshot.
205{
206 for (uint32_t i = 0; i < (uint32_t)g_mappingCount; i++)
207 {
208 if (GetAsyncKeyState(g_keyboardMappingKeys[i]) < 0)
210 }
211 if (GetAsyncKeyState(VK_F10) < 0)
213}
214
215/* At exactly +/-700 the game preserves the existing axis value. */
216static void sample_analog_axis(int32_t raw, int16_t *axis)
217{
218 if (raw <= -INPUT_JOYSTICK_DIGITAL_THRESHOLD || raw >= INPUT_JOYSTICK_DIGITAL_THRESHOLD)
219 return;
220
221 if (raw <= -INPUT_JOYSTICK_DEADZONE)
223 else if (raw >= INPUT_JOYSTICK_DEADZONE)
225 else
226 return;
227
229}
230
231// Original pcdogs.exe: 0x43d7e0
232// Polls the joystick, merges directional buttons and analog axes, then frees the temporary state. X and Y use strict digital thresholds beyond +/-700, leaving exactly +/-700 outside both conversion and digital paths; Rz uses strict +/-600 thresholds.
234{
236 return;
237
239 int32_t axis_x_raw = Input_GetJoystickAxisX(g_pJoystickState);
240 int32_t axis_y_raw = Input_GetJoystickAxisY(g_pJoystickState);
241 int32_t axis_rz_raw = Input_GetJoystickAxisRz(g_pJoystickState);
242
243 if (axis_x_raw < -INPUT_JOYSTICK_DIGITAL_THRESHOLD)
245 if (axis_x_raw > INPUT_JOYSTICK_DIGITAL_THRESHOLD)
247 if (axis_y_raw < -INPUT_JOYSTICK_DIGITAL_THRESHOLD)
249 if (axis_y_raw > INPUT_JOYSTICK_DIGITAL_THRESHOLD)
251
252 sample_analog_axis(axis_x_raw, &state->axis.x);
253 sample_analog_axis(axis_y_raw, &state->axis.y);
254
255 int16_t x = state->axis.x;
256 int16_t y = state->axis.y;
257
259 {
260 if (y < INPUT_JOYSTICK_DEADZONE && y > -INPUT_JOYSTICK_DEADZONE)
261 {
262 uint32_t button_bits = state->button_bits;
263
264 if ((uint8_t)button_bits & INPUT_BUTTON_UP)
265 {
266 state->axis.y = INPUT_Q12_ONE;
268 }
269 else if ((uint8_t)button_bits & INPUT_BUTTON_DOWN)
270 {
273 }
274 }
275 }
277 {
278 uint32_t button_bits = state->button_bits;
279
280 if ((uint8_t)button_bits & INPUT_BUTTON_LEFT)
281 {
282 state->axis.x = INPUT_Q12_ONE;
284 }
285 else if ((uint8_t)button_bits & INPUT_BUTTON_RIGHT)
286 {
289 }
290 }
291
292 if (axis_rz_raw < -INPUT_JOYSTICK_RZ_THRESHOLD)
294
295 if (axis_rz_raw > INPUT_JOYSTICK_RZ_THRESHOLD)
297
298 for (int control = INPUT_GAMEPAD_BUTTON_0; control <= INPUT_GAMEPAD_BUTTON_12; control++)
299 {
302 }
303
305 g_pJoystickState = NULL;
306}
307
308// Original pcdogs.exe: 0x43de70
309// Tests the high bit returned by GetAsyncKeyState to report whether the key is currently down.
310BOOL Input_IsKeyPressedAsync(int32_t v_key)
311{
312 return GetAsyncKeyState(v_key) < 0;
313}
314
315// Original pcdogs.exe: 0x43de90
316// Returns the first pressed keyboard key, joystick direction, or joystick button in that priority order, or -1. Successful joystick matches retain the allocated state while the no-match path frees it; failed polling is not checked before state access.
318{
319 int32_t control_code;
320
321 for (control_code = 0; control_code < INPUT_KEY_CODE_COUNT; control_code += 1)
322 {
323 if (GetAsyncKeyState(control_code) < 0)
324 return control_code;
325 }
326
328 return INPUT_NO_CONTROL;
329
330 struct Input_JoystickState *joystick_state =
332
333 g_pJoystickState = joystick_state;
334
335 int32_t axis_x_raw = Input_GetJoystickAxisX(joystick_state);
336 int32_t axis_y_raw = Input_GetJoystickAxisY(g_pJoystickState);
337 int32_t axis_rz_raw = Input_GetJoystickAxisRz(g_pJoystickState);
338
339 if (axis_x_raw < -INPUT_JOYSTICK_RZ_THRESHOLD)
340 return INPUT_GAMEPAD_LEFT;
341
342 if (axis_x_raw > INPUT_JOYSTICK_RZ_THRESHOLD)
343 return INPUT_GAMEPAD_RIGHT;
344
345 if (axis_y_raw < -INPUT_JOYSTICK_RZ_THRESHOLD)
346 return INPUT_GAMEPAD_UP;
347
348 if (axis_y_raw > INPUT_JOYSTICK_RZ_THRESHOLD)
349 return INPUT_GAMEPAD_DOWN;
350
351 if (axis_rz_raw < -INPUT_JOYSTICK_RZ_THRESHOLD)
353
354 if (axis_rz_raw > INPUT_JOYSTICK_RZ_THRESHOLD)
356
357 for (control_code = INPUT_GAMEPAD_BUTTON_0; control_code <= INPUT_GAMEPAD_BUTTON_12; control_code += 1)
358 {
360 return control_code;
361 }
362
364 g_pJoystickState = NULL;
365
366 return INPUT_NO_CONTROL;
367}
368
369// Original pcdogs.exe: 0x43dfb0
370// Pumps window messages through accelerator translation and dispatch, returning early for selected move, size, and system messages. A quit message sets the quit latch and requests closure, while an already-set latch exits the process.
372{
374 {
375 CRT_exit(0);
376 /* no return */
377 }
378
379 MSG msg;
380
381 if (!PeekMessageA(&msg, NULL, 0, 0, PM_NOREMOVE))
382 return 1;
383
384 BOOL more_messages_pending;
385
386 do
387 {
388 if (!GetMessageA(&msg, NULL, 0, 0))
389 {
392
393 return 0;
394 }
395
396 switch (msg.message)
397 {
398 case WM_MOVE:
399 case WM_SIZE:
400 case WM_SYSKEYDOWN:
401 case WM_SYSKEYUP:
402 case WM_SYSCHAR:
403 case WM_SYSDEADCHAR:
404 case WM_SYSCOMMAND:
405 return 1;
406 }
407
408 if (!TranslateAcceleratorA(Window_MainHandle, (HACCEL)(g_acceleratorTable), &msg))
409 {
410 TranslateMessage(&msg);
411 DispatchMessageA(&msg);
412 }
413
414 more_messages_pending = PeekMessageA(&msg, NULL, 0, 0, PM_NOREMOVE);
415 } while (more_messages_pending);
416
417 return 1;
418}
419
420// Original pcdogs.exe: 0x43e2f0
421// Clears raw input and selected graphics flags, updates frame-transition flags, and records the current elapsed tick after display setup.
433
434// Original pcdogs.exe: 0x442e40
435// Writes a movement vector from digital or analog input state.
436void Input_CalculateMovementVector(struct Math_Vec3I32 *out_move_vector, int32_t player_index, int32_t heading_angle)
437{
438 out_move_vector->y = 0;
439
440 int32_t angle;
441
442 // Wave5 Agent07 SSOT 2026-05-06: D-pad route path reads buttons at 0x00634460 + playerIndex*12, masks low
443 // nibble, then jump-table maps bit combinations to heading offsets before trig output.
444 switch ((g_inputStateCurrentP1[player_index].button_bits & INPUT_BUTTON_DIRECTIONS) - 1)
445 {
446 case INPUT_BUTTON_LEFT - 1:
447 {
448 angle = heading_angle + INPUT_ANGLE_QUARTER_TURN;
449 out_move_vector->x = Math_SinQ14(angle) >> INPUT_Q14_TO_Q12_SHIFT;
450 out_move_vector->z = Math_SinQ14(INPUT_ANGLE_QUARTER_TURN - angle) >> INPUT_Q14_TO_Q12_SHIFT;
451
452 return;
453 }
454
455 case INPUT_BUTTON_RIGHT - 1:
456 {
457 // Wave5 Agent07 SSOT 2026-05-06: low-nibble value 0x2 reaches this case (after decrement case index 1): route
458 // button=2 / D-pad-right in retail input encoding -> heading + 0x0C00 (-0x400).
459 angle = heading_angle + (3 * INPUT_ANGLE_QUARTER_TURN);
460 out_move_vector->x = Math_SinQ14(angle) >> INPUT_Q14_TO_Q12_SHIFT;
461 out_move_vector->z = Math_SinQ14(INPUT_ANGLE_QUARTER_TURN - angle) >> INPUT_Q14_TO_Q12_SHIFT;
462
463 return;
464 }
465
466 case INPUT_BUTTON_UP - 1:
467 {
468 out_move_vector->x = Math_SinQ14(heading_angle) >> INPUT_Q14_TO_Q12_SHIFT;
469 out_move_vector->z = Math_SinQ14(INPUT_ANGLE_QUARTER_TURN - heading_angle) >> INPUT_Q14_TO_Q12_SHIFT;
470
471 return;
472 }
473
475 {
476 angle = heading_angle + INPUT_ANGLE_EIGHTH_TURN;
477 out_move_vector->x = Math_SinQ14(angle) >> INPUT_Q14_TO_Q12_SHIFT;
478 out_move_vector->z = Math_SinQ14(INPUT_ANGLE_QUARTER_TURN - angle) >> INPUT_Q14_TO_Q12_SHIFT;
479
480 return;
481 }
482
484 {
485 angle = heading_angle + (7 * INPUT_ANGLE_EIGHTH_TURN);
486 out_move_vector->x = Math_SinQ14(angle) >> INPUT_Q14_TO_Q12_SHIFT;
487 out_move_vector->z = Math_SinQ14(INPUT_ANGLE_QUARTER_TURN - angle) >> INPUT_Q14_TO_Q12_SHIFT;
488
489 return;
490 }
491
492 case INPUT_BUTTON_DOWN - 1:
493 {
494 angle = heading_angle + INPUT_ANGLE_HALF_TURN;
495 out_move_vector->x = Math_SinQ14(angle) >> INPUT_Q14_TO_Q12_SHIFT;
496 out_move_vector->z = Math_SinQ14(INPUT_ANGLE_QUARTER_TURN - angle) >> INPUT_Q14_TO_Q12_SHIFT;
497
498 return;
499 }
500
502 {
503 angle = heading_angle + (3 * INPUT_ANGLE_EIGHTH_TURN);
504 out_move_vector->x = Math_SinQ14(angle) >> INPUT_Q14_TO_Q12_SHIFT;
505 out_move_vector->z = Math_SinQ14(INPUT_ANGLE_QUARTER_TURN - angle) >> INPUT_Q14_TO_Q12_SHIFT;
506
507 return;
508 }
509
511 {
512 angle = heading_angle + (5 * INPUT_ANGLE_EIGHTH_TURN);
513 out_move_vector->x = Math_SinQ14(angle) >> INPUT_Q14_TO_Q12_SHIFT;
514 out_move_vector->z = Math_SinQ14(INPUT_ANGLE_QUARTER_TURN - angle) >> INPUT_Q14_TO_Q12_SHIFT;
515
516 return;
517 }
518 }
519
520 // Wave5 Agent07 SSOT 2026-05-06: analog fallback reads signed axes at 0x00634464/+0x00634466 plus
521 // playerIndex*12 and rotates them by the same heading; D-pad path bypasses these axes.
522 int32_t x = (int32_t)g_inputStateCurrentP1[player_index].axis.x;
523 int32_t y = (int32_t)g_inputStateCurrentP1[player_index].axis.y;
524
525 /* analog vertical axis remains y */
526 if (!(y | x))
527 {
528 out_move_vector->z = 0;
529 out_move_vector->x = 0;
530
531 return;
532 }
533
534 out_move_vector->x = (((Math_SinQ14(INPUT_ANGLE_QUARTER_TURN - heading_angle) >> INPUT_Q14_TO_Q12_SHIFT) * x) >> INPUT_Q12_SHIFT) + (((Math_SinQ14(heading_angle) >> INPUT_Q14_TO_Q12_SHIFT) * y) >> INPUT_Q12_SHIFT);
535 out_move_vector->z = (((Math_SinQ14(INPUT_ANGLE_QUARTER_TURN - heading_angle) >> INPUT_Q14_TO_Q12_SHIFT) * y) >> INPUT_Q12_SHIFT) - (((Math_SinQ14(heading_angle) >> INPUT_Q14_TO_Q12_SHIFT) * x) >> INPUT_Q12_SHIFT);
536}
537
538// Original pcdogs.exe: 0x443130
539// Updates both player input records and optionally replaces player-one input with replay data. Replay advances exactly one record on an equal frame boundary with no catch-up or bounds check, while player two remains live and designated player-one buttons can stop playback.
541{
542 // INPUT UPDATE MAIN LOOP: Updates input for 2 players (0-1). Saves previous state for edge detection, polls
543 // fresh input via ReadInputDevices, then handles button masking or recording playback
544 for (int32_t player_index = 0; player_index < INPUT_PLAYER_COUNT; player_index += 1)
545 {
546 g_inputStatePreviousP1[player_index].button_bits =
547 g_inputStateCurrentP1[player_index].button_bits;
548
549 struct Math_Vec2I16 axis = g_inputStateCurrentP1[player_index].axis;
550
551 g_inputStatePreviousP1[player_index].axis.x = axis.x;
552 g_inputStatePreviousP1[player_index].axis.y = axis.y;
553
554 struct Math_Vec2I16 axis_aux = g_inputStateCurrentP1[player_index].axis_aux;
555
556 g_inputStatePreviousP1[player_index].axis_aux.x = axis_aux.x;
557 g_inputStatePreviousP1[player_index].axis_aux.y = axis_aux.y;
558 Input_ReadDevices(player_index, &g_inputStateCurrentP1[player_index]);
559
560 // Read fresh input from keyboard and gamepad devices
562 {
563 if (g_inputToggleMasks[player_index])
564 {
565 for (uint32_t button_mask = INPUT_BUTTON_CANCEL; button_mask; button_mask >>= 1)
566 {
567 int32_t toggle_mask = g_inputToggleMasks[player_index];
568
569 if (button_mask & toggle_mask)
570 {
571 uint32_t sampled_buttons =
572 g_inputStateCurrentP1[player_index].button_bits;
573
574 if (!(button_mask & sampled_buttons))
575 g_inputToggleMasks[player_index] = ~button_mask & toggle_mask;
576 else
577 g_inputStateCurrentP1[player_index].button_bits =
578 ~button_mask & sampled_buttons;
579 }
580 }
581 }
582 }
583 else if (!player_index)
584 {
585 // Check if in recording playback mode (bit 0x20 of g_gameStateFlags)
586 struct Replay_InputRecord32 *replay_record = g_demoReplayInputPtr;
587
588 if (g_frameCounter != replay_record->end_frame)
589 {
590 uint32_t button_bits = g_inputStateCurrentP1[0].button_bits;
591
593 {
595
596 continue;
597 }
598 }
599 else
600 {
601 replay_record = &replay_record[1];
602 g_demoReplayInputPtr = replay_record;
603
604 if (replay_record->button_bits == INPUT_STATE_DISABLED)
605 {
607
608 continue;
609 }
610 }
611
612 g_inputStateCurrentP1[0].button_bits = replay_record->button_bits;
613
614 struct Replay_InputRecord32 replayed_primary_axes;
615
616 replayed_primary_axes.axis_x = replay_record->axis_x;
617 replayed_primary_axes.axis_y = replay_record->axis_y;
618 g_inputStateCurrentP1[0].axis.x = replayed_primary_axes.axis_x;
619 g_inputStateCurrentP1[0].axis.y = replayed_primary_axes.axis_y;
620
621 struct Replay_InputRecord32 replayed_auxiliary_axes;
622
623 replayed_auxiliary_axes.aux_x = replay_record->aux_x;
624 replayed_auxiliary_axes.aux_y = replay_record->aux_y;
625 g_inputStateCurrentP1[0].axis_aux.x = replayed_auxiliary_axes.aux_x;
626 g_inputStateCurrentP1[0].axis_aux.y = replayed_auxiliary_axes.aux_y;
627 }
628 }
629}
630
631// Original pcdogs.exe: 0x444ff0
632// Clears all 256 bytes of the raw input-state buffer.
634{
635 __builtin_memset(&g_inputStateBuffer, 0, sizeof(g_inputStateBuffer));
636}
637
638// Original pcdogs.exe: 0x445010
639// Finds a scan code in the sentinel-terminated key table and returns its input-state byte. Missing keys return zero through the one-byte result contract.
640uint8_t Input_IsKeyPressed(uint8_t scan_code)
641{
642 int32_t mapping_index = 0;
643
644 if (g_keyMappingTable[0].display_name)
645 {
646 struct Input_KeyMappingRecord *mapping_cursor = g_keyMappingTable;
647 char const *next_key_name;
648
649 do
650 {
651 if (mapping_cursor->scan_code == scan_code)
652 {
653 int32_t mapped_scan_code = g_keyMappingTable[mapping_index].scan_code;
654
655 return g_inputStateBuffer[mapped_scan_code];
656 }
657
658 next_key_name = mapping_cursor[1].display_name;
659 mapping_cursor += 1;
660 mapping_index += 1;
661 } while (next_key_name);
662 }
663
664 return 0;
665}
666
667// Original pcdogs.exe: 0x445050
668// Marks the low eight bits of the supplied scan code as down in the input-state buffer.
670{
671 g_inputStateBuffer[(uint32_t)scan_code] = 1;
672}
673
674// Original pcdogs.exe: 0x445070
675// Marks the low eight bits of the supplied scan code as up in the input-state buffer.
677{
678 g_inputStateBuffer[(uint32_t)scan_code] = 0;
679}
#define GAME_TRANSITION_RESET_CLEAR
Definition constants.h:9
#define GAME_TRANSITION_LOAD_LEVEL
Definition constants.h:26
#define GAME_TRANSITION_REPLAY_PLAYBACK
Definition constants.h:21
void Replay_StopPlayback(void)
Definition replay.c:66
#define Game_FrameTransitionFlags
Definition globals.h:47
#define g_demoReplayInputPtr
Definition globals.h:41
#define GRAPHICS_CAP_DISPLAY_RESET_RESERVED_11
Definition constants.h:75
#define GRAPHICS_CAP_FRAME_TRANSITION
Definition constants.h:14
#define GRAPHICS_CAP_DISPLAY_RESET_RESERVED_5
Definition constants.h:73
#define GRAPHICS_CAP_DISPLAY_RESET_RESERVED_8
Definition constants.h:74
void Graphics_TakeScreenshot(void)
Definition screenshots.c:13
#define Graphics_RenderFrame_LastFrameTick
Definition globals.h:275
#define g_graphicsCapabilities
Definition globals.h:284
#define INPUT_BUTTON_CONFIRM
Definition constants.h:11
#define INPUT_BIT_COUNT
Definition constants.h:46
#define INPUT_Q12_ONE
Definition constants.h:38
#define INPUT_ANGLE_QUARTER_TURN
Definition constants.h:40
#define INPUT_ANALOG_STRENGTH_MAX
Definition constants.h:44
#define INPUT_STATE_DISABLED
Definition constants.h:20
#define INPUT_AXIS_DISPATCH_LAST_OFFSET
Definition constants.h:47
#define INPUT_Q14_TO_Q12_SHIFT
Definition constants.h:34
#define INPUT_JOYSTICK_DEADZONE
Definition constants.h:27
#define INPUT_BUTTON_UP
Definition constants.h:6
#define INPUT_Q12_NEGATIVE_ONE_BITS
Definition constants.h:39
#define INPUT_PLAYER_COUNT
Definition constants.h:32
#define INPUT_JOYSTICK_RZ_THRESHOLD
Definition constants.h:26
#define INPUT_BUTTON_LEFT
Definition constants.h:4
#define INPUT_BUTTON_RIGHT
Definition constants.h:5
#define INPUT_BUTTON_CANCEL
Definition constants.h:17
#define INPUT_RUMBLE_SCALE_DEFAULT
Definition constants.h:49
#define INPUT_BUTTON_DIRECTIONS
Definition constants.h:18
#define INPUT_ANGLE_HALF_TURN
Definition constants.h:42
#define INPUT_NO_CONTROL
Definition constants.h:59
#define INPUT_JOYSTICK_DIGITAL_THRESHOLD
Definition constants.h:25
@ INPUT_ANALOG_COMBINED_NEGATIVE_X
Definition constants.h:95
@ INPUT_ANALOG_COMBINED_POSITIVE_X
Definition constants.h:94
@ INPUT_ANALOG_COMBINED_POSITIVE_Y
Definition constants.h:96
#define INPUT_BIT_INDEX_MASK
Definition constants.h:45
#define INPUT_DIGITAL_STRENGTH
Definition constants.h:43
@ INPUT_GAMEPAD_DOWN
Definition constants.h:72
@ INPUT_GAMEPAD_UP
Definition constants.h:71
@ INPUT_GAMEPAD_LEFT
Definition constants.h:73
@ INPUT_GAMEPAD_BUTTON_0
Definition constants.h:77
@ INPUT_GAMEPAD_RIGHT
Definition constants.h:74
@ INPUT_GAMEPAD_BUTTON_12
Definition constants.h:89
@ INPUT_GAMEPAD_RZ_NEGATIVE
Definition constants.h:75
@ INPUT_GAMEPAD_RZ_POSITIVE
Definition constants.h:76
@ INPUT_AXIS_AUX_NEGATIVE_X
Definition constants.h:108
@ INPUT_AXIS_AUX_POSITIVE_Y
Definition constants.h:109
@ INPUT_AXIS_PRIMARY_NEGATIVE_Y
Definition constants.h:106
@ INPUT_AXIS_COMBINED
Definition constants.h:102
@ INPUT_AXIS_PRIMARY_POSITIVE_X
Definition constants.h:103
@ INPUT_AXIS_PRIMARY_NEGATIVE_X
Definition constants.h:104
@ INPUT_AXIS_AUX_POSITIVE_X
Definition constants.h:107
@ INPUT_AXIS_PRIMARY_POSITIVE_Y
Definition constants.h:105
@ INPUT_AXIS_AUX_NEGATIVE_Y
Definition constants.h:110
#define INPUT_Q12_SHIFT
Definition constants.h:33
#define INPUT_BUTTON_DOWN
Definition constants.h:7
#define INPUT_KEY_CODE_COUNT
Definition constants.h:28
#define INPUT_ANGLE_EIGHTH_TURN
Definition constants.h:41
int32_t Input_GetJoystickAxisY(struct Input_JoystickState *joy_state)
Definition devices.c:202
void Input_SetForceFeedbackScale(float scale)
void Input_ReadDevices(int32_t unused_player_index, struct Input_State *state)
Definition devices.c:344
BOOL DInput_InitializeJoystickInput(HWND hwnd, HINSTANCE h_instance)
Definition devices.c:307
int32_t Input_GetJoystickAxisRz(struct Input_JoystickState *joy_state)
Definition devices.c:211
struct Input_JoystickState * Input_PollJoystickState(IDirectInputDevice2A *device)
Definition devices.c:179
BOOL Input_IsJoystickButtonPressed(struct Input_JoystickState *joy_state, int32_t button_index)
Definition devices.c:228
int32_t Input_GetJoystickAxisX(struct Input_JoystickState *joy_state)
Definition devices.c:193
#define g_pJoystickState
Definition globals.h:47
#define Input_ReadGamepad_AxisInvRange
Definition globals.h:20
#define g_inputStatePreviousP1
Definition globals.h:65
#define g_inputStateCurrentP1
Definition globals.h:72
#define g_keyMappingTable
Definition globals.h:35
#define Input_GamepadActionMasks
Definition globals.h:144
#define Input_AxisDispatchCases
Definition globals.h:141
#define Input_ProcessWindowMessages_ShouldQuit
Definition globals.h:56
#define input_joystick_available
Definition globals.h:135
#define g_pDirectInputJoystickDevice
Definition globals.h:50
#define g_inputStateBuffer
Definition globals.h:62
#define Input_ReadGamepad_AxisScale
Definition globals.h:17
#define g_inputToggleMasks
Definition globals.h:68
int32_t Input_GetPressedButton()
Definition state.c:317
void Input_ResetState()
Definition state.c:422
void Input_ReadGamepad(struct Input_State *state)
Definition state.c:233
BOOL Input_ProcessWindowMessages()
Definition state.c:371
void Input_SetKeyDown(uint8_t scan_code)
Definition state.c:669
BOOL Input_IsKeyPressedAsync(int32_t v_key)
Definition state.c:310
void Input_Update()
Definition state.c:540
void Input_SetKeyUp(uint8_t scan_code)
Definition state.c:676
int32_t Input_CheckButtonState(int32_t state_index, struct Input_State const *state_table, int32_t control_code, int32_t mode_or_threshold)
Definition state.c:27
void Input_ClearState()
Definition state.c:633
uint8_t Input_IsKeyPressed(uint8_t scan_code)
Definition state.c:640
void Input_CalculateMovementVector(struct Math_Vec3I32 *out_move_vector, int32_t player_index, int32_t heading_angle)
Definition state.c:436
static void sample_analog_axis(int32_t raw, int16_t *axis)
Definition state.c:216
void Input_InitializeInputSubsystem(HWND hwnd, HINSTANCE h_instance)
Definition state.c:195
void Input_ReadKeyboard(struct Input_State *state)
Definition state.c:204
int32_t Math_SinQ14(int32_t angle)
void Window_RequestClose()
Definition window.c:101
uint32_t Timer_GetElapsedTickCount()
Definition timer.c:24
#define Window_MainHandle
Definition globals.h:213
void CRT_free(void *ptr)
Definition heap.c:164
void CRT_exit(int32_t status)
Definition startup.c:135
int64_t __ftol_msvc(long double value)
char const * display_name
Definition types.h:59
struct Math_Vec2I16 axis
Definition types.h:84
uint32_t button_bits
Definition types.h:83
struct Math_Vec2I16 axis_aux
Definition types.h:85
int16_t x
Definition types.h:402
int16_t y
Definition types.h:403
int32_t y
Definition types.h:471
int32_t x
Definition types.h:470
int32_t z
Definition types.h:472
int32_t end_frame
Definition types.h:82
uint32_t button_bits
Definition types.h:83
#define g_acceleratorTable
Definition values.h:546
#define g_keyboardMappingButtons
Definition values.h:489
#define g_gamepadAxisRzNegativeMask
Definition values.h:573
#define g_gamepadAxisXNegativeMask
Definition values.h:567
#define g_frameCounter
Definition values.h:501
#define g_gamepadAxisRzPositiveMask
Definition values.h:576
#define g_gamepadAxisXPositiveMask
Definition values.h:570
#define g_gamepadAxisYNegativeMask
Definition values.h:561
#define g_gamepadAxisYPositiveMask
Definition values.h:564
#define g_mappingCount
Definition values.h:558
#define g_keyboardMappingKeys
Definition values.h:486
#define PM_NOREMOVE