- minor optimization to last PR to use a FixedBitArray to reduce stack impact of the check array.

This commit is contained in:
Christoph Oelckers 2021-11-21 10:10:58 +01:00
parent b1fea228be
commit 4530a7b583

View file

@ -67,9 +67,10 @@ CVAR(Bool, m_filter, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
void D_ProcessEvents (void) void D_ProcessEvents (void)
{ {
bool keywasdown[NUM_KEYS] = { false }; FixedBitArray<NUM_KEYS> keywasdown;
TArray<event_t> delayedevents; TArray<event_t> delayedevents;
keywasdown.Zero();
while (eventtail != eventhead) while (eventtail != eventhead)
{ {
event_t *ev = &events[eventtail]; event_t *ev = &events[eventtail];
@ -94,7 +95,7 @@ void D_ProcessEvents (void)
continue; // menu ate the event continue; // menu ate the event
} }
keywasdown[ev->data1] = G_Responder(ev) && ev->type == EV_KeyDown; if (G_Responder(ev) && ev->type == EV_KeyDown) keywasdown.Set(ev->data1);
} }
for (auto& ev: delayedevents) for (auto& ev: delayedevents)