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