diff options
39 files changed, 63 insertions, 54 deletions
diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp index 885028422..fcfaef99a 100644 --- a/src/aircraft_cmd.cpp +++ b/src/aircraft_cmd.cpp @@ -15,7 +15,6 @@ #include "engine.h" #include "station.h" #include "news.h" -#include "sound.h" #include "player.h" #include "aircraft.h" #include "airport.h" @@ -32,6 +31,7 @@ #include "window_func.h" #include "date_func.h" #include "vehicle_func.h" +#include "sound_func.h" #include "functions.h" void Aircraft::UpdateDeltaXY(Direction direction) diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp index c8a3bedff..32d00bc8b 100644 --- a/src/airport_gui.cpp +++ b/src/airport_gui.cpp @@ -10,11 +10,11 @@ #include "gui.h" #include "station_gui.h" #include "viewport.h" -#include "sound.h" #include "command_func.h" #include "station.h" #include "airport.h" #include "depot.h" +#include "sound_func.h" #include "window_func.h" static byte _selected_airport_type; diff --git a/src/bridge_gui.cpp b/src/bridge_gui.cpp index a158300df..d6a0dbbcd 100644 --- a/src/bridge_gui.cpp +++ b/src/bridge_gui.cpp @@ -10,11 +10,11 @@ #include "viewport.h" #include "command_func.h" #include "economy_func.h" -#include "sound.h" #include "variables.h" #include "bridge.h" #include "strings_func.h" #include "window_func.h" +#include "sound_func.h" #include "map_func.h" static struct BridgeData { diff --git a/src/disaster_cmd.cpp b/src/disaster_cmd.cpp index 81bff49cc..985ae8866 100644 --- a/src/disaster_cmd.cpp +++ b/src/disaster_cmd.cpp @@ -32,7 +32,6 @@ #include "industry.h" #include "player.h" #include "airport.h" -#include "sound.h" #include "variables.h" #include "table/sprites.h" #include "strings_func.h" @@ -40,6 +39,7 @@ #include "functions.h" #include "vehicle_func.h" #include "vehicle_base.h" +#include "sound_func.h" enum DisasterSubType { ST_Zeppeliner, diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp index 92f3a7e41..d64a30134 100644 --- a/src/dock_gui.cpp +++ b/src/dock_gui.cpp @@ -12,12 +12,12 @@ #include "window_gui.h" #include "station_gui.h" #include "viewport.h" -#include "sound.h" #include "command_func.h" #include "variables.h" #include "water.h" #include "window_func.h" #include "vehicle_func.h" +#include "sound_func.h" static void ShowBuildDockStationPicker(); static void ShowBuildDocksDepotPicker(); diff --git a/src/economy.cpp b/src/economy.cpp index 862d97089..089250f0b 100644 --- a/src/economy.cpp +++ b/src/economy.cpp @@ -16,7 +16,6 @@ #include "industry.h" #include "town.h" #include "network/network.h" -#include "sound.h" #include "engine.h" #include "network/network_data.h" #include "variables.h" @@ -40,6 +39,7 @@ #include "window_func.h" #include "date_func.h" #include "vehicle_func.h" +#include "sound_func.h" /** * Multiply two integer values and shift the results to right. diff --git a/src/engine.h b/src/engine.h index 8fece3082..65dd82ca2 100644 --- a/src/engine.h +++ b/src/engine.h @@ -12,7 +12,7 @@ #include "command_type.h" #include "gfx_type.h" #include "date_type.h" -#include "sound.h" +#include "sound_type.h" enum RailVehicleTypes { RAILVEH_SINGLEHEAD, ///< indicates a "standalone" locomotive diff --git a/src/genworld_gui.cpp b/src/genworld_gui.cpp index f4a76e427..bc2d7350b 100644 --- a/src/genworld_gui.cpp +++ b/src/genworld_gui.cpp @@ -13,7 +13,6 @@ #include "gfxinit.h" #include "player.h" #include "command_func.h" -#include "sound.h" #include "variables.h" #include "string.h" #include "settings.h" @@ -25,6 +24,7 @@ #include "strings_func.h" #include "window_func.h" #include "date_func.h" +#include "sound_func.h" #include "fios.h" /** diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp index d38beb3fd..66c183e23 100644 --- a/src/industry_cmd.cpp +++ b/src/industry_cmd.cpp @@ -17,7 +17,6 @@ #include "town.h" #include "news.h" #include "saveload.h" -#include "sound.h" #include "variables.h" #include "table/industry_land.h" #include "table/build_industry.h" @@ -40,6 +39,7 @@ #include "window_func.h" #include "date_func.h" #include "vehicle_func.h" +#include "sound_func.h" void ShowIndustryViewWindow(int industry); void BuildOilRig(TileIndex tile); diff --git a/src/main_gui.cpp b/src/main_gui.cpp index 4e7b14191..f5fb8bf35 100644 --- a/src/main_gui.cpp +++ b/src/main_gui.cpp @@ -20,7 +20,6 @@ #include "news.h" #include "town.h" #include "console.h" -#include "sound.h" #include "network/network.h" #include "signs.h" #include "waypoint.h" @@ -41,6 +40,7 @@ #include "date_func.h" #include "functions.h" #include "vehicle_func.h" +#include "sound_func.h" #include "fios.h" #include "network/network_data.h" diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index 679cefe42..f05d89692 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -23,7 +23,6 @@ #include "command_func.h" #include "player.h" #include "town.h" -#include "sound.h" #include "network/network.h" #include "string.h" #include "variables.h" @@ -40,6 +39,7 @@ #include "functions.h" #include "window_func.h" #include "date_func.h" +#include "sound_func.h" /* Variables to display file lists */ FiosItem *_fios_list; diff --git a/src/music/extmidi.cpp b/src/music/extmidi.cpp index fdc9923f0..821c0132e 100644 --- a/src/music/extmidi.cpp +++ b/src/music/extmidi.cpp @@ -3,7 +3,7 @@ #ifndef __MORPHOS__ #include "../stdafx.h" #include "../openttd.h" -#include "../sound.h" +#include "../sound_func.h" #include "../string.h" #include "../variables.h" #include "../debug.h" diff --git a/src/music_gui.cpp b/src/music_gui.cpp index be9f43a3d..ba7ef6d2b 100644 --- a/src/music_gui.cpp +++ b/src/music_gui.cpp @@ -7,13 +7,13 @@ #include "table/strings.h" #include "table/sprites.h" #include "fileio.h" -#include "sound.h" #include "variables.h" #include "music.h" #include "music/music_driver.hpp" #include "window_gui.h" #include "strings_func.h" #include "window_func.h" +#include "sound_func.h" static byte _music_wnd_cursong; static bool _song_is_active; diff --git a/src/newgrf.cpp b/src/newgrf.cpp index 67bad76c5..c70845f4e 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -25,7 +25,6 @@ #include "fontcache.h" #include "currency.h" #include "landscape.h" -#include "sound.h" #include "newgrf_config.h" #include "newgrf_house.h" #include "newgrf_sound.h" @@ -46,6 +45,7 @@ #include "gfx_func.h" #include "date_func.h" #include "vehicle_func.h" +#include "sound_func.h" /* TTDPatch extended GRF format codec * (c) Petr Baudis 2004 (GPL'd) diff --git a/src/newgrf_house.cpp b/src/newgrf_house.cpp index 1f9a19491..917e85178 100644 --- a/src/newgrf_house.cpp +++ b/src/newgrf_house.cpp @@ -10,7 +10,6 @@ #include "landscape.h" #include "town.h" #include "town_map.h" -#include "sound.h" #include "sprite.h" #include "table/strings.h" #include "table/sprites.h" diff --git a/src/newgrf_sound.cpp b/src/newgrf_sound.cpp index 5161ea1ea..80b4d6060 100644 --- a/src/newgrf_sound.cpp +++ b/src/newgrf_sound.cpp @@ -5,12 +5,12 @@ #include "stdafx.h" #include "openttd.h" #include "oldpool.h" -#include "sound.h" #include "engine.h" #include "newgrf_callbacks.h" #include "newgrf_engine.h" #include "newgrf_sound.h" #include "vehicle_base.h" +#include "sound_func.h" static uint _sound_count = 0; STATIC_OLD_POOL(SoundInternal, FileEntry, 3, 1000, NULL, NULL) diff --git a/src/newgrf_sound.h b/src/newgrf_sound.h index 1b368a510..1965e3aae 100644 --- a/src/newgrf_sound.h +++ b/src/newgrf_sound.h @@ -5,6 +5,8 @@ #ifndef NEWGRF_SOUND_H #define NEWGRF_SOUND_H +#include "sound_type.h" + enum VehicleSoundEvent { VSE_START = 1, VSE_TUNNEL = 2, diff --git a/src/news_gui.cpp b/src/news_gui.cpp index 08f6b0061..dd8fb28e4 100644 --- a/src/news_gui.cpp +++ b/src/news_gui.cpp @@ -9,7 +9,6 @@ #include "window_gui.h" #include "viewport.h" #include "news.h" -#include "sound.h" #include "variables.h" #include "string.h" #include "transparency.h" @@ -17,6 +16,7 @@ #include "window_func.h" #include "date_func.h" #include "vehicle_base.h" +#include "sound_func.h" /** @file news_gui.cpp * diff --git a/src/openttd.cpp b/src/openttd.cpp index 8ae851f53..b2c42ccf2 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -30,7 +30,6 @@ #include "industry.h" #include "news.h" #include "engine.h" -#include "sound.h" #include "fileio.h" #include "fios.h" #include "airport.h" @@ -63,6 +62,7 @@ #include "zoom_func.h" #include "date_func.h" #include "vehicle_func.h" +#include "sound_func.h" #include "bridge_map.h" #include "clear_map.h" diff --git a/src/players.cpp b/src/players.cpp index 430a7811e..5fd0c2276 100644 --- a/src/players.cpp +++ b/src/players.cpp @@ -14,7 +14,6 @@ #include "news.h" #include "saveload.h" #include "command_func.h" -#include "sound.h" #include "network/network.h" #include "variables.h" #include "engine.h" @@ -29,6 +28,7 @@ #include "functions.h" #include "date_func.h" #include "vehicle_func.h" +#include "sound_func.h" /** * Sets the local player and updates the patch settings that are set on a diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp index 78227bb38..e733a61eb 100644 --- a/src/rail_cmd.cpp +++ b/src/rail_cmd.cpp @@ -21,7 +21,6 @@ #include "pathfind.h" #include "engine.h" #include "town.h" -#include "sound.h" #include "station.h" #include "sprite.h" #include "depot.h" @@ -41,6 +40,7 @@ #include "tunnelbridge_map.h" #include "window_func.h" #include "vehicle_func.h" +#include "sound_func.h" const byte _track_sloped_sprites[14] = { diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp index 49909d762..659fd070e 100644 --- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -12,7 +12,6 @@ #include "window_gui.h" #include "station_gui.h" #include "viewport.h" -#include "sound.h" #include "command_func.h" #include "station.h" #include "waypoint.h" @@ -25,6 +24,7 @@ #include "functions.h" #include "window_func.h" #include "date_func.h" +#include "sound_func.h" #include "bridge_map.h" #include "rail_map.h" diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp index b5bccca95..90afac8de 100644 --- a/src/road_cmd.cpp +++ b/src/road_cmd.cpp @@ -20,7 +20,6 @@ #include "command_func.h" #include "player.h" #include "town.h" -#include "sound.h" #include "yapf/yapf.h" #include "depot.h" #include "newgrf.h" @@ -34,6 +33,7 @@ #include "strings_func.h" #include "vehicle_func.h" #include "vehicle_base.h" +#include "sound_func.h" #define M(x) (1 << (x)) diff --git a/src/road_gui.cpp b/src/road_gui.cpp index 9722ede36..443009511 100644 --- a/src/road_gui.cpp +++ b/src/road_gui.cpp @@ -10,17 +10,16 @@ #include "window_gui.h" #include "station_gui.h" #include "viewport.h" -#include "sound.h" #include "command_func.h" #include "variables.h" #include "road_cmd.h" #include "road_map.h" #include "station_map.h" -//needed for catchments #include "station.h" #include "functions.h" #include "window_func.h" #include "vehicle_func.h" +#include "sound_func.h" static void ShowRVStationPicker(RoadStop::Type rs); diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp index 83e6f7c42..96b9e6b95 100644 --- a/src/roadveh_cmd.cpp +++ b/src/roadveh_cmd.cpp @@ -19,7 +19,6 @@ #include "pathfind.h" #include "npf.h" #include "player.h" -#include "sound.h" #include "depot.h" #include "bridge.h" #include "tunnel_map.h" @@ -38,6 +37,7 @@ #include "window_func.h" #include "date_func.h" #include "vehicle_func.h" +#include "sound_func.h" static const uint16 _roadveh_images[63] = { diff --git a/src/settings.cpp b/src/settings.cpp index 992df4695..5fc0b2221 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -23,7 +23,6 @@ #include "openttd.h" #include "currency.h" #include "screenshot.h" -#include "sound.h" #include "string.h" #include "variables.h" #include "network/network.h" @@ -42,6 +41,7 @@ #include "window_func.h" #include "strings_func.h" #include "vehicle_func.h" +#include "sound_func.h" #ifdef WITH_FREETYPE #include "fontcache.h" #endif diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp index b126db9bb..4ab205d40 100644 --- a/src/ship_cmd.cpp +++ b/src/ship_cmd.cpp @@ -16,7 +16,6 @@ #include "news.h" #include "engine.h" #include "player.h" -#include "sound.h" #include "npf.h" #include "depot.h" #include "vehicle_gui.h" @@ -34,6 +33,7 @@ #include "window_func.h" #include "date_func.h" #include "vehicle_func.h" +#include "sound_func.h" static const uint16 _ship_sprites[] = {0x0E5D, 0x0E55, 0x0E65, 0x0E6D}; diff --git a/src/smallmap_gui.cpp b/src/smallmap_gui.cpp index a799952f3..8d1273bb5 100644 --- a/src/smallmap_gui.cpp +++ b/src/smallmap_gui.cpp @@ -19,7 +19,6 @@ #include "viewport.h" #include "player.h" #include "town.h" -#include "sound.h" #include "variables.h" #include "blitter/factory.hpp" #include "tunnelbridge_map.h" @@ -27,6 +26,7 @@ #include "zoom_func.h" #include "core/endian_func.hpp" #include "vehicle_base.h" +#include "sound_func.h" static const Widget _smallmap_widgets[] = { diff --git a/src/sound.cpp b/src/sound.cpp index 1a231b0f5..c2047c05e 100644 --- a/src/sound.cpp +++ b/src/sound.cpp @@ -6,7 +6,7 @@ #include "openttd.h" #include "landscape.h" #include "mixer.h" -#include "sound.h" +#include "sound_func.h" #include "viewport.h" #include "fileio.h" #include "newgrf_sound.h" @@ -18,6 +18,7 @@ static uint _file_count; static FileEntry *_files; +MusicFileSettings msf; // Number of levels of panning per side #define PANNING_LEVELS 16 diff --git a/src/sound_func.h b/src/sound_func.h new file mode 100644 index 000000000..d60822ca5 --- /dev/null +++ b/src/sound_func.h @@ -0,0 +1,22 @@ +/* $Id$ */ + +/** @file sound_func.h Functions related to sound. */ + +#ifndef SOUND_FUNC_H +#define SOUND_FUNC_H + +#include "sound_type.h" +#include "vehicle_type.h" +#include "tile_type.h" + +extern MusicFileSettings msf; + +bool SoundInitialize(const char *filename); +uint GetNumOriginalSounds(); + +void SndPlayTileFx(SoundFx sound, TileIndex tile); +void SndPlayVehicleFx(SoundFx sound, const Vehicle *v); +void SndPlayFx(SoundFx sound); +void SndCopyToPool(); + +#endif /* SOUND_FUNC_H */ diff --git a/src/sound.h b/src/sound_type.h index 0912430d6..319a8a06f 100644 --- a/src/sound.h +++ b/src/sound_type.h @@ -1,13 +1,11 @@ /* $Id$ */ -/** @file sound.h */ +/** @file sound_type.h Types related to sounds. */ -#ifndef SOUND_H -#define SOUND_H +#ifndef SOUND_TYPE_H +#define SOUND_TYPE_H #include "core/enum_type.hpp" -#include "vehicle_type.h" -#include "tile_type.h" struct MusicFileSettings { byte playlist; @@ -20,8 +18,6 @@ struct MusicFileSettings { char extmidi[80]; }; -VARDEF MusicFileSettings msf; - struct FileEntry { uint8 file_slot; uint32 file_offset; @@ -33,9 +29,6 @@ struct FileEntry { uint8 priority; }; -bool SoundInitialize(const char *filename); -uint GetNumOriginalSounds(); - enum SoundFx { SND_BEGIN = 0, SND_02_SPLAT = 0, // 0 == 0x00 ! @@ -118,9 +111,4 @@ enum SoundFx { template <> struct EnumPropsT<SoundFx> : MakeEnumPropsT<SoundFx, byte, SND_BEGIN, SND_END, SND_END> {}; typedef TinyEnumT<SoundFx> SoundFxByte; -void SndPlayTileFx(SoundFx sound, TileIndex tile); -void SndPlayVehicleFx(SoundFx sound, const Vehicle *v); -void SndPlayFx(SoundFx sound); -void SndCopyToPool(); - -#endif /* SOUND_H */ +#endif /* SOUND_TYPE_H */ diff --git a/src/table/engines.h b/src/table/engines.h index 9ce78c497..6797de73b 100644 --- a/src/table/engines.h +++ b/src/table/engines.h @@ -7,8 +7,6 @@ * This file contains all the data for vehicles */ -#include "../sound.h" - /** Writes the properties of a train or road vehicle into the EngineInfo struct. * @see EngineInfo * @param a Introduction date diff --git a/src/terraform_gui.cpp b/src/terraform_gui.cpp index bcd6197b7..cf22fd5e9 100644 --- a/src/terraform_gui.cpp +++ b/src/terraform_gui.cpp @@ -12,11 +12,11 @@ #include "gui.h" #include "window_gui.h" #include "viewport.h" -#include "sound.h" #include "command_func.h" #include "signs.h" #include "variables.h" #include "functions.h" +#include "sound_func.h" void CcTerraform(bool success, TileIndex tile, uint32 p1, uint32 p2) { diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index a1b0b8cb0..c347200f2 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -22,7 +22,6 @@ #include "news.h" #include "engine.h" #include "player.h" -#include "sound.h" #include "depot.h" #include "waypoint.h" #include "vehicle_gui.h" @@ -43,6 +42,7 @@ #include "window_func.h" #include "date_func.h" #include "vehicle_func.h" +#include "sound_func.h" static bool TrainCheckIfLineEnds(Vehicle *v); diff --git a/src/transparency_gui.cpp b/src/transparency_gui.cpp index 2ecad02f9..fe232e3ff 100644 --- a/src/transparency_gui.cpp +++ b/src/transparency_gui.cpp @@ -7,9 +7,9 @@ #include "gui.h" #include "window_gui.h" #include "viewport.h" -#include "sound.h" #include "variables.h" #include "transparency.h" +#include "sound_func.h" TransparencyOptionBits _transparency_opt; diff --git a/src/tree_cmd.cpp b/src/tree_cmd.cpp index b8fedf23b..5d00f96fc 100644 --- a/src/tree_cmd.cpp +++ b/src/tree_cmd.cpp @@ -16,12 +16,12 @@ #include "command_func.h" #include "economy_func.h" #include "town.h" -#include "sound.h" #include "variables.h" #include "genworld.h" #include "transparency.h" #include "functions.h" #include "player.h" +#include "sound_func.h" /** * List of tree placer algorithm. diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp index 7407111f9..d1512baef 100644 --- a/src/tunnelbridge_cmd.cpp +++ b/src/tunnelbridge_cmd.cpp @@ -20,7 +20,6 @@ #include "command_func.h" #include "player.h" #include "town.h" -#include "sound.h" #include "variables.h" #include "bridge.h" #include "train.h" @@ -35,6 +34,7 @@ #include "date_func.h" #include "functions.h" #include "vehicle_func.h" +#include "sound_func.h" const Bridge orig_bridge[] = { diff --git a/src/vehicle.cpp b/src/vehicle.cpp index d001b396b..81b384011 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -19,7 +19,6 @@ #include "saveload.h" #include "player.h" #include "engine.h" -#include "sound.h" #include "debug.h" #include "vehicle_gui.h" #include "depot.h" @@ -43,6 +42,7 @@ #include "date_func.h" #include "window_func.h" #include "vehicle_func.h" +#include "sound_func.h" #define INVALID_COORD (0x7fffffff) #define GEN_HASH(x, y) ((GB((y), 6, 6) << 6) + GB((x), 7, 6)) diff --git a/src/water_cmd.cpp b/src/water_cmd.cpp index 10527e4a2..78aa37cc4 100644 --- a/src/water_cmd.cpp +++ b/src/water_cmd.cpp @@ -16,7 +16,6 @@ #include "command_func.h" #include "town.h" #include "news.h" -#include "sound.h" #include "depot.h" #include "vehicle_gui.h" #include "train.h" @@ -32,6 +31,7 @@ #include "functions.h" #include "window_func.h" #include "vehicle_func.h" +#include "sound_func.h" /** Array for the shore sprites */ static const SpriteID _water_shore_sprites[] = { |