1
0
Fork 0

Codechange: [Video] move InteractiveRandom() to the VideoDriver

pull/8743/head
Patric Stout 2021-02-24 14:50:52 +01:00 committed by Patric Stout
parent c409f45ddd
commit 67d3c6aa71
7 changed files with 5 additions and 13 deletions

View File

@ -482,8 +482,6 @@ void VideoDriver_Allegro::InputLoop()
void VideoDriver_Allegro::MainLoop() void VideoDriver_Allegro::MainLoop()
{ {
for (;;) { for (;;) {
InteractiveRandom(); // randomness
if (_exit_game) return; if (_exit_game) return;
if (this->Tick()) { if (this->Tick()) {

View File

@ -437,9 +437,6 @@ void VideoDriver_Cocoa::GameLoop()
{ {
for (;;) { for (;;) {
@autoreleasepool { @autoreleasepool {
InteractiveRandom(); // randomness
if (_exit_game) { if (_exit_game) {
/* Restore saved resolution if in fullscreen mode. */ /* Restore saved resolution if in fullscreen mode. */
if (this->IsFullscreen()) _cur_resolution = this->orig_res; if (this->IsFullscreen()) _cur_resolution = this->orig_res;

View File

@ -275,8 +275,6 @@ void VideoDriver_Dedicated::MainLoop()
} }
while (!_exit_game) { while (!_exit_game) {
InteractiveRandom(); // randomness
if (!_dedicated_forks) DedicatedHandleKeyInput(); if (!_dedicated_forks) DedicatedHandleKeyInput();
_fast_forward = _ddc_fastforward; _fast_forward = _ddc_fastforward;

View File

@ -628,8 +628,6 @@ void VideoDriver_SDL_Base::InputLoop()
void VideoDriver_SDL_Base::LoopOnce() void VideoDriver_SDL_Base::LoopOnce()
{ {
InteractiveRandom(); // randomness
if (_exit_game) { if (_exit_game) {
#ifdef __EMSCRIPTEN__ #ifdef __EMSCRIPTEN__
/* Emscripten is event-driven, and as such the main loop is inside /* Emscripten is event-driven, and as such the main loop is inside

View File

@ -718,8 +718,6 @@ void VideoDriver_SDL::MainLoop()
DEBUG(driver, 1, "SDL: using %sthreads", _draw_threaded ? "" : "no "); DEBUG(driver, 1, "SDL: using %sthreads", _draw_threaded ? "" : "no ");
for (;;) { for (;;) {
InteractiveRandom(); // randomness
if (_exit_game) break; if (_exit_game) break;
if (this->Tick()) { if (this->Tick()) {

View File

@ -9,6 +9,7 @@
#include "../stdafx.h" #include "../stdafx.h"
#include "../debug.h" #include "../debug.h"
#include "../core/random_func.hpp"
#include "../gfx_func.h" #include "../gfx_func.h"
#include "../progress.h" #include "../progress.h"
#include "../thread.h" #include "../thread.h"
@ -24,6 +25,10 @@ bool VideoDriver::Tick()
auto delta = std::chrono::duration_cast<std::chrono::milliseconds>(cur_ticks - this->last_realtime_tick); auto delta = std::chrono::duration_cast<std::chrono::milliseconds>(cur_ticks - this->last_realtime_tick);
_realtime_tick += delta.count(); _realtime_tick += delta.count();
this->last_realtime_tick += delta; this->last_realtime_tick += delta;
/* Keep the interactive randomizer a bit more random by requesting
* new values when-ever we can. */
InteractiveRandom();
} }
if (cur_ticks >= this->next_game_tick || (_fast_forward && !_pause_mode)) { if (cur_ticks >= this->next_game_tick || (_fast_forward && !_pause_mode)) {

View File

@ -907,8 +907,6 @@ void VideoDriver_Win32Base::MainLoop()
} }
for (;;) { for (;;) {
InteractiveRandom(); // randomness
if (_exit_game) break; if (_exit_game) break;
/* Flush GDI buffer to ensure we don't conflict with the drawing thread. */ /* Flush GDI buffer to ensure we don't conflict with the drawing thread. */