ScummVM API documentation
sound_logic_entry.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  * Additional copyright for this file:
8  * Copyright (C) 1999-2000 Revolution Software Ltd.
9  * This code is based on source code created by Revolution Software,
10  * used with permission.
11  *
12  * This program is free software: you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation, either version 3 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program. If not, see <http://www.gnu.org/licenses/>.
24  *
25  */
26 
27 #ifndef ICB_SOUND_LOGIC_ENTRY_H_INCLUDED
28 #define ICB_SOUND_LOGIC_ENTRY_H_INCLUDED
29 
30 #include "engines/icb/p4.h"
31 #include "engines/icb/debug.h"
32 #include "engines/icb/common/px_clu_api.h"
33 
34 namespace ICB {
35 
36 // This defines the maximum number of sounds any one mega can be registered for.
37 #define SL_MAX_SOUND_REGISTRATIONS 10
38 
39 // This defines a range on the hearing sensitivity a mega can have ( MAX = normal hearing, MIN = deaf ).
40 #define SL_MIN_HEARING_SENSITIVITY 0
41 #define SL_MAX_HEARING_SENSITIVITY 9
42 
43 // This is the volume range over which the real sound engine works over (0 to this figure).
44 #define SL_MAX_VOLUME 127
45 
46 // This defines the default.
47 #define SL_DEFAULT_HEARING_SENSITIVITY 5
48 
49 // Holds the current sounds that a single mega character is interested in in the sound logic engine.
51 public:
52  // Default constructor.
53  inline _sound_logic_entry();
54 
55  // This sets up a new entry for a mega.
56  void Initialise(uint32 nID, bool8 bFull = TRUE8);
57 
58  // Gets and sets.
59  uint32 GetMegaID() const { return (m_nMegaID); }
60  inline bool8 HeardSound();
61  void SetHearingSensitivity(uint32 nSensitivity);
62  bool8 HeardThis(const char *pcSoundID);
63  void SetSuspendedFlag(bool8 bSuspend) {
64  m_bSuspended = bSuspend;
65  m_bHeardSomething = FALSE8;
66  }
67 
68  // This allows the heard-something event flag to be cleared.
69  void ClearHeardFlag() { m_bHeardSomething = FALSE8; }
70 
71  // This adds interest in a certain sound for a mega character.
72  bool8 AddSoundRegistration(const char *pcSoundID);
73 
74  // Removes one.
75  void RemoveSoundRegistration(const char *pcSoundID);
76 
77  // Call this when a sound has reached a mega.
78  void SoundReachedMega(uint32 nHashedSoundID, uint32 nVolume);
79 
80 private:
81  uint32 m_nMegaID; // ID of the mega character.
82  uint32 m_nHashedSoundIDs[SL_MAX_SOUND_REGISTRATIONS]; // Sounds this mega is interested in.
83  uint32 m_nLastHashedSoundHeard; // Hash of last sound to be heard.
84  bool8 m_bHeardSomething; // Gets set to true when there is a sound event outstanding.
85  uint8 m_nHearingThreshold; // The hearing sensitivity of the mega.
86  bool8 m_bSuspended; // Set true when mega is suspended from this service.
87  uint8 m_nPad2;
88 
89  // Block use of default '='.
91  void operator=(const _sound_logic_entry &) { ; }
92 };
93 
94 inline _sound_logic_entry::_sound_logic_entry() { memset(m_nHashedSoundIDs, 0, SL_MAX_SOUND_REGISTRATIONS * sizeof(uint32)); m_nPad2 = 0; }
95 
96 inline bool8 _sound_logic_entry::HeardSound() { return (m_bHeardSomething); }
97 
98 } // End of namespace ICB
99 
100 #endif // #if !defined(SOUND_LOGIC_ENTRY_H_INCLUDED)
Definition: actor.h:32
Definition: sound_logic_entry.h:50