ScummVM API documentation
scumm_v0.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_V0_H
23 #define SCUMM_SCRIPT_V0_H
24 
25 #include "scumm/scumm_v2.h"
26 
27 namespace Scumm {
28 
33 protected:
34  enum CurrentMode {
35  kModeCutscene = 0, // cutscene active
36  kModeKeypad = 1, // kid selection / dial pad / save-load dialog
37  kModeNoNewKid = 2, // verb "new kid" disabled (e.g. when entering lab)
38  kModeNormal = 3 // normal playing mode
39  };
40 
41  enum WalkToObjectState {
42  kWalkToObjectStateDone = 0,
43  kWalkToObjectStateWalk = 1,
44  kWalkToObjectStateTurn = 2
45  };
46 
47 protected:
48  bool _drawDemo;
49  byte _currentMode;
50  byte _currentLights;
51 
52  int _activeVerb; // selected verb
53  int _activeObject; // 1st selected object (see OBJECT_V0())
54  int _activeObject2; // 2nd selected object or actor (see OBJECT_V0())
55 
56  int _cmdVerb; // script verb
57  int _cmdObject; // 1st script object (see OBJECT_V0())
58  int _cmdObject2; // 2nd script object or actor (see OBJECT_V0())
59  int _sentenceNestedCount;
60 
61  int _walkToObject;
62  int _walkToObjectState;
63  bool _redrawSentenceLine;
64 
65 public:
66  ScummEngine_v0(OSystem *syst, const DetectorResult &dr);
67 
68  void resetScumm() override;
69 
70  byte walkboxFindTarget(Actor *a, int destbox, Common::Point walkdest);
71 
72  /* Delay calculation */
73  void DelayReset();
74  int DelayCalculateDelta();
75 
76 protected:
77  void resetRoomObject(ObjectData *od, const byte *room, const byte *searchptr = NULL) override;
78 
79  void setupOpcodes() override;
80 
81  void setupScummVars() override;
82  void resetScummVars() override;
83  void scummLoop(int delta) override;
84  void decodeParseString() override;
85 
86  void processInput() override;
87 
88  void saveLoadWithSerializer(Common::Serializer &s) override;
89  void terminateSaveMenuScript() override;
90 
91  bool objIsActor(int obj) override;
92  int objToActor(int obj) override;
93  int actorToObj(int actor) override;
94 
95  // V0 MM Verb commands
96  int getVerbPrepId();
97  int activeVerbPrep();
98  void walkToActorOrObject(int object);
99  void verbExec();
100 
101  virtual void runSentenceScript();
102  void checkAndRunSentenceScript() override;
103  bool checkPendingWalkAction();
104  bool checkSentenceComplete();
105  void checkExecVerbs() override;
106  void handleMouseOver(bool updateInventory) override;
107  int verbPrepIdType(int verbid);
108  void resetVerbs();
109  void verbDemoMode();
110  void verbDrawDemoString(int VerbDemoNumber);
111 
112  void clearSentenceLine();
113  void flushSentenceLine();
114  void drawSentenceObject(int object);
115  void drawSentenceLine();
116 
117  void setMode(byte mode);
118 
119  void switchActor(int slot);
120 
121  int getVarOrDirectWord(byte mask) override;
122  uint fetchScriptWord() override;
123 
124  int getActiveObject() override;
125 
126  void resetSentence() override;
127 
128  bool areBoxesNeighbors(int box1nr, int box2nr) override;
129 
130  bool ifEqualActiveObject2Common(bool checkType);
131 
132  int getCurrentLights() const override;
133 
134  /* Version 0 script opcodes */
135  void o_stopCurrentScript();
136  void o_walkActorToObject();
137  void o_loadSound();
138  void o_getActorMoving();
139  void o_animateActor();
140  void o_putActorAtObject();
141  void o_pickupObject();
142  void o_setObjectName();
143  void o_lockSound();
144  void o_lockCostume();
145  void o_loadCostume();
146  void o_loadRoom();
147  void o_loadRoomWithEgo();
148  void o_lockScript();
149  void o_loadScript();
150  void o_lockRoom();
151  void o_setMode();
152  void o_lights();
153  void o_unlockCostume();
154  void o_unlockScript();
155  void o_decrement();
156  void o_nop();
157  void o_getObjectOwner();
158  void o_getActorBitVar();
159  void o_setActorBitVar();
160  void o_getBitVar();
161  void o_setBitVar();
162  void o_doSentence();
163  void o_ifEqualActiveObject2();
164  void o_ifNotEqualActiveObject2();
165  void o_getClosestActor();
166  void o_printEgo();
167  void o_print();
168  void o_unlockRoom();
169  void o_unlockSound();
170  void o_cutscene();
171  void o_endCutscene();
172  void o_setOwnerOf();
173  void o_screenPrepare();
174 
175  byte VAR_ACTIVE_OBJECT2;
176  byte VAR_IS_SOUND_RUNNING;
177  byte VAR_ACTIVE_VERB;
178 };
179 
180 
181 } // End of namespace Scumm
182 
183 #endif
Definition: serializer.h:79
Definition: scumm_v2.h:32
Definition: object.h:64
Definition: rect.h:45
Definition: actor.h:97
Definition: system.h:161
Definition: actor.h:30
Definition: scumm_v0.h:32
Definition: detection.h:131