File: scumm_v2.h

package info (click to toggle)
scummvm 2.9.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 450,268 kB
  • sloc: cpp: 4,297,604; asm: 28,322; python: 12,901; sh: 11,219; java: 8,477; xml: 7,843; perl: 2,633; ansic: 2,465; yacc: 1,670; javascript: 1,020; makefile: 933; lex: 578; awk: 275; objc: 82; sed: 11; php: 1
file content (203 lines) | stat: -rw-r--r-- 5,219 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
/* ScummVM - Graphic Adventure Engine
 *
 * ScummVM is the legal property of its developers, whose names
 * are too numerous to list here. Please refer to the COPYRIGHT
 * file distributed with this source distribution.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

#ifndef SCUMM_SCRIPT_V2_H
#define SCUMM_SCRIPT_V2_H

#include "scumm/scumm_v3.h"

namespace Scumm {

/**
 * Engine for version 2 SCUMM games.
 */
class ScummEngine_v2 : public ScummEngine_v3old {
protected:
	struct V2MouseoverBox {
		Common::Rect rect;
		byte color;
		byte hicolor;
	};

	V2MouseoverBox _mouseOverBoxesV2[7];
	int8 _mouseOverBoxV2;

	Common::String _sentenceBuf;
	uint16 _inventoryOffset;

public:
	ScummEngine_v2(OSystem *syst, const DetectorResult &dr);

	void resetScumm() override;

	void checkV2MouseOver(Common::Point pos);
	int checkV2Inventory(int x, int y);
	void redrawV2Inventory();

protected:
	byte _hiLiteColorVerbArrow = 0x0E;
	byte _hiLiteColorInvSentence = 0x0E;

protected:
	void setupOpcodes() override;

	void setupScummVars() override;
	void resetScummVars() override;
	void decodeParseString() override;

	void saveLoadWithSerializer(Common::Serializer &s) override;
	void terminateSaveMenuScript() override;

	void processKeyboard(Common::KeyState lastKeyHit) override;

	void readIndexFile() override;
	void readClassicIndexFile();	// V1
	void readEnhancedIndexFile();	// V2
	void readGlobalObjects() override;
	void loadCharset(int no) override;

	void runInputScript(int clickArea, int val, int mode) override;
	void runInventoryScript(int) override;
	void runInventoryScriptEx(int) override;

	int getVar() override;

	void getResultPosIndirect();
	void getResultPos() override;

	int readVar(uint var) override;
	void writeVar(uint var, int value) override;

protected:
	virtual int getActiveObject();
	void ifStateZeroCommon(byte type);
	void ifStateNotZeroCommon(byte type);
	void setStateCommon(byte type);
	void clearStateCommon(byte type);
	void stopScriptCommon(int script);

	void drawSentence() override;
	void resetSentence() override;
	void setUserState(byte state);

	void beginCutscene(int *args) override { o2_cutscene(); }
	void endCutscene() override { o2_endCutscene(); }

	void handleMouseOver(bool updateInventory) override;
	void checkExecVerbs() override;
	void initV2MouseOver();
	void initNESMouseOver();

	void setBuiltinCursor(int index) override;
	void setSnailCursor() override;
	void adaptCursorToVideoMode();

	void drawPreposition(int index);

	void walkActorToObject(int actor, int obj);

	/* Version 2 script opcodes */
	void o2_actorFromPos();
	void o2_actorOps();
	void o2_add();
	void o2_addIndirect();
	void o2_assignVarByte();
	void o2_assignVarWordIndirect();
	void o2_beginOverride();
	void o2_chainScript();
	void o2_setStateUnpickupable();
	void o2_setStateTouchable();
	void o2_setStateUnlocked();
	void o2_setStateIntrinsicOff();
	void o2_cursorCommand();
	void o2_cutscene();
	void o2_delay();
	void o2_doSentence();
	void o2_drawObject();
	void o2_drawSentence();
	void o2_dummy();
	void o2_endCutscene();
	void o2_findObject();
	void o2_getActorWalkBox();
	void o2_getActorX();
	void o2_getActorY();
	void o2_getBitVar();
	void o2_getObjPreposition();
	void o2_ifClassOfIs();
	void o2_ifStatePickupable();
	void o2_ifStateUntouchable();
	void o2_ifStateLocked();
	void o2_ifStateIntrinsicOn();
	void o2_ifStateUnpickupable();
	void o2_ifStateTouchable();
	void o2_ifStateUnlocked();
	void o2_ifStateIntrinsicOff();
	void o2_isGreater();
	void o2_isGreaterEqual();
	void o2_isLess();
	void o2_isLessEqual();
	void o2_lights();
	void o2_loadRoomWithEgo();
	void o2_panCameraTo();
	void o2_pickupObject();
	void o2_putActor();
	void o2_putActorAtObject();
	void o2_putActorInRoom();
	void o2_resourceRoutines();
	void o2_restart();
	void o2_roomOps();
	void o2_getActorElevation();
	void o2_setActorElevation();
	void o2_setBitVar();
	void o2_setCameraAt();
	void o2_setObjPreposition();
	void o2_setOwnerOf();
	void o2_setStatePickupable();
	void o2_setStateUntouchable();
	void o2_setStateLocked();
	void o2_setStateIntrinsicOn();
	void o2_startScript();
	void o2_stopScript();
	void o2_subtract();
	void o2_subIndirect();
	void o2_switchCostumeSet();
	void o2_verbOps();
	void o2_waitForActor();
	void o2_waitForMessage();
	void o2_waitForSentence();
	void o2_walkActorTo();
	void o2_walkActorToObject();

	byte VAR_SENTENCE_VERB;
	byte VAR_SENTENCE_OBJECT1;
	byte VAR_SENTENCE_OBJECT2;
	byte VAR_SENTENCE_PREPOSITION;
	byte VAR_BACKUP_VERB;

	byte VAR_CLICK_AREA;
	byte VAR_CLICK_VERB;
	byte VAR_CLICK_OBJECT;
};


} // End of namespace Scumm

#endif