Expose both MAX_SOUNDS in both games
This commit is contained in:
parent
dd035a8f2f
commit
514c63efad
|
@ -28,6 +28,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
|||
#define _SOUNDS_H
|
||||
|
||||
#include "digi.h"
|
||||
#include <array>
|
||||
|
||||
#ifdef dsx
|
||||
#if defined(DXX_BUILD_DESCENT_I)
|
||||
|
@ -39,6 +40,16 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
|||
#define SOUND_GOOD_SELECTION_SECONDARY SOUND_GOOD_SELECTION_SECONDARY_FULL_DATA
|
||||
#define SOUND_CHEATER SOUND_CHEATER_FULL_DATA
|
||||
#endif
|
||||
|
||||
namespace d1x {
|
||||
constexpr std::integral_constant<unsigned, 250> MAX_SOUNDS{};
|
||||
}
|
||||
namespace d2x {
|
||||
//--------------------------------------------------------------
|
||||
// bad to have sound 255!
|
||||
constexpr std::integral_constant<unsigned, 254> MAX_SOUNDS{};
|
||||
}
|
||||
|
||||
//------------------- List of sound effects --------------------
|
||||
namespace dcx {
|
||||
|
||||
|
@ -70,6 +81,8 @@ enum sound_effect : unsigned
|
|||
SOUND_LASER_HIT_CLUTTER = 30,
|
||||
SOUND_CONTROL_CENTER_DESTROYED = 31,
|
||||
SOUND_EXPLODING_WALL = 31, // one long sound
|
||||
SOUND_BIG_ENDLEVEL_EXPLOSION = SOUND_EXPLODING_WALL,
|
||||
SOUND_TUNNEL_EXPLOSION = SOUND_EXPLODING_WALL,
|
||||
SOUND_CONTROL_CENTER_WARNING_SIREN = 32,
|
||||
SOUND_MINE_BLEW_UP = 33,
|
||||
SOUND_FUSION_WARMUP = 34,
|
||||
|
@ -89,6 +102,7 @@ enum sound_effect : unsigned
|
|||
SOUND_ALREADY_SELECTED = 155, // Adam: New sound number here! MK, 01/30/95
|
||||
SOUND_BAD_SELECTION = 156,
|
||||
SOUND_CLOAK_OFF = 161, // sound when cloak goes away
|
||||
SOUND_WALL_CLOAK_OFF = SOUND_CLOAK_OFF,
|
||||
SOUND_INVULNERABILITY_OFF = 163, // sound when invulnerability goes away
|
||||
ROBOT_SEE_SOUND_DEFAULT = 170,
|
||||
ROBOT_ATTACK_SOUND_DEFAULT = 171,
|
||||
|
@ -134,6 +148,7 @@ enum sound_effect : unsigned
|
|||
SOUND_SHIP_IN_WATERFALL = 158, // under a waterfall
|
||||
|
||||
SOUND_CLOAK_ON = 160, // USED FOR WALL CLOAK
|
||||
SOUND_WALL_CLOAK_ON = SOUND_CLOAK_ON,
|
||||
|
||||
SOUND_AMBIENT_LAVA = 222,
|
||||
SOUND_AMBIENT_WATER = 223,
|
||||
|
@ -159,30 +174,13 @@ enum sound_effect : unsigned
|
|||
};
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
#define SOUND_BIG_ENDLEVEL_EXPLOSION SOUND_EXPLODING_WALL
|
||||
#define SOUND_TUNNEL_EXPLOSION SOUND_EXPLODING_WALL
|
||||
|
||||
#if defined(DXX_BUILD_DESCENT_I)
|
||||
constexpr std::integral_constant<unsigned, 250> MAX_SOUNDS{};
|
||||
#elif defined(DXX_BUILD_DESCENT_II)
|
||||
#define SOUND_WALL_CLOAK_ON SOUND_CLOAK_ON
|
||||
#define SOUND_WALL_CLOAK_OFF SOUND_CLOAK_OFF
|
||||
|
||||
//--------------------------------------------------------------
|
||||
// bad to have sound 255!
|
||||
constexpr std::integral_constant<unsigned, 254> MAX_SOUNDS{};
|
||||
#endif
|
||||
|
||||
namespace dsx {
|
||||
// I think it would be nice to have a scrape sound...
|
||||
//#define SOUND_PLAYER_SCRAPE_WALL 72
|
||||
|
||||
#if defined(DXX_BUILD_DESCENT_I) || defined(DXX_BUILD_DESCENT_II)
|
||||
#include "dxxsconf.h"
|
||||
#include <array>
|
||||
|
||||
extern std::array<ubyte, MAX_SOUNDS> Sounds, AltSounds;
|
||||
extern std::array<uint8_t, MAX_SOUNDS> Sounds, AltSounds;
|
||||
}
|
||||
|
||||
constexpr std::integral_constant<int, -1> sound_none{};
|
||||
#endif
|
||||
|
|
|
@ -70,8 +70,6 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
|||
#include "partial_range.h"
|
||||
#include <memory>
|
||||
|
||||
std::array<ubyte, MAX_SOUNDS> Sounds, AltSounds;
|
||||
|
||||
unsigned NumTextures;
|
||||
|
||||
#if DXX_USE_EDITOR
|
||||
|
@ -79,6 +77,7 @@ int Num_object_subtypes = 1;
|
|||
#endif
|
||||
|
||||
namespace dsx {
|
||||
std::array<uint8_t, MAX_SOUNDS> Sounds, AltSounds;
|
||||
#if defined(DXX_BUILD_DESCENT_I)
|
||||
int Num_total_object_types;
|
||||
|
||||
|
@ -175,8 +174,8 @@ void properties_read_cmp(d_vclip_array &Vclip, PHYSFS_File * fp)
|
|||
range_for (tmap_info &ti, TmapInfo)
|
||||
tmap_info_read(ti, fp);
|
||||
|
||||
PHYSFS_read(fp, Sounds, sizeof(Sounds[0]), Sounds.size());
|
||||
PHYSFS_read(fp, AltSounds, sizeof(AltSounds[0]), AltSounds.size());
|
||||
PHYSFS_read(fp, Sounds, sizeof(Sounds[0]), MAX_SOUNDS);
|
||||
PHYSFS_read(fp, AltSounds, sizeof(AltSounds[0]), MAX_SOUNDS);
|
||||
|
||||
Num_vclips = PHYSFSX_readInt(fp);
|
||||
range_for (vclip &vc, Vclip)
|
||||
|
@ -233,8 +232,8 @@ void properties_read_cmp(d_vclip_array &Vclip, PHYSFS_File * fp)
|
|||
Num_cockpits = PHYSFSX_readInt(fp);
|
||||
bitmap_index_read_n(fp, cockpit_bitmap);
|
||||
|
||||
PHYSFS_read(fp, Sounds, sizeof(Sounds[0]), Sounds.size());
|
||||
PHYSFS_read(fp, AltSounds, sizeof(AltSounds[0]), AltSounds.size());
|
||||
PHYSFS_read(fp, Sounds, sizeof(Sounds[0]), MAX_SOUNDS);
|
||||
PHYSFS_read(fp, AltSounds, sizeof(AltSounds[0]), MAX_SOUNDS);
|
||||
|
||||
Num_total_object_types = PHYSFSX_readInt(fp);
|
||||
PHYSFS_read( fp, ObjType, sizeof(ubyte), MAX_OBJTYPE );
|
||||
|
|
|
@ -488,11 +488,8 @@ int gamedata_read_tbl(d_vclip_array &Vclip, int pc_shareware)
|
|||
load_palette(DEFAULT_PIG_PALETTE,-2,0); //special: tell palette code which pig is loaded
|
||||
#endif
|
||||
|
||||
for (unsigned i = 0; i < MAX_SOUNDS; ++i)
|
||||
{
|
||||
Sounds[i] = 255;
|
||||
AltSounds[i] = 255;
|
||||
}
|
||||
Sounds.fill(255);
|
||||
AltSounds.fill(255);
|
||||
|
||||
DXX_MAKE_VAR_UNDEFINED(TmapInfo);
|
||||
range_for (auto &ti, TmapInfo)
|
||||
|
|
|
@ -1166,9 +1166,9 @@ static int piggy_is_needed(int soundnum)
|
|||
if (!CGameArg.SysLowMem)
|
||||
return 1;
|
||||
|
||||
range_for (auto i, AltSounds)
|
||||
for (const auto i : AltSounds)
|
||||
{
|
||||
if (i < 255 && Sounds[i] == soundnum)
|
||||
if (i < Sounds.size() && Sounds[i] == soundnum)
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
|
Loading…
Reference in a new issue