22#ifndef ZVISION_SCRIPT_MANAGER_H
23#define ZVISION_SCRIPT_MANAGER_H
25#include "common/events.h"
26#include "common/hashmap.h"
27#include "common/queue.h"
28#include "zvision/scripting/control.h"
29#include "zvision/scripting/puzzle.h"
30#include "zvision/scripting/scripting_effect.h"
34class SeekableReadStream;
47 StateKey_KeyPress = 8,
48 StateKey_InventoryItem = 9,
54 StateKey_MenuState = 19,
55 StateKey_RestoreFlag = 20,
56 StateKey_Quitting = 39,
57 StateKey_LastWorld = 40,
58 StateKey_LastRoom = 41,
59 StateKey_LastNode = 42,
60 StateKey_LastView = 43,
61 StateKey_LastViewPos = 44,
62 StateKey_Menu_LastWorld = 45,
63 StateKey_Menu_LastRoom = 46,
64 StateKey_Menu_LastNode = 47,
65 StateKey_Menu_LastView = 48,
66 StateKey_Menu_LastViewPos = 49,
67 StateKey_KbdRotateSpeed = 50,
68 StateKey_Subtitles = 51,
69 StateKey_StreamSkipKey = 52,
70 StateKey_RotateSpeed = 53,
73 StateKey_VenusEnable = 58,
74 StateKey_HighQuality = 59,
75 StateKey_VideoLineSkip = 65,
76 StateKey_Platform = 66,
77 StateKey_InstallLevel = 67,
78 StateKey_CountryCode = 68,
80 StateKey_MovieCursor = 70,
81 StateKey_NoTurnAnim = 71,
83 StateKey_ShowErrorDlg = 73,
84 StateKey_DebugCheats = 74,
85 StateKey_JapanFonts = 75,
86 StateKey_ExecScopeStyle = 76,
87 StateKey_Brightness = 77,
88 StateKey_MPEGMovies = 78,
92 StateKey_EF9_Speed = 94,
93 StateKey_Inv_Cnt_Slot = 100,
94 StateKey_Inv_1_Slot = 101,
95 StateKey_Inv_49_Slot = 149,
97 StateKey_Inv_TotalSlots = 150,
98 StateKey_Inv_StartSlot = 151,
99 StateKey_Spell_1 = 191,
100 StateKey_Active_Spell = 205,
101 StateKey_Reversed_Spellbooc = 206
105 Location() : world(
'g'), room(
'a'), node(
'r'), view(
'y'), offset(0) {}
116 lhs.world == rhs.world &&
117 lhs.room == rhs.room &&
118 lhs.node == rhs.node &&
123inline bool operator==(
const Location& lhs,
const char* rhs) {
125 return lhsStr == rhs;
128inline bool operator!=(
const Location& lhs,
const Location& rhs) {
129 return !(lhs == rhs);
132inline bool operator!=(
const Location& lhs,
const char* rhs) {
133 return !(lhs == rhs);
185 ScriptScope _universe;
188 ScriptScope _nodeview;
195 const uint8 _changeLocationExtraCycles = 16;
197 uint32 _currentlyFocusedControl;
200 enum TransitionLevel {
208 void initialize(
bool restarted =
false);
209 void process(uint deltaTimeMillis);
210 void queuePuzzles(uint32 key);
212 int getStateValue(uint32 key);
213 void setStateValue(uint32 key,
int value);
215 uint getStateFlag(uint32 key);
216 void setStateFlag(uint32 key, uint value);
217 void unsetStateFlag(uint32 key, uint value);
219 void addControl(
Control *control);
220 Control *getControl(uint32 key);
222 void enableControl(uint32 key);
223 void disableControl(uint32 key);
225 void focusControl(uint32 key);
227 void setFocusControlKey(uint32 key);
231 void deleteSideFx(uint32 key);
232 void stopSideFx(uint32 key);
233 void killSideFx(uint32 key);
234 void killSideFxType(ScriptingEffect::ScriptingEffectType type);
278 bool changingLocation()
const;
283 Location getCurrentLocation()
const;
297 void referenceTableAddPuzzle(uint32 key, PuzzleRef ref);
298 void addPuzzlesToReferenceTable(ScriptScope &scope);
299 void updateNodes(uint deltaTimeMillis);
300 void updateControls(uint deltaTimeMillis);
312 bool checkPuzzleCriteria(
Puzzle *puzzle, uint counter);
313 void cleanStateTable();
314 void cleanScriptScope(ScriptScope &scope);
315 bool execScope(ScriptScope &scope);
318 void ChangeLocationReal(
bool isLoading);
320 int8 inventoryGetCount();
321 void inventorySetCount(int8 cnt);
322 int16 inventoryGetItem(int8
id);
323 void inventorySetItem(int8
id, int16 item);
325 void setStateFlagSilent(uint32 key, uint value);
326 void setStateValueSilent(uint32 key,
int value);
329 void inventoryAdd(int16 item);
330 void inventoryDrop(int16 item);
331 void inventoryCycle();
340 void parseScrFile(
const Common::Path &fileName, ScriptScope &scope);
static String format(MSVC_PRINTF const char *fmt,...) GCC_PRINTF(1
Definition: script_manager.h:143
void onKeyUp(Common::KeyState keyState)
void onMouseUp(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos)
void trimCommentsAndWhiteSpace(Common::String *string) const
void changeLocation(char world, char room, char node, char view, uint32 offset)
void onKeyDown(Common::KeyState keyState)
bool onMouseMove(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos)
void onMouseDown(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos)
Definition: scripting_effect.h:45
Definition: script_manager.h:400
EventType
Definition: events.h:49
Definition: algorithm.h:29
Definition: focus_list.h:27
Definition: keyboard.h:294
Definition: script_manager.h:104