ScummVM API documentation
scriptfuncs.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 MADE_SCRIPTFUNCS_H
23#define MADE_SCRIPTFUNCS_H
24
25#include "made/resource.h"
26
27#include "audio/mixer.h"
28
29#include "common/debug.h"
30#include "common/system.h"
31
32namespace Made {
33
34class MadeEngine;
35
37
39public:
41 virtual ~ScriptFunctions();
42
43 int16 callFunction(uint16 index, int16 argc, int16 *argv) {
44 if (index >= _externalFuncs.size())
45 error("ScriptFunctions::callFunction() Invalid function index %d", index);
46 debug(4, "%s", _externalFuncNames[index]);
47 return (*_externalFuncs[index])(argc, argv);
48 }
49
50 void setupExternalsTable();
51 const char* getFuncName(int index) { return _externalFuncNames[index]; }
52 int getCount() const { return _externalFuncs.size(); }
53
54private:
55 void playSound(SoundResource *soundRes, bool externalFile);
56 void stopSound();
57
58protected:
59 MadeEngine *_vm;
60 Audio::SoundHandle _audioStreamHandle;
61 Audio::SoundHandle _voiceStreamHandle;
62 SoundResource* _soundResource;
63 bool _soundStarted;
64 bool _soundWasPlaying;
65 bool _soundExternalFile;
66 // The sound length in milliseconds for purpose of checking if the sound is
67 // still playing.
68 int _soundCheckLength;
69 // The audio volume set by the game scripts.
70 uint8 _gameAudioVolume;
71
72 // PlayNote/StopNote and PlayTele/StopTele wave generators
73 Audio::SoundHandle _sine1, _sine2;
74
76 Common::Array<const char *> _externalFuncNames;
77
78 int16 sfSystemCall(int16 argc, int16 *argv);
79 int16 sfInitGraf(int16 argc, int16 *argv);
80 int16 sfRestoreGraf(int16 argc, int16 *argv);
81 int16 sfDrawPicture(int16 argc, int16 *argv);
82 int16 sfClearScreen(int16 argc, int16 *argv);
83 int16 sfShowPage(int16 argc, int16 *argv);
84 int16 sfPollEvent(int16 argc, int16 *argv);
85 int16 sfGetMouseX(int16 argc, int16 *argv);
86 int16 sfGetMouseY(int16 argc, int16 *argv);
87 int16 sfGetKey(int16 argc, int16 *argv);
88 int16 sfSetVisualEffect(int16 argc, int16 *argv);
89 int16 sfPlaySound(int16 argc, int16 *argv);
90 int16 sfPlayMusic(int16 argc, int16 *argv);
91 int16 sfStopMusic(int16 argc, int16 *argv);
92 int16 sfIsMusicPlaying(int16 argc, int16 *argv);
93 int16 sfSetTextPos(int16 argc, int16 *argv);
94 int16 sfFlashScreen(int16 argc, int16 *argv);
95 int16 sfPlayNote(int16 argc, int16 *argv);
96 int16 sfStopNote(int16 argc, int16 *argv);
97 int16 sfPlayTele(int16 argc, int16 *argv);
98 int16 sfStopTele(int16 argc, int16 *argv);
99 int16 sfHideMouseCursor(int16 argc, int16 *argv);
100 int16 sfShowMouseCursor(int16 argc, int16 *argv);
101 int16 sfGetMusicBeat(int16 argc, int16 *argv);
102 int16 sfSetScreenLock(int16 argc, int16 *argv);
103 int16 sfAddSprite(int16 argc, int16 *argv);
104 int16 sfFreeAnim(int16 argc, int16 *argv);
105 int16 sfDrawSprite(int16 argc, int16 *argv);
106 int16 sfEraseSprites(int16 argc, int16 *argv);
107 int16 sfUpdateSprites(int16 argc, int16 *argv);
108 int16 sfGetTimer(int16 argc, int16 *argv);
109 int16 sfSetTimer(int16 argc, int16 *argv);
110 int16 sfResetTimer(int16 argc, int16 *argv);
111 int16 sfAllocTimer(int16 argc, int16 *argv);
112 int16 sfFreeTimer(int16 argc, int16 *argv);
113 int16 sfSetPaletteLock(int16 argc, int16 *argv);
114 int16 sfSetFont(int16 argc, int16 *argv);
115 int16 sfDrawText(int16 argc, int16 *argv);
116 int16 sfHomeText(int16 argc, int16 *argv);
117 int16 sfSetTextRect(int16 argc, int16 *argv);
118 int16 sfSetTextXY(int16 argc, int16 *argv);
119 int16 sfSetFontDropShadow(int16 argc, int16 *argv);
120 int16 sfSetFontColor(int16 argc, int16 *argv);
121 int16 sfSetFontOutline(int16 argc, int16 *argv);
122 int16 sfLoadMouseCursor(int16 argc, int16 *argv);
123 int16 sfSetSpriteGround(int16 argc, int16 *argv);
124 int16 sfLoadResText(int16 argc, int16 *argv);
125 int16 sfSetClipArea(int16 argc, int16 *argv);
126 int16 sfSetSpriteClip(int16 argc, int16 *argv);
127 int16 sfAddScreenMask(int16 argc, int16 *argv);
128 int16 sfSetSpriteMask(int16 argc, int16 *argv);
129 int16 sfSoundPlaying(int16 argc, int16 *argv);
130 int16 sfStopSound(int16 argc, int16 *argv);
131 int16 sfPlayVoice(int16 argc, int16 *argv);
132 int16 sfPlayCd(int16 argc, int16 *argv);
133 int16 sfStopCd(int16 argc, int16 *argv);
134 int16 sfGetCdStatus(int16 argc, int16 *argv);
135 int16 sfGetCdTime(int16 argc, int16 *argv);
136 int16 sfPlayCdSegment(int16 argc, int16 *argv);
137 int16 sfPrintf(int16 argc, int16 *argv);
138 int16 sfClearMono(int16 argc, int16 *argv);
139 int16 sfGetSoundEnergy(int16 argc, int16 *argv);
140 int16 sfClearText(int16 argc, int16 *argv);
141 int16 sfAnimText(int16 argc, int16 *argv);
142 int16 sfGetTextWidth(int16 argc, int16 *argv);
143 int16 sfPlayMovie(int16 argc, int16 *argv);
144 int16 sfLoadSound(int16 argc, int16 *argv);
145 int16 sfLoadMusic(int16 argc, int16 *argv);
146 int16 sfLoadPicture(int16 argc, int16 *argv);
147 int16 sfSetMusicVolume(int16 argc, int16 *argv);
148 int16 sfRestartEvents(int16 argc, int16 *argv);
149 int16 sfPlaceSprite(int16 argc, int16 *argv);
150 int16 sfPlaceText(int16 argc, int16 *argv);
151 int16 sfDeleteChannel(int16 argc, int16 *argv);
152 int16 sfGetChannelType(int16 argc, int16 *argv);
153 int16 sfSetChannelState(int16 argc, int16 *argv);
154 int16 sfSetChannelLocation(int16 argc, int16 *argv);
155 int16 sfSetChannelContent(int16 argc, int16 *argv);
156 int16 sfSetExcludeArea(int16 argc, int16 *argv);
157 int16 sfSetSpriteExclude(int16 argc, int16 *argv);
158 int16 sfGetChannelState(int16 argc, int16 *argv);
159 int16 sfPlaceAnim(int16 argc, int16 *argv);
160 int16 sfSetAnimFrame(int16 argc, int16 *argv);
161 int16 sfGetAnimFrame(int16 argc, int16 *argv);
162 int16 sfGetAnimFrameCount(int16 argc, int16 *argv);
163 int16 sfGetPictureWidth(int16 argc, int16 *argv);
164 int16 sfGetPictureHeight(int16 argc, int16 *argv);
165 int16 sfSetSoundRate(int16 argc, int16 *argv);
166 int16 sfDrawAnimPic(int16 argc, int16 *argv);
167 int16 sfLoadAnim(int16 argc, int16 *argv);
168 int16 sfReadText(int16 argc, int16 *argv);
169 int16 sfReadMenu(int16 argc, int16 *argv);
170 int16 sfDrawMenu(int16 argc, int16 *argv);
171 int16 sfGetMenuCount(int16 argc, int16 *argv);
172 int16 sfSaveGame(int16 argc, int16 *argv);
173 int16 sfLoadGame(int16 argc, int16 *argv);
174 int16 sfGetGameDescription(int16 argc, int16 *argv);
175 int16 sfShakeScreen(int16 argc, int16 *argv);
176 int16 sfPlaceMenu(int16 argc, int16 *argv);
177 int16 sfSetSoundVolume(int16 argc, int16 *argv);
178 int16 sfGetSynthType(int16 argc, int16 *argv);
179 int16 sfIsSlowSystem(int16 argc, int16 *argv);
180 int16 sfMovieCall(int16 argc, int16 *argv);
181 int16 sfCursorXY(int16 argc, int16 *argv);
182 int16 sfSoundFile(int16 argc, int16 *argv);
183
184 int16 sfUnknown(int16 argc, int16 *argv);
185};
186
187} // End of namespace Made
188
189#endif /* MADE_H */
Definition: mixer.h:49
Definition: array.h:52
Definition: made.h:69
Definition: scriptfuncs.h:38
Definition: resource.h:118
void debug(MSVC_PRINTF const char *s,...) GCC_PRINTF(1
void NORETURN_PRE error(MSVC_PRINTF const char *s,...) GCC_PRINTF(1
Definition: console.h:27
Definition: func.h:473