STARK: Implement NewGame and some small fixing
This commit is contained in:
parent
4bf241d399
commit
842887006a
6 changed files with 75 additions and 2 deletions
|
@ -26,6 +26,8 @@
|
|||
#include "common/singleton.h"
|
||||
#include "common/scummsys.h"
|
||||
|
||||
struct ADGameDescription;
|
||||
|
||||
namespace Common {
|
||||
class RandomSource;
|
||||
}
|
||||
|
@ -79,6 +81,7 @@ public:
|
|||
GameInterface *gameInterface;
|
||||
UserInterface *userInterface;
|
||||
FontProvider *fontProvider;
|
||||
const ADGameDescription *gameDescription;
|
||||
};
|
||||
|
||||
/** Shortcuts for accessing the services. */
|
||||
|
@ -94,6 +97,7 @@ public:
|
|||
#define StarkGameInterface StarkServices::instance().gameInterface
|
||||
#define StarkUserInterface StarkServices::instance().userInterface
|
||||
#define StarkFontProvider StarkServices::instance().fontProvider
|
||||
#define StarkGameDescription StarkServices::instance().gameDescription
|
||||
|
||||
} // End of namespace Stark
|
||||
|
||||
|
|
|
@ -64,6 +64,7 @@ UserInterface::~UserInterface() {
|
|||
delete _fmvScreen;
|
||||
delete _diaryIndexScreen;
|
||||
delete _cursor;
|
||||
delete _mainMenuScreen;
|
||||
}
|
||||
|
||||
void UserInterface::init() {
|
||||
|
|
|
@ -138,6 +138,7 @@ Common::Error StarkEngine::run() {
|
|||
services.gameInterface = _gameInterface;
|
||||
services.userInterface = _userInterface;
|
||||
services.fontProvider = _fontProvider;
|
||||
services.gameDescription = _gameDescription;
|
||||
|
||||
// Load global resources
|
||||
_resourceProvider->initGlobal();
|
||||
|
|
|
@ -180,6 +180,9 @@ void StaticLocationWidget::onClick() {
|
|||
_soundMouseClick->play();
|
||||
}
|
||||
|
||||
// Ensure the click sound is played completely
|
||||
while (_soundMouseClick->isPlaying()) {};
|
||||
|
||||
if (_onClick) {
|
||||
(*_onClick)();
|
||||
}
|
||||
|
|
|
@ -1,4 +1,28 @@
|
|||
/* 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/mainmenu.h"
|
||||
#include "engines/stark/services/userinterface.h"
|
||||
#include "engines/stark/services/resourceprovider.h"
|
||||
|
||||
namespace Stark {
|
||||
|
||||
|
@ -20,7 +44,7 @@ void MainMenuScreen::open() {
|
|||
|
||||
_widgets.push_back(new StaticLocationWidget(
|
||||
"NewGame",
|
||||
nullptr,
|
||||
CLICK_HANDLER(MainMenuScreen, newGameHandler),
|
||||
MOVE_HANDLER(MainMenuScreen, helpTextHandler<7>)));
|
||||
_widgets.back()->setupSounds(0, 1);
|
||||
|
||||
|
@ -108,4 +132,14 @@ void MainMenuScreen::helpTextHandler(StaticLocationWidget &widget, const Common:
|
|||
}
|
||||
}
|
||||
|
||||
void MainMenuScreen::newGameHandler() {
|
||||
StarkUserInterface->changeScreen(kScreenGame);
|
||||
|
||||
if (isDemo()) {
|
||||
StarkResourceProvider->requestLocationChange(0x4f, 0x00);
|
||||
} else {
|
||||
StarkResourceProvider->requestLocationChange(0x45, 0x00);
|
||||
}
|
||||
}
|
||||
|
||||
} // End of namespace Stark
|
|
@ -1,7 +1,31 @@
|
|||
/* 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_MAIN_MENU_H
|
||||
#define STARK_UI_MENU_MAIN_MENU_H
|
||||
|
||||
#include "engines/stark/ui/menu/locationscreen.h"
|
||||
#include "engines/stark/services/services.h"
|
||||
#include "engines/advancedDetector.h"
|
||||
|
||||
namespace Stark {
|
||||
|
||||
|
@ -14,11 +38,17 @@ public:
|
|||
virtual ~MainMenuScreen();
|
||||
|
||||
// StaticLocationScreen API
|
||||
void open();
|
||||
void open() override;
|
||||
|
||||
private:
|
||||
template<uint N>
|
||||
void helpTextHandler(StaticLocationWidget &widget, const Common::Point &mousePos);
|
||||
|
||||
void newGameHandler();
|
||||
|
||||
bool isDemo() {
|
||||
return StarkGameDescription->flags & ADGF_DEMO;
|
||||
}
|
||||
};
|
||||
|
||||
} // End of namespace Stark
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue