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  // Overrides confirming the isSoundActive(0x3D98) gate the base
66  // class's pure-virtual command4()/command5() require - see
67  // RSound::command4/5.
68  int command4() override;
69  int command5() override;
70 
71  int command24();
72  int command25();
73  int command26();
74  int command27();
75 
76  int command32();
77  // Targets of command16's random picker (funcs_122AD in the
78  // disassembly). sound1() is not a real disassembly function - see
79  // the class comment.
80  int command38();
81  int sound1();
82  int sound2();
83  int sound3();
84  int sound4();
85  int sound5();
86  int command33();
87  int command34();
88  int command35();
89  int command36();
90  int command37();
91  int command39();
92 
93  int command64();
94  int command65();
95  int command66();
96  int command67();
97  int command68();
98  int command69();
99  int command70();
100  int command71();
101  int command72();
102  int command73();
103  int command74();
104  int command75();
105  int command76();
106 
107 public:
108  RSound1(Audio::Mixer *mixer);
109 
110  int command(int commandId, int param) override;
111 };
112 
130 class RSound2 : public RSound {
131 private:
132  typedef int (RSound2:: *CommandPtr)();
133  static const CommandPtr _commandList[74];
134 
135  // Overrides confirming the isSoundActive(0x3D98) gate the base
136  // class's pure-virtual command4()/command5() require - see
137  // RSound::command4/5. Same offset NUMBER as RSound1's, but not
138  // assumed to be the same underlying data.
139  int command4() override;
140  int command5() override;
141 
142  int command16();
143  int command24();
144  int command25();
145  int command26();
146  int command27();
147  int command32();
148  int command33();
149  int command34();
150  int command35();
151  int command64();
152  int command65();
153  int command66();
154  int command67();
155  int command68();
156  int command69();
157  int command70();
158  int command71();
159  int command72();
160 
161 public:
162  RSound2(Audio::Mixer *mixer);
163 
164  int command(int commandId, int param) override;
165 };
166 
201 class RSound3 : public RSound {
202 private:
203  typedef int (RSound3:: *CommandPtr)();
204  static const CommandPtr _commandList[77];
205 
206  int command4() override;
207  int command5() override;
208 
209  int command16();
210 
211  int command24();
212  int command25();
213  int command26();
214  int command27();
215 
216  int command32();
217  int command33();
218  int command34();
219  int command35();
220  int command36();
221 
222  int command64();
223  int command65();
224  int command66();
225  int command67();
226  int command68();
227  int command69();
228  int command70();
229  int command71();
230  int command72();
231  int command73();
232  int command74();
233  int command75();
234 
235 public:
236  RSound3(Audio::Mixer *mixer);
237 
238  int command(int commandId, int param) override;
239 };
240 
275 class RSound4 : public RSound {
276 private:
277  typedef int (RSound4:: *CommandPtr)();
278  static const CommandPtr _commandList[72];
279  bool callFunction(uint16 targetOffset) override;
280 
281  int command4() override;
282  int command5() override;
283 
284  int command16();
285 
286  int command24();
287  int command25();
288  int command26();
289  int command27();
290 
291  int command64();
292  int command65();
293  int command66();
294  int command67();
295  int command68();
296  int command69();
297  int command70();
298 
299 public:
300  RSound4(Audio::Mixer *mixer);
301 
302  int command(int commandId, int param) override;
303 };
304 
335 class RSound5 : public RSound {
336 private:
337  typedef int (RSound5:: *CommandPtr)();
338  static const CommandPtr _commandList[80];
339 
340  int command1();
341  int command3();
342  int command4() override;
343  int command5() override;
344 
350  void enableChannels678();
351 
352  int command16();
353 
354  int command24();
355  int command25();
356  int command26();
357  int command27();
358 
359  int command33();
360  int command34();
361  int command35();
362  int command36();
363  int command37();
364  int command38();
365  int command39();
366 
367  int command64();
368  int command65();
369  int command66();
370  int command67();
371  int command68();
372  int command69();
373  int command70();
374  int command71();
375  int command72();
376  int command73();
377  int command74();
378  int command75();
379  int command76();
380  int command77();
381  int command78();
382 
383 public:
384  RSound5(Audio::Mixer *mixer);
385 
386  int command(int commandId, int param) override;
387 };
388 
417 class RSound9 : public RSound {
418 private:
419  typedef int (RSound9:: *CommandPtr)();
420  static const CommandPtr _commandList[73];
421 
422  int command4() override;
423  int command5() override;
424 
425  // Shared by dispatch indices 16 AND 24 (identical handler).
426  int command16Or24();
427 
428  int command25();
429  int command26();
430  int command27();
431 
432  int command32();
433  int command34();
434  int command35();
435  int command36();
436  int command37();
437  int command38();
438  int command39();
439 
440  int command64();
441  // Shared by dispatch indices 65 AND 66 (identical handler).
442  int command65Or66();
443  int command67();
444  int command68();
445  int command69();
446  int command70();
447  int command71();
448 
449 public:
450  RSound9(Audio::Mixer *mixer);
451 
452  int command(int commandId, int param) override;
453 };
454 
456 class RSoundDemo : public RSound {
457 protected:
458  RSoundDemo(Audio::Mixer *mixer, const Common::Path &filename,
459  int dataOffset, int dataSize, int sysExOffset);
460 
461  int dispatchCommonCommand(int commandId);
462  int command4() override;
463  int command5() override;
464 };
465 
467 class RSoundDemoPHA final : public RSoundDemo {
468 private:
469  bool callFunction(uint16 targetOffset) override;
470  void writeRandomizedPair(uint16 firstLowOffset, uint16 secondLowOffset,
471  uint16 firstHighOffset, uint16 secondHighOffset,
472  byte firstLow, byte secondLow, byte firstHigh, byte secondHigh);
473 
474 public:
475  explicit RSoundDemoPHA(Audio::Mixer *mixer);
476 
477  int command(int commandId, int param) override;
478  static bool validate(Common::String *reason = nullptr);
479 };
480 
481 } // namespace Sound
482 } // namespace Phantom
483 } // namespace MADS
484 
485 #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:335
Definition: path.h:52
Definition: rsound_phantom.h:417
Definition: rsound_phantom.h:275
Definition: mixer.h:70
virtual bool callFunction(uint16 targetOffset)
Definition: rsound.h:299
Definition: rsound_phantom.h:467
Definition: rsound_phantom.h:456
Definition: rsound_phantom.h:201
Definition: anim_timer.h:27
Definition: rsound_phantom.h:130