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
27namespace Scumm {
28
33protected:
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
47protected:
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
65public:
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
76protected:
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 int checkSoundEngineSaveDataSize(Serializer &s) override;
90 void terminateSaveMenuScript() override;
91
92 bool objIsActor(int obj) override;
93 int objToActor(int obj) override;
94 int actorToObj(int actor) override;
95
96 // V0 MM Verb commands
97 int getVerbPrepId();
98 int activeVerbPrep();
99 void walkToActorOrObject(int object);
100 void verbExec();
101
102 virtual void runSentenceScript();
103 void checkAndRunSentenceScript() override;
104 bool checkPendingWalkAction();
105 bool checkSentenceComplete();
106 void checkExecVerbs() override;
107 void handleMouseOver(bool updateInventory) override;
108 int verbPrepIdType(int verbid);
109 void resetVerbs();
110 void verbDemoMode();
111 void verbDrawDemoString(int VerbDemoNumber);
112
113 void clearSentenceLine();
114 void flushSentenceLine();
115 void drawSentenceObject(int object);
116 void drawSentenceLine();
117
118 void setMode(byte mode);
119
120 void switchActor(int slot);
121
122 int getVarOrDirectWord(byte mask) override;
123 uint fetchScriptWord() override;
124
125 int getActiveObject() override;
126
127 void resetSentence() override;
128
129 bool areBoxesNeighbors(int box1nr, int box2nr) override;
130
131 bool ifEqualActiveObject2Common(bool checkType);
132
133 int getCurrentLights() const override;
134
135 /* Version 0 script opcodes */
136 void o_stopCurrentScript();
137 void o_walkActorToObject();
138 void o_loadSound();
139 void o_getActorMoving();
140 void o_animateActor();
141 void o_putActorAtObject();
142 void o_pickupObject();
143 void o_setObjectName();
144 void o_lockSound();
145 void o_lockCostume();
146 void o_loadCostume();
147 void o_loadRoom();
148 void o_loadRoomWithEgo();
149 void o_lockScript();
150 void o_loadScript();
151 void o_lockRoom();
152 void o_setMode();
153 void o_lights();
154 void o_unlockCostume();
155 void o_unlockScript();
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:80
Definition: system.h:166
Definition: actor.h:100
Definition: scumm_v0.h:32
Definition: scumm_v2.h:32
Definition: serializer.h:33
Definition: actor.h:30
Definition: rect.h:144
Definition: detection.h:144
Definition: object.h:64