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 ROOM_SCRIPT 2000
36 #define INIT_ROOM_SCRIPT 1000
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 void 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 cmdJumpLook();
62  void cmdJumpOpen();
63  void cmdJumpHelp();
64  void cmdJumpGet();
65  void cmdJumpMove();
66  void cmdJumpUse();
67  void cmdJumpTalk();
68  void cmdNull();
69  void cmdPrint_v1();
70  void cmdPrint_v2();
71  void cmdAnim();
72  void cmdSetFlag();
73  void cmdCheckFlag();
74 
78  void cmdGoto();
79 
80  void cmdAddScore();
81  void cmdSetInventory();
82  void cmdCheckInventory();
83  void cmdSetTex();
84  void cmdNewRoom();
85  void cmdConverse();
86  void cmdCheckFrame();
87  void cmdCheckAnim();
88  void cmdSnd();
89  void cmdRetNeg();
90  void cmdCheckLoc();
91  void cmdSetAnim();
92  void cmdDispInv_v1();
93  void cmdDispInv_v2();
94  void cmdSetAbout();
95  void cmdSetTimer();
96  void cmdCheckTimer();
97  void cmdJumpGoto();
98  void cmdSetTravel();
99  void cmdSetVideo();
100  void cmdPlayVideo();
101  void cmdPlotImage();
102  void cmdSetDisplay();
103  void cmdSetBuffer();
104  void cmdSetScroll();
105  void cmdSaveRect();
106  void cmdVideoEnded();
107  void cmdSetBufVid();
108  void cmdPlayBufVid();
109  void cmdRemoveLast();
110  void cmdDoTravel();
111  void cmdCheckAbout();
112  void cmdSpecial();
113  void cmdSetCycle();
114  void cmdCycle();
115  void cmdCharSpeak();
116  void cmdTexSpeak();
117  void cmdTexChoice();
118  void cmdWait();
119  void cmdSetConPos();
120  void cmdCheckVFrame();
121  void cmdJumpChoice();
122  void cmdReturnChoice();
123  void cmdClearBlock();
124  void cmdLoadSound();
125  void cmdSetVideoSound();
126  void cmdPlayVideoSound();
127  void cmdPrintWatch();
128  void cmdDispAbout();
129  void cmdPushLocation();
130  void cmdPushLocation_v1();
131  void cmdCheckTravel();
132  void cmdBlock();
133  void cmdPlayerOff();
134  void cmdPlayerOn();
135  void cmdDead();
136  void cmdFadeOut();
137  void cmdEndVideo();
138  void cmdHelp_v1();
139  void cmdHelp_v2();
140  void cmdCycleBack();
141  void cmdSetHelp();
142 public:
143  int _sequence;
144  bool _endFlag;
145  int _returnCode;
146  int _scriptCommand;
147  int _choice;
148  int32 _choiceStart;
149  Common::Point _charsOrg, _texsOrg;
150 
151 public:
152  Scripts(AccessEngine *vm);
153 
154  virtual ~Scripts();
155 
156  void setOpcodes();
157  void setOpcodes_v2();
158 
159  void setScript(Resource *data, bool restartFlag = false);
160 
161  void freeScriptData();
162 
163  void searchForSequence();
164 
165  int executeScript();
166 
167  void findNull();
168  void doCmdPrint_v1(const Common::String &msg);
169 
173  void printString(const Common::String &msg);
174 
175  // Script commands that need to be public
176  void cmdFreeSound();
177  void cmdRetPos();
178  void converse1(int val);
179 };
180 
181 } // End of namespace Access
182 
183 #endif /* ACCESS_SCRIPTS_H */
void printString(const Common::String &msg)
Definition: str.h:59
Definition: data.h:37
Definition: access.h:139
Definition: scripts.h:40
Definition: stream.h:745
Definition: files.h:54
Definition: rect.h:144
Definition: debugger.h:34
Definition: access.h:62