Revision: 2427 http://rigsofrods.svn.sourceforge.net/rigsofrods/?rev=2427&view=rev Author: rorthomas Date: 2012-02-02 02:36:56 +0000 (Thu, 02 Feb 2012) Log Message: ----------- soundsources3 sounds for commands
Modified Paths: -------------- trunk/source/main/audio/SoundScriptManager.cpp trunk/source/main/audio/SoundScriptManager.h trunk/source/main/gameplay/RoRFrameListener.cpp trunk/source/main/physics/Beam.cpp trunk/source/main/physics/BeamData.h trunk/source/main/physics/BeamForcesEuler.cpp trunk/source/main/physics/input_output/SerializedRig.cpp Modified: trunk/source/main/audio/SoundScriptManager.cpp =================================================================== --- trunk/source/main/audio/SoundScriptManager.cpp 2012-02-01 22:27:51 UTC (rev 2426) +++ trunk/source/main/audio/SoundScriptManager.cpp 2012-02-02 02:36:56 UTC (rev 2427) @@ -44,7 +44,10 @@ free_pitches[i]=0; free_gains[i]=0; } - for (int i=0; i<SS_MAX_TRIG*(MAX_TRUCKS+2); i++) statemap[i]=false; + + // reset all states + statemap.clear(); + sm=new SoundManager(); //we can give a device name if we want here LOG("SoundScriptManager: Sound Manager started with "+TOSTRING(sm->getNumHardwareSources())+" sources"); mScriptPatterns.push_back("*.soundscript"); @@ -53,98 +56,107 @@ soundsDisabled = (SSETTING("3D Sound renderer", "Default") == "No sound"); } -void SoundScriptManager::trigOnce(Beam *truck, int trig) +void SoundScriptManager::trigOnce(Beam *truck, int trig, int linkType, int linkItemID) { if(soundsDisabled) return; - if(truck) trigOnce(truck->trucknum, trig); + if(truck) trigOnce(truck->trucknum, trig, linkType, linkItemID); } -void SoundScriptManager::trigOnce(int truck, int trig) +void SoundScriptManager::trigOnce(int truck, int trig, int linkType, int linkItemID) { if(soundsDisabled) return; for (int i=0; i<free_trigs[trig]; i++) { SoundScriptInstance* inst=trigs[trig+i*SS_MAX_TRIG]; - if (inst->truck==truck) inst->runOnce(); + if (inst->truck == truck && inst->soundLinkType == linkType && inst->soundLinkItemId == linkItemID) + inst->runOnce(); } } -void SoundScriptManager::trigStart(Beam *truck, int trig) +void SoundScriptManager::trigStart(Beam *truck, int trig, int linkType, int linkItemID) { if(soundsDisabled) return; - if(truck) trigStart(truck->trucknum, trig); + if(truck) trigStart(truck->trucknum, trig, linkType, linkItemID); } -void SoundScriptManager::trigStart(int truck, int trig) +void SoundScriptManager::trigStart(int truck, int trig, int linkType, int linkItemID) { if(soundsDisabled) return; - if (getTrigState(truck, trig)) return; - statemap[truck*SS_MAX_TRIG+trig]=true; + if (getTrigState(truck, trig, linkType, linkItemID)) return; + + statemap[linkType][linkItemID][truck][trig] = true; + for (int i=0; i<free_trigs[trig]; i++) { SoundScriptInstance* inst=trigs[trig+i*SS_MAX_TRIG]; - if (inst->truck==truck) inst->start(); + if (inst->truck == truck && inst->soundLinkType == linkType && inst->soundLinkItemId == linkItemID) + inst->start(); } } -void SoundScriptManager::trigStop(Beam *truck, int trig) +void SoundScriptManager::trigStop(Beam *truck, int trig, int linkType, int linkItemID) { if(soundsDisabled) return; - if(truck) trigStop(truck->trucknum, trig); + if(truck) trigStop(truck->trucknum, trig, linkType, linkItemID); } -void SoundScriptManager::trigStop(int truck, int trig) +void SoundScriptManager::trigStop(int truck, int trig, int linkType, int linkItemID) { if(soundsDisabled) return; - if (!getTrigState(truck, trig)) return; - statemap[truck*SS_MAX_TRIG+trig]=false; + if (!getTrigState(truck, trig, linkType, linkItemID)) return; + + statemap[linkType][linkItemID][truck][trig] = false; + for (int i=0; i<free_trigs[trig]; i++) { SoundScriptInstance* inst=trigs[trig+i*SS_MAX_TRIG]; - if (inst->truck==truck) inst->stop(); + if (inst->truck == truck && inst->soundLinkType == linkType && inst->soundLinkItemId == linkItemID) + inst->stop(); } } -void SoundScriptManager::trigToggle(Beam *truck, int trig) +void SoundScriptManager::trigToggle(Beam *truck, int trig, int linkType, int linkItemID) { if(soundsDisabled) return; - if(truck) trigToggle(truck->trucknum, trig); + if(truck) trigToggle(truck->trucknum, trig, linkType, linkItemID); } -void SoundScriptManager::trigToggle(int truck, int trig) +void SoundScriptManager::trigToggle(int truck, int trig, int linkType, int linkItemID) { if(soundsDisabled) return; - if (getTrigState(truck, trig)) trigStop(truck, trig); - else trigStart(truck, trig); + if (getTrigState(truck, trig, linkType, linkItemID)) + trigStop(truck, trig, linkType, linkItemID); + else + trigStart(truck, trig, linkType, linkItemID); } -bool SoundScriptManager::getTrigState(Beam *truck, int trig) +bool SoundScriptManager::getTrigState(Beam *truck, int trig, int linkType, int linkItemID) { if(soundsDisabled) return false; - if(truck) return getTrigState(truck->trucknum, trig); + if(truck) return getTrigState(truck->trucknum, trig, linkType, linkItemID); return false; } -bool SoundScriptManager::getTrigState(int truck, int trig) +bool SoundScriptManager::getTrigState(int truck, int trig, int linkType, int linkItemID) { if(soundsDisabled) return false; - return statemap[truck*SS_MAX_TRIG+trig]; + return statemap[linkType][linkItemID][truck][trig]; } -void SoundScriptManager::modulate(Beam *truck, int mod, float value) +void SoundScriptManager::modulate(Beam *truck, int mod, float value, int linkType, int linkItemID) { if(soundsDisabled) return; - if(truck) modulate(truck->trucknum, mod, value); + if(truck) modulate(truck->trucknum, mod, value, linkType, linkItemID); } -void SoundScriptManager::modulate(int truck, int mod, float value) +void SoundScriptManager::modulate(int truck, int mod, float value, int linkType, int linkItemID) { if(soundsDisabled) return; for (int i=0; i<free_gains[mod]; i++) { SoundScriptInstance* inst=gains[mod+i*SS_MAX_MOD]; if(!inst) continue; - if (inst->truck==truck) + if (inst->truck == truck && inst->soundLinkType == linkType && inst->soundLinkItemId == linkItemID) { //this one requires modulation float gain=value*value*inst->templ->gain_square+value*inst->templ->gain_multiplier+inst->templ->gain_offset; @@ -157,7 +169,7 @@ { SoundScriptInstance* inst=pitches[mod+i*SS_MAX_MOD]; if(!inst) continue; - if (inst->truck==truck) + if (inst->truck == truck && inst->soundLinkType == linkType && inst->soundLinkItemId == linkItemID) { //this one requires modulation float pitch=value*value*inst->templ->pitch_square+value*inst->templ->pitch_multiplier+inst->templ->pitch_offset; @@ -234,7 +246,7 @@ LOG("SoundScriptManager: removed " + TOSTRING(counter) + " non-base templates"); } -SoundScriptInstance* SoundScriptManager::createInstance(Ogre::String templatename, int truck, Ogre::SceneNode *toAttach) +SoundScriptInstance* SoundScriptManager::createInstance(Ogre::String templatename, int truck, Ogre::SceneNode *toAttach, int soundLinkType, int soundLinkItemId) { //first, search template SoundScriptTemplate* templ=NULL; @@ -245,7 +257,7 @@ templ = templates[templatename]; if (templ->trigger_source==SS_TRIG_NONE) return NULL; //invalid template! //ok create instance - SoundScriptInstance* inst=new SoundScriptInstance(truck, templ, sm, templ->filename+"-"+TOSTRING(truck)+"-"+TOSTRING(instance_counter)); + SoundScriptInstance* inst=new SoundScriptInstance(truck, templ, sm, templ->filename+"-"+TOSTRING(truck)+"-"+TOSTRING(instance_counter), soundLinkType, soundLinkItemId); instance_counter++; //register to lookup tables trigs[templ->trigger_source+free_trigs[templ->trigger_source]*SS_MAX_TRIG]=inst; @@ -445,6 +457,12 @@ if (vec[1]==String("ignition")) {trigger_source=SS_TRIG_IGNITION;return true;}; if (vec[1]==String("reverse_gear")) {trigger_source=SS_TRIG_REVERSE_GEAR;return true;}; if (vec[1]==String("turn_signal")) {trigger_source=SS_TRIG_TURN_SIGNAL;return true;}; + if (vec[1]==String("turn_signal_tick")) {trigger_source=SS_TRIG_TURN_SIGNAL_TICK;return true;}; + if (vec[1]==String("turn_signal_warn_tick")) {trigger_source=SS_TRIG_TURN_SIGNAL_WARN_TICK;return true;}; + if (vec[1]==String("linked_command")) {trigger_source=SS_LINKED_COMMAND;return true;}; + + + return false; } if (vec[0]==String("pitch_source")) @@ -537,25 +555,29 @@ if (str==String("aeroengine8_throttle")) return SS_MOD_THROTTLE8; if (str==String("air_speed_knots")) return SS_MOD_AIRSPEED; if (str==String("angle_of_attack_degree")) return SS_MOD_AOA; + + if (str==String("linked_command_rate")) return SS_MOD_LINKED_COMMANDRATE; return -1; } //==================================================================== -SoundScriptInstance::SoundScriptInstance(int truck, SoundScriptTemplate *templ, SoundManager* sm, String instancename) +SoundScriptInstance::SoundScriptInstance(int truck, SoundScriptTemplate *templ, SoundManager* sm, String instancename, int soundLinkType, int soundLinkItemId) : + truck(truck) + , templ(templ) + , sm(sm) + , soundLinkType(soundLinkType) + , soundLinkItemId(soundLinkItemId) + , startSound(nullptr) + , stopSound(nullptr) { - this->templ=templ; - this->truck=truck; - this->sm=sm; - startSound=NULL; - stopSound=NULL; //create sounds if (templ->has_start_sound) - startSound=sm->createSound(templ->start_sound_name); + startSound = sm->createSound(templ->start_sound_name); if (templ->has_stop_sound) - stopSound=sm->createSound(templ->stop_sound_name); + stopSound = sm->createSound(templ->stop_sound_name); for (int i=0; i<templ->free_sound; i++) - sounds[i]=sm->createSound(templ->sound_names[i]); + sounds[i] = sm->createSound(templ->sound_names[i]); lastgain=1.0; setPitch(0.0); setGain(1.0); Modified: trunk/source/main/audio/SoundScriptManager.h =================================================================== --- trunk/source/main/audio/SoundScriptManager.h 2012-02-01 22:27:51 UTC (rev 2426) +++ trunk/source/main/audio/SoundScriptManager.h 2012-02-02 02:36:56 UTC (rev 2427) @@ -34,6 +34,7 @@ // TODO: fix this fugly defines into a proper enum #define MAX_SOUNDS_PER_SCRIPT 16 #define MAX_INSTANCES_PER_GROUP 256 +#define MAX_SOUNDLINK_ITEM 64 #define PITCHDOWN_FADE_FACTOR 3.0 #define PITCHDOWN_CUTOFF_FACTOR 5.0 @@ -85,6 +86,8 @@ SS_TRIG_IGNITION, SS_TRIG_REVERSE_GEAR, SS_TRIG_TURN_SIGNAL, + SS_TRIG_TURN_SIGNAL_TICK, + SS_TRIG_TURN_SIGNAL_WARN_TICK, SS_TRIG_ALB_ACTIVE, SS_TRIG_TC_ACTIVE, SS_TRIG_AVICHAT01, @@ -100,6 +103,7 @@ SS_TRIG_AVICHAT11, SS_TRIG_AVICHAT12, SS_TRIG_AVICHAT13, + SS_LINKED_COMMAND, SS_MAX_TRIG }; @@ -134,9 +138,25 @@ SS_MOD_AEROENGINE8, SS_MOD_AIRSPEED, SS_MOD_AOA, + SS_MOD_LINKED_COMMANDRATE, SS_MAX_MOD }; +enum {SL_DEFAULT, + SL_COMMAND, + SL_HYDRO, + SL_COLLISION, + SL_SHOCKS, + SL_BRAKES, + SL_ROPES, + SL_TIES, + SL_PARTICLES, + SL_AXLES, + SL_FLARES, + SL_FLEXBODIES, + SL_EXHAUSTS, + SL_VIDEOCAMERA, + SL_MAX}; class SoundScriptTemplate { @@ -175,14 +195,17 @@ class SoundScriptInstance { public: - SoundScriptInstance(int truck, SoundScriptTemplate* templ, SoundManager* sm, Ogre::String instancename); + SoundScriptInstance(int truck, SoundScriptTemplate* templ, SoundManager* sm, Ogre::String instancename, int soundLinkType=SL_DEFAULT, int soundLinkItemId=-1); void setPitch(float value); void setGain(float value); void setPosition(Ogre::Vector3 pos, Ogre::Vector3 velocity); void runOnce(); void start(); void stop(); - int truck; // TODO: remove this + + int truck; // holds the number of the truck this is for. important + int soundLinkType; // holds the SL_ type this is bound to + int soundLinkItemId; // holds the item number this is for void setEnabled(bool e); SoundScriptTemplate* templ; @@ -211,24 +234,26 @@ void parseScript(DataStreamPtr& stream, const Ogre::String& groupName); Real getLoadingOrder(void) const; - SoundScriptInstance* createInstance(Ogre::String templatename, int truck, SceneNode *toAttach); + SoundScriptInstance* createInstance(Ogre::String templatename, int truck, SceneNode *toAttach=NULL, int soundLinkType=SL_DEFAULT, int soundLinkItemId=-1); void unloadResourceGroup(Ogre::String groupname); void clearNonBaseTemplates(); - // values update - void trigOnce (int truck, int trig); - void trigOnce (Beam *b, int trig); - void trigStart (int truck, int trig); - void trigStart (Beam *b, int trig); - void trigStop (int truck, int trig); - void trigStop (Beam *b, int trig); - void trigToggle (int truck, int trig); - void trigToggle (Beam *b, int trig); - bool getTrigState(int truck, int trig); - bool getTrigState(Beam *b, int trig); - void modulate (int truck, int mod, float value); - void modulate (Beam *b, int mod, float value); + + // functions + void trigOnce (int truck, int trig, int linkType = SL_DEFAULT, int linkItemID=-1); + void trigOnce (Beam *b, int trig, int linkType = SL_DEFAULT, int linkItemID=-1); + void trigStart (int truck, int trig, int linkType = SL_DEFAULT, int linkItemID=-1); + void trigStart (Beam *b, int trig, int linkType = SL_DEFAULT, int linkItemID=-1); + void trigStop (int truck, int trig, int linkType = SL_DEFAULT, int linkItemID=-1); + void trigStop (Beam *b, int trig, int linkType = SL_DEFAULT, int linkItemID=-1); + void trigToggle (int truck, int trig, int linkType = SL_DEFAULT, int linkItemID=-1); + void trigToggle (Beam *b, int trig, int linkType = SL_DEFAULT, int linkItemID=-1); + bool getTrigState(int truck, int trig, int linkType = SL_DEFAULT, int linkItemID=-1); + bool getTrigState(Beam *b, int trig, int linkType = SL_DEFAULT, int linkItemID=-1); + void modulate (int truck, int mod, float value, int linkType = SL_DEFAULT, int linkItemID=-1); + void modulate (Beam *b, int mod, float value, int linkType = SL_DEFAULT, int linkItemID=-1); + void soundEnable(bool state); void setCamera(Ogre::Vector3 position, Ogre::Vector3 direction, Ogre::Vector3 up, Ogre::Vector3 velocity); @@ -262,7 +287,9 @@ SoundScriptInstance *gains[SS_MAX_MOD * MAX_INSTANCES_PER_GROUP]; //state map - bool statemap[SS_MAX_TRIG * (MAX_TRUCKS + 2)]; + // TODO: replace with STL container to save memory + // soundLinks, soundItems, trucks, triggers + std::map <int, std::map <int, std::map <int, std::map <int, bool > > > > statemap; SoundManager* sm; }; Modified: trunk/source/main/gameplay/RoRFrameListener.cpp =================================================================== --- trunk/source/main/gameplay/RoRFrameListener.cpp 2012-02-01 22:27:51 UTC (rev 2426) +++ trunk/source/main/gameplay/RoRFrameListener.cpp 2012-02-02 02:36:56 UTC (rev 2427) @@ -2232,11 +2232,26 @@ // -- available, so why should we iterate till MAX_COMMANDS? for (i=1; i<=MAX_COMMANDS; i++) { - curr_truck->commandkey[i].commandValue=0; + float oldVal = curr_truck->commandkey[i].commandValue; + + curr_truck->commandkey[i].commandValue = 0; int eventID = EV_COMMANDS_01 + (i - 1); float tmp = INPUTENGINE.getEventValue(eventID); if(tmp > 0.0) + { curr_truck->commandkey[i].commandValue = tmp; + } + + if(tmp > 0.01f && oldVal < 0.01f) + { + // just started + curr_truck->commandkey[i].commandValueState = 1; + } else if(tmp < 0.01f && oldVal > 0.01f) + { + // just stopped + curr_truck->commandkey[i].commandValueState = -1; + } + } // replay mode Modified: trunk/source/main/physics/Beam.cpp =================================================================== --- trunk/source/main/physics/Beam.cpp 2012-02-01 22:27:51 UTC (rev 2426) +++ trunk/source/main/physics/Beam.cpp 2012-02-02 02:36:56 UTC (rev 2427) @@ -1449,6 +1449,14 @@ } } + + // linked sounds + for(int i=0; i<free_commands; i++) + { + addSoundSource(SoundScriptManager::getSingleton().createInstance(String("tracks/linked/default_command/extend"), trucknum, NULL, SL_COMMAND, i), 0); + addSoundSource(SoundScriptManager::getSingleton().createInstance(String("tracks/linked/default_command/retract"), trucknum, NULL, SL_COMMAND, -i), 0); + } + #endif //OPENAL } @@ -3700,10 +3708,30 @@ // apply blinking isvisible = isvisible && flares[i].blinkdelay_state; - if (flares[i].type == 'l' && blinkingtype == BLINK_LEFT) left_blink_on = isvisible; - else if(flares[i].type == 'r' && blinkingtype == BLINK_RIGHT) right_blink_on = isvisible; - else if(flares[i].type == 'l' && blinkingtype == BLINK_WARN) warn_blink_on = isvisible; + if (flares[i].type == 'l' && blinkingtype == BLINK_LEFT) + { + left_blink_on = isvisible; +#ifdef USE_OPENAL + if(left_blink_on) + SoundScriptManager::getSingleton().trigOnce(trucknum, SS_TRIG_TURN_SIGNAL_TICK); +#endif //USE_OPENAL + } else if(flares[i].type == 'r' && blinkingtype == BLINK_RIGHT) + { + right_blink_on = isvisible; +#ifdef USE_OPENAL + if(right_blink_on) + SoundScriptManager::getSingleton().trigOnce(trucknum, SS_TRIG_TURN_SIGNAL_TICK); +#endif //USE_OPENAL + } else if(flares[i].type == 'l' && blinkingtype == BLINK_WARN) + { + warn_blink_on = isvisible; +#ifdef USE_OPENAL + if(warn_blink_on) + SoundScriptManager::getSingleton().trigOnce(trucknum, SS_TRIG_TURN_SIGNAL_WARN_TICK); +#endif //USE_OPENAL + } + //left_blink_on, right_blink_on, warn_blink_on; // update material Bindings materialFunctionMapper->toggleFunction(i, isvisible); Modified: trunk/source/main/physics/BeamData.h =================================================================== --- trunk/source/main/physics/BeamData.h 2012-02-01 22:27:51 UTC (rev 2426) +++ trunk/source/main/physics/BeamData.h 2012-02-02 02:36:56 UTC (rev 2427) @@ -136,6 +136,7 @@ BTS_MATERIALFLAREBINDINGS, BTS_SOUNDSOURCES, BTS_SOUNDSOURCES2, + BTS_SOUNDSOURCES3, BTS_ENVMAP, BTS_MANAGEDMATERIALS, BTS_SECTIONCONFIG, @@ -635,6 +636,7 @@ struct command { float commandValue; + int commandValueState; bool trigger_cmdkeyblock_state; //identifies blocked F-commands for triggers std::vector<int> beams; std::vector<int> rotators; Modified: trunk/source/main/physics/BeamForcesEuler.cpp =================================================================== --- trunk/source/main/physics/BeamForcesEuler.cpp 2012-02-01 22:27:51 UTC (rev 2426) +++ trunk/source/main/physics/BeamForcesEuler.cpp 2012-02-02 02:36:56 UTC (rev 2427) @@ -1841,7 +1841,10 @@ if(beams[bbeam_abs].isforcerestricted && crankfactor > 1) crankfactor=1; - float v = commandkey[i].commandValue; + float v = commandkey[i].commandValue; + int &vst = commandkey[i].commandValueState; + + /* if(i==1) LOG(TOSTRING(v) + "/" + TOSTRING(beams[bbeam].autoMovingMode)); @@ -1941,6 +1944,26 @@ if(!canwork) continue; +#ifdef USE_OPENAL + // command sounds + if(vst == 1) + { + // just started + SoundScriptManager::getSingleton().trigStart(trucknum, SS_LINKED_COMMAND, SL_COMMAND, i); + vst = 0; + + } else if(vst == -1) + { + // just stopped + SoundScriptManager::getSingleton().trigStop(trucknum, SS_LINKED_COMMAND, SL_COMMAND, i); + vst = 0; + } else if (vst == 0) + { + // already running, modulate + SoundScriptManager::getSingleton().modulate(trucknum, SS_MOD_LINKED_COMMANDRATE, v, SL_COMMAND, i); + } +#endif // USE_OPENAL + beams[bbeam].L *= (1.0 + beams[bbeam].commandRatioLong * v * crankfactor * dt / beams[bbeam].L); dl=fabs(dl-beams[bbeam].L); if(v>0.5) @@ -2015,6 +2038,26 @@ if(!canwork) continue; +#ifdef USE_OPENAL + // command sounds + if(vst == 1) + { + // just started + SoundScriptManager::getSingleton().trigStart(trucknum, SS_LINKED_COMMAND, SL_COMMAND, -i); + vst = 0; + + } else if(vst == -1) + { + // just stopped + SoundScriptManager::getSingleton().trigStop(trucknum, SS_LINKED_COMMAND, SL_COMMAND, -i); + vst = 0; + } else if (vst == 0) + { + // already running, modulate + SoundScriptManager::getSingleton().modulate(trucknum, SS_LINKED_COMMAND, v, SL_COMMAND, -i); + } +#endif // USE_OPENAL + beams[bbeam].L *= (1.0 - beams[bbeam].commandRatioShort * v * crankfactor * dt / beams[bbeam].L); dl=fabs(dl-beams[bbeam].L); if(v>0.5) Modified: trunk/source/main/physics/input_output/SerializedRig.cpp =================================================================== --- trunk/source/main/physics/input_output/SerializedRig.cpp 2012-02-01 22:27:51 UTC (rev 2426) +++ trunk/source/main/physics/input_output/SerializedRig.cpp 2012-02-02 02:36:56 UTC (rev 2427) @@ -100,6 +100,7 @@ {BTS_MATERIALFLAREBINDINGS, "materialflarebindings", false}, {BTS_SOUNDSOURCES, "soundsources", false}, {BTS_SOUNDSOURCES2, "soundsources2", false}, + {BTS_SOUNDSOURCES3, "soundsources3", false}, {BTS_ENVMAP, "envmap", false}, {BTS_MANAGEDMATERIALS, "managedmaterials", false}, {BTS_SECTIONCONFIG, "BTS_SECTIONCONFIG", false}, @@ -4491,7 +4492,7 @@ strncpy(script, args[1].c_str(), 255); #ifdef USE_OPENAL - addSoundSource(SoundScriptManager::getSingleton().createInstance(script, trucknum, NULL), ref, -2, &c); + addSoundSource(SoundScriptManager::getSingleton().createInstance(script, trucknum), ref, -2, &c); #endif //OPENAL } else if (c.mode == BTS_SOUNDSOURCES2) @@ -4504,10 +4505,39 @@ type = PARSEINT(args[1]); strncpy(script, args[2].c_str(), 255); - #ifdef USE_OPENAL - addSoundSource(SoundScriptManager::getSingleton().createInstance(script, trucknum, NULL), ref, type, &c); - #endif //OPENAL +#ifdef USE_OPENAL + addSoundSource(SoundScriptManager::getSingleton().createInstance(script, trucknum), ref, type, &c); +#endif //OPENAL } + else if (c.mode == BTS_SOUNDSOURCES3) + { + //parse soundsources3 + int ref, mode, itemNum; + char script[256]; + int n = parse_args(c, args, 5); + ref = PARSEINT(args[0]); // DO NOT check nodes here, they may come afterwards + mode = PARSEINT(args[1]); + int slType = SL_DEFAULT; + if (args[2] == "command") slType = SL_COMMAND; + else if(args[2] == "hydro") slType = SL_HYDRO; + else if(args[2] == "collision") slType = SL_COLLISION; + else if(args[2] == "shock") slType = SL_SHOCKS; + else if(args[2] == "brake") slType = SL_BRAKES; + else if(args[2] == "rope") slType = SL_ROPES; + else if(args[2] == "tie") slType = SL_TIES; + else if(args[2] == "particle") slType = SL_PARTICLES; + else if(args[2] == "axle") slType = SL_AXLES; + else if(args[2] == "flare") slType = SL_FLARES; + else if(args[2] == "flexbody") slType = SL_FLEXBODIES; + else if(args[2] == "exhaust") slType = SL_EXHAUSTS; + else if(args[2] == "videocamera") slType = SL_VIDEOCAMERA; + + itemNum = PARSEINT(args[3]); + strncpy(script, args[4].c_str(), 255); +#ifdef USE_OPENAL + addSoundSource(SoundScriptManager::getSingleton().createInstance(script, trucknum, NULL, slType, itemNum), ref, mode, &c); +#endif //OPENAL + } else if (c.mode == BTS_ENVMAP) { // parse envmap This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d _______________________________________________ Rigsofrods-devel mailing list Rigsofrods-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rigsofrods-devel