/* ScummVM - Graphic Adventure Engine * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT * file distributed with this source distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ #include "hdb/hdb.h" #include "hdb/menu.h" namespace HDB { bool Menu::init() { _starWarp = 0; _rocketEx = 0; _titleActive = false; _menuActive = false; _optionsActive = false; _gamefilesActive = false; _newgameActive = false; _warpActive = false; _optionsScrolling = false; _optionsScrollX = kMenuX; _rocketX = kMRocketX; _sayHDB = false; _nebulaY = 0; // Used as a flag _fStars[0].y = 0; // Used as a flag _keyAssignUp = Common::KEYCODE_UP; _keyAssignDown = Common::KEYCODE_DOWN; _keyAssignLeft = Common::KEYCODE_LEFT; _keyAssignRight = Common::KEYCODE_RIGHT; _keyAssignUse = Common::KEYCODE_RETURN; _gCheckEmpty = g_hdb->_gfx->loadPic(G_CHECK_EMPTY); _gCheckOff = g_hdb->_gfx->loadPic(G_CHECK_OFF); _gCheckOn = g_hdb->_gfx->loadPic(G_CHECK_ON); _gCheckLeft = g_hdb->_gfx->loadPic(G_CHECK_LEFT); _gCheckRight = g_hdb->_gfx->loadPic(G_CHECK_RIGHT); _contArrowUp = g_hdb->_gfx->loadPic(CTRL_ARROWUP); _contArrowDown = g_hdb->_gfx->loadPic(CTRL_ARROWDN); _contArrowLeft = g_hdb->_gfx->loadPic(CTRL_ARROWLEFT); _contArrowRight = g_hdb->_gfx->loadPic(CTRL_ARROWRIGHT); _contAssign = g_hdb->_gfx->loadPic(CTRL_ASSIGN); _waitingForKey = false; _warpPlaque = g_hdb->_gfx->loadPic(WARP_PLAQUE); _hdbLogoScreen = g_hdb->_gfx->loadPic(TITLESCREEN); return true; } void Menu::readConfig() { warning("STUB: readConfig: Music Config not implemented"); if (ConfMan.hasKey(CONFIG_MSTONE7)) { g_hdb->setStarsMonkeystone7(ConfMan.getInt(CONFIG_MSTONE7)); } else { ConfMan.setInt(CONFIG_MSTONE7, STARS_MONKEYSTONE_7_FAKE); } if (ConfMan.hasKey(CONFIG_MSTONE14)) { g_hdb->setStarsMonkeystone14(ConfMan.getInt(CONFIG_MSTONE14)); } else { ConfMan.setInt(CONFIG_MSTONE14, STARS_MONKEYSTONE_14_FAKE); } if (ConfMan.hasKey(CONFIG_MSTONE21)) { g_hdb->setStarsMonkeystone21(ConfMan.getInt(CONFIG_MSTONE21)); } else { ConfMan.setInt(CONFIG_MSTONE21, STARS_MONKEYSTONE_21_FAKE); } if (ConfMan.hasKey(CONFIG_KEY_UP)) { _keyAssignUp = (Common::KeyCode)ConfMan.getInt(CONFIG_KEY_UP); g_hdb->_input->assignKey(0, _keyAssignUp); } else { ConfMan.setInt(CONFIG_KEY_UP, _keyAssignUp); } if (ConfMan.hasKey(CONFIG_KEY_DOWN)) { _keyAssignDown = (Common::KeyCode)ConfMan.getInt(CONFIG_KEY_DOWN); g_hdb->_input->assignKey(1, _keyAssignDown); } else { ConfMan.setInt(CONFIG_KEY_DOWN, _keyAssignDown); } if (ConfMan.hasKey(CONFIG_KEY_LEFT)) { _keyAssignLeft = (Common::KeyCode)ConfMan.getInt(CONFIG_KEY_LEFT); g_hdb->_input->assignKey(2, _keyAssignLeft); } else { ConfMan.setInt(CONFIG_KEY_LEFT, _keyAssignLeft); } if (ConfMan.hasKey(CONFIG_KEY_RIGHT)) { _keyAssignRight = (Common::KeyCode)ConfMan.getInt(CONFIG_KEY_RIGHT); g_hdb->_input->assignKey(3, _keyAssignRight); } else { ConfMan.setInt(CONFIG_KEY_RIGHT, _keyAssignRight); } if (ConfMan.hasKey(CONFIG_KEY_USE)) { _keyAssignUse = (Common::KeyCode)ConfMan.getInt(CONFIG_KEY_USE); g_hdb->_input->assignKey(4, _keyAssignUse); } else { ConfMan.setInt(CONFIG_KEY_USE, _keyAssignUse); } if (ConfMan.hasKey(CONFIG_CHEAT)) { g_hdb->setCheatingOn(); } ConfMan.flushToDisk(); } void Menu::writeConfig() { warning("STUB: writeConfig: Music Config not implemented"); int value; value = g_hdb->getStarsMonkeystone7(); ConfMan.setInt(CONFIG_MSTONE7, value); value = g_hdb->getStarsMonkeystone14(); ConfMan.setInt(CONFIG_MSTONE14, value); value = g_hdb->getStarsMonkeystone21(); ConfMan.setInt(CONFIG_MSTONE21, value); ConfMan.setInt(CONFIG_KEY_UP, _keyAssignUp); ConfMan.setInt(CONFIG_KEY_DOWN, _keyAssignDown); ConfMan.setInt(CONFIG_KEY_LEFT, _keyAssignLeft); ConfMan.setInt(CONFIG_KEY_RIGHT, _keyAssignRight); ConfMan.setInt(CONFIG_KEY_USE, _keyAssignUse); if (g_hdb->getCheatingOn()) ConfMan.set(CONFIG_CHEAT, "1"); } void Menu::startMenu() { int i; // stuff that gets loaded-in at Title Screen if (!_titleLogo) { _titleLogo = g_hdb->_gfx->loadPic(TITLELOGO); for (i = 0; i < kNebulaCount; i++) _nebulaGfx[i] = g_hdb->_gfx->loadPic(nebulaNames[i]); _rocketMain = g_hdb->_gfx->loadPic(MENU_ROCKETSHIP1); _rocketSecond = g_hdb->_gfx->loadPic(MENU_ROCKETSHIP2); _rocketEx1 = g_hdb->_gfx->loadPic(MENU_EXHAUST1); _rocketEx2 = g_hdb->_gfx->loadPic(MENU_EXHAUST2); } // // menu-only stuff // _newGfx = g_hdb->_gfx->loadPic(MENU_NEWGAME); _loadGfx = g_hdb->_gfx->loadPic(MENU_LOADGAME); _optionsGfx = g_hdb->_gfx->loadPic(MENU_OPTIONS); _quitGfx = g_hdb->_gfx->loadPic(MENU_QUIT); _resumeGfx = g_hdb->_gfx->loadPic(MENU_RESUME); _slotGfx = g_hdb->_gfx->loadPic(GAMEFILE_SLOT); _menuBackoutGfx = g_hdb->_gfx->loadPic(MENU_BACK); _menuBackspaceGfx = g_hdb->_gfx->loadPic(MENU_BACKSPACE); _controlButtonGfx = g_hdb->_gfx->loadPic(MENU_CONTROLS); _controlsGfx = g_hdb->_gfx->loadPic(PIC_CONTROLSSCREEN); _vortexian[0] = g_hdb->_gfx->loadTile(GROUP_ENT_VORTEXIAN_STANDDOWN"01"); _vortexian[1] = g_hdb->_gfx->loadTile(GROUP_ENT_VORTEXIAN_STANDDOWN"02"); _vortexian[2] = g_hdb->_gfx->loadTile(GROUP_ENT_VORTEXIAN_STANDDOWN"03"); _modeLoadGfx = g_hdb->_gfx->loadPic(MENU_LOAD); _modeSaveGfx = g_hdb->_gfx->loadPic(MENU_SAVE); _modePuzzleGfx = g_hdb->_gfx->loadPic(MODE_PUZZLE); _modeActionGfx = g_hdb->_gfx->loadPic(MODE_ACTION); _sliderLeft = g_hdb->_gfx->loadPic(MENU_SLIDER_LEFT); _sliderMid = g_hdb->_gfx->loadPic(MENU_SLIDER_MID); _sliderRight = g_hdb->_gfx->loadPic(MENU_SLIDER_RIGHT); _sliderKnob = g_hdb->_gfx->loadPic(MENU_SLIDER_KNOB); _starRedGfx[0] = g_hdb->_gfx->loadPic(SECRETSTAR_RED1); _starRedGfx[1] = g_hdb->_gfx->loadPic(SECRETSTAR_RED2); _starGreenGfx[0] = g_hdb->_gfx->loadPic(SECRETSTAR_GREEN1); _starGreenGfx[1] = g_hdb->_gfx->loadPic(SECRETSTAR_GREEN2); _starBlueGfx[0] = g_hdb->_gfx->loadPic(SECRETSTAR_BLUE1); _starBlueGfx[1] = g_hdb->_gfx->loadPic(SECRETSTAR_BLUE2); // setup menu falling stars _star[0] = g_hdb->_gfx->loadPic(STAR_1); _star[1] = g_hdb->_gfx->loadPic(STAR_2); _star[2] = g_hdb->_gfx->loadPic(STAR_3); _versionGfx = g_hdb->_gfx->loadPic(MENU_VERSION_NUMBER); _warpGfx = g_hdb->_gfx->loadPic(MENU_WARP); // if we're popping back into menu, don't init this if (!_fStars[0].y) { for (i = 0; i < kMaxStars; i++) { _fStars[i].y = -30; _fStars[i].x = g_hdb->_rnd->getRandomNumber(kScreenWidth); _fStars[i].speed = g_hdb->_rnd->getRandomNumber(5) + 1; _fStars[i].anim = g_hdb->_rnd->getRandomNumber(3); _fStars[i].delay = 5; } } _quitScreen = NULL; // did we skip the intro? if (!_nebulaY) { g_hdb->_gfx->setup3DStars(); // setup the star info _nebulaWhich = g_hdb->_rnd->getRandomNumber(kNebulaCount); _nebulaX = g_hdb->_rnd->getRandomNumber(kScreenWidth) + 10; _nebulaY = -20; _nebulaYVel = g_hdb->_rnd->getRandomNumber(10) + 2; } _optionsScrollX = kMenuX; _oBannerY = -48; _rocketY = kMRocketY; _rocketX = kMRocketX; _menuActive = true; _clickDelay = 30; fillSavegameSlots(); // did we already say "HYPERSPACE DELIVERY BOY!" ?? // if not, this is a great time to check for Copy Protection! if (_sayHDB == false) { g_hdb->_sound->playSound(SND_HDB); _sayHDB = true; } } void Menu::changeToMenu() { if (!g_hdb->_sound->songPlaying(_titleSong)) { g_hdb->_sound->stopMusic(); g_hdb->_sound->startMusic(_titleSong); } } void Menu::drawMenu() { // DEC the counter... if (_clickDelay) _clickDelay--; // sound.UpdateMusic(); // fading in/out g_hdb->_gfx->turnOffFade(); // heh //------------------------------------------------------------------- // Draw the MAIN MENU //------------------------------------------------------------------- if (_menuActive) { drawRocketAndSelections(); // draw version # _versionGfx->drawMasked(kScreenWidth - 6 * 8, kScreenHeight - 8); // // see if the Options/GameFiles menu has scrolled off // if (_optionsScrolling) { _optionsScrollX += _optionsXV; _rocketX += -_optionsXV; _oBannerY += _optionsXV / 3; _optionsXV += 3; if (_optionsScrollX > kScreenWidth + 10) { switch (_nextScreen) { case 0: _optionsActive = true; break; case 1: _gamefilesActive = 1; break; case 2: _newgameActive = true; break; } _oBannerY = 0; _optionsScrolling = false; _menuActive = false; } } // // Draw the Secret Stars! (tm) // if (g_hdb->getStarsMonkeystone7() == STARS_MONKEYSTONE_7 || g_hdb->getStarsMonkeystone14() == STARS_MONKEYSTONE_14 || g_hdb->getStarsMonkeystone21() == STARS_MONKEYSTONE_21) { static int anim = 0, angler = 0, angleb = 90, angleg = 180; static uint32 anim_time; if (g_hdb->getStarsMonkeystone7() == STARS_MONKEYSTONE_7) _starRedGfx[anim]->drawMasked( kStarRedX + (int)(5 * g_hdb->_gfx->getCos(angler)), kStarRedY + (int)(5 * g_hdb->_gfx->getSin(angler)) ); if (g_hdb->getStarsMonkeystone14() == STARS_MONKEYSTONE_14) _starGreenGfx[anim]->drawMasked( kStarGreenX + (int)(5 * g_hdb->_gfx->getCos(angleg)), kStarGreenY + (int)(5 * g_hdb->_gfx->getSin(angleg)) ); if (g_hdb->getStarsMonkeystone21() == STARS_MONKEYSTONE_21) _starBlueGfx[anim]->drawMasked( kStarBlueX + (int)(5 * g_hdb->_gfx->getCos(angleb)), kStarBlueY + (int)(5 * g_hdb->_gfx->getSin(angleb)) ); angler += 10; if (angler > 359) angler = 0; angleg += 10; if (angleg > 359) angleg = 0; angleb += 10; if (angleb > 359) angleb = 0; if (anim_time < g_hdb->getTimeSlice()) { anim_time = g_hdb->getTimeSlice() + 500; anim = 1 - anim; } } //#ifndef HDB_DEMO // // Draw WARP // if (g_hdb->getCheatingOn() && _warpGfx) _warpGfx->drawMasked(0, kScreenHeight - _warpGfx->_height); //#endif } else if (_newgameActive) { //------------------------------------------------------------------- // Draw the NEWGAME menu //------------------------------------------------------------------- g_hdb->_gfx->draw3DStars(); // // see if the Options menu has scrolled back on // if (_optionsScrolling) { _optionsScrollX += _optionsXV; _rocketX += -_optionsXV; _oBannerY += _optionsXV / 3; _optionsXV -= 3; if (_optionsScrollX < kMenuX) { _optionsScrollX = kMenuX; _rocketX = kMRocketX; _oBannerY = -48; _optionsScrolling = false; _newgameActive = false; _menuActive = true; } drawRocketAndSelections(); } else { drawNebula(); _newGfx->drawMasked(centerPic(_newGfx), _oBannerY); _modePuzzleGfx->drawMasked(kNewGameX, kModePuzzleY); _modePuzzleGfx->drawMasked(kNewGameX, kModeActionY); g_hdb->_gfx->setCursor(kNewGameX2, kModePuzzleY - 10); g_hdb->_gfx->drawText("PUZZLE MODE"); g_hdb->_gfx->setCursor(kNewGameX2, kModePuzzleY + 10); g_hdb->_gfx->drawText("In this mode, the focus"); g_hdb->_gfx->setCursor(kNewGameX2, kModePuzzleY + 22); g_hdb->_gfx->drawText("is on solving puzzles and"); g_hdb->_gfx->setCursor(kNewGameX2, kModePuzzleY + 34); g_hdb->_gfx->drawText("avoiding enemies."); g_hdb->_gfx->setCursor(kNewGameX2, kModeActionY - 10); g_hdb->_gfx->drawText("ACTION MODE"); g_hdb->_gfx->setCursor(kNewGameX2, kModeActionY + 10); g_hdb->_gfx->drawText("In this mode, the focus"); g_hdb->_gfx->setCursor(kNewGameX2, kModeActionY + 22); g_hdb->_gfx->drawText("is on solving puzzles and"); g_hdb->_gfx->setCursor(kNewGameX2, kModeActionY + 34); g_hdb->_gfx->drawText("attacking enemies!"); // title logo _titleLogo->drawMasked(centerPic(_titleLogo), _rocketY + kMTitleY); _menuBackoutGfx->drawMasked(kBackoutX, kBackoutY); } } else if (_optionsActive) { //------------------------------------------------------------------- // Draw the OPTIONS menu //------------------------------------------------------------------- g_hdb->_gfx->draw3DStars(); // // see if the Options menu has scrolled back on // if (_optionsScrolling) { _optionsScrollX += _optionsXV; _rocketX += -_optionsXV; _oBannerY += _optionsXV / 3; _optionsXV -= 3; if (_optionsScrollX < kMenuX) { _optionsScrollX = kMenuX; _rocketX = kMRocketX; _oBannerY = -48; _optionsScrolling = false; _optionsActive = false; _menuActive = true; } drawRocketAndSelections(); } else if (_optionsActive == 1) { // // Options menu content // static int hand_off, hand_yvel = 1; drawNebula(); _optionsGfx->drawMasked(centerPic(_optionsGfx), _oBannerY); g_hdb->_gfx->setCursor(kOptionsX + kOptionSPC, kOptionsY); if (!g_hdb->_sound->getMusicVolume()) g_hdb->_gfx->drawText("Music OFF"); else g_hdb->_gfx->drawText("Music Volume"); drawSlider(kOptionsX, kOptionsY + 20, g_hdb->_sound->getMusicVolume()); g_hdb->_gfx->setCursor(kOptionsX + kOptionSPC, kOptionsY + kOptionLineSPC * 2); if (!g_hdb->_sound->getSFXVolume()) g_hdb->_gfx->drawText("Sound Effects OFF"); else g_hdb->_gfx->drawText("Sound Effects Volume"); drawSlider(kOptionsX, kOptionsY + kOptionLineSPC * 2 + 20, g_hdb->_sound->getSFXVolume()); // Voices ON or OFF drawToggle(kOptionsX, kOptionsY + kOptionLineSPC * 4 + 20, g_hdb->_sound->getVoiceStatus()); if (!g_hdb->isVoiceless()) { g_hdb->_gfx->setCursor(kOptionsX + kOptionSPC + 24, kOptionsY + kOptionLineSPC * 4 + 24); if (!g_hdb->_sound->getVoiceStatus()) g_hdb->_gfx->drawText("Voice Dialogue OFF"); else g_hdb->_gfx->drawText("Voice Dialogue ON"); } // title logo _titleLogo->drawMasked(centerPic(_titleLogo), _rocketY + kMTitleY); _menuBackoutGfx->drawMasked(kBackoutX, kBackoutY); _controlButtonGfx->drawMasked(centerPic(_controlButtonGfx), kMControlsY); } else if (_optionsActive == 2) { // // Draw CONTROLS screen // controlsDraw(); return; } } else if (_gamefilesActive) { //------------------------------------------------------------------- // DRAW GAMEFILES MENU //------------------------------------------------------------------- int i; g_hdb->_gfx->draw3DStars(); // // see if the Options menu has scrolled back on // if (_optionsScrolling) { _optionsScrollX += _optionsXV; _rocketX += -_optionsXV; _oBannerY += _optionsXV / 3; _optionsXV -= 3; if (_optionsScrollX < kMenuX) { _optionsScrollX = kMenuX; _rocketX = kMRocketX; _oBannerY = -48; _optionsScrolling = false; _gamefilesActive = false; _menuActive = true; } drawRocketAndSelections(); } else { static int anim = 0; static uint32 anim_time = 0; drawNebula(); _titleLogo->drawMasked(centerPic(_titleLogo), _rocketY + kMTitleY); // CHOOSE SLOT screen _modeLoadGfx->drawMasked(centerPic(_modeLoadGfx), _oBannerY); _menuBackoutGfx->drawMasked(kBackoutX, kBackoutY); if (_saveGames[0].seconds) { _vortexian[anim]->drawMasked(kVortSaveX, kVortSaveY); } if (anim_time < g_hdb->getTimeSlice()) { anim_time = g_hdb->getTimeSlice() + 50; anim++; if (anim > 2) anim = 0; } for (i = 0; i < kNumSaveSlots; i++) { char buff[16]; int seconds = _saveGames[i].seconds; _slotGfx->drawMasked(kSaveSlotX - 8, i * 32 + (kSaveSlotY - 4)); if (seconds || _saveGames[i].mapName[0]) { g_hdb->_gfx->setTextEdges(0, kScreenWidth + 60, 0, kScreenHeight); g_hdb->_gfx->setCursor(kSaveSlotX, i * 32 + kSaveSlotY); g_hdb->_gfx->drawText(_saveGames[i].mapName); g_hdb->_gfx->setCursor(kSaveSlotX + 180, i * 32 + kSaveSlotY); sprintf(buff, "%02d:%02d", seconds / 3600, (seconds / 60) % 60); g_hdb->_gfx->drawText(buff); } } } } else if (_warpActive) { //------------------------------------------------------------------- // DRAW WARP MENU //------------------------------------------------------------------- int i; char string[32]; g_hdb->_gfx->draw3DStars(); drawNebula(); drawWarpScreen(); // title logo _titleLogo->drawMasked(centerPic(_titleLogo), _rocketY + kMTitleY); _menuBackoutGfx->drawMasked(kWarpBackoutX, kWarpBackoutY); for (i = 0; i < 10; i++) { sprintf(string, "Map %2d", i); g_hdb->_gfx->setCursor(kWarpX + 4, i * 16 + kWarpY); g_hdb->_gfx->drawText(string); } for (i = 0; i < 10; i++) { sprintf(string, "Map %d", i + 10); g_hdb->_gfx->setCursor(kWarpX + 80, i * 16 + kWarpY); g_hdb->_gfx->drawText(string); } for (i = 0; i < 10; i++) { sprintf(string, "Map %d", i + 20); g_hdb->_gfx->setCursor(kWarpX + 160, i * 16 + kWarpY); g_hdb->_gfx->drawText(string); } if (_warpActive > 1) { g_hdb->_gfx->setCursor(kWarpX + 60, kWarpY + 164); sprintf(string, "Warping to MAP%d", _warpActive - 2); g_hdb->_gfx->centerPrint(string); } } else if (_quitActive) { //------------------------------------------------------------------- // DRAW QUIT SCREEN //------------------------------------------------------------------- g_hdb->_gfx->draw3DStars(); drawNebula(); { if (!_quitScreen) _quitScreen = g_hdb->_gfx->loadPic(PIC_QUITSCREEN); _quitScreen->drawMasked(kQuitX, kQuitY); } } } void Menu::freeMenu() { int i; // title sequence stuff if (_titleScreen) _titleScreen->free(); _titleScreen = NULL; if (_oohOohGfx) _oohOohGfx->free(); _oohOohGfx = NULL; if (_newGfx) _newGfx->free(); _newGfx = NULL; if (_loadGfx) _loadGfx->free(); _loadGfx = NULL; if (_optionsGfx) _optionsGfx->free(); _optionsGfx = NULL; if (_quitGfx) _quitGfx->free(); _quitGfx = NULL; if (_resumeGfx) _resumeGfx->free(); _resumeGfx = NULL; if (_slotGfx) _slotGfx->free(); _slotGfx = NULL; if (_rocketMain) _rocketMain->free(); _rocketMain = NULL; if (_rocketSecond) _rocketSecond->free(); _rocketSecond = NULL; if (_rocketEx1) _rocketEx1->free(); _rocketEx1 = NULL; if (_rocketEx2) _rocketEx2->free(); _rocketEx2 = NULL; if (_titleLogo) _titleLogo->free(); _titleLogo = NULL; if (_hdbLogoScreen) _hdbLogoScreen->free(); _hdbLogoScreen = NULL; if (_nebulaGfx[0]) for (i = 0; i < kNebulaCount; i++) { _nebulaGfx[i]->free(); _nebulaGfx[i] = NULL; } if (_sliderLeft) _sliderLeft->free(); _sliderLeft = NULL; if (_sliderMid) _sliderMid->free(); _sliderMid = NULL; if (_sliderRight) _sliderRight->free(); _sliderRight = NULL; if (_sliderKnob) _sliderKnob->free(); _sliderKnob = NULL; if (_modePuzzleGfx) _modePuzzleGfx->free(); _modePuzzleGfx = NULL; if (_modeActionGfx) _modeActionGfx->free(); _modeActionGfx = NULL; if (_modeLoadGfx) _modeLoadGfx->free(); _modeLoadGfx = NULL; if (_modeSaveGfx) _modeSaveGfx->free(); _modeSaveGfx = NULL; if (_menuBackoutGfx) _menuBackoutGfx->free(); _menuBackoutGfx = NULL; if (_controlButtonGfx) _controlButtonGfx->free(); _controlButtonGfx = NULL; if (_controlsGfx) _controlsGfx->free(); _controlsGfx = NULL; if (_vortexian[0]) { _vortexian[0]->free(); _vortexian[1]->free(); _vortexian[2]->free(); _vortexian[0] = _vortexian[1] = _vortexian[2] = NULL; } if (_star[0]) { _star[0]->free(); _star[1]->free(); _star[2]->free(); _star[0] = _star[1] = _star[2] = NULL; } // secret stars if (_starRedGfx[0]) { _starRedGfx[0]->free(); _starRedGfx[1]->free(); _starGreenGfx[0]->free(); _starGreenGfx[1]->free(); _starBlueGfx[0]->free(); _starBlueGfx[1]->free(); _starRedGfx[0] = _starRedGfx[1] = NULL; _starGreenGfx[0] = _starGreenGfx[1] = NULL; _starBlueGfx[0] = _starBlueGfx[1] = NULL; } if (_versionGfx) _versionGfx->free(); _versionGfx = NULL; if (_warpGfx) _warpGfx->free(); _warpGfx = NULL; } bool Menu::startTitle() { // Defaults the game into Action Mode warning("REMOVE: Putting this here since Menu hasn't been implemented yet"); g_hdb->setActionMode(1); g_hdb->setGameState(GAME_PLAY); int i; readConfig(); _titleScreen = g_hdb->_gfx->loadPic(MONKEYLOGOSCREEN); if (!_titleScreen) return false; _oohOohGfx = g_hdb->_gfx->loadPic(MONKEYLOGO_OOHOOH); _rocketMain = g_hdb->_gfx->loadPic(MENU_ROCKETSHIP1); _rocketSecond = g_hdb->_gfx->loadPic(MENU_ROCKETSHIP2); _rocketEx1 = g_hdb->_gfx->loadPic(MENU_EXHAUST1); _rocketEx2 = g_hdb->_gfx->loadPic(MENU_EXHAUST2); _titleLogo = g_hdb->_gfx->loadPic(TITLELOGO); for (i = 0; i < kNebulaCount; i++) _nebulaGfx[i] = g_hdb->_gfx->loadPic(nebulaNames[i]); _titleCycle = 1; // 1 = Waiting for OOH OOH _titleDelay = g_system->getMillis() + 1000 * TITLE_DELAY1; g_hdb->_sound->stopMusic(); _introSong = SONG_TITLE; _titleSong = SONG_MENU; g_hdb->_sound->startMusic(_introSong); return _titleActive = true; } void Menu::drawTitle() { static int line; static uint32 time; //sound.UpdateMusic(); if (!_titleActive) return; //------------------------------------------------------------------- // draw special gfx //------------------------------------------------------------------- switch (_titleCycle) { case 1: case 3: // draw entire screen _titleScreen->draw(0, 0); break; case 2: // draw entire screen & ooh ooh _titleScreen->draw(0, 0); _oohOohGfx->draw(kOohOhhX, kOohOhhY); break; case 4: // fadeout monkeystone logo _titleScreen->draw(0, 0); break; case 5: // fadein HDB title screen case 6: // wait case 7: // fadeout HDB title screen _hdbLogoScreen->draw(0, 0); break; // draw the rocket & exhaust until it stops case 8: g_hdb->_gfx->draw3DStars(); // draw nebula _nebulaGfx[_nebulaWhich]->draw(_nebulaX, _nebulaY); _nebulaY += _nebulaYVel; if (_nebulaY > kScreenHeight + (kScreenHeight / 2)) { _nebulaWhich = g_hdb->_rnd->getRandomNumber(kNebulaCount); _nebulaX = g_hdb->_rnd->getRandomNumber(kScreenWidth) + 10; _nebulaY = -11 * 8; _nebulaYVel = g_hdb->_rnd->getRandomNumber(4) + 1; if (_nebulaWhich > 4) // galaxy? _nebulaYVel = 1; } // draw rocket _rocketMain->drawMasked(kMRocketX, _rocketY); _rocketSecond->drawMasked(kMRocketX + 40, _rocketY + kMRocketYBottom); // exhaust if (_rocketEx < 5) { _rocketEx1->drawMasked(kMRocketX + kMRocketEXHX, _rocketY + kMRocketYBottom); _rocketEx2->drawMasked(kMRocketX + kMRocketEXHX2, _rocketY + kMRocketYBottom); } else if (_rocketEx >= 5 && _rocketEx < 10) { _rocketEx2->drawMasked(kMRocketX + kMRocketEXHX, _rocketY + kMRocketYBottom); _rocketEx1->drawMasked(kMRocketX + kMRocketEXHX2, _rocketY + kMRocketYBottom); } else { _rocketEx = 0; _rocketEx1->drawMasked(kMRocketX + kMRocketEXHX, _rocketY + kMRocketYBottom); _rocketEx2->drawMasked(kMRocketX + kMRocketEXHX2, _rocketY + kMRocketYBottom); } _rocketEx++; // title logo _titleLogo->drawMasked(centerPic(_titleLogo), _rocketY + kMTitleY); break; } // timer countdown... if (_titleDelay > g_system->getMillis()) return; //------------------------------------------------------------------- // change title state... //------------------------------------------------------------------- switch (_titleCycle) { //------------------------------------------------------------------- // MONKEYSTONE LOGO //------------------------------------------------------------------- // time to OOH OOH case 1: _titleDelay = (uint32)(g_system->getMillis() + 1000 * TITLE_DELAY2); g_hdb->_sound->playSound(SND_MONKEY_OOHOOH); _titleCycle++; break; // delay after OOH OOH case 2: _titleDelay = g_system->getMillis() + 1000 * TITLE_DELAY3; _titleCycle++; break; // done with delay; set up the fadeout... case 3: time = g_hdb->getTimeSliceDelta(); g_hdb->_gfx->setFade(false, false, kScreenFade / time); // FADEOUT _titleCycle++; g_hdb->_sound->stopMusic(); break; // wait for fadeout, then start music case 4: if (g_hdb->_gfx->isFadeActive()) break; g_hdb->_gfx->setFade(true, false, kScreenFade / time); // FADEIN g_hdb->_sound->startMusic(_titleSong); _titleCycle++; break; //------------------------------------------------------------------- // HDB TITLE SCREEN //------------------------------------------------------------------- // wait for fadein to stop case 5: if (g_hdb->_gfx->isFadeActive()) break; _titleDelay = g_system->getMillis() + 5000; _titleCycle++; break; // set fadeout to stars case 6: g_hdb->_gfx->setFade(false, false, kScreenFade / time); // FADEOUT _titleCycle++; break; // get rocket ready case 7: if (g_hdb->_gfx->isFadeActive()) break; g_hdb->_gfx->turnOffFade(); g_hdb->_gfx->fillScreen(0); { _titleCycle++; _rocketY = kScreenHeight; // ycoord _rocketYVel = -1; // yspeed _rocketEx = 0; // exhaust toggle g_hdb->_gfx->setup3DStars(); // setup the star info _nebulaWhich = g_hdb->_rnd->getRandomNumber(kNebulaCount); _nebulaX = g_hdb->_rnd->getRandomNumber(kScreenWidth) + 10; _nebulaY = -11 * 8; _nebulaYVel = g_hdb->_rnd->getRandomNumber(10) + 2; if (_nebulaWhich > 4) // galaxy? _nebulaYVel = 1; } break; // move rocket up the screen! case 8: _titleDelay = 1; _rocketY += _rocketYVel; if (_rocketY < kMRocketY) { _rocketY = kMRocketY; _titleCycle = 12; _titleDelay = 1; } break; // shut down title....start up menu! case 12: _titleActive = false; g_hdb->changeGameState(); break; } } void Menu::fillSavegameSlots() { int i; int max = kNumSaveSlots; Common::InSaveFile *in; Common::String saveGameFile; for (i = 0; i < max; i++) { saveGameFile = Common::String::format("%s.%03d", g_hdb->getTargetName()->c_str(), i); in = g_system->getSavefileManager()->openForLoading(saveGameFile); if (!in) { memset(&_saveGames[i], 0, sizeof(Save)); } else { strcpy(_saveGames[i].saveID, saveGameFile.c_str()); _saveGames[i].seconds = in->readUint32LE(); in->read(_saveGames[i].mapName, 32); delete in; } _saveGames[i].fileSlot = i + 1; } } void Menu::processInput(int x, int y) { warning("STUB: Menu: processInput"); } void Menu::controlsInput(int x, int y) { warning("STUB: Menu: controlsInput"); } void Menu::controlsDraw() { warning("STUB: Menu: controlsDraw"); } void Menu::drawNebula() { warning("STUB: Menu: drawNebula"); } void Menu::drawRocketAndSelections() { warning("STUB: Menu: drawRocketAndSelections"); } void Menu::drawSlider(int x, int y, int offset) { warning("STUB: Menu: drawSlider"); } void Menu::drawToggle(int x, int y, bool flag) { warning("STUB: Menu: drawToggle"); } void Menu::drawWarpScreen() { warning("STUB: Menu: drawWarpScreen"); } } // End of Namespace