| 361 | } |
| 362 | |
| 363 | int GameEvents::handleEvent() |
| 364 | { |
| 365 | /* Implement frame-advance auto-repeat */ |
| 366 | bool ar_advance = false; |
| 367 | if (ar_ticks >= 0) { |
| 368 | ar_ticks++; |
| 369 | if ((ar_ticks > ar_delay) && !(ar_ticks % ar_freq)) |
| 370 | /* Trigger auto-repeat */ |
| 371 | ar_advance = true; |
| 372 | } |
| 373 | |
| 374 | struct HotKey hk; |
| 375 | EventType eventType = EVENT_TYPE_NONE; |
| 376 | int flags = ar_advance?RETURN_FLAG_ADVANCE:0; |
| 377 | |
| 378 | do { |
| 379 | eventType = nextEvent(hk); |
| 380 | |
| 381 | if (eventType != EVENT_TYPE_NONE) { |
| 382 | flags |= RETURN_FLAG_EVENT; |
| 383 | flags |= RETURN_FLAG_UPDATE; // For now, mark all events for update |
| 384 | if (processEvent(eventType, hk)) |
| 385 | flags |= RETURN_FLAG_ADVANCE; |
| 386 | } |
| 387 | else { |
| 388 | movie->inputs->processPendingActions(); |
| 389 | } |
| 390 | } while (eventType != EVENT_TYPE_NONE && !(flags & RETURN_FLAG_ADVANCE)); |
| 391 | |
| 392 | return flags; |
| 393 | } |
no test coverage detected