| 65 | //========================================================================== |
| 66 | |
| 67 | void D_ProcessEvents (void) |
| 68 | { |
| 69 | FixedBitArray<NUM_KEYS> keywasdown; |
| 70 | TArray<event_t*> delayedevents; |
| 71 | |
| 72 | keywasdown.Zero(); |
| 73 | while (eventtail != eventhead) |
| 74 | { |
| 75 | event_t *ev = &events[eventtail]; |
| 76 | eventtail = (eventtail + 1) & (MAXEVENTS - 1); |
| 77 | |
| 78 | if (ev->type == EV_KeyUp && keywasdown[ev->data1]) |
| 79 | { |
| 80 | delayedevents.Push(ev); |
| 81 | continue; |
| 82 | } |
| 83 | |
| 84 | if (ev->type == EV_None) |
| 85 | continue; |
| 86 | if (ev->type == EV_DeviceChange) |
| 87 | UpdateJoystickMenu(I_UpdateDeviceList()); |
| 88 | |
| 89 | // allow the game to intercept Escape before dispatching it. |
| 90 | if (ev->type != EV_KeyDown || ev->data1 != KEY_ESCAPE || !sysCallbacks.WantEscape || !sysCallbacks.WantEscape()) |
| 91 | { |
| 92 | if (gamestate != GS_INTRO) // GS_INTRO blocks the UI. |
| 93 | { |
| 94 | if (C_Responder(ev)) |
| 95 | continue; // console ate the event |
| 96 | if (M_Responder(ev)) |
| 97 | continue; // menu ate the event |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | if (sysCallbacks.G_Responder(ev) && ev->type == EV_KeyDown) keywasdown.Set(ev->data1); |
| 102 | } |
| 103 | |
| 104 | for (auto ev: delayedevents) |
| 105 | { |
| 106 | D_PostEvent(ev); |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | //========================================================================== |
| 111 | // |
no test coverage detected