aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph-Eugene Winzer2017-06-15 19:55:09 +0200
committerThierry Crozat2018-01-22 23:08:31 +0000
commitf3656ecce98e8fa2bf48eaa9366f53326feec5c1 (patch)
treeb0f520ddeeddde420205b3350f16736127c2d309
parent6538a6386bf77a95ccabb5f25c664e21d985b11c (diff)
downloadscummvm-rg350-f3656ecce98e8fa2bf48eaa9366f53326feec5c1.tar.gz
scummvm-rg350-f3656ecce98e8fa2bf48eaa9366f53326feec5c1.tar.bz2
scummvm-rg350-f3656ecce98e8fa2bf48eaa9366f53326feec5c1.zip
SUPERNOVA: Adds methods for alterting Object state
-rw-r--r--engines/supernova/msn_def.h186
-rw-r--r--engines/supernova/supernova.cpp18
2 files changed, 117 insertions, 87 deletions
diff --git a/engines/supernova/msn_def.h b/engines/supernova/msn_def.h
index 1b854f0853..1bd81ddc0f 100644
--- a/engines/supernova/msn_def.h
+++ b/engines/supernova/msn_def.h
@@ -19,93 +19,6 @@ const int kRoomsChap2 = 9;
const int kRoomsChap3 = 21;
const int kRoomsNum = kRoomsChap0 + kRoomsChap1 + kRoomsChap2 + kRoomsChap3;
-enum ObjectType {
- NULLTYPE = 0,
- TAKE = 1,
- OPEN = 2,
- OPENED = 4,
- CLOSED = 8,
- EXIT = 16,
- PRESS = 32,
- COMBINABLE = 64,
- CARRIED = 128,
- UNNECESSARY = 256,
- WORN = 512,
- TALK = 1024,
- OCCUPIED = 2048,
- CAUGHT = 4096
-};
-
-enum Action {
- ACTION_WALK,
- ACTION_LOOK,
- ACTION_TAKE,
- ACTION_OPEN,
- ACTION_CLOSE,
- ACTION_PRESS,
- ACTION_PULL,
- ACTION_USE,
- ACTION_TALK,
- ACTION_GIVE
-};
-
-enum RoomID {
- INTRO,CORRIDOR,HALL,SLEEP,COCKPIT,AIRLOCK,
- HOLD,LANDINGMODULE,GENERATOR,OUTSIDE,
- CABIN_R1,CABIN_R2,CABIN_R3,CABIN_L1,CABIN_L3,CABIN_L2,BATHROOM,
-
- ROCKS,CAVE,MEETUP,ENTRANCE,REST,ROGER,GLIDER,MEETUP2,MEETUP3,
-
- CELL,CORRIDOR1,CORRIDOR2,CORRIDOR3,CORRIDOR4,CORRIDOR5,CORRIDOR6,CORRIDOR7,CORRIDOR8,CORRIDOR9,
- BCORRIDOR,GUARD,GUARD3,OFFICE_L1,OFFICE_L2,OFFICE_R1,OFFICE_R2,OFFICE_L,
- ELEVATOR,STATION,SIGN,NULLROOM
-};
-
-enum ObjectID {
- NULLOBJECT,
- KEYCARD,KNIFE,WATCH,
- SOCKET,
- BUTTON,HATCH1,
- BUTTON1,BUTTON2,MANOMETER,SUIT,HELMET,LIFESUPPORT,
- SCRAP_LK,OUTERHATCH_TOP,GENERATOR_TOP,TERMINALSTRIP,LANDINGMOD_OUTERHATCH,
- HOLD_WIRE,
- LANDINGMOD_BUTTON,LANDINGMOD_SOCKET,LANDINGMOD_WIRE,LANDINGMOD_HATCH,LANDINGMOD_MONITOR,
- KEYBOARD,
- KEYCARD2,OUTERHATCH,GENERATOR_WIRE,TRAP,SHORT_WIRE,CLIP,
- VOLTMETER,LADDER,GENERATOR_ROPE,
- KITCHEN_HATCH,SLEEP_SLOT,
- MONITOR,INSTRUMENTS,
- COMPUTER,CABINS,CABIN,
- SLOT_K1,SLOT_K2,SLOT_K3,SLOT_K4,
- SHELF1,SHELF2,SHELF3,SHELF4,
- ROPE,BOOK,DISCMAN,CHESS,
- SLOT_KL1,SLOT_KL2,SLOT_KL3,SLOT_KL4,
- SHELF_L1,SHELF_L2,SHELF_L3,SHELF_L4,
- PISTOL,BOOK2,SPOOL,
- RECORD,TURNTABLE,TURNTABLE_BUTTON,WIRE,WIRE2,PLUG,
- PEN,
- BATHROOM_DOOR,BATHROOM_EXIT,SHOWER,TOILET,
-
- STONE,
- SPACESHIPS,SPACESHIP,STAR,DOOR,MEETUP_SIGN,
- PORTER,BATHROOM_BUTTON,BATHROOM_SIGN,KITCHEN_SIGN,CAR_SLOT,
- ARS_BATHROOM,COINS,SCHNUCK,EGG,PILL,PILL_HULL,STAIRCASE,
- MEETUP_EXIT,
- ROGER_W,WALLET,KEYCARD_R,CUP,
- GLIDER_BUTTON1,GLIDER_BUTTON2,GLIDER_BUTTON3,GLIDER_BUTTON4,GLIDER_SLOT,GLIDER_BUTTONS,
- GLIDER_DISPLAY,GLIDER_INSTRUMENTS,GLIDER_KEYCARD,
- UFO,
-
- CELL_BUTTON,CELL_TABLE,CELL_WIRE,TRAY,CELL_DOOR,MAGNET,
- NEWSPAPER,TABLE,
- PILLAR1,PILLAR2,DOOR1,DOOR2,DOOR3,DOOR4,
- GUARDIAN,LAMP,
- MASTERKEYCARD,PAINTING,MONEY,LOCKER,LETTER,
- JUNGLE,SLOT,STATION_SIGN,
-
- TICKETS
-};
-
enum MessagePosition {
kMessageNormal,
kMessageLeft,
@@ -370,6 +283,97 @@ const byte initVGAPalette[768] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
+enum ObjectType {
+ NULLTYPE = 0,
+ TAKE = 1,
+ OPEN = 2,
+ OPENED = 4,
+ CLOSED = 8,
+ EXIT = 16,
+ PRESS = 32,
+ COMBINABLE = 64,
+ CARRIED = 128,
+ UNNECESSARY = 256,
+ WORN = 512,
+ TALK = 1024,
+ OCCUPIED = 2048,
+ CAUGHT = 4096
+};
+
+enum Action {
+ ACTION_WALK,
+ ACTION_LOOK,
+ ACTION_TAKE,
+ ACTION_OPEN,
+ ACTION_CLOSE,
+ ACTION_PRESS,
+ ACTION_PULL,
+ ACTION_USE,
+ ACTION_TALK,
+ ACTION_GIVE
+};
+
+enum RoomID {
+ INTRO,CORRIDOR,HALL,SLEEP,COCKPIT,AIRLOCK,
+ HOLD,LANDINGMODULE,GENERATOR,OUTSIDE,
+ CABIN_R1,CABIN_R2,CABIN_R3,CABIN_L1,CABIN_L3,CABIN_L2,BATHROOM,
+
+ ROCKS,CAVE,MEETUP,ENTRANCE,REST,ROGER,GLIDER,MEETUP2,MEETUP3,
+
+ CELL,CORRIDOR1,CORRIDOR2,CORRIDOR3,CORRIDOR4,CORRIDOR5,CORRIDOR6,CORRIDOR7,CORRIDOR8,CORRIDOR9,
+ BCORRIDOR,GUARD,GUARD3,OFFICE_L1,OFFICE_L2,OFFICE_R1,OFFICE_R2,OFFICE_L,
+ ELEVATOR,STATION,SIGN,NULLROOM
+};
+
+enum ObjectID {
+ NULLOBJECT,
+ KEYCARD,KNIFE,WATCH,
+ SOCKET,
+ BUTTON,HATCH1,
+ BUTTON1,BUTTON2,MANOMETER,SUIT,HELMET,LIFESUPPORT,
+ SCRAP_LK,OUTERHATCH_TOP,GENERATOR_TOP,TERMINALSTRIP,LANDINGMOD_OUTERHATCH,
+ HOLD_WIRE,
+ LANDINGMOD_BUTTON,LANDINGMOD_SOCKET,LANDINGMOD_WIRE,LANDINGMOD_HATCH,LANDINGMOD_MONITOR,
+ KEYBOARD,
+ KEYCARD2,OUTERHATCH,GENERATOR_WIRE,TRAP,SHORT_WIRE,CLIP,
+ VOLTMETER,LADDER,GENERATOR_ROPE,
+ KITCHEN_HATCH,SLEEP_SLOT,
+ MONITOR,INSTRUMENTS,
+ COMPUTER,CABINS,CABIN,
+ SLOT_K1,SLOT_K2,SLOT_K3,SLOT_K4,
+ SHELF1,SHELF2,SHELF3,SHELF4,
+ ROPE,BOOK,DISCMAN,CHESS,
+ SLOT_KL1,SLOT_KL2,SLOT_KL3,SLOT_KL4,
+ SHELF_L1,SHELF_L2,SHELF_L3,SHELF_L4,
+ PISTOL,BOOK2,SPOOL,
+ RECORD,TURNTABLE,TURNTABLE_BUTTON,WIRE,WIRE2,PLUG,
+ PEN,
+ BATHROOM_DOOR,BATHROOM_EXIT,SHOWER,TOILET,
+
+ STONE,
+ SPACESHIPS,SPACESHIP,STAR,DOOR,MEETUP_SIGN,
+ PORTER,BATHROOM_BUTTON,BATHROOM_SIGN,KITCHEN_SIGN,CAR_SLOT,
+ ARS_BATHROOM,COINS,SCHNUCK,EGG,PILL,PILL_HULL,STAIRCASE,
+ MEETUP_EXIT,
+ ROGER_W,WALLET,KEYCARD_R,CUP,
+ GLIDER_BUTTON1,GLIDER_BUTTON2,GLIDER_BUTTON3,GLIDER_BUTTON4,GLIDER_SLOT,GLIDER_BUTTONS,
+ GLIDER_DISPLAY,GLIDER_INSTRUMENTS,GLIDER_KEYCARD,
+ UFO,
+
+ CELL_BUTTON,CELL_TABLE,CELL_WIRE,TRAY,CELL_DOOR,MAGNET,
+ NEWSPAPER,TABLE,
+ PILLAR1,PILLAR2,DOOR1,DOOR2,DOOR3,DOOR4,
+ GUARDIAN,LAMP,
+ MASTERKEYCARD,PAINTING,MONEY,LOCKER,LETTER,
+ JUNGLE,SLOT,STATION_SIGN,
+
+ TICKETS
+};
+
+ObjectType operator|(ObjectType a, ObjectType b);
+ObjectType operator^(ObjectType a, ObjectType b);
+ObjectType &operator|=(ObjectType &a, ObjectType b);
+ObjectType &operator^=(ObjectType &a, ObjectType b);
struct Object {
static const char *const defaultDescription;
@@ -398,6 +402,14 @@ struct Object {
, _direction(direction)
{}
+ void setProperty(ObjectType type) {
+ _type |= type;
+ }
+
+ void disableProperty(ObjectType type) {
+ _type ^= type;
+ }
+
const char *_name;
const char *_description;
ObjectID _id;
diff --git a/engines/supernova/supernova.cpp b/engines/supernova/supernova.cpp
index 602f69fc1a..47c782d347 100644
--- a/engines/supernova/supernova.cpp
+++ b/engines/supernova/supernova.cpp
@@ -42,6 +42,24 @@
namespace Supernova {
+const char *const Object::defaultDescription = "Es ist nichts Besonderes daran.";
+
+ObjectType operator|(ObjectType a, ObjectType b) {
+ return static_cast<ObjectType>(+a | +b);
+}
+
+ObjectType operator^(ObjectType a, ObjectType b) {
+ return static_cast<ObjectType>(+a ^ +b);
+}
+
+ObjectType &operator|=(ObjectType &a, ObjectType b) {
+ return a = a | b;
+}
+
+ObjectType &operator^=(ObjectType &a, ObjectType b) {
+ return a = a ^ b;
+}
+
SupernovaEngine::SupernovaEngine(OSystem *syst)
: Engine(syst)
, _console(NULL)