scummvm/engines/lilliput/script.h

317 lines
8.8 KiB
C
Raw Normal View History

/* 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 LILLIPUT_SCRIPT_H
#define LILLIPUT_SCRIPT_H
#include "common/memstream.h"
#include "common/stack.h"
2012-04-12 20:53:38 +02:00
#include "common/random.h"
#include "common/rect.h"
#include "lilliput/stream.h"
namespace Lilliput {
class LilliputEngine;
enum kActionType {
kActionNone = 0,
kButtonPressed = 1,
kButtonReleased = 2,
2012-06-23 18:56:08 +02:00
kActionTalk = 3,
kActionGoto = 4,
kCubeSelected = 5,
kCodeEntered = 6
};
enum kValueType {
kNone,
kImmediateValue,
kCompareOperation,
kComputeOperation,
kGetValue1,
kgetPosFromScript
};
struct OpCode {
const char* _opName;
int _numArgs;
kValueType _arg1;
kValueType _arg2;
kValueType _arg3;
kValueType _arg4;
kValueType _arg5;
};
struct EvaluatedMode {
int _mode;
int _priority;
};
class LilliputScript {
public:
byte _heroismLevel;
2012-05-11 23:32:26 +02:00
byte _speechTimer;
2012-04-17 23:48:11 +02:00
byte _characterScriptEnabled[40];
int8 _interfaceHotspotStatus[20];
Common::Point _characterTilePos[40];
2018-03-21 08:01:44 +01:00
int8 _characterNextSequence[40];
int8 _characterPose[40];
2012-07-01 01:58:15 +02:00
byte _interfaceButtonActivationDelay[20];
byte _array122C1[40];
byte _characterSeek[40];
2018-03-20 07:45:32 +01:00
int16 _interactions[40 * 40];
2012-04-22 22:54:50 +02:00
byte *_savedBuffer215Ptr;
2012-04-17 23:48:11 +02:00
Common::Point _viewportPos;
2012-05-20 15:09:32 +02:00
int16 _viewportCharacterTarget;
int16 _talkingCharacter;
int _heroismBarX;
int _heroismBarBottomY;
2018-03-23 08:07:40 +01:00
Common::Point _sequenceArr[640];
byte _characterMapPixelColor[40];
2018-03-21 08:01:44 +01:00
int8 _characterLastSequence[40];
EvaluatedMode _newEvaluatedModes[32];
2012-04-11 15:58:41 +02:00
LilliputScript(LilliputEngine *vm);
~LilliputScript();
void disasmScript(ScriptStream script);
void listAllTexts();
static Common::String getArgumentString(kValueType type, ScriptStream& script);
void runScript(ScriptStream script);
void runMenuScript(ScriptStream script);
private:
LilliputEngine *_vm;
ScriptStream *_currScript;
Common::Stack<ScriptStream *> _scriptStack;
byte _byte16F05_ScriptHandler;
byte _cubeSet;
2012-05-20 09:45:10 +02:00
byte _lastRandomValue;
byte _scriptForVal;
byte _textVarNumber;
2012-05-11 23:32:26 +02:00
byte _speechDisplaySpeed;
2012-04-12 20:53:38 +02:00
int16 _word16F00_characterId;
2012-05-20 15:09:32 +02:00
int _currentSpeechId;
int _word18821;
int _monitoredCharacter;
2012-06-15 23:34:17 +02:00
Common::Point _word1825E;
char _monitoredAttr[4];
int handleOpcode(ScriptStream *script);
byte handleOpcodeType1(int curWord);
void handleOpcodeType2(int curWord);
void enableCharacterScript(byte index, byte var1, byte *curBufPtr);
2018-03-22 23:30:37 +01:00
void skipOpcodes(int var1);
2018-03-23 08:07:40 +01:00
void copySequence(int index, byte *buf);
void setSequence(int charIdx, int8 seqIdx);
2012-05-20 15:09:32 +02:00
void checkSpeechAllowed(bool &forceReturnFl);
2012-05-09 08:07:58 +02:00
void decodePackedText(char *buf);
2012-05-20 15:09:32 +02:00
void startSpeech(int var);
void displayNumber(byte var1, Common::Point pos);
byte *getMapPtr(Common::Point val);
byte *getCurrentCharacterVarFromScript();
2018-03-24 02:15:54 +01:00
void sendSignal(int16 var1, byte var2h, byte characterId, int16 var4);
void getSpeechVariant(int speechIndex, int speechVariant);
void showSpeech();
void formatSpeechString();
Common::Point getCharacterTilePos(int index);
int getPackedStringStartRelativeIndex(int index);
2012-04-08 12:54:56 +02:00
int16 getValue1();
Common::Point getPosFromScript();
2018-03-22 00:14:11 +01:00
byte *getCharacterAttributesPtr();
2012-05-20 09:45:10 +02:00
byte compareValues(int16 var1, uint16 oper, int16 var2);
void computeOperation(byte *bufPtr, uint16 oper, int16 var2);
//Opcodes Type 1
byte OC_checkCharacterGoalPos();
byte OC_comparePos();
byte OC_checkIsoMap3();
byte OC_compareCharacterVariable();
2012-05-20 09:45:10 +02:00
byte OC_CompareLastRandomValue();
byte OC_getRandom();
2012-04-27 23:17:40 +02:00
byte OC_for();
2012-05-20 15:09:32 +02:00
byte OC_compCurrentSpeechId();
byte OC_checkSaveFlag();
byte OC_compScriptForVal();
2018-03-20 07:45:32 +01:00
byte OC_isCarrying();
byte OC_CompareCharacterVariables();
byte OC_compareCoords_1();
byte OC_compareCoords_2();
byte OC_CompareDistanceFromCharacterToPositionWith();
byte OC_compareRandomCharacterId();
byte OC_IsCurrentCharacterIndex();
2018-03-20 07:45:32 +01:00
byte OC_hasVisibilityLevel();
byte OC_hasGainedVisibilityLevel();
byte OC_hasReducedVisibilityLevel();
byte OC_isHost();
2018-03-21 08:01:44 +01:00
byte OC_isSequenceActive();
byte OC_isSequenceFinished();
byte OC_CompareMapValueWith();
byte OC_IsCharacterValid();
2018-03-21 08:01:44 +01:00
byte OC_CheckWaitingSignal();
byte OC_CurrentCharacterVar0AndVar1Equals();
byte OC_CurrentCharacterVar0Equals();
byte OC_checkLastInterfaceHotspotIndexMenu13();
byte OC_checkLastInterfaceHotspotIndexMenu2();
byte OC_CompareNumberOfCharacterWithVar0Equals();
byte OC_IsPositionInViewport();
byte OC_CompareGameVariables();
byte OC_skipNextOpcode();
2018-03-22 00:14:11 +01:00
byte OC_CheckCurrentCharacterAttr2();
byte OC_CheckCurrentCharacterType();
byte OC_CheckCurrentCharacterAttr0And();
byte OC_IsCurrentCharacterAttr0LessEqualThan();
byte OC_isCarried();
byte OC_CheckCurrentCharacterAttr1();
2018-04-02 19:13:47 +02:00
byte OC_isCurrentCharacterSpecial();
2018-03-22 00:14:11 +01:00
byte OC_CurrentCharacterAttr3Equals1();
2012-04-30 17:57:23 +02:00
byte OC_checkCharacterDirection();
byte OC_checkLastInterfaceHotspotIndex();
2012-06-17 14:09:52 +02:00
byte OC_checkSelectedCharacter();
2012-07-01 00:59:06 +02:00
byte OC_checkDelayedReactivation();
2018-03-22 23:30:37 +01:00
byte OC_checkTargetReached();
byte OC_checkFunctionKeyPressed();
byte OC_checkCodeEntered();
2012-05-11 20:47:17 +02:00
byte OC_checkViewPortCharacterTarget();
// Opcodes Type 2
void OC_setWord18821();
void OC_ChangeIsoMap();
2012-05-20 15:09:32 +02:00
void OC_startSpeech();
void OC_getComputedVariantSpeech();
void OC_getRotatingVariantSpeech();
2012-05-20 15:09:32 +02:00
void OC_startSpeechIfMute();
void OC_getComputedVariantSpeechIfMute();
void OC_startSpeechIfSilent();
void OC_ComputeCharacterVariable();
void OC_setAttributeToRandom();
void OC_setCharacterPosition();
void OC_DisableCharacter();
void OC_saveAndQuit();
2018-03-22 23:30:37 +01:00
void OC_nSkipOpcodes();
void OC_startSpeech5();
2018-03-23 08:07:40 +01:00
void OC_resetHandleOpcodeFlag();
void OC_deleteSavegameAndQuit();
void OC_incScriptForVal();
2018-03-23 08:07:40 +01:00
void OC_computeChararacterAttr();
void OC_setTextVarNumber();
void OC_callScript();
void OC_callScriptAndReturn();
void OC_setCurrentScriptCharacterPos();
void OC_initScriptFor();
2018-03-23 08:07:40 +01:00
void OC_setCurrentCharacterSequence();
void OC_setNextCharacterSequence();
void OC_setHost();
void OC_changeMapCube();
void OC_setCharacterCarry();
void OC_dropCarried();
void OC_setCurrentCharacter();
2018-03-24 02:15:54 +01:00
void OC_sendSeeSignal();
void OC_sendHearSignal();
2018-03-26 01:48:25 +02:00
void OC_sendVarSignal();
void OC_sendBroadcastSignal();
void OC_resetWaitingSignal();
void OC_enableCurrentCharacterScript();
void OC_IncCurrentCharacterVar1();
2018-03-26 01:48:25 +02:00
void OC_setCurrentCharacterPos();
void OC_setCurrentCharacterBehavior();
void OC_changeCurrentCharacterSprite();
void OC_sub17E99();
void OC_sub17EC5();
void OC_setCharacterDirectionTowardsPos();
void OC_turnCharacterTowardsAnother();
void OC_setSeek();
void OC_scrollAwayFromCharacter();
void OC_skipNextVal();
void OC_setCurrentCharacterAttr6();
void OC_setCurrentCharacterPose();
void OC_setCharacterScriptEnabled();
void OC_setCurrentCharacterAttr2();
void OC_clearCurrentCharacterAttr2();
2012-05-26 02:06:12 +02:00
void OC_setCharacterProperties();
void OC_setMonitoredCharacter();
void OC_setNewPose();
2012-04-30 17:57:23 +02:00
void OC_setCurrentCharacterDirection();
void OC_setInterfaceHotspot();
2012-06-17 14:44:30 +02:00
void OC_scrollViewPort();
2012-05-11 20:47:17 +02:00
void OC_setViewPortPos();
void OC_setCurrentCharacterAltitude();
void OC_setModePriority();
void setMode(EvaluatedMode newMode);
void OC_sub181BB();
void OC_sub18213();
void OC_magicPuffEntrance();
void OC_sub18260();
void OC_CharacterVariableAddOrRemoveFlag();
2012-04-22 23:07:09 +02:00
void OC_PaletteFadeOut();
void OC_PaletteFadeIn();
void OC_loadAndDisplayCubesGfx();
void OC_setCurrentCharacterAttr3();
2012-05-01 12:18:52 +02:00
void OC_setArray122C1();
void OC_sub18367();
void OC_enableCharacterScript();
void OC_setRulesBuffer2Element();
2012-04-29 11:48:10 +02:00
void OC_setDebugFlag();
void OC_setByte14837();
void OC_waitForEvent();
void OC_disableInterfaceHotspot();
void OC_loadFileAerial();
void OC_startSpeechIfSoundOff();
void OC_sub1844A();
2012-05-17 20:35:20 +02:00
void OC_displayNumericCharacterVariable();
void OC_displayVGAFile();
void OC_startSpeechWithoutSpeeker();
2012-04-10 10:06:50 +02:00
void OC_displayTitleScreen();
2012-05-17 20:35:20 +02:00
void OC_initGameAreaDisplay();
void OC_displayCharacterStatBar();
2012-05-11 17:01:00 +02:00
void OC_initSmallAnim();
void OC_setCharacterHeroismBar();
void OC_setCharacterHome();
2012-04-30 17:57:23 +02:00
void OC_setViewPortCharacterTarget();
void OC_showObject();
2018-03-29 00:28:12 +02:00
void OC_playObjectSound();
void OC_startLocationSound();
void OC_stopObjectSound();
void OC_stopLocationSound();
void OC_toggleSound();
void OC_playMusic();
void OC_stopMusic();
2012-06-20 07:49:21 +02:00
void OC_setCharacterMapColor();
};
} // End of namespace Lilliput
#endif