ScummVM API documentation
scripts.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef LURE_SCRIPTS_H
23 #define LURE_SCRIPTS_H
24 
25 #include "lure/luredefs.h"
26 #include "lure/memory.h"
27 #include "lure/hotspots.h"
28 
29 namespace Lure {
30 
31 // Opcode list
32 #define S_OPCODE_ABORT 0
33 #define S_OPCODE_ADD 1
34 #define S_OPCODE_SUBTRACT 2
35 #define S_OPCODE_MULTIPLY 3
36 #define S_OPCODE_DIVIDE 4
37 #define S_OPCODE_EQUALS 5
38 #define S_OPCODE_NOT_EQUALS 6
39 #define S_OPCODE_LT 7
40 #define S_OPCODE_GT 8
41 #define S_OPCODE_LTE 9
42 #define S_OPCODE_GTE 10
43 #define S_OPCODE_AND 11
44 #define S_OPCODE_OR 12
45 #define S_OPCODE_LOGICAL_AND 13
46 #define S_OPCODE_LOGICAL_OR 14
47 #define S_OPCODE_GET_FIELD 15
48 #define S_OPCODE_SET_FIELD 16
49 #define S_OPCODE_PUSH 17
50 #define S_OPCODE_SUBROUTINE 18
51 #define S_OPCODE_EXEC 19
52 #define S_OPCODE_END 20
53 #define S_OPCODE_COND_JUMP 21
54 #define S_OPCODE_JUMP 22
55 #define S_OPCODE_ABORT2 23
56 #define S_OPCODE_ABORT3 24
57 #define S_OPCODE_RANDOM 25
58 
59 #define S2_OPCODE_FRAME_CTR -1
60 #define S2_OPCODE_POSITION -2
61 #define S2_OPCODE_CHANGE_POS -3
62 #define S2_OPCODE_UNLOAD -4
63 #define S2_OPCODE_DIMENSIONS -5
64 #define S2_OPCODE_JUMP -6
65 #define S2_OPCODE_ANIMATION -7
66 #define S2_OPCODE_PLAY_SOUND -8
67 #define S2_OPCODE_STOP_SOUND -9
68 #define S2_OPCODE_ACTIONS -10
69 
70 
71 
72 class Script {
73 public:
74  static uint16 execute(uint16 startOffset);
75 
76  static void executeMethod(int methodIndex, uint16 v1, uint16 v2, uint16 v3);
77  static void activateHotspot(uint16 hotspotId, uint16 v2, uint16 v3);
78  static void setHotspotScript(uint16 hotspotId, uint16 scriptIndex, uint16 v3);
79  static void addSound2(uint16 soundIndex, uint16 v2, uint16 v3);
80  static void setHotspotFlagMask(uint16 maskVal, uint16 v2, uint16 v3);
81  static void clearSequenceDelayList(uint16 v1, uint16 scriptIndex, uint16 v3);
82  static void deactivateHotspotSet(uint16 listIndex, uint16 v2, uint16 v3);
83  static void deactivateHotspot(uint16 hotspotId, uint16 v2, uint16 v3);
84  static void resetPathfinder(uint16 v1, uint16 v2, uint16 v3);
85  static void addDelayedSequence(uint16 seqOffset, uint16 delay, uint16 canClear);
86  static void killSound(uint16 soundNumber, uint16 v2, uint16 v3);
87  static void characterInRoom(uint16 characterId, uint16 roomNumber, uint16 v3);
88  static void setDesc(uint16 hotspotId, uint16 descId, uint16 v3);
89  static void setHotspotName(uint16 hotspotId, uint16 nameId, uint16 v3);
90  static void addSound(uint16 soundIndex, uint16 v2, uint16 v3);
91  static void endgameSequence(uint16 v1, uint16 v2, uint16 v3);
92  static void setupPigFight(uint16 v1, uint16 v2, uint16 v3);
93  static void displayDialog(uint16 stringId, uint16 v2, uint16 v3);
94  static void setupSkorlFight(uint16 v1, uint16 v2, uint16 v3);
95  static void remoteRoomViewSetup(uint16 v1, uint16 v2, uint16 v3);
96  static void startSpeakingToNoone(uint16 characterId, uint16 stringId, uint16 v3);
97  static void stopSound(uint16 soundIndex, uint16 v2, uint16 v3);
98  static void getDoorBlocked(uint16 hotspotId, uint16 v2, uint16 v3);
99  static void isSkorlInCell(uint16 v1, uint16 v2, uint16 v3);
100  static void ratpouchPushBricks(uint16 v1, uint16 v2, uint16 v3);
101  static void characterChangeRoom(uint16 y, uint16 x, uint16 roomNumber);
102  static void pauseRatpouch(uint16 v1, uint16 v2, uint16 v3);
103  static void setBlockingHotspotScript(uint16 charId, uint16 scriptIndex, uint16 v3);
104  static void decrInventoryItems(uint16 v1, uint16 v2, uint16 v3);
105  static void setTalking(uint16 characterId, uint16 destHotspot, uint16 messageId);
106  static void setActionCtr(uint16 hotspotId, uint16 value, uint16 v3);
107  static void startSpeaking(uint16 characterId, uint16 destHotspot, uint16 messageId);
108  static void disableHotspot(uint16 hotspotId, uint16 v2, uint16 v3);
109  static void cutSack(uint16 hotspotId, uint16 v2, uint16 v3);
110  static void increaseNumGroats(uint16 characterId, uint16 numGroats, uint16 v3);
111  static void enableHotspot(uint16 hotspotId, uint16 v2, uint16 v3);
112  static void displayMessage2(uint16 messageId, uint16 hotspotId, uint16 v3);
113  static void startOilBurner(uint16 v1, uint16 v2, uint16 v3);
114  static void transformPlayer(uint16 v1, uint16 v2, uint16 v3);
115  static void townHallClose(uint16 v1, uint16 v2, uint16 v3);
116  static void checkRoomNumber(uint16 hotspotId, uint16 roomNumber, uint16 v3);
117  static void makeGoewinFollow(uint16 v1, uint16 v2, uint16 v3);
118  static void doorClose(uint16 hotspotId, uint16 v2, uint16 v3);
119  static void fixGoewin(uint16 v1, uint16 v2, uint16 v3);
120  static void displayMessage(uint16 messageId, uint16 characterId, uint16 destCharacterId);
121  static void doorOpen(uint16 hotspotId, uint16 v2, uint16 v3);
122  static void npcWait(uint16 hotspotId, uint16 v2, uint16 v3);
123  static void checkWakeBrenda(uint16 v1, uint16 v2, uint16 v3);
124  static void setNewSupportData(uint16 index, uint16 hotspotId, uint16 v3);
125  static void setSupportData(uint16 hotspotId, uint16 index, uint16 v3);
126  static void givePlayerItem(uint16 hotspotId, uint16 v2, uint16 v3);
127  static void decreaseNumGroats(uint16 characterId, uint16 numGroats, uint16 v3);
128  static void makeGoewinWork(uint16 v1, uint16 v2, uint16 v3);
129  static void moveCharacterToPlayer(uint16 characterId, uint16 v2, uint16 v3);
130  static void setVillageSkorlTickProc(uint16 v1, uint16 v2, uint16 v3);
131  static void freeGoewin(uint16 v1, uint16 v2, uint16 v3);
132  static void barmanServe(uint16 v1, uint16 v2, uint16 v3);
133  static void getNumGroats(uint16 v1, uint16 v2, uint16 v3);
134  static void checkHasBook(uint16 v1, uint16 v2, uint16 v3);
135  static void enableGargoylesTalk(uint16 v1, uint16 v2, uint16 v3);
136  static void killPlayer(uint16 v1, uint16 v2, uint16 v3);
137  static void normalGoewin(uint16 v1, uint16 v2, uint16 v3);
138  static void animationLoad(uint16 hotspotId, uint16 v2, uint16 v3);
139  static void addActions(uint16 hotspotId, uint16 actions, uint16 v3);
140  static void randomToGeneral(uint16 maxVal, uint16 minVal, uint16 v3);
141  static void checkCellDoor(uint16 v1, uint16 v2, uint16 v3);
142  static void checkSound(uint16 soundNumber, uint16 v2, uint16 v3);
143 };
144 
146 private:
147  static int16 nextVal(MemoryBlock *data, uint16 &offset);
148 public:
149  static bool execute(Hotspot *h);
150 };
151 
152 } // End of namespace Lure
153 
154 #endif
Definition: scripts.h:72
Definition: hotspots.h:180
Definition: scripts.h:145
Definition: animseq.h:27
Definition: memory.h:31