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
This commit is contained in:
Arnaud Boutonné 2010-12-12 07:40:00 +00:00
parent c4e4f7dc86
commit c428cfbb85
9 changed files with 23 additions and 13 deletions

View File

@ -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

View File

@ -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

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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;