Initial commit

This commit is contained in:
2026-02-02 04:50:13 +01:00
commit 5b11698731
22592 changed files with 7677434 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#include "got/views/dialogs/ask.h"
#include "got/vars.h"
namespace Got {
namespace Views {
namespace Dialogs {
Ask::Ask() : SelectOption("Ask") {
}
void Ask::show(const Common::String &title, const Common::StringArray &options) {
Ask *view = (Ask *)g_events->findView("Ask");
view->setContent(title, options);
view->addView();
}
void Ask::closed() {
_G(scripts).setAskResponse(0);
}
void Ask::selected() {
_G(scripts).setAskResponse(_selectedItem + 1);
}
} // namespace Dialogs
} // namespace Views
} // namespace Got

View File

@@ -0,0 +1,45 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef GOT_VIEWS_DIALOGS_ASK_H
#define GOT_VIEWS_DIALOGS_ASK_H
#include "got/views/dialogs/select_option.h"
namespace Got {
namespace Views {
namespace Dialogs {
class Ask : public SelectOption {
public:
Ask();
virtual ~Ask() {}
static void show(const Common::String &title, const Common::StringArray &options);
void closed() override;
void selected() override;
};
} // namespace Dialogs
} // namespace Views
} // namespace Got
#endif

View File

@@ -0,0 +1,62 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#include "got/views/dialogs/dialog.h"
#include "got/vars.h"
namespace Got {
namespace Views {
namespace Dialogs {
Dialog::Dialog(const Common::String &name) : View(name) {
_bounds.setBorderSize(16);
}
void Dialog::draw() {
// Clear the inner content first
GfxSurface s = getSurface(true);
s.clear(215);
s = getSurface();
assert((s.w % 16) == 0 && (s.h % 16) == 0);
// Draw four corners
s.simpleBlitFrom(_G(bgPics[192]), Common::Point(0, 0));
s.simpleBlitFrom(_G(bgPics[193]), Common::Point(_bounds.width() - 16, 0));
s.simpleBlitFrom(_G(bgPics[194]), Common::Point(0, _bounds.height() - 16));
s.simpleBlitFrom(_G(bgPics[195]), Common::Point(_bounds.width() - 16, _bounds.height() - 16));
// Draw top/bottom horizontal lines
for (int x = 16; x < _bounds.width() - 16; x += 16) {
s.simpleBlitFrom(_G(bgPics[196]), Common::Point(x, 0));
s.simpleBlitFrom(_G(bgPics[197]), Common::Point(x, _bounds.height() - 16));
}
// Draw left/right vertical lines
for (int y = 16; y < _bounds.height() - 16; y += 16) {
s.simpleBlitFrom(_G(bgPics[198]), Common::Point(0, y));
s.simpleBlitFrom(_G(bgPics[199]), Common::Point(_bounds.width() - 16, y));
}
}
} // namespace Dialogs
} // namespace Views
} // namespace Got

View File

@@ -0,0 +1,43 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef GOT_VIEWS_DIALOGS_DIALOG_H
#define GOT_VIEWS_DIALOGS_DIALOG_H
#include "got/views/view.h"
namespace Got {
namespace Views {
namespace Dialogs {
class Dialog : public View {
public:
Dialog(const Common::String &name);
virtual ~Dialog() {}
void draw() override;
};
} // namespace Dialogs
} // namespace Views
} // namespace Got
#endif

View File

@@ -0,0 +1,145 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#include "got/views/dialogs/high_scores.h"
#include "got/vars.h"
namespace Got {
namespace Views {
namespace Dialogs {
#define TIMEOUT 500
HighScores::HighScores() : Dialog("HighScores") {
setBounds(Common::Rect(0, 0 + 24, 320, 192 + 24));
}
void HighScores::draw() {
// Draw background outside dialog
GfxSurface s = GfxSurface(*g_events->getScreen(), Common::Rect(0, 0, 320, 240));
for (int col = 0, xp = 0; col < 10; ++col, xp += 32) {
for (int yp = 0; yp < 240; yp += 32)
s.simpleBlitFrom(_G(gfx[26]), Common::Point(xp, yp));
}
// Draw the dialog frame
Dialog::draw();
// Clear the inner content first
s = getSurface(true);
s.clear(215);
// Draw title
Common::String title = "High Scores - Part I";
for (int area = 2; area <= _currentArea; ++area)
title += 'I';
const int titleStart = (s.w - title.size() * 8) / 2;
s.print(Common::Point(titleStart, 4), title, 54);
#ifdef USE_TTS
sayText(title);
#endif
for (int i = 0; i < 7; ++i) {
const HighScore &hs = _G(highScores)._scores[_currentArea - 1][i];
// Draw frames for name and score
s.frameRect(Common::Rect(10, 20 + i * 18, 210, 20 + i * 18 + 16), 206);
s.frameRect(Common::Rect(220, 20 + i * 18, 280, 20 + i * 18 + 16), 206);
// Write out the name and scores
s.print(Common::Point(15, 24 + i * 18), hs._name, 14);
Common::String score = Common::String::format("%d", hs._total);
s.print(Common::Point(275 - (score.size() * 8), 24 + i * 18), score, 14);
#ifdef USE_TTS
sayText(Common::String::format("%s: %d", hs._name, hs._total), Common::TextToSpeechManager::QUEUE);
_previousSaid.clear();
#endif
}
}
bool HighScores::msgFocus(const FocusMessage &msg) {
_currentArea = 1;
_showAll = true;
_timeoutCtr = TIMEOUT;
Gfx::loadPalette();
return true;
}
bool HighScores::msgGame(const GameMessage &msg) {
if (msg._name == "HIGH_SCORES") {
// Finished one of the parts of the game, so just
// set the view to show only scores for that area
replaceView("HighScores", true);
_currentArea = msg._value;
_showAll = false;
draw();
fadeIn();
return true;
}
return false;
}
bool HighScores::msgAction(const ActionMessage &msg) {
if (msg._action == KEYBIND_ESCAPE) {
goToMainMenu();
} else {
goToNextArea();
}
return true;
}
void HighScores::goToMainMenu() {
fadeOut();
send("TitleBackground", GameMessage("MAIN_MENU"));
}
void HighScores::goToNextArea() {
if (_showAll && _currentArea < 3) {
fadeOut();
++_currentArea;
draw();
fadeIn();
_timeoutCtr = TIMEOUT;
} else {
// Done all the areas, so
goToMainMenu();
}
}
bool HighScores::tick() {
Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager();
if (--_timeoutCtr < 0 && (!ttsMan || !ttsMan->isSpeaking()))
goToNextArea();
return true;
}
} // namespace Dialogs
} // namespace Views
} // namespace Got

View File

@@ -0,0 +1,56 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef GOT_VIEWS_DIALOGS_HIGH_SCORES_H
#define GOT_VIEWS_DIALOGS_HIGH_SCORES_H
#include "got/views/dialogs/dialog.h"
namespace Got {
namespace Views {
namespace Dialogs {
class HighScores : public Dialog {
private:
int _currentArea = 0;
bool _showAll = false;
int _timeoutCtr = 0;
void goToMainMenu();
void goToNextArea();
public:
HighScores();
virtual ~HighScores() {
}
void draw() override;
bool msgFocus(const FocusMessage &msg) override;
bool msgAction(const ActionMessage &msg) override;
bool msgGame(const GameMessage &msg) override;
bool tick() override;
};
} // namespace Dialogs
} // namespace Views
} // namespace Got
#endif

View File

@@ -0,0 +1,99 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#include "got/views/dialogs/main_menu.h"
#include "got/game/init.h"
#include "got/vars.h"
namespace Got {
namespace Views {
namespace Dialogs {
static const char *OPTIONS[] = {"Play Game", "Load Game", "High Scores", "Credits", "Demo", "Quit", nullptr};
static const char *OPTIONS_NO_DEMO[] = {"Play Game", "Load Game", "High Scores", "Credits", "Quit", nullptr};
MainMenu::MainMenu() : SelectOption("MainMenu", "God of Thunder Menu",
gDebugLevel > 0 ? OPTIONS : OPTIONS_NO_DEMO) {
}
bool MainMenu::msgFocus(const FocusMessage &msg) {
g_vars->resetEndGameFlags();
musicPlay("MENU", false);
return SelectOption::msgFocus(msg);
}
void MainMenu::closed() {
_selectedItem = 4; // Quit game
selected();
}
void MainMenu::selected() {
switch (_selectedItem) {
case 0:
_G(demo) = false;
if (g_events->isDemo()) {
// The shareware release only has part 1
g_vars->setArea(1);
initGame();
replaceView("Story", true, true);
} else {
// Full game. Select the game part
addView("SelectGame");
}
break;
case 1:
if (!g_engine->loadGameDialog())
addView("SelectGame");
break;
case 2:
replaceView("HighScores", true, true);
break;
case 3:
addView("Credits");
break;
case 4:
if (gDebugLevel > 0) {
_G(demo) = true;
initGame();
replaceView("PartTitle", true, true);
} else {
addView("Quit");
}
break;
case 5:
addView("Quit");
break;
default:
break;
}
}
} // namespace Dialogs
} // namespace Views
} // namespace Got

View File

@@ -0,0 +1,45 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef GOT_VIEWS_DIALOGS_MAIN_MENU_H
#define GOT_VIEWS_DIALOGS_MAIN_MENU_H
#include "got/views/dialogs/select_option.h"
namespace Got {
namespace Views {
namespace Dialogs {
class MainMenu : public SelectOption {
public:
MainMenu();
virtual ~MainMenu() {}
bool msgFocus(const FocusMessage &msg) override;
void closed() override;
void selected() override;
};
} // namespace Dialogs
} // namespace Views
} // namespace Got
#endif

View File

@@ -0,0 +1,69 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#include "got/views/dialogs/options_menu.h"
#include "got/game/back.h"
#include "got/vars.h"
namespace Got {
namespace Views {
namespace Dialogs {
static const char *OPTIONS[] = {"Sound/Music", "Skill Level", "Save Game", "Load Game", "Die", "Turbo Mode", "Help", "Quit", nullptr};
OptionsMenu::OptionsMenu() : SelectOption("OptionsMenu", "Options Menu", OPTIONS) {
}
void OptionsMenu::selected() {
switch (_selectedItem) {
case 0:
addView("SetSound");
break;
case 1:
addView("SkillLevel");
break;
case 2:
g_engine->saveGameDialog();
break;
case 3:
g_engine->loadGameDialog();
break;
case 4:
g_events->send(GameMessage("THOR_DIES"));
break;
case 5:
addView("SelectSlow");
break;
case 6:
// Help
odinSpeaks(2008, -1);
break;
case 7:
addView("QuitGame");
break;
default:
break;
}
}
} // namespace Dialogs
} // namespace Views
} // namespace Got

View File

@@ -0,0 +1,43 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef GOT_VIEWS_DIALOGS_OPTIONS_MENU_H
#define GOT_VIEWS_DIALOGS_OPTIONS_MENU_H
#include "got/views/dialogs/select_option.h"
namespace Got {
namespace Views {
namespace Dialogs {
class OptionsMenu : public SelectOption {
public:
OptionsMenu();
virtual ~OptionsMenu() {}
void selected() override;
};
} // namespace Dialogs
} // namespace Views
} // namespace Got
#endif

View File

@@ -0,0 +1,51 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#include "got/views/dialogs/quit.h"
#include "got/got.h"
namespace Got {
namespace Views {
namespace Dialogs {
Quit::Quit() : SelectOption("Quit", "Quit Game?", YES_NO) {
}
void Quit::selected() {
switch (_selectedItem) {
case 0:
g_engine->quitGame();
break;
case 1:
addView("MainMenu");
break;
default:
break;
}
}
void Quit::closed() {
addView("MainMenu");
}
} // namespace Dialogs
} // namespace Views
} // namespace Got

View File

@@ -0,0 +1,44 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef GOT_VIEWS_DIALOGS_QUIT_H
#define GOT_VIEWS_DIALOGS_QUIT_H
#include "got/views/dialogs/select_option.h"
namespace Got {
namespace Views {
namespace Dialogs {
class Quit : public SelectOption {
public:
Quit();
virtual ~Quit() {}
void selected() override;
void closed() override;
};
} // namespace Dialogs
} // namespace Views
} // namespace Got
#endif

View File

@@ -0,0 +1,53 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#include "got/views/dialogs/quit_game.h"
#include "got/got.h"
namespace Got {
namespace Views {
namespace Dialogs {
static const char *OPTIONS[] = { "Continue Game", "Quit to Opening Screen", "Quit to DOS", nullptr };
QuitGame::QuitGame() : SelectOption("QuitGame", "Quit Game?", OPTIONS) {
}
void QuitGame::selected() {
switch (_selectedItem) {
case 0:
break;
case 1:
// Prompt for saving game before returning to title
send("SaveGame", GameMessage("TITLE"));
break;
case 2:
// Prompt for saving game before quitting
send("SaveGame", GameMessage("QUIT"));
break;
default:
break;
}
}
} // namespace Dialogs
} // namespace Views
} // namespace Got

View File

@@ -0,0 +1,43 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef GOT_VIEWS_DIALOGS_QUIT_GAME_H
#define GOT_VIEWS_DIALOGS_QUIT_GAME_H
#include "got/views/dialogs/select_option.h"
namespace Got {
namespace Views {
namespace Dialogs {
class QuitGame : public SelectOption {
public:
QuitGame();
virtual ~QuitGame() {}
void selected() override;
};
} // namespace Dialogs
} // namespace Views
} // namespace Got
#endif

View File

@@ -0,0 +1,56 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#include "got/views/dialogs/save_game.h"
#include "got/got.h"
namespace Got {
namespace Views {
namespace Dialogs {
SaveGame::SaveGame() : SelectOption("SaveGame", "Save Game?", YES_NO) {
}
bool SaveGame::msgGame(const GameMessage &msg) {
if (msg._name == "TITLE" || msg._name == "QUIT") {
_isQuit = msg._name == "QUIT";
open();
return true;
}
return false;
}
void SaveGame::selected() {
if (_selectedItem == 0)
g_engine->saveGameDialog();
if (_isQuit) {
g_engine->quitGame();
} else {
fadeOut();
send("TitleBackground", GameMessage("MAIN_MENU"));
}
}
} // namespace Dialogs
} // namespace Views
} // namespace Got

View File

@@ -0,0 +1,48 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef GOT_VIEWS_DIALOGS_SAVE_GAME_H
#define GOT_VIEWS_DIALOGS_SAVE_GAME_H
#include "got/views/dialogs/select_option.h"
namespace Got {
namespace Views {
namespace Dialogs {
class SaveGame : public SelectOption {
private:
bool _isQuit = false;
public:
SaveGame();
virtual ~SaveGame() {
}
bool msgGame(const GameMessage &msg) override;
void selected() override;
};
} // namespace Dialogs
} // namespace Views
} // namespace Got
#endif

View File

@@ -0,0 +1,207 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#include "got/views/dialogs/say.h"
#include "got/vars.h"
namespace Got {
namespace Views {
namespace Dialogs {
Say::Say() : Dialog("Say") {
setBounds(Common::Rect(32, 48, 288, 160));
}
void Say::show(int item, const Gfx::Pics &speakerIcon, int type) {
Say *view = (Say *)g_events->findView("Say");
view->_item = item;
view->_speakerIcon = speakerIcon;
view->_type = type;
view->addView();
}
bool Say::msgFocus(const FocusMessage &msg) {
if (!_type)
playSound(WOOP, true);
_content = (const char *)_G(tmpBuff);
_contentLength = 0;
_waitForResponse = WAIT_NONE;
_woopCtr = 0;
_picIndex = 0;
return true;
}
bool Say::msgUnfocus(const UnfocusMessage &msg) {
// Since the Ask dialog is shown by scripts, closing the view
// starts the calling script running again
_G(scripts).resume();
return true;
}
void Say::draw() {
Dialog::draw();
GfxSurface s = getSurface();
if (_item)
s.simpleBlitFrom(_G(objects)[_item], Common::Point(160, 17));
const char *p = _content;
const char *endP = _content + _contentLength;
int color = 14;
int x = 20, lc = 0;
#ifdef USE_TTS
// Voice all text immediately, so that TTS syncs better with the text appearing on screen
Common::String ttsMessage = _content;
int ttsMessageLc = 0;
for (uint i = 0; i < ttsMessage.size(); ++i) {
if (ttsMessage[i] == '\n') {
ttsMessageLc++;
if (ttsMessageLc > 4) {
ttsMessage.erase(i);
ttsMessage += "\n\nMore...";
break;
}
}
}
sayText(ttsMessage);
#endif
while (p < endP) {
if (*p == '~' && Common::isXDigit(*(p + 1))) {
p++;
int ch = *p;
p++;
if (Common::isDigit(ch))
ch -= '0';
else
ch = toupper(ch) - 'A' + 10;
color = Gfx::DIALOG_COLOR[ch];
continue;
}
if (*p == '\n') {
x = 20;
lc++;
if (lc > 4) {
// Got a full text to display
if (_waitForResponse == WAIT_NONE)
_waitForResponse = WAIT_MORE;
_picIndex = 1;
break;
}
p++;
continue;
}
s.printChar(*p, x, 35 + (lc * 10), color);
p++;
x += 8;
}
s.simpleBlitFrom(_speakerIcon[_picIndex], Common::Point(120, 17));
if (_waitForResponse == WAIT_MORE)
s.print(Common::Point(184, 86), "More...", 15);
}
bool Say::msgKeypress(const KeypressMessage &msg) {
if (_waitForResponse == WAIT_DONE) {
close();
} else if (_waitForResponse == WAIT_MORE) {
_waitForResponse = WAIT_NONE;
_content = _content + _contentLength;
_contentLength = 0;
redraw();
} else {
showEntirePage();
redraw();
}
return false;
}
bool Say::msgAction(const ActionMessage &msg) {
if (msg._action == KEYBIND_ESCAPE || _waitForResponse == WAIT_DONE) {
close();
} else if (_waitForResponse == WAIT_MORE) {
_waitForResponse = WAIT_NONE;
_content = _content + _contentLength;
_contentLength = 0;
redraw();
} else {
showEntirePage();
redraw();
}
return true;
}
bool Say::tick() {
if (_waitForResponse == WAIT_NONE && ++_contentCtr > 1) {
_contentCtr = 0;
const char *contentEnd = _content + ++_contentLength;
if (*(contentEnd - 1) == '~' && Common::isXDigit(*contentEnd))
++_contentLength;
if (!*contentEnd) {
// Reached end of text to display
_waitForResponse = WAIT_DONE;
_picIndex = 1;
} else if (++_picIndex > 3) {
_picIndex = 0;
}
if (_type) {
playSound(WOOP, true);
_woopCtr = 0;
}
redraw();
}
return true;
}
void Say::showEntirePage() {
int lc = 0;
char c;
for (_contentLength = 0; (c = *(_content + _contentLength)) != 0; ++_contentLength) {
if (c == '~' && Common::isXDigit(*(_content + _contentLength + 1)))
++_contentLength;
else if (c == '\n') {
if (++lc > 4)
break;
}
}
}
} // namespace Dialogs
} // namespace Views
} // namespace Got

View File

@@ -0,0 +1,73 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef GOT_VIEWS_DIALOGS_SAY_H
#define GOT_VIEWS_DIALOGS_SAY_H
#include "got/gfx/gfx_pics.h"
#include "got/views/dialogs/dialog.h"
namespace Got {
namespace Views {
namespace Dialogs {
class Say : public Dialog {
enum WaitResponse {
WAIT_NONE,
WAIT_MORE,
WAIT_DONE
};
private:
Gfx::Pics _speakerIcon;
int _item = 0;
int _type = 0;
int _picIndex = 0;
const char *_content = nullptr;
int _contentLength = 0;
int _woopCtr = 0;
int _contentCtr = 0;
WaitResponse _waitForResponse = WAIT_NONE;
/**
* Advance to showing the entirety of the current page
*/
void showEntirePage();
public:
Say();
virtual ~Say() {}
static void show(int item, const Gfx::Pics &speakerIcon, int type);
void draw() override;
bool msgFocus(const FocusMessage &msg) override;
bool msgUnfocus(const UnfocusMessage &msg) override;
bool msgKeypress(const KeypressMessage &msg) override;
bool msgAction(const ActionMessage &msg) override;
bool tick() override;
};
} // namespace Dialogs
} // namespace Views
} // namespace Got
#endif

View File

@@ -0,0 +1,55 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#include "got/views/dialogs/select_game.h"
#include "got/game/init.h"
#include "got/got.h"
namespace Got {
namespace Views {
namespace Dialogs {
static const char *OPTIONS[] = {
"Part 1: Serpent Surprise!",
"Part 2: Non-stick Nognir",
"Part 3: Lookin' for Loki",
nullptr
};
SelectGame::SelectGame() : SelectOption("SelectGame", "Play Which Game?", OPTIONS) {
}
void SelectGame::selected() {
// Select the game area to start from
g_vars->setArea(_selectedItem + 1);
// Switch to the story view for the selected game area
initGame();
replaceView("Story", true, true);
}
void SelectGame::closed() {
addView("MainMenu");
}
} // namespace Dialogs
} // namespace Views
} // namespace Got

View File

@@ -0,0 +1,45 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef GOT_VIEWS_DIALOGS_SELECT_GAME_H
#define GOT_VIEWS_DIALOGS_SELECT_GAME_H
#include "got/views/dialogs/select_option.h"
namespace Got {
namespace Views {
namespace Dialogs {
class SelectGame : public SelectOption {
public:
SelectGame();
virtual ~SelectGame() {
}
void selected() override;
void closed() override;
};
} // namespace Dialogs
} // namespace Views
} // namespace Got
#endif

View File

@@ -0,0 +1,171 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#include "got/views/dialogs/select_item.h"
#include "got/vars.h"
namespace Got {
namespace Views {
namespace Dialogs {
#define _HRZSP 24
static const char *ITEM_NAMES[] = {
"Enchanted Apple", "Lightning Power", "Winged Boots",
"Wind Power", "Amulet of Protection", "Thunder Power"
};
SelectItem::SelectItem() : Dialog("SelectItem") {
_selectedItem = -1;
setBounds(Common::Rect(56, 48, 264, 160));
}
void SelectItem::draw() {
Dialog::draw();
GfxSurface s = getSurface();
if (_G(thorInfo)._inventory == 0) {
s.print(Common::Point(44, 52), "No Items Found", 14);
#ifdef USE_TTS
sayText("No Items Found");
#endif
return;
}
uint b = 1;
for (int l = 0; l < 7; l++, b = b << 1) {
if (_G(thorInfo)._inventory & b) {
if (l < 6)
s.simpleBlitFrom(_G(objects[l + 26]), Common::Point(82 - 56 + (l * _HRZSP), 72 - 48));
else {
const int objId = _G(thorInfo)._object + 10;
s.simpleBlitFrom(_G(objects[objId]), Common::Point(82 - 56 + (l * _HRZSP), 72 - 48));
}
}
}
const char *objName;
if (_selectedItem < 6)
objName = ITEM_NAMES[_selectedItem];
else
objName = _G(thorInfo)._objectName;
#ifdef USE_TTS
sayText(objName);
#endif
s.print(Common::Point((s.w - (strlen(objName) * 8)) / 2, 66), objName, 12);
s.frameRect(Common::Rect(26 + (_selectedItem * _HRZSP), 22,
43 + (_selectedItem * _HRZSP), 42),
15);
}
bool SelectItem::msgFocus(const FocusMessage &msg) {
if (_G(thorInfo)._inventory == 0) {
_selectedItem = -1;
} else {
_selectedItem = _G(thorInfo)._selectedItem - 1;
if (_selectedItem < 1)
_selectedItem = 0;
uint b = 1 << _selectedItem;
for (;;) {
if (_G(thorInfo)._inventory & b)
break;
if (_selectedItem < 7)
_selectedItem++;
else
_selectedItem = 0;
b = 1 << _selectedItem;
}
}
return true;
}
bool SelectItem::msgAction(const ActionMessage &msg) {
uint b;
if (_G(thorInfo)._inventory == 0) {
close();
return true;
}
switch (msg._action) {
case KEYBIND_ESCAPE:
close();
break;
case KEYBIND_SELECT:
case KEYBIND_FIRE:
case KEYBIND_MAGIC:
selectItem();
break;
case KEYBIND_LEFT:
for (;;) {
if (_selectedItem > 0)
_selectedItem--;
else
_selectedItem = 8;
b = 1 << _selectedItem;
if (_G(thorInfo)._inventory & b)
break;
}
playSound(WOOP, true);
redraw();
break;
case KEYBIND_RIGHT:
while (1) {
if (_selectedItem < 9)
_selectedItem++;
else
_selectedItem = 0;
b = 1 << _selectedItem;
if (_G(thorInfo)._inventory & b)
break;
}
playSound(WOOP, true);
redraw();
break;
default:
break;
}
return true;
}
void SelectItem::selectItem() {
_G(thorInfo)._selectedItem = _selectedItem + 1;
close();
}
} // namespace Dialogs
} // namespace Views
} // namespace Got

View File

@@ -0,0 +1,50 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef GOT_VIEWS_DIALOGS_SELECT_ITEM_H
#define GOT_VIEWS_DIALOGS_SELECT_ITEM_H
#include "got/views/dialogs/dialog.h"
namespace Got {
namespace Views {
namespace Dialogs {
class SelectItem : public Dialog {
private:
int _selectedItem;
void selectItem();
public:
SelectItem();
virtual ~SelectItem() {}
void draw() override;
bool msgFocus(const FocusMessage &msg) override;
bool msgAction(const ActionMessage &msg) override;
};
} // namespace Dialogs
} // namespace Views
} // namespace Got
#endif

View File

@@ -0,0 +1,171 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#include "got/views/dialogs/select_option.h"
#include "got/metaengine.h"
#include "got/vars.h"
namespace Got {
namespace Views {
namespace Dialogs {
const char *ON_OFF[] = { "On", "Off", nullptr };
const char *YES_NO[] = { "Yes", "No", nullptr };
SelectOption::SelectOption(const Common::String &name, const char *title,
const char *options[]) : Dialog(name) {
// Set up string array of options
Common::StringArray optionsArray;
for (const char **option = options; *option; ++option)
optionsArray.push_back(*option);
setContent(title, optionsArray);
}
SelectOption::SelectOption(const Common::String &name) : Dialog(name) {
}
void SelectOption::setContent(const Common::String &title,
const Common::StringArray &options) {
_title = title;
_options = options;
int w = title.size();
for (uint i = 0; i < _options.size(); ++i)
w = MAX(w, (int)_options[i].size());
if (w & 1)
w++;
w = (w * 8) + 32;
const int h = (_options.size() * 16) + 32;
const int x1 = (320 - w) / 2;
const int x2 = (x1 + w);
const int y1 = (192 - h) / 2;
const int y2 = (y1 + h);
_bounds = Common::Rect(x1 - 16, y1 - 16, x2 + 16, y2 + 16);
}
void SelectOption::draw() {
Dialog::draw();
// Write the title
GfxSurface s = getSurface(true);
const int titleStart = (s.w - _title.size() * 8) / 2;
s.print(Common::Point(titleStart, 4), _title, 54);
// Write the options
for (uint i = 0; i < _options.size(); ++i)
s.print(Common::Point(32, 28 + i * 16), _options[i], 14);
#ifdef USE_TTS
if (!_titleVoiced) {
sayText(_title);
sayText(_options[_selectedItem], Common::TextToSpeechManager::QUEUE);
_titleVoiced = true;
} else {
sayText(_options[_selectedItem]);
}
#endif
// Draw selection pointer
if (_smackCtr > 0) {
// Selecting an item
const int xp = 8 + 2 * (_smackCtr < 3 ? (_smackCtr + 1) : (6 - _smackCtr));
s.simpleBlitFrom(_G(hampic[0]), Common::Point(xp, 24 + (_selectedItem * 16)));
} else {
// Normal animated cursor
s.simpleBlitFrom(_G(hampic[_hammerFrame]), Common::Point(8, 24 + (_selectedItem * 16)));
}
}
bool SelectOption::msgFocus(const FocusMessage &msg) {
_selectedItem = 0;
_smackCtr = 0;
#ifdef USE_TTS
_titleVoiced = false;
#endif
return true;
}
bool SelectOption::msgAction(const ActionMessage &msg) {
// Don't allow further actions if selection is in progress
if (_smackCtr != 0)
return true;
switch (msg._action) {
case KEYBIND_UP:
playSound(WOOP, true);
if (--_selectedItem < 0)
_selectedItem = (int)_options.size() - 1;
break;
case KEYBIND_DOWN:
playSound(WOOP, true);
if (++_selectedItem >= (int)_options.size())
_selectedItem = 0;
break;
case KEYBIND_SELECT:
case KEYBIND_FIRE:
case KEYBIND_MAGIC:
_smackCtr = 1;
break;
case KEYBIND_ESCAPE:
_selectedItem = -1;
close();
closed();
break;
default:
break;
}
return true;
}
bool SelectOption::tick() {
if (++_hammerFrame == 4)
_hammerFrame = 0;
// Handle animation when an item is selected
if (_smackCtr != 0) {
++_smackCtr;
if (_smackCtr == 3)
playSound(CLANG, true);
if (_smackCtr == 6) {
_smackCtr = 0;
close();
selected();
}
}
redraw();
return true;
}
} // namespace Dialogs
} // namespace Views
} // namespace Got

View File

@@ -0,0 +1,69 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef GOT_VIEWS_DIALOGS_SELECT_OPTION_H
#define GOT_VIEWS_DIALOGS_SELECT_OPTION_H
#include "got/views/dialogs/dialog.h"
namespace Got {
namespace Views {
namespace Dialogs {
// Commonly used options across multiple dialogs
extern const char *ON_OFF[];
extern const char *YES_NO[];
class SelectOption : public Dialog {
private:
Common::String _title;
Common::StringArray _options;
int _hammerFrame = 0;
int _smackCtr = 0;
#ifdef USE_TTS
bool _titleVoiced = false;
#endif
protected:
int _selectedItem = 0;
void setContent(const Common::String &title,
const Common::StringArray &options);
virtual void closed() {}
virtual void selected() {}
public:
SelectOption(const Common::String &name, const char *title, const char *options[]);
SelectOption(const Common::String &name);
virtual ~SelectOption() {}
bool msgFocus(const FocusMessage &msg) override;
bool msgAction(const ActionMessage &msg) override;
void draw() override;
bool tick() override;
};
} // namespace Dialogs
} // namespace Views
} // namespace Got
#endif

View File

@@ -0,0 +1,44 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#include "got/views/dialogs/select_scroll.h"
#include "got/got.h"
namespace Got {
namespace Views {
namespace Dialogs {
SelectScroll::SelectScroll() : SelectOption("SelectScroll", "Scroll Between Screens?", YES_NO) {
}
bool SelectScroll::msgFocus(const FocusMessage &msg) {
_selectedItem = 1 - (_G(setup)._scrollFlag ? 1 : 0);
return true;
}
void SelectScroll::selected() {
_G(setup)._scrollFlag = (_selectedItem == 0);
_G(lastSetup) = _G(setup);
}
} // namespace Dialogs
} // namespace Views
} // namespace Got

View File

@@ -0,0 +1,44 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef GOT_VIEWS_DIALOGS_SELECT_SCROLL_H
#define GOT_VIEWS_DIALOGS_SELECT_SCROLL_H
#include "got/views/dialogs/select_option.h"
namespace Got {
namespace Views {
namespace Dialogs {
class SelectScroll : public SelectOption {
public:
SelectScroll();
virtual ~SelectScroll() {}
bool msgFocus(const FocusMessage &msg) override;
void selected() override;
};
} // namespace Dialogs
} // namespace Views
} // namespace Got
#endif

View File

@@ -0,0 +1,52 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#include "got/views/dialogs/select_slow.h"
#include "got/got.h"
namespace Got {
namespace Views {
namespace Dialogs {
static const char *OPTIONS[] = { "On (slow computer)", "Off (fast computer)", nullptr };
SelectSlow::SelectSlow() : SelectOption("SelectSlow", "Fast Mode", OPTIONS) {
}
void SelectSlow::selected() {
switch (_selectedItem) {
case 0:
_G(slowMode) = true;
break;
case 1:
_G(slowMode) = false;
break;
default:
break;
}
// Next select scrolling
addView("SelectScroll");
}
} // namespace Dialogs
} // namespace Views
} // namespace Got

View File

@@ -0,0 +1,43 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef GOT_VIEWS_DIALOGS_SELECT_SLOW_H
#define GOT_VIEWS_DIALOGS_SELECT_SLOW_H
#include "got/views/dialogs/select_option.h"
namespace Got {
namespace Views {
namespace Dialogs {
class SelectSlow : public SelectOption {
public:
SelectSlow();
virtual ~SelectSlow() {}
void selected() override;
};
} // namespace Dialogs
} // namespace Views
} // namespace Got
#endif

View File

@@ -0,0 +1,46 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#include "got/views/dialogs/set_music.h"
#include "common/config-manager.h"
#include "got/got.h"
namespace Got {
namespace Views {
namespace Dialogs {
SetMusic::SetMusic() : SelectOption("SetMusic", "Set Music", ON_OFF) {
}
bool SetMusic::msgFocus(const FocusMessage &msg) {
_selectedItem = ConfMan.getBool("music_mute") ? 1 : 0;
return true;
}
void SetMusic::selected() {
ConfMan.setBool("music_mute", _selectedItem == 1);
ConfMan.flushToDisk();
g_engine->syncSoundSettings();
}
} // namespace Dialogs
} // namespace Views
} // namespace Got

View File

@@ -0,0 +1,44 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef GOT_VIEWS_DIALOGS_SET_MUSIC_H
#define GOT_VIEWS_DIALOGS_SET_MUSIC_H
#include "got/views/dialogs/select_option.h"
namespace Got {
namespace Views {
namespace Dialogs {
class SetMusic : public SelectOption {
public:
SetMusic();
virtual ~SetMusic() {}
bool msgFocus(const FocusMessage &msg) override;
void selected() override;
};
} // namespace Dialogs
} // namespace Views
} // namespace Got
#endif

View File

@@ -0,0 +1,47 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#include "got/views/dialogs/set_sound.h"
#include "common/config-manager.h"
#include "got/got.h"
namespace Got {
namespace Views {
namespace Dialogs {
SetSound::SetSound() : SelectOption("SetSound", "Set Sound", ON_OFF) {
}
bool SetSound::msgFocus(const FocusMessage &msg) {
_selectedItem = ConfMan.getBool("sfx_mute") ? 1 : 0;
return true;
}
void SetSound::selected() {
ConfMan.setBool("sfx_mute", _selectedItem == 1);
ConfMan.flushToDisk();
g_engine->syncSoundSettings();
addView("SetMusic");
}
} // namespace Dialogs
} // namespace Views
} // namespace Got

View File

@@ -0,0 +1,44 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef GOT_VIEWS_DIALOGS_SET_SOUND_H
#define GOT_VIEWS_DIALOGS_SET_SOUND_H
#include "got/views/dialogs/select_option.h"
namespace Got {
namespace Views {
namespace Dialogs {
class SetSound : public SelectOption {
public:
SetSound();
virtual ~SetSound() {}
bool msgFocus(const FocusMessage &msg) override;
void selected() override;
};
} // namespace Dialogs
} // namespace Views
} // namespace Got
#endif

View File

@@ -0,0 +1,48 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#include "got/views/dialogs/skill_level.h"
#include "got/got.h"
namespace Got {
namespace Views {
namespace Dialogs {
static const char *OPTIONS[] = {
"Easy Enemies", "Normal Enemies", "Tough Enemies", nullptr
};
SkillLevel::SkillLevel() : SelectOption("SkillLevel", "Set Skill Level", OPTIONS) {
}
bool SkillLevel::msgFocus(const FocusMessage &msg) {
_selectedItem = _G(setup)._difficultyLevel;
return true;
}
void SkillLevel::selected() {
_G(setup)._difficultyLevel = _selectedItem;
_G(lastSetup) = _G(setup);
}
} // namespace Dialogs
} // namespace Views
} // namespace Got

View File

@@ -0,0 +1,45 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef GOT_VIEWS_DIALOGS_SKILL_LEVEL_H
#define GOT_VIEWS_DIALOGS_SKILL_LEVEL_H
#include "got/views/dialogs/select_option.h"
namespace Got {
namespace Views {
namespace Dialogs {
class SkillLevel : public SelectOption {
public:
SkillLevel();
virtual ~SkillLevel() {
}
bool msgFocus(const FocusMessage &msg) override;
void selected() override;
};
} // namespace Dialogs
} // namespace Views
} // namespace Got
#endif