2003-04-25 15:17:53 +00:00
|
|
|
/* ScummVM - Scumm Interpreter
|
2006-01-18 17:39:49 +00:00
|
|
|
* Copyright (C) 2003-2006 The ScummVM project
|
2003-04-25 15:17:53 +00:00
|
|
|
*
|
|
|
|
* 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
|
2005-10-18 01:30:26 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2003-04-25 15:17:53 +00:00
|
|
|
*
|
|
|
|
* $Header$
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SKYLOGIC_H
|
|
|
|
#define SKYLOGIC_H
|
|
|
|
|
2005-06-24 15:23:51 +00:00
|
|
|
#include "common/stdafx.h"
|
2003-10-05 20:21:20 +00:00
|
|
|
#include "common/util.h"
|
|
|
|
|
2004-01-03 01:58:58 +00:00
|
|
|
namespace Sky {
|
|
|
|
|
2003-10-05 20:21:20 +00:00
|
|
|
struct Compact;
|
2003-04-25 15:17:53 +00:00
|
|
|
|
2003-05-26 17:56:17 +00:00
|
|
|
enum scriptVariableOffsets {
|
|
|
|
RESULT = 0,
|
|
|
|
SCREEN = 1,
|
|
|
|
LOGIC_LIST_NO = 2,
|
2003-06-04 17:13:24 +00:00
|
|
|
MOUSE_LIST_NO = 6,
|
2003-05-27 16:42:20 +00:00
|
|
|
DRAW_LIST_NO = 8,
|
2003-05-26 17:56:17 +00:00
|
|
|
CUR_ID = 12,
|
|
|
|
MOUSE_STATUS = 13,
|
|
|
|
MOUSE_STOP = 14,
|
2003-06-04 17:13:24 +00:00
|
|
|
BUTTON = 15,
|
|
|
|
SPECIAL_ITEM = 17,
|
2003-05-26 17:56:17 +00:00
|
|
|
GET_OFF = 18,
|
2003-06-05 18:54:26 +00:00
|
|
|
CURSOR_ID = 22,
|
|
|
|
SAFEX = 25,
|
|
|
|
SAFEY = 26,
|
2003-05-26 17:56:17 +00:00
|
|
|
PLAYER_X = 27,
|
|
|
|
PLAYER_Y = 28,
|
|
|
|
PLAYER_MOOD = 29,
|
|
|
|
PLAYER_SCREEN = 30,
|
|
|
|
HIT_ID = 37,
|
2003-05-27 16:42:20 +00:00
|
|
|
LAYER_0_ID = 41,
|
|
|
|
LAYER_1_ID = 42,
|
|
|
|
LAYER_2_ID = 43,
|
|
|
|
LAYER_3_ID = 44,
|
|
|
|
GRID_1_ID = 45,
|
|
|
|
GRID_2_ID = 46,
|
|
|
|
GRID_3_ID = 47,
|
2003-05-26 17:56:17 +00:00
|
|
|
THE_CHOSEN_ONE = 51,
|
|
|
|
TEXT1 = 53,
|
|
|
|
MENU_LENGTH = 100,
|
|
|
|
SCROLL_OFFSET = 101,
|
|
|
|
MENU = 102,
|
2003-07-10 08:24:16 +00:00
|
|
|
OBJECT_HELD = 103,
|
2004-09-14 20:46:04 +00:00
|
|
|
LAMB_GREET = 109,
|
2003-06-06 20:54:52 +00:00
|
|
|
RND = 115,
|
2003-06-01 21:21:10 +00:00
|
|
|
CUR_SECTION = 143,
|
2004-09-14 20:46:04 +00:00
|
|
|
JOEY_SECTION = 145,
|
|
|
|
LAMB_SECTION = 146,
|
|
|
|
KNOWS_PORT = 190,
|
|
|
|
GOT_SPONSOR = 240,
|
|
|
|
GOT_JAMMER = 258,
|
2003-07-01 13:04:00 +00:00
|
|
|
CONSOLE_TYPE = 345,
|
2004-09-14 20:46:04 +00:00
|
|
|
S15_FLOOR = 450,
|
|
|
|
FOREMAN_FRIEND = 451,
|
2003-07-01 01:29:29 +00:00
|
|
|
REICH_DOOR_FLAG = 470,
|
2004-09-14 20:46:04 +00:00
|
|
|
CARD_STATUS = 479,
|
|
|
|
CARD_FIX = 480,
|
|
|
|
GUARDIAN_THERE = 640,
|
2003-07-01 13:04:00 +00:00
|
|
|
FS_COMMAND = 643,
|
|
|
|
ENTER_DIGITS = 644,
|
2003-07-01 01:29:29 +00:00
|
|
|
LINC_DIGIT_0 = 646,
|
|
|
|
LINC_DIGIT_1 = 647,
|
|
|
|
LINC_DIGIT_2 = 648,
|
|
|
|
LINC_DIGIT_3 = 649,
|
|
|
|
LINC_DIGIT_4 = 650,
|
|
|
|
LINC_DIGIT_5 = 651,
|
|
|
|
LINC_DIGIT_6 = 651,
|
|
|
|
LINC_DIGIT_7 = 653,
|
|
|
|
LINC_DIGIT_8 = 654,
|
2004-09-14 20:46:04 +00:00
|
|
|
LINC_DIGIT_9 = 655,
|
|
|
|
DOOR_67_68_FLAG = 678,
|
|
|
|
SC70_IRIS_FLAG = 693,
|
|
|
|
DOOR_73_75_FLAG = 704,
|
|
|
|
SC76_CABINET1_FLAG = 709,
|
|
|
|
SC76_CABINET2_FLAG = 710,
|
|
|
|
SC76_CABINET3_FLAG = 711,
|
|
|
|
DOOR_77_78_FLAG = 719,
|
|
|
|
SC80_EXIT_FLAG = 720,
|
|
|
|
SC31_LIFT_FLAG = 793,
|
|
|
|
SC32_LIFT_FLAG = 797,
|
|
|
|
SC33_SHED_DOOR_FLAG = 798,
|
|
|
|
BAND_PLAYING = 804,
|
|
|
|
COLSTON_AT_TABLE = 805,
|
|
|
|
SC36_NEXT_DEALER = 806,
|
|
|
|
SC36_DOOR_FLAG = 807,
|
|
|
|
SC37_DOOR_FLAG = 808,
|
|
|
|
SC40_LOCKER_1_FLAG = 817,
|
|
|
|
SC40_LOCKER_2_FLAG = 818,
|
|
|
|
SC40_LOCKER_3_FLAG = 819,
|
|
|
|
SC40_LOCKER_4_FLAG = 820,
|
|
|
|
SC40_LOCKER_5_FLAG = 821
|
2003-05-26 17:56:17 +00:00
|
|
|
};
|
|
|
|
|
2004-12-16 04:22:32 +00:00
|
|
|
#define NUM_SKY_SCRIPTVARS 838
|
|
|
|
|
2004-01-03 15:57:57 +00:00
|
|
|
class AutoRoute;
|
|
|
|
class Control;
|
|
|
|
class Disk;
|
|
|
|
class Grid;
|
|
|
|
class Mouse;
|
|
|
|
class MusicBase;
|
|
|
|
class Screen;
|
|
|
|
class Sound;
|
|
|
|
class Text;
|
2004-12-15 06:48:08 +00:00
|
|
|
class SkyCompact;
|
2003-05-27 16:42:20 +00:00
|
|
|
|
2004-12-16 04:22:32 +00:00
|
|
|
class Logic;
|
|
|
|
|
|
|
|
typedef void (Logic::*LogicTable) ();
|
|
|
|
typedef bool (Logic::*McodeTable) (uint32, uint32, uint32);
|
|
|
|
|
2004-01-03 15:57:57 +00:00
|
|
|
class Logic {
|
2003-04-25 15:17:53 +00:00
|
|
|
public:
|
2004-01-03 15:57:57 +00:00
|
|
|
Logic(
|
2004-12-15 06:48:08 +00:00
|
|
|
SkyCompact *skyCompact,
|
2004-01-03 15:57:57 +00:00
|
|
|
Screen *skyScreen,
|
|
|
|
Disk *skyDisk,
|
|
|
|
Text *skyText,
|
|
|
|
MusicBase *skyMusic,
|
|
|
|
Mouse *skyMouse,
|
|
|
|
Sound *skySound);
|
2005-12-05 05:02:43 +00:00
|
|
|
~Logic(void);
|
2003-04-25 15:17:53 +00:00
|
|
|
void engine();
|
2004-01-03 15:57:57 +00:00
|
|
|
void useControlInstance(Control *control) { _skyControl = control; };
|
2003-04-25 15:17:53 +00:00
|
|
|
|
2004-12-16 04:22:32 +00:00
|
|
|
uint16 mouseScript(uint32 scrNum, Compact *scriptComp);
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2004-12-16 04:22:32 +00:00
|
|
|
static uint32 _scriptVariables[NUM_SKY_SCRIPTVARS];
|
|
|
|
Grid *_skyGrid;
|
|
|
|
|
|
|
|
uint16 script(uint16 scriptNo, uint16 offset);
|
|
|
|
void initScreen0(void);
|
|
|
|
void parseSaveData(uint32 *data);
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2005-11-05 19:06:01 +00:00
|
|
|
private:
|
|
|
|
void setupLogicTable();
|
|
|
|
void setupMcodeTable();
|
|
|
|
const LogicTable *_logicTable;
|
|
|
|
const McodeTable *_mcodeTable;
|
|
|
|
|
2004-12-16 04:22:32 +00:00
|
|
|
protected:
|
|
|
|
void push(uint32);
|
|
|
|
uint32 pop();
|
|
|
|
void checkModuleLoaded(uint16 moduleNo);
|
|
|
|
bool collide(Compact *cpt);
|
|
|
|
void initScriptVariables();
|
|
|
|
void mainAnim();
|
|
|
|
void runGetOff();
|
|
|
|
void stopAndWait();
|
|
|
|
bool checkProtection(void);
|
|
|
|
|
2003-05-25 15:41:48 +00:00
|
|
|
void nop();
|
2003-04-25 15:17:53 +00:00
|
|
|
void logicScript();
|
|
|
|
void autoRoute();
|
|
|
|
void arAnim();
|
|
|
|
void arTurn();
|
|
|
|
void alt();
|
|
|
|
void anim();
|
|
|
|
void turn();
|
|
|
|
void cursor();
|
|
|
|
void talk();
|
|
|
|
void listen();
|
|
|
|
void stopped();
|
|
|
|
void choose();
|
|
|
|
void frames();
|
|
|
|
void pause();
|
|
|
|
void waitSync();
|
|
|
|
void simpleAnim();
|
|
|
|
|
2003-05-26 20:54:58 +00:00
|
|
|
bool fnCacheChip(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnCacheFast(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnDrawScreen(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnAr(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnArAnimate(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnIdle(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnInteract(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnStartSub(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnTheyStartSub(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnAssignBase(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnDiskMouse(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnNormalMouse(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnBlankMouse(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnCrossMouse(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnCursorRight(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnCursorLeft(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnCursorDown(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnOpenHand(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnCloseHand(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnGetTo(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnSetToStand(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnTurnTo(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnArrived(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnLeaving(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnSetAlternate(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnAltSetAlternate(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnKillId(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnNoHuman(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnAddHuman(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnAddButtons(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnNoButtons(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnSetStop(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnClearStop(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnPointerText(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnQuit(uint32 a, uint32 b, uint32 c);
|
2003-05-30 13:47:33 +00:00
|
|
|
bool fnSpeakMe(uint32 targetId, uint32 mesgNum, uint32 animNum);
|
|
|
|
bool fnSpeakMeDir(uint32 targetId, uint32 mesgNum, uint32 animNum);
|
2003-05-26 20:54:58 +00:00
|
|
|
bool fnSpeakWait(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnSpeakWaitDir(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnChooser(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnHighlight(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnTextKill(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnStopMode(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnWeWait(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnSendSync(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnSendFastSync(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnSendRequest(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnClearRequest(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnCheckRequest(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnStartMenu(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnUnhighlight(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnFaceId(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnForeground(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnBackground(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnNewBackground(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnSort(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnNoSpriteEngine(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnNoSpritesA6(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnResetId(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnToggleGrid(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnPause(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnRunAnimMod(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnSimpleMod(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnRunFrames(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnAwaitSync(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnIncMegaSet(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnDecMegaSet(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnSetMegaSet(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnMoveItems(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnNewList(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnAskThis(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnRandom(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnPersonHere(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnToggleMouse(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnMouseOn(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnMouseOff(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnFetchX(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnFetchY(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnTestList(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnFetchPlace(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnCustomJoey(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnSetPalette(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnTextModule(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnChangeName(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnMiniLoad(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnFlushBuffers(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnFlushChip(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnSaveCoods(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnPlotGrid(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnRemoveGrid(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnEyeball(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnCursorUp(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnLeaveSection(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnEnterSection(uint32 sectionNo, uint32 b, uint32 c);
|
|
|
|
bool fnRestoreGame(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnRestartGame(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnNewSwingSeq(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnWaitSwingEnd(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnSkipIntroCode(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnBlankScreen(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnPrintCredit(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnLookAt(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnLincTextModule(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnTextKill2(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnSetFont(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnStartFx(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnStopFx(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnStartMusic(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnStopMusic(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnFadeDown(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnFadeUp(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnQuitToDos(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnPauseFx(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnUnPauseFx(uint32 a, uint32 b, uint32 c);
|
|
|
|
bool fnPrintf(uint32 a, uint32 b, uint32 c);
|
2003-04-25 15:17:53 +00:00
|
|
|
|
2003-05-30 14:20:32 +00:00
|
|
|
void stdSpeak(Compact *target, uint32 textNum, uint32 animNum, uint32 base);
|
2004-09-13 17:05:23 +00:00
|
|
|
void fnExec(uint16 num, uint32 a, uint32 b, uint32 c);
|
2003-04-25 15:17:53 +00:00
|
|
|
|
2003-04-26 14:00:59 +00:00
|
|
|
uint16 *_moduleList[16];
|
|
|
|
uint32 _stack[20];
|
|
|
|
byte _stackPtr;
|
|
|
|
|
2003-04-25 15:17:53 +00:00
|
|
|
Compact *_compact;
|
2003-05-26 17:41:19 +00:00
|
|
|
|
|
|
|
uint32 _objectList[30];
|
2003-04-25 15:17:53 +00:00
|
|
|
|
2003-05-05 13:19:59 +00:00
|
|
|
uint32 _currentSection;
|
2003-06-06 20:54:52 +00:00
|
|
|
|
2003-10-04 11:50:21 +00:00
|
|
|
Common::RandomSource _rnd;
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2004-12-15 06:48:08 +00:00
|
|
|
SkyCompact *_skyCompact;
|
|
|
|
Screen *_skyScreen;
|
|
|
|
Disk *_skyDisk;
|
|
|
|
Text *_skyText;
|
|
|
|
MusicBase *_skyMusic;
|
|
|
|
Sound *_skySound;
|
|
|
|
AutoRoute *_skyAutoRoute;
|
|
|
|
Mouse *_skyMouse;
|
|
|
|
Control *_skyControl;
|
2004-12-16 04:22:32 +00:00
|
|
|
|
|
|
|
friend class Debugger;
|
2003-04-25 15:17:53 +00:00
|
|
|
};
|
|
|
|
|
2004-01-03 01:58:58 +00:00
|
|
|
} // End of namespace Sky
|
|
|
|
|
2003-04-25 15:17:53 +00:00
|
|
|
#endif
|