ASYLUM: Removed the ScriptManager. The singleton functionality is rolled into the actionlist class (where it belongs)
git-svn-id: http://asylumengine.googlecode.com/svn/trunk@348 0bfb4aae-4ea4-11de-8d8d-752d95cf3e3c
This commit is contained in:
parent
2cb80c6d8d
commit
b4385f8e9e
12 changed files with 1293 additions and 1412 deletions
File diff suppressed because it is too large
Load diff
|
@ -29,10 +29,14 @@
|
||||||
#include "common/array.h"
|
#include "common/array.h"
|
||||||
#include "common/stream.h"
|
#include "common/stream.h"
|
||||||
|
|
||||||
|
#include "asylum/scene.h"
|
||||||
|
|
||||||
namespace Asylum {
|
namespace Asylum {
|
||||||
|
|
||||||
#define MAX_ACTION_COMMANDS 161
|
#define MAX_ACTION_COMMANDS 161
|
||||||
|
|
||||||
|
class Scene;
|
||||||
|
|
||||||
typedef struct ActionCommand {
|
typedef struct ActionCommand {
|
||||||
uint32 numLines; // Only set on the first line of each script
|
uint32 numLines; // Only set on the first line of each script
|
||||||
uint32 opcode;
|
uint32 opcode;
|
||||||
|
@ -58,7 +62,7 @@ typedef struct ActionDefinitions {
|
||||||
|
|
||||||
class ActionList {
|
class ActionList {
|
||||||
public:
|
public:
|
||||||
ActionList(Common::SeekableReadStream *stream);
|
ActionList(Common::SeekableReadStream *stream, Scene *scene);
|
||||||
virtual ~ActionList();
|
virtual ~ActionList();
|
||||||
|
|
||||||
uint32 size;
|
uint32 size;
|
||||||
|
@ -66,12 +70,140 @@ public:
|
||||||
|
|
||||||
Common::Array<ActionDefinitions> entries;
|
Common::Array<ActionDefinitions> entries;
|
||||||
|
|
||||||
|
// FIXME
|
||||||
|
// Made all the internal control variables public and removed the getter/setter
|
||||||
|
// pairs for simplicity. This should be refactored later, once the function mapping
|
||||||
|
// is cleaned up properly
|
||||||
|
int currentLine;
|
||||||
|
int currentLoops;
|
||||||
|
int delayedSceneIndex;
|
||||||
|
int delayedVideoIndex;
|
||||||
|
bool allowInput;
|
||||||
|
bool processing;
|
||||||
|
int lineIncrement;
|
||||||
|
bool done;
|
||||||
|
bool waitCycle;
|
||||||
|
|
||||||
|
void setScriptByIndex(uint32 index);
|
||||||
|
ActionDefinitions* getScript() { return _currentScript; }
|
||||||
|
int process();
|
||||||
|
|
||||||
|
int checkBarrierFlags(int barrierId);
|
||||||
|
int setBarrierNextFrame(int barrierId, int barrierFlags);
|
||||||
|
|
||||||
|
void processActionListSub02(ActionDefinitions* script, ActionCommand* command, int a4);
|
||||||
|
void enableActorSub(int actorIndex, int condition);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Scene *_scene;
|
||||||
|
ActionDefinitions *_currentScript;
|
||||||
|
|
||||||
void load(Common::SeekableReadStream *stream);
|
void load(Common::SeekableReadStream *stream);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// opcode functions
|
||||||
|
int kReturn0(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kSetGameFlag(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kClearGameFlag(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kToggleGameFlag(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kJumpIfGameFlag(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kHideCursor(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kShowCursor(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kPlayAnimation(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kMoveScenePosition(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kHideActor(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kShowActor(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kSetActorStats(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kSetSceneMotionStat(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kDisableActor(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kEnableActor(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kEnableBarriers(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kReturn(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kDestroyBarrier(ActionCommand *cmd, Scene *scn);
|
||||||
|
int k_unk12_JMP_WALK_ACTOR(ActionCommand *cmd, Scene *scn);
|
||||||
|
int k_unk13_JMP_WALK_ACTOR(ActionCommand *cmd, Scene *scn);
|
||||||
|
int k_unk14_JMP_WALK_ACTOR(ActionCommand *cmd, Scene *scn);
|
||||||
|
int k_unk15(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kResetAnimation(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kClearFlag1Bit0(ActionCommand *cmd, Scene *scn);
|
||||||
|
int k_unk18_PLAY_SND(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kJumpIfFlag2Bit0(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kSetFlag2Bit0(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kClearFlag2Bit0(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kJumpIfFlag2Bit2(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kSetFlag2Bit2(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kClearFlag2Bit2(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kJumpIfFlag2Bit1(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kSetFlag2Bit1(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kClearFlag2Bit1(ActionCommand *cmd, Scene *scn);
|
||||||
|
int k_unk22(ActionCommand *cmd, Scene *scn);
|
||||||
|
int k_unk23(ActionCommand *cmd, Scene *scn);
|
||||||
|
int k_unk24(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kRunEncounter(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kJumpIfFlag2Bit4(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kSetFlag2Bit4(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kClearFlag2Bit4(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kSetActorField638(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kJumpIfActorField638(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kChangeScene(ActionCommand *cmd, Scene *scn);
|
||||||
|
int k_unk2C_ActorSub(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kPlayMovie(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kStopAllBarriersSounds(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kSetActionFlag01(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kClearActionFlag01(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kResetSceneRect(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kChangeMusicById(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kStopMusic(ActionCommand *cmd, Scene *scn);
|
||||||
|
int k_unk34_Status(ActionCommand *cmd, Scene *scn);
|
||||||
|
int k_unk35(ActionCommand *cmd, Scene *scn);
|
||||||
|
int k_unk36(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kRunBlowUpPuzzle(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kJumpIfFlag2Bit3(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kSetFlag2Bit3(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kClearFlag2Bit3(ActionCommand *cmd, Scene *scn);
|
||||||
|
int k_unk3B_PALETTE_MOD(ActionCommand *cmd, Scene *scn);
|
||||||
|
int k_unk3C_CMP_VAL(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kWaitUntilFramePlayed(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kUpdateWideScreen(ActionCommand *cmd, Scene *scn);
|
||||||
|
int k_unk3F(ActionCommand *cmd, Scene *scn);
|
||||||
|
int k_unk40_SOUND(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kPlaySpeech(ActionCommand *cmd, Scene *scn);
|
||||||
|
int k_unk42(ActionCommand *cmd, Scene *scn);
|
||||||
|
int k_unk43(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kPaletteFade(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kStartPaletteFadeThread(ActionCommand *cmd, Scene *scn);
|
||||||
|
int k_unk46(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kActorFaceObject(ActionCommand *cmd, Scene *scn);
|
||||||
|
int k_unk48_MATTE_01(ActionCommand *cmd, Scene *scn);
|
||||||
|
int k_unk49_MATTE_90(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kJumpIfSoundPlaying(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kChangePlayerCharacterIndex(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kChangeActorField40(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kStopSound(ActionCommand *cmd, Scene *scn);
|
||||||
|
int k_unk4E_RANDOM_COMMAND(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kClearScreen(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kQuit(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kJumpBarrierFrame(ActionCommand *cmd, Scene *scn);
|
||||||
|
int k_unk52(ActionCommand *cmd, Scene *scn);
|
||||||
|
int k_unk53(ActionCommand *cmd, Scene *scn);
|
||||||
|
int k_unk54_SET_ACTIONLIST_6EC(ActionCommand *cmd, Scene *scn);
|
||||||
|
int k_unk55(ActionCommand *cmd, Scene *scn);
|
||||||
|
int k_unk56(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kSetResourcePalette(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kSetBarrierFrameIdxFlaged(ActionCommand *cmd, Scene *scn);
|
||||||
|
int k_unk59(ActionCommand *cmd, Scene *scn);
|
||||||
|
int k_unk5A(ActionCommand *cmd, Scene *scn);
|
||||||
|
int k_unk5B(ActionCommand *cmd, Scene *scn);
|
||||||
|
int k_unk5C(ActionCommand *cmd, Scene *scn);
|
||||||
|
int k_unk5D(ActionCommand *cmd, Scene *scn);
|
||||||
|
int k_unk5E(ActionCommand *cmd, Scene *scn);
|
||||||
|
int kSetBarrierLastFrameIdx(ActionCommand *cmd, Scene *scn);
|
||||||
|
int k_unk60_SET_OR_CLR_ACTIONAREA_FLAG(ActionCommand *cmd, Scene *scn);
|
||||||
|
int k_unk61(ActionCommand *cmd, Scene *scn);
|
||||||
|
int k_unk62_SHOW_OPTIONS_SCREEN(ActionCommand *cmd, Scene *scn);
|
||||||
|
int k_unk63(ActionCommand *cmd, Scene *scn);
|
||||||
|
|
||||||
} // end of namespace Asylum
|
} // end of namespace Asylum
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -157,7 +157,7 @@ void Actor::drawActor() {
|
||||||
|
|
||||||
void Actor::setWalkArea(ActionArea *target) {
|
void Actor::setWalkArea(ActionArea *target) {
|
||||||
if (_currentWalkArea != target) {
|
if (_currentWalkArea != target) {
|
||||||
ScriptMan.setScriptIndex(target->actionListIdx1);
|
Shared.getScene()->actions()->setScriptByIndex(target->actionListIdx1);
|
||||||
_currentWalkArea = target;
|
_currentWalkArea = target;
|
||||||
debugC(kDebugLevelScripts, "%s", target->name);
|
debugC(kDebugLevelScripts, "%s", target->name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,7 +114,7 @@ Common::Error AsylumEngine::go() {
|
||||||
|
|
||||||
// XXX This can probably also be rolled into the scene constructor.
|
// XXX This can probably also be rolled into the scene constructor.
|
||||||
// Investigate if this will fuck up the execution sequence though :P
|
// Investigate if this will fuck up the execution sequence though :P
|
||||||
ScriptMan.setScript(_scene->getDefaultActionList());
|
_scene->actions()->setScriptByIndex(_scene->worldstats()->actionListIdx);
|
||||||
|
|
||||||
// Set up main menu
|
// Set up main menu
|
||||||
_mainMenu = new MainMenu();
|
_mainMenu = new MainMenu();
|
||||||
|
@ -260,12 +260,12 @@ void AsylumEngine::checkForEvent(bool doUpdate) { // k_sub_40AE30 (0040AE30)
|
||||||
|
|
||||||
void AsylumEngine::processDelayedEvents() {
|
void AsylumEngine::processDelayedEvents() {
|
||||||
// check for a delayed video
|
// check for a delayed video
|
||||||
int videoIdx = ScriptMan.delayedVideoIndex;
|
int videoIdx = _scene->actions()->delayedVideoIndex;
|
||||||
if (videoIdx >= 0) {
|
if (videoIdx >= 0) {
|
||||||
_sound->stopMusic();
|
_sound->stopMusic();
|
||||||
_sound->stopSfx();
|
_sound->stopSfx();
|
||||||
_video->playVideo(videoIdx, kSubtitlesOn);
|
_video->playVideo(videoIdx, kSubtitlesOn);
|
||||||
ScriptMan.delayedVideoIndex = -1;
|
_scene->actions()->delayedVideoIndex = -1;
|
||||||
|
|
||||||
if (_mainMenu->isActive())
|
if (_mainMenu->isActive())
|
||||||
_mainMenu->openMenu();
|
_mainMenu->openMenu();
|
||||||
|
@ -274,8 +274,8 @@ void AsylumEngine::processDelayedEvents() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// check for a delayed scene change
|
// check for a delayed scene change
|
||||||
int sceneIdx = ScriptMan.delayedSceneIndex;
|
int sceneIdx = _scene->actions()->delayedSceneIndex;
|
||||||
if (sceneIdx >=0 && !ScriptMan.processing) {
|
if (sceneIdx >=0 && !_scene->actions()->processing) {
|
||||||
_sound->stopMusic();
|
_sound->stopMusic();
|
||||||
_sound->stopSfx();
|
_sound->stopSfx();
|
||||||
|
|
||||||
|
@ -286,8 +286,8 @@ void AsylumEngine::processDelayedEvents() {
|
||||||
Shared.setScene(_scene);
|
Shared.setScene(_scene);
|
||||||
_scene->enterScene();
|
_scene->enterScene();
|
||||||
|
|
||||||
ScriptMan.delayedSceneIndex = -1;
|
_scene->actions()->delayedSceneIndex = -1;
|
||||||
ScriptMan.setScript(_scene->getDefaultActionList());
|
_scene->actions()->setScriptByIndex(_scene->worldstats()->actionListIdx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,6 @@
|
||||||
#include "asylum/screen.h"
|
#include "asylum/screen.h"
|
||||||
#include "asylum/sound.h"
|
#include "asylum/sound.h"
|
||||||
#include "asylum/video.h"
|
#include "asylum/video.h"
|
||||||
#include "asylum/scriptman.h"
|
|
||||||
#include "asylum/blowuppuzzle.h"
|
#include "asylum/blowuppuzzle.h"
|
||||||
#include "asylum/encounters.h"
|
#include "asylum/encounters.h"
|
||||||
|
|
||||||
|
|
|
@ -42,9 +42,7 @@
|
||||||
<File RelativePath="..\..\engines\asylum\scene.cpp" />
|
<File RelativePath="..\..\engines\asylum\scene.cpp" />
|
||||||
<File RelativePath="..\..\engines\asylum\scene.h" />
|
<File RelativePath="..\..\engines\asylum\scene.h" />
|
||||||
<File RelativePath="..\..\engines\asylum\screen.cpp" />
|
<File RelativePath="..\..\engines\asylum\screen.cpp" />
|
||||||
<File RelativePath="..\..\engines\asylum\screen.h" />
|
<File RelativePath="..\..\engines\asylum\screen.h" />
|
||||||
<File RelativePath="..\..\engines\asylum\scriptman.cpp" />
|
|
||||||
<File RelativePath="..\..\engines\asylum\scriptman.h" />
|
|
||||||
<File RelativePath="..\..\engines\asylum\sound.cpp" />
|
<File RelativePath="..\..\engines\asylum\sound.cpp" />
|
||||||
<File RelativePath="..\..\engines\asylum\sound.h" />
|
<File RelativePath="..\..\engines\asylum\sound.h" />
|
||||||
<File RelativePath="..\..\engines\asylum\text.cpp" />
|
<File RelativePath="..\..\engines\asylum\text.cpp" />
|
||||||
|
|
|
@ -118,7 +118,7 @@ bool Console::cmdPlayVideo(int argc, const char **argv) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ScriptMan.delayedVideoIndex = atoi(argv[1]);
|
Shared.getScene()->actions()->delayedVideoIndex = atoi(argv[1]);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -129,7 +129,7 @@ bool Console::cmdRunScript(int argc, const char **argv) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ScriptMan.setScriptIndex(atoi(argv[1]));
|
Shared.getScene()->actions()->setScriptByIndex(atoi(argv[1]));
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -145,8 +145,9 @@ bool Console::cmdChangeScene(int argc, const char **argv) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ScriptMan.delayedSceneIndex = atoi(argv[1]);
|
Shared.getScene()->actions()->delayedSceneIndex = atoi(argv[1]);
|
||||||
ScriptMan.setScript(0);
|
Shared.getScene()->actions()->setScriptByIndex(0); // XXX is this right or should it be
|
||||||
|
// ws->actionListIdx???
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,26 +1,25 @@
|
||||||
MODULE := engines/asylum
|
MODULE := engines/asylum
|
||||||
|
|
||||||
MODULE_OBJS := \
|
MODULE_OBJS := \
|
||||||
|
actionlist.o \
|
||||||
|
actor.o \
|
||||||
asylum.o \
|
asylum.o \
|
||||||
|
barrier.o \
|
||||||
|
blowuppuzzle.o \
|
||||||
console.o \
|
console.o \
|
||||||
|
cursor.o \
|
||||||
detection.o \
|
detection.o \
|
||||||
|
encounters.o \
|
||||||
graphics.o \
|
graphics.o \
|
||||||
menu.o \
|
menu.o \
|
||||||
|
polygons.o \
|
||||||
respack.o \
|
respack.o \
|
||||||
scene.o \
|
scene.o \
|
||||||
barrier.o \
|
|
||||||
screen.o \
|
screen.o \
|
||||||
|
shared.o \
|
||||||
sound.o \
|
sound.o \
|
||||||
text.o \
|
text.o \
|
||||||
video.o \
|
video.o \
|
||||||
actor.o \
|
|
||||||
encounters.o \
|
|
||||||
scriptman.o \
|
|
||||||
blowuppuzzle.o \
|
|
||||||
shared.o \
|
|
||||||
cursor.o \
|
|
||||||
polygons.o \
|
|
||||||
actionlist.o \
|
|
||||||
worldstats.o
|
worldstats.o
|
||||||
|
|
||||||
# This module can be built as a plugin
|
# This module can be built as a plugin
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
|
|
||||||
#include "asylum/scene.h"
|
#include "asylum/scene.h"
|
||||||
#include "asylum/shared.h"
|
#include "asylum/shared.h"
|
||||||
#include "asylum/scriptman.h"
|
|
||||||
#include "asylum/actor.h"
|
#include "asylum/actor.h"
|
||||||
|
|
||||||
namespace Asylum {
|
namespace Asylum {
|
||||||
|
@ -64,7 +63,7 @@ Scene::Scene(uint8 sceneIdx) {
|
||||||
_polygons = new Polygons(fd);
|
_polygons = new Polygons(fd);
|
||||||
// jump to action list data
|
// jump to action list data
|
||||||
fd->seek(0xE868E + _polygons->size * _polygons->numEntries);
|
fd->seek(0xE868E + _polygons->size * _polygons->numEntries);
|
||||||
_actions = new ActionList(fd);
|
_actions = new ActionList(fd, this);
|
||||||
|
|
||||||
fd->close();
|
fd->close();
|
||||||
delete fd;
|
delete fd;
|
||||||
|
@ -157,17 +156,6 @@ void Scene::enterScene() {
|
||||||
_walking = false;
|
_walking = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ActionDefinitions* Scene::getDefaultActionList() {
|
|
||||||
getActionList(_ws->actionListIdx);
|
|
||||||
}
|
|
||||||
|
|
||||||
ActionDefinitions* Scene::getActionList(int actionListIndex) {
|
|
||||||
if ((actionListIndex >= 0) && (actionListIndex < (int)_ws->numActions))
|
|
||||||
return &actions()->entries[actionListIndex];
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Scene::setScenePosition(int x, int y)
|
void Scene::setScenePosition(int x, int y)
|
||||||
{
|
{
|
||||||
WorldStats *ws = _ws;
|
WorldStats *ws = _ws;
|
||||||
|
@ -199,12 +187,12 @@ void Scene::handleEvent(Common::Event *event, bool doUpdate) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Common::EVENT_LBUTTONUP:
|
case Common::EVENT_LBUTTONUP:
|
||||||
if (ScriptMan.allowInput)
|
if (_actions->allowInput)
|
||||||
_leftClick = true;
|
_leftClick = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Common::EVENT_RBUTTONUP:
|
case Common::EVENT_RBUTTONUP:
|
||||||
if (ScriptMan.allowInput) {
|
if (_actions->allowInput) {
|
||||||
// TODO This isn't always going to be the magnifying glass
|
// TODO This isn't always going to be the magnifying glass
|
||||||
// Should check the current pointer region to identify the type
|
// Should check the current pointer region to identify the type
|
||||||
// of cursor to use
|
// of cursor to use
|
||||||
|
@ -214,7 +202,7 @@ void Scene::handleEvent(Common::Event *event, bool doUpdate) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Common::EVENT_RBUTTONDOWN:
|
case Common::EVENT_RBUTTONDOWN:
|
||||||
if (ScriptMan.allowInput)
|
if (_actions->allowInput)
|
||||||
_rightButton = true;
|
_rightButton = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -276,7 +264,7 @@ int Scene::updateScene() {
|
||||||
//updateAdjustScreen();
|
//updateAdjustScreen();
|
||||||
//debugC(kDebugLevelScene, "AdjustScreenStart Time: %d", Shared.getMillis() - startTick);
|
//debugC(kDebugLevelScene, "AdjustScreenStart Time: %d", Shared.getMillis() - startTick);
|
||||||
|
|
||||||
if(ScriptMan.processActionList())
|
if(_actions->process())
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -878,7 +866,7 @@ void Scene::OLD_UPDATE(WorldStats *worldStats) {
|
||||||
worldStats->actions[a].actionListIdx2,
|
worldStats->actions[a].actionListIdx2,
|
||||||
worldStats->actions[a].actionType,
|
worldStats->actions[a].actionType,
|
||||||
worldStats->actions[a].soundResId);
|
worldStats->actions[a].soundResId);
|
||||||
ScriptMan.setScript(&_actions->entries[worldStats->actions[a].actionListIdx1]);
|
_actions->setScriptByIndex(_ws->actions[a].actionListIdx1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (curBarrier >= 0) {
|
} else if (curBarrier >= 0) {
|
||||||
|
@ -889,7 +877,7 @@ void Scene::OLD_UPDATE(WorldStats *worldStats) {
|
||||||
b.soundResId,
|
b.soundResId,
|
||||||
b.flags,
|
b.flags,
|
||||||
b.flags2);
|
b.flags2);
|
||||||
ScriptMan.setScript(getActionList(b.actionListIdx));
|
_actions->setScriptByIndex(b.actionListIdx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
|
|
||||||
namespace Asylum {
|
namespace Asylum {
|
||||||
|
|
||||||
|
class ActionList;
|
||||||
class Screen;
|
class Screen;
|
||||||
class Sound;
|
class Sound;
|
||||||
class Video;
|
class Video;
|
||||||
|
@ -61,10 +62,6 @@ public:
|
||||||
void deactivate() { _isActive = false; }
|
void deactivate() { _isActive = false; }
|
||||||
bool isActive() { return _isActive; }
|
bool isActive() { return _isActive; }
|
||||||
int getSceneIndex() { return _sceneIdx; }
|
int getSceneIndex() { return _sceneIdx; }
|
||||||
|
|
||||||
// TODO roll into actionlist.cpp
|
|
||||||
ActionDefinitions* getDefaultActionList();
|
|
||||||
ActionDefinitions* getActionList(int actionListIndex);
|
|
||||||
|
|
||||||
Actor* getActor();
|
Actor* getActor();
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,186 +0,0 @@
|
||||||
/* 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.
|
|
||||||
*
|
|
||||||
* $URL$
|
|
||||||
* $Id$
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef ASYLUM_SCRIPTMANAGER_H_
|
|
||||||
#define ASYLUM_SCRIPTMANAGER_H_
|
|
||||||
|
|
||||||
#include "common/singleton.h"
|
|
||||||
|
|
||||||
#include "asylum/scene.h"
|
|
||||||
|
|
||||||
namespace Asylum {
|
|
||||||
|
|
||||||
class ActionList;
|
|
||||||
struct ActionDefinitions;
|
|
||||||
struct ActionCommand;
|
|
||||||
class WorldStats;
|
|
||||||
|
|
||||||
class ScriptManager: public Common::Singleton<ScriptManager> {
|
|
||||||
public:
|
|
||||||
|
|
||||||
int processActionList();
|
|
||||||
|
|
||||||
void setScript(ActionDefinitions *action);
|
|
||||||
void setScriptIndex(uint32 index);
|
|
||||||
ActionDefinitions* getScript() { return _currentScript; }
|
|
||||||
|
|
||||||
int checkBarrierFlags(int barrierId);
|
|
||||||
int setBarrierNextFrame(int barrierId, int barrierFlags);
|
|
||||||
|
|
||||||
void processActionListSub02(ActionDefinitions* script, ActionCommand* command, int a4);
|
|
||||||
void enableActorSub(int actorIndex, int condition);
|
|
||||||
|
|
||||||
// FIXME
|
|
||||||
// Made all the internal control variables public and removed the getter/setter
|
|
||||||
// pairs for simplicity. This should be refactored later, once the function mapping
|
|
||||||
// is cleaned up properly
|
|
||||||
int currentLine;
|
|
||||||
int currentLoops;
|
|
||||||
int delayedSceneIndex;
|
|
||||||
int delayedVideoIndex;
|
|
||||||
bool allowInput;
|
|
||||||
bool processing;
|
|
||||||
int lineIncrement;
|
|
||||||
bool done;
|
|
||||||
bool waitCycle;
|
|
||||||
|
|
||||||
private:
|
|
||||||
friend class Common::Singleton<SingletonBaseType>;
|
|
||||||
ScriptManager();
|
|
||||||
~ScriptManager();
|
|
||||||
|
|
||||||
ActionDefinitions *_currentScript;
|
|
||||||
|
|
||||||
friend class Console;
|
|
||||||
|
|
||||||
}; // end of class ScriptManager
|
|
||||||
|
|
||||||
// opcode functions
|
|
||||||
int kReturn0(ActionCommand *cmd);
|
|
||||||
int kSetGameFlag(ActionCommand *cmd);
|
|
||||||
int kClearGameFlag(ActionCommand *cmd);
|
|
||||||
int kToggleGameFlag(ActionCommand *cmd);
|
|
||||||
int kJumpIfGameFlag(ActionCommand *cmd);
|
|
||||||
int kHideCursor(ActionCommand *cmd);
|
|
||||||
int kShowCursor(ActionCommand *cmd);
|
|
||||||
int kPlayAnimation(ActionCommand *cmd);
|
|
||||||
int kMoveScenePosition(ActionCommand *cmd);
|
|
||||||
int kHideActor(ActionCommand *cmd);
|
|
||||||
int kShowActor(ActionCommand *cmd);
|
|
||||||
int kSetActorStats(ActionCommand *cmd);
|
|
||||||
int kSetSceneMotionStat(ActionCommand *cmd);
|
|
||||||
int kDisableActor(ActionCommand *cmd);
|
|
||||||
int kEnableActor(ActionCommand *cmd);
|
|
||||||
int kEnableBarriers(ActionCommand *cmd);
|
|
||||||
int kReturn(ActionCommand *cmd);
|
|
||||||
int kDestroyBarrier(ActionCommand *cmd);
|
|
||||||
int k_unk12_JMP_WALK_ACTOR(ActionCommand *cmd);
|
|
||||||
int k_unk13_JMP_WALK_ACTOR(ActionCommand *cmd);
|
|
||||||
int k_unk14_JMP_WALK_ACTOR(ActionCommand *cmd);
|
|
||||||
int k_unk15(ActionCommand *cmd);
|
|
||||||
int kResetAnimation(ActionCommand *cmd);
|
|
||||||
int kClearFlag1Bit0(ActionCommand *cmd);
|
|
||||||
int k_unk18_PLAY_SND(ActionCommand *cmd);
|
|
||||||
int kJumpIfFlag2Bit0(ActionCommand *cmd);
|
|
||||||
int kSetFlag2Bit0(ActionCommand *cmd);
|
|
||||||
int kClearFlag2Bit0(ActionCommand *cmd);
|
|
||||||
int kJumpIfFlag2Bit2(ActionCommand *cmd);
|
|
||||||
int kSetFlag2Bit2(ActionCommand *cmd);
|
|
||||||
int kClearFlag2Bit2(ActionCommand *cmd);
|
|
||||||
int kJumpIfFlag2Bit1(ActionCommand *cmd);
|
|
||||||
int kSetFlag2Bit1(ActionCommand *cmd);
|
|
||||||
int kClearFlag2Bit1(ActionCommand *cmd);
|
|
||||||
int k_unk22(ActionCommand *cmd);
|
|
||||||
int k_unk23(ActionCommand *cmd);
|
|
||||||
int k_unk24(ActionCommand *cmd);
|
|
||||||
int kRunEncounter(ActionCommand *cmd);
|
|
||||||
int kJumpIfFlag2Bit4(ActionCommand *cmd);
|
|
||||||
int kSetFlag2Bit4(ActionCommand *cmd);
|
|
||||||
int kClearFlag2Bit4(ActionCommand *cmd);
|
|
||||||
int kSetActorField638(ActionCommand *cmd);
|
|
||||||
int kJumpIfActorField638(ActionCommand *cmd);
|
|
||||||
int kChangeScene(ActionCommand *cmd);
|
|
||||||
int k_unk2C_ActorSub(ActionCommand *cmd);
|
|
||||||
int kPlayMovie(ActionCommand *cmd);
|
|
||||||
int kStopAllBarriersSounds(ActionCommand *cmd);
|
|
||||||
int kSetActionFlag01(ActionCommand *cmd);
|
|
||||||
int kClearActionFlag01(ActionCommand *cmd);
|
|
||||||
int kResetSceneRect(ActionCommand *cmd);
|
|
||||||
int kChangeMusicById(ActionCommand *cmd);
|
|
||||||
int kStopMusic(ActionCommand *cmd);
|
|
||||||
int k_unk34_Status(ActionCommand *cmd);
|
|
||||||
int k_unk35(ActionCommand *cmd);
|
|
||||||
int k_unk36(ActionCommand *cmd);
|
|
||||||
int kRunBlowUpPuzzle(ActionCommand *cmd);
|
|
||||||
int kJumpIfFlag2Bit3(ActionCommand *cmd);
|
|
||||||
int kSetFlag2Bit3(ActionCommand *cmd);
|
|
||||||
int kClearFlag2Bit3(ActionCommand *cmd);
|
|
||||||
int k_unk3B_PALETTE_MOD(ActionCommand *cmd);
|
|
||||||
int k_unk3C_CMP_VAL(ActionCommand *cmd);
|
|
||||||
int kWaitUntilFramePlayed(ActionCommand *cmd);
|
|
||||||
int kUpdateWideScreen(ActionCommand *cmd);
|
|
||||||
int k_unk3F(ActionCommand *cmd);
|
|
||||||
int k_unk40_SOUND(ActionCommand *cmd);
|
|
||||||
int kPlaySpeech(ActionCommand *cmd);
|
|
||||||
int k_unk42(ActionCommand *cmd);
|
|
||||||
int k_unk43(ActionCommand *cmd);
|
|
||||||
int kPaletteFade(ActionCommand *cmd);
|
|
||||||
int kStartPaletteFadeThread(ActionCommand *cmd);
|
|
||||||
int k_unk46(ActionCommand *cmd);
|
|
||||||
int kActorFaceObject(ActionCommand *cmd);
|
|
||||||
int k_unk48_MATTE_01(ActionCommand *cmd);
|
|
||||||
int k_unk49_MATTE_90(ActionCommand *cmd);
|
|
||||||
int kJumpIfSoundPlaying(ActionCommand *cmd);
|
|
||||||
int kChangePlayerCharacterIndex(ActionCommand *cmd);
|
|
||||||
int kChangeActorField40(ActionCommand *cmd);
|
|
||||||
int kStopSound(ActionCommand *cmd);
|
|
||||||
int k_unk4E_RANDOM_COMMAND(ActionCommand *cmd);
|
|
||||||
int kClearScreen(ActionCommand *cmd);
|
|
||||||
int kQuit(ActionCommand *cmd);
|
|
||||||
int kJumpBarrierFrame(ActionCommand *cmd);
|
|
||||||
int k_unk52(ActionCommand *cmd);
|
|
||||||
int k_unk53(ActionCommand *cmd);
|
|
||||||
int k_unk54_SET_ACTIONLIST_6EC(ActionCommand *cmd);
|
|
||||||
int k_unk55(ActionCommand *cmd);
|
|
||||||
int k_unk56(ActionCommand *cmd);
|
|
||||||
int kSetResourcePalette(ActionCommand *cmd);
|
|
||||||
int kSetBarrierFrameIdxFlaged(ActionCommand *cmd);
|
|
||||||
int k_unk59(ActionCommand *cmd);
|
|
||||||
int k_unk5A(ActionCommand *cmd);
|
|
||||||
int k_unk5B(ActionCommand *cmd);
|
|
||||||
int k_unk5C(ActionCommand *cmd);
|
|
||||||
int k_unk5D(ActionCommand *cmd);
|
|
||||||
int k_unk5E(ActionCommand *cmd);
|
|
||||||
int kSetBarrierLastFrameIdx(ActionCommand *cmd);
|
|
||||||
int k_unk60_SET_OR_CLR_ACTIONAREA_FLAG(ActionCommand *cmd);
|
|
||||||
int k_unk61(ActionCommand *cmd);
|
|
||||||
int k_unk62_SHOW_OPTIONS_SCREEN(ActionCommand *cmd);
|
|
||||||
int k_unk63(ActionCommand *cmd);
|
|
||||||
|
|
||||||
|
|
||||||
#define ScriptMan (::Asylum::ScriptManager::instance())
|
|
||||||
|
|
||||||
} // end of namespace Asylum
|
|
||||||
|
|
||||||
#endif
|
|
Loading…
Add table
Add a link
Reference in a new issue