OpenTTD Source: src/newgrf_sound.h Source File

OpenTTD Source 14.0-beta3

newgrf_sound.h
Go to the documentation of this file.
1 /*
2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
6 */
7
10 #ifndef NEWGRF_SOUND_H
11 #define NEWGRF_SOUND_H
12
13 #include "sound_type.h"
14 #include "tile_type.h"
15 #include "vehicle_type.h"
16
18 enum VehicleSoundEvent {
19 VSE_START = 1,
20 VSE_TUNNEL = 2,
21 VSE_BREAKDOWN = 3,
22 VSE_RUNNING = 4,
23 VSE_TOUCHDOWN = 5,
24 VSE_VISUAL_EFFECT = 6,
25 VSE_RUNNING_16 = 7,
26 VSE_STOPPED_16 = 8,
27 VSE_LOAD_UNLOAD = 9,
28 };
29
30
31 SoundEntry *AllocateSound(uint num);
32 void InitializeSoundPool();
33 bool LoadNewGRFSound(SoundEntry *sound);
34 SoundID GetNewGRFSoundID(const struct GRFFile *file, SoundID sound_id);
35 SoundEntry *GetSound(SoundID sound_id);
36 uint GetNumSounds();
37 bool PlayVehicleSound(const Vehicle *v, VehicleSoundEvent event, bool force = false);
38 void PlayTileSound(const struct GRFFile *file, SoundID sound_id, TileIndex tile);
39
40 #endif /* NEWGRF_SOUND_H */
VSE_START
@ VSE_START
Vehicle starting, i.e. leaving, the station.
Definition: newgrf_sound.h:19
VSE_TUNNEL
@ VSE_TUNNEL
Train entering a tunnel.
Definition: newgrf_sound.h:20
VSE_TOUCHDOWN
@ VSE_TOUCHDOWN
Whenever a plane touches down.
Definition: newgrf_sound.h:23
sound_type.h
VSE_BREAKDOWN
@ VSE_BREAKDOWN
Vehicle breaking down.
Definition: newgrf_sound.h:21
GetNewGRFSoundID
SoundID GetNewGRFSoundID(const GRFFile *file, SoundID sound_id)
Resolve NewGRF sound ID.
Definition: newgrf_sound.cpp:169
StrongType::Typedef< uint32_t, struct TileIndexTag, StrongType::Compare, StrongType::Integer, StrongType::Compatible< int32_t >, StrongType::Compatible< int64_t > >
Vehicle
Vehicle data structure.
Definition: vehicle_base.h:240
VSE_VISUAL_EFFECT
@ VSE_VISUAL_EFFECT
Vehicle visual effect (steam, diesel smoke or electric spark) is shown.
Definition: newgrf_sound.h:24
VSE_LOAD_UNLOAD
@ VSE_LOAD_UNLOAD
Whenever cargo payment is made for a vehicle.
Definition: newgrf_sound.h:27
PlayTileSound
void PlayTileSound(const GRFFile *file, SoundID sound_id, TileIndex tile)
Play a NewGRF sound effect at the location of a specific tile.
Definition: newgrf_sound.cpp:220
PlayVehicleSound
bool PlayVehicleSound(const Vehicle *v, VehicleSoundEvent event, bool force=false)
Checks whether a NewGRF wants to play a different vehicle sound effect.
Definition: newgrf_sound.cpp:187
SoundEntry
Definition: sound_type.h:13
AllocateSound
SoundEntry * AllocateSound(uint num)
Allocate sound slots.
Definition: newgrf_sound.cpp:31
vehicle_type.h
tile_type.h
LoadNewGRFSound
bool LoadNewGRFSound(SoundEntry *sound)
Extract meta data from a NewGRF sound.
Definition: newgrf_sound.cpp:66
VehicleSoundEvent
VehicleSoundEvent
Events at which a sound might be played.
Definition: newgrf_sound.h:18
VSE_RUNNING
@ VSE_RUNNING
Vehicle running normally.
Definition: newgrf_sound.h:22
VSE_STOPPED_16
@ VSE_STOPPED_16
Every 16 ticks while the vehicle is stopped (speed == 0).
Definition: newgrf_sound.h:26
GRFFile
Dynamic data of a loaded NewGRF.
Definition: newgrf.h:107
VSE_RUNNING_16
@ VSE_RUNNING_16
Every 16 ticks while the vehicle is running (speed > 0).
Definition: newgrf_sound.h:25