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
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (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, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #ifndef SUPERNOVA_MSN_DEF_H
24 #define SUPERNOVA_MSN_DEF_H
25 
26 // Avoid error on expansion of macro switch in the ObjectID enum below
27 #ifdef SWITCH
28 #undef SWITCH
29 #endif
30 
31 #include "common/scummsys.h"
32 
33 namespace Supernova {
34 
35 const int kTextSpeed[] = {19, 14, 10, 7, 4};
36 const int kMsecPerTick = 55;
37 
38 const int kMaxSection = 40;
39 const int kMaxDialog = 2;
40 const int kMaxObject = 30;
41 const int kMaxCarry = 30;
42 
43 const int kSleepAutosaveSlot = 999;
44 
45 const byte kShownFalse = 0;
46 const byte kShownTrue = 1;
47 
48 const byte kSectionInvert = 128;
49 
50 enum MessagePosition {
51 	kMessageNormal,
52 	kMessageLeft,
53 	kMessageRight,
54 	kMessageCenter,
55 	kMessageTop
56 };
57 
58 enum ObjectType {
59 	NULLTYPE    =      0,
60 	TAKE        =      1,
61 	OPENABLE    =      2,
62 	OPENED      =      4,
63 	CLOSED      =      8,
64 	EXIT        =     16,
65 	PRESS       =     32,
66 	COMBINABLE  =     64,
67 	CARRIED     =    128,
68 	UNNECESSARY =    256,
69 	WORN        =    512,
70 	TALK        =   1024,
71 	OCCUPIED    =   2048,
72 	CAUGHT      =   4096
73 };
74 typedef uint16 ObjectTypes;
75 
76 enum Action {
77 	ACTION_WALK,
78 	ACTION_LOOK,
79 	ACTION_TAKE,
80 	ACTION_OPEN,
81 	ACTION_CLOSE,
82 	ACTION_PRESS,
83 	ACTION_PULL,
84 	ACTION_USE,
85 	ACTION_TALK,
86 	ACTION_GIVE
87 };
88 
89 enum RoomId {
90 	// Supernova 1
91 	INTRO1,CORRIDOR_ROOM,HALL,SLEEP,COCKPIT,AIRLOCK,
92 	HOLD,LANDINGMODULE,GENERATOR,OUTSIDE,
93 	CABIN_R1,CABIN_R2,CABIN_R3,CABIN_L1,CABIN_L2,CABIN_L3,BATHROOM,
94 
95 	ROCKS,CAVE,MEETUP,ENTRANCE,REST,ROGER,GLIDER,MEETUP2,MEETUP3,
96 
97 	CELL,CORRIDOR1,CORRIDOR2,CORRIDOR3,CORRIDOR4,CORRIDOR5,CORRIDOR6,CORRIDOR7,CORRIDOR8,CORRIDOR9,
98 	BCORRIDOR,GUARD,GUARD3,OFFICE_L1,OFFICE_L2,OFFICE_R1,OFFICE_R2,OFFICE_L,
99 	ELEVATOR,STATION,SIGN_ROOM,OUTRO,NUMROOMS1,
100 
101 	// Supernova 2
102 	INTRO2 = 0,AIRPORT,TAXISTAND,STREET,GAMES,CABIN2,KIOSK,
103 	CULTURE_PALACE,CHECKOUT,CITY1,CITY2,ELEVATOR2,APARTMENT,SHIP,
104 
105 	PYRAMID,PYR_ENTRANCE,UPSTAIRS1,DOWNSTAIRS1,
106 	BOTTOM_RIGHT_DOOR,BOTTOM_LEFT_DOOR,UPSTAIRS2,DOWNSTAIRS2,
107 	UPPER_DOOR,PUZZLE_FRONT,PUZZLE_BEHIND,
108 	FORMULA1_F,FORMULA1_N,FORMULA2_F,FORMULA2_N,TOMATO_F,TOMATO_N,
109 	MONSTER_F,MONSTER1_N,MONSTER2_N,UPSTAIRS3,DOWNSTAIRS3,
110 	LCORRIDOR1,LCORRIDOR2,HOLE_ROOM,IN_HOLE,FLOORDOOR,FLOORDOOR_U,
111 	BST_DOOR,HALL2,COFFIN_ROOM,MASK,
112 
113 	MUSEUM,MUS_ENTRANCE,MUS1,MUS2,MUS3,MUS4,MUS5,MUS6,MUS7,MUS8,
114 	MUS9,MUS10,MUS11,MUS_ROUND,
115 	MUS12,MUS13,MUS14,MUS15,MUS16,MUS17,MUS18,MUS19,MUS20,MUS21,MUS22,
116 	NUMROOMS2,NULLROOM
117 };
118 
119 enum ObjectId {
120 	INVALIDOBJECT = -1,
121 	NULLOBJECT = 0,
122 
123 	// Supernova 1
124 	KEYCARD,KNIFE,WATCH,
125 	SOCKET,
126 	BUTTON,HATCH1,
127 	BUTTON1,BUTTON2,MANOMETER,SUIT,HELMET,LIFESUPPORT,
128 	SCRAP_LK,OUTERHATCH_TOP,GENERATOR_TOP,TERMINALSTRIP,LANDINGMOD_OUTERHATCH,
129 	HOLD_WIRE,
130 	LANDINGMOD_BUTTON,LANDINGMOD_SOCKET,LANDINGMOD_WIRE,LANDINGMOD_HATCH,LANDINGMOD_MONITOR,
131 	KEYBOARD,
132 	KEYCARD2,OUTERHATCH,GENERATOR_WIRE,TRAP,SHORT_WIRE,CLIP,
133 	VOLTMETER,LADDER,GENERATOR_ROPE,
134 	KITCHEN_HATCH,SLEEP_SLOT,
135 	MONITOR,INSTRUMENTS,
136 	COMPUTER,CABINS,CABIN,
137 	SLOT_K1,SLOT_K2,SLOT_K3,SLOT_K4,
138 	SHELF1,SHELF2,SHELF3,SHELF4,
139 	ROPE,BOOK,DISCMAN,CHESS,
140 	SLOT_KL1,SLOT_KL2,SLOT_KL3,SLOT_KL4,
141 	SHELF_L1,SHELF_L2,SHELF_L3,SHELF_L4,
142 	PISTOL,BOOK2,SPOOL,
143 	RECORD,TURNTABLE,TURNTABLE_BUTTON,WIRE,WIRE2,PLUG,
144 	PEN,
145 	BATHROOM_DOOR,BATHROOM_EXIT,SHOWER,TOILET,
146 
147 	STONE,
148 	SPACESHIPS,SPACESHIP,STAR,DOOR,MEETUP_SIGN,
149 	PORTER,BATHROOM_BUTTON,BATHROOM_SIGN,KITCHEN_SIGN,CAR_SLOT,
150 	ARSANO_BATHROOM,COINS,SCHNUCK,EGG,PILL,PILL_HULL,STAIRCASE,
151 	MEETUP_EXIT,
152 	ROGER_W,WALLET,KEYCARD_R,CUP,
153 	GLIDER_BUTTON1,GLIDER_BUTTON2,GLIDER_BUTTON3,GLIDER_BUTTON4,GLIDER_SLOT,GLIDER_BUTTONS,
154 	GLIDER_DISPLAY,GLIDER_INSTRUMENTS,GLIDER_KEYCARD,
155 	UFO,
156 
157 	CELL_BUTTON,CELL_TABLE,CELL_WIRE,TRAY,CELL_DOOR,MAGNET,
158 	NEWSPAPER,TABLE,
159 	PILLAR1,PILLAR2,DOOR1,DOOR2,DOOR3,DOOR4,
160 	GUARDIAN,LAMP,
161 	MASTERKEYCARD,PAINTING,MONEY,LOCKER,LETTER,
162 	JUNGLE,STATION_SLOT,STATION_SIGN,
163 
164 
165 	// Supernova2
166 	TAXI,TRANSMITTER,ROD,OCCUPIED_CABIN,
167 	SLOT1,CHAIR,CORRIDOR,G_RIGHT,G_LEFT,PYRA_ENTRANCE,
168 	PART0,PART1,PART2,PART3,PART4,PART5,PART6,PART7,
169 	PART8,PART9,PART10,PART11,PART12,PART13,PART14,PART15,
170 	TKNIFE,NOTE,MOUTH,
171 	HOLE1,HOLE2,HOLE3,HOLE4,HOLE5,HOLE6,HOLE7,HOLE8,HOLE9,HOLE10,
172 	HOLE11,HOLE12,HOLE13,HOLE14,HOLE15,HOLE16,HOLE17,HOLE18,HOLE19,HOLE20,
173 	HOLE21,HOLE22,HOLE23,HOLE24,HOLE25,SIGN,
174 	SLOT,HOLE,STONES,
175 	BST1,BST2,BST3,BST4,BST5,BST6,BST7,BST8,
176 	BST9,BST10,BST11,BST12,BST13,BST14,BST15,BST16,
177 	COFFIN,SUN,MONSTER,EYE,EYE1,EYE2,L_BALL,R_BALL,
178 	PRIZE,REAR_STREET,
179 	BMASK,BOTTLE,PLAYER,TOOTHBRUSH,BOOKS,LEXICON,PLANT,SNAKE,
180 	JOYSTICK,BOTTLE1,BOTTLE2,BOTTLE3,BOTTLE4,BOX,FACES,
181 	SELLER,POSTER,AXACUSSER,KP_ENTRANCE,CHIP,CARD,
182 	SCRIBBLE1,SCRIBBLE2,BELL,KEYPAD,DOOR_L,DOOR_R,ID_CARD,
183 	UNDER_BED,KEY,HATCH,CABINET,
184 	SMALL_DOOR,BACK_MONEY,WALL,SUCTION_CUP,IMITATION,SP_KEYCARD,ALARM_CRACKER,
185 	ENCRYPTED_DOOR,ALARM_SYSTEM,MUS_STREET,BIG_DOOR,MUSIC_SYSTEM,
186 	HANDLE,SWITCH,DOOR_SWITCH,CABLE,RCABLE,
187 	MUSCARD,HEAD, DISPLAY
188 };
189 
190 enum StringId {
191 	kNoString = -1,
192 	// 0
193 	kStringCommandGo = 0, kStringCommandLook, kStringCommandTake, kStringCommandOpen, kStringCommandClose,
194 	kStringCommandPress, kStringCommandPull, kStringCommandUse, kStringCommandTalk, kStringCommandGive,
195 	kStringStatusCommandGo, kStringStatusCommandLook, kStringStatusCommandTake, kStringStatusCommandOpen, kStringStatusCommandClose,
196 	kStringStatusCommandPress, kStringStatusCommandPull, kStringStatusCommandUse, kStringStatusCommandTalk, kStringStatusCommandGive,
197 	kPhrasalVerbParticleGiveTo, kPhrasalVerbParticleUseWith, kStringDefaultDescription, kStringDialogSeparator, kStringConversationEnd,
198 	// 25
199 	kStringHelpOverview1, kStringHelpOverview2, kStringHelpOverview3, kStringHelpOverview4, kStringHelpOverview5,
200 	kStringHelpOverview6, kStringHelpOverview7, kStringTextSpeed, kStringLeaveGame, kStringYes,
201 	kStringNo
202 };
203 
204 ObjectType operator|(ObjectType a, ObjectType b);
205 ObjectType operator&(ObjectType a, ObjectType b);
206 ObjectType operator^(ObjectType a, ObjectType b);
207 ObjectType &operator|=(ObjectType &a, ObjectType b);
208 ObjectType &operator&=(ObjectType &a, ObjectType b);
209 ObjectType &operator^=(ObjectType &a, ObjectType b);
210 
211 struct Object {
ObjectObject212 	Object()
213 		: _name(kNoString)
214 		, _description(kStringDefaultDescription)
215 		, _id(INVALIDOBJECT)
216 		, _roomId(NULLROOM)
217 		, _type(NULLTYPE)
218 		, _click(0)
219 		, _click2(0)
220 		, _section(0)
221 		, _exitRoom(NULLROOM)
222 		, _direction(0)
223 	{}
224 	Object(byte roomId, int name, int description, ObjectId id, ObjectType type,
225 		   byte click, byte click2, byte section = 0, RoomId exitRoom = NULLROOM, byte direction = 0)
_nameObject226 		: _name(name)
227 		, _description(description)
228 		, _id(id)
229 		, _roomId(roomId)
230 		, _type(type)
231 		, _click(click)
232 		, _click2(click2)
233 		, _section(section)
234 		, _exitRoom(exitRoom)
235 		, _direction(direction)
236 	{}
237 
238 	void resetProperty(ObjectType type = NULLTYPE) {
239 		_type = type;
240 	}
241 
setPropertyObject242 	void setProperty(ObjectType type) {
243 		_type |= type;
244 	}
245 
disablePropertyObject246 	void disableProperty(ObjectType type) {
247 		_type &= ~type;
248 	}
249 
hasPropertyObject250 	bool hasProperty(ObjectType type) const {
251 		return _type & type;
252 	}
253 
combineObject254 	static bool combine(Object &obj1, Object &obj2, ObjectId id1, ObjectId id2) {
255 		if (obj1.hasProperty(COMBINABLE))
256 			return (((obj1._id == id1) && (obj2._id == id2)) ||
257 					((obj1._id == id2) && (obj2._id == id1)));
258 		else
259 			return false;
260 	}
261 
262 	byte _roomId;
263 	int _name;
264 	int _description;
265 	ObjectId _id;
266 	ObjectTypes _type;
267 	byte _click;
268 	byte _click2;
269 	byte _section;
270 	RoomId _exitRoom;
271 	byte _direction;
272 };
273 
274 #define ticksToMsec(x) (x * kMsecPerTick)
275 
276 }
277 
278 #endif // SUPERNOVA_MSN_DEF_H
279