mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-12 03:56:20 +00:00
Implemented game speed changing by pressing - or + to e.g. ease testing.
svn-id: r33689
This commit is contained in:
parent
da84a54694
commit
092d7224b9
@ -105,8 +105,22 @@ int CineEngine::go() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CineEngine::getTimerDelay() const {
|
||||
return (10923000 * _timerDelayMultiplier) / 1193180;
|
||||
}
|
||||
|
||||
/*! \brief Modify game speed
|
||||
* \param speedChange Negative values slow game down, positive values speed it up, zero does nothing
|
||||
* \return Timer delay multiplier's value after the game speed change
|
||||
*/
|
||||
int CineEngine::modifyGameSpeed(int speedChange) {
|
||||
// If we want more speed we decrement the timer delay multiplier and vice versa.
|
||||
_timerDelayMultiplier = CLIP(_timerDelayMultiplier - speedChange, 1, 50);
|
||||
return _timerDelayMultiplier;
|
||||
}
|
||||
|
||||
void CineEngine::initialize() {
|
||||
_timerDelayMultiplier = 12; // Set default speed
|
||||
setupOpcodes();
|
||||
|
||||
initLanguage(g_cine->getLanguage());
|
||||
|
@ -86,6 +86,8 @@ public:
|
||||
|
||||
bool loadSaveDirectory(void);
|
||||
void makeSystemMenu(void);
|
||||
int modifyGameSpeed(int speedChange);
|
||||
int getTimerDelay() const;
|
||||
|
||||
const CINEGameDescription *_gameDescription;
|
||||
Common::File _partFileHandle;
|
||||
@ -109,6 +111,7 @@ private:
|
||||
void readVolCnf();
|
||||
|
||||
bool _preLoad;
|
||||
int _timerDelayMultiplier;
|
||||
};
|
||||
|
||||
extern CineEngine *g_cine;
|
||||
|
@ -125,6 +125,14 @@ static void processEvent(Common::Event &event) {
|
||||
g_cine->makeSystemMenu();
|
||||
}
|
||||
break;
|
||||
case Common::KEYCODE_MINUS:
|
||||
case Common::KEYCODE_KP_MINUS:
|
||||
g_cine->modifyGameSpeed(-1); // Slower
|
||||
break;
|
||||
case Common::KEYCODE_PLUS:
|
||||
case Common::KEYCODE_KP_PLUS:
|
||||
g_cine->modifyGameSpeed(+1); // Faster
|
||||
break;
|
||||
default:
|
||||
lastKeyStroke = event.kbd.keycode;
|
||||
break;
|
||||
@ -138,7 +146,7 @@ static void processEvent(Common::Event &event) {
|
||||
void manageEvents() {
|
||||
Common::EventManager *eventMan = g_system->getEventManager();
|
||||
|
||||
uint32 nextFrame = g_system->getMillis() + kGameTimerDelay * kGameSpeed;
|
||||
uint32 nextFrame = g_system->getMillis() + g_cine->getTimerDelay();
|
||||
do {
|
||||
Common::Event event;
|
||||
while (eventMan->pollEvent(event)) {
|
||||
|
@ -28,11 +28,6 @@
|
||||
|
||||
namespace Cine {
|
||||
|
||||
enum {
|
||||
kGameTimerDelay = 1000 / (1193180 / 10923),
|
||||
kGameSpeed = 12
|
||||
};
|
||||
|
||||
void mainLoop(int bootScriptIdx);
|
||||
void manageEvents();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user