diff options
author | Arnaud Boutonné | 2010-12-12 07:40:00 +0000 |
---|---|---|
committer | Arnaud Boutonné | 2010-12-12 07:40:00 +0000 |
commit | c428cfbb855fa3162fcc6aff87e2b1c8a3de799a (patch) | |
tree | 0303301db8bc742e791d9349a9a5a4f3f03fdf3e | |
parent | c4e4f7dc865b014cbfd516753fefd5ed077c8450 (diff) | |
download | scummvm-rg350-c428cfbb855fa3162fcc6aff87e2b1c8a3de799a.tar.gz scummvm-rg350-c428cfbb855fa3162fcc6aff87e2b1c8a3de799a.tar.bz2 scummvm-rg350-c428cfbb855fa3162fcc6aff87e2b1c8a3de799a.zip |
HUGO: Fix "mouse" bug in H3 Dos, TPS tuning
- Fix "mouse" bug in H3 DOS. Game is still not completable
- Use variable normal TPS, as it was slightly different in
some DOS versions
svn-id: r54880
-rw-r--r-- | engines/hugo/game.h | 4 | ||||
-rw-r--r-- | engines/hugo/hugo.cpp | 13 | ||||
-rw-r--r-- | engines/hugo/hugo.h | 5 | ||||
-rw-r--r-- | engines/hugo/object_v1d.cpp | 2 | ||||
-rw-r--r-- | engines/hugo/object_v1w.cpp | 2 | ||||
-rw-r--r-- | engines/hugo/object_v2d.cpp | 2 | ||||
-rw-r--r-- | engines/hugo/object_v3d.cpp | 2 | ||||
-rw-r--r-- | engines/hugo/parser.cpp | 2 | ||||
-rw-r--r-- | engines/hugo/schedule.cpp | 4 |
9 files changed, 23 insertions, 13 deletions
diff --git a/engines/hugo/game.h b/engines/hugo/game.h index 3c88c4cafa..b0bfe82e0b 100644 --- a/engines/hugo/game.h +++ b/engines/hugo/game.h @@ -56,7 +56,6 @@ namespace Hugo { // Game specific equates #define MAX_TUNES 16 // Max number of tunes -#define NORMAL_TPS 9 // Number of ticks (frames) per second #define TURBO_TPS 16 // This many in turbo mode #define DX 5 // Num pixels moved in x by HERO per step #define DY 4 // Num pixels moved in y by HERO per step @@ -99,9 +98,6 @@ namespace Hugo { #define DROP 4 #define LOOK_S 8 // Description depends on state of object -// Macros: -#define TPS ((_config.turboFl) ? TURBO_TPS : NORMAL_TPS) - #define NUM_COLORS 16 // Num colors to save in palette #define MAX_UIFS 32 // Max possible uif items in hdr #define NUM_FONTS 3 // Number of dib fonts diff --git a/engines/hugo/hugo.cpp b/engines/hugo/hugo.cpp index 786dbcb613..9ec3887cfa 100644 --- a/engines/hugo/hugo.cpp +++ b/engines/hugo/hugo.cpp @@ -203,6 +203,7 @@ Common::Error HugoEngine::run() { _screen = new Screen_v1w(this); _parser = new Parser_v1w(this); _object = new ObjectHandler_v1w(this); + _normalTPS = 9; break; case 1: _file = new FileManager_v2d(this); @@ -211,6 +212,7 @@ Common::Error HugoEngine::run() { _screen = new Screen_v1w(this); _parser = new Parser_v1w(this); _object = new ObjectHandler_v1w(this); + _normalTPS = 9; break; case 2: _file = new FileManager_v2d(this); @@ -219,6 +221,7 @@ Common::Error HugoEngine::run() { _screen = new Screen_v1w(this); _parser = new Parser_v1w(this); _object = new ObjectHandler_v1w(this); + _normalTPS = 9; break; case 3: // H1 DOS _file = new FileManager_v1d(this); @@ -227,6 +230,7 @@ Common::Error HugoEngine::run() { _screen = new Screen_v1d(this); _parser = new Parser_v1d(this); _object = new ObjectHandler_v1d(this); + _normalTPS = 8; break; case 4: _file = new FileManager_v2d(this); @@ -235,6 +239,7 @@ Common::Error HugoEngine::run() { _screen = new Screen_v1d(this); _parser = new Parser_v2d(this); _object = new ObjectHandler_v2d(this); + _normalTPS = 8; break; case 5: _file = new FileManager_v3d(this); @@ -242,7 +247,8 @@ Common::Error HugoEngine::run() { _intro = new intro_v3d(this); _screen = new Screen_v1d(this); _parser = new Parser_v3d(this); - _object = new ObjectHandler_v1d(this); + _object = new ObjectHandler_v3d(this); + _normalTPS = 9; break; } @@ -335,7 +341,7 @@ void HugoEngine::runMachine() { return; // Process machine once every tick - if (g_system->getMillis() - lastTime < (uint32)(1000 / TPS)) + if (g_system->getMillis() - lastTime < (uint32)(1000 / getTPS())) return; lastTime = g_system->getMillis(); @@ -1267,4 +1273,7 @@ bool HugoEngine::canSaveGameStateCurrently() { return (_status.viewState == V_PLAY); } +int8 HugoEngine::getTPS() { + return ((_config.turboFl) ? TURBO_TPS : _normalTPS); +} } // End of namespace Hugo diff --git a/engines/hugo/hugo.h b/engines/hugo/hugo.h index c6dc41f168..4c511efe41 100644 --- a/engines/hugo/hugo.h +++ b/engines/hugo/hugo.h @@ -127,6 +127,9 @@ public: int8 _soundTest; int8 _tunesNbr; uint16 _numScreens; + int8 _normalTPS; // Number of ticks (frames) per second. + //8 for Win versions, 9 for DOS versions + object_t *_hero; byte *_screen_p; @@ -198,6 +201,8 @@ public: int deltaX(int x1, int x2, int vx, int y); int deltaY(int x1, int x2, int vy, int y); + int8 getTPS(); + void initGame(const HugoGameDescription *gd); void initGamePart(const HugoGameDescription *gd); void boundaryCollision(object_t *obj); diff --git a/engines/hugo/object_v1d.cpp b/engines/hugo/object_v1d.cpp index 7b42263759..176acfb401 100644 --- a/engines/hugo/object_v1d.cpp +++ b/engines/hugo/object_v1d.cpp @@ -236,7 +236,7 @@ void ObjectHandler_v1d::moveObjects() { break; } case WANDER: - if (!_vm->_rnd->getRandomNumber(3 * NORMAL_TPS)) { // Kick on random interval + if (!_vm->_rnd->getRandomNumber(3 * _vm->_normalTPS)) { // Kick on random interval obj->vx = _vm->_rnd->getRandomNumber(obj->vxPath << 1) - obj->vxPath; obj->vy = _vm->_rnd->getRandomNumber(obj->vyPath << 1) - obj->vyPath; diff --git a/engines/hugo/object_v1w.cpp b/engines/hugo/object_v1w.cpp index 708376a01b..cec8ef032a 100644 --- a/engines/hugo/object_v1w.cpp +++ b/engines/hugo/object_v1w.cpp @@ -247,7 +247,7 @@ void ObjectHandler_v1w::moveObjects() { } case WANDER2: case WANDER: - if (!_vm->_rnd->getRandomNumber(3 * NORMAL_TPS)) { // Kick on random interval + if (!_vm->_rnd->getRandomNumber(3 * _vm->_normalTPS)) { // Kick on random interval obj->vx = _vm->_rnd->getRandomNumber(obj->vxPath << 1) - obj->vxPath; obj->vy = _vm->_rnd->getRandomNumber(obj->vyPath << 1) - obj->vyPath; diff --git a/engines/hugo/object_v2d.cpp b/engines/hugo/object_v2d.cpp index d798a54fd1..2e1413a4a5 100644 --- a/engines/hugo/object_v2d.cpp +++ b/engines/hugo/object_v2d.cpp @@ -250,7 +250,7 @@ void ObjectHandler_v2d::moveObjects() { } case WANDER2: case WANDER: - if (!_vm->_rnd->getRandomNumber(3 * NORMAL_TPS)) { // Kick on random interval + if (!_vm->_rnd->getRandomNumber(3 * _vm->_normalTPS)) { // Kick on random interval obj->vx = _vm->_rnd->getRandomNumber(obj->vxPath << 1) - obj->vxPath; obj->vy = _vm->_rnd->getRandomNumber(obj->vyPath << 1) - obj->vyPath; diff --git a/engines/hugo/object_v3d.cpp b/engines/hugo/object_v3d.cpp index 431c71498f..e7408f0504 100644 --- a/engines/hugo/object_v3d.cpp +++ b/engines/hugo/object_v3d.cpp @@ -131,7 +131,7 @@ void ObjectHandler_v3d::moveObjects() { } case WANDER2: case WANDER: - if (!_vm->_rnd->getRandomNumber(3 * NORMAL_TPS)) { // Kick on random interval + if (!_vm->_rnd->getRandomNumber(3 * _vm->_normalTPS)) { // Kick on random interval obj->vx = _vm->_rnd->getRandomNumber(obj->vxPath << 1) - obj->vxPath; obj->vy = _vm->_rnd->getRandomNumber(obj->vyPath << 1) - obj->vyPath; diff --git a/engines/hugo/parser.cpp b/engines/hugo/parser.cpp index 720b8e3305..7e2157039b 100644 --- a/engines/hugo/parser.cpp +++ b/engines/hugo/parser.cpp @@ -175,7 +175,7 @@ void Parser::charHandler() { } // See if time to blink cursor, set cursor character - if ((tick++ % (TPS / BLINKS)) == 0) + if ((tick++ % (_vm->getTPS() / BLINKS)) == 0) cursor = (cursor == '_') ? ' ' : '_'; // See if recall button pressed diff --git a/engines/hugo/schedule.cpp b/engines/hugo/schedule.cpp index eca9a2050e..6ea7bfd273 100644 --- a/engines/hugo/schedule.cpp +++ b/engines/hugo/schedule.cpp @@ -134,9 +134,9 @@ uint32 Scheduler::getDosTicks(bool updateFl) { return(tick); if (t_old == 0) - t_old = (uint32) floor((double) (g_system->getMillis() * TPS / 1000)); + t_old = (uint32) floor((double) (g_system->getMillis() * _vm->getTPS() / 1000)); /* Calculate current wall time in ticks */ - t_now = g_system->getMillis() * TPS / 1000 ; + t_now = g_system->getMillis() * _vm->getTPS() / 1000 ; if ((t_now - t_old) > 0) { t_old = t_now; |