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 
32 namespace MediaStation {
33 
34 enum Platform {
35  kPlatformParamTokenUnknown = 0,
36  kPlatformParamTokenWindows = 0x76D,
37  kPlatformParakTokenMacintosh = 0x76E
38 };
39 
41 public:
42  ScriptFunction(Chunk &chunk);
43  ~ScriptFunction();
44 
46 
47  uint _contextId = 0;
48  uint _id = 0;
49 
50 private:
51  CodeChunk *_code = nullptr;
52 };
53 
55 public:
56  FunctionManager() {};
57  virtual ~FunctionManager();
58 
59  virtual bool attemptToReadFromStream(Chunk &chunk, uint sectionType) override;
60  ScriptValue call(uint functionId, Common::Array<ScriptValue> &args);
61  void deleteFunctionsForContext(uint contextId);
62 
63 private:
65 
66  void script_GetPlatform(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
67  void script_Random(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
68  void script_TimeOfDay(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
69  void script_SquareRoot(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
70  void script_GetUniqueRandom(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
71  void script_CurrentRunTime(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
72  void script_SetGammaCorrection(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
73  void script_GetDefaultGammaCorrection(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
74  void script_GetCurrentGammaCorrection(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
75  void script_SetAudioVolume(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
76  void script_GetAudioVolume(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
77  void script_SystemLanguagePreference(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
78  void script_SetRegistry(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
79  void script_GetRegistry(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
80  void script_SetProfile(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
81  void script_DebugPrint(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
82 
83  // 101 Dalmatians.
84  void script_MazeGenerate(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
85  void script_MazeApplyMoveMask(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
86  void script_MazeSolve(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
87  void script_BeginTimedInterval(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
88  void script_EndTimedInterval(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
89 
90  // IBM/Crayola.
91  void script_Drawing(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
92 };
93 
94 } // End of namespace MediaStation
95 
96 #endif
Definition: actor.h:33
Definition: function.h:40
Definition: datafile.h:102
Definition: function.h:54
Definition: codechunk.h:33
Definition: clients.h:29
Definition: hashmap.h:85
Definition: scriptvalue.h:35
Platform
Definition: platform.h:93