____ _ __
/ __ )____ _____ | | / /___ ___________
/ __ / __ \/ ___/ | | /| / / __ `/ ___/ ___/
/ /_/ / /_/ (__ ) | |/ |/ / /_/ / / (__ )
/_____/\____/____/ |__/|__/\__,_/_/ /____/
A futuristic real-time strategy game.
This file is part of Bos Wars.
(C) Copyright 2001-2007 by the Bos Wars and Stratagus Project.
Distributed under the "GNU General Public License"00001 // ____ _ __ 00002 // / __ )____ _____ | | / /___ ___________ 00003 // / __ / __ \/ ___/ | | /| / / __ `/ ___/ ___/ 00004 // / /_/ / /_/ (__ ) | |/ |/ / /_/ / / (__ ) 00005 // /_____/\____/____/ |__/|__/\__,_/_/ /____/ 00006 // 00007 // A futuristic real-time strategy game. 00008 // This file is part of Bos Wars. 00009 // 00011 // 00012 // (c) Copyright 1999-2007 by Fabrice Rossi and Jimmy Salmon 00013 // 00014 // This program is free software; you can redistribute it and/or modify 00015 // it under the terms of the GNU General Public License as published by 00016 // the Free Software Foundation; only version 2 of the License. 00017 // 00018 // This program is distributed in the hope that it will be useful, 00019 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00020 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00021 // GNU General Public License for more details. 00022 // 00023 // You should have received a copy of the GNU General Public License 00024 // along with this program; if not, write to the Free Software 00025 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 00026 // 02111-1307, USA. 00027 // 00028 00030 00031 /*---------------------------------------------------------------------------- 00032 -- Include 00033 ----------------------------------------------------------------------------*/ 00034 00035 #include "stratagus.h" 00036 #include "sound.h" 00037 #include "sound_server.h" 00038 #include "unittype.h" 00039 #include "animation.h" 00040 00041 /*---------------------------------------------------------------------------- 00042 -- Functions 00043 ----------------------------------------------------------------------------*/ 00044 00048 void LoadUnitSounds(void) 00049 { 00050 } 00051 00055 static void MapAnimSounds2(CAnimation *anim) 00056 { 00057 while (anim) { 00058 if (anim->Type == AnimationSound) { 00059 anim->D.Sound.Sound = SoundForName(anim->D.Sound.Name); 00060 } else if (anim->Type == AnimationRandomSound) { 00061 for (int i = 0; i < anim->D.RandomSound.NumSounds; ++i) { 00062 anim->D.RandomSound.Sound[i] = SoundForName(anim->D.RandomSound.Name[i]); 00063 } 00064 } 00065 anim = anim->Next; 00066 } 00067 } 00068 00072 static void MapAnimSounds(CUnitType *type) 00073 { 00074 if (!type->Animations) { 00075 return; 00076 } 00077 00078 MapAnimSounds2(type->Animations->Start); 00079 MapAnimSounds2(type->Animations->Still); 00080 MapAnimSounds2(type->Animations->Death); 00081 MapAnimSounds2(type->Animations->Attack); 00082 MapAnimSounds2(type->Animations->Move); 00083 MapAnimSounds2(type->Animations->Repair); 00084 MapAnimSounds2(type->Animations->Train); 00085 MapAnimSounds2(type->Animations->Harvest); 00086 } 00087 00093 void MapUnitSounds(void) 00094 { 00095 if (SoundEnabled()) { 00096 // 00097 // Parse all units sounds. 00098 // 00099 for (size_t i = 0; i < UnitTypes.size(); ++i) { 00100 CUnitType *type = UnitTypes[i]; 00101 00102 MapAnimSounds(type); 00103 00104 if (!type->Sound.Selected.Name.empty()) { 00105 type->Sound.Selected.Sound = 00106 SoundForName(type->Sound.Selected.Name); 00107 } 00108 if (!type->Sound.Acknowledgement.Name.empty()) { 00109 type->Sound.Acknowledgement.Sound = 00110 SoundForName(type->Sound.Acknowledgement.Name); 00111 /* 00112 // Acknowledge sounds have infinite range 00113 SetSoundRange(type->Sound.Acknowledgement.Sound, 00114 INFINITE_SOUND_RANGE); 00115 */ 00116 } 00117 if (!type->Sound.Ready.Name.empty()) { 00118 type->Sound.Ready.Sound = 00119 SoundForName(type->Sound.Ready.Name); 00120 // Ready sounds have infinite range 00121 SetSoundRange(type->Sound.Ready.Sound, 00122 INFINITE_SOUND_RANGE); 00123 } 00124 if (!type->Sound.Repair.Name.empty()) { 00125 type->Sound.Repair.Sound = 00126 SoundForName(type->Sound.Repair.Name); 00127 } 00128 if (!type->Sound.Harvest.Name.empty()) { 00129 type->Sound.Harvest.Sound = 00130 SoundForName(type->Sound.Harvest.Name); 00131 } 00132 if (!type->Sound.Help.Name.empty()) { 00133 type->Sound.Help.Sound = 00134 SoundForName(type->Sound.Help.Name); 00135 // Help sounds have infinite range 00136 SetSoundRange(type->Sound.Help.Sound, 00137 INFINITE_SOUND_RANGE); 00138 } 00139 if (!type->Sound.Dead.Name.empty()) { 00140 type->Sound.Dead.Sound = 00141 SoundForName(type->Sound.Dead.Name); 00142 } 00143 } 00144 } 00145 } 00146
1.5.6