ScummVM API documentation
function.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 MEDIASTATION_MEDIASCRIPT_FUNCTION_H
23#define MEDIASTATION_MEDIASCRIPT_FUNCTION_H
24
25#include "common/array.h"
26#include "common/hashmap.h"
27
28#include "mediastation/clients.h"
29#include "mediastation/datafile.h"
30#include "mediastation/mediascript/codechunk.h"
31
32namespace MediaStation {
33
34enum Platform {
35 kPlatformParamTokenUnknown = 0,
36 kPlatformParamTokenWindows = 0x76D,
37 kPlatformParamTokenMacintosh = 0x76E
38};
39
41public:
42 ScriptFunction(Chunk &chunk);
44
46 Common::String decompile() const;
47 uint32 bytecodeSize() const { return _bytecodeSize; }
48
49 uint _contextId = 0;
50 uint _id = 0;
51
52private:
53 byte *_bytecodeBuffer = nullptr;
54 uint32 _bytecodeSize = 0;
55};
56
57namespace MazeMinigame {
58class Maze;
59} // End of namespace MazeMinigame
60
61namespace CheckersMinigame {
62class Checkers;
63} // End of namespace CheckersMinigame
64
66friend class Debugger;
67
68public:
69 FunctionManager() {};
70 virtual ~FunctionManager();
71
72 virtual bool attemptToReadFromStream(Chunk &chunk, uint sectionType) override;
73 ScriptValue call(uint functionId, Common::Array<ScriptValue> &args);
74 ScriptFunction *getFunctionById(uint functionId);
75 void deleteFunctionsForContext(uint contextId);
76
77 MazeMinigame::Maze *_maze = nullptr;
78 CheckersMinigame::Checkers *_checkers = nullptr;
79
80 uint _scriptBlockCallDepth = 0;
81
82private:
84 uint32 _timedIntervalStartInMs = 0.0;
86
87 void script_GetPlatform(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
88 void script_Random(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
89 void script_TimeOfDay(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
90 void script_SquareRoot(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
91 void script_GetUniqueRandom(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
92 void script_CurrentRunTime(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
93 void script_SetGammaCorrection(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
94 void script_GetDefaultGammaCorrection(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
95 void script_GetCurrentGammaCorrection(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
96 void script_SetAudioVolume(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
97 void script_GetAudioVolume(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
98 void script_SystemLanguagePreference(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
99 void script_SetRegistry(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
100 void script_GetRegistry(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
101 void script_SetProfile(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
102 void script_DebugPrint(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
103 void script_EffectTransition(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
104
105 // Barbie.
106 void script_MazeGenerate(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
107 void script_MazeApplyMoveMask(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
108 void script_MazeSolve(Common::Array<ScriptValue> &args, ScriptValue &returnValue); // Shared with Dalmatians.
109 void script_BeginTimedInterval(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
110 void script_EndTimedInterval(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
111
112 // Hercules.
113 void script_Checkers(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
114
115 // IBM/Crayola.
116 void script_Drawing(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
117
118 // Puzzle Castle.
119 void script_MoveSophie(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
120};
121
122} // End of namespace MediaStation
123
124#endif
Definition: hashmap.h:85
Definition: str.h:59
Definition: datafile.h:99
Definition: debugger.h:31
Definition: function.h:65
Definition: dalmatiansmaze.h:98
Definition: clients.h:34
Definition: function.h:40
Definition: scriptvalue.h:35
Platform
Definition: platform.h:93