/** Loads all sound groups. ** Special groups are created. */ local void LoadSoundGroups(void) { int i; int nb; int nb_sounds; nb=sizeof(Acknowledgments)/sizeof(*Acknowledgments); DebugLevel3("Loading Acknowledgment Sound Groups (%d groups)\n",nb); for(i=0;i<nb;i++) { nb_sounds=NbSoundsInGroup(Acknowledgments[i].Sounds); DebugLevel3("Load group %s (%d sounds)\n",Acknowledgments[i].Name, nb_sounds); MakeSound(Acknowledgments[i].Name,Acknowledgments[i].Sounds, nb_sounds); } nb=sizeof(Selections)/sizeof(*Selections); DebugLevel3("Loading Selection Sound Groups (%d groups)\n",nb); for(i=0;i<nb;i++) { nb_sounds=NbSoundsInGroup(Selections[i].Sounds); DebugLevel3("Load group %s (%d sounds)\n",Selections[i].Name, nb_sounds); MakeSound(Selections[i].Name,Selections[i].Sounds,nb_sounds); } nb=sizeof(Annoyed)/sizeof(*Annoyed); DebugLevel3("Loading Annoyed Sound Groups (%d groups)\n",nb); for(i=0;i<nb;i++) { nb_sounds=NbSoundsInGroup(Annoyed[i].Sounds); DebugLevel3("Load group %s (%d sounds)\n",Annoyed[i].Name, nb_sounds); MakeSound(Annoyed[i].Name,Annoyed[i].Sounds,nb_sounds); } nb=sizeof(OtherGroups)/sizeof(*OtherGroups); DebugLevel3("Loading Other Sound Groups (%d groups)\n",nb); for(i=0;i<nb;i++) { nb_sounds=NbSoundsInGroup(OtherGroups[i].Sounds); DebugLevel3("Load group %s (%d sounds)\n",OtherGroups[i].Name, nb_sounds); MakeSound(OtherGroups[i].Name,OtherGroups[i].Sounds, nb_sounds); } nb=sizeof(SelectionGroups)/sizeof(*SelectionGroups); DebugLevel3("Making Special Sound Groups (%d groups)\n",nb); for(i=0;i<nb;i++) { //FIXME: might be more efficient DebugLevel3("Group %s (%s,%s)\n",SelectionGroups[i].Name, SelectionGroups[i].First,SelectionGroups[i].Second); MakeSoundGroup(SelectionGroups[i].Name, SoundIdForName(SelectionGroups[i].First), SoundIdForName(SelectionGroups[i].Second)); } }
/** Performs remaping listed in the Remaps array. Maps also critter sounds to ** their correct values. */ local void RemapSounds(void) { int i; int nb; nb=sizeof(Remaps)/sizeof(*Remaps); for(i=0;i<nb;i++) { //FIXME: should be more efficient MapSound(Remaps[i].NewName,SoundIdForName(Remaps[i].BaseName)); } // critter mapping switch( TheMap.Terrain ) { case TilesetSummer: MakeSoundGroup("critter-selected", SoundIdForName("sheep selected"), SoundIdForName("sheep annoyed")); break; case TilesetWinter: MakeSoundGroup("critter-selected", SoundIdForName("seal selected"), SoundIdForName("seal annoyed")); break; case TilesetWasteland: MakeSoundGroup("critter-selected", SoundIdForName("pig selected"), SoundIdForName("pig annoyed")); break; case TilesetSwamp: MakeSoundGroup("critter-selected", SoundIdForName("warthog selected"), SoundIdForName("warthog annoyed")); break; default: DebugLevel2("Unknown Terrain %d\n",TheMap.Terrain); } }
/** ** Glue between c and scheme. This function asks the sound system to ** build a special sound group. ** ** @param l Lua state. ** ** @return The sound id of the created sound */ static int CclMakeSoundGroup(lua_State *l) { CSound *id; std::string c_name; CSound *first; CSound *second; LuaUserData *data; LuaCheckArgs(l, 3); c_name = LuaToString(l, 1); lua_pushvalue(l, 2); first = CclGetSound(l); lua_pop(l, 1); second = CclGetSound(l); id = MakeSoundGroup(c_name, first, second); data = (LuaUserData *)lua_newuserdata(l, sizeof(LuaUserData)); data->Type = LuaSoundType; data->Data = id; return 1; }