D_ProcessEvents: fix old input events repeating themselves when pressing Y button in Time Attack

This commit is contained in:
James R 2024-03-08 04:52:03 -08:00
parent 266e36928b
commit 7305afa5ea

View file

@ -272,9 +272,19 @@ void D_ProcessEvents(boolean callresponders)
boolean eaten;
G_ResetAllDeviceResponding();
for (; eventtail != eventhead; eventtail = (eventtail+1) & (MAXEVENTS-1))
// Save these in local variables because eventtail !=
// eventhead was evaluating true when they were equal,
// but only when using the Y button to restart a Time
// Attack??
INT32 tail = eventtail;
INT32 head = eventhead;
eventtail = eventhead;
for (; tail != head; tail = (tail+1) & (MAXEVENTS-1))
{
ev = &events[eventtail];
ev = &events[tail];
HandleGamepadDeviceEvents(ev);