[Scummvm-cvs-logs] SF.net SVN: scummvm: [24970] scummvm/trunk
eriktorbjorn at users.sourceforge.net
eriktorbjorn at users.sourceforge.net
Wed Jan 3 08:36:47 CET 2007
Revision: 24970
http://scummvm.svn.sourceforge.net/scummvm/?rev=24970&view=rev
Author: eriktorbjorn
Date: 2007-01-02 23:36:44 -0800 (Tue, 02 Jan 2007)
Log Message:
-----------
Added experimental "fast mode" for Broken Sword 2. (Use Ctrl-f to toggle.)
Modified Paths:
--------------
scummvm/trunk/NEWS
scummvm/trunk/README
scummvm/trunk/doc/running-hotkeys.tex
scummvm/trunk/engines/sword2/render.cpp
scummvm/trunk/engines/sword2/sound.cpp
scummvm/trunk/engines/sword2/sword2.cpp
scummvm/trunk/engines/sword2/sword2.h
Modified: scummvm/trunk/NEWS
===================================================================
--- scummvm/trunk/NEWS 2007-01-03 01:41:34 UTC (rev 24969)
+++ scummvm/trunk/NEWS 2007-01-03 07:36:44 UTC (rev 24970)
@@ -18,6 +18,7 @@
Broken Sword 2:
- Added support for DXA cutscenes.
+ - Added "fast mode" (use Ctrl-f to toggle).
Cine:
- Improved support for international versions.
Modified: scummvm/trunk/README
===================================================================
--- scummvm/trunk/README 2007-01-03 01:41:34 UTC (rev 24969)
+++ scummvm/trunk/README 2007-01-03 07:36:44 UTC (rev 24970)
@@ -851,6 +851,7 @@
Broken Sword 2:
Ctrl-d - Starts the debugger
+ Ctrl-f - Toggle fast mode
c - Display the credits
p - Pauses
Modified: scummvm/trunk/doc/running-hotkeys.tex
===================================================================
--- scummvm/trunk/doc/running-hotkeys.tex 2007-01-03 01:41:34 UTC (rev 24969)
+++ scummvm/trunk/doc/running-hotkeys.tex 2007-01-03 07:36:44 UTC (rev 24970)
@@ -60,6 +60,7 @@
\item Broken Sword 2:\\
\begin{tabular}{ll}
Ctrl-d & Starts the debugger\\
+ Ctrl-f & Toggle fast mode\\
c & Displays the credits\\
p & Pauses\\
\end{tabular}
Modified: scummvm/trunk/engines/sword2/render.cpp
===================================================================
--- scummvm/trunk/engines/sword2/render.cpp 2007-01-03 01:41:34 UTC (rev 24969)
+++ scummvm/trunk/engines/sword2/render.cpp 2007-01-03 07:36:44 UTC (rev 24970)
@@ -31,7 +31,6 @@
namespace Sword2 {
-#define MILLISECSPERCYCLE 83
#define RENDERAVERAGETOTAL 4
void Screen::updateRect(Common::Rect *r) {
@@ -297,7 +296,7 @@
void Screen::initialiseRenderCycle() {
_initialTime = _vm->_system->getMillis();
- _totalTime = _initialTime + MILLISECSPERCYCLE;
+ _totalTime = _initialTime + (1000 / _vm->getFramesPerSecond());
}
/**
@@ -354,7 +353,7 @@
}
if (_startTime + _renderAverageTime >= _totalTime) {
- _totalTime += MILLISECSPERCYCLE;
+ _totalTime += (1000 / _vm->getFramesPerSecond());
_initialTime = time;
return true;
}
@@ -365,7 +364,7 @@
// rest of the render cycle.
_vm->sleepUntil(_totalTime);
_initialTime = _vm->_system->getMillis();
- _totalTime += MILLISECSPERCYCLE;
+ _totalTime += (1000 / _vm->getFramesPerSecond());
return true;
}
#endif
Modified: scummvm/trunk/engines/sword2/sound.cpp
===================================================================
--- scummvm/trunk/engines/sword2/sound.cpp 2007-01-03 01:41:34 UTC (rev 24969)
+++ scummvm/trunk/engines/sword2/sound.cpp 2007-01-03 07:36:44 UTC (rev 24970)
@@ -219,7 +219,7 @@
// effects, however, it's the average number of
// seconds between playing the sound, so we
// have to multiply by the frame rate.
- delay *= 12;
+ delay *= _vm->getFramesPerSecond();
}
volume = (volume * Audio::Mixer::kMaxChannelVolume) / 16;
Modified: scummvm/trunk/engines/sword2/sword2.cpp
===================================================================
--- scummvm/trunk/engines/sword2/sword2.cpp 2007-01-03 01:41:34 UTC (rev 24969)
+++ scummvm/trunk/engines/sword2/sword2.cpp 2007-01-03 07:36:44 UTC (rev 24970)
@@ -42,6 +42,8 @@
#include "sword2/screen.h"
#include "sword2/sound.h"
+#define FRAMES_PER_SECOND 12
+
namespace Sword2 {
struct GameSettings {
@@ -175,6 +177,7 @@
_graphicsLevelFudged = false;
_gameCycle = 0;
+ _gameSpeed = 1;
_quit = false;
}
@@ -227,6 +230,10 @@
ConfMan.flushToDisk();
}
+int Sword2Engine::getFramesPerSecond() {
+ return _gameSpeed * FRAMES_PER_SECOND;
+}
+
/**
* The global script variables and player object should be kept open throughout
* the game, so that they are never expelled by the resource manager.
@@ -513,6 +520,14 @@
while (_system->pollEvent(event)) {
switch (event.type) {
case OSystem::EVENT_KEYDOWN:
+ if (event.kbd.flags == OSystem::KBD_CTRL) {
+ if (event.kbd.keycode == 'f') {
+ if (_gameSpeed == 1)
+ _gameSpeed = 2;
+ else
+ _gameSpeed = 1;
+ }
+ }
if (!(_inputEventFilter & RD_KEYDOWN)) {
_keyboardEvent.pending = true;
_keyboardEvent.repeat = now + 400;
Modified: scummvm/trunk/engines/sword2/sword2.h
===================================================================
--- scummvm/trunk/engines/sword2/sword2.h 2007-01-03 01:41:34 UTC (rev 24969)
+++ scummvm/trunk/engines/sword2/sword2.h 2007-01-03 07:36:44 UTC (rev 24970)
@@ -116,6 +116,7 @@
uint32 _startRes;
bool _useSubtitles;
+ int _gameSpeed;
StartUp _startList[MAX_starts];
@@ -125,6 +126,8 @@
int go();
int init();
+ int getFramesPerSecond();
+
void registerDefaultSettings();
void readSettings();
void writeSettings();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list