- Timestamp:
- Jun 5, 2008, 10:59:49 AM (16 years ago)
- Location:
- code/branches
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/camera/bin/levels/sample.oxw
r1201 r1541 10 10 11 11 <Ambient colourvalue="1,1,1" /> 12 <Skybox src="Orxonox/Star SkyBox" />12 <Skybox src="Orxonox/StarfieldSkyBox" /> 13 13 <SpaceShip camera="true" position="0,0,0" scale="10" yawpitchroll="-90,-90,0" mesh="assf3.mesh" maxSpeed="500" maxSideAndBackSpeed="50" maxRotation="1.0" transAcc="200" rotAcc="3.0" transDamp="75" rotDamp="1.0" /> 14 14 -
code/branches/input/bin/plugins.cfg-init
r1505 r1541 2 2 3 3 # Define plugin folder 4 PluginFolder=/usr/l ib/OGRE4 PluginFolder=/usr/local/lib/OGRE 5 5 6 6 # Define plugins -
code/branches/network/bin/plugins.cfg-init
r1505 r1541 2 2 3 3 # Define plugin folder 4 PluginFolder=/usr/l ib/OGRE4 PluginFolder=/usr/local/lib/OGRE 5 5 6 6 # Define plugins -
code/branches/script_trigger/bin/levels/sample.oxw
r1383 r1541 1 <!--audio>1 <AudioManager> 2 2 <ambient> 3 3 <ogg src="allgorythm-lift_up" /> … … 7 7 <ogg src="tha_silent_partner_-_void" /> 8 8 </ambient> 9 </audio-->9 </AudioManager> 10 10 11 11 <!--Ambient colourvalue="1,1,1" /--> -
code/branches/script_trigger/src/audio/AudioManager.cc
r1089 r1541 39 39 namespace audio 40 40 { 41 42 41 AudioManager::AudioManager() 42 { 43 43 ambientPath = "audio/ambient"; 44 44 45 45 alutInit(NULL, 0); 46 } 46 47 48 AudioManager::~AudioManager() 49 { 50 for (unsigned int i=0;i<bgSounds.size();i++) 51 { 52 bgSounds[i]->release(); 53 } 54 alutExit(); 55 } 47 56 48 } 57 void AudioManager::ambientStart() 58 { 59 // currentBgSound = 0; 60 if (bgSounds.size() > 0) 61 { 62 currentBgSound = rand() % bgSounds.size(); 63 if(!bgSounds[currentBgSound]->playback()) 64 { 65 orxonox::Error("Ogg refused to play."); 66 } 67 else 68 { 69 COUT(3) << "Info: Started playing background sound" << std::endl; 70 } 71 } 72 } 49 73 50 AudioManager::~AudioManager() 51 { 52 for (unsigned int i=0;i<bgSounds.size();i++) 53 { 54 bgSounds[i]->release(); 55 } 56 alutExit(); 57 } 74 void AudioManager::ambientStop() 75 { 76 COUT(3) << "Info: Stopped playing background sound" << std::endl; 77 } 58 78 59 void AudioManager::ambientStart() 60 { 61 // currentBgSound = 0; 62 if (bgSounds.size() > 0) 63 { 64 currentBgSound = rand() % bgSounds.size(); 65 if(!bgSounds[currentBgSound]->playback()) 66 { 67 orxonox::Error("Ogg refused to play."); 68 } 69 else 70 { 71 COUT(3) << "Info: Started playing background sound" << std::endl; 72 } 73 } 74 } 79 void AudioManager::ambientAdd(std::string file) 80 { 81 std::string path = ambientPath + "/" + file + ".ogg"; 82 AudioStream* tmp = new AudioStream(path); 83 tmp->open(); 84 if (tmp->isLoaded()) 85 { 86 bgSounds.push_back(tmp); 87 COUT(3) << "Info: Added background sound " << file << std::endl; 88 } 89 } 75 90 76 void AudioManager::ambientStop() 77 { 78 COUT(3) << "Info: Stopped playing background sound" << std::endl; 79 } 80 81 void AudioManager::ambientAdd(std::string file) 82 { 83 std::string path = ambientPath + "/" + file + ".ogg"; 84 AudioStream* tmp = new AudioStream(path); 85 tmp->open(); 86 if (tmp->isLoaded()) 87 { 88 bgSounds.push_back(tmp); 89 COUT(3) << "Info: Added background sound " << file << std::endl; 90 } 91 } 92 93 void AudioManager::tick(float dt) 94 { 95 if (bgSounds.size() > 0) 96 { 97 if (bgSounds[currentBgSound]->isLoaded()) 98 { 99 bool playing = bgSounds[currentBgSound]->update(); 100 if(!bgSounds[currentBgSound]->playing() && playing) 101 { 102 if(!bgSounds[currentBgSound]->playback()) 103 orxonox::Error("Ogg abruptly stopped."); 104 else 105 orxonox::Error("Ogg stream was interrupted."); 106 107 } 108 if (!playing) 109 { 110 // if (currentBgSound < bgSounds.size()-1) 111 // { 112 // currentBgSound++; 113 // } 114 // else 115 // { 116 // currentBgSound=0; 117 // } 91 void AudioManager::tick(float dt) 92 { 93 if (bgSounds.size() > 0) 94 { 95 if (bgSounds[currentBgSound]->isLoaded()) 96 { 97 bool playing = bgSounds[currentBgSound]->update(); 98 if(!bgSounds[currentBgSound]->playing() && playing) 99 { 100 if(!bgSounds[currentBgSound]->playback()) 101 orxonox::Error("Ogg abruptly stopped."); 102 else 103 orxonox::Error("Ogg stream was interrupted."); 104 } 105 if (!playing) 106 { 107 // if (currentBgSound < bgSounds.size()-1) 108 // { 109 // currentBgSound++; 110 // } 111 // else 112 // { 113 // currentBgSound=0; 114 // } 118 115 // switch to next sound in list/array 119 116 currentBgSound = ++currentBgSound % bgSounds.size(); 120 117 121 122 123 124 125 126 127 128 129 130 131 118 if (!bgSounds[currentBgSound]->isLoaded()) 119 { 120 bgSounds[currentBgSound]->release(); 121 bgSounds[currentBgSound]->open(); 122 } 123 bgSounds[currentBgSound]->playback(); 124 COUT(3) << "Info: Playing next background sound" << std::endl; 125 } 126 } 127 } 128 } 132 129 133 void AudioManager::setPos(std::vector<float> newPosition) 134 { 130 void AudioManager::setPos(std::vector<float> newPosition) 131 { 132 } 135 133 136 } 134 void AudioManager::setSpeed(std::vector<float> newSpeed) 135 { 136 } 137 137 138 void AudioManager::setSpeed(std::vector<float> newSpeed) 139 { 138 void AudioManager::setOri(std::vector<float> at, std::vector<float> up) 139 { 140 } 140 141 141 }142 143 void AudioManager::setOri(std::vector<float> at, std::vector<float> up)144 {145 146 }147 142 } -
code/branches/script_trigger/src/core/ClassTreeMask.h
r1062 r1541 60 60 step back, and so on. 61 61 62 Example: A and B are childs of BaseObject, A1 and A2 are childs of A, B1 and B2 are childs of B.62 @example: A and B are childs of BaseObject, A1 and A2 are childs of A, B1 and B2 are childs of B. 63 63 The ClassTreeMaskIterator would move trough the tree in the following order: 64 64 BaseObject, A, A1, A2, B, B1, B2. -
code/branches/script_trigger/src/orxonox/objects/Trigger.cc
r1383 r1541 39 39 RegisterObject(Trigger); 40 40 41 targetMask_.exclude(Class(BaseObject)); 41 42 } 42 43 … … 47 48 bool Trigger::isTriggered() 48 49 { 49 return true; 50 return this->isTriggered(this->mode_); 51 } 52 53 bool Trigger::isTriggered(TriggerMode mode) 54 { 55 switch(mode) 56 { 57 case TM_EventTriggerAnd: 58 return checkAnd(); 59 break; 60 case TM_EventTriggerOr: 61 return checkOr(); 62 break; 63 case TM_DelayTrigger: 64 return checkDelay(); 65 break; 66 case TM_DistanceTrigger: 67 return checkDistance(); 68 break; 69 case TM_DistanceEventTriggerAnd: 70 if (checkDistance() && checkAnd()) 71 return true; 72 else 73 return false; 74 break; 75 case TM_DistanceEventTriggerOr: 76 if (checkDistance() && checkOr()) 77 return true; 78 else 79 return false; 80 break; 81 default: 82 return false; 83 break; 84 } 50 85 } 51 86 … … 56 91 } 57 92 93 void Trigger::addTargets(std::string targets) 94 { 95 Identifier* targetId = ID(targets); 96 targetMask_.include(targetId); 97 // trigger shouldn't react on itself or other triggers 98 targetMask_.exclude(Class(Trigger), true); 99 } 100 101 bool Trigger::checkAnd() 102 { 103 std::set<Trigger*>::iterator it; 104 for(it = this->triggers_.begin(); it != this->triggers_.end(); it++) 105 { 106 if(!((*it)->isTriggered())) 107 return false; 108 } 109 return true; 110 } 111 112 bool Trigger::checkOr() 113 { 114 std::set<Trigger*>::iterator it; 115 for(it = this->triggers_.begin(); it != this->triggers_.end(); it++) 116 { 117 if((*it)->isTriggered()) 118 return true; 119 } 120 return false; 121 } 122 123 bool Trigger::checkDelay() 124 { 125 if (triggingTime_ < actualTime_) 126 return true; 127 else 128 return false; 129 } 130 131 bool Trigger::checkDistance() 132 { 133 // Iterate through all WorldEntities 134 for(Iterator<WorldEntity> it = ObjectList<WorldEntity>::begin(); it; it++) 135 { 136 Vector3 distanceVec = it->getNode()->getWorldPosition() - this->getNode()->getWorldPosition(); 137 if (distanceVec.length() < radius_) 138 return true; 139 } 140 return false; 141 142 } 143 58 144 } -
code/branches/script_trigger/src/orxonox/objects/Trigger.h
r1383 r1541 30 30 #define _Trigger_H__ 31 31 32 #include < list>32 #include <set> 33 33 34 34 #include "OrxonoxPrereqs.h" … … 36 36 #include "WorldEntity.h" 37 37 #include "core/BaseObject.h" 38 #include "core/ClassTreeMask.h" 38 39 39 40 namespace orxonox { … … 56 57 57 58 bool isTriggered(); 59 bool isTriggered(TriggerMode mode); 58 60 void addTrigger(Trigger* trig); 61 void addTargets(std::string targets); 59 62 inline TriggerMode getMode() { return mode_; } 60 63 inline void setMode(TriggerMode mode) { this->mode_ = mode; } 64 inline void tick(float dt) { this->actualTime_ += dt; } 65 66 private: 67 bool checkAnd(); 68 bool checkOr(); 69 bool checkDelay(); 70 bool checkDistance(); 61 71 62 72 private: 63 73 std::set<Trigger*> triggers_; 64 74 TriggerMode mode_; 65 75 float triggingTime_; 76 float actualTime_; 77 float radius_; 78 ClassTreeMask targetMask_; 66 79 }; 67 80
Note: See TracChangeset
for help on using the changeset viewer.