mirror of
https://github.com/scummvm/scummvm.git
synced 2026-06-20 05:45:29 +00:00
STARK: Build the Settings and link it with other screens
This commit is contained in:
@@ -88,6 +88,7 @@ MODULE_OBJS := \
|
||||
ui/menu/diaryindex.o \
|
||||
ui/menu/locationscreen.o \
|
||||
ui/menu/mainmenu.o \
|
||||
ui/menu/settingsmenu.o \
|
||||
ui/window.o \
|
||||
ui/world/actionmenu.o \
|
||||
ui/world/button.o \
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#include "engines/stark/ui/cursor.h"
|
||||
#include "engines/stark/ui/menu/diaryindex.h"
|
||||
#include "engines/stark/ui/menu/mainmenu.h"
|
||||
#include "engines/stark/ui/menu/settingsmenu.h"
|
||||
#include "engines/stark/ui/world/inventorywindow.h"
|
||||
#include "engines/stark/ui/world/fmvscreen.h"
|
||||
#include "engines/stark/ui/world/gamescreen.h"
|
||||
@@ -49,6 +50,7 @@ UserInterface::UserInterface(Gfx::Driver *gfx) :
|
||||
_cursor(nullptr),
|
||||
_diaryIndexScreen(nullptr),
|
||||
_mainMenuScreen(nullptr),
|
||||
_settingsMenuScreen(nullptr),
|
||||
_exitGame(false),
|
||||
_fmvScreen(nullptr),
|
||||
_gameScreen(nullptr),
|
||||
@@ -67,6 +69,7 @@ UserInterface::~UserInterface() {
|
||||
delete _diaryIndexScreen;
|
||||
delete _cursor;
|
||||
delete _mainMenuScreen;
|
||||
delete _settingsMenuScreen;
|
||||
}
|
||||
|
||||
void UserInterface::init() {
|
||||
@@ -75,6 +78,7 @@ void UserInterface::init() {
|
||||
_mainMenuScreen = new MainMenuScreen(_gfx, _cursor);
|
||||
_gameScreen = new GameScreen(_gfx, _cursor);
|
||||
_diaryIndexScreen = new DiaryIndexScreen(_gfx, _cursor);
|
||||
_settingsMenuScreen = new SettingsMenuScreen(_gfx, _cursor);
|
||||
_fmvScreen = new FMVScreen(_gfx, _cursor);
|
||||
|
||||
_prevScreenNameStack.push(Screen::kScreenMainMenu);
|
||||
@@ -180,6 +184,8 @@ Screen *UserInterface::getScreenByName(Screen::Name screenName) const {
|
||||
return _gameScreen;
|
||||
case Screen::kScreenMainMenu:
|
||||
return _mainMenuScreen;
|
||||
case Screen::kScreenSettingsMenu:
|
||||
return _settingsMenuScreen;
|
||||
default:
|
||||
error("Unhandled screen name '%d'", screenName);
|
||||
}
|
||||
|
||||
@@ -47,6 +47,7 @@ class Driver;
|
||||
class DiaryIndexScreen;
|
||||
class GameScreen;
|
||||
class MainMenuScreen;
|
||||
class SettingsMenuScreen;
|
||||
class Cursor;
|
||||
class FMVScreen;
|
||||
|
||||
@@ -151,6 +152,7 @@ private:
|
||||
FMVScreen *_fmvScreen;
|
||||
DiaryIndexScreen *_diaryIndexScreen;
|
||||
MainMenuScreen *_mainMenuScreen;
|
||||
SettingsMenuScreen *_settingsMenuScreen;
|
||||
Screen *_currentScreen;
|
||||
Common::Stack<Screen::Name> _prevScreenNameStack;
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ void DiaryIndexScreen::open() {
|
||||
|
||||
_widgets.push_back(new StaticLocationWidget(
|
||||
"Options",
|
||||
nullptr,
|
||||
CLICK_HANDLER(DiaryIndexScreen, settingsHandler),
|
||||
MOVE_HANDLER(DiaryIndexScreen, widgetTextColorHandler)));
|
||||
|
||||
_widgets.push_back(new StaticLocationWidget(
|
||||
@@ -109,6 +109,10 @@ void DiaryIndexScreen::widgetTextColorHandler(StaticLocationWidget &widget, cons
|
||||
}
|
||||
}
|
||||
|
||||
void DiaryIndexScreen::settingsHandler() {
|
||||
StarkUserInterface->changeScreen(Screen::kScreenSettingsMenu);
|
||||
}
|
||||
|
||||
void DiaryIndexScreen::backHandler() {
|
||||
StarkUserInterface->backPrevScreen();
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ public:
|
||||
private:
|
||||
void widgetTextColorHandler(StaticLocationWidget &widget, const Common::Point &mousePos);
|
||||
void backHandler();
|
||||
void settingsHandler();
|
||||
void loadHandler();
|
||||
void saveHandler();
|
||||
void quitHandler();
|
||||
|
||||
@@ -59,7 +59,7 @@ void MainMenuScreen::open() {
|
||||
|
||||
_widgets.push_back(new StaticLocationWidget(
|
||||
"Options",
|
||||
nullptr,
|
||||
CLICK_HANDLER(MainMenuScreen, settingsHandler),
|
||||
MOVE_HANDLER(MainMenuScreen, helpTextHandler<6>)));
|
||||
_widgets.back()->setupSounds(0, 1);
|
||||
|
||||
@@ -170,6 +170,10 @@ void MainMenuScreen::loadHandler() {
|
||||
// TODO: Link to the load screen
|
||||
}
|
||||
|
||||
void MainMenuScreen::settingsHandler() {
|
||||
StarkUserInterface->changeScreen(Screen::kScreenSettingsMenu);
|
||||
}
|
||||
|
||||
void MainMenuScreen::quitHandler() {
|
||||
StarkUserInterface->notifyShouldExit();
|
||||
}
|
||||
|
||||
@@ -47,6 +47,7 @@ private:
|
||||
void newGameHandler();
|
||||
void loadHandler();
|
||||
void creditsHandler();
|
||||
void settingsHandler();
|
||||
void quitHandler();
|
||||
|
||||
bool isDemo() {
|
||||
|
||||
@@ -0,0 +1,192 @@
|
||||
/* ResidualVM - A 3D game interpreter
|
||||
*
|
||||
* ResidualVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the AUTHORS
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "engines/stark/ui/menu/settingsmenu.h"
|
||||
#include "engines/stark/services/services.h"
|
||||
#include "engines/stark/services/userinterface.h"
|
||||
|
||||
namespace Stark {
|
||||
|
||||
SettingsMenuScreen::SettingsMenuScreen(Gfx::Driver *gfx, Cursor *cursor):
|
||||
StaticLocationScreen(gfx, cursor, "OptionLocation", Screen::kScreenSettingsMenu) {
|
||||
}
|
||||
|
||||
SettingsMenuScreen::~SettingsMenuScreen() {
|
||||
}
|
||||
|
||||
void SettingsMenuScreen::open() {
|
||||
StaticLocationScreen::open();
|
||||
|
||||
_widgets.push_back(new StaticLocationWidget(
|
||||
// This is the background image
|
||||
"The Longest Journey",
|
||||
nullptr,
|
||||
nullptr));
|
||||
|
||||
_widgets.push_back(new StaticLocationWidget(
|
||||
"Return",
|
||||
CLICK_HANDLER(SettingsMenuScreen, backHandler),
|
||||
nullptr));
|
||||
_widgets.back()->setupSounds(3, 4);
|
||||
|
||||
_widgets.push_back(new StaticLocationWidget(
|
||||
"Back",
|
||||
CLICK_HANDLER(SettingsMenuScreen, backHandler),
|
||||
nullptr));
|
||||
_widgets.back()->setupSounds(3, 4);
|
||||
|
||||
_widgets.push_back(new StaticLocationWidget(
|
||||
"GSettings",
|
||||
nullptr,
|
||||
nullptr));
|
||||
|
||||
_widgets.push_back(new StaticLocationWidget(
|
||||
"AprilHighRes",
|
||||
nullptr,
|
||||
MOVE_HANDLER(SettingsMenuScreen, textHandler<5>)));
|
||||
_widgets.back()->setupSounds(3, 4);
|
||||
|
||||
_widgets.push_back(new StaticLocationWidget(
|
||||
"HighResHelp",
|
||||
nullptr,
|
||||
nullptr));
|
||||
_widgets.back()->setVisible(false);
|
||||
|
||||
_widgets.push_back(new StaticLocationWidget(
|
||||
"Subtitles",
|
||||
nullptr,
|
||||
MOVE_HANDLER(SettingsMenuScreen, textHandler<7>)));
|
||||
_widgets.back()->setupSounds(3, 4);
|
||||
|
||||
_widgets.push_back(new StaticLocationWidget(
|
||||
"SubtitleHelp",
|
||||
nullptr,
|
||||
nullptr));
|
||||
_widgets.back()->setVisible(false);
|
||||
|
||||
_widgets.push_back(new StaticLocationWidget(
|
||||
"SpecialFX",
|
||||
nullptr,
|
||||
MOVE_HANDLER(SettingsMenuScreen, textHandler<9>)));
|
||||
_widgets.back()->setupSounds(3, 4);
|
||||
|
||||
_widgets.push_back(new StaticLocationWidget(
|
||||
"SpecialFXHelp",
|
||||
nullptr,
|
||||
nullptr));
|
||||
_widgets.back()->setVisible(false);
|
||||
|
||||
_widgets.push_back(new StaticLocationWidget(
|
||||
"Shadows",
|
||||
nullptr,
|
||||
MOVE_HANDLER(SettingsMenuScreen, textHandler<11>)));
|
||||
_widgets.back()->setupSounds(3, 4);
|
||||
|
||||
_widgets.push_back(new StaticLocationWidget(
|
||||
"ShadowsHelp",
|
||||
nullptr,
|
||||
nullptr));
|
||||
_widgets.back()->setVisible(false);
|
||||
|
||||
_widgets.push_back(new StaticLocationWidget(
|
||||
"HighResFMV",
|
||||
nullptr,
|
||||
MOVE_HANDLER(SettingsMenuScreen, textHandler<13>)));
|
||||
_widgets.back()->setupSounds(3, 4);
|
||||
|
||||
_widgets.push_back(new StaticLocationWidget(
|
||||
"FMVHelp",
|
||||
nullptr,
|
||||
nullptr));
|
||||
_widgets.back()->setVisible(false);
|
||||
|
||||
_widgets.push_back(new StaticLocationWidget(
|
||||
"VSettings",
|
||||
nullptr,
|
||||
nullptr));
|
||||
|
||||
_widgets.push_back(new StaticLocationWidget(
|
||||
"Voice",
|
||||
nullptr,
|
||||
MOVE_HANDLER(SettingsMenuScreen, textHandler<16>)));
|
||||
|
||||
_widgets.push_back(new StaticLocationWidget(
|
||||
"VoiceHelp",
|
||||
nullptr,
|
||||
nullptr));
|
||||
_widgets.back()->setVisible(false);
|
||||
|
||||
_widgets.push_back(new StaticLocationWidget(
|
||||
"Music",
|
||||
nullptr,
|
||||
MOVE_HANDLER(SettingsMenuScreen, textHandler<18>)));
|
||||
|
||||
_widgets.push_back(new StaticLocationWidget(
|
||||
"MusicHelp",
|
||||
nullptr,
|
||||
nullptr));
|
||||
_widgets.back()->setVisible(false);
|
||||
|
||||
_widgets.push_back(new StaticLocationWidget(
|
||||
"Sfx",
|
||||
nullptr,
|
||||
MOVE_HANDLER(SettingsMenuScreen, textHandler<20>)));
|
||||
|
||||
_widgets.push_back(new StaticLocationWidget(
|
||||
"SfxHelp",
|
||||
nullptr,
|
||||
nullptr));
|
||||
_widgets.back()->setVisible(false);
|
||||
|
||||
if (!isDemo()) {
|
||||
_widgets.push_back(new StaticLocationWidget(
|
||||
"AllowFF",
|
||||
nullptr,
|
||||
MOVE_HANDLER(SettingsMenuScreen, textHandler<22>)));
|
||||
_widgets.back()->setupSounds(3, 4);
|
||||
|
||||
_widgets.push_back(new StaticLocationWidget(
|
||||
"AllowFFHelp",
|
||||
nullptr,
|
||||
nullptr));
|
||||
_widgets.back()->setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
template<uint N>
|
||||
void SettingsMenuScreen::textHandler(StaticLocationWidget &widget, const Common::Point &mousePos) {
|
||||
if (widget.isVisible()) {
|
||||
if (widget.isMouseInside(mousePos)) {
|
||||
widget.setTextColor(_textColorHovered);
|
||||
_widgets[N]->setVisible(true);
|
||||
} else {
|
||||
widget.setTextColor(_textColorDefault);
|
||||
_widgets[N]->setVisible(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SettingsMenuScreen::backHandler() {
|
||||
StarkUserInterface->backPrevScreen();
|
||||
}
|
||||
|
||||
} // End of namespace Stark
|
||||
@@ -0,0 +1,60 @@
|
||||
/* ResidualVM - A 3D game interpreter
|
||||
*
|
||||
* ResidualVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the AUTHORS
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef STARK_UI_MENU_SETTING_MENU_H
|
||||
#define STARK_UI_MENU_SETTING_MENU_H
|
||||
|
||||
#include "engines/stark/ui/menu/locationscreen.h"
|
||||
#include "engines/stark/services/services.h"
|
||||
#include "engines/advancedDetector.h"
|
||||
|
||||
namespace Stark {
|
||||
|
||||
/**
|
||||
* The setting menu of the game
|
||||
*/
|
||||
class SettingsMenuScreen : public StaticLocationScreen {
|
||||
public:
|
||||
SettingsMenuScreen(Gfx::Driver *gfx, Cursor *cursor);
|
||||
virtual ~SettingsMenuScreen();
|
||||
|
||||
// StaticLocationScreen API
|
||||
void open() override;
|
||||
|
||||
private:
|
||||
template<uint N>
|
||||
void textHandler(StaticLocationWidget &widget, const Common::Point &mousePos);
|
||||
|
||||
void backHandler();
|
||||
|
||||
private:
|
||||
static const uint32 _textColorHovered = 0xFF961E1E;
|
||||
static const uint32 _textColorDefault = 0xFF000000;
|
||||
|
||||
bool isDemo() {
|
||||
return StarkGameDescription->flags & ADGF_DEMO;
|
||||
}
|
||||
};
|
||||
|
||||
} // End of namespace Stark
|
||||
|
||||
#endif // STARK_UI_MENU_SETTING_MENU_H
|
||||
@@ -39,7 +39,8 @@ public:
|
||||
kScreenMainMenu,
|
||||
kScreenGame,
|
||||
kScreenFMV,
|
||||
kScreenDiaryIndex
|
||||
kScreenDiaryIndex,
|
||||
kScreenSettingsMenu
|
||||
};
|
||||
|
||||
explicit Screen(Name name) : _name(name) {};
|
||||
|
||||
Reference in New Issue
Block a user