MADS: Phantom: Implement Scene101::enter(), add some empty (new) engine functions

This commit is contained in:
Strangerke 2015-10-10 17:32:51 +02:00
parent 7fbbf51593
commit 3ffa01ec2a
15 changed files with 291 additions and 8 deletions

View 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 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 "mads/conversations.h"
#include "mads/mads.h"
namespace MADS {
GameConversation::GameConversation(MADSEngine *vm)
: _vm(vm) {
_restoreRunning = 0;
}
GameConversation::~GameConversation() {
}
void GameConversation::get(int id) {
warning("TODO GameConversation::get");
}
void GameConversation::run(int id) {
warning("TODO GameConversation::run");
}
void GameConversation::exportPointer(int *val) {
warning("TODO GameConversation::exportPointer");
}
} // End of namespace MADS

View file

@ -0,0 +1,54 @@
/* 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.
*
*/
#ifndef MADS_CONVERSATIONS_H
#define MADS_CONVERSATIONS_H
namespace MADS {
class MADSEngine;
class GameConversation {
private:
MADSEngine *_vm;
public:
/**
* Constructor
*/
GameConversation(MADSEngine *vm);
/**
* Destructor
*/
virtual ~GameConversation();
void get(int id);
void run(int id);
void exportPointer(int *val);
int _restoreRunning;
};
} // End of namespace MADS
#endif /* MADS_CONVERSATIONS_H */

View file

@ -52,6 +52,11 @@ DynamicHotspots::DynamicHotspots(MADSEngine *vm) : _vm(vm) {
_count = 0;
}
int DynamicHotspots::add(int descId, int verbId, int syntax, int seqIndex, const Common::Rect &bounds) {
warning("TODO: DynamicHotspots::add(5 params))");
return add(descId, verbId, seqIndex, bounds);
}
int DynamicHotspots::add(int descId, int verbId, int seqIndex, const Common::Rect &bounds) {
// Find a free slot
uint idx = 0;

View file

@ -56,6 +56,16 @@ public:
#define DYNAMIC_HOTSPOTS_SIZE 8
#define SYNTAX_SINGULAR 0
#define SYNTAX_PLURAL 1
#define SYNTAX_PARTITIVE 2
#define SYNTAX_SINGULAR_MASC 3
#define SYNTAX_SINGULAR_FEM 4
#define SYNTAX_SINGULAR_LIVING 5
#define SYNTAX_MASC_NOT_PROPER 6
#define SYNTAX_FEM_NOT_PROPER 7
#define MAX_SYNTAX 8
class DynamicHotspots {
private:
MADSEngine *_vm;
@ -68,6 +78,7 @@ public:
Common::Array<MADS::DynamicHotspot>::size_type size() const { return _entries.size(); }
DynamicHotspot &operator[](uint idx) { return _entries[idx]; }
int add(int descId, int verbId, int syntax, int seqIndex, const Common::Rect &bounds);
int add(int descId, int verbId, int seqIndex, const Common::Rect &bounds);
int setPosition(int index, const Common::Point &pos, Facing facing);
int setCursor(int index, CursorType cursor);

View file

@ -46,12 +46,14 @@ MADSEngine::MADSEngine(OSystem *syst, const MADSGameDescription *gameDesc) :
_musicFlag = true;
_soundFlag = true;
_dithering = false;
_disableFastwalk = false;
_debugger = nullptr;
_dialogs = nullptr;
_events = nullptr;
_font = nullptr;
_game = nullptr;
_gameConv = nullptr;
_palette = nullptr;
_resources = nullptr;
_sound = nullptr;
@ -65,6 +67,7 @@ MADSEngine::~MADSEngine() {
delete _font;
Font::deinit();
delete _game;
delete _gameConv;
delete _palette;
delete _resources;
delete _sound;
@ -96,6 +99,14 @@ void MADSEngine::initialize() {
_audio = new AudioPlayer(_mixer, getGameID());
_game = Game::init(this);
switch (getGameID()) {
case GType_RexNebular:
_gameConv = nullptr;
break;
default:
_gameConv = new GameConversation(this);
}
loadOptions();
_screen.empty();

View file

@ -30,6 +30,7 @@
#include "common/util.h"
#include "engines/engine.h"
#include "graphics/surface.h"
#include "mads/conversations.h"
#include "mads/debugger.h"
#include "mads/dialogs.h"
#include "mads/events.h"
@ -96,6 +97,7 @@ public:
EventsManager *_events;
Font *_font;
Game *_game;
GameConversation * _gameConv;
Palette *_palette;
Resources *_resources;
ScreenSurface _screen;
@ -108,6 +110,7 @@ public:
bool _musicFlag;
bool _soundFlag;
bool _dithering;
bool _disableFastwalk;
public:
MADSEngine(OSystem *syst, const MADSGameDescription *gameDesc);
virtual ~MADSEngine();

View file

@ -26,6 +26,7 @@ MODULE_OBJS := \
assets.o \
audio.o \
compression.o \
conversations.o \
debugger.o \
detection.o \
dialogs.o \

View file

@ -22,6 +22,7 @@
#include "common/scummsys.h"
#include "mads/mads.h"
#include "mads/conversations.h"
#include "mads/scene.h"
#include "mads/phantom/phantom_scenes.h"
#include "mads/phantom/phantom_scenes1.h"
@ -117,30 +118,129 @@ void Scene1xx::setPlayerSpritesPrefix() {
/*------------------------------------------------------------------------*/
Scene101::Scene101(MADSEngine *vm) : Scene1xx(vm) {
_execute_chan = -1;
_execute_wipe = -1;
_brie_calling_position = -1;
_brie_chandelier_position = -1;
_brie_calling_frame = -1;
_brie_chandelier_frame = -1;
_talk_count = -1;
_dynamic_brie = 0;
_dynamic_brie_2 = 0;
_start_walking = false;
_start_walking_0 = false;
_anim_0_running = false;
_anim_1_running = false;
_start_sitting_down = false;
}
void Scene101::synchronize(Common::Serializer &s) {
Scene1xx::synchronize(s);
s.syncAsSint16LE(_execute_chan);
s.syncAsSint16LE(_execute_wipe);
s.syncAsSint16LE(_brie_calling_position);
s.syncAsSint16LE(_brie_chandelier_position);
s.syncAsSint16LE(_brie_calling_frame);
s.syncAsSint16LE(_brie_chandelier_frame);
s.syncAsSint16LE(_talk_count);
s.syncAsSint16LE(_dynamic_brie);
s.syncAsSint16LE(_dynamic_brie_2);
s.syncAsByte(_start_walking);
s.syncAsByte(_start_walking_0);
s.syncAsByte(_anim_0_running);
s.syncAsByte(_anim_1_running);
s.syncAsByte(_start_sitting_down);
}
void Scene101::setup() {
setPlayerSpritesPrefix();
setAAName();
_scene->addActiveVocab(NOUN_MONSIEUR_BRIE);
}
void Scene101::enter() {
// TODO
_vm->_disableFastwalk = true;
if (_scene->_priorSceneId != RETURNING_FROM_DIALOG) {
_execute_chan = -1;
_execute_wipe = -1;
_start_walking = false;
_start_walking_0 = false;
_anim_0_running = true;
_anim_1_running = false;
_start_sitting_down = false;
}
// Load Dialogs
_vm->_gameConv->get(0);
_vm->_gameConv->get(1);
if (_globals[kCurrentYear] == 1993) {
_globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('z', -1));
// TODO
//_scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14);
_globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, 1);
_scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14);
} else {
// TODO
_scene->_hotspots.activate(NOUN_CHANDELIER, false);
}
// TODO
if (_globals[kBrieTalkStatus] == 0) {
_game._player.firstWalk(Common::Point(-20, 75), FACING_EAST, Common::Point(18, 79), FACING_EAST, true);
_brie_calling_position = 0;
_brie_chandelier_position = 3;
_game._player.setWalkTrigger(50);
_scene->loadAnimation(formAnimName('b', 9), 1, 1);
_scene->loadAnimation(formAnimName('b', 8), 1, 0);
_anim_0_running = true;
_anim_1_running = true;
_dynamic_brie = _scene->_dynamicHotspots.add(NOUN_MONSIEUR_BRIE, VERB_WALKTO, SYNTAX_SINGULAR_MASC, -1, Common::Rect(0, 0, 0, 0));
_scene->_dynamicHotspots[_dynamic_brie]._articleNumber = PREP_ON;
_scene->_dynamicHotspots.setPosition(_dynamic_brie, Common::Point(490, 119), FACING_NONE);
_scene->setDynamicAnim(_dynamic_brie, 0, 0);
_scene->setDynamicAnim(_dynamic_brie, 0, 1);
_scene->setDynamicAnim(_dynamic_brie, 0, 2);
_scene->setDynamicAnim(_dynamic_brie, 0, 3);
_scene->setDynamicAnim(_dynamic_brie, 0, 4);
_dynamic_brie_2 = _scene->_dynamicHotspots.add(NOUN_MONSIEUR_BRIE, VERB_WALKTO, SYNTAX_SINGULAR_MASC, -1, Common::Rect(0, 0, 0, 0));
_scene->_dynamicHotspots[_dynamic_brie_2]._articleNumber = PREP_ON;
_scene->_dynamicHotspots.setPosition(_dynamic_brie_2, Common::Point(25, 80), FACING_NONE);
_scene->setDynamicAnim(_dynamic_brie_2, 1, 1);
_scene->setDynamicAnim(_dynamic_brie_2, 1, 2);
_talk_count = 0;
} else if (_globals[kBrieTalkStatus] == 1) {
_scene->loadAnimation(formAnimName('b', 9), 1, 1);
_dynamic_brie = _scene->_dynamicHotspots.add(NOUN_MONSIEUR_BRIE, VERB_WALKTO, SYNTAX_SINGULAR_MASC, -1, Common::Rect(0, 0, 0, 0));
_scene->_dynamicHotspots[_dynamic_brie]._articleNumber = PREP_ON;
_scene->setDynamicAnim(_dynamic_brie, 1, 1);
_scene->setDynamicAnim(_dynamic_brie, 1, 2);
_anim_1_running = true;
_talk_count = 0;
_brie_chandelier_position = 3;
if (_vm->_gameConv->_restoreRunning == 1) {
_vm->_gameConv->run(1);
_vm->_gameConv->exportPointer(&_globals[kPlayerScore]);
_brie_chandelier_position = 4;
if (_scene->_animation[1])
_scene->_animation[1]->setCurrentFrame(25);
}
} else {
if (_scene->_priorSceneId == 202) {
if (_globals[kJacquesStatus] == 1)
_globals[kJacquesStatus] = 2;
_game._player.firstWalk(Common::Point(-20, 75), FACING_EAST, Common::Point(18, 79), FACING_EAST, true);
} else if ((_scene->_priorSceneId == 102) || (_scene->_priorSceneId != RETURNING_FROM_LOADING)) {
_game._player.firstWalk(Common::Point(655, 130), FACING_WEST, Common::Point(625, 127), FACING_WEST, true);
_scene->setCamera(Common::Point(320, 0));
}
}
sceneEntrySound();
}
void Scene101::step() {

View file

@ -55,8 +55,20 @@ public:
class Scene101 : public Scene1xx {
private:
// TODO
int _execute_chan;
int _execute_wipe;
int _brie_calling_position;
int _brie_chandelier_position;
int _brie_calling_frame;
int _brie_chandelier_frame;
int _talk_count;
int _dynamic_brie;
int _dynamic_brie_2;
bool _start_walking;
bool _start_walking_0;
bool _anim_0_running;
bool _anim_1_running;
bool _start_sitting_down;
public:
Scene101(MADSEngine *vm);
virtual void synchronize(Common::Serializer &s);

View file

@ -81,6 +81,8 @@ Player::Player(MADSEngine *vm)
_walkOffScreen = 0;
_walkOffScreenSceneId = -1;
_forcePrefix = false;
_commandsAllowed = false;
_enableAtTarget = false;
Common::fill(&_stopWalkerList[0], &_stopWalkerList[12], 0);
Common::fill(&_stopWalkerTrigger[0], &_stopWalkerTrigger[12], 0);
@ -798,4 +800,18 @@ void Player::removePlayerSprites() {
_visible = false;
}
void Player::firstWalk(Common::Point fromPos, Facing fromFacing, Common::Point destPos, Facing destFacing, bool enableFl) {
_playerPos = fromPos;
_facing = fromFacing;
walk(destPos, destFacing);
_walkAnywhere = true;
_commandsAllowed = false;
_enableAtTarget = enableFl;
}
void Player::setWalkTrigger(int val) {
warning("TODO: Player::setWalkTrigger");
}
} // End of namespace MADS

View file

@ -134,6 +134,8 @@ public:
bool _forcePrefix;
bool _needToWalk;
bool _readyToWalk;
bool _commandsAllowed;
bool _enableAtTarget;
int _stopWalkerIndex;
int _centerOfGravity;
int _currentDepth;
@ -222,6 +224,10 @@ public:
}
void removePlayerSprites();
void firstWalk(Common::Point fromPos, Facing fromFacing, Common::Point destPos, Facing destFacing, bool enableFl);
void setWalkTrigger(int val);
};
} // End of namespace MADS

View file

@ -744,4 +744,11 @@ void Scene::synchronize(Common::Serializer &s) {
_dynamicHotspots.synchronize(s);
}
void Scene::setDynamicAnim(int id, int anim_id, int segment) {
warning("TODO: Scene::setDynamicAnim");
}
void Scene::setCamera(Common::Point pos) {
warning("TODO: Scene::setCamera");
}
} // End of namespace MADS

View file

@ -248,6 +248,9 @@ public:
* Synchronize the game
*/
void synchronize(Common::Serializer &s);
void setDynamicAnim(int id, int anim_id, int segment);
void setCamera(Common::Point pos);
};
} // End of namespace MADS

View file

@ -550,4 +550,9 @@ void SequenceList::setMotion(int seqIndex, int flags, int deltaX, int deltaY) {
se._posAccum.x = se._posAccum.y = 0;
}
int SequenceList::addStampCycle(int srcSpriteIdx, bool flipped, int sprite) {
warning("TODO: SequenceList::addStampCycle");
return -1;
}
} // End of namespace

View file

@ -125,6 +125,8 @@ public:
void setMsgLayout(int seqIndex);
void setDone(int seqIndex);
void setMotion(int seqIndex, int flags, int deltaX, int deltaY);
int addStampCycle(int srcSpriteIdx, bool flipped, int sprite);
};
} // End of namespace MADS