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  byte *_bytecodeBuffer = nullptr;
52  uint32 _bytecodeSize = 0;
53 };
54 
56 public:
57  FunctionManager() {};
58  virtual ~FunctionManager();
59 
60  virtual bool attemptToReadFromStream(Chunk &chunk, uint sectionType) override;
61  ScriptValue call(uint functionId, Common::Array<ScriptValue> &args);
62  void deleteFunctionsForContext(uint contextId);
63 
64  uint _scriptBlockCallDepth = 0;
65 
66 private:
68 
69  void script_GetPlatform(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
70  void script_Random(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
71  void script_TimeOfDay(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
72  void script_SquareRoot(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
73  void script_GetUniqueRandom(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
74  void script_CurrentRunTime(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
75  void script_SetGammaCorrection(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
76  void script_GetDefaultGammaCorrection(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
77  void script_GetCurrentGammaCorrection(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
78  void script_SetAudioVolume(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
79  void script_GetAudioVolume(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
80  void script_SystemLanguagePreference(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
81  void script_SetRegistry(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
82  void script_GetRegistry(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
83  void script_SetProfile(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
84  void script_DebugPrint(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
85 
86  // 101 Dalmatians.
87  void script_MazeGenerate(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
88  void script_MazeApplyMoveMask(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
89  void script_MazeSolve(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
90  void script_BeginTimedInterval(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
91  void script_EndTimedInterval(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
92 
93  // Hercules.
94  void script_Checkers(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
95 
96  // IBM/Crayola.
97  void script_Drawing(Common::Array<ScriptValue> &args, ScriptValue &returnValue);
98 };
99 
100 } // End of namespace MediaStation
101 
102 #endif
Definition: actor.h:34
Definition: function.h:40
Definition: datafile.h:99
Definition: function.h:55
Definition: clients.h:29
Definition: hashmap.h:85
Definition: scriptvalue.h:35
Platform
Definition: platform.h:93