1 //       _________ __                 __
2 //      /   _____//  |_____________ _/  |______     ____  __ __  ______
3 //      \_____  \\   __\_  __ \__  \\   __\__  \   / ___\|  |  \/  ___/
4 //      /        \|  |  |  | \// __ \|  |  / __ \_/ /_/  >  |  /\___ |
5 //     /_______  /|__|  |__|  (____  /__| (____  /\___  /|____//____  >
6 //             \/                  \/          \//_____/            \/
7 //  ______________________                           ______________________
8 //                        T H E   W A R   B E G I N S
9 //         Stratagus - A free fantasy real time strategy game engine
10 //
11 /**@name unitsound.h - The unit sounds headerfile. */
12 //
13 //      (c) Copyright 1999-2005 by Lutz Sammer, Fabrice Rossi,
14 //                                 and Jimmy Salmon
15 //
16 //      This program is free software; you can redistribute it and/or modify
17 //      it under the terms of the GNU General Public License as published by
18 //      the Free Software Foundation; only version 2 of the License.
19 //
20 //      This program is distributed in the hope that it will be useful,
21 //      but WITHOUT ANY WARRANTY; without even the implied warranty of
22 //      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23 //      GNU General Public License for more details.
24 //
25 //      You should have received a copy of the GNU General Public License
26 //      along with this program; if not, write to the Free Software
27 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
28 //      02111-1307, USA.
29 //
30 
31 #ifndef __UNITSOUND_H__
32 #define __UNITSOUND_H__
33 
34 //@{
35 
36 /*----------------------------------------------------------------------------
37 --  Includes
38 ----------------------------------------------------------------------------*/
39 
40 #include "upgrade/upgrade_structs.h"
41 
42 /*----------------------------------------------------------------------------
43 --  Declarations
44 ----------------------------------------------------------------------------*/
45 
46 #define ANIMATIONS_DEATHTYPES 40
47 
48 class CSound;
49 
50 /**
51 **  Sound definition
52 */
53 class SoundConfig
54 {
55 public:
SoundConfig()56 	SoundConfig() : Sound(nullptr) {}
SoundConfig(std::string name)57 	SoundConfig(std::string name) : Name(name), Sound(nullptr) {}
58 
59 	bool MapSound();
60 	void SetSoundRange(unsigned char range);
61 
62 public:
63 	std::string Name;     /// config sound name
64 	CSound *Sound;        /// identifier send to sound server
65 };
66 
67 /**
68 **  The sounds of the units.
69 **
70 **  Played for the various events.
71 */
72 class CUnitSound
73 {
74 public:
75 	SoundConfig Selected;           /// selected by user
76 	SoundConfig Acknowledgement;    /// acknowledge of use command
77 	SoundConfig Attack;             /// attack confirm command
78 	//Wyrmgus start
79 	SoundConfig Idle;				/// idle
80 	SoundConfig Hit;				/// hit another unit
81 	SoundConfig Miss;				/// attacked another unit, but missed
82 	SoundConfig FireMissile;		/// fire a missile at another unit
83 	SoundConfig Step;				/// stepped
84 	SoundConfig StepDirt;			/// stepped on dirt
85 	SoundConfig StepGrass;			/// stepped on grass
86 	SoundConfig StepGravel;			/// stepped on gravel
87 	SoundConfig StepMud;			/// stepped on mud
88 	SoundConfig StepStone;			/// stepped on stone
89 	SoundConfig Used;				/// used (for items)
90 	//Wyrmgus end
91 	SoundConfig Build;              /// build confirm command
92 	SoundConfig Ready;              /// unit training... ready
93 	SoundConfig Repair;             /// unit repairing
94 	SoundConfig Harvest[MaxCosts];  /// unit harvesting
95 	SoundConfig Help;               /// unit is attacked
96 	//Wyrmgus start
97 	SoundConfig HelpTown;           /// building is attacked; used only for civilization unit sounds
98 	//Wyrmgus end
99 	SoundConfig Dead[ANIMATIONS_DEATHTYPES + 1];             /// unit is killed
100 };
101 
102 /*----------------------------------------------------------------------------
103 --  Variables
104 ----------------------------------------------------------------------------*/
105 
106 /*----------------------------------------------------------------------------
107 --  Functions
108 ----------------------------------------------------------------------------*/
109 
110 /**
111 **  Loads sounds defined in unitsound.c. Should be replaced by ccl loading of
112 **  sounds.
113 */
114 extern void LoadUnitSounds();
115 
116 /**
117 **  Performs the mapping between sound names and CSound* for each unit type.
118 **  Set ranges for some sounds (infinite range for acknowledge and help sounds).
119 */
120 extern void MapUnitSounds();
121 
122 //@}
123 
124 #endif // !__UNITSOUND_H__
125