FULLPIPE: Simplify demo check in the engine

This commit is contained in:
Eugene Sandulenko 2016-12-11 16:14:58 +01:00
parent a95be40dcd
commit 8f4a662b1d
7 changed files with 11 additions and 13 deletions

View File

@ -35,6 +35,10 @@ uint32 FullpipeEngine::getFeatures() const {
return _gameDescription->flags;
}
bool FullpipeEngine::isDemo() {
return _gameDescription->flags & ADGF_DEMO;
}
Common::Language FullpipeEngine::getLanguage() const {
return _gameDescription->language;
}

View File

@ -271,6 +271,7 @@ Common::Error FullpipeEngine::loadGameState(int slot) {
else
return Common::kUnknownError;
}
Common::Error FullpipeEngine::saveGameState(int slot, const Common::String &description) {
if (_gameLoader->writeSavegame(_currentScene, getSavegameFile(slot)))
return Common::kNoError;

View File

@ -113,6 +113,7 @@ public:
// Detection related functions
const ADGameDescription *_gameDescription;
uint32 getFeatures() const;
bool isDemo();
Common::Language getLanguage() const;
Common::RandomSource *_rnd;

View File

@ -35,8 +35,6 @@
#include "fullpipe/scenes.h"
#include "fullpipe/interaction.h"
#include "engines/advancedDetector.h"
namespace Fullpipe {
Vars::Vars() {
@ -619,7 +617,7 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) {
sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_INTRO1");
scene->preloadMovements(sceneVar);
if (!(g_fp->getFeatures() & ADGF_DEMO && g_fp->getLanguage() == Common::RU_RUS))
if (!(g_fp->isDemo() && g_fp->getLanguage() == Common::RU_RUS))
sceneIntro_initScene(scene);
else
sceneIntroDemo_initScene(scene);
@ -628,7 +626,7 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) {
scene->initObjectCursors("SC_INTRO1");
setSceneMusicParameters(sceneVar);
if (!(g_fp->getFeatures() & ADGF_DEMO && g_fp->getLanguage() == Common::RU_RUS)) {
if (!(g_fp->isDemo() && g_fp->getLanguage() == Common::RU_RUS)) {
addMessageHandler(sceneHandlerIntro, 2);
_updateCursorCallback = sceneIntro_updateCursor;
} else {

View File

@ -20,8 +20,6 @@
*
*/
#include "engines/advancedDetector.h"
#include "fullpipe/fullpipe.h"
#include "fullpipe/objects.h"
@ -412,7 +410,7 @@ void sceneHandler08_checkEndArcade() {
if (y < 80) {
sceneHandler08_finishArcade();
if (g_fp->getFeatures() & ADGF_DEMO && g_fp->getLanguage() == Common::DE_DEU) {
if (g_fp->isDemo() && g_fp->getLanguage() == Common::DE_DEU) {
ModalDemo *demo = new ModalDemo;
demo->launch();

View File

@ -33,8 +33,6 @@
#include "fullpipe/interaction.h"
#include "fullpipe/behavior.h"
#include "engines/advancedDetector.h"
namespace Fullpipe {
struct Hanger {
@ -465,7 +463,7 @@ int sceneHandler09(ExCommand *cmd) {
break;
case 367:
if (g_fp->getFeatures() & ADGF_DEMO && g_fp->getLanguage() == Common::RU_RUS) {
if (g_fp->isDemo() && g_fp->getLanguage() == Common::RU_RUS) {
g_fp->_needRestart = true;
return 0;
}

View File

@ -27,8 +27,6 @@
#include "common/list.h"
#include "common/memstream.h"
#include "engines/advancedDetector.h"
#include "graphics/thumbnail.h"
#include "fullpipe/objects.h"
@ -335,7 +333,7 @@ bool FullpipeEngine::loadGam(const char *fname, int scene) {
_gameLoader->loadScene(SC_INTRO1);
_gameLoader->gotoScene(SC_INTRO1, TrubaUp);
} else {
if (g_fp->getFeatures() & ADGF_DEMO && g_fp->getLanguage() == Common::RU_RUS) {
if (g_fp->isDemo() && g_fp->getLanguage() == Common::RU_RUS) {
_gameLoader->loadScene(SC_9);
_gameLoader->gotoScene(SC_9, TrubaDown);
} else {