2015-01-11 15:43:02 +00: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.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef XEEN_SCRIPTS_H
|
|
|
|
#define XEEN_SCRIPTS_H
|
|
|
|
|
|
|
|
#include "common/scummsys.h"
|
|
|
|
#include "common/system.h"
|
2015-01-11 19:21:57 +00:00
|
|
|
#include "common/serializer.h"
|
2015-01-24 02:25:58 +00:00
|
|
|
#include "common/stack.h"
|
2015-01-22 01:42:44 +00:00
|
|
|
#include "common/str-array.h"
|
2015-01-11 19:21:57 +00:00
|
|
|
#include "xeen/files.h"
|
2015-01-25 04:12:30 +00:00
|
|
|
#include "xeen/party.h"
|
2015-01-11 15:43:02 +00:00
|
|
|
|
|
|
|
namespace Xeen {
|
|
|
|
|
|
|
|
enum Opcode {
|
|
|
|
OP_None = 0x00,
|
|
|
|
OP_Display0x01 = 0x01,
|
|
|
|
OP_DoorTextSml = 0x02,
|
|
|
|
OP_DoorTextLrg = 0x03,
|
|
|
|
OP_SignText = 0x04,
|
|
|
|
OP_NPC = 0x05,
|
|
|
|
OP_PlayFX = 0x06,
|
|
|
|
OP_TeleportAndExit = 0x07,
|
2015-01-24 04:47:05 +00:00
|
|
|
OP_If1 = 0x08,
|
|
|
|
OP_If2 = 0x09,
|
2015-01-11 15:43:02 +00:00
|
|
|
OP_If3 = 0x0A,
|
|
|
|
OP_MoveObj = 0x0B,
|
|
|
|
OP_TakeOrGive = 0x0C,
|
|
|
|
OP_NoAction = 0x0D,
|
|
|
|
OP_Remove = 0x0E,
|
|
|
|
OP_SetChar = 0x0F,
|
|
|
|
OP_Spawn = 0x10,
|
|
|
|
OP_DoTownEvent = 0x11,
|
|
|
|
OP_Exit = 0x12,
|
|
|
|
OP_AfterMap = 0x13,
|
|
|
|
OP_GiveExtended = 0x14,
|
|
|
|
OP_ConfirmWord = 0x15,
|
|
|
|
OP_Damage = 0x16,
|
|
|
|
OP_JumpRnd = 0x17,
|
|
|
|
OP_AfterEvent = 0x18,
|
|
|
|
OP_CallEvent = 0x19,
|
|
|
|
OP_Return = 0x1A,
|
|
|
|
OP_SetVar = 0x1B,
|
|
|
|
OP_TakeOrGive_2 = 0x1C,
|
|
|
|
OP_TakeOrGive_3 = 0x1D,
|
|
|
|
OP_CutsceneEndClouds = 0x1E,
|
|
|
|
OP_TeleportAndContinue = 0x1F,
|
|
|
|
OP_WhoWill = 0x20,
|
|
|
|
OP_RndDamage = 0x21,
|
|
|
|
OP_MoveWallObj = 0x22,
|
|
|
|
OP_AlterCellFlag= 0x23,
|
|
|
|
OP_AlterHed = 0x24,
|
|
|
|
OP_DisplayStat = 0x25,
|
|
|
|
OP_TakeOrGive_4 = 0x26,
|
|
|
|
OP_SeatTextSml = 0x27,
|
|
|
|
OP_PlayEventVoc = 0x28,
|
|
|
|
OP_DisplayBottom = 0x29,
|
|
|
|
OP_IfMapFlag = 0x2A,
|
|
|
|
OP_SelRndChar = 0x2B,
|
|
|
|
OP_GiveEnchanted= 0x2C,
|
|
|
|
OP_ItemType = 0x2D,
|
|
|
|
OP_MakeNothingHere = 0x2E,
|
|
|
|
OP_NoAction_2 = 0x2F,
|
|
|
|
OP_ChooseNumeric= 0x30,
|
|
|
|
OP_DisplayBottomTwoLines = 0x31,
|
|
|
|
OP_DisplayLarge = 0x32,
|
|
|
|
OP_ExchObj = 0x33,
|
|
|
|
OP_FallToMap = 0x34,
|
|
|
|
OP_DisplayMain = 0x35,
|
|
|
|
OP_Goto = 0x36,
|
|
|
|
OP_ConfirmWord_2= 0x37,
|
|
|
|
OP_GotoRandom = 0x38,
|
|
|
|
OP_CutsceneEndDarkside = 0x39,
|
|
|
|
OP_CutsceneEdWorld = 0x3A,
|
|
|
|
OP_FlipWorld = 0x3B,
|
|
|
|
OP_PlayCD = 0x3C
|
|
|
|
};
|
|
|
|
|
2015-01-19 16:32:57 +00:00
|
|
|
class XeenEngine;
|
|
|
|
|
2015-01-11 15:43:02 +00:00
|
|
|
class MazeEvent {
|
|
|
|
public:
|
|
|
|
Common::Point _position;
|
|
|
|
int _direction;
|
|
|
|
int _line;
|
|
|
|
Opcode _opcode;
|
|
|
|
Common::Array<byte> _parameters;
|
|
|
|
public:
|
|
|
|
MazeEvent();
|
|
|
|
|
2015-01-11 19:21:57 +00:00
|
|
|
void synchronize(Common::Serializer &s);
|
2015-01-11 15:43:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class MazeEvents : public Common::Array<MazeEvent> {
|
|
|
|
public:
|
2015-01-22 01:42:44 +00:00
|
|
|
Common::StringArray _text;
|
2015-01-11 15:43:02 +00:00
|
|
|
public:
|
2015-01-11 19:21:57 +00:00
|
|
|
void synchronize(XeenSerializer &s);
|
2015-01-11 15:43:02 +00:00
|
|
|
};
|
|
|
|
|
2015-01-24 02:25:58 +00:00
|
|
|
struct StackEntry : public Common::Point {
|
|
|
|
int line;
|
|
|
|
|
|
|
|
StackEntry(const Common::Point &pt, int l) : Common::Point(pt), line(l) {}
|
|
|
|
};
|
|
|
|
|
2015-01-25 04:12:30 +00:00
|
|
|
struct MirrorEntry {
|
|
|
|
Common::String _name;
|
|
|
|
int _mapId;
|
|
|
|
Common::Point _position;
|
|
|
|
int _direction;
|
|
|
|
|
|
|
|
MirrorEntry() : _mapId(0), _direction(DIR_ALL) {}
|
|
|
|
|
|
|
|
bool synchronize(Common::SeekableReadStream &s);
|
|
|
|
};
|
|
|
|
|
2015-01-19 16:32:57 +00:00
|
|
|
class Scripts {
|
|
|
|
private:
|
|
|
|
XeenEngine *_vm;
|
2015-01-22 01:42:44 +00:00
|
|
|
int _charFX[6];
|
|
|
|
int _treasureItems;
|
|
|
|
int _treasureGold;
|
|
|
|
int _treasureGems;
|
2015-01-22 02:51:45 +00:00
|
|
|
int _lineNum;
|
2015-01-23 03:05:36 +00:00
|
|
|
int _charIndex;
|
2015-01-25 04:12:30 +00:00
|
|
|
int _mirrorId;
|
2015-01-25 14:01:21 +00:00
|
|
|
int _refreshIcons;
|
2015-01-26 02:19:59 +00:00
|
|
|
int _scriptResult;
|
2015-01-26 04:59:16 +00:00
|
|
|
int _v2;
|
2015-01-26 02:19:59 +00:00
|
|
|
bool _scriptExecuted;
|
|
|
|
bool _var50;
|
2015-01-22 12:53:33 +00:00
|
|
|
MazeEvent *_event;
|
2015-01-24 02:25:58 +00:00
|
|
|
Common::Point _currentPos;
|
|
|
|
Common::Stack<StackEntry> _stack;
|
2015-01-22 01:42:44 +00:00
|
|
|
|
2015-01-22 12:53:33 +00:00
|
|
|
void doOpcode(MazeEvent &event);
|
2015-01-22 02:51:45 +00:00
|
|
|
void cmdDisplay1(Common::Array<byte> ¶ms);
|
2015-01-22 01:42:44 +00:00
|
|
|
void cmdDoorTextSml(Common::Array<byte> ¶ms);
|
|
|
|
void cmdDoorTextLrg(Common::Array<byte> ¶ms);
|
|
|
|
void cmdSignText(Common::Array<byte> ¶ms);
|
|
|
|
void cmdNPC(Common::Array<byte> ¶ms);
|
|
|
|
void cmdPlayFX(Common::Array<byte> ¶ms);
|
2015-01-22 02:51:45 +00:00
|
|
|
void cmdTeleport(Common::Array<byte> ¶ms);
|
|
|
|
void cmdIf(Common::Array<byte> ¶ms);
|
2015-01-22 01:42:44 +00:00
|
|
|
void cmdMoveObj(Common::Array<byte> ¶ms);
|
|
|
|
void cmdTakeOrGive(Common::Array<byte> ¶ms);
|
|
|
|
void cmdNoAction(Common::Array<byte> ¶ms);
|
|
|
|
void cmdRemove(Common::Array<byte> ¶ms);
|
|
|
|
void cmdSetChar(Common::Array<byte> ¶ms);
|
|
|
|
void cmdSpawn(Common::Array<byte> ¶ms);
|
|
|
|
void cmdDoTownEvent(Common::Array<byte> ¶ms);
|
|
|
|
void cmdExit(Common::Array<byte> ¶ms);
|
2015-01-24 01:44:02 +00:00
|
|
|
void cmdAlterMap(Common::Array<byte> ¶ms);
|
2015-01-22 01:42:44 +00:00
|
|
|
void cmdGiveExtended(Common::Array<byte> ¶ms);
|
|
|
|
void cmdConfirmWord(Common::Array<byte> ¶ms);
|
|
|
|
void cmdDamage(Common::Array<byte> ¶ms);
|
|
|
|
void cmdJumpRnd(Common::Array<byte> ¶ms);
|
2015-01-24 02:33:18 +00:00
|
|
|
void cmdAlterEvent(Common::Array<byte> ¶ms);
|
2015-01-22 01:42:44 +00:00
|
|
|
void cmdCallEvent(Common::Array<byte> ¶ms);
|
|
|
|
void cmdReturn(Common::Array<byte> ¶ms);
|
|
|
|
void cmdSetVar(Common::Array<byte> ¶ms);
|
|
|
|
void cmdCutsceneEndClouds(Common::Array<byte> ¶ms);
|
|
|
|
void cmdWhoWill(Common::Array<byte> ¶ms);
|
|
|
|
void cmdRndDamage(Common::Array<byte> ¶ms);
|
|
|
|
void cmdMoveWallObj(Common::Array<byte> ¶ms);
|
|
|
|
void cmdAlterCellFlag(Common::Array<byte> ¶ms);
|
|
|
|
void cmdAlterHed(Common::Array<byte> ¶ms);
|
|
|
|
void cmdDisplayStat(Common::Array<byte> ¶ms);
|
|
|
|
void cmdSeatTextSml(Common::Array<byte> ¶ms);
|
|
|
|
void cmdPlayEventVoc(Common::Array<byte> ¶ms);
|
|
|
|
void cmdDisplayBottom(Common::Array<byte> ¶ms);
|
|
|
|
void cmdIfMapFlag(Common::Array<byte> ¶ms);
|
|
|
|
void cmdSelRndChar(Common::Array<byte> ¶ms);
|
|
|
|
void cmdGiveEnchanted(Common::Array<byte> ¶ms);
|
|
|
|
void cmdItemType(Common::Array<byte> ¶ms);
|
|
|
|
void cmdMakeNothingHere(Common::Array<byte> ¶ms);
|
2015-01-25 00:38:58 +00:00
|
|
|
void cmdCheckProtection(Common::Array<byte> ¶ms);
|
2015-01-22 01:42:44 +00:00
|
|
|
void cmdChooseNumeric(Common::Array<byte> ¶ms);
|
|
|
|
void cmdDisplayBottomTwoLines(Common::Array<byte> ¶ms);
|
|
|
|
void cmdDisplayLarge(Common::Array<byte> ¶ms);
|
|
|
|
void cmdExchObj(Common::Array<byte> ¶ms);
|
|
|
|
void cmdFallToMap(Common::Array<byte> ¶ms);
|
|
|
|
void cmdDisplayMain(Common::Array<byte> ¶ms);
|
|
|
|
void cmdGoto(Common::Array<byte> ¶ms);
|
|
|
|
void cmdGotoRandom(Common::Array<byte> ¶ms);
|
|
|
|
void cmdCutsceneEndDarkside(Common::Array<byte> ¶ms);
|
|
|
|
void cmdCutsceneEdWorld(Common::Array<byte> ¶ms);
|
|
|
|
void cmdFlipWorld(Common::Array<byte> ¶ms);
|
|
|
|
void cmdPlayCD(Common::Array<byte> ¶ms);
|
2015-01-24 01:44:02 +00:00
|
|
|
|
|
|
|
int whoWill(int v1, int v2, int v3);
|
|
|
|
|
|
|
|
void doEndGame();
|
|
|
|
|
|
|
|
void doEndGame2();
|
|
|
|
|
|
|
|
void doWorldEnd();
|
|
|
|
|
|
|
|
void doEnding(const Common::String &endStr, int v2);
|
2015-01-24 04:47:05 +00:00
|
|
|
|
|
|
|
bool ifProc(int action, uint32 mask, int mode, int charIndex);
|
2015-01-25 00:38:58 +00:00
|
|
|
|
|
|
|
bool copyProtectionCheck();
|
2015-01-22 01:42:44 +00:00
|
|
|
public:
|
|
|
|
int _animCounter;
|
|
|
|
bool _eventSkipped;
|
2015-01-23 03:05:36 +00:00
|
|
|
int _whoWill;
|
2015-01-25 03:15:57 +00:00
|
|
|
int _nEdamageType;
|
2015-02-07 01:57:01 +00:00
|
|
|
int _itemType;
|
2015-01-25 04:12:30 +00:00
|
|
|
Common::Array<MirrorEntry> _mirror;
|
2015-01-19 16:32:57 +00:00
|
|
|
public:
|
|
|
|
Scripts(XeenEngine *vm);
|
|
|
|
|
2015-01-26 02:19:59 +00:00
|
|
|
bool checkEvents();
|
2015-01-19 16:32:57 +00:00
|
|
|
|
|
|
|
void giveTreasure();
|
|
|
|
|
|
|
|
void openGrate(int v1, int v2);
|
|
|
|
};
|
|
|
|
|
2015-01-11 15:43:02 +00:00
|
|
|
} // End of namespace Xeen
|
|
|
|
|
|
|
|
#endif /* XEEN_SCRIPTS_H */
|