ScummVM API documentation
rsound_phantom.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 MADS_PHANTOM_SOUND_RSOUND_PHANTOM_H
23 #define MADS_PHANTOM_SOUND_RSOUND_PHANTOM_H
24 
25 #include "mads/phantom/sound/rsound.h"
26 
27 namespace MADS {
28 namespace Phantom {
29 namespace Sound {
30 
54 class RSound1 : public RSound {
55 private:
56  typedef int (RSound1:: *CommandPtr)();
57 
58  // Avoids picking the same alternative twice in a row.
59  int _lastRandomAmbianceIndex = -1;
60 
61  void checkRandomAmbianceTrigger() override;
62 
63  int command16();
64 
65  // Both commands use the section-1-specific isSoundActive(0x3D98) gate.
66  int command4() override;
67  int command5() override;
68 
69  int command24();
70  int command25();
71  int command26();
72  int command27();
73 
74  int command32();
75  // Targets of command16's random picker (funcs_122AD in the
76  // disassembly). sound1() is not a real disassembly function - see
77  // the class comment.
78  int command38();
79  int sound1();
80  int sound2();
81  int sound3();
82  int sound4();
83  int sound5();
84  int command33();
85  int command34();
86  int command35();
87  int command36();
88  int command37();
89  int command39();
90 
91  int command64();
92  int command65();
93  int command66();
94  int command67();
95  int command68();
96  int command69();
97  int command70();
98  int command71();
99  int command72();
100  int command73();
101  int command74();
102  int command75();
103  int command76();
104 
105 public:
106  RSound1(Audio::Mixer *mixer);
107 
108  int command(int commandId, int param) override;
109 };
110 
128 class RSound2 : public RSound {
129 private:
130  typedef int (RSound2:: *CommandPtr)();
131  static const CommandPtr _commandList[74];
132 
133  // Both commands use the standard ungated reset/enable tails.
134  int command4() override;
135  int command5() override;
136 
137  int command16();
138  int command24();
139  int command25();
140  int command26();
141  int command27();
142  int command32();
143  int command33();
144  int command34();
145  int command35();
146  int command64();
147  int command65();
148  int command66();
149  int command67();
150  int command68();
151  int command69();
152  int command70();
153  int command71();
154  int command72();
155 
156 public:
157  RSound2(Audio::Mixer *mixer);
158 
159  int command(int commandId, int param) override;
160 };
161 
196 class RSound3 : public RSound {
197 private:
198  typedef int (RSound3:: *CommandPtr)();
199  static const CommandPtr _commandList[77];
200 
201  int command4() override;
202  int command5() override;
203 
204  int command16();
205 
206  int command24();
207  int command25();
208  int command26();
209  int command27();
210 
211  int command32();
212  int command33();
213  int command34();
214  int command35();
215  int command36();
216 
217  int command64();
218  int command65();
219  int command66();
220  int command67();
221  int command68();
222  int command69();
223  int command70();
224  int command71();
225  int command72();
226  int command73();
227  int command74();
228  int command75();
229 
230 public:
231  RSound3(Audio::Mixer *mixer);
232 
233  int command(int commandId, int param) override;
234 };
235 
270 class RSound4 : public RSound {
271 private:
272  typedef int (RSound4:: *CommandPtr)();
273  static const CommandPtr _commandList[72];
274  bool callFunction(uint16 targetOffset) override;
275 
276  int command4() override;
277  int command5() override;
278 
279  int command16();
280 
281  int command24();
282  int command25();
283  int command26();
284  int command27();
285 
286  int command64();
287  int command65();
288  int command66();
289  int command67();
290  int command68();
291  int command69();
292  int command70();
293 
294 public:
295  RSound4(Audio::Mixer *mixer);
296 
297  int command(int commandId, int param) override;
298 };
299 
330 class RSound5 : public RSound {
331 private:
332  typedef int (RSound5:: *CommandPtr)();
333  static const CommandPtr _commandList[80];
334 
335  int command1();
336  int command3();
337  int command4() override;
338  int command5() override;
339 
345  void enableChannels678();
346 
347  int command16();
348 
349  int command24();
350  int command25();
351  int command26();
352  int command27();
353 
354  int command33();
355  int command34();
356  int command35();
357  int command36();
358  int command37();
359  int command38();
360  int command39();
361 
362  int command64();
363  int command65();
364  int command66();
365  int command67();
366  int command68();
367  int command69();
368  int command70();
369  int command71();
370  int command72();
371  int command73();
372  int command74();
373  int command75();
374  int command76();
375  int command77();
376  int command78();
377 
378 public:
379  RSound5(Audio::Mixer *mixer);
380 
381  int command(int commandId, int param) override;
382 };
383 
412 class RSound9 : public RSound {
413 private:
414  typedef int (RSound9:: *CommandPtr)();
415  static const CommandPtr _commandList[73];
416 
417  int command4() override;
418  int command5() override;
419 
420  // Shared by dispatch indices 16 AND 24 (identical handler).
421  int command16Or24();
422 
423  int command25();
424  int command26();
425  int command27();
426 
427  int command32();
428  int command34();
429  int command35();
430  int command36();
431  int command37();
432  int command38();
433  int command39();
434 
435  int command64();
436  // Shared by dispatch indices 65 AND 66 (identical handler).
437  int command65Or66();
438  int command67();
439  int command68();
440  int command69();
441  int command70();
442  int command71();
443 
444 public:
445  RSound9(Audio::Mixer *mixer);
446 
447  int command(int commandId, int param) override;
448 };
449 
451 class RSoundDemo : public RSound {
452 protected:
453  RSoundDemo(Audio::Mixer *mixer, const Common::Path &filename,
454  int dataOffset, int dataSize, int sysExOffset);
455 
456  int dispatchCommonCommand(int commandId);
457  int command4() override;
458  int command5() override;
459 };
460 
462 class RSoundDemoPHA final : public RSoundDemo {
463 private:
464  bool callFunction(uint16 targetOffset) override;
465  void writeRandomizedPair(uint16 firstLowOffset, uint16 secondLowOffset,
466  uint16 firstHighOffset, uint16 secondHighOffset,
467  byte firstLow, byte secondLow, byte firstHigh, byte secondHigh);
468 
469 public:
470  explicit RSoundDemoPHA(Audio::Mixer *mixer);
471 
472  int command(int commandId, int param) override;
473  static bool validate(Common::String *reason = nullptr);
474 };
475 
476 } // namespace Sound
477 } // namespace Phantom
478 } // namespace MADS
479 
480 #endif
Definition: rsound.h:129
Definition: rsound_phantom.h:54
Definition: str.h:59
int command(int commandId, int param) override
Definition: rsound_phantom.h:330
Definition: path.h:52
Definition: rsound_phantom.h:412
Definition: rsound_phantom.h:270
Definition: mixer.h:70
virtual bool callFunction(uint16 targetOffset)
Definition: rsound.h:299
Definition: rsound_phantom.h:462
Definition: rsound_phantom.h:451
Definition: rsound_phantom.h:196
Definition: anim_timer.h:27
Definition: rsound_phantom.h:128