Plug in Puzzle. Now it consists mainly of stubs but neverthless lets skip

the Puzzle and continue game pretending like you completed the Puzzle.

svn-id: r18225
This commit is contained in:
Eugene Sandulenko 2005-05-23 02:23:34 +00:00
parent b9e8e40805
commit 0ccb1b726b
14 changed files with 179 additions and 25 deletions

View file

@ -1298,13 +1298,19 @@ void Actor::drawActors() {
}
}
// draw speeches
drawSpeech();
}
void Actor::drawSpeech(void) {
if (isSpeaking() && _activeSpeech.playing && !_vm->_script->_skipSpeeches) {
int i;
int textDrawFlags;
char oneChar[2];
oneChar[1] = 0;
const char *outputString;
SURFACE *back_buf;
back_buf = _vm->_gfx->getBackBuffer();
if (_activeSpeech.speechFlags & kSpeakSlow) {
outputString = oneChar;

View file

@ -471,6 +471,8 @@ public:
void drawActors();
void updateActorsScene(int actorsEntrance); // calls from scene loading to update Actors info
void drawSpeech();
void drawPathTest();
uint16 hitTest(const Point &testPoint, bool skipProtagonist);

View file

@ -30,6 +30,7 @@
#include "saga/font.h"
#include "saga/objectmap.h"
#include "saga/itedata.h"
#include "saga/puzzle.h"
#include "saga/rscfile_mod.h"
#include "saga/scene.h"
#include "saga/script.h"
@ -302,7 +303,8 @@ bool Interface::processKeyCode(int keyCode) {
switch (keyCode) {
case 'x':
setMode(kPanelMain);
// FIXME: puzzle
if (_vm->_puzzle->isActive())
_vm->_puzzle->exitPuzzle();
break;
case 'u':
@ -1124,7 +1126,8 @@ void Interface::converseSetPos(int key) {
_vm->_script->finishDialog(ct->replyId, ct->replyFlags, ct->replyBit);
// FIXME: TODO: Puzzle
if (_vm->_puzzle->isActive())
_vm->_puzzle->handleReply(ct->replyId);
_conversePos = -1;
}

View file

@ -16,6 +16,7 @@ MODULE_OBJS := \
saga/ite_introproc.o \
saga/itedata.o \
saga/objectmap.o \
saga/puzzle.o \
saga/palanim.o \
saga/render.o \
saga/rscfile.o \

68
saga/puzzle.cpp Normal file
View file

@ -0,0 +1,68 @@
/* ScummVM - Scumm Interpreter
* Copyright (C) 2005 The ScummVM project
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header$
*
*/
#include "saga/saga.h"
#include "saga/interface.h"
#include "saga/scene.h"
#include "saga/puzzle.h"
#include "saga/resnames.h"
#include "common/timer.h"
namespace Saga {
Puzzle::Puzzle(SagaEngine *vm) : _vm(vm), _solved(false), _active(false) {
}
void Puzzle::execute(void) {
_active = true;
Common::g_timer->installTimerProc(&hintTimerCallback, ticksToMSec(30), this);
_solved = true; // Cheat
exitPuzzle();
}
void Puzzle::exitPuzzle(void) {
_active = false;
Common::g_timer->removeTimerProc(&hintTimerCallback);
_vm->_scene->changeScene(ITE_SCENE_LODGE, 0, kTransitionNoFade);
_vm->_interface->setMode(kPanelMain);
}
void Puzzle::hintTimerCallback(void *refCon) {
((Puzzle *)refCon)->hintTimer();
}
void Puzzle::hintTimer(void) {
}
void Puzzle::handleReply(int reply) {
}
void Puzzle::movePiece(Point mousePt) {
}
} // End of namespace Saga

55
saga/puzzle.h Normal file
View file

@ -0,0 +1,55 @@
/* ScummVM - Scumm Interpreter
* Copyright (C) 2005 The ScummVM project
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header$
*
*/
#ifndef SAGA_PUZZLE_H_
#define SAGA_PUZZLE_H_
namespace Saga {
class Puzzle {
private:
SagaEngine *_vm;
bool _solved;
bool _active;
public:
Puzzle(SagaEngine *vm);
void execute(void);
void exitPuzzle(void);
bool isSolved(void) { return _solved; }
bool isActive(void) { return _active; }
void handleReply(int reply);
void movePiece(Point mousePt);
private:
static void hintTimerCallback(void *refCon);
void hintTimer(void);
};
} // End of namespace Saga
#endif

View file

@ -24,17 +24,16 @@
// Main rendering loop
#include "saga/saga.h"
#include "saga/gfx.h"
#include "saga/actor.h"
#include "saga/font.h"
#include "saga/gfx.h"
#include "saga/interface.h"
#include "saga/objectmap.h"
#include "saga/puzzle.h"
#include "saga/render.h"
#include "saga/scene.h"
#include "saga/text.h"
#include "saga/objectmap.h"
#include "saga/render.h"
#include "common/timer.h"
#include "common/system.h"
@ -119,6 +118,12 @@ int Render::drawScene() {
if (_vm->_interface->getMode() != kPanelFade) {
// Draw queued actors
_vm->_actor->drawActors();
if (_vm->_puzzle->isActive()) {
_vm->_puzzle->movePiece(mouse_pt);
_vm->_actor->drawSpeech();
}
if (getFlags() & RF_OBJECTMAP_TEST) {
if (_vm->_scene->_objectMap)
_vm->_scene->_objectMap->draw(backbuf_surface, mouse_pt, kITEColorBrightWhite, kITEColorBlack);

View file

@ -45,6 +45,8 @@ namespace Saga {
// SCENES
#define ITE_SCENE_INV -1
#define ITE_SCENE_PUZZLE 26
#define ITE_SCENE_LODGE 21
#define ITE_DEFAULT_SCENE 32
#define IHNM_DEFAULT_SCENE 152

View file

@ -44,6 +44,7 @@
#include "saga/font.h"
#include "saga/interface.h"
#include "saga/isomap.h"
#include "saga/puzzle.h"
#include "saga/script.h"
#include "saga/scene.h"
#include "saga/sndres.h"
@ -138,6 +139,7 @@ SagaEngine::SagaEngine(GameDetector *detector, OSystem *syst)
_render = NULL;
_music = NULL;
_sound = NULL;
_puzzle = NULL;
// The Linux version of Inherit the Earth puts all data files in an
@ -170,6 +172,7 @@ SagaEngine::~SagaEngine() {
_scene->endScene();
}
delete _puzzle;
delete _sndRes;
delete _events;
delete _font;
@ -234,6 +237,7 @@ int SagaEngine::init(GameDetector &detector) {
_palanim = new PalAnim(this);
_scene = new Scene(this);
_isoMap = new IsoMap(this);
_puzzle = new Puzzle(this);
if (!_scene->initialized()) {
warning("Couldn't initialize scene module");
@ -245,7 +249,7 @@ int SagaEngine::init(GameDetector &detector) {
_previousTicks = _system->getMillis();
// Initialize graphics
_gfx = new Gfx(_system, _vm->getDisplayWidth(), _vm->getDisplayHeight(), detector);
_gfx = new Gfx(_system, getDisplayWidth(), getDisplayHeight(), detector);
// Graphics driver should be initialized before console
_console = new Console(this);
@ -319,10 +323,14 @@ int SagaEngine::go() {
msec = MAX_TIME_DELTA;
}
if (!_vm->_scene->isInDemo() && getGameType() == GType_ITE)
if (_vm->_interface->getMode() == kPanelMain ||
_vm->_interface->getMode() == kPanelConverse ||
_vm->_interface->getMode() == kPanelNull)
// Since Puzzle is actorless, we do it here
if (_puzzle->isActive())
_actor->handleSpeech(msec);
if (!_scene->isInDemo() && getGameType() == GType_ITE)
if (_interface->getMode() == kPanelMain ||
_interface->getMode() == kPanelConverse ||
_interface->getMode() == kPanelNull)
_actor->direct(msec);
_events->handleEvents(msec);
@ -383,8 +391,8 @@ const char *SagaEngine::getObjectName(uint16 objectId) {
return _actor->_actorsStrings.getString(actor->nameIndex);
break;
case kGameObjectHitZone:
hitZone = _vm->_scene->_objectMap->getHitZone(objectIdToIndex(objectId));
return _vm->_scene->_sceneStrings.getString(hitZone->getNameIndex());
hitZone = _scene->_objectMap->getHitZone(objectIdToIndex(objectId));
return _scene->_sceneStrings.getString(hitZone->getNameIndex());
}
warning("SagaEngine::getObjectName name not found for 0x%X", objectId);
return NULL;
@ -392,7 +400,7 @@ const char *SagaEngine::getObjectName(uint16 objectId) {
const char *SagaEngine::getTextString(int textStringId) {
const char *string;
int lang = _vm->getFeatures() & GF_LANG_DE ? 1 : 0;
int lang = getFeatures() & GF_LANG_DE ? 1 : 0;
string = interfaceTextStrings[lang][textStringId];
if (!string)

View file

@ -55,6 +55,7 @@ class Interface;
class Console;
class Events;
class PalAnim;
class Puzzle;
#define MIN_IMG_RLECODE 3
#define MODEX_SCANLINE_LIMIT 200
@ -482,6 +483,7 @@ public:
Console *_console;
Events *_events;
PalAnim *_palanim;
Puzzle *_puzzle;
/** Random number generator */

View file

@ -32,6 +32,7 @@
#include "saga/isomap.h"
#include "saga/objectmap.h"
#include "saga/palanim.h"
#include "saga/puzzle.h"
#include "saga/render.h"
#include "saga/rscfile_mod.h"
#include "saga/script.h"
@ -620,9 +621,12 @@ void Scene::loadScene(LoadSceneParams *loadSceneParams) {
// We probably don't want "followers" to go into scene -1 , 0. At the very
// least we don't want garbage to be drawn that early in the ITE intro.
if (_sceneNumber > 0)
if (_sceneNumber > 0 && _sceneNumber != ITE_SCENE_PUZZLE)
_vm->_actor->updateActorsScene(loadSceneParams->actorsEntrance);
if (_sceneNumber == ITE_SCENE_PUZZLE)
_vm->_puzzle->execute();
if (_sceneDescription.flags & kSceneFlagShowCursor)
_vm->_interface->activate();

View file

@ -120,7 +120,7 @@ struct SceneEntryList {
const SceneEntry * getEntry(int index) {
if ((index < 0) || (index >= entryListCount)) {
error("SceneEntryList::getEntry wrong index");
error("SceneEntryList::getEntry wrong index (%d)", index);
}
return &entryList[index];
}

View file

@ -530,7 +530,7 @@ private:
void SF_tossRif(SCRIPTFUNC_PARAMS);
void SF_showControls(SCRIPTFUNC_PARAMS);
void SF_showMap(SCRIPTFUNC_PARAMS);
void SF_puzzleWon(SCRIPTFUNC_PARAMS);
void sfPuzzleWon(SCRIPTFUNC_PARAMS);
void sfEnableEscape(SCRIPTFUNC_PARAMS);
void sfPlaySound(SCRIPTFUNC_PARAMS);
void SF_playLoopedSound(SCRIPTFUNC_PARAMS);

View file

@ -34,6 +34,7 @@
#include "saga/interface.h"
#include "saga/music.h"
#include "saga/itedata.h"
#include "saga/puzzle.h"
#include "saga/render.h"
#include "saga/sound.h"
#include "saga/sndres.h"
@ -118,7 +119,7 @@ void Script::setupScriptFuncList(void) {
OPCODE(SF_tossRif),
OPCODE(SF_showControls),
OPCODE(SF_showMap),
OPCODE(SF_puzzleWon),
OPCODE(sfPuzzleWon),
OPCODE(sfEnableEscape),
OPCODE(sfPlaySound),
OPCODE(SF_playLoopedSound),
@ -1501,11 +1502,8 @@ void Script::SF_showMap(SCRIPTFUNC_PARAMS) {
}
// Script function #68 (0x44)
void Script::SF_puzzleWon(SCRIPTFUNC_PARAMS) {
for (int i = 0; i < nArgs; i++)
thread->pop();
debug(0, "STUB: SF_puzzleWon(), %d args", nArgs);
void Script::sfPuzzleWon(SCRIPTFUNC_PARAMS) {
thread->_returnValue = _vm->_puzzle->isSolved();
}
// Script function #69 (0x45)