2014-03-08 22:54:34 +01:00
|
|
|
/* 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 "illusions/illusions.h"
|
2014-03-10 11:50:35 +01:00
|
|
|
#include "illusions/resourcesystem.h"
|
2014-03-10 13:12:21 +01:00
|
|
|
#include "illusions/backgroundresource.h"
|
2014-03-10 17:49:08 +01:00
|
|
|
#include "illusions/camera.h"
|
2014-03-10 14:56:55 +01:00
|
|
|
#include "illusions/graphics.h"
|
2014-03-10 17:49:08 +01:00
|
|
|
#include "illusions/input.h"
|
2014-03-11 12:10:31 +01:00
|
|
|
#include "illusions/updatefunctions.h"
|
2014-03-11 16:41:40 +01:00
|
|
|
#include "illusions/actor.h"
|
2014-03-12 16:55:42 +01:00
|
|
|
#include "illusions/actorresource.h"
|
2014-03-13 10:05:22 +01:00
|
|
|
#include "illusions/thread.h"
|
2014-03-17 12:57:39 +01:00
|
|
|
#include "illusions/screen.h"
|
2014-03-13 11:54:56 +01:00
|
|
|
#include "illusions/scriptresource.h"
|
2014-03-13 14:31:02 +01:00
|
|
|
#include "illusions/scriptman.h"
|
2014-03-15 21:57:51 +01:00
|
|
|
#include "illusions/time.h"
|
2014-03-18 11:41:14 +01:00
|
|
|
#include "illusions/dictionary.h"
|
2014-03-08 22:54:34 +01:00
|
|
|
|
|
|
|
#include "audio/audiostream.h"
|
|
|
|
#include "common/config-manager.h"
|
|
|
|
#include "common/debug-channels.h"
|
|
|
|
#include "common/error.h"
|
|
|
|
#include "common/fs.h"
|
|
|
|
#include "common/timer.h"
|
|
|
|
#include "engines/util.h"
|
|
|
|
#include "graphics/cursorman.h"
|
|
|
|
#include "graphics/font.h"
|
|
|
|
#include "graphics/fontman.h"
|
|
|
|
#include "graphics/palette.h"
|
|
|
|
#include "graphics/surface.h"
|
|
|
|
|
|
|
|
namespace Illusions {
|
|
|
|
|
|
|
|
IllusionsEngine::IllusionsEngine(OSystem *syst, const ADGameDescription *gd) :
|
|
|
|
Engine(syst), _gameDescription(gd) {
|
|
|
|
|
|
|
|
_random = new Common::RandomSource("illusions");
|
|
|
|
|
|
|
|
Engine::syncSoundSettings();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
IllusionsEngine::~IllusionsEngine() {
|
|
|
|
|
|
|
|
delete _random;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Common::Error IllusionsEngine::run() {
|
|
|
|
|
2014-03-10 13:12:21 +01:00
|
|
|
// Init search paths
|
|
|
|
const Common::FSNode gameDataDir(ConfMan.get("path"));
|
|
|
|
SearchMan.addSubDirectoryMatching(gameDataDir, "music");
|
|
|
|
SearchMan.addSubDirectoryMatching(gameDataDir, "resource");
|
|
|
|
SearchMan.addSubDirectoryMatching(gameDataDir, "resrem");
|
|
|
|
SearchMan.addSubDirectoryMatching(gameDataDir, "savegame");
|
|
|
|
SearchMan.addSubDirectoryMatching(gameDataDir, "sfx");
|
|
|
|
SearchMan.addSubDirectoryMatching(gameDataDir, "video");
|
|
|
|
SearchMan.addSubDirectoryMatching(gameDataDir, "voice");
|
|
|
|
|
2014-03-08 22:54:34 +01:00
|
|
|
Graphics::PixelFormat pixelFormat16(2, 5, 6, 5, 0, 11, 5, 0, 0);
|
|
|
|
initGraphics(640, 480, true, &pixelFormat16);
|
2014-03-10 13:12:21 +01:00
|
|
|
|
2014-03-18 11:41:14 +01:00
|
|
|
_dict = new Dictionary();
|
|
|
|
|
2014-03-10 13:12:21 +01:00
|
|
|
_resSys = new ResourceSystem();
|
2014-03-12 16:55:42 +01:00
|
|
|
_resSys->addResourceLoader(0x00060000, new ActorResourceLoader(this));
|
2014-03-13 11:54:56 +01:00
|
|
|
_resSys->addResourceLoader(0x000D0000, new ScriptResourceLoader(this));
|
2014-03-12 16:55:42 +01:00
|
|
|
_resSys->addResourceLoader(0x00100000, new ActorResourceLoader(this));
|
2014-03-10 13:12:21 +01:00
|
|
|
_resSys->addResourceLoader(0x00110000, new BackgroundResourceLoader(this));
|
2014-03-12 16:55:42 +01:00
|
|
|
|
2014-03-18 10:59:28 +01:00
|
|
|
_screen = new Screen(this);
|
2014-03-14 18:52:25 +01:00
|
|
|
_input = new Input();
|
|
|
|
_scriptMan = new ScriptMan(this);
|
2014-03-13 19:55:25 +01:00
|
|
|
_actorItems = new ActorItems(this);
|
2014-03-11 17:36:10 +01:00
|
|
|
_backgroundItems = new BackgroundItems(this);
|
2014-03-11 19:54:22 +01:00
|
|
|
_camera = new Camera(this);
|
2014-03-10 13:12:21 +01:00
|
|
|
|
2014-03-13 19:55:25 +01:00
|
|
|
#if 0
|
2014-03-13 11:54:56 +01:00
|
|
|
// ActorResource test
|
2014-03-12 16:55:42 +01:00
|
|
|
_resSys->loadResource(0x00100006, 0, 0);
|
2014-03-13 19:55:25 +01:00
|
|
|
#endif
|
2014-03-10 14:56:55 +01:00
|
|
|
|
2014-03-15 17:54:59 +01:00
|
|
|
#if 1
|
2014-03-13 11:54:56 +01:00
|
|
|
// BackgroundResource test
|
2014-03-15 21:57:51 +01:00
|
|
|
_resSys->loadResource(0x00110007, 0, 0);
|
2014-03-11 17:36:10 +01:00
|
|
|
BackgroundItem *backgroundItem = _backgroundItems->debugFirst();
|
2014-03-15 17:54:59 +01:00
|
|
|
_system->copyRectToScreen((byte*)backgroundItem->_surfaces[0]->getBasePtr(0, 0), backgroundItem->_surfaces[0]->pitch, 0, 0, 640, 480);
|
2014-03-10 14:56:55 +01:00
|
|
|
_system->updateScreen();
|
2014-03-15 21:57:51 +01:00
|
|
|
_camera->panToPoint(Common::Point(800, 0), 500, 0);
|
2014-03-15 17:54:59 +01:00
|
|
|
while (!shouldQuit()) {
|
2014-03-15 21:57:51 +01:00
|
|
|
//debug("panPoints[0] = %d, %d", backgroundItem->_panPoints[0].x, backgroundItem->_panPoints[0].y);
|
|
|
|
uint32 t = getCurrentTime();
|
|
|
|
//debug("t = %d", t);
|
|
|
|
_camera->update(t);
|
|
|
|
_system->delayMillis(10);
|
|
|
|
_system->copyRectToScreen((byte*)backgroundItem->_surfaces[0]->getBasePtr(backgroundItem->_panPoints[0].x, 0),
|
|
|
|
backgroundItem->_surfaces[0]->pitch, 0, 0, 640, 480);
|
|
|
|
_system->updateScreen();
|
2014-03-15 17:54:59 +01:00
|
|
|
updateEvents();
|
|
|
|
}
|
2014-03-13 19:55:25 +01:00
|
|
|
#endif
|
2014-03-13 11:54:56 +01:00
|
|
|
|
2014-03-15 17:54:59 +01:00
|
|
|
#if 0
|
2014-03-13 11:54:56 +01:00
|
|
|
// ScriptResource test
|
|
|
|
_resSys->loadResource(0x000D0001, 0, 0);
|
2014-03-13 19:55:25 +01:00
|
|
|
|
|
|
|
_scriptMan->startScriptThread(0x00020004, 0, 0, 0, 0);
|
|
|
|
|
|
|
|
while (!shouldQuit()) {
|
|
|
|
updateEvents();
|
|
|
|
_scriptMan->_threads->updateThreads();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
2014-03-08 22:54:34 +01:00
|
|
|
|
2014-03-11 19:54:22 +01:00
|
|
|
delete _camera;
|
2014-03-11 17:36:10 +01:00
|
|
|
delete _backgroundItems;
|
2014-03-12 16:55:42 +01:00
|
|
|
delete _actorItems;
|
2014-03-13 19:55:25 +01:00
|
|
|
delete _scriptMan;
|
2014-03-14 18:52:25 +01:00
|
|
|
delete _input;
|
2014-03-17 12:57:39 +01:00
|
|
|
delete _screen;
|
2014-03-10 13:12:21 +01:00
|
|
|
delete _resSys;
|
2014-03-18 11:41:14 +01:00
|
|
|
delete _dict;
|
2014-03-10 13:12:21 +01:00
|
|
|
|
2014-03-08 22:54:34 +01:00
|
|
|
return Common::kNoError;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool IllusionsEngine::hasFeature(EngineFeature f) const {
|
|
|
|
return
|
|
|
|
false;
|
|
|
|
/*
|
|
|
|
(f == kSupportsRTL) ||
|
|
|
|
(f == kSupportsLoadingDuringRuntime) ||
|
|
|
|
(f == kSupportsSavingDuringRuntime);
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
|
|
|
|
void IllusionsEngine::updateEvents() {
|
|
|
|
Common::Event event;
|
|
|
|
|
|
|
|
while (_eventMan->pollEvent(event)) {
|
|
|
|
switch (event.type) {
|
|
|
|
case Common::EVENT_KEYDOWN:
|
|
|
|
break;
|
|
|
|
case Common::EVENT_KEYUP:
|
|
|
|
break;
|
|
|
|
case Common::EVENT_MOUSEMOVE:
|
|
|
|
break;
|
|
|
|
case Common::EVENT_LBUTTONDOWN:
|
|
|
|
break;
|
|
|
|
case Common::EVENT_LBUTTONUP:
|
|
|
|
break;
|
|
|
|
case Common::EVENT_RBUTTONDOWN:
|
|
|
|
break;
|
|
|
|
case Common::EVENT_RBUTTONUP:
|
|
|
|
break;
|
|
|
|
case Common::EVENT_QUIT:
|
|
|
|
quitGame();
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-12 13:14:22 +01:00
|
|
|
Common::Point *IllusionsEngine::getObjectActorPositionPtr(uint32 objectId) {
|
|
|
|
// TODO Dummy, to be replaced later
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-03-14 18:52:25 +01:00
|
|
|
Control *IllusionsEngine::findControl(uint32 objectId) {
|
|
|
|
// TODO Dummy, to be replaced later
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-03-18 10:59:28 +01:00
|
|
|
void IllusionsEngine::notifyThreadId(uint32 &threadId) {
|
|
|
|
if (threadId) {
|
|
|
|
uint32 tempThreadId = threadId;
|
|
|
|
threadId = 0;
|
|
|
|
_scriptMan->_threads->notifyId(tempThreadId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
FramesList *IllusionsEngine::findSequenceFrames(Sequence *sequence) {
|
|
|
|
// TODO Dummy, to be replaced later
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void IllusionsEngine::setCursorControl(Control *control) {
|
|
|
|
// TODO Dummy, to be replaced later
|
|
|
|
}
|
|
|
|
|
|
|
|
void IllusionsEngine::placeCursor(Control *control, uint32 sequenceId) {
|
|
|
|
// TODO Dummy, to be replaced later
|
|
|
|
}
|
|
|
|
|
|
|
|
bool IllusionsEngine::showCursor() {
|
|
|
|
// TODO Dummy, to be replaced later
|
|
|
|
// TODO ++cursor._visibleCtr;
|
|
|
|
// TODO if (cursor._visibleCtr > 0)
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool IllusionsEngine::hideCursor() {
|
|
|
|
// TODO Dummy, to be replaced later
|
|
|
|
// TODO --cursor._visibleCtr;
|
|
|
|
// TODO if (cursor.visibleCtr <= 0)
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2014-03-08 22:54:34 +01:00
|
|
|
} // End of namespace Illusions
|