Game::menu_t Game::LoadGame(void) { Mixer::Pause(); AGG::PlayMusic(MUS::MAINMENU); if(Settings::Get().QVGA()) return PocketPC::LoadGame(); // preload AGG::PreloadObject(ICN::HEROES); AGG::PreloadObject(ICN::BTNNEWGM); AGG::PreloadObject(ICN::REDBACK); // cursor Cursor & cursor = Cursor::Get(); cursor.Hide(); cursor.SetThemes(cursor.POINTER); Display & display = Display::Get(); // image background const Sprite &back = AGG::GetICN(ICN::HEROES, 0); const Point top((display.w() - back.w()) / 2, (display.h() - back.h()) / 2); display.Blit(back, top); const Sprite &panel = AGG::GetICN(ICN::REDBACK, 0); display.Blit(panel, top.x + 405, top.y + 5); LocalEvent & le = LocalEvent::Get(); Button buttonStandartGame(top.x + 455, top.y + 45, ICN::BTNNEWGM, 0, 1); Button buttonCampainGame(top.x + 455, top.y + 110, ICN::BTNNEWGM, 2, 3); Button buttonMultiGame(top.x + 455, top.y + 175, ICN::BTNNEWGM, 4, 5); Button buttonCancelGame(top.x + 455, top.y + 375, ICN::BTNNEWGM, 6, 7); buttonStandartGame.Draw(); buttonCampainGame.Draw(); buttonMultiGame.Draw(); buttonCancelGame.Draw(); cursor.Show(); display.Flip(); // loadgame loop while(le.HandleEvents()) { le.MousePressLeft(buttonStandartGame) ? buttonStandartGame.PressDraw() : buttonStandartGame.ReleaseDraw(); le.MousePressLeft(buttonCampainGame) ? buttonCampainGame.PressDraw() : buttonCampainGame.ReleaseDraw(); le.MousePressLeft(buttonMultiGame) ? buttonMultiGame.PressDraw() : buttonMultiGame.ReleaseDraw(); le.MousePressLeft(buttonCancelGame) ? buttonCancelGame.PressDraw() : buttonCancelGame.ReleaseDraw(); if(le.KeyPress(KEY_s) || le.MouseClickLeft(buttonStandartGame)) return LOADSTANDARD; if(le.KeyPress(KEY_c) || le.MouseClickLeft(buttonCampainGame)) return LOADCAMPAIN; if(le.KeyPress(KEY_m) || le.MouseClickLeft(buttonMultiGame)) return LOADMULTI; if(le.MouseClickLeft(buttonCancelGame) || le.KeyPress(KEY_ESCAPE)) return MAINMENU; } return QUITGAME; }
Game::menu_t Game::NewGame(void) { Mixer::Pause(); AGG::PlayMusic(MUS::MAINMENU); Settings & conf = Settings::Get(); Game::IO::last_name.clear(); if(Settings::Get().QVGA()) return PocketPC::NewGame(); // preload AGG::PreloadObject(ICN::HEROES); AGG::PreloadObject(ICN::BTNNEWGM); AGG::PreloadObject(ICN::REDBACK); // cursor Cursor & cursor = Cursor::Get(); cursor.Hide(); cursor.SetThemes(cursor.POINTER); Display & display = Display::Get(); display.Fill(0); // load game settings conf.BinaryLoad(); // image background const Sprite &back = AGG::GetICN(ICN::HEROES, 0); const Point top((display.w() - back.w()) / 2, (display.h() - back.h()) / 2); back.Blit(top); const Sprite &panel = AGG::GetICN(ICN::REDBACK, 0); panel.Blit(top.x + 405, top.y + 5); LocalEvent & le = LocalEvent::Get(); Button buttonStandartGame(top.x + 455, top.y + 45, ICN::BTNNEWGM, 0, 1); Button buttonMultiGame(top.x + 455, top.y + 110, ICN::BTNNEWGM, 4, 5); Button buttonSettings(top.x + 455, top.y + 240, ICN::BTNDCCFG, 4, 5); Button buttonCancelGame(top.x + 455, top.y + 375, ICN::BTNNEWGM, 6, 7); Button buttonBattleGame(top.x + 455, top.y + 175, ICN::BTNBATTLEONLY, 0, 1); //Button buttonCampainGame(top.x + 455, top.y + 110, ICN::BTNNEWGM, 2, 3); //Button buttonMultiGame(top.x + 455, top.y + 175, ICN::BTNNEWGM, 4, 5); //Button buttonSettings(top.x + 455, top.y + 240, ICN::BTNDCCFG, 4, 5); //Button buttonCancelGame(top.x + 455, top.y + 375, ICN::BTNNEWGM, 6, 7); buttonStandartGame.Draw(); //buttonCampainGame.Draw(); buttonMultiGame.Draw(); buttonCancelGame.Draw(); buttonSettings.Draw(); #ifdef BUILD_BATTLEONLY buttonBattleGame.Draw(); #else buttonBattleGame.SetDisable(true); #endif cursor.Show(); display.Flip(); // newgame loop while(le.HandleEvents()) { le.MousePressLeft(buttonStandartGame) ? buttonStandartGame.PressDraw() : buttonStandartGame.ReleaseDraw(); //le.MousePressLeft(buttonCampainGame) ? buttonCampainGame.PressDraw() : buttonCampainGame.ReleaseDraw(); le.MousePressLeft(buttonMultiGame) ? buttonMultiGame.PressDraw() : buttonMultiGame.ReleaseDraw(); le.MousePressLeft(buttonCancelGame) ? buttonCancelGame.PressDraw() : buttonCancelGame.ReleaseDraw(); le.MousePressLeft(buttonSettings) ? buttonSettings.PressDraw() : buttonSettings.ReleaseDraw(); buttonBattleGame.isEnable() && le.MousePressLeft(buttonBattleGame) ? buttonBattleGame.PressDraw() : buttonBattleGame.ReleaseDraw(); if(HotKeyPress(EVENT_BUTTON_STANDARD) || le.MouseClickLeft(buttonStandartGame)) return NEWSTANDARD; //if(HotKeyPress(EVENT_BUTTON_CAMPAIN) || le.MouseClickLeft(buttonCampainGame)) return NEWCAMPAIN; if(HotKeyPress(EVENT_BUTTON_MULTI) || le.MouseClickLeft(buttonMultiGame)) return NEWMULTI; if(HotKeyPress(EVENT_BUTTON_SETTINGS) || le.MouseClickLeft(buttonSettings)){ Dialog::ExtSettings(false); cursor.Show(); display.Flip(); } if(HotKeyPress(EVENT_DEFAULT_EXIT) || le.MouseClickLeft(buttonCancelGame)) return MAINMENU; if(buttonBattleGame.isEnable()) if(HotKeyPress(EVENT_BUTTON_BATTLEONLY) || le.MouseClickLeft(buttonBattleGame)) return NEWBATTLEONLY; // right info if(le.MousePressRight(buttonStandartGame)) Dialog::Message(_("Standard Game"), _("A single player game playing out a single map."), Font::BIG); //if(le.MousePressRight(buttonCampainGame)) Dialog::Message(_("Campaign Game"), _("A single player game playing through a series of maps."), Font::BIG); if(le.MousePressRight(buttonMultiGame)) Dialog::Message(_("Multi-Player Game"), _("A multi-player game, with several human players completing against each other on a single map."), Font::BIG); if(le.MousePressRight(buttonSettings)) Dialog::Message(_("Settings"), _("FHeroes2 game settings."), Font::BIG); if(le.MousePressRight(buttonCancelGame)) Dialog::Message(_("Cancel"), _("Cancel back to the main menu."), Font::BIG); } return QUITGAME; }