Skip to content

Commit

Permalink
FULLPIPE: Initial support for Russian Demo. The demo starts
Browse files Browse the repository at this point in the history
  • Loading branch information
sev- committed Dec 11, 2016
1 parent df896e4 commit 817ca2a
Show file tree
Hide file tree
Showing 6 changed files with 275 additions and 5 deletions.
130 changes: 128 additions & 2 deletions engines/fullpipe/modal.cpp
Expand Up @@ -226,8 +226,7 @@ void ModalIntro::update() {
}

void ModalIntro::finish() {
if (!(g_fp->getFeatures() & ADGF_DEMO && g_fp->getLanguage() == Common::RU_RUS))
g_fp->_gameLoader->unloadScene(SC_INTRO2);
g_fp->_gameLoader->unloadScene(SC_INTRO2);

g_fp->_currentScene = g_fp->accessScene(SC_INTRO1);
g_fp->_gameLoader->preloadScene(SC_INTRO1, TrubaDown);
Expand All @@ -236,6 +235,133 @@ void ModalIntro::finish() {
g_fp->_gameLoader->updateSystems(42);
}

ModalIntroDemo::ModalIntroDemo() {
_field_8 = 0;
_countDown = 50;
_stillRunning = 0;
_introFlags = 9;
g_vars->sceneIntro_skipIntro = false;
_sfxVolume = g_fp->_sfxVolume;
}

ModalIntroDemo::~ModalIntroDemo() {
g_fp->stopAllSounds();
g_fp->_sfxVolume = _sfxVolume;
}

bool ModalIntroDemo::handleMessage(ExCommand *message) {
if (message->_messageKind != 17)
return false;

if (message->_messageNum != 36)
return false;

if (message->_param != 13 && message->_param != 27 && message->_param != 32)
return false;

if (_introFlags & 0x8) {
_countDown = 0;
g_vars->sceneIntro_needBlackout = true;
return true;
} else if (_stillRunning) {
g_vars->sceneIntro_playing = false;
g_vars->sceneIntro_needBlackout = true;
}

return true;
}

bool ModalIntroDemo::init(int counterdiff) {
if (!g_vars->sceneIntro_playing) {
if (!_stillRunning) {
finish();
return false;
}

if (_introFlags & 0x10)
g_fp->_gameLoader->updateSystems(42);

_introFlags |= 2;

return true;
}

if (_introFlags & 8) {
_countDown--;

if (_countDown > 0)
return true;

if (_stillRunning > 0) {
_introFlags |= 2;
return true;
}

_countDown = 150;
_introFlags = (_introFlags & 0xf7) | 0x21;
g_fp->accessScene(SC_INTRO1)->getPictureObjectById(522, 0)->_flags &= 0xfffb;
} else {
if (!(_introFlags & 0x20))
return true;

_countDown--;

if (_countDown > 0)
return true;

if (_stillRunning > 0) {
_introFlags |= 2;
return true;
}

_introFlags &= 0xDF;

g_vars->sceneIntro_playing = false;
_stillRunning = 0;
}

return true;
}

void ModalIntroDemo::update() {
if (g_fp->_currentScene) {
if (_introFlags & 1) {
if (g_vars->sceneIntro_needBlackout) {
g_fp->drawAlphaRectangle(0, 0, 800, 600, 0);
g_vars->sceneIntro_needBlackout = 0;
} else {
g_fp->sceneFade(g_fp->_currentScene, true);
}
_stillRunning = 255;
_introFlags &= 0xfe;

if (_introFlags & 0x20)
g_fp->playSound(SND_INTR_019, 0);
} else if (_introFlags & 2) {
if (g_vars->sceneIntro_needBlackout) {
g_fp->drawAlphaRectangle(0, 0, 800, 600, 0);
g_vars->sceneIntro_needBlackout = 0;
_stillRunning = 0;
_introFlags &= 0xfd;
} else {
g_fp->sceneFade(g_fp->_currentScene, false);
_stillRunning = 0;
_introFlags &= 0xfd;
}
} else if (_stillRunning) {
g_fp->_currentScene->draw();
}
}
}

void ModalIntroDemo::finish() {
g_fp->_currentScene = g_fp->accessScene(SC_INTRO1);
g_fp->_gameLoader->preloadScene(SC_INTRO1, TrubaDown);

if (g_fp->_currentScene)
g_fp->_gameLoader->updateSystems(42);
}

void ModalVideoPlayer::play(const char *filename) {
Video::AVIDecoder *aviDecoder = new Video::AVIDecoder();

Expand Down
20 changes: 20 additions & 0 deletions engines/fullpipe/modal.h
Expand Up @@ -78,6 +78,26 @@ class ModalIntro : public BaseModalObject {
void finish();
};

class ModalIntroDemo : public BaseModalObject {
int _field_8;
int _introFlags;
int _countDown;
int _stillRunning;
int _sfxVolume;

public:
ModalIntroDemo();
virtual ~ModalIntroDemo();

virtual bool pollEvent() { return true; }
virtual bool handleMessage(ExCommand *message);
virtual bool init(int counterdiff);
virtual void update();
virtual void saveload() {}

void finish();
};

class ModalVideoPlayer : public BaseModalObject {
public:

Expand Down
1 change: 1 addition & 0 deletions engines/fullpipe/module.mk
Expand Up @@ -27,6 +27,7 @@ MODULE_OBJS = \
statics.o \
utils.o \
scenes/sceneIntro.o \
scenes/sceneIntroDemo.o \
scenes/scene01.o \
scenes/scene02.o \
scenes/scene03.o \
Expand Down
19 changes: 16 additions & 3 deletions engines/fullpipe/scenes.cpp
Expand Up @@ -35,6 +35,8 @@
#include "fullpipe/scenes.h"
#include "fullpipe/interaction.h"

#include "engines/advancedDetector.h"

namespace Fullpipe {

Vars::Vars() {
Expand Down Expand Up @@ -616,12 +618,23 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) {
case SC_INTRO1:
sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_INTRO1");
scene->preloadMovements(sceneVar);
sceneIntro_initScene(scene);

if (!(g_fp->getFeatures() & ADGF_DEMO && g_fp->getLanguage() == Common::RU_RUS))
sceneIntro_initScene(scene);
else
sceneIntroDemo_initScene(scene);

_behaviorManager->initBehavior(scene, sceneVar);
scene->initObjectCursors("SC_INTRO1");
setSceneMusicParameters(sceneVar);
addMessageHandler(sceneHandlerIntro, 2);
_updateCursorCallback = sceneIntro_updateCursor;

if (!(g_fp->getFeatures() & ADGF_DEMO && g_fp->getLanguage() == Common::RU_RUS)) {
addMessageHandler(sceneHandlerIntro, 2);
_updateCursorCallback = sceneIntro_updateCursor;
} else {
addMessageHandler(sceneHandlerIntroDemo, 2);
_updateCursorCallback = sceneIntroDemo_updateCursor;
}
break;

case SC_1:
Expand Down
4 changes: 4 additions & 0 deletions engines/fullpipe/scenes.h
Expand Up @@ -41,6 +41,10 @@ int sceneIntro_updateCursor();
void sceneIntro_initScene(Scene *sc);
int sceneHandlerIntro(ExCommand *cmd);

int sceneIntroDemo_updateCursor();
void sceneIntroDemo_initScene(Scene *sc);
int sceneHandlerIntroDemo(ExCommand *cmd);

void scene01_fixEntrance();
void scene01_initScene(Scene *sc, int entrance);
int sceneHandler01(ExCommand *cmd);
Expand Down
106 changes: 106 additions & 0 deletions engines/fullpipe/scenes/sceneIntroDemo.cpp
@@ -0,0 +1,106 @@
/* 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 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 "fullpipe/fullpipe.h"

#include "fullpipe/constants.h"
#include "fullpipe/gameloader.h"
#include "fullpipe/motion.h"
#include "fullpipe/scenes.h"
#include "fullpipe/modal.h"
#include "fullpipe/statics.h"

namespace Fullpipe {

int sceneIntroDemo_updateCursor() {
g_fp->_cursorId = 0;

return 0;
}

void sceneIntroDemo_initScene(Scene *sc) {
g_vars->sceneIntro_needSleep = true;
g_vars->sceneIntro_needGetup = false;
g_vars->sceneIntro_playing = true;
g_vars->sceneIntro_needBlackout = false;

if (g_fp->_recordEvents || g_fp->_inputArFlag)
g_vars->sceneIntro_skipIntro = false;

g_fp->_modalObject = new ModalIntroDemo;
}

void sceneHandlerIntroDemo_part1() {
g_fp->_currentScene = g_fp->accessScene(SC_INTRO1);
chainQueue(QU_INTR_FINISH, 0);
}

void sceneHandlerIntroDemo_part2() {
chainQueue(QU_IN2_DO, 0);
}

int sceneHandlerIntroDemo(ExCommand *ex) {
if (ex->_messageKind != 17)
return 0;

switch (ex->_messageNum) {
case MSG_INTR_ENDINTRO:
g_vars->sceneIntro_playing = 0;
return 0;

case MSG_INTR_SWITCHTO1:
sceneHandlerIntroDemo_part1();
return 0;

case MSG_INTR_GETUPMAN:
g_vars->sceneIntro_needSleep = 0;
g_vars->sceneIntro_needGetup = 1;
return 0;

case MSG_INTR_SWITCHTO2:
sceneHandlerIntroDemo_part2();
return 0;

case 33:
// fall through
break;

default:
return 0;
}

if (g_vars->sceneIntro_needSleep) {
if (!g_vars->sceneIntro_aniin1man->_movement && g_vars->sceneIntro_aniin1man->_statics->_staticsId == ST_IN1MAN_SLEEP)
g_vars->sceneIntro_aniin1man->startAnim(MV_IN1MAN_SLEEP, 0, -1);
} else if (g_vars->sceneIntro_needGetup && !g_vars->sceneIntro_aniin1man->_movement &&
g_vars->sceneIntro_aniin1man->_statics->_staticsId == ST_IN1MAN_SLEEP) {
g_vars->sceneIntro_needGetup = 0;

chainQueue(QU_INTR_GETUPMAN, 0);
}

g_fp->startSceneTrack();

return 0;
}

} // End of namespace Fullpipe

0 comments on commit 817ca2a

Please sign in to comment.