Initial commit
This commit is contained in:
158
engines/got/views/credits.cpp
Normal file
158
engines/got/views/credits.cpp
Normal file
@@ -0,0 +1,158 @@
|
||||
/* 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/credits.h"
|
||||
#include "got/vars.h"
|
||||
|
||||
namespace Got {
|
||||
namespace Views {
|
||||
|
||||
#ifdef USE_TTS
|
||||
|
||||
static const char *creditsText[] = {
|
||||
"Programming: Ron Davis",
|
||||
"Graphics: Gary Sirois",
|
||||
"Level Design: Adam Pedersen",
|
||||
"Additional Programming: Jason Blochowiak",
|
||||
"Music: Roy Davis",
|
||||
"Title Screen Art: Wayne C. Timmerman",
|
||||
"Additional Level Design: Ron Davis, Doug Howell, Ken Heckbert, Evan Heckbert",
|
||||
"Play Testing: Ken Heckbert, Doug Howell, Tom King",
|
||||
"Play Testing: Kelly Rogers, Michael Smith, Rik Pierce"
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#define CREDITS_COUNT 9
|
||||
#define FADE_FRAMES 15
|
||||
#define DISPLAY_TIME 15
|
||||
#define CREDIT_TIME (FADE_FRAMES * 2 + DISPLAY_TIME)
|
||||
|
||||
bool Credits::msgFocus(const FocusMessage &msg) {
|
||||
_delayCtr = 0;
|
||||
_frameCtr = 0;
|
||||
|
||||
draw();
|
||||
const Gfx::Palette63 pal = _G(gfx[41]);
|
||||
fadeIn(pal);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Credits::draw() {
|
||||
GfxSurface s = getSurface();
|
||||
|
||||
// Draw scroll background
|
||||
const Graphics::ManagedSurface &bg = _G(gfx[42]);
|
||||
s.clear(*(const byte *)bg.getPixels());
|
||||
s.simpleBlitFrom(bg, Common::Point(0, 24));
|
||||
|
||||
const int creditNum = _frameCtr / CREDIT_TIME;
|
||||
int subNum = _frameCtr % CREDIT_TIME;
|
||||
|
||||
if (subNum >= (FADE_FRAMES + DISPLAY_TIME)) {
|
||||
subNum = (FADE_FRAMES - 1) - (subNum - (FADE_FRAMES + DISPLAY_TIME));
|
||||
} else if (subNum >= FADE_FRAMES) {
|
||||
subNum = FADE_FRAMES - 1;
|
||||
}
|
||||
|
||||
if (creditNum < CREDITS_COUNT) {
|
||||
const int gfxNum1 = 43 + creditNum;
|
||||
const int gfxNum2 = 67 + creditNum;
|
||||
const int gfxNum3 = 52 + subNum;
|
||||
const int gfxNum4 = 76 + subNum;
|
||||
|
||||
drawCredit(s, gfxNum1, gfxNum3, 16, 40 + 24);
|
||||
drawCredit(s, gfxNum2, gfxNum4, 16, 40 + 24);
|
||||
|
||||
#ifdef USE_TTS
|
||||
sayText(creditsText[creditNum]);
|
||||
#endif
|
||||
}
|
||||
|
||||
s.markAllDirty();
|
||||
}
|
||||
|
||||
void Credits::drawCredit(GfxSurface &s, int gfxNum1, int gfxNum2, int x, int y) {
|
||||
const Gfx::GraphicChunk &data = _G(gfx[gfxNum1]);
|
||||
const Gfx::GraphicChunk &lookup = _G(gfx[gfxNum2]);
|
||||
const byte *lines = data._data;
|
||||
const byte *lineData = data._data + 2 * data._height;
|
||||
|
||||
assert(x >= 0 && (x + data._width) <= 320);
|
||||
assert(y >= 0 && (y + data._height) <= 200);
|
||||
|
||||
for (int yCtr = 0; yCtr < data._height; ++yCtr) {
|
||||
byte *dest = (byte *)s.getBasePtr(x, y + yCtr);
|
||||
uint16 lineParts = READ_LE_UINT16(lines);
|
||||
lines += 2;
|
||||
|
||||
if (lineParts == 0)
|
||||
// Nothing on line, move to next
|
||||
continue;
|
||||
|
||||
for (; lineParts > 0; --lineParts) {
|
||||
byte count = *lineData++;
|
||||
|
||||
if (count & 0x80) {
|
||||
// Shade a range of pixels using lookup table
|
||||
count &= 0x7f;
|
||||
for (int i = 0; i < count; ++i, ++dest)
|
||||
*dest = lookup._data[*dest];
|
||||
} else {
|
||||
dest += count;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool Credits::tick() {
|
||||
if (++_delayCtr >= 3) {
|
||||
_delayCtr = 0;
|
||||
|
||||
if (_frameCtr == (CREDIT_TIME * CREDITS_COUNT) + 10) {
|
||||
replaceView("HighScores", true, true);
|
||||
} else {
|
||||
#ifdef USE_TTS
|
||||
// Pause credits progression until TTS is finished
|
||||
Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager();
|
||||
if (_frameCtr % CREDIT_TIME < FADE_FRAMES + DISPLAY_TIME || !ttsMan || !ttsMan->isSpeaking())
|
||||
#endif
|
||||
++_frameCtr;
|
||||
redraw();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Credits::msgAction(const ActionMessage &msg) {
|
||||
if (msg._action == KEYBIND_ESCAPE) {
|
||||
fadeOut();
|
||||
send("TitleBackground", GameMessage("MAIN_MENU"));
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace Views
|
||||
} // namespace Got
|
||||
50
engines/got/views/credits.h
Normal file
50
engines/got/views/credits.h
Normal 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_CREDITS_H
|
||||
#define GOT_VIEWS_CREDITS_H
|
||||
|
||||
#include "got/views/view.h"
|
||||
|
||||
namespace Got {
|
||||
namespace Views {
|
||||
|
||||
class Credits : public View {
|
||||
private:
|
||||
int _delayCtr = 0;
|
||||
int _frameCtr = 0;
|
||||
|
||||
void drawCredit(GfxSurface &s, int gfxNum1, int gfxNum2, int x, int y);
|
||||
|
||||
public:
|
||||
Credits() : View("Credits") {}
|
||||
virtual ~Credits() {}
|
||||
|
||||
bool msgFocus(const FocusMessage &msg) override;
|
||||
bool msgAction(const ActionMessage &msg) override;
|
||||
void draw() override;
|
||||
bool tick() override;
|
||||
};
|
||||
|
||||
} // namespace Views
|
||||
} // namespace Got
|
||||
|
||||
#endif
|
||||
48
engines/got/views/dialogs/ask.cpp
Normal file
48
engines/got/views/dialogs/ask.cpp
Normal 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
|
||||
45
engines/got/views/dialogs/ask.h
Normal file
45
engines/got/views/dialogs/ask.h
Normal 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
|
||||
62
engines/got/views/dialogs/dialog.cpp
Normal file
62
engines/got/views/dialogs/dialog.cpp
Normal 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
|
||||
43
engines/got/views/dialogs/dialog.h
Normal file
43
engines/got/views/dialogs/dialog.h
Normal 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
|
||||
145
engines/got/views/dialogs/high_scores.cpp
Normal file
145
engines/got/views/dialogs/high_scores.cpp
Normal 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
|
||||
56
engines/got/views/dialogs/high_scores.h
Normal file
56
engines/got/views/dialogs/high_scores.h
Normal 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
|
||||
99
engines/got/views/dialogs/main_menu.cpp
Normal file
99
engines/got/views/dialogs/main_menu.cpp
Normal 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
|
||||
45
engines/got/views/dialogs/main_menu.h
Normal file
45
engines/got/views/dialogs/main_menu.h
Normal 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
|
||||
69
engines/got/views/dialogs/options_menu.cpp
Normal file
69
engines/got/views/dialogs/options_menu.cpp
Normal 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
|
||||
43
engines/got/views/dialogs/options_menu.h
Normal file
43
engines/got/views/dialogs/options_menu.h
Normal 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
|
||||
51
engines/got/views/dialogs/quit.cpp
Normal file
51
engines/got/views/dialogs/quit.cpp
Normal 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
|
||||
44
engines/got/views/dialogs/quit.h
Normal file
44
engines/got/views/dialogs/quit.h
Normal 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
|
||||
53
engines/got/views/dialogs/quit_game.cpp
Normal file
53
engines/got/views/dialogs/quit_game.cpp
Normal 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
|
||||
43
engines/got/views/dialogs/quit_game.h
Normal file
43
engines/got/views/dialogs/quit_game.h
Normal 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
|
||||
56
engines/got/views/dialogs/save_game.cpp
Normal file
56
engines/got/views/dialogs/save_game.cpp
Normal 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
|
||||
48
engines/got/views/dialogs/save_game.h
Normal file
48
engines/got/views/dialogs/save_game.h
Normal 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
|
||||
207
engines/got/views/dialogs/say.cpp
Normal file
207
engines/got/views/dialogs/say.cpp
Normal 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
|
||||
73
engines/got/views/dialogs/say.h
Normal file
73
engines/got/views/dialogs/say.h
Normal 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
|
||||
55
engines/got/views/dialogs/select_game.cpp
Normal file
55
engines/got/views/dialogs/select_game.cpp
Normal 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
|
||||
45
engines/got/views/dialogs/select_game.h
Normal file
45
engines/got/views/dialogs/select_game.h
Normal 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
|
||||
171
engines/got/views/dialogs/select_item.cpp
Normal file
171
engines/got/views/dialogs/select_item.cpp
Normal 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
|
||||
50
engines/got/views/dialogs/select_item.h
Normal file
50
engines/got/views/dialogs/select_item.h
Normal 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
|
||||
171
engines/got/views/dialogs/select_option.cpp
Normal file
171
engines/got/views/dialogs/select_option.cpp
Normal 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
|
||||
69
engines/got/views/dialogs/select_option.h
Normal file
69
engines/got/views/dialogs/select_option.h
Normal 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
|
||||
44
engines/got/views/dialogs/select_scroll.cpp
Normal file
44
engines/got/views/dialogs/select_scroll.cpp
Normal 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
|
||||
44
engines/got/views/dialogs/select_scroll.h
Normal file
44
engines/got/views/dialogs/select_scroll.h
Normal 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
|
||||
52
engines/got/views/dialogs/select_slow.cpp
Normal file
52
engines/got/views/dialogs/select_slow.cpp
Normal 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
|
||||
43
engines/got/views/dialogs/select_slow.h
Normal file
43
engines/got/views/dialogs/select_slow.h
Normal 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
|
||||
46
engines/got/views/dialogs/set_music.cpp
Normal file
46
engines/got/views/dialogs/set_music.cpp
Normal 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
|
||||
44
engines/got/views/dialogs/set_music.h
Normal file
44
engines/got/views/dialogs/set_music.h
Normal 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
|
||||
47
engines/got/views/dialogs/set_sound.cpp
Normal file
47
engines/got/views/dialogs/set_sound.cpp
Normal 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
|
||||
44
engines/got/views/dialogs/set_sound.h
Normal file
44
engines/got/views/dialogs/set_sound.h
Normal 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
|
||||
48
engines/got/views/dialogs/skill_level.cpp
Normal file
48
engines/got/views/dialogs/skill_level.cpp
Normal 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
|
||||
45
engines/got/views/dialogs/skill_level.h
Normal file
45
engines/got/views/dialogs/skill_level.h
Normal 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
|
||||
128
engines/got/views/game.cpp
Normal file
128
engines/got/views/game.cpp
Normal file
@@ -0,0 +1,128 @@
|
||||
/* 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/game.h"
|
||||
#include "got/game/back.h"
|
||||
#include "got/game/boss1.h"
|
||||
#include "got/game/boss2.h"
|
||||
#include "got/game/boss3.h"
|
||||
#include "got/game/move.h"
|
||||
#include "got/metaengine.h"
|
||||
#include "got/vars.h"
|
||||
|
||||
namespace Got {
|
||||
namespace Views {
|
||||
|
||||
Game::Game() : View("Game") {
|
||||
_children.push_back(&_content);
|
||||
_children.push_back(&_status);
|
||||
_content.setBounds(Common::Rect(0, 0, 320, 240 - 48));
|
||||
_status.setBounds(Common::Rect(0, 240 - 48, 320, 240));
|
||||
}
|
||||
|
||||
bool Game::msgFocus(const FocusMessage &msg) {
|
||||
Gfx::loadPalette();
|
||||
musicPlay(_G(levelMusic), false);
|
||||
return View::msgFocus(msg);
|
||||
}
|
||||
|
||||
bool Game::msgKeypress(const KeypressMessage &msg) {
|
||||
if (_G(gameMode) != MODE_NORMAL && _G(gameMode) != MODE_THUNDER)
|
||||
return false;
|
||||
|
||||
switch (msg.keycode) {
|
||||
case Common::KEYCODE_F1:
|
||||
odinSpeaks(2008, -1);
|
||||
return true;
|
||||
|
||||
case Common::KEYCODE_f:
|
||||
if (gDebugLevel > 0) {
|
||||
// Hack used for testing end-game sequence
|
||||
if (GAME1 && _G(currentLevel) == BOSS_LEVEL1)
|
||||
boss1ClosingSequence1();
|
||||
else if (GAME2 && _G(currentLevel) == BOSS_LEVEL2)
|
||||
boss2ClosingSequence1();
|
||||
else if (GAME3 && _G(currentLevel) == BOSS_LEVEL3)
|
||||
boss3ClosingSequence1();
|
||||
}
|
||||
break;
|
||||
|
||||
case Common::KEYCODE_e:
|
||||
if (gDebugLevel > 0 && GAME3)
|
||||
// Launch endgame screen
|
||||
boss3ClosingSequence3();
|
||||
break;
|
||||
|
||||
case Common::KEYCODE_s:
|
||||
g_engine->saveGameDialog();
|
||||
break;
|
||||
|
||||
case Common::KEYCODE_l:
|
||||
g_engine->loadGameDialog();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Game::msgAction(const ActionMessage &msg) {
|
||||
if (_G(gameMode) != MODE_NORMAL && _G(gameMode) != MODE_THUNDER)
|
||||
return false;
|
||||
|
||||
switch (msg._action) {
|
||||
case KEYBIND_FIRE:
|
||||
thorShoots();
|
||||
break;
|
||||
|
||||
case KEYBIND_SELECT:
|
||||
selectItem();
|
||||
return true;
|
||||
|
||||
case KEYBIND_THOR_DIES:
|
||||
_content.send(GameMessage("THOR_DIES"));
|
||||
return true;
|
||||
|
||||
case KEYBIND_ESCAPE:
|
||||
addView("OptionsMenu");
|
||||
return true;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Game::tick() {
|
||||
// There are many things in original game code that can trigger
|
||||
// changes on screen, and for simplicity they each no longer have
|
||||
// the code that partially updates the screen. Due to this,
|
||||
// we set to redraw the screen every frame in case of updates
|
||||
redraw();
|
||||
|
||||
return View::tick();
|
||||
}
|
||||
|
||||
} // namespace Views
|
||||
} // namespace Got
|
||||
50
engines/got/views/game.h
Normal file
50
engines/got/views/game.h
Normal 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_GAME_H
|
||||
#define GOT_VIEWS_GAME_H
|
||||
|
||||
#include "got/views/game_content.h"
|
||||
#include "got/views/game_status.h"
|
||||
#include "got/views/view.h"
|
||||
|
||||
namespace Got {
|
||||
namespace Views {
|
||||
|
||||
class Game : public View {
|
||||
private:
|
||||
GameContent _content;
|
||||
GameStatus _status;
|
||||
|
||||
public:
|
||||
Game();
|
||||
virtual ~Game() {}
|
||||
|
||||
bool msgFocus(const FocusMessage &msg) override;
|
||||
bool msgKeypress(const KeypressMessage &msg) override;
|
||||
bool msgAction(const ActionMessage &msg) override;
|
||||
bool tick() override;
|
||||
};
|
||||
|
||||
} // namespace Views
|
||||
} // namespace Got
|
||||
|
||||
#endif
|
||||
757
engines/got/views/game_content.cpp
Normal file
757
engines/got/views/game_content.cpp
Normal file
@@ -0,0 +1,757 @@
|
||||
/* 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/game_content.h"
|
||||
#include "got/game/back.h"
|
||||
#include "got/game/boss1.h"
|
||||
#include "got/game/boss2.h"
|
||||
#include "got/game/boss3.h"
|
||||
#include "got/game/move.h"
|
||||
#include "got/game/move_patterns.h"
|
||||
#include "got/game/object.h"
|
||||
#include "got/game/status.h"
|
||||
#include "got/vars.h"
|
||||
|
||||
namespace Got {
|
||||
namespace Views {
|
||||
|
||||
#define SPIN_INTERVAL 4
|
||||
#define SPIN_COUNT 20
|
||||
#define DEATH_THRESHOLD (SPIN_COUNT * SPIN_INTERVAL)
|
||||
|
||||
GameContent::GameContent() : View("GameContent") {
|
||||
_surface.create(320, 192);
|
||||
}
|
||||
|
||||
void GameContent::draw() {
|
||||
GfxSurface s;
|
||||
if (_G(gameMode) == MODE_THUNDER || _G(gameMode) == MODE_AREA_CHANGE) {
|
||||
s.create(320, 192);
|
||||
} else {
|
||||
s = getSurface();
|
||||
}
|
||||
s.clear();
|
||||
|
||||
drawBackground(s);
|
||||
drawObjects(s);
|
||||
drawActors(s);
|
||||
|
||||
if ((GAME1 && _G(currentLevel) == BOSS_LEVEL1) ||
|
||||
(GAME2 && _G(currentLevel) == BOSS_LEVEL2) ||
|
||||
(GAME3 && _G(currentLevel) == BOSS_LEVEL3))
|
||||
drawBossHealth(s);
|
||||
|
||||
// If we're shaking the screen, render the content with the shake X/Y
|
||||
if (_G(gameMode) == MODE_THUNDER) {
|
||||
GfxSurface win = getSurface();
|
||||
win.clear();
|
||||
win.simpleBlitFrom(s, _moveDelta);
|
||||
} else if (_G(gameMode) == MODE_LIGHTNING) {
|
||||
drawLightning(s);
|
||||
|
||||
} else if (_G(gameMode) == MODE_AREA_CHANGE) {
|
||||
// Draw parts of the new scene along with parts of the old one
|
||||
// as it's scrolled off-screen
|
||||
GfxSurface win = getSurface();
|
||||
|
||||
switch (_G(transitionDir)) {
|
||||
case DIR_LEFT:
|
||||
win.simpleBlitFrom(s, Common::Rect(320 - _transitionPos, 0, 320, 192), Common::Point(0, 0));
|
||||
win.simpleBlitFrom(_surface, Common::Rect(0, 0, 320 - _transitionPos, 192), Common::Point(_transitionPos, 0));
|
||||
break;
|
||||
case DIR_RIGHT:
|
||||
win.simpleBlitFrom(_surface, Common::Rect(_transitionPos, 0, 320, 192), Common::Point(0, 0));
|
||||
win.simpleBlitFrom(s, Common::Rect(0, 0, _transitionPos, 192), Common::Point(320 - _transitionPos, 0));
|
||||
break;
|
||||
case DIR_UP:
|
||||
win.simpleBlitFrom(s, Common::Rect(0, 192 - _transitionPos, 320, 192), Common::Point(0, 0));
|
||||
win.simpleBlitFrom(_surface, Common::Rect(0, 0, 320, 192 - _transitionPos), Common::Point(0, _transitionPos));
|
||||
break;
|
||||
case DIR_DOWN:
|
||||
win.simpleBlitFrom(_surface, Common::Rect(0, _transitionPos, 320, 192), Common::Point(0, 0));
|
||||
win.simpleBlitFrom(s, Common::Rect(0, 0, 320, _transitionPos), Common::Point(0, 192 - _transitionPos));
|
||||
break;
|
||||
case DIR_PHASED:
|
||||
win.simpleBlitFrom(_surface); // Copy old surface
|
||||
|
||||
// Copy the randomly chosen blocks over from new scene
|
||||
for (int i = 0; i < 240; ++i) {
|
||||
int x = (i * 16) % 320;
|
||||
int y = ((i * 16) / 320) * 16;
|
||||
if (_phased[i])
|
||||
win.simpleBlitFrom(s, Common::Rect(x, y, x + 16, y + 16), Common::Point(x, y));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define MSG(STR, METHOD) \
|
||||
else if (msg._name == STR) { \
|
||||
METHOD(); \
|
||||
return true; \
|
||||
}
|
||||
|
||||
bool GameContent::msgGame(const GameMessage &msg) {
|
||||
if (msg._name == "PAUSE") {
|
||||
_G(gameMode) = MODE_PAUSE;
|
||||
_pauseCtr = msg._value;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (msg._name == "SCORE_INV") {
|
||||
_G(gameMode) = MODE_SCORE_INV;
|
||||
_pauseCtr = 0;
|
||||
return true;
|
||||
}
|
||||
MSG("THROW_LIGHTNING", throwLightning)
|
||||
MSG("THOR_DIES", thorDies)
|
||||
MSG("CLOSING", closingSequence)
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#undef MSG
|
||||
|
||||
bool GameContent::tick() {
|
||||
checkThunderShake();
|
||||
|
||||
switch (_G(gameMode)) {
|
||||
case MODE_NORMAL:
|
||||
case MODE_THUNDER:
|
||||
checkSwitchFlag();
|
||||
checkForItem();
|
||||
moveActors();
|
||||
useItem();
|
||||
updateActors();
|
||||
checkForBossDead();
|
||||
checkForCheats();
|
||||
|
||||
if (_G(endGame))
|
||||
endGameMovement();
|
||||
break;
|
||||
|
||||
case MODE_THOR_DIES:
|
||||
if (_deathCtr < DEATH_THRESHOLD) {
|
||||
spinThor();
|
||||
} else if (_deathCtr < DEATH_THRESHOLD + 60) {
|
||||
_G(thor)->_active = false;
|
||||
++_deathCtr;
|
||||
} else {
|
||||
thorDead();
|
||||
}
|
||||
break;
|
||||
|
||||
case MODE_LIGHTNING:
|
||||
if (--_lightningCtr == 0) {
|
||||
lightningCountdownDone();
|
||||
}
|
||||
break;
|
||||
|
||||
case MODE_PAUSE:
|
||||
if (--_pauseCtr == 0)
|
||||
_G(gameMode) = MODE_NORMAL;
|
||||
break;
|
||||
|
||||
case MODE_SCORE_INV:
|
||||
if (--_pauseCtr <= 0) {
|
||||
_pauseCtr = 2;
|
||||
|
||||
if (_G(thor)->_health > 0) {
|
||||
_G(thor)->_health--;
|
||||
playSound(WOOP, true);
|
||||
addHealth(-1);
|
||||
addScore(10);
|
||||
|
||||
} else if (_G(thorInfo)._magic > 0) {
|
||||
_G(thorInfo)._magic--;
|
||||
playSound(WOOP, true);
|
||||
addMagic(-1);
|
||||
addScore(10);
|
||||
|
||||
} else if (_G(thorInfo)._jewels) {
|
||||
_G(thorInfo)._jewels--;
|
||||
playSound(WOOP, true);
|
||||
addJewels(-1);
|
||||
addScore(10);
|
||||
|
||||
} else {
|
||||
_G(gameMode) = MODE_NORMAL;
|
||||
_pauseCtr = 0;
|
||||
send(GameMessage("CLOSING"));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (_G(eyeballs) == 1) { // eyeballs movement animation
|
||||
if (!_G(setup).f25) {
|
||||
_G(thor)->_dir = 0;
|
||||
} else {
|
||||
_G(thor)->_dir = 1;
|
||||
}
|
||||
}
|
||||
|
||||
checkForAreaChange();
|
||||
|
||||
// Check for end of game area
|
||||
if (_G(endTile)) {
|
||||
_G(endTile) = false;
|
||||
Gfx::fadeOut();
|
||||
|
||||
// Add name to high scores list if necessary, and then show it
|
||||
_G(highScores).add(_G(area), _G(playerName), _G(thorInfo)._score);
|
||||
g_events->send("HighScores", GameMessage("HIGH_SCORES", _G(area)));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void GameContent::drawBackground(GfxSurface &s) {
|
||||
const Level &screen = _G(scrn);
|
||||
|
||||
for (int y = 0; y < TILES_Y; y++) {
|
||||
for (int x = 0; x < TILES_X; x++) {
|
||||
if (screen._iconGrid[y][x] != 0) {
|
||||
const Common::Point pt(x * TILE_SIZE, y * TILE_SIZE);
|
||||
s.simpleBlitFrom(_G(bgPics[screen._backgroundColor]), pt);
|
||||
s.simpleBlitFrom(_G(bgPics[screen._iconGrid[y][x]]), pt);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GameContent::drawObjects(GfxSurface &s) {
|
||||
for (int y = 0; y < TILES_Y; ++y) {
|
||||
for (int x = 0; x < TILES_X; ++x) {
|
||||
int p = (y * TILES_X) + x;
|
||||
|
||||
byte currObjId = _G(objectMap[p]);
|
||||
if (currObjId) {
|
||||
s.simpleBlitFrom(_G(objects[currObjId - 1]), Common::Point(x * TILE_SIZE, y * TILE_SIZE));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GameContent::drawActors(GfxSurface &s) {
|
||||
Actor *actor_ptr = &_G(actor[MAX_ACTORS - 1]);
|
||||
Actor *actor2_storage = nullptr;
|
||||
|
||||
for (int actor_num = 0; actor_num <= MAX_ACTORS;) {
|
||||
// Check for blinking flag
|
||||
if (actor_ptr && actor_ptr->_active && !(actor_ptr->_show & 2)) {
|
||||
actor_ptr->_lastX[_G(pge)] = actor_ptr->_x;
|
||||
actor_ptr->_lastY[_G(pge)] = actor_ptr->_y;
|
||||
|
||||
const Graphics::ManagedSurface &frame = actor_ptr->pic[actor_ptr->_dir][actor_ptr->_frameSequence[actor_ptr->_nextFrame]];
|
||||
s.simpleBlitFrom(frame, Common::Point(actor_ptr->_x, actor_ptr->_y));
|
||||
}
|
||||
|
||||
// Move to the next actor
|
||||
do {
|
||||
--actor_ptr;
|
||||
++actor_num;
|
||||
|
||||
if (actor_num == MAX_ACTORS)
|
||||
actor_ptr = actor2_storage;
|
||||
else if (actor_num == (MAX_ACTORS - 3))
|
||||
actor2_storage = actor_ptr;
|
||||
} while (actor_num == (MAX_ACTORS - 3));
|
||||
}
|
||||
|
||||
if (_G(gameMode) == MODE_THOR_DIES && _deathCtr >= DEATH_THRESHOLD)
|
||||
s.simpleBlitFrom(_G(objects[10]), Common::Point(_G(thor)->_x, _G(thor)->_y));
|
||||
}
|
||||
|
||||
void GameContent::drawBossHealth(GfxSurface &s) {
|
||||
int c;
|
||||
|
||||
int health = _G(actor[3])._health;
|
||||
|
||||
s.fillRect(Common::Rect(304, 2, 317, 81), 0);
|
||||
s.fillRect(Common::Rect(305, 3, 316, 80), 28);
|
||||
s.fillRect(Common::Rect(306, 4, 315, 79), 26);
|
||||
s.fillRect(Common::Rect(307, 5, 314, 78), 24);
|
||||
|
||||
for (int i = 10; i > 0; i--) {
|
||||
if (i * 10 > health)
|
||||
c = 0;
|
||||
else
|
||||
c = 32;
|
||||
|
||||
s.fillRect(Common::Rect(308, 7 + (7 * (10 - i)), 313, 13 + (7 * (10 - i))), c);
|
||||
}
|
||||
}
|
||||
|
||||
void GameContent::checkThunderShake() {
|
||||
if (_G(thunderSnakeCounter)) {
|
||||
_G(gameMode) = MODE_THUNDER;
|
||||
|
||||
// Introduce a random screen shake by rendering screen 1 pixel offset randomly
|
||||
static const int8 DELTA_X[4] = {-1, 1, 0, 0};
|
||||
static const int8 DELTA_Y[4] = {0, 0, -1, 1};
|
||||
int delta = g_events->getRandomNumber(3);
|
||||
|
||||
_moveDelta.x = DELTA_X[delta];
|
||||
_moveDelta.y = DELTA_Y[delta];
|
||||
|
||||
_G(thunderSnakeCounter--);
|
||||
if ((_G(thunderSnakeCounter) < MAX_ACTORS) && _G(thunderSnakeCounter) > 2) {
|
||||
int thunderFl = _G(thunderSnakeCounter);
|
||||
if (_G(actor[thunderFl])._active) {
|
||||
_G(actor[thunderFl])._vulnerableCountdown = 0;
|
||||
actorDamaged(&_G(actor[thunderFl]), 20);
|
||||
}
|
||||
}
|
||||
|
||||
if (!_G(thunderSnakeCounter)) {
|
||||
_G(gameMode) = MODE_NORMAL;
|
||||
_moveDelta = Common::Point(0, 0);
|
||||
}
|
||||
|
||||
redraw();
|
||||
}
|
||||
}
|
||||
|
||||
void GameContent::checkSwitchFlag() {
|
||||
if (!_G(switchUsed))
|
||||
return;
|
||||
|
||||
switch (_G(switchUsed)) {
|
||||
case 1:
|
||||
switchIcons();
|
||||
break;
|
||||
case 2:
|
||||
rotateArrows();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
_G(switchUsed) = 0;
|
||||
}
|
||||
|
||||
void GameContent::checkForItem() {
|
||||
int thor_pos = _G(thor)->getPos();
|
||||
if (_G(objectMap[thor_pos]))
|
||||
pickUpObject(thor_pos);
|
||||
}
|
||||
|
||||
void GameContent::moveActors() {
|
||||
for (int i = 0; i < MAX_ACTORS; i++) {
|
||||
if (_G(actor[i])._active) {
|
||||
_G(actor[i])._moveCount = _G(actor[i])._numMoves;
|
||||
while (_G(actor[i])._moveCount--)
|
||||
moveActor(&_G(actor[i]));
|
||||
|
||||
if (i == 0)
|
||||
setThorVars();
|
||||
|
||||
if (_G(newLevel) != _G(currentLevel))
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
int thor_pos = _G(thor)->getPos();
|
||||
_G(thor)->_centerX = thor_pos % 20;
|
||||
_G(thor)->_centerY = thor_pos / 20;
|
||||
}
|
||||
|
||||
void GameContent::updateActors() {
|
||||
for (int i = 0; i < MAX_ACTORS; ++i) {
|
||||
Actor *actor = &_G(actor[i]);
|
||||
|
||||
if (!actor->_active && actor->_dead > 0)
|
||||
actor->_dead--;
|
||||
}
|
||||
}
|
||||
|
||||
void GameContent::checkForBossDead() {
|
||||
if (_G(bossDead)) {
|
||||
int loop;
|
||||
for (loop = 3; loop < 7; loop++) {
|
||||
if (_G(actor[loop])._active)
|
||||
break;
|
||||
}
|
||||
|
||||
if (loop == 7) {
|
||||
_G(bossDead) = false;
|
||||
|
||||
_G(exitFlag) = 0;
|
||||
|
||||
if (_G(bossActive)) {
|
||||
switch (_G(area)) {
|
||||
case 1:
|
||||
boss1ClosingSequence1();
|
||||
break;
|
||||
case 2:
|
||||
boss2ClosingSequence1();
|
||||
break;
|
||||
case 3:
|
||||
boss3ClosingSequence1();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
_G(bossActive) = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GameContent::checkForAreaChange() {
|
||||
if (_G(gameMode) == MODE_AREA_CHANGE) {
|
||||
// Area transition is already in progress
|
||||
switch (_G(transitionDir)) {
|
||||
case DIR_LEFT:
|
||||
case DIR_RIGHT:
|
||||
_transitionPos += 32;
|
||||
if (_transitionPos == 320)
|
||||
_G(gameMode) = MODE_NORMAL;
|
||||
break;
|
||||
case DIR_UP:
|
||||
case DIR_DOWN:
|
||||
_transitionPos += 16;
|
||||
if (_transitionPos == 192)
|
||||
_G(gameMode) = MODE_NORMAL;
|
||||
break;
|
||||
case DIR_PHASED:
|
||||
_transitionPos += 10;
|
||||
if (_transitionPos == 240) {
|
||||
_G(gameMode) = MODE_NORMAL;
|
||||
Common::fill(_phased, _phased + 240, false);
|
||||
} else {
|
||||
// The screen is subdivided into 240 16x16 blocks. Picks ones
|
||||
// randomly to copy over from the new screen
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
for (;;) {
|
||||
int idx = g_events->getRandomNumber(239);
|
||||
if (!_phased[idx]) {
|
||||
_phased[idx] = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (_G(gameMode) == MODE_NORMAL) {
|
||||
_transitionPos = 0;
|
||||
showLevelDone();
|
||||
}
|
||||
|
||||
} else if (_G(newLevel) != _G(currentLevel)) {
|
||||
// Area transition beginning
|
||||
_G(thor)->_show = 0;
|
||||
_G(thor)->_active = false;
|
||||
_G(hammer)->_active = false;
|
||||
_G(tornadoUsed) = false;
|
||||
|
||||
// Draws the old area without Thor, and then save a copy of it.
|
||||
// This will be used to scroll old area off-screen as new area scrolls in
|
||||
draw();
|
||||
_surface.copyFrom(getSurface());
|
||||
|
||||
// Set up new level
|
||||
_G(thor)->_active = true;
|
||||
showLevel(_G(newLevel));
|
||||
}
|
||||
}
|
||||
|
||||
void GameContent::thorDies() {
|
||||
if (_G(gameMode) == MODE_SCORE_INV)
|
||||
return;
|
||||
|
||||
// Stop any actors on-screen from moving
|
||||
for (int li = 0; li < MAX_ACTORS; li++)
|
||||
_G(actor[li])._show = 0;
|
||||
_G(actor[2])._active = false;
|
||||
|
||||
// Set the state for showing death animation
|
||||
_G(gameMode) = MODE_THOR_DIES;
|
||||
_deathCtr = 0;
|
||||
_G(shieldOn) = false;
|
||||
|
||||
playSound(DEAD, true);
|
||||
}
|
||||
|
||||
void GameContent::spinThor() {
|
||||
static const byte DIRS[] = {0, 2, 1, 3};
|
||||
|
||||
if (!_G(eyeballs)) {
|
||||
_G(thor)->_dir = DIRS[(_deathCtr / SPIN_INTERVAL) % 4];
|
||||
_G(thor)->_lastDir = DIRS[(_deathCtr / SPIN_INTERVAL) % 4];
|
||||
}
|
||||
|
||||
++_deathCtr;
|
||||
}
|
||||
|
||||
void GameContent::thorDead() {
|
||||
int li = _G(thorInfo)._selectedItem;
|
||||
int ln = _G(thorInfo)._inventory;
|
||||
|
||||
_G(newLevel) = _G(thorInfo)._lastScreen;
|
||||
_G(thor)->_x = (_G(thorInfo)._lastIcon % 20) * 16;
|
||||
_G(thor)->_y = ((_G(thorInfo)._lastIcon / 20) * 16) - 1;
|
||||
if (_G(thor)->_x < 1)
|
||||
_G(thor)->_x = 1;
|
||||
if (_G(thor)->_y < 0)
|
||||
_G(thor)->_y = 0;
|
||||
_G(thor)->_lastX[0] = _G(thor)->_x;
|
||||
_G(thor)->_lastX[1] = _G(thor)->_x;
|
||||
_G(thor)->_lastY[0] = _G(thor)->_y;
|
||||
_G(thor)->_lastY[1] = _G(thor)->_y;
|
||||
_G(thor)->_dir = _G(thorInfo)._lastDir;
|
||||
_G(thor)->_lastDir = _G(thorInfo)._lastDir;
|
||||
_G(thor)->_health = _G(thorInfo)._lastHealth;
|
||||
_G(thorInfo)._magic = _G(thorInfo)._lastMagic;
|
||||
_G(thorInfo)._jewels = _G(thorInfo)._lastJewels;
|
||||
_G(thorInfo)._keys = _G(thorInfo)._lastKeys;
|
||||
_G(thorInfo)._score = _G(thorInfo)._lastScore;
|
||||
_G(thorInfo)._object = _G(thorInfo)._lastObject;
|
||||
_G(thorInfo)._objectName = _G(thorInfo)._lastObjectName;
|
||||
|
||||
if (ln == _G(thorInfo)._lastInventory) {
|
||||
_G(thorInfo)._selectedItem = li;
|
||||
} else {
|
||||
_G(thorInfo)._selectedItem = _G(thorInfo)._lastItem;
|
||||
_G(thorInfo)._inventory = _G(thorInfo)._lastInventory;
|
||||
}
|
||||
|
||||
_G(setup) = _G(lastSetup);
|
||||
|
||||
_G(thor)->_numMoves = 1;
|
||||
_G(thor)->_vulnerableCountdown = 60;
|
||||
_G(thor)->_show = 60;
|
||||
_G(appleFlag) = false;
|
||||
_G(thunderSnakeCounter) = 0;
|
||||
_G(tornadoUsed) = false;
|
||||
_G(shieldOn) = false;
|
||||
musicResume();
|
||||
_G(actor[1])._active = false;
|
||||
_G(actor[2])._active = false;
|
||||
_G(thor)->_moveCountdown = 6;
|
||||
_G(thor)->_active = true;
|
||||
|
||||
// Load saved data for new level back into scrn
|
||||
_G(scrn).load(_G(newLevel));
|
||||
|
||||
_G(gameMode) = MODE_NORMAL;
|
||||
_deathCtr = 0;
|
||||
|
||||
showLevel(_G(newLevel));
|
||||
setThorVars();
|
||||
}
|
||||
|
||||
void GameContent::checkForCheats() {
|
||||
if (_G(cheats)._freezeHealth)
|
||||
_G(thor)->_health = 150;
|
||||
if (_G(cheats)._freezeMagic)
|
||||
_G(thorInfo)._magic = 150;
|
||||
if (_G(cheats)._freezeJewels)
|
||||
_G(thorInfo)._jewels = 999;
|
||||
}
|
||||
|
||||
void GameContent::placePixel(GfxSurface &s, int dir, int num) {
|
||||
switch (dir) {
|
||||
case 0:
|
||||
_pixelY[dir][num] = _pixelY[dir][num - 1] - 1;
|
||||
_pixelX[dir][num] = _pixelX[dir][num - 1] +
|
||||
(1 - (g_events->getRandomNumber(2)));
|
||||
break;
|
||||
case 1:
|
||||
if (g_events->getRandomNumber(1)) {
|
||||
_pixelX[dir][num] = _pixelX[dir][num - 1] + 1;
|
||||
_pixelY[dir][num] = _pixelY[dir][num - 1] + (0 - (g_events->getRandomNumber(1)));
|
||||
} else {
|
||||
_pixelY[dir][num] = _pixelY[dir][num - 1] - 1;
|
||||
_pixelX[dir][num] = _pixelX[dir][num - 1] + (1 - (g_events->getRandomNumber(1)));
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
_pixelX[dir][num] = _pixelX[dir][num - 1] + 1;
|
||||
_pixelY[dir][num] = _pixelY[dir][num - 1] + (1 - (g_events->getRandomNumber(2)));
|
||||
break;
|
||||
case 3:
|
||||
if (g_events->getRandomNumber(1)) {
|
||||
_pixelX[dir][num] = _pixelX[dir][num - 1] + 1;
|
||||
_pixelY[dir][num] = _pixelY[dir][num - 1] + (1 - (g_events->getRandomNumber(1)));
|
||||
} else {
|
||||
_pixelY[dir][num] = _pixelY[dir][num - 1] + 1;
|
||||
_pixelX[dir][num] = _pixelX[dir][num - 1] + (1 - (g_events->getRandomNumber(1)));
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
_pixelY[dir][num] = _pixelY[dir][num - 1] + 1;
|
||||
_pixelX[dir][num] = _pixelX[dir][num - 1] + (1 - (g_events->getRandomNumber(2)));
|
||||
break;
|
||||
case 5:
|
||||
if (g_events->getRandomNumber(1)) {
|
||||
_pixelX[dir][num] = _pixelX[dir][num - 1] - 1;
|
||||
_pixelY[dir][num] = _pixelY[dir][num - 1] + (1 - (g_events->getRandomNumber(1)));
|
||||
} else {
|
||||
_pixelY[dir][num] = _pixelY[dir][num - 1] + 1;
|
||||
_pixelX[dir][num] = _pixelX[dir][num - 1] + (0 - (g_events->getRandomNumber(1)));
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
_pixelX[dir][num] = _pixelX[dir][num - 1] - 1;
|
||||
_pixelY[dir][num] = _pixelY[dir][num - 1] + (1 - (g_events->getRandomNumber(2)));
|
||||
break;
|
||||
case 7:
|
||||
if (g_events->getRandomNumber(1)) {
|
||||
_pixelX[dir][num] = _pixelX[dir][num - 1] - 1;
|
||||
_pixelY[dir][num] = _pixelY[dir][num - 1] + (0 - (g_events->getRandomNumber(1)));
|
||||
} else {
|
||||
_pixelY[dir][num] = _pixelY[dir][num - 1] - 1;
|
||||
_pixelX[dir][num] = _pixelX[dir][num - 1] + (0 - (g_events->getRandomNumber(1)));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
if (pointWithin(_pixelX[dir][num], _pixelY[dir][num], 0, 0, 319, 191)) {
|
||||
byte *pixel = (byte *)s.getBasePtr(_pixelX[dir][num],
|
||||
_pixelY[dir][num]);
|
||||
*pixel = _pixelC[dir];
|
||||
}
|
||||
}
|
||||
|
||||
void GameContent::throwLightning() {
|
||||
_G(gameMode) = MODE_LIGHTNING;
|
||||
_lightningCtr = 20;
|
||||
|
||||
for (int i = 0; i < MAX_ACTORS; i++)
|
||||
_G(actor[i])._show = 0;
|
||||
|
||||
playSound(ELECTRIC, true);
|
||||
}
|
||||
|
||||
void GameContent::drawLightning(GfxSurface &s) {
|
||||
for (int i = 0; i < 8; i++) {
|
||||
_pixelX[i][0] = _G(thor)->_x + 7;
|
||||
_pixelY[i][0] = _G(thor)->_y + 7;
|
||||
_pixelC[i] = 14 + g_events->getRandomNumber(1);
|
||||
}
|
||||
|
||||
for (int r = 0; r < 8; r++) {
|
||||
for (int i = 1; i < 25; i++) {
|
||||
placePixel(s, r, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GameContent::lightningCountdownDone() {
|
||||
_G(gameMode) = MODE_NORMAL;
|
||||
|
||||
int x = _G(thor)->_x + 7;
|
||||
int y = _G(thor)->_y + 7;
|
||||
|
||||
for (int i = 3; i < MAX_ACTORS; i++) {
|
||||
if (!_G(actor[i])._active)
|
||||
continue;
|
||||
|
||||
int ax = _G(actor[i])._x + (_G(actor[i])._sizeX / 2);
|
||||
int ay = _G(actor[i])._y + (_G(actor[i])._sizeY / 2);
|
||||
|
||||
if ((ABS(ax - x) < 30) && (ABS(ay - y) < 30)) {
|
||||
_G(actor[i])._magicHit = 1;
|
||||
_G(actor[i])._vulnerableCountdown = 0;
|
||||
actorDamaged(&_G(actor[i]), 254);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GameContent::closingSequence() {
|
||||
const int area = _G(area);
|
||||
|
||||
switch (++_closingStateCtr) {
|
||||
case 1:
|
||||
// Convert health/magic/jewels to score
|
||||
_G(gameMode) = MODE_SCORE_INV;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
switch (area) {
|
||||
case 1:
|
||||
boss1ClosingSequence2();
|
||||
break;
|
||||
case 2:
|
||||
boss2ClosingSequence2();
|
||||
break;
|
||||
case 3:
|
||||
boss3ClosingSequence2();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 3:
|
||||
switch (area) {
|
||||
case 1:
|
||||
boss1ClosingSequence3();
|
||||
break;
|
||||
case 2:
|
||||
boss2ClosingSequence3();
|
||||
break;
|
||||
case 3:
|
||||
boss3ClosingSequence3();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 4:
|
||||
_closingStateCtr = 0;
|
||||
|
||||
switch (area) {
|
||||
case 1:
|
||||
boss1ClosingSequence4();
|
||||
break;
|
||||
case 2:
|
||||
boss2ClosingSequence4();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Views
|
||||
} // namespace Got
|
||||
79
engines/got/views/game_content.h
Normal file
79
engines/got/views/game_content.h
Normal file
@@ -0,0 +1,79 @@
|
||||
/* 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_GAME_CONTENT_H
|
||||
#define GOT_VIEWS_GAME_CONTENT_H
|
||||
|
||||
#include "got/data/defines.h"
|
||||
#include "got/views/view.h"
|
||||
|
||||
namespace Got {
|
||||
namespace Views {
|
||||
|
||||
class GameContent : public View {
|
||||
private:
|
||||
GfxSurface _surface;
|
||||
Common::Point _moveDelta;
|
||||
int _transitionPos = 0;
|
||||
int _deathCtr = 0;
|
||||
bool _phased[240] = {};
|
||||
int _lightningCtr = 0;
|
||||
int _pixelX[8][25] = {};
|
||||
int _pixelY[8][25] = {};
|
||||
//byte _pixelP[8][25] = {};
|
||||
byte _pixelC[8] = {};
|
||||
int _pauseCtr = 0;
|
||||
int _closingStateCtr = 0;
|
||||
|
||||
void drawBackground(GfxSurface &s);
|
||||
void drawObjects(GfxSurface &s);
|
||||
void drawActors(GfxSurface &s);
|
||||
void drawBossHealth(GfxSurface &s);
|
||||
void drawLightning(GfxSurface &s);
|
||||
void placePixel(GfxSurface &s, int dir, int num);
|
||||
void checkThunderShake();
|
||||
void checkSwitchFlag();
|
||||
void checkForItem();
|
||||
void moveActors();
|
||||
void updateActors();
|
||||
void checkForBossDead();
|
||||
void checkForAreaChange();
|
||||
void thorDies();
|
||||
void spinThor();
|
||||
void thorDead();
|
||||
void checkForCheats();
|
||||
void throwLightning();
|
||||
void lightningCountdownDone();
|
||||
void closingSequence();
|
||||
|
||||
public:
|
||||
GameContent();
|
||||
virtual ~GameContent() {}
|
||||
|
||||
void draw() override;
|
||||
bool msgGame(const GameMessage &msg) override;
|
||||
bool tick() override;
|
||||
};
|
||||
|
||||
} // namespace Views
|
||||
} // namespace Got
|
||||
|
||||
#endif
|
||||
180
engines/got/views/game_status.cpp
Normal file
180
engines/got/views/game_status.cpp
Normal file
@@ -0,0 +1,180 @@
|
||||
/* 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/game_status.h"
|
||||
#include "got/game/status.h"
|
||||
#include "got/vars.h"
|
||||
|
||||
namespace Got {
|
||||
namespace Views {
|
||||
|
||||
#define STAT_COLOR 206
|
||||
#define SCORE_INTERVAL 5
|
||||
|
||||
void GameStatus::draw() {
|
||||
GfxSurface s = getSurface();
|
||||
|
||||
// Draw the status background
|
||||
const Graphics::ManagedSurface &status = _G(status[0]);
|
||||
s.simpleBlitFrom(status);
|
||||
|
||||
// Draw the elements
|
||||
displayHealth(s);
|
||||
displayMagic(s);
|
||||
displayJewels(s);
|
||||
displayScore(s);
|
||||
displayKeys(s);
|
||||
displayItem(s);
|
||||
}
|
||||
|
||||
void GameStatus::displayHealth(GfxSurface &s) {
|
||||
const int x = 59 + _G(thor)->_health;
|
||||
|
||||
s.fillRect(Common::Rect(59, 8, x, 12), 32);
|
||||
s.fillRect(Common::Rect(x, 8, 209, 12), STAT_COLOR);
|
||||
}
|
||||
|
||||
void GameStatus::displayMagic(GfxSurface &s) {
|
||||
const int x = 59 + _G(thorInfo)._magic;
|
||||
|
||||
s.fillRect(Common::Rect(59, 20, x, 24), 96);
|
||||
s.fillRect(Common::Rect(x, 20, 209, 24), STAT_COLOR);
|
||||
}
|
||||
|
||||
void GameStatus::displayJewels(GfxSurface &s) {
|
||||
const Common::String str = Common::String::format("%d", _G(thorInfo)._jewels);
|
||||
|
||||
#ifdef USE_TTS
|
||||
if (_G(thorInfo)._previousJewels != _G(thorInfo)._jewels && _G(gameMode) != MODE_SCORE_INV) {
|
||||
if (_lastStatusSpoken == kJewels) {
|
||||
stopTextToSpeech();
|
||||
}
|
||||
|
||||
sayText("Jewels: " + str, Common::TextToSpeechManager::QUEUE);
|
||||
|
||||
_G(thorInfo)._previousJewels = _G(thorInfo)._jewels;
|
||||
_lastStatusSpoken = kJewels;
|
||||
}
|
||||
#endif
|
||||
|
||||
int x;
|
||||
if (str.size() == 1)
|
||||
x = 70;
|
||||
else if (str.size() == 2)
|
||||
x = 66;
|
||||
else
|
||||
x = 62;
|
||||
|
||||
s.fillRect(Common::Rect(59, 32, 85, 42), STAT_COLOR);
|
||||
s.print(Common::Point(x, 32), str, 14);
|
||||
}
|
||||
|
||||
void GameStatus::displayScore(GfxSurface &s) {
|
||||
const Common::String str = Common::String::format("%ld", _G(thorInfo)._score);
|
||||
const int x = 276 - (str.size() * 8);
|
||||
|
||||
#ifdef USE_TTS
|
||||
if (_G(thorInfo)._previousScore != _G(thorInfo)._score && _G(gameMode) != MODE_SCORE_INV && _scoreCountdown == 0) {
|
||||
if (_lastStatusSpoken == kScore) {
|
||||
stopTextToSpeech();
|
||||
}
|
||||
|
||||
sayText("Score: " + str, Common::TextToSpeechManager::QUEUE);
|
||||
|
||||
_G(thorInfo)._previousScore = _G(thorInfo)._score;
|
||||
_lastStatusSpoken = kScore;
|
||||
}
|
||||
#endif
|
||||
|
||||
s.fillRect(Common::Rect(223, 32, 279, 42), STAT_COLOR);
|
||||
s.print(Common::Point(x, 32), str, 14);
|
||||
}
|
||||
|
||||
void GameStatus::displayKeys(GfxSurface &s) {
|
||||
const Common::String str = Common::String::format("%d", _G(thorInfo)._keys);
|
||||
|
||||
#ifdef USE_TTS
|
||||
if (_G(thorInfo)._previousKeys != _G(thorInfo)._keys && _G(gameMode) != MODE_SCORE_INV) {
|
||||
if (_lastStatusSpoken == kKeys) {
|
||||
stopTextToSpeech();
|
||||
}
|
||||
|
||||
sayText("Keys: " + str, Common::TextToSpeechManager::QUEUE);
|
||||
|
||||
_G(thorInfo)._previousKeys = _G(thorInfo)._keys;
|
||||
_lastStatusSpoken = kKeys;
|
||||
}
|
||||
#endif
|
||||
|
||||
int x;
|
||||
if (str.size() == 1)
|
||||
x = 150;
|
||||
else if (str.size() == 2)
|
||||
x = 146;
|
||||
else
|
||||
x = 142;
|
||||
|
||||
s.fillRect(Common::Rect(139, 32, 164, 42), STAT_COLOR);
|
||||
s.print(Common::Point(x, 32), str, 14);
|
||||
}
|
||||
|
||||
void GameStatus::displayItem(GfxSurface &s) {
|
||||
s.fillRect(Common::Rect(280, 8, 296, 24), STAT_COLOR);
|
||||
|
||||
ThorInfo thorInfo = _G(thorInfo);
|
||||
if (thorInfo._selectedItem) {
|
||||
if (thorInfo._selectedItem == 7)
|
||||
s.simpleBlitFrom(_G(objects[thorInfo._object + 10]), Common::Point(280, 8));
|
||||
else
|
||||
s.simpleBlitFrom(_G(objects[thorInfo._selectedItem + 25]), Common::Point(280, 8));
|
||||
}
|
||||
}
|
||||
|
||||
bool GameStatus::msgGame(const GameMessage &msg) {
|
||||
if (msg._name == "FILL_SCORE") {
|
||||
_G(gameMode) = MODE_ADD_SCORE;
|
||||
_scoreCountdown = msg._value * SCORE_INTERVAL;
|
||||
_endMessage = msg._stringValue;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GameStatus::tick() {
|
||||
if (_scoreCountdown > 0) {
|
||||
if ((_scoreCountdown % SCORE_INTERVAL) == 0) {
|
||||
_G(sound).playSound(WOOP, 1);
|
||||
addScore(1000);
|
||||
}
|
||||
|
||||
if (--_scoreCountdown == 0) {
|
||||
_G(gameMode) = MODE_NORMAL;
|
||||
if (!_endMessage.empty())
|
||||
g_events->send(GameMessage(_endMessage));
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace Views
|
||||
} // namespace Got
|
||||
69
engines/got/views/game_status.h
Normal file
69
engines/got/views/game_status.h
Normal 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_GAME_STATUS_H
|
||||
#define GOT_VIEWS_GAME_STATUS_H
|
||||
|
||||
#include "got/views/view.h"
|
||||
|
||||
namespace Got {
|
||||
namespace Views {
|
||||
|
||||
#ifdef USE_TTS
|
||||
|
||||
enum LastStatusSpoken {
|
||||
kNone = 0,
|
||||
kJewels = 1,
|
||||
kScore = 2,
|
||||
kKeys = 3
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
class GameStatus : public View {
|
||||
private:
|
||||
int _scoreCountdown = 0;
|
||||
Common::String _endMessage;
|
||||
|
||||
void displayHealth(GfxSurface &s);
|
||||
void displayMagic(GfxSurface &s);
|
||||
void displayJewels(GfxSurface &s);
|
||||
void displayScore(GfxSurface &s);
|
||||
void displayKeys(GfxSurface &s);
|
||||
void displayItem(GfxSurface &s);
|
||||
|
||||
#ifdef USE_TTS
|
||||
LastStatusSpoken _lastStatusSpoken = kNone;
|
||||
#endif
|
||||
|
||||
public:
|
||||
GameStatus() : View("GameStatus") {}
|
||||
virtual ~GameStatus() {}
|
||||
|
||||
void draw() override;
|
||||
bool msgGame(const GameMessage &msg) override;
|
||||
bool tick() override;
|
||||
};
|
||||
|
||||
} // namespace Views
|
||||
} // namespace Got
|
||||
|
||||
#endif
|
||||
114
engines/got/views/opening.cpp
Normal file
114
engines/got/views/opening.cpp
Normal file
@@ -0,0 +1,114 @@
|
||||
/* 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/opening.h"
|
||||
#include "got/got.h"
|
||||
#include "got/vars.h"
|
||||
|
||||
namespace Got {
|
||||
namespace Views {
|
||||
|
||||
int ctr = 0;
|
||||
|
||||
void Opening::draw() {
|
||||
GfxSurface s = getSurface();
|
||||
|
||||
if (_shakeX == 0) {
|
||||
s.blitFrom(_surface, Common::Rect(0, 0, 320, 400), Common::Rect(0, 0, 320, 240));
|
||||
} else {
|
||||
s.clear();
|
||||
Common::Rect destRect(0, 0, 320, 240);
|
||||
destRect.translate(_shakeX, 0);
|
||||
s.blitFrom(_surface, Common::Rect(0, 0, 320, 400), destRect);
|
||||
}
|
||||
}
|
||||
|
||||
bool Opening::msgFocus(const FocusMessage &msg) {
|
||||
_surface.create(320, 400);
|
||||
for (int chunkNum = 0; chunkNum < 4; ++chunkNum) {
|
||||
const byte *src = _G(gfx[36 + chunkNum])._data;
|
||||
byte *dest = (byte *)_surface.getBasePtr(chunkNum, 0);
|
||||
|
||||
for (int i = 0; i < (320 * 400 / 4); ++i, ++src, dest += 4)
|
||||
*dest = *src;
|
||||
}
|
||||
|
||||
// Fade in the screen
|
||||
const Gfx::Palette63 pal = _G(gfx[35]);
|
||||
draw();
|
||||
fadeIn(pal);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Opening::drawTitle() {
|
||||
const byte *src = _G(gfx[40])._data;
|
||||
|
||||
for (int pane = 0; pane < 4; ++pane) {
|
||||
byte *dest = (byte *)_surface.getBasePtr(pane, 0);
|
||||
|
||||
for (int i = 0; i < (320 * 80 / 4); ++i, ++src, dest += 4)
|
||||
*dest = *src;
|
||||
}
|
||||
}
|
||||
|
||||
bool Opening::msgUnfocus(const UnfocusMessage &msg) {
|
||||
_surface.clear();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Opening::msgAction(const ActionMessage &msg) {
|
||||
if (msg._action == KEYBIND_ESCAPE) {
|
||||
fadeOut();
|
||||
send("TitleBackground", GameMessage("MAIN_MENU"));
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Opening::tick() {
|
||||
++_frameCtr;
|
||||
|
||||
if (_frameCtr == 20) {
|
||||
drawTitle();
|
||||
redraw();
|
||||
playSound(_G(gfx[104]));
|
||||
} else if (_frameCtr < 40) {
|
||||
if ((_frameCtr % 4) == 0) {
|
||||
_shakeX = g_engine->getRandomNumber(19) - 10;
|
||||
redraw();
|
||||
}
|
||||
} else if (_frameCtr == 41) {
|
||||
_shakeX = 0;
|
||||
redraw();
|
||||
} else if (_frameCtr == 100) {
|
||||
musicPlay("MENU", true);
|
||||
} else if (_frameCtr == 200) {
|
||||
fadeOut();
|
||||
replaceView("Credits", true);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace Views
|
||||
} // namespace Got
|
||||
52
engines/got/views/opening.h
Normal file
52
engines/got/views/opening.h
Normal 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef GOT_VIEWS_OPENING_H
|
||||
#define GOT_VIEWS_OPENING_H
|
||||
|
||||
#include "got/views/view.h"
|
||||
|
||||
namespace Got {
|
||||
namespace Views {
|
||||
|
||||
class Opening : public View {
|
||||
private:
|
||||
Graphics::ManagedSurface _surface;
|
||||
int _frameCtr = 0;
|
||||
int _shakeX = 0;
|
||||
|
||||
void drawTitle();
|
||||
|
||||
public:
|
||||
Opening() : View("Opening") {}
|
||||
virtual ~Opening() {}
|
||||
|
||||
bool msgFocus(const FocusMessage &msg) override;
|
||||
bool msgUnfocus(const UnfocusMessage &msg) override;
|
||||
bool msgAction(const ActionMessage &msg) override;
|
||||
void draw() override;
|
||||
bool tick() override;
|
||||
};
|
||||
|
||||
} // namespace Views
|
||||
} // namespace Got
|
||||
|
||||
#endif
|
||||
89
engines/got/views/part_title.cpp
Normal file
89
engines/got/views/part_title.cpp
Normal file
@@ -0,0 +1,89 @@
|
||||
/* 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/part_title.h"
|
||||
#include "got/metaengine.h"
|
||||
#include "got/vars.h"
|
||||
|
||||
namespace Got {
|
||||
namespace Views {
|
||||
|
||||
void PartTitle::draw() {
|
||||
GfxSurface s = getSurface();
|
||||
s.clear();
|
||||
s.print(Common::Point(13 * 8, 13 * 8), "God of Thunder", 14);
|
||||
#ifdef USE_TTS
|
||||
Common::String ttsMessage = "God of Thunder: ";
|
||||
#endif
|
||||
|
||||
switch (_G(area)) {
|
||||
case 1:
|
||||
s.print(Common::Point(8 * 8, 15 * 8), "Part I: Serpent Surprise", 32);
|
||||
#ifdef USE_TTS
|
||||
ttsMessage += "Part 1: Serpent Surprise";
|
||||
#endif
|
||||
break;
|
||||
case 2:
|
||||
s.print(Common::Point(7 * 8, 15 * 8), "Part II: Non-Stick Nognir", 32);
|
||||
#ifdef USE_TTS
|
||||
ttsMessage += "Part 2: Non-Stick Nognir";
|
||||
#endif
|
||||
break;
|
||||
case 3:
|
||||
s.print(Common::Point(7 * 8, 15 * 8), "Part III: Lookin' for Loki", 32);
|
||||
#ifdef USE_TTS
|
||||
ttsMessage += "Part 3: Lookin' for Loki";
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#ifdef USE_TTS
|
||||
sayText(ttsMessage);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool PartTitle::msgAction(const ActionMessage &msg) {
|
||||
if (msg._action == KEYBIND_ESCAPE)
|
||||
done();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PartTitle::tick() {
|
||||
Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager();
|
||||
if (++_timeoutCtr >= 80 && (!ttsMan || !ttsMan->isSpeaking())) {
|
||||
_timeoutCtr = 0;
|
||||
done();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void PartTitle::done() {
|
||||
#ifdef USE_TTS
|
||||
stopTextToSpeech();
|
||||
#endif
|
||||
replaceView("Game", true, true);
|
||||
}
|
||||
|
||||
} // namespace Views
|
||||
} // namespace Got
|
||||
48
engines/got/views/part_title.h
Normal file
48
engines/got/views/part_title.h
Normal 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_PART_TITLE_H
|
||||
#define GOT_VIEWS_PART_TITLE_H
|
||||
|
||||
#include "got/views/view.h"
|
||||
|
||||
namespace Got {
|
||||
namespace Views {
|
||||
|
||||
class PartTitle : public View {
|
||||
private:
|
||||
int _timeoutCtr = 0;
|
||||
|
||||
void done();
|
||||
|
||||
public:
|
||||
PartTitle() : View("PartTitle") {}
|
||||
virtual ~PartTitle() {}
|
||||
|
||||
bool msgAction(const ActionMessage &msg) override;
|
||||
void draw() override;
|
||||
bool tick() override;
|
||||
};
|
||||
|
||||
} // namespace Views
|
||||
} // namespace Got
|
||||
|
||||
#endif
|
||||
165
engines/got/views/splash_screen.cpp
Normal file
165
engines/got/views/splash_screen.cpp
Normal file
@@ -0,0 +1,165 @@
|
||||
/* 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/splash_screen.h"
|
||||
#include "common/file.h"
|
||||
#include "got/gfx/palette.h"
|
||||
#include "got/vars.h"
|
||||
|
||||
namespace Got {
|
||||
namespace Views {
|
||||
|
||||
#define SPLASH_FRAME_INTERVAL 2
|
||||
|
||||
void SplashScreen::draw() {
|
||||
if (_frameCtr == -1) {
|
||||
_frameCtr = 0;
|
||||
GfxSurface s = getSurface();
|
||||
|
||||
// Display background. The rest of the logo animation will be
|
||||
// done in the frame routines called from tick
|
||||
s.clear();
|
||||
s.simpleBlitFrom(_G(gfx[92]), Common::Point(0, 24));
|
||||
}
|
||||
}
|
||||
|
||||
bool SplashScreen::msgFocus(const FocusMessage &msg) {
|
||||
const Gfx::GraphicChunk chunk = _G(gfx[93]);
|
||||
_frameCount = READ_LE_UINT16(chunk._data);
|
||||
_chunkSize = chunk._data + 2;
|
||||
_chunkPtr = chunk._data + 2 + _frameCount * 4;
|
||||
|
||||
_frameCtr = -1;
|
||||
_delayCtr = 0;
|
||||
|
||||
// This is the first screen shown, so start with black, and fade it in
|
||||
byte blackPal[Graphics::PALETTE_SIZE];
|
||||
Common::fill(blackPal, blackPal + Graphics::PALETTE_SIZE, 0);
|
||||
Gfx::xSetPal(blackPal);
|
||||
|
||||
draw();
|
||||
const Gfx::Palette63 pal = _G(gfx[91]);
|
||||
Gfx::fadeIn(pal);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SplashScreen::msgUnfocus(const UnfocusMessage &msg) {
|
||||
fadeOut();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SplashScreen::tick() {
|
||||
if (++_delayCtr == SPLASH_FRAME_INTERVAL) {
|
||||
_delayCtr = 0;
|
||||
|
||||
if (++_frameCtr < _frameCount) {
|
||||
GfxSurface s = getSurface();
|
||||
byte *dest = (byte *)s.getBasePtr(0, 24);
|
||||
executeFrame(_chunkPtr, dest);
|
||||
s.markAllDirty();
|
||||
|
||||
_chunkPtr += READ_LE_UINT32(_chunkSize);
|
||||
_chunkSize += 4;
|
||||
} else if (_frameCtr == (_frameCount + 50)) {
|
||||
// Switch to the opening screen showing the game name
|
||||
replaceView("Opening", true);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
int frame = -1;
|
||||
|
||||
void SplashScreen::executeFrame(const byte *src, byte *dest) {
|
||||
const byte *codeP = src;
|
||||
int count = 0;
|
||||
int val = 0;
|
||||
|
||||
while (*codeP != 0xcb) {
|
||||
if (codeP[0] == 0xc9) {
|
||||
// leave
|
||||
codeP++;
|
||||
} else if (codeP[0] == 0x33 && codeP[1] == 0xc9) {
|
||||
// xor cx, cx
|
||||
count = 0;
|
||||
codeP += 2;
|
||||
} else if (codeP[0] == 0x81 && codeP[1] == 0xc6) {
|
||||
// add si, 16-bit
|
||||
src += READ_LE_INT16(codeP + 2);
|
||||
codeP += 4;
|
||||
} else if (codeP[0] == 0x81 && codeP[1] == 0xee) {
|
||||
// sub si, 16-bit
|
||||
src -= READ_LE_INT16(codeP + 2);
|
||||
codeP += 4;
|
||||
} else if (codeP[0] == 0x8b && codeP[1] == 0xdf) {
|
||||
// mov bx, di
|
||||
codeP += 2;
|
||||
} else if (codeP[0] == 0x81 && codeP[1] == 0xc7) {
|
||||
// add di, 16-bit
|
||||
dest += READ_LE_INT16(codeP + 2);
|
||||
codeP += 4;
|
||||
} else if (codeP[0] == 0xb8) {
|
||||
// mov ax, 16-bit
|
||||
val = READ_LE_UINT16(codeP + 1);
|
||||
codeP += 3;
|
||||
} else if (codeP[0] == 0xb0) {
|
||||
// mov al, 8-bit
|
||||
val = codeP[1];
|
||||
codeP += 2;
|
||||
} else if (codeP[0] == 0xb1) {
|
||||
// mov cl, 8-bit
|
||||
count = codeP[1];
|
||||
codeP += 2;
|
||||
} else if (codeP[0] == 0xf3 && codeP[1] == 0xab) {
|
||||
// rep stosw
|
||||
while (count-- > 0) {
|
||||
WRITE_LE_UINT16(dest, val);
|
||||
dest += 2;
|
||||
}
|
||||
codeP += 2;
|
||||
} else if (codeP[0] == 0xab) {
|
||||
// stosw
|
||||
WRITE_LE_UINT16(dest, val);
|
||||
dest += 2;
|
||||
codeP++;
|
||||
} else if (codeP[0] == 0xaa) {
|
||||
// stosb
|
||||
*dest++ = (byte)val;
|
||||
++codeP;
|
||||
} else if (codeP[0] == 0xf3 && codeP[1] == 0xa5) {
|
||||
// rep movsw
|
||||
Common::copy(src, src + count * 2, dest);
|
||||
src += count * 2;
|
||||
dest += count * 2;
|
||||
codeP += 2;
|
||||
} else if (codeP[0] == 0xa4) {
|
||||
// movsb
|
||||
*dest++ = *src++;
|
||||
++codeP;
|
||||
} else {
|
||||
error("Unhandled opcode");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Views
|
||||
} // namespace Got
|
||||
52
engines/got/views/splash_screen.h
Normal file
52
engines/got/views/splash_screen.h
Normal 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef GOT_VIEWS_SPLASH_SCREEN_H
|
||||
#define GOT_VIEWS_SPLASH_SCREEN_H
|
||||
|
||||
#include "got/views/view.h"
|
||||
|
||||
namespace Got {
|
||||
namespace Views {
|
||||
|
||||
class SplashScreen : public View {
|
||||
private:
|
||||
const byte *_chunkSize = nullptr;
|
||||
const byte *_chunkPtr = nullptr;
|
||||
int _frameCount = 0;
|
||||
int _delayCtr = 0, _frameCtr = 0;
|
||||
|
||||
void executeFrame(const byte *src, byte *dest);
|
||||
|
||||
public:
|
||||
SplashScreen() : View("SplashScreen") {}
|
||||
virtual ~SplashScreen() {}
|
||||
|
||||
bool msgFocus(const FocusMessage &msg) override;
|
||||
bool msgUnfocus(const UnfocusMessage &msg) override;
|
||||
void draw() override;
|
||||
bool tick() override;
|
||||
};
|
||||
|
||||
} // namespace Views
|
||||
} // namespace Got
|
||||
|
||||
#endif
|
||||
192
engines/got/views/story.cpp
Normal file
192
engines/got/views/story.cpp
Normal file
@@ -0,0 +1,192 @@
|
||||
/* 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/story.h"
|
||||
#include "got/gfx/palette.h"
|
||||
#include "got/metaengine.h"
|
||||
#include "got/utils/file.h"
|
||||
#include "got/vars.h"
|
||||
|
||||
namespace Got {
|
||||
namespace Views {
|
||||
|
||||
#define MAX_Y 236
|
||||
|
||||
bool Story::msgFocus(const FocusMessage &msg) {
|
||||
Common::String storyName = g_events->isDemo() ? "STORY" :
|
||||
Common::String::format("STORY%d", _G(area));
|
||||
resourceRead(storyName, _G(tmpBuff));
|
||||
|
||||
byte paletteBuffer[Graphics::PALETTE_SIZE] = {};
|
||||
resourceRead("STORYPAL", paletteBuffer);
|
||||
|
||||
for (int i = 0; i < Graphics::PALETTE_SIZE; ++i)
|
||||
paletteBuffer[i] = ((int)paletteBuffer[i] * 255 + 31) / 63;
|
||||
Gfx::setPalette(paletteBuffer);
|
||||
|
||||
// Create story image and load in it's fragments
|
||||
_surface.create(320, 240 * 2);
|
||||
|
||||
for (int i = 0; i < 12; i++) {
|
||||
Gfx::Pics pics(Common::String::format("OPENP%d", i + 1));
|
||||
pics.load();
|
||||
|
||||
_surface.simpleBlitFrom(pics[0], Common::Point(0, i * 40));
|
||||
}
|
||||
|
||||
// Set up the story text
|
||||
int i = 0;
|
||||
int x = 8, y = 2;
|
||||
byte color = 72;
|
||||
char s[21];
|
||||
|
||||
const char *p = (const char *)_G(tmpBuff);
|
||||
|
||||
#ifdef USE_TTS
|
||||
_ttsMessage.clear();
|
||||
#endif
|
||||
|
||||
while (i < 46) {
|
||||
if (*p == '\n') {
|
||||
x = 8;
|
||||
y += 10;
|
||||
i++;
|
||||
|
||||
if (i == 23) {
|
||||
// Move to start of of "second page" of the surface
|
||||
y = 240 + 2;
|
||||
#ifdef USE_TTS
|
||||
_secondPageIndex = _ttsMessage.size() - 1;
|
||||
#endif
|
||||
}
|
||||
#ifdef USE_TTS
|
||||
_ttsMessage += '\n';
|
||||
#endif
|
||||
} else if (*p == '/' && *(p + 4) == '/') {
|
||||
p++;
|
||||
s[0] = *p++;
|
||||
s[1] = *p++;
|
||||
s[2] = *p++;
|
||||
s[3] = 0;
|
||||
color = atoi(s);
|
||||
} else if (*p != '\r') {
|
||||
_surface.rawPrintChar(*p, x - 1, y - 1, 255);
|
||||
_surface.rawPrintChar(*p, x + 1, y + 1, 255);
|
||||
_surface.rawPrintChar(*p, x - 1, y + 1, 255);
|
||||
_surface.rawPrintChar(*p, x + 1, y - 1, 255);
|
||||
_surface.rawPrintChar(*p, x, y - 1, 255);
|
||||
_surface.rawPrintChar(*p, x, y + 1, 255);
|
||||
_surface.rawPrintChar(*p, x - 1, y, 255);
|
||||
_surface.rawPrintChar(*p, x + 1, y, 255);
|
||||
_surface.rawPrintChar(*p, x, y, color);
|
||||
x += 8;
|
||||
|
||||
#ifdef USE_TTS
|
||||
_ttsMessage += *p;
|
||||
#endif
|
||||
}
|
||||
|
||||
p++;
|
||||
}
|
||||
|
||||
#ifdef USE_TTS
|
||||
sayText(_ttsMessage.substr(0, _secondPageIndex));
|
||||
#endif
|
||||
|
||||
// Final two glyphs
|
||||
Gfx::Pics glyphs("STORYPIC", 262);
|
||||
|
||||
if (_G(area) == 1) {
|
||||
_surface.simpleBlitFrom(glyphs[0], Common::Point(146, 64));
|
||||
_surface.simpleBlitFrom(glyphs[1], Common::Point(24, 88 + 240));
|
||||
} else {
|
||||
_surface.simpleBlitFrom(glyphs[0], Common::Point(146, 16));
|
||||
}
|
||||
|
||||
// Play the opening music
|
||||
musicPlay("OPENSONG", true);
|
||||
|
||||
_yp = 0;
|
||||
_scrolling = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Story::msgUnfocus(const UnfocusMessage &msg) {
|
||||
_surface.clear();
|
||||
musicPause();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Story::draw() {
|
||||
GfxSurface s = getSurface();
|
||||
|
||||
// Draw the currently visible part of the surface
|
||||
s.simpleBlitFrom(_surface, Common::Rect(0, _yp, 320, _yp + 240),
|
||||
Common::Point(0, 0));
|
||||
}
|
||||
|
||||
bool Story::msgAction(const ActionMessage &msg) {
|
||||
if (msg._action == KEYBIND_ESCAPE || _yp == MAX_Y)
|
||||
done();
|
||||
else if (!_scrolling) {
|
||||
#ifdef USE_TTS
|
||||
sayText(_ttsMessage.substr(_secondPageIndex));
|
||||
#endif
|
||||
_scrolling = true;
|
||||
} else
|
||||
_yp = MAX_Y;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Story::msgKeypress(const KeypressMessage &msg) {
|
||||
if (_yp == MAX_Y)
|
||||
done();
|
||||
else if (!_scrolling)
|
||||
_scrolling = true;
|
||||
else
|
||||
_yp = 240;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Story::tick() {
|
||||
if (_scrolling && _yp < MAX_Y) {
|
||||
_yp = MIN(_yp + 4, MAX_Y);
|
||||
redraw();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Story::done() {
|
||||
musicStop();
|
||||
|
||||
fadeOut();
|
||||
Gfx::loadPalette();
|
||||
replaceView("PartTitle");
|
||||
fadeIn();
|
||||
}
|
||||
|
||||
} // namespace Views
|
||||
} // namespace Got
|
||||
58
engines/got/views/story.h
Normal file
58
engines/got/views/story.h
Normal file
@@ -0,0 +1,58 @@
|
||||
/* 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_STORY_H
|
||||
#define GOT_VIEWS_STORY_H
|
||||
|
||||
#include "got/views/view.h"
|
||||
|
||||
namespace Got {
|
||||
namespace Views {
|
||||
|
||||
class Story : public View {
|
||||
private:
|
||||
Gfx::GfxSurface _surface;
|
||||
int _yp = 0;
|
||||
bool _scrolling = false;
|
||||
|
||||
void done();
|
||||
|
||||
#ifdef USE_TTS
|
||||
Common::String _ttsMessage;
|
||||
uint _secondPageIndex = 0;
|
||||
#endif
|
||||
|
||||
public:
|
||||
Story() : View("Story") {}
|
||||
virtual ~Story() {}
|
||||
|
||||
bool msgFocus(const FocusMessage &msg) override;
|
||||
bool msgUnfocus(const UnfocusMessage &msg) override;
|
||||
bool msgAction(const ActionMessage &msg) override;
|
||||
bool msgKeypress(const KeypressMessage &msg) override;
|
||||
void draw() override;
|
||||
bool tick() override;
|
||||
};
|
||||
|
||||
} // namespace Views
|
||||
} // namespace Got
|
||||
|
||||
#endif
|
||||
52
engines/got/views/title_background.cpp
Normal file
52
engines/got/views/title_background.cpp
Normal 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/title_background.h"
|
||||
#include "got/vars.h"
|
||||
|
||||
namespace Got {
|
||||
namespace Views {
|
||||
|
||||
bool TitleBackground::msgGame(const GameMessage &msg) {
|
||||
if (msg._name == "MAIN_MENU") {
|
||||
replaceView("TitleBackground", true);
|
||||
draw();
|
||||
Gfx::loadPalette();
|
||||
fadeIn();
|
||||
|
||||
addView("MainMenu");
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void TitleBackground::draw() {
|
||||
GfxSurface s = getSurface();
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Views
|
||||
} // namespace Got
|
||||
46
engines/got/views/title_background.h
Normal file
46
engines/got/views/title_background.h
Normal 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef GOT_VIEWS_TITLE_BACKGROUND_H
|
||||
#define GOT_VIEWS_TITLE_BACKGROUND_H
|
||||
|
||||
#include "got/views/view.h"
|
||||
|
||||
namespace Got {
|
||||
namespace Views {
|
||||
|
||||
/**
|
||||
* This view provides the green background for the
|
||||
* main menu and other dialogs on the title screen
|
||||
*/
|
||||
class TitleBackground : public View {
|
||||
public:
|
||||
TitleBackground() : View("TitleBackground") {}
|
||||
virtual ~TitleBackground() {}
|
||||
|
||||
bool msgGame(const GameMessage &msg) override;
|
||||
void draw() override;
|
||||
};
|
||||
|
||||
} // namespace Views
|
||||
} // namespace Got
|
||||
|
||||
#endif
|
||||
172
engines/got/views/view.cpp
Normal file
172
engines/got/views/view.cpp
Normal file
@@ -0,0 +1,172 @@
|
||||
/* 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 "common/config-manager.h"
|
||||
#include "got/views/view.h"
|
||||
#include "got/gfx/palette.h"
|
||||
#include "got/vars.h"
|
||||
|
||||
namespace Got {
|
||||
namespace Views {
|
||||
|
||||
void View::checkFocusedControl(const Common::Point &mousePos) {
|
||||
if (_focusedElement) {
|
||||
if (!_focusedElement->getBounds().contains(mousePos)) {
|
||||
_focusedElement->send(MouseLeaveMessage());
|
||||
_focusedElement = nullptr;
|
||||
}
|
||||
|
||||
} else {
|
||||
for (UIElement *child : _children) {
|
||||
if (child->getBounds().contains(mousePos)) {
|
||||
_focusedElement = child;
|
||||
child->send(MouseEnterMessage());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UIElement *View::getElementAtPos(const Common::Point &pos) const {
|
||||
for (UIElement *child : _children) {
|
||||
if (child->getBounds().contains(pos))
|
||||
return child;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool View::msgFocus(const FocusMessage &msg) {
|
||||
_focusedElement = nullptr;
|
||||
return UIElement::msgFocus(msg);
|
||||
}
|
||||
|
||||
bool View::msgUnfocus(const UnfocusMessage &msg) {
|
||||
if (_focusedElement)
|
||||
_focusedElement->send(MouseLeaveMessage());
|
||||
|
||||
return UIElement::msgUnfocus(msg);
|
||||
}
|
||||
|
||||
bool View::msgMouseMove(const MouseMoveMessage &msg) {
|
||||
checkFocusedControl(msg._pos);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool View::msgMouseDown(const MouseDownMessage &msg) {
|
||||
UIElement *child = getElementAtPos(msg._pos);
|
||||
return child ? child->send(msg) : false;
|
||||
}
|
||||
|
||||
bool View::msgMouseUp(const MouseUpMessage &msg) {
|
||||
UIElement *child = getElementAtPos(msg._pos);
|
||||
return child ? child->send(msg) : false;
|
||||
}
|
||||
|
||||
void View::playSound(int index, bool priority_override) {
|
||||
_G(sound).playSound(index, priority_override);
|
||||
}
|
||||
|
||||
void View::playSound(const Gfx::GraphicChunk &src) {
|
||||
_G(sound).playSound(src);
|
||||
}
|
||||
|
||||
void View::musicPlay(int num, bool override) {
|
||||
_G(sound).musicPlay(num, override);
|
||||
}
|
||||
|
||||
void View::musicPlay(const char *name, bool override) {
|
||||
_G(sound).musicPlay(name, override);
|
||||
}
|
||||
|
||||
void View::musicPause() {
|
||||
_G(sound).musicPause();
|
||||
}
|
||||
|
||||
void View::musicResume() {
|
||||
_G(sound).musicResume();
|
||||
}
|
||||
|
||||
void View::musicStop() {
|
||||
_G(sound).musicStop();
|
||||
}
|
||||
|
||||
bool View::musicIsOn() const {
|
||||
return _G(sound).musicIsOn();
|
||||
}
|
||||
|
||||
void View::fadeOut() {
|
||||
Gfx::fadeOut();
|
||||
}
|
||||
|
||||
void View::fadeIn(const byte *pal) {
|
||||
Gfx::fadeIn(pal);
|
||||
}
|
||||
|
||||
#ifdef USE_TTS
|
||||
|
||||
void View::sayText(const Common::String &text, Common::TextToSpeechManager::Action action) {
|
||||
Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager();
|
||||
|
||||
// _previousSaid is used to prevent the TTS from looping when sayText is called inside a loop,
|
||||
// for example when options in selection menus are voiced. Without it when the text ends it would speak
|
||||
// the same text again.
|
||||
// _previousSaid is cleared when appropriate to allow for repeat requests
|
||||
if (ttsMan && ConfMan.getBool("tts_enabled") && _previousSaid != text) {
|
||||
Common::String ttsMessage;
|
||||
|
||||
for (uint i = 0; i < text.size(); ++i) {
|
||||
// Some text is enclosed in < and >, which causes the text to not be voiced by TTS if they aren't replaced
|
||||
if (text[i] == '<' || text[i] == '>') {
|
||||
ttsMessage += ", ";
|
||||
continue;
|
||||
}
|
||||
|
||||
// Ignore color changing characters
|
||||
if (text[i] == '~' && i < text.size() - 1 && Common::isXDigit(text[i + 1])) {
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Replace single newlines with spaces to make voicing of dialog smoother. If there are two or more newlines in a row,
|
||||
// then the pieces of text are most likely supposed to be voiced as separate sentences, so keep the newlines in
|
||||
// that case
|
||||
if (text[i] == '\n') {
|
||||
if (i < text.size() - 1 && text[i + 1] == '\n') {
|
||||
i++;
|
||||
} else {
|
||||
ttsMessage += ' ';
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
ttsMessage += text[i];
|
||||
}
|
||||
|
||||
ttsMan->say(ttsMessage, action, Common::CodePage::kDos850);
|
||||
_previousSaid = text;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace Views
|
||||
} // namespace Got
|
||||
90
engines/got/views/view.h
Normal file
90
engines/got/views/view.h
Normal file
@@ -0,0 +1,90 @@
|
||||
/* 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_VIEW_H
|
||||
#define GOT_VIEWS_VIEW_H
|
||||
|
||||
#include "common/text-to-speech.h"
|
||||
#include "got/events.h"
|
||||
#include "got/gfx/gfx_chunks.h"
|
||||
|
||||
namespace Got {
|
||||
namespace Views {
|
||||
|
||||
/**
|
||||
* Base view class for screens and dialogs that appear on-screen.
|
||||
* The View class takes care of two important things:
|
||||
* 1) By default events get sent to all controls on a view until one
|
||||
* handles it. For mouse events, we instead want only the control the
|
||||
* mouse cursor is over to receive the events, saving the individual
|
||||
* controls from having to check if the mouse is within their bounds.
|
||||
* 2) Individual elements will get a Focus/Unfocus message as the
|
||||
* mouse enters and leaves them. This allows, for example, buttons
|
||||
* that have been pressed to de-select if the mouse leaves their bounds.
|
||||
*/
|
||||
class View : public UIElement {
|
||||
private:
|
||||
UIElement *_focusedElement = nullptr;
|
||||
|
||||
/**
|
||||
* Checks if a control is entered or left
|
||||
*/
|
||||
void checkFocusedControl(const Common::Point &mousePos);
|
||||
|
||||
/**
|
||||
* Check for an element at the given position
|
||||
*/
|
||||
UIElement *getElementAtPos(const Common::Point &pos) const;
|
||||
|
||||
protected:
|
||||
void playSound(int index, bool priority_override);
|
||||
void playSound(const Gfx::GraphicChunk &src);
|
||||
|
||||
void musicPlay(int num, bool override);
|
||||
void musicPlay(const char *name, bool override);
|
||||
void musicPause();
|
||||
void musicResume();
|
||||
void musicStop();
|
||||
bool musicIsOn() const;
|
||||
|
||||
void fadeOut();
|
||||
void fadeIn(const byte *pal = nullptr);
|
||||
|
||||
#ifdef USE_TTS
|
||||
void sayText(const Common::String &text, Common::TextToSpeechManager::Action action = Common::TextToSpeechManager::INTERRUPT);
|
||||
#endif
|
||||
|
||||
public:
|
||||
View(const Common::String &name, UIElement *uiParent) : UIElement(name, uiParent) {}
|
||||
View(const Common::String &name) : UIElement(name) {}
|
||||
virtual ~View() {}
|
||||
|
||||
bool msgFocus(const FocusMessage &msg) override;
|
||||
bool msgUnfocus(const UnfocusMessage &msg) override;
|
||||
bool msgMouseMove(const MouseMoveMessage &msg) override;
|
||||
bool msgMouseDown(const MouseDownMessage &msg) override;
|
||||
bool msgMouseUp(const MouseUpMessage &msg) override;
|
||||
};
|
||||
|
||||
} // namespace Views
|
||||
} // namespace Got
|
||||
|
||||
#endif
|
||||
80
engines/got/views/views.h
Normal file
80
engines/got/views/views.h
Normal file
@@ -0,0 +1,80 @@
|
||||
/* 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_H
|
||||
#define GOT_VIEWS_H
|
||||
|
||||
#include "got/views/credits.h"
|
||||
#include "got/views/dialogs/ask.h"
|
||||
#include "got/views/dialogs/high_scores.h"
|
||||
#include "got/views/dialogs/main_menu.h"
|
||||
#include "got/views/dialogs/options_menu.h"
|
||||
#include "got/views/dialogs/quit.h"
|
||||
#include "got/views/dialogs/quit_game.h"
|
||||
#include "got/views/dialogs/save_game.h"
|
||||
#include "got/views/dialogs/say.h"
|
||||
#include "got/views/dialogs/select_game.h"
|
||||
#include "got/views/dialogs/select_item.h"
|
||||
#include "got/views/dialogs/select_scroll.h"
|
||||
#include "got/views/dialogs/select_slow.h"
|
||||
#include "got/views/dialogs/set_music.h"
|
||||
#include "got/views/dialogs/set_sound.h"
|
||||
#include "got/views/dialogs/skill_level.h"
|
||||
#include "got/views/game.h"
|
||||
#include "got/views/opening.h"
|
||||
#include "got/views/part_title.h"
|
||||
#include "got/views/splash_screen.h"
|
||||
#include "got/views/story.h"
|
||||
#include "got/views/title_background.h"
|
||||
|
||||
namespace Got {
|
||||
namespace Views {
|
||||
|
||||
struct Views {
|
||||
Credits _credits;
|
||||
Game _game;
|
||||
Opening _opening;
|
||||
PartTitle _partTitle;
|
||||
SplashScreen _splashScreen;
|
||||
Story _story;
|
||||
TitleBackground _titleBackground;
|
||||
|
||||
Dialogs::Ask _ask;
|
||||
Dialogs::HighScores _highScores;
|
||||
Dialogs::MainMenu _mainMenu;
|
||||
Dialogs::OptionsMenu _optionsMenu;
|
||||
Dialogs::Quit _quit;
|
||||
Dialogs::QuitGame _quitGame;
|
||||
Dialogs::SaveGame _saveGame;
|
||||
Dialogs::Say _say;
|
||||
Dialogs::SelectGame _selectGame;
|
||||
Dialogs::SelectItem _selectItem;
|
||||
Dialogs::SelectScroll _selectScroll;
|
||||
Dialogs::SelectSlow _selectSlow;
|
||||
Dialogs::SetMusic _setMusic;
|
||||
Dialogs::SetSound _setSound;
|
||||
Dialogs::SkillLevel _skillLevel;
|
||||
};
|
||||
|
||||
} // namespace Views
|
||||
} // namespace Got
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user