diff options
Diffstat (limited to 'engines/hdb')
-rw-r--r-- | engines/hdb/ai-bots.cpp | 133 | ||||
-rw-r--r-- | engines/hdb/ai-funcs.cpp | 8 | ||||
-rw-r--r-- | engines/hdb/ai-lists.cpp | 3 | ||||
-rw-r--r-- | engines/hdb/ai-player.cpp | 40 | ||||
-rw-r--r-- | engines/hdb/ai-waypoint.cpp | 1 | ||||
-rw-r--r-- | engines/hdb/gfx.cpp | 2 | ||||
-rw-r--r-- | engines/hdb/hdb.cpp | 30 | ||||
-rw-r--r-- | engines/hdb/input.cpp | 2 | ||||
-rw-r--r-- | engines/hdb/input.h | 1 | ||||
-rw-r--r-- | engines/hdb/lua-script.cpp | 2 | ||||
-rw-r--r-- | engines/hdb/menu.cpp | 10 | ||||
-rw-r--r-- | engines/hdb/window.cpp | 4 |
12 files changed, 172 insertions, 64 deletions
diff --git a/engines/hdb/ai-bots.cpp b/engines/hdb/ai-bots.cpp index 6e99419925..5f7e28ddb9 100644 --- a/engines/hdb/ai-bots.cpp +++ b/engines/hdb/ai-bots.cpp @@ -114,6 +114,7 @@ void aiOmniBotAction(AIEntity *e) { } break; case DIR_NONE: + default: break; } @@ -361,6 +362,7 @@ void aiRightBotInit2(AIEntity *e) { e->state = STATE_MOVERIGHT; break; case DIR_NONE: + default: break; } } @@ -457,6 +459,7 @@ void aiRightBotFindGoal(AIEntity *e) { e->dir = DIR_DOWN; break; case DIR_NONE: + default: break; } } else if (!bg && !e1) { @@ -474,6 +477,7 @@ void aiRightBotFindGoal(AIEntity *e) { e->dir = DIR_UP; break; case DIR_NONE: + default: break; } } else { @@ -499,6 +503,7 @@ void aiRightBotFindGoal(AIEntity *e) { xv = -1; break; case DIR_NONE: + default: break; } sx += xv; @@ -522,6 +527,7 @@ void aiRightBotFindGoal(AIEntity *e) { e->state = STATE_MOVERIGHT; break; case DIR_NONE: + default: break; } @@ -718,6 +724,7 @@ void aiRailRiderAction(AIEntity *e) { e->yVel = 0; break; case DIR_NONE: + default: break; } } @@ -740,6 +747,8 @@ void aiRailRiderAction(AIEntity *e) { e->value1 = 0; // Not in a tunnel } break; + default: + break; } // Cycle through animation frames @@ -849,6 +858,7 @@ void aiRailRiderOnAction(AIEntity *e) { g_hdb->_ai->setEntityGoal(p, e->tileX, e->tileY + 1); break; case DIR_NONE: + default: break; } g_hdb->_ai->setPlayerInvisible(false); @@ -881,8 +891,9 @@ void aiRailRiderOnAction(AIEntity *e) { case DIR_RIGHT: e->draw = e->moverightGfx[0]; break; + case DIR_NONE: default: - break; // DIR_NONE + break; } g_hdb->_map->centerMapXY(e->x + 16, e->y + 16); @@ -925,6 +936,8 @@ void aiRailRiderOnAction(AIEntity *e) { e->draw = e->standupGfx[e->animFrame]; break; + default: + break; } } @@ -1020,6 +1033,8 @@ void aiMaintBotAction(AIEntity *e) { g_hdb->_ai->findPath(e); g_hdb->_ai->animateEntity(e); break; + default: + break; } // Deciding where to go at 4-way else { @@ -1046,11 +1061,15 @@ void aiMaintBotAction(AIEntity *e) { break; // Decide direction and GO case 0: - int dir = (g_hdb->_rnd->getRandomNumber(3)) + 1; - e->dir = dirList[dir]; - g_hdb->_ai->findPath(e); - if (e->onScreen && !g_hdb->isDemo()) - g_hdb->_sound->playSound(whistles[g_hdb->_rnd->getRandomNumber(2)]); + { + int dir = (g_hdb->_rnd->getRandomNumber(3)) + 1; + e->dir = dirList[dir]; + g_hdb->_ai->findPath(e); + if (e->onScreen && !g_hdb->isDemo()) + g_hdb->_sound->playSound(whistles[g_hdb->_rnd->getRandomNumber(2)]); + } + break; + default: break; } } @@ -1168,6 +1187,7 @@ void aiFourFirerAction(AIEntity *e) { } break; case DIR_NONE: + default: break; } @@ -1241,6 +1261,9 @@ void aiDeadEyeWalkInPlace(AIEntity *e) { break; case 0: e->sequence = 64; + break; + default: + break; } g_hdb->_ai->animEntFrames(e); } @@ -1278,6 +1301,7 @@ void aiDeadEyeAction(AIEntity *e) { nuts = true; break; case DIR_NONE: + default: break; } @@ -1343,35 +1367,39 @@ void aiDeadEyeAction(AIEntity *e) { } break; case 0: - // Pick a random direction and random number of tiles in that direction - int dir = g_hdb->_rnd->getRandomNumber(3) + 1; - int walk = g_hdb->_rnd->getRandomNumber(4) + 1; - - e->dir = (AIDir)dir; - e->state = state[dir]; - - int xv = xvAhead[dir] * walk; - if (e->tileX + xv < 1) - xv = 1 - e->tileX; - if (e->tileX + xv > g_hdb->_map->_width) - xv = g_hdb->_map->_width - e->tileX - 1; - - int yv = yvAhead[dir] * walk; - if (e->tileY + yv < 1) - yv = 1 - e->tileY; - if (e->tileY + yv > g_hdb->_map->_height) - yv = g_hdb->_map->_height - e->tileY - 1; - - e->value1 = xvAhead[dir]; - e->value2 = yvAhead[dir]; - e->moveSpeed = kPlayerMoveSpeed; - int result; - AIEntity *hit = g_hdb->_ai->legalMove(e->tileX + xvAhead[e->dir], e->tileY + yvAhead[e->dir], e->level, &result); - if (hit && hit->type == AI_GUY) - hit = nullptr; + { + // Pick a random direction and random number of tiles in that direction + int dir = g_hdb->_rnd->getRandomNumber(3) + 1; + int walk = g_hdb->_rnd->getRandomNumber(4) + 1; - if (!hit && result) - g_hdb->_ai->setEntityGoal(e, e->tileX + xv, e->tileY + yv); + e->dir = (AIDir)dir; + e->state = state[dir]; + + int xv = xvAhead[dir] * walk; + if (e->tileX + xv < 1) + xv = 1 - e->tileX; + if (e->tileX + xv > g_hdb->_map->_width) + xv = g_hdb->_map->_width - e->tileX - 1; + + int yv = yvAhead[dir] * walk; + if (e->tileY + yv < 1) + yv = 1 - e->tileY; + if (e->tileY + yv > g_hdb->_map->_height) + yv = g_hdb->_map->_height - e->tileY - 1; + + e->value1 = xvAhead[dir]; + e->value2 = yvAhead[dir]; + e->moveSpeed = kPlayerMoveSpeed; + int result; + AIEntity *hit = g_hdb->_ai->legalMove(e->tileX + xvAhead[e->dir], e->tileY + yvAhead[e->dir], e->level, &result); + if (hit && hit->type == AI_GUY) + hit = nullptr; + + if (!hit && result) + g_hdb->_ai->setEntityGoal(e, e->tileX + xv, e->tileY + yv); + } + break; + default: break; } g_hdb->_ai->animEntFrames(e); @@ -1477,6 +1505,7 @@ void aiLaserAction(AIEntity *e) { hit->int1 = 1; break; case DIR_NONE: + default: break; } } else { @@ -1497,6 +1526,7 @@ void aiLaserAction(AIEntity *e) { hit->int2 = -1; break; case DIR_NONE: + default: break; } } @@ -1640,6 +1670,7 @@ void aiLaserDraw(AIEntity *e, int mx, int my) { } } break; + case DIR_NONE: default: break; } @@ -1691,6 +1722,7 @@ void aiDiverterInit2(AIEntity *e) { e->draw = e->standrightGfx[0]; break; case DIR_NONE: + default: break; } @@ -1721,6 +1753,7 @@ void aiDiverterAction(AIEntity *e) { e->draw = e->standrightGfx[0]; break; case DIR_NONE: + default: break; } } @@ -1811,6 +1844,7 @@ void aiDiverterDraw(AIEntity *e, int mx, int my) { } break; case DIR_NONE: + default: break; } e->movedownFrames++; @@ -1985,6 +2019,9 @@ void aiMeerkatAction(AIEntity *e) { e->animDelay = e->animCycle; } break; + + default: + break; } // blasting a gem outta Guy? @@ -2262,6 +2299,8 @@ void aiFatFrogTongueDraw(AIEntity *e, int mx, int my) { g_hdb->_ai->_tileFroglickMiddleUD->drawMasked(nx - mx, ny - my); g_hdb->_ai->_tileFroglickWiggleUD[2]->drawMasked(nx - mx, ny + 32 - my); break; + default: + break; } break; @@ -2300,6 +2339,8 @@ void aiFatFrogTongueDraw(AIEntity *e, int mx, int my) { g_hdb->_ai->_tileFroglickMiddleLR->drawMasked(nx - mx, ny - my); g_hdb->_ai->_tileFroglickWiggleLeft[2]->drawMasked(nx - 32 - mx, ny - my); break; + default: + break; } break; @@ -2338,6 +2379,8 @@ void aiFatFrogTongueDraw(AIEntity *e, int mx, int my) { g_hdb->_ai->_tileFroglickMiddleLR->drawMasked(nx - mx, ny - my); g_hdb->_ai->_tileFroglickWiggleRight[2]->drawMasked(nx + 32 - mx, ny - my); break; + default: + break; } break; default: @@ -2491,6 +2534,9 @@ void aiGoodFairyAction(AIEntity *e) { e->sequence = 1; e->value1 = e->value2 = e->xVel = e->yVel = 0; } + break; + default: + break; } g_hdb->_ai->animEntFrames(e); return; @@ -2641,6 +2687,9 @@ void aiBadFairyAction(AIEntity *e) { e->sequence = 1; e->value1 = e->value2 = e->xVel = e->yVel = 0; } + break; + default: + break; } g_hdb->_ai->animEntFrames(e); return; @@ -2669,9 +2718,10 @@ void aiBadFairyAction(AIEntity *e) { } } g_hdb->_ai->animateEntity(e); - } else + } else { // if not, start looking around! e->sequence = 20; + } } //------------------------------------------------------------------- @@ -2728,6 +2778,7 @@ void aiGatePuddleAction(AIEntity *e) { g_hdb->_ai->setEntityGoal(p, p->tileX + 1, p->tileY); break; case DIR_NONE: + default: break; } g_hdb->_ai->_playerEmerging = true; @@ -2762,6 +2813,7 @@ void aiGatePuddleAction(AIEntity *e) { g_hdb->_ai->setEntityGoal(p, p->tileX + 1, p->tileY); break; case DIR_NONE: + default: break; } g_hdb->_ai->_playerEmerging = true; @@ -2946,6 +2998,8 @@ void aiIcePuffAction(AIEntity *e) { e->draw = e->blinkGfx[3]; e->sequence = 30; break; + default: + break; } // can we see the player? (and no snowball is out) @@ -3128,6 +3182,10 @@ void aiBuzzflyAction(AIEntity *e) { if (e->onScreen) g_hdb->_sound->playSound(SND_BUZZFLY_FLY); e->sequence = 0; + break; + + default: + break; } } else { g_hdb->_ai->animateEntity(e); @@ -3313,6 +3371,9 @@ void aiDragonAction(AIEntity *e) { } } break; + + default: + break; } } @@ -3338,6 +3399,8 @@ void aiDragonDraw(AIEntity *e, int mx, int my) { case 4: g_hdb->_ai->_gfxDragonBreathe[e->animFrame & 1]->drawMasked(e->x - 32 - mx, e->y - 96 - my); break; + default: + break; } } diff --git a/engines/hdb/ai-funcs.cpp b/engines/hdb/ai-funcs.cpp index e2955959da..438f617e97 100644 --- a/engines/hdb/ai-funcs.cpp +++ b/engines/hdb/ai-funcs.cpp @@ -821,6 +821,8 @@ void AI::killPlayer(Death method) { g_hdb->_sound->playSound(SND_GUY_PLUMMET); } break; + default: + break; } // sound.StopMusic(); @@ -1038,6 +1040,7 @@ void AI::animateEntity(AIEntity *e) { xv = 1; break; case DIR_NONE: + default: break; } @@ -1095,6 +1098,7 @@ void AI::animateEntity(AIEntity *e) { yOff = 0; break; case DIR_NONE: + default: break; } if ((e->tileX + xOff == _waypoints[_numWaypoints - 1].x && @@ -1185,6 +1189,7 @@ void AI::animateEntity(AIEntity *e) { e->state = STATE_MOVERIGHT; break; case DIR_NONE: + default: break; } if (_playerRunning) { @@ -1273,6 +1278,7 @@ void AI::animateEntity(AIEntity *e) { xv = 1; break; case DIR_NONE: + default: break; } @@ -1895,6 +1901,7 @@ void AI::entityFace(const char *luaName, int dir) { e->state = STATE_STANDRIGHT; break; case DIR_NONE: + default: break; } } @@ -1978,6 +1985,7 @@ bool AI::findPath(AIEntity *e) { xv = 1; break; case DIR_NONE: + default: break; } diff --git a/engines/hdb/ai-lists.cpp b/engines/hdb/ai-lists.cpp index f728d5ac6f..c7637113ee 100644 --- a/engines/hdb/ai-lists.cpp +++ b/engines/hdb/ai-lists.cpp @@ -51,6 +51,7 @@ void AI::addAnimateTarget(int x, int y, int start, int end, AnimSpeed speed, boo at->animFrame = 10; break; case ANIM_NORMAL: + default: at->animCycle = 6; at->animFrame = 6; break; @@ -215,6 +216,7 @@ void AI::animateBridges() { } break; case DIR_NONE: + default: break; } @@ -747,6 +749,7 @@ bool AI::checkTeleportList(AIEntity *e, int x, int y) { setEntityGoal(e, e->tileX + 1, e->tileY); break; case DIR_NONE: + default: break; } diff --git a/engines/hdb/ai-player.cpp b/engines/hdb/ai-player.cpp index 029df3f8d4..02089e2413 100644 --- a/engines/hdb/ai-player.cpp +++ b/engines/hdb/ai-player.cpp @@ -55,6 +55,7 @@ void aiPlayerInit(AIEntity *e) { e->state = STATE_STANDRIGHT; break; case DIR_NONE: + default: break; } @@ -493,6 +494,7 @@ void aiPlayerDraw(AIEntity *e, int mx, int my) { g_hdb->_ai->_stunLightningGfx[frame]->drawMasked(e->x + 64 - mx, e->y - my); break; case DIR_NONE: + default: break; } @@ -590,26 +592,30 @@ void aiGemAttackAction(AIEntity *e) { break; // coming back to daddy? case 1: - AIEntity *p = g_hdb->_ai->getPlayer(); - if (e->x < p->x) - e->x++; - else - e->x--; - - if (e->y < p->y) - e->y++; - else - e->y--; - - if (abs(e->x - p->x) < 4 && abs(e->y - p->y) < 4) { - int amt = g_hdb->_ai->getGemAmount(); - g_hdb->_ai->setGemAmount(amt + 1); - g_hdb->_ai->addAnimateTarget(e->x, e->y, 0, 3, ANIM_NORMAL, false, false, GEM_FLASH); - g_hdb->_ai->removeEntity(e); - g_hdb->_sound->playSound(SND_GET_GEM); + AIEntity *p = g_hdb->_ai->getPlayer(); + if (e->x < p->x) + e->x++; + else + e->x--; + + if (e->y < p->y) + e->y++; + else + e->y--; + + if (abs(e->x - p->x) < 4 && abs(e->y - p->y) < 4) + { + int amt = g_hdb->_ai->getGemAmount(); + g_hdb->_ai->setGemAmount(amt + 1); + g_hdb->_ai->addAnimateTarget(e->x, e->y, 0, 3, ANIM_NORMAL, false, false, GEM_FLASH); + g_hdb->_ai->removeEntity(e); + g_hdb->_sound->playSound(SND_GET_GEM); + } } break; + default: + break; } } diff --git a/engines/hdb/ai-waypoint.cpp b/engines/hdb/ai-waypoint.cpp index a10b70d483..a71f45c8b0 100644 --- a/engines/hdb/ai-waypoint.cpp +++ b/engines/hdb/ai-waypoint.cpp @@ -413,6 +413,7 @@ Tile *AI::getStandFrameDir(AIEntity *e) { return e->moverightGfx[0]; break; case DIR_NONE: + default: break; } return e->standdownGfx[0]; diff --git a/engines/hdb/gfx.cpp b/engines/hdb/gfx.cpp index ef3b1fe2c5..82fdf742be 100644 --- a/engines/hdb/gfx.cpp +++ b/engines/hdb/gfx.cpp @@ -1238,6 +1238,8 @@ void Gfx::turnOnBonusStars(int which) { _starsInfo.gfx[0] = loadPic(SECRETSTAR_BLUE1); _starsInfo.gfx[1] = loadPic(SECRETSTAR_BLUE2); break; + default: + break; } } diff --git a/engines/hdb/hdb.cpp b/engines/hdb/hdb.cpp index 1fc20efbd5..dd20951728 100644 --- a/engines/hdb/hdb.cpp +++ b/engines/hdb/hdb.cpp @@ -225,6 +225,8 @@ void HDBGame::changeGameState() { break; case GAME_LOADING: break; + default: + break; } } @@ -361,17 +363,21 @@ void HDBGame::paint() { _gfx->drawPointer(); break; case GAME_LOADING: - // clear video, then draw HDB logo - drawLoadingScreen(); - - // if the graphic has never been loaded, load it now and leave it in memory - if (!_logoGfx) - _logoGfx = _gfx->loadPic(TITLELOGO); - _logoGfx->drawMasked(_screenWidth / 2 - _logoGfx->_width / 2, 10); - - int x = _screenWidth / 2 - _progressGfx->_width / 2; - int pixels = _progressGfx->_width - _progressMarkGfx->_width; - _progressXOffset = (int)(((double)pixels / _progressMax) * (double)_progressCurrent) + x; + { + // clear video, then draw HDB logo + drawLoadingScreen(); + + // if the graphic has never been loaded, load it now and leave it in memory + if (!_logoGfx) + _logoGfx = _gfx->loadPic(TITLELOGO); + _logoGfx->drawMasked(_screenWidth / 2 - _logoGfx->_width / 2, 10); + + int x = _screenWidth / 2 - _progressGfx->_width / 2; + int pixels = _progressGfx->_width - _progressMarkGfx->_width; + _progressXOffset = (int)(((double)pixels / _progressMax) * (double)_progressCurrent) + x; + } + break; + default: break; } @@ -725,6 +731,7 @@ void HDBGame::useEntity(AIEntity *e) { e->state = STATE_DIVERTER_TR; break; case DIR_NONE: + default: break; } } @@ -760,6 +767,7 @@ void HDBGame::useEntity(AIEntity *e) { p->drawXOff = 10; break; case DIR_NONE: + default: break; } diff --git a/engines/hdb/input.cpp b/engines/hdb/input.cpp index 7a45c2ef1e..6ea04141bc 100644 --- a/engines/hdb/input.cpp +++ b/engines/hdb/input.cpp @@ -413,6 +413,8 @@ void Input::stylusDown(int x, int y) { } case GAME_LOADING: break; + default: + break; } } diff --git a/engines/hdb/input.h b/engines/hdb/input.h index 3d469946ee..e870435497 100644 --- a/engines/hdb/input.h +++ b/engines/hdb/input.h @@ -68,6 +68,7 @@ public: case 2: _keyLeft = keyPressed; return; case 3: _keyRight = keyPressed; return; case 4: _keyUse = keyPressed; return; + default: break; } } diff --git a/engines/hdb/lua-script.cpp b/engines/hdb/lua-script.cpp index 82a52f7c24..054bde9104 100644 --- a/engines/hdb/lua-script.cpp +++ b/engines/hdb/lua-script.cpp @@ -1018,6 +1018,8 @@ static int animation(lua_State *L) { if (playsnd) g_hdb->_sound->playSound(SND_CHICKEN_DEATH); break; + default: + break; } lua_pop(L, 3); diff --git a/engines/hdb/menu.cpp b/engines/hdb/menu.cpp index a9b1f4a75f..4a40036039 100644 --- a/engines/hdb/menu.cpp +++ b/engines/hdb/menu.cpp @@ -600,6 +600,8 @@ void Menu::drawMenu() { case 2: _newgameActive = true; break; + default: + break; } _oBannerY = 0; @@ -1160,6 +1162,9 @@ void Menu::drawTitle() { _titleLogo->drawMasked(centerPic(_titleLogo), _rocketY + _mTitleY); break; + + default: + break; } // timer countdown... @@ -1293,6 +1298,9 @@ void Menu::drawTitle() { _titleActive = false; g_hdb->changeGameState(); break; + + default: + break; } } @@ -1711,6 +1719,8 @@ void Menu::drawRocketAndSelections() { case 2: _newGfx->drawMasked(centerPic(_newGfx), _oBannerY); break; + default: + break; } // menu items diff --git a/engines/hdb/window.cpp b/engines/hdb/window.cpp index 5cd4875595..af3c816008 100644 --- a/engines/hdb/window.cpp +++ b/engines/hdb/window.cpp @@ -1858,7 +1858,9 @@ void Window::drawPanicZone() { return; } } - break; + break; + default: + break; } } |