ScummVM API documentation
gamevars.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 NEVERHOOD_GAMEVARS_H
23 #define NEVERHOOD_GAMEVARS_H
24 
25 #include "common/array.h"
26 #include "common/savefile.h"
27 #include "neverhood/neverhood.h"
28 
29 namespace Neverhood {
30 
31 enum : uint {
32  // Misc
33  V_MODULE_NAME = 0x91080831, // Currently active module name hash
34  V_CURRENT_SCENE = 0x108A4870, // Current scene in the current module
35  V_CURRENT_SCENE_WHICH = 0x82C80875,
36  V_DEBUG = 0xA4014072, // Original debug-flag, can probably be removed
37  V_SMACKER_CAN_ABORT = 0x06C02850, // Not set anywhere (yet), seems like a debug flag
38  V_KEY3_LOCATION = 0x13382860, // Location of the third key
39  V_TEXT_FLAG1 = 0x8440001F,
40  V_TEXT_INDEX = 0x01830201,
41  V_TEXT_COUNTING_INDEX1 = 0x29408F00,
42  V_TEXT_COUNTING_INDEX2 = 0x8A140C21,
43  V_TALK_COUNTING_INDEX = 0xA0808898,
44  V_FRUIT_COUNTING_INDEX = 0x40040831,
45  V_NOISY_SYMBOL_INDEX = 0x2414C2F2,
46  V_COLUMN_BACK_NAME = 0x4CE79018,
47  V_COLUMN_TEXT_NAME = 0xC8C28808,
48  V_CLICKED_COLUMN_INDEX = 0x48A68852,
49  V_CLICKED_COLUMN_ROW = 0x49C40058,
50  // Klaymen
51  V_KLAYMEN_SMALL = 0x1860C990, // Is Klaymen small?
52  V_KLAYMEN_FRAMEINDEX = 0x18288913,
53  V_KLAYMEN_IS_DELTA_X = 0xC0418A02,
54  V_KLAYMEN_SAVED_X = 0x00D30138,
55  V_CAR_DELTA_X = 0x21E60190,
56  // Flags
57  V_CRYSTAL_COLORS_INIT = 0xDE2EC914,
58  V_TV_JOKE_TOLD = 0x92603A79,
59  V_NOTES_DOOR_UNLOCKED = 0x0045D021,
60  V_WATER_RUNNING = 0x4E0BE910,
61  V_CREATURE_ANGRY = 0x0A310817, // After having played with the music box
62  V_BEEN_SHRINKING_ROOM = 0x1C1B8A9A,
63  V_BEEN_STATUE_ROOM = 0xCB45DE03,
64  V_MOUSE_PUZZLE_SOLVED = 0x70A1189C,
65  V_NOTES_PUZZLE_SOLVED = 0x86615030,
66  V_TILE_PUZZLE_SOLVED = 0x404290D5,
67  V_STAIRS_PUZZLE_SOLVED = 0xA9035F60,
68  V_CODE_SYMBOLS_SOLVED = 0x2C531AF8,
69  V_SPIKES_RETRACTED = 0x18890C91,
70  V_LARGE_DOOR_NUMBER = 0x9A500914, // Number of the currently "large" door
71  V_LIGHTS_ON = 0x4D080E54,
72  V_SHRINK_LIGHTS_ON = 0x190A1D18, // Lights on in the room with the shrinking device
73  V_STAIRS_DOWN_ONCE = 0x2050861A, // Stairs have been down once before
74  V_STAIRS_DOWN = 0x09221A62,
75  V_LADDER_DOWN = 0x0018CA22, // Is the ladder in the statue room down?
76  V_LADDER_DOWN_ACTION = 0x00188211,
77  V_WALL_BROKEN = 0x10938830,
78  V_BOLT_DOOR_OPEN = 0x01BA1A52,
79  V_BOLT_DOOR_UNLOCKED = 0x00040153,
80  V_SEEN_SYMBOLS_NO_LIGHT = 0x81890D14,
81  V_FELL_DOWN_HOLE = 0xE7498218,
82  V_DOOR_PASSED = 0x2090590C, // Auto-closing door was passed
83  V_ENTRANCE_OPEN = 0xD0A14D10, // Is the entrance to Module1300 open (after the robot got his teddy)
84  V_WINDOW_OPEN = 0x03C698DA,
85  V_DOOR_STATUS = 0x52371C95,
86  V_DOOR_BUSTED = 0xD217189D,
87  V_WORLDS_JOINED = 0x98109F12, // Are the worlds joined?
88  V_KEYDOOR_UNLOCKED = 0x80455A41, // Is the keyboard-door unlocked?
89  V_MOUSE_SUCKED_IN = 0x01023818, // Are mouse/cheese in Scene1308?
90  V_BALLOON_POPPED = 0xAC00C0D0, // Has the balloon with the key been popped?
91  V_TNT_DUMMY_BUILT = 0x000CF819, // Are all TNT parts on the dummy?
92  V_TNT_DUMMY_FUSE_LIT = 0x20A0C516,
93  V_RADIO_ENABLED = 0x4DE80AC0,
94  V_SEEN_CREATURE_EXPLODE_VID = 0x2A02C07B,
95  V_CREATURE_EXPLODED = 0x0A18CA33,
96  V_UNUSED = 0x89C669AA, // Seems to be unused, confirmed by checking the exe for this constant value (still left in atm)
97  // Radio
98  V_RADIO_ROOM_LEFT_DOOR = 0x09880D40,
99  V_RADIO_ROOM_RIGHT_DOOR = 0x08180ABC,
100  V_CURR_RADIO_MUSIC_INDEX = 0x08CC0828,
101  V_GOOD_RADIO_MUSIC_INDEX = 0x88880915,
102  V_GOOD_RADIO_MUSIC_NAME = 0x89A82A15,
103  V_RADIO_MOVE_DISH_VIDEO = 0x28D8C940,
104  // Match
105  V_MATCH_STATUS = 0x0112090A,
106  // Venus fly trap
107  V_FLYTRAP_RING_EATEN = 0x2B514304,
108  V_FLYTRAP_RING_DOOR = 0x8306F218,
109  V_FLYTRAP_RING_FENCE = 0x80101B1E,
110  V_FLYTRAP_RING_BRIDGE = 0x13206309,
111  V_FLYTRAP_POSITION_1 = 0x1B144052,
112  V_FLYTRAP_POSITION_2 = 0x86341E88,
113  // Navigation
114  V_NAVIGATION_INDEX = 0x4200189E, // Navigation scene: Current navigation index
115  // Cannon
116  V_CANNON_RAISED = 0x000809C2, // Is the cannon raised?
117  V_CANNON_TURNED = 0x9040018A, // Is the cannon turned?
118  V_ROBOT_HIT = 0x0C0288F4, // Was the robot hit by the cannon?
119  V_ROBOT_TARGET = 0x610210B7, // Is the robot at the cannon target position? (teddy)
120  V_CANNON_SMACKER_NAME = 0xF0402B0A,
121  V_CANNON_TARGET_STATUS = 0x20580A86,
122  // Projector
123  V_PROJECTOR_SLOT = 0x04A10F33, // Projector x slot index
124  V_PROJECTOR_LOCATION = 0x04A105B3, // Projector scene location
125  V_PROJECTOR_ACTIVE = 0x12A10DB3, // Is the projecor projecting?
126  // Teleporter
127  V_TELEPORTER_CURR_LOCATION = 0x0152899A,
128  V_TELEPORTER_WHICH = 0x60826830,
129  V_TELEPORTER_DEST_AVAILABLE = 0x2C145A98,
130  // Inventory
131  V_HAS_NEEDLE = 0x31C63C51, // Has Klaymen the needle?
132  V_HAS_FINAL_KEY = 0xC0780812, // Has Klaymen the key from the diskplayer?
133  V_HAS_TEST_TUBE = 0x45080C38,
134  // Arrays
135  // NOTE "GOOD" means the solution, "CURR" is the current setup of the puzzle variables
136  VA_IS_PUZZLE_INIT = 0x40050052,
137  VA_SMACKER_PLAYED = 0x00800410,
138  VA_CURR_CRYSTAL_COLORS = 0xE11A1929,
139  VA_GOOD_CRYSTAL_COLORS = 0xD4B2089C,
140  VA_GOOD_TEST_TUBES_LEVEL_1 = 0x0C601058,
141  VA_GOOD_TEST_TUBES_LEVEL_2 = 0x40005834,
142  VA_CURR_CANNON_SYMBOLS = 0x00000914,
143  VA_GOOD_CANNON_SYMBOLS_1 = 0x00504B86,
144  VA_GOOD_CANNON_SYMBOLS_2 = 0x0A4C0A9A,
145  VA_CURR_WATER_PIPES_LEVEL = 0x0800547C,
146  VA_GOOD_WATER_PIPES_LEVEL = 0x90405038,
147  VA_CURR_DICE_NUMBERS = 0x61084036,
148  VA_GOOD_DICE_NUMBERS = 0x7500993A,
149  VA_CURR_KEY_SLOT_NUMBERS = 0xA010B810,
150  VA_GOOD_KEY_SLOT_NUMBERS = 0x0C10A000,
151  VA_CUBE_POSITIONS = 0x484498D0,
152  VA_CODE_SYMBOLS = 0x04909A50,
153  VA_TILE_SYMBOLS = 0x0C65F80B,
154  VA_IS_TILE_MATCH = 0xCCE0280F,
155  VA_TNT_POSITIONS = 0x10055D14,
156  VA_DICE_MEMORY_SYMBOLS = 0x13100631,
157  VA_HAS_TAPE = 0x02038314,
158  VA_IS_TAPE_INSERTED = 0x02720344,
159  VA_HAS_KEY = 0x0090EA95,
160  VA_IS_KEY_INSERTED = 0x08D0AB11,
161  VA_LOCKS_DISABLED = 0x14800353,
162  V_END_
163 };
164 
165 struct GameVar {
166  uint32 nameHash;
167  uint32 value;
168  int16 firstIndex, nextIndex;
169 };
170 
171 class Console;
172 
173 class GameVars {
174 public:
175  GameVars();
176  void clear();
177  void loadState(Common::InSaveFile *in);
178  void saveState(Common::OutSaveFile *out);
179  uint32 getGlobalVar(uint32 nameHash);
180  void setGlobalVar(uint32 nameHash, uint32 value);
181  uint32 getSubVar(uint32 nameHash, uint32 subNameHash);
182  void setSubVar(uint32 nameHash, uint32 subNameHash, uint32 value);
183  void dumpVars(Console *con);
184 protected:
186  int16 addVar(uint32 nameHash, uint32 value);
187  int16 findSubVarIndex(int16 varIndex, uint32 subNameHash);
188  int16 addSubVar(int16 varIndex, uint32 subNameHash, uint32 value);
189  int16 getSubVarIndex(int16 varIndex, uint32 subNameHash);
190 };
191 
192 } // End of namespace Neverhood
193 
194 #endif /* NEVERHOOD_GAMEVARS_H */
Definition: background.h:30
Definition: savefile.h:54
Definition: array.h:52
Definition: gamevars.h:165
Definition: stream.h:745
Definition: gamevars.h:173
Definition: console.h:31