aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/hdb/ai-bots.cpp87
-rw-r--r--engines/hdb/ai-funcs.cpp66
-rw-r--r--engines/hdb/ai-player.cpp81
-rw-r--r--engines/hdb/hdb.cpp60
-rw-r--r--engines/hdb/menu.cpp24
5 files changed, 228 insertions, 90 deletions
diff --git a/engines/hdb/ai-bots.cpp b/engines/hdb/ai-bots.cpp
index ac4b24197c..6e99419925 100644
--- a/engines/hdb/ai-bots.cpp
+++ b/engines/hdb/ai-bots.cpp
@@ -444,19 +444,35 @@ void aiRightBotFindGoal(AIEntity *e) {
// If neither, go backwards
if (!bg2 && !e2) {
switch (e->dir) {
- case DIR_UP: e->dir = DIR_RIGHT; break;
- case DIR_DOWN: e->dir = DIR_LEFT; break;
- case DIR_LEFT: e->dir = DIR_UP; break;
- case DIR_RIGHT: e->dir = DIR_DOWN; break;
+ case DIR_UP:
+ e->dir = DIR_RIGHT;
+ break;
+ case DIR_DOWN:
+ e->dir = DIR_LEFT;
+ break;
+ case DIR_LEFT:
+ e->dir = DIR_UP;
+ break;
+ case DIR_RIGHT:
+ e->dir = DIR_DOWN;
+ break;
case DIR_NONE:
break;
}
} else if (!bg && !e1) {
switch (e->dir) {
- case DIR_UP: e->dir = DIR_LEFT; break;
- case DIR_DOWN: e->dir = DIR_RIGHT; break;
- case DIR_LEFT: e->dir = DIR_DOWN; break;
- case DIR_RIGHT: e->dir = DIR_UP; break;
+ case DIR_UP:
+ e->dir = DIR_LEFT;
+ break;
+ case DIR_DOWN:
+ e->dir = DIR_RIGHT;
+ break;
+ case DIR_LEFT:
+ e->dir = DIR_DOWN;
+ break;
+ case DIR_RIGHT:
+ e->dir = DIR_UP;
+ break;
case DIR_NONE:
break;
}
@@ -685,10 +701,22 @@ void aiRailRiderAction(AIEntity *e) {
if (!g_hdb->_window->dialogActive()) {
e->sequence = 2;
switch (e->dir) {
- case DIR_UP: e->xVel = 0; e->yVel = -1; break;
- case DIR_DOWN: e->xVel = 0; e->yVel = 1; break;
- case DIR_LEFT: e->xVel = -1; e->yVel = 0; break;
- case DIR_RIGHT: e->xVel = 1; e->yVel = 0; break;
+ case DIR_UP:
+ e->xVel = 0;
+ e->yVel = -1;
+ break;
+ case DIR_DOWN:
+ e->xVel = 0;
+ e->yVel = 1;
+ break;
+ case DIR_LEFT:
+ e->xVel = -1;
+ e->yVel = 0;
+ break;
+ case DIR_RIGHT:
+ e->xVel = 1;
+ e->yVel = 0;
+ break;
case DIR_NONE:
break;
}
@@ -841,11 +869,20 @@ void aiRailRiderOnAction(AIEntity *e) {
p->y = e->y;
g_hdb->_ai->animateEntity(e);
switch (e->dir) {
- case DIR_UP: e->draw = e->moveupGfx[0]; break;
- case DIR_DOWN: e->draw = e->movedownGfx[0]; break;
- case DIR_LEFT: e->draw = e->moveleftGfx[0]; break;
- case DIR_RIGHT: e->draw = e->moverightGfx[0]; break;
- default: break; // DIR_NONE
+ case DIR_UP:
+ e->draw = e->moveupGfx[0];
+ break;
+ case DIR_DOWN:
+ e->draw = e->movedownGfx[0];
+ break;
+ case DIR_LEFT:
+ e->draw = e->moveleftGfx[0];
+ break;
+ case DIR_RIGHT:
+ e->draw = e->moverightGfx[0];
+ break;
+ default:
+ break; // DIR_NONE
}
g_hdb->_map->centerMapXY(e->x + 16, e->y + 16);
@@ -1562,8 +1599,8 @@ void aiLaserDraw(AIEntity *e, int mx, int my) {
case DIR_UP:
{
for (i = e->value1 - 1; i > e->value2; i--)
- onScreen += g_hdb->_ai->_gfxLaserbeamUD[frame]->drawMasked(e->x - mx, i*kTileWidth - my);
- onScreen += g_hdb->_ai->_gfxLaserbeamUDBottom[frame & 3]->drawMasked(e->x - mx, i*kTileWidth - my);
+ onScreen += g_hdb->_ai->_gfxLaserbeamUD[frame]->drawMasked(e->x - mx, i * kTileWidth - my);
+ onScreen += g_hdb->_ai->_gfxLaserbeamUDBottom[frame & 3]->drawMasked(e->x - mx, i * kTileWidth - my);
if (onScreen) {
g_hdb->_sound->playSoundEx(SND_LASER_LOOP, kLaserChannel, true);
g_hdb->_ai->_laserOnScreen = true;
@@ -1573,8 +1610,8 @@ void aiLaserDraw(AIEntity *e, int mx, int my) {
case DIR_DOWN:
{
for (i = e->value1 + 1; i < e->value2; i++)
- onScreen += g_hdb->_ai->_gfxLaserbeamUD[frame]->drawMasked(e->x - mx, i*kTileWidth - my);
- onScreen += g_hdb->_ai->_gfxLaserbeamUDBottom[frame]->drawMasked(e->x - mx, i*kTileWidth - my);
+ onScreen += g_hdb->_ai->_gfxLaserbeamUD[frame]->drawMasked(e->x - mx, i * kTileWidth - my);
+ onScreen += g_hdb->_ai->_gfxLaserbeamUDBottom[frame]->drawMasked(e->x - mx, i * kTileWidth - my);
if (onScreen) {
g_hdb->_sound->playSoundEx(SND_LASER_LOOP, kLaserChannel, true);
g_hdb->_ai->_laserOnScreen = true;
@@ -1584,8 +1621,8 @@ void aiLaserDraw(AIEntity *e, int mx, int my) {
case DIR_LEFT:
{
for (i = e->value1 - 1; i > e->value2; i--)
- onScreen += g_hdb->_ai->_gfxLaserbeamLR[frame]->drawMasked(i*kTileWidth - mx, e->y - my);
- onScreen += g_hdb->_ai->_gfxLaserbeamLRRight[frame]->drawMasked(i*kTileWidth - mx, e->y - my);
+ onScreen += g_hdb->_ai->_gfxLaserbeamLR[frame]->drawMasked(i * kTileWidth - mx, e->y - my);
+ onScreen += g_hdb->_ai->_gfxLaserbeamLRRight[frame]->drawMasked(i * kTileWidth - mx, e->y - my);
if (onScreen) {
g_hdb->_sound->playSoundEx(SND_LASER_LOOP, kLaserChannel, true);
g_hdb->_ai->_laserOnScreen = true;
@@ -1595,8 +1632,8 @@ void aiLaserDraw(AIEntity *e, int mx, int my) {
case DIR_RIGHT:
{
for (i = e->value1 + 1; i < e->value2; i++)
- onScreen += g_hdb->_ai->_gfxLaserbeamLR[frame]->drawMasked(i*kTileWidth - mx, e->y - my);
- onScreen += g_hdb->_ai->_gfxLaserbeamLRLeft[frame]->drawMasked(i*kTileWidth - mx, e->y - my);
+ onScreen += g_hdb->_ai->_gfxLaserbeamLR[frame]->drawMasked(i * kTileWidth - mx, e->y - my);
+ onScreen += g_hdb->_ai->_gfxLaserbeamLRLeft[frame]->drawMasked(i * kTileWidth - mx, e->y - my);
if (onScreen) {
g_hdb->_sound->playSoundEx(SND_LASER_LOOP, kLaserChannel, true);
g_hdb->_ai->_laserOnScreen = true;
diff --git a/engines/hdb/ai-funcs.cpp b/engines/hdb/ai-funcs.cpp
index 7b2f148796..255e0581c5 100644
--- a/engines/hdb/ai-funcs.cpp
+++ b/engines/hdb/ai-funcs.cpp
@@ -908,8 +908,6 @@ void AI::animateEntity(AIEntity *e) {
static const int xva[5] = {9, 0, 0, -1, 1};
static const int yva[5] = {9, -1, 1, 0, 0};
- int bgTileFlags, fgTileFlags;
-
// Move entity if player is not dead
debug(9, "Before animateEntity, e->x: %d, e->y: %d", e->x, e->y);
debug(9, "Before animateEntity, e->tileX: %d, e->tileY: %d", e->tileX, e->tileY);
@@ -960,8 +958,8 @@ void AI::animateEntity(AIEntity *e) {
}
// Are we on ice?
- bgTileFlags = g_hdb->_map->getMapBGTileFlags(e->tileX, e->tileY);
- fgTileFlags = g_hdb->_map->getMapFGTileFlags(e->tileX, e->tileY);
+ int bgTileFlags = g_hdb->_map->getMapBGTileFlags(e->tileX, e->tileY);
+ int fgTileFlags = g_hdb->_map->getMapFGTileFlags(e->tileX, e->tileY);
if (e->level == 1 ? ((bgTileFlags & kFlagIce) == kFlagIce) : (((bgTileFlags & kFlagIce) == kFlagIce) && !(fgTileFlags & kFlagGrating))) {
int nx, ny, moveOK = 0;
@@ -1027,11 +1025,20 @@ void AI::animateEntity(AIEntity *e) {
if (!result) {
int xv = 0, yv = 0;
switch (e->dir) {
- case DIR_UP: yv = -1; break;
- case DIR_DOWN: yv = 1; break;
- case DIR_LEFT: xv = -1; break;
- case DIR_RIGHT: xv = 1; break;
- case DIR_NONE: break;
+ case DIR_UP:
+ yv = -1;
+ break;
+ case DIR_DOWN:
+ yv = 1;
+ break;
+ case DIR_LEFT:
+ xv = -1;
+ break;
+ case DIR_RIGHT:
+ xv = 1;
+ break;
+ case DIR_NONE:
+ break;
}
bgTileFlags = g_hdb->_map->getMapBGTileFlags(e->tileX + xv, e->tileY + yv);
@@ -1053,8 +1060,8 @@ void AI::animateEntity(AIEntity *e) {
// Check for bad tiles (DEATH)
int cx = (e->x + 16) / kTileWidth;
int cy = (e->y + 16) / kTileHeight;
- bgTileFlags = g_hdb->_map->getMapBGTileFlags(cx, cy);
- fgTileFlags = g_hdb->_map->getMapFGTileFlags(cx, cy);
+ int bgTileFlags = g_hdb->_map->getMapBGTileFlags(cx, cy);
+ int fgTileFlags = g_hdb->_map->getMapFGTileFlags(cx, cy);
if ((bgTileFlags & kFlagPlayerDie) && !(checkFloating(cx, cy)) && !(fgTileFlags & kFlagGrating)) {
if ((bgTileFlags & kFlagEnergyFloor) == kFlagEnergyFloor)
killPlayer(DEATH_SHOCKED);
@@ -1105,9 +1112,9 @@ void AI::animateEntity(AIEntity *e) {
}
// Check for moving up/down stair levels
- int bgTileIndex = g_hdb->_map->getMapBGTileIndex(e->tileX, e->tileY); // CHECKME: unused?
- bgTileFlags = g_hdb->_map->getMapBGTileFlags(e->tileX, e->tileY);
- fgTileFlags = g_hdb->_map->getMapFGTileFlags(e->tileX, e->tileY); // CHECKME: unused?
+// int bgTileIndex = g_hdb->_map->getMapBGTileIndex(e->tileX, e->tileY); // CHECKME: unused?
+ int bgTileFlags = g_hdb->_map->getMapBGTileFlags(e->tileX, e->tileY);
+// fgTileFlags = g_hdb->_map->getMapFGTileFlags(e->tileX, e->tileY); // CHECKME: unused?
if (bgTileFlags & kFlagStairTop)
e->level = 2;
else if (bgTileFlags & kFlagStairBot)
@@ -1153,11 +1160,32 @@ void AI::animateEntity(AIEntity *e) {
AIEntity *hit = legalMove(nx, ny, e->level, &result2);
if (!hit && result2) {
switch (e->dir) {
- case DIR_UP: e->goalY = ny; e->xVel = 0; e->yVel = -kPlayerMoveSpeed; e->state = STATE_MOVEUP; break;
- case DIR_DOWN: e->goalY = ny; e->xVel = 0; e->yVel = kPlayerMoveSpeed; e->state = STATE_MOVEDOWN; break;
- case DIR_LEFT: e->goalX = nx; e->yVel = 0; e->xVel = -kPlayerMoveSpeed; e->state = STATE_MOVELEFT; break;
- case DIR_RIGHT: e->goalX = nx; e->yVel = 0; e->xVel = kPlayerMoveSpeed; e->state = STATE_MOVERIGHT; break;
- case DIR_NONE: break;
+ case DIR_UP:
+ e->goalY = ny;
+ e->xVel = 0;
+ e->yVel = -kPlayerMoveSpeed;
+ e->state = STATE_MOVEUP;
+ break;
+ case DIR_DOWN:
+ e->goalY = ny;
+ e->xVel = 0;
+ e->yVel = kPlayerMoveSpeed;
+ e->state = STATE_MOVEDOWN;
+ break;
+ case DIR_LEFT:
+ e->goalX = nx;
+ e->yVel = 0;
+ e->xVel = -kPlayerMoveSpeed;
+ e->state = STATE_MOVELEFT;
+ break;
+ case DIR_RIGHT:
+ e->goalX = nx;
+ e->yVel = 0;
+ e->xVel = kPlayerMoveSpeed;
+ e->state = STATE_MOVERIGHT;
+ break;
+ case DIR_NONE:
+ break;
}
if (_playerRunning) {
e->xVel = e->xVel << 1;
diff --git a/engines/hdb/ai-player.cpp b/engines/hdb/ai-player.cpp
index 46d9dfc74b..84bfa8e506 100644
--- a/engines/hdb/ai-player.cpp
+++ b/engines/hdb/ai-player.cpp
@@ -201,10 +201,22 @@ void aiPlayerAction(AIEntity *e) {
if (!e->animFrame--) {
// Done with the Grabbing Animation, switch to standing
switch (e->state) {
- case STATE_GRABUP: e->draw = e->standupGfx[0]; e->state = STATE_STANDUP; break;
- case STATE_GRABDOWN: e->draw = e->standdownGfx[0]; e->state = STATE_STANDDOWN; break;
- case STATE_GRABLEFT: e->draw = e->standleftGfx[0]; e->state = STATE_STANDLEFT; break;
- case STATE_GRABRIGHT: e->draw = e->standrightGfx[0]; e->state = STATE_STANDRIGHT; break;
+ case STATE_GRABUP:
+ e->draw = e->standupGfx[0];
+ e->state = STATE_STANDUP;
+ break;
+ case STATE_GRABDOWN:
+ e->draw = e->standdownGfx[0];
+ e->state = STATE_STANDDOWN;
+ break;
+ case STATE_GRABLEFT:
+ e->draw = e->standleftGfx[0];
+ e->state = STATE_STANDLEFT;
+ break;
+ case STATE_GRABRIGHT:
+ e->draw = e->standrightGfx[0];
+ e->state = STATE_STANDRIGHT;
+ break;
default:
break;
}
@@ -221,20 +233,36 @@ void aiPlayerAction(AIEntity *e) {
e->drawXOff = xOff[e->state - STATE_ATK_CLUB_UP];
e->drawYOff = yOff[e->state - STATE_ATK_CLUB_UP];
switch (e->state) {
- case STATE_ATK_CLUB_UP: cycleFrames(e, g_hdb->_ai->_clubUpFrames); break;
- case STATE_ATK_CLUB_DOWN: cycleFrames(e, g_hdb->_ai->_clubDownFrames); break;
- case STATE_ATK_CLUB_LEFT: cycleFrames(e, g_hdb->_ai->_clubLeftFrames); break;
- case STATE_ATK_CLUB_RIGHT: cycleFrames(e, g_hdb->_ai->_clubRightFrames); break;
+ case STATE_ATK_CLUB_UP:
+ cycleFrames(e, g_hdb->_ai->_clubUpFrames);
+ break;
+ case STATE_ATK_CLUB_DOWN:
+ cycleFrames(e, g_hdb->_ai->_clubDownFrames);
+ break;
+ case STATE_ATK_CLUB_LEFT:
+ cycleFrames(e, g_hdb->_ai->_clubLeftFrames);
+ break;
+ case STATE_ATK_CLUB_RIGHT:
+ cycleFrames(e, g_hdb->_ai->_clubRightFrames);
+ break;
default:
break;
}
// Whack!
if ((e->animFrame >= 1) && (e->animDelay == e->animCycle)) {
switch (e->dir) {
- case DIR_UP: hit = g_hdb->_ai->playerCollision(32, 0, 16, 16); break;
- case DIR_DOWN: hit = g_hdb->_ai->playerCollision(0, 32, 16, 16); break;
- case DIR_LEFT: hit = g_hdb->_ai->playerCollision(16, 16, 32, 0); break;
- case DIR_RIGHT: hit = g_hdb->_ai->playerCollision(16, 16, 0, 32); break;
+ case DIR_UP:
+ hit = g_hdb->_ai->playerCollision(32, 0, 16, 16);
+ break;
+ case DIR_DOWN:
+ hit = g_hdb->_ai->playerCollision(0, 32, 16, 16);
+ break;
+ case DIR_LEFT:
+ hit = g_hdb->_ai->playerCollision(16, 16, 32, 0);
+ break;
+ case DIR_RIGHT:
+ hit = g_hdb->_ai->playerCollision(16, 16, 0, 32);
+ break;
default:
break;
}
@@ -280,10 +308,18 @@ void aiPlayerAction(AIEntity *e) {
e->state = stand[e->dir];
e->aiDraw = NULL;
switch (e->state) {
- case STATE_ATK_CLUB_UP: e->draw = e->standupGfx[0]; break;
- case STATE_ATK_CLUB_DOWN: e->draw = e->standdownGfx[0]; break;
- case STATE_ATK_CLUB_LEFT: e->draw = e->standleftGfx[0]; break;
- case STATE_ATK_CLUB_RIGHT: e->draw = e->standrightGfx[0]; break;
+ case STATE_ATK_CLUB_UP:
+ e->draw = e->standupGfx[0];
+ break;
+ case STATE_ATK_CLUB_DOWN:
+ e->draw = e->standdownGfx[0];
+ break;
+ case STATE_ATK_CLUB_LEFT:
+ e->draw = e->standleftGfx[0];
+ break;
+ case STATE_ATK_CLUB_RIGHT:
+ e->draw = e->standrightGfx[0];
+ break;
default:
break;
}
@@ -922,9 +958,8 @@ void aiScientistInit2(AIEntity *e) {
}
void aiSlugAttackAction(AIEntity *e) {
- int xv[5] = {9, 0, 0, -1, 1}, yv[5] = {9, -1, 1, 0, 0};
- AIEntity *hit;
- int result;
+ static const int xv[5] = {9, 0, 0, -1, 1};
+ static const int yv[5] = {9, -1, 1, 0, 0};
if (e->goalX)
g_hdb->_ai->animateEntity(e);
@@ -932,7 +967,7 @@ void aiSlugAttackAction(AIEntity *e) {
g_hdb->_ai->checkActionList(e, e->tileX, e->tileY, false);
g_hdb->_ai->checkAutoList(e, e->tileX, e->tileY);
- hit = g_hdb->_ai->findEntityIgnore(e->tileX, e->tileY, e);
+ AIEntity *hit = g_hdb->_ai->findEntityIgnore(e->tileX, e->tileY, e);
if (hit && hit->type == AI_GUY)
hit = NULL;
@@ -946,7 +981,7 @@ void aiSlugAttackAction(AIEntity *e) {
uint32 bg_flags = g_hdb->_map->getMapBGTileFlags(e->tileX, e->tileY);
uint32 fg_flags = g_hdb->_map->getMapFGTileFlags(e->tileX, e->tileY);
- result = (e->level == 1 ? (bg_flags & (kFlagSolid)) : !(fg_flags & kFlagGrating) && (bg_flags & (kFlagSolid)));
+ int result = (e->level == 1 ? (bg_flags & (kFlagSolid)) : !(fg_flags & kFlagGrating) && (bg_flags & (kFlagSolid)));
if (hit) {
g_hdb->_sound->playSound(SND_SLUG_HIT);
g_hdb->_sound->playSound(g_hdb->_ai->metalOrFleshSND(hit));
@@ -1052,10 +1087,12 @@ void aiSlugAttackDraw(AIEntity *e, int mx, int my) {
}
void aiSlugAttackInit(AIEntity *e) {
+ static const int xv[5] = {9, 0, 0, -1, 1};
+ static const int yv[5] = {9, -1, 1, 0, 0};
+
if (g_hdb->isDemo())
return;
- int xv[5] = {9, 0, 0, -1, 1}, yv[5] = {9, -1, 1, 0, 0};
e->moveSpeed = kPlayerMoveSpeed << 1;
g_hdb->_ai->setEntityGoal(e, e->tileX + xv[e->dir], e->tileY + yv[e->dir]);
e->draw = NULL; // use custom draw function
diff --git a/engines/hdb/hdb.cpp b/engines/hdb/hdb.cpp
index 62e2ec8d67..557c8bac75 100644
--- a/engines/hdb/hdb.cpp
+++ b/engines/hdb/hdb.cpp
@@ -715,11 +715,20 @@ void HDBGame::useEntity(AIEntity *e) {
// Diverters are very special - don't mess with their direction & state!
if (e->type == AI_DIVERTER) {
switch (e->dir2) {
- case DIR_DOWN: e->state = STATE_DIVERTER_BL; break;
- case DIR_UP: e->state = STATE_DIVERTER_BR; break;
- case DIR_LEFT: e->state = STATE_DIVERTER_TL; break;
- case DIR_RIGHT: e->state = STATE_DIVERTER_TR; break;
- case DIR_NONE: break;
+ case DIR_DOWN:
+ e->state = STATE_DIVERTER_BL;
+ break;
+ case DIR_UP:
+ e->state = STATE_DIVERTER_BR;
+ break;
+ case DIR_LEFT:
+ e->state = STATE_DIVERTER_TL;
+ break;
+ case DIR_RIGHT:
+ e->state = STATE_DIVERTER_TR;
+ break;
+ case DIR_NONE:
+ break;
}
}
@@ -737,11 +746,24 @@ void HDBGame::useEntity(AIEntity *e) {
// need to set the state AFTER the SetEntityGoal!
switch (p->dir) {
- case DIR_UP: p->state = STATE_PUSHUP; p->drawYOff = -10; break;
- case DIR_DOWN: p->state = STATE_PUSHDOWN; p->drawYOff = 9; break;
- case DIR_LEFT: p->state = STATE_PUSHLEFT; p->drawXOff = -10; break;
- case DIR_RIGHT: p->state = STATE_PUSHRIGHT; p->drawXOff = 10; break;
- case DIR_NONE: break;
+ case DIR_UP:
+ p->state = STATE_PUSHUP;
+ p->drawYOff = -10;
+ break;
+ case DIR_DOWN:
+ p->state = STATE_PUSHDOWN;
+ p->drawYOff = 9;
+ break;
+ case DIR_LEFT:
+ p->state = STATE_PUSHLEFT;
+ p->drawXOff = -10;
+ break;
+ case DIR_RIGHT:
+ p->state = STATE_PUSHRIGHT;
+ p->drawXOff = 10;
+ break;
+ case DIR_NONE:
+ break;
}
// if player is running, keep speed slow since we're pushing
@@ -752,17 +774,21 @@ void HDBGame::useEntity(AIEntity *e) {
switch (e->type) {
case AI_CRATE:
- g_hdb->_sound->playSound(SND_CRATE_SLIDE); break;
+ g_hdb->_sound->playSound(SND_CRATE_SLIDE);
+ break;
case AI_LIGHTBARREL:
case AI_FROGSTATUE:
case AI_ICE_BLOCK:
- g_hdb->_sound->playSound(SND_LIGHT_SLIDE); break;
+ g_hdb->_sound->playSound(SND_LIGHT_SLIDE);
+ break;
case AI_HEAVYBARREL:
case AI_MAGIC_EGG:
case AI_BOOMBARREL:
- g_hdb->_sound->playSound(SND_HEAVY_SLIDE); break;
+ g_hdb->_sound->playSound(SND_HEAVY_SLIDE);
+ break;
case AI_DIVERTER:
- g_hdb->_sound->playSound(SND_PUSH_DIVERTER); break;
+ g_hdb->_sound->playSound(SND_PUSH_DIVERTER);
+ break;
default:
break;
}
@@ -875,9 +901,8 @@ void HDBGame::setInMapName(const char *name) {
Common::Error HDBGame::run() {
// Initialize System
- if (!_systemInit) {
+ if (!_systemInit)
init();
- }
// Initializes Graphics
initGraphics(_screenWidth, _screenHeight, &_format);
@@ -1056,9 +1081,8 @@ Common::Error HDBGame::run() {
uint32 frameTime = curTime - lastTime;
uint32 frameCap = 1000 / kGameFPS;
- if (frameTime < frameCap) {
+ if (frameTime < frameCap)
g_system->delayMillis(frameCap - frameTime);
- }
lastTime = g_system->getMillis();
}
diff --git a/engines/hdb/menu.cpp b/engines/hdb/menu.cpp
index c11821cbfb..34c7c62c19 100644
--- a/engines/hdb/menu.cpp
+++ b/engines/hdb/menu.cpp
@@ -558,9 +558,15 @@ void Menu::drawMenu() {
_optionsXV += 3;
if (_optionsScrollX > g_hdb->_screenWidth + 10) {
switch (_nextScreen) {
- case 0: _optionsActive = true; break;
- case 1: _gamefilesActive = 1; break;
- case 2: _newgameActive = true; break;
+ case 0:
+ _optionsActive = true;
+ break;
+ case 1:
+ _gamefilesActive = 1;
+ break;
+ case 2:
+ _newgameActive = true;
+ break;
}
_oBannerY = 0;
@@ -1662,9 +1668,15 @@ void Menu::drawRocketAndSelections() {
// top-down/up scrolling stuff
switch (_nextScreen) {
- case 0: _optionsGfx->drawMasked(centerPic(_optionsGfx), _oBannerY); break;
- case 1: _modeLoadGfx->drawMasked(centerPic(_modeLoadGfx), _oBannerY); break;
- case 2: _newGfx->drawMasked(centerPic(_newGfx), _oBannerY); break;
+ case 0:
+ _optionsGfx->drawMasked(centerPic(_optionsGfx), _oBannerY);
+ break;
+ case 1:
+ _modeLoadGfx->drawMasked(centerPic(_modeLoadGfx), _oBannerY);
+ break;
+ case 2:
+ _newGfx->drawMasked(centerPic(_newGfx), _oBannerY);
+ break;
}
// menu items