Debian Codegraph @

common/main/sounds.h

raw
1 /*
2 * Portions of this file are copyright Rebirth contributors and licensed as
3 * described in COPYING.txt.
4 * Portions of this file are copyright Parallax Software and licensed
5 * according to the Parallax license below.
6 * See COPYING.txt for license details.
7
8 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
9 SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
10 END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
11 ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
12 IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
13 SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
14 FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
15 CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
16 AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
17 COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
18 */
19
20 /*
21 *
22 * Numbering system for the sounds.
23 *
24 */
25
26
27 #ifndef _SOUNDS_H
28 #define _SOUNDS_H
29
30 #include <array>
31 #include <cstdint>
32 #include <type_traits>
33 #include "dsx-ns.h"
34
35 #ifdef DXX_BUILD_DESCENT
36 #if DXX_BUILD_DESCENT == 1
37 #define SOUND_GOOD_SELECTION_PRIMARY (PCSharePig ? sound_effect::SOUND_ALREADY_SELECTED : sound_effect::SOUND_GOOD_SELECTION_PRIMARY_FULL_DATA)
38 #define SOUND_GOOD_SELECTION_SECONDARY (PCSharePig ? sound_effect::SOUND_ALREADY_SELECTED : sound_effect::SOUND_GOOD_SELECTION_SECONDARY_FULL_DATA) // Adam: New sound number here! MK, 01/30/95
39 #define SOUND_CHEATER (PCSharePig ? sound_effect::SOUND_BAD_SELECTION : sound_effect::SOUND_CHEATER_FULL_DATA) // moved by Victor Rachels
40 #elif DXX_BUILD_DESCENT == 2
41 #define SOUND_GOOD_SELECTION_PRIMARY sound_effect::SOUND_GOOD_SELECTION_PRIMARY_FULL_DATA
42 #define SOUND_GOOD_SELECTION_SECONDARY sound_effect::SOUND_GOOD_SELECTION_SECONDARY_FULL_DATA
43 #define SOUND_CHEATER sound_effect::SOUND_CHEATER_FULL_DATA
44 #endif
45
46 namespace d1x {
47 constexpr std::integral_constant<unsigned, 250> MAX_SOUNDS{};
48 }
49 namespace d2x {
50 //--------------------------------------------------------------
51 // bad to have sound 255!
52 constexpr std::integral_constant<unsigned, 254> MAX_SOUNDS{};
53 }
54
55 //------------------- List of sound effects --------------------
56 namespace dcx {
57
58 /* The games do not use exactly the same sounds, but every sound can
59 * be classified as:
60 * - Used in both games, with the same value
61 * - Used only in Descent 1
62 * - Used only in Descent 2
63 * Therefore, this can be in dcx without causing ambiguity. Sounds
64 * used only for one game are unnecessarily defined in the other,
65 * and then ignored.
66 *
67 * The values of sound_effect are used to index Sounds. Some existing
68 * structures use a uint8_t to store a value that is interpreted as a
69 * sound_effect, so use uint8_t as the underlying type for sound_effect.
70 */
71 enum sound_effect : uint8_t
72 {
73 SOUND_LASER_FIRED = 10,
74 SOUND_BADASS_EXPLOSION = 11, // need something different for this if possible
75 SOUND_WEAPON_HIT_BLASTABLE = 11,
76 SOUND_ROBOT_HIT_PLAYER = 17,
77 SOUND_ROBOT_HIT = 20,
78 SOUND_VOLATILE_WALL_HIT = 21,
79 SOUND_DROP_BOMB = 26,
80 SOUND_WEAPON_HIT_DOOR = 27,
81 SOUND_CONTROL_CENTER_HIT = 30,
82 SOUND_LASER_HIT_CLUTTER = 30,
83 SOUND_CONTROL_CENTER_DESTROYED = 31,
84 SOUND_EXPLODING_WALL = 31, // one long sound
85 SOUND_BIG_ENDLEVEL_EXPLOSION = SOUND_EXPLODING_WALL,
86 SOUND_TUNNEL_EXPLOSION = SOUND_EXPLODING_WALL,
87 SOUND_CONTROL_CENTER_WARNING_SIREN = 32,
88 SOUND_MINE_BLEW_UP = 33,
89 SOUND_FUSION_WARMUP = 34,
90 SOUND_REFUEL_STATION_GIVING_FUEL = 62,
91 SOUND_PLAYER_HIT_WALL = 70,
92 SOUND_PLAYER_GOT_HIT = 71,
93 SOUND_HOSTAGE_RESCUED = 91,
94 SOUND_COUNTDOWN_0_SECS = 100, // countdown 100..114
95 SOUND_COUNTDOWN_13_SECS = 113,
96 SOUND_COUNTDOWN_29_SECS = 114,
97 SOUND_HUD_MESSAGE = 117,
98 SOUND_HUD_KILL = 118,
99 SOUND_HOMING_WARNING = 122, // Warning beep: You are being tracked by a missile! Borrowed from old repair center sounds.
100 SOUND_VOLATILE_WALL_HISS = 151, // need a hiss sound here.
101 SOUND_GOOD_SELECTION_PRIMARY_FULL_DATA = 153,
102 SOUND_GOOD_SELECTION_SECONDARY_FULL_DATA = 154, // Adam: New sound number here! MK, 01/30/95
103 SOUND_ALREADY_SELECTED = 155, // Adam: New sound number here! MK, 01/30/95
104 SOUND_BAD_SELECTION = 156,
105 SOUND_CLOAK_OFF = 161, // sound when cloak goes away
106 SOUND_WALL_CLOAK_OFF = SOUND_CLOAK_OFF,
107 SOUND_INVULNERABILITY_OFF = 163, // sound when invulnerability goes away
108 ROBOT_SEE_SOUND_DEFAULT = 170,
109 ROBOT_ATTACK_SOUND_DEFAULT = 171,
110 SOUND_BOSS_SHARE_SEE = 183,
111 SOUND_BOSS_SHARE_DIE = 185,
112 ROBOT_CLAW_SOUND_DEFAULT = 190,
113 SOUND_CHEATER_FULL_DATA = 200,
114
115 /* if DXX_BUILD_DESCENT == 1 */
116 /* Not used even there */
117 #if 0
118 SOUND_BOSS_SHARE_ATTACK = 184,
119
120 SOUND_NASTY_ROBOT_HIT_1 = 190, // ding.raw ; tearing metal 1
121 SOUND_NASTY_ROBOT_HIT_2 = 191, // ding.raw ; tearing metal 2
122 #endif
123 /* endif */
124 /* if DXX_BUILD_DESCENT == 2 */
125 SOUND_LASER_HIT_WATER = 232,
126 SOUND_MISSILE_HIT_WATER = 233,
127 SOUND_DROP_WEAPON = 39,
128
129 SOUND_FORCEFIELD_BOUNCE_PLAYER = 40,
130 SOUND_FORCEFIELD_BOUNCE_WEAPON = 41,
131 SOUND_FORCEFIELD_HUM = 42,
132 SOUND_FORCEFIELD_OFF = 43,
133
134 SOUND_MARKER_HIT = 50,
135 SOUND_BUDDY_MET_GOAL = 51,
136
137 SOUND_BRIEFING_HUM = 94,
138 SOUND_BRIEFING_PRINTING = 95,
139 SOUND_HUD_JOIN_REQUEST = 123,
140 SOUND_HUD_BLUE_GOT_FLAG = 124,
141 SOUND_HUD_RED_GOT_FLAG = 125,
142 SOUND_HUD_YOU_GOT_FLAG = 126,
143 SOUND_HUD_BLUE_GOT_GOAL = 127,
144 SOUND_HUD_RED_GOT_GOAL = 128,
145 SOUND_HUD_YOU_GOT_GOAL = 129,
146
147 SOUND_LAVAFALL_HISS = 150, // under a lavafall
148 SOUND_SHIP_IN_WATER = 152, // sitting (or moving though) water
149 SOUND_SHIP_IN_WATERFALL = 158, // under a waterfall
150
151 SOUND_CLOAK_ON = 160, // USED FOR WALL CLOAK
152 SOUND_WALL_CLOAK_ON = SOUND_CLOAK_ON,
153
154 SOUND_AMBIENT_LAVA = 222,
155 SOUND_AMBIENT_WATER = 223,
156
157 SOUND_CONVERT_ENERGY = 241,
158 SOUND_WEAPON_STOLEN = 244,
159
160 SOUND_LIGHT_BLOWNUP = 157,
161
162 SOUND_WALL_REMOVED = 246, // Wall removed, probably due to a wall switch.
163 SOUND_AFTERBURNER_IGNITE = 247,
164 SOUND_AFTERBURNER_PLAY = 248,
165
166 SOUND_SECRET_EXIT = 249,
167
168 SOUND_SEISMIC_DISTURBANCE_START = 251,
169
170 SOUND_YOU_GOT_ORB = 84,
171 SOUND_FRIEND_GOT_ORB = 85,
172 SOUND_OPPONENT_GOT_ORB = 86,
173 SOUND_OPPONENT_HAS_SCORED = 87,
174 /* endif */
175 None = UINT8_MAX,
176 };
177
178 // I think it would be nice to have a scrape sound...
179 //#define SOUND_PLAYER_SCRAPE_WALL 72
180
181 extern std::array<sound_effect, ::d2x::MAX_SOUNDS> Sounds, AltSounds;
182 }
183
184 namespace dsx {
185
186 static inline sound_effect build_sound_effect_from_untrusted(const uint8_t u)
187 {
188 return u < MAX_SOUNDS ? sound_effect{u} : sound_effect::None;
189 }
190
191 }
192
193 #endif
194
195 #endif /* _SOUNDS_H */