Move wrong init

This commit is contained in:
Miloslav Číž 2020-10-20 20:19:24 +02:00
parent b236900a14
commit cf46b52180
2 changed files with 19 additions and 0 deletions

4
game.h
View File

@ -4763,6 +4763,10 @@ uint8_t SFG_mainLoopBody()
delta time. */ delta time. */
uint32_t timeNow = SFG_getTimeMs(); uint32_t timeNow = SFG_getTimeMs();
#if SFG_TIME_MULTIPLIER != 1024
timeNow = (timeNow * SFG_TIME_MULTIPLIER) / 1024;
#endif
int32_t timeSinceLastFrame = timeNow - SFG_game.frameTime; int32_t timeSinceLastFrame = timeNow - SFG_game.frameTime;
if (timeSinceLastFrame >= SFG_MS_PER_FRAME) if (timeSinceLastFrame >= SFG_MS_PER_FRAME)

View File

@ -19,6 +19,15 @@
#ifndef _SFG_SETTINGS_H #ifndef _SFG_SETTINGS_H
#define _SFG_SETTINGS_H #define _SFG_SETTINGS_H
/**
Time multiplier in SFG_Units (1.0 == 1024). This can be used to slow down or
speed up the game.
*/
#ifndef SFG_TIME_MULTIPLIER
#define SFG_TIME_MULTIPLIER 1024
#endif
/** /**
Target FPS (frames per second). This sets the game logic FPS and will try to Target FPS (frames per second). This sets the game logic FPS and will try to
render at the same rate. If such fast rendering can't be achieved, frames will render at the same rate. If such fast rendering can't be achieved, frames will
@ -34,6 +43,12 @@
#define SFG_FPS 60 #define SFG_FPS 60
#endif #endif
#define SFG_FPS ((SFG_FPS * SFG_TIME_MULTIPLIER) / 1024)
#if SFG_FPS == 0
#define SFG_FPS 1
#endif
/** /**
On platforms with mouse this sets its horizontal sensitivity. 128 means 1 On platforms with mouse this sets its horizontal sensitivity. 128 means 1
RCL_Unit per mouse pixel travelled. RCL_Unit per mouse pixel travelled.