/*********************************************************** directly synchronize value between physic and display ***********************************************************/ void WorldToDisplayObjectSynchronizer::StraightSync() { // get value from physic object float posX, posY, posZ; LbaQuaternion Quat; _phH->GetPosition(posX, posY, posZ); _phH->GetRotation(Quat); // for each value test if they are equal with display value //if not move display value to the correct value bool positionchanged = false; if(!equal(posX, _lastDisplayPositionX)) { positionchanged = true; _lastDisplayPositionX = posX; } if(!equal(posY, _lastDisplayPositionY)) { positionchanged = true; _lastDisplayPositionY = posY; } if(!equal(posZ, _lastDisplayPositionZ)) { positionchanged = true; _lastDisplayPositionZ = posZ; } // update displayed position if needed if(_disH && positionchanged) _disH->SetPosition(_lastDisplayPositionX, _lastDisplayPositionY, _lastDisplayPositionZ); // check rotations bool directionchanged = false; if( !equal(Quat.X, _lastDisplayRotation.X) || !equal(Quat.Y, _lastDisplayRotation.Y) || !equal(Quat.Z, _lastDisplayRotation.Z) || !equal(Quat.W, _lastDisplayRotation.W)) { directionchanged = true; _lastDisplayRotation = Quat; if(_disH) _disH->SetRotation(_lastDisplayRotation); } if(positionchanged || directionchanged) UpdateSoundPosition(); }
void PlayChannel (COUNT channel, PVOID sample, SoundPosition pos, void *positional_object, unsigned char priority) { TFB_SoundSample *tfb_sample = *(TFB_SoundSample**) sample; StopSource (channel); // all finished (stopped) channels can be cleaned up at this point // since this is the only func that can initiate an sfx sound CheckFinishedChannels (); soundSource[channel].sample = tfb_sample; soundSource[channel].positional_object = positional_object; if (optStereoSFX) UpdateSoundPosition (channel, pos); audio_Sourcei (soundSource[channel].handle, audio_BUFFER, tfb_sample->buffer[0]); audio_SourcePlay (soundSource[channel].handle); (void) priority; }