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 ACCESS_SCRIPTS_H
23 #define ACCESS_SCRIPTS_H
24 
25 #include "common/scummsys.h"
26 #include "common/memstream.h"
27 #include "access/data.h"
28 
29 namespace Access {
30 
31 class AccessEngine;
32 class Scripts;
33 
34 #define SCRIPT_START_BYTE 0xE0
35 #define INIT_ROOM_SCRIPT 1000
36 #define ROOM_SCRIPT 2000
37 
38 typedef void(Scripts::*ScriptMethodPtr)();
39 
40 class Scripts : public Manager {
41  friend class Debugger;
42 
43 private:
44  int _specialFunction;
45 
46  void clearWatch();
47  void printWatch();
48 
49 protected:
50  Resource *_resource;
52  ScriptMethodPtr COMMAND_LIST[100];
53 
54  virtual bool executeSpecial(int commandIndex, int param1, int param2) = 0;
55  virtual void executeCommand(int commandIndex);
56 
57  void charLoop();
58 
59  void cmdObject();
60  void cmdEndObject();
61  void cmdEndObject_v3();
62  void cmdJumpLook();
63  void cmdJumpOpen();
64  void cmdJumpHelp();
65  void cmdJumpGet();
66  void cmdJumpMove();
67  void cmdJumpUse();
68  void cmdJumpUse_v3();
69  void cmdJumpTalk();
70  void cmdJumpTalk_v3();
71  void cmdNull();
72  void cmdPrint_v1();
73  void cmdPrint_v2();
74  void cmdAnim();
75  void cmdSetFlag();
76  void cmdCheckFlag();
77 
81  void cmdGoto();
82 
83  void cmdAddScore();
84  void cmdSetInventory();
85  void cmdCheckInventory();
86  void cmdSetPlayerCoords();
87  void cmdNewRoom();
88  void cmdConverse();
89  void cmdCheckFrame();
90  void cmdCheckAnim();
91  void cmdSnd();
92  void cmdRetNeg();
93  void cmdBD();
94  void cmdCheckLoc();
95  void cmdSetAnim();
96  void cmdDispInv_v1();
97  void cmdDispInv_v2();
98  void cmdSetAbout();
99  void cmdSetTimer();
100  void cmdCheckTimer();
101  void cmdJumpGoto();
102  void cmdJumpGoto_v3();
103  void cmdSetTravel();
104  void cmdSetVideo_v1();
105  void cmdSetVideo_v3();
106  void cmdPlayVideo();
107  void cmdPlotImage();
108  void cmdSetDisplay();
109  void cmdSetBuffer();
110  void cmdSetScroll();
111  void cmdSaveRect();
112  void cmdVideoEnded();
113  void cmdSetBufVid();
114  void cmdPlayBufVid();
115  void cmdRemoveLast();
116  void cmdDoTravel();
117  void cmdCheckAbout();
118  void cmdSpecial();
119  void cmdSetCycle();
120  void cmdCycle();
121  void cmdCharSpeak();
122  void cmdTexSpeak();
123  void cmdTexChoice();
124  void cmdWait();
125  void cmdSetConPos();
126  void cmdCheckVFrame();
127  void cmdJumpChoice();
128  void cmdReturnChoice();
129  void cmdClearBlock();
130  void cmdLoadSound();
131  void cmdSetVideoSound();
132  void cmdPlayVideoSound();
133  void cmdPrintWatch();
134  void cmdDispAbout();
135  void cmdDispAbout_v3();
136  void cmdPushLocation();
137  void cmdPushLocation_v1();
138  void cmdCheckTravel();
139  void cmdBlock();
140  void cmdPlayerOff();
141  void cmdPlayerOn();
142  void cmdDead();
143  void cmdFadeOut();
144  void cmdFadeOut_v3();
145  void cmdEndVideo();
146  void cmdHelp_v1();
147  //void cmdHelp_v2(); // only in AmazonScripts
148  void cmdCycleBack();
149  void cmdSetHelp();
150  void cmdDoTravel_Noct();
151  void cmdDigitalPlay();
152  void cmdFillSound();
153  void cmdPlayVid1();
154  void cmdCharWait();
155  void cmdUndoText();
156  void cmdResetAnim();
157  void cmdWalkTo();
158  void cmdWalkCheck();
159  void cmdSoundEnd();
160  void cmdFadeWhite();
161  void cmdGotoFrame();
162  void cmdPlayerScale();
163  void cmdRestoreBlock();
164  void cmdCopyScnBuf();
165  void cmdStilWalkTo();
166  void cmdStilWalkCheck();
167  void cmdStilOff();
168  void cmdStilOn();
169  void cmdReturnExit();
170  void cmdSetCoords();
171  void cmdSetStilCoords();
172  void cmdSetPlayerDir();
173  void cmdSetStilDir();
174  void cmdStilScale();
175  void cmdLockInterface();
176  void cmdUnlockInterface();
177  void cmdCharSpeak_v3();
178  void cmdPlayerSpeak();
179  void cmdPlayerChoice();
180 
181 public:
182  int _sequence;
183  bool _endFlag;
184  int _returnCode;
185  int _scriptCommand;
186  int _choice;
187  int32 _choiceStart;
188  Common::Point _charsOrg, _texsOrg;
189 
190  int _continuenceType; // Only used in Noctropolis
191  bool _continuenceFlag; // Only set in Noctropolis (always false otherwise). See also room->_conFlag which is used in earlier games.
192 
193 public:
194  Scripts(AccessEngine *vm);
195 
196  virtual ~Scripts();
197 
198  void setOpcodes();
199  void setOpcodes_v2();
200  void setOpcodes_v3();
201 
202  void setScript(Resource *data, bool restartFlag = false);
203 
204  void freeScriptData();
205 
206  virtual void searchForSequence();
207 
208  int executeScript();
209 
210  void findNull();
211  void doCmdPrint_v1(const Common::String &msg);
212 
213 
217  void printString(const Common::String &msg, Common::Point pt = Common::Point(-1, -1));
218 
219  // Script commands that need to be public
220  void cmdFreeSound();
221  void cmdRetPos();
222  void converse1(int val);
223 };
224 
225 } // End of namespace Access
226 
227 #endif /* ACCESS_SCRIPTS_H */
Definition: str.h:59
Definition: data.h:37
Definition: access.h:141
Definition: scripts.h:40
Definition: stream.h:745
Definition: files.h:55
Definition: rect.h:144
Definition: debugger.h:34
void printString(const Common::String &msg, Common::Point pt=Common::Point(-1, -1))
Definition: access.h:62