ScummVM API documentation
scumm_v2.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 SCUMM_SCRIPT_V2_H
23 #define SCUMM_SCRIPT_V2_H
24 
25 #include "scumm/scumm_v3.h"
26 
27 namespace Scumm {
28 
33 protected:
34  struct V2MouseoverBox {
35  Common::Rect rect;
36  byte color;
37  byte hicolor;
38  };
39 
40  V2MouseoverBox _mouseOverBoxesV2[7];
41  int8 _mouseOverBoxV2;
42 
43  Common::String _sentenceBuf;
44  uint16 _inventoryOffset;
45 
46 public:
47  ScummEngine_v2(OSystem *syst, const DetectorResult &dr);
48 
49  void resetScumm() override;
50 
51  void checkV2MouseOver(Common::Point pos);
52  int checkV2Inventory(int x, int y);
53  void redrawV2Inventory();
54 
55 protected:
56  byte _hiLiteColorVerbArrow = 0x0E;
57  byte _hiLiteColorInvSentence = 0x0E;
58 
59 protected:
60  void setupOpcodes() override;
61 
62  void setupScummVars() override;
63  void resetScummVars() override;
64  void decodeParseString() override;
65 
66  void saveLoadWithSerializer(Common::Serializer &s) override;
67  void terminateSaveMenuScript() override;
68 
69  void processKeyboard(Common::KeyState lastKeyHit) override;
70 
71  void readIndexFile() override;
72  void readClassicIndexFile(); // V1
73  void readEnhancedIndexFile(); // V2
74  void readGlobalObjects() override;
75  void loadCharset(int no) override;
76 
77  void runInputScript(int clickArea, int val, int mode) override;
78  void runInventoryScript(int) override;
79  void runInventoryScriptEx(int) override;
80 
81  int getVar() override;
82 
83  void getResultPosIndirect();
84  void getResultPos() override;
85 
86  int readVar(uint var) override;
87  void writeVar(uint var, int value) override;
88 
89 protected:
90  virtual int getActiveObject();
91  void ifStateZeroCommon(byte type);
92  void ifStateNotZeroCommon(byte type);
93  void setStateCommon(byte type);
94  void clearStateCommon(byte type);
95  void stopScriptCommon(int script);
96 
97  void drawSentence() override;
98  void resetSentence() override;
99  void setUserState(byte state);
100 
101  void beginCutscene(int *args) override { o2_cutscene(); }
102  void endCutscene() override { o2_endCutscene(); }
103 
104  void handleMouseOver(bool updateInventory) override;
105  void checkExecVerbs() override;
106  void initV2MouseOver();
107  void initNESMouseOver();
108 
109  void setBuiltinCursor(int index) override;
110  void setSnailCursor() override;
111  void adaptCursorToVideoMode();
112 
113  void drawPreposition(int index);
114 
115  void walkActorToObject(int actor, int obj);
116 
117  /* Version 2 script opcodes */
118  void o2_actorFromPos();
119  void o2_actorOps();
120  void o2_add();
121  void o2_addIndirect();
122  void o2_assignVarByte();
123  void o2_assignVarWordIndirect();
124  void o2_beginOverride();
125  void o2_chainScript();
126  void o2_setStateUnpickupable();
127  void o2_setStateTouchable();
128  void o2_setStateUnlocked();
129  void o2_setStateIntrinsicOff();
130  void o2_cursorCommand();
131  void o2_cutscene();
132  void o2_delay();
133  void o2_doSentence();
134  void o2_drawObject();
135  void o2_drawSentence();
136  void o2_dummy();
137  void o2_endCutscene();
138  void o2_findObject();
139  void o2_getActorWalkBox();
140  void o2_getActorX();
141  void o2_getActorY();
142  void o2_getBitVar();
143  void o2_getObjPreposition();
144  void o2_ifClassOfIs();
145  void o2_ifStatePickupable();
146  void o2_ifStateUntouchable();
147  void o2_ifStateLocked();
148  void o2_ifStateIntrinsicOn();
149  void o2_ifStateUnpickupable();
150  void o2_ifStateTouchable();
151  void o2_ifStateUnlocked();
152  void o2_ifStateIntrinsicOff();
153  void o2_isGreater();
154  void o2_isGreaterEqual();
155  void o2_isLess();
156  void o2_isLessEqual();
157  void o2_lights();
158  void o2_loadRoomWithEgo();
159  void o2_panCameraTo();
160  void o2_pickupObject();
161  void o2_putActor();
162  void o2_putActorAtObject();
163  void o2_putActorInRoom();
164  void o2_resourceRoutines();
165  void o2_restart();
166  void o2_roomOps();
167  void o2_getActorElevation();
168  void o2_setActorElevation();
169  void o2_setBitVar();
170  void o2_setCameraAt();
171  void o2_setObjPreposition();
172  void o2_setOwnerOf();
173  void o2_setStatePickupable();
174  void o2_setStateUntouchable();
175  void o2_setStateLocked();
176  void o2_setStateIntrinsicOn();
177  void o2_startScript();
178  void o2_stopScript();
179  void o2_subtract();
180  void o2_subIndirect();
181  void o2_switchCostumeSet();
182  void o2_verbOps();
183  void o2_waitForActor();
184  void o2_waitForMessage();
185  void o2_waitForSentence();
186  void o2_walkActorTo();
187  void o2_walkActorToObject();
188 
189  byte VAR_SENTENCE_VERB;
190  byte VAR_SENTENCE_OBJECT1;
191  byte VAR_SENTENCE_OBJECT2;
192  byte VAR_SENTENCE_PREPOSITION;
193  byte VAR_BACKUP_VERB;
194 
195  byte VAR_CLICK_AREA;
196  byte VAR_CLICK_VERB;
197  byte VAR_CLICK_OBJECT;
198 };
199 
200 
201 } // End of namespace Scumm
202 
203 #endif
Definition: str.h:59
Definition: scumm_v3.h:58
Definition: rect.h:144
Definition: serializer.h:79
Definition: scumm_v2.h:32
Definition: rect.h:45
Definition: keyboard.h:294
Definition: system.h:161
Definition: actor.h:30
Definition: scumm_v2.h:34
Definition: detection.h:131