[Gcblue-commits] gcb_wx/src/common simmath.cpp,1.19,1.20 tcOggStreamer.cpp,1.10,1.11
Status: Alpha
Brought to you by:
ddcforge
|
From: Dewitt C. <ddc...@us...> - 2004-12-05 02:49:59
|
Update of /cvsroot/gcblue/gcb_wx/src/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20399/src/common Modified Files: simmath.cpp tcOggStreamer.cpp Log Message: Sonar work, passive sonar, torpedoes Index: tcOggStreamer.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/tcOggStreamer.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** tcOggStreamer.cpp 14 Sep 2004 02:01:46 -0000 1.10 --- tcOggStreamer.cpp 5 Dec 2004 02:49:47 -0000 1.11 *************** *** 222,225 **** --- 222,234 ---- } + bool tcOggStreamer::IsPaused() + { + ALenum state; + + alGetSourcei(source, AL_SOURCE_STATE, &state); + + return (state == AL_PAUSED); + } + bool tcOggStreamer::IsPlaying() *************** *** 232,235 **** --- 241,253 ---- } + bool tcOggStreamer::IsStopped() + { + ALenum state; + + alGetSourcei(source, AL_SOURCE_STATE, &state); + + return (state == AL_STOPPED); + } + *************** *** 261,273 **** { bool active = true; ! int processed; ! if (paused) return true; // Ask OpenAL how many buffers it has managed to play back ! alGetSourcei(source, AL_BUFFERS_PROCESSED, &processed); ! nFreeBuffers += processed; if (nFreeBuffers > NUM_BUFFERS) --- 279,303 ---- { bool active = true; ! int nProcessed; ! int queued; ! if (paused) ! { ! return true; ! } + if (IsStopped()) + { + alSourcePlay(source); + #ifdef _DEBUG + fprintf(stderr, "tcOggStreamer::Update - Restarting source\n"); + #endif + } + alGetSourcei(source, AL_BUFFERS_QUEUED, &queued); // Ask OpenAL how many buffers it has managed to play back ! alGetSourcei(source, AL_BUFFERS_PROCESSED, &nProcessed); ! nFreeBuffers += nProcessed; if (nFreeBuffers > NUM_BUFFERS) *************** *** 291,296 **** while (active && nFreeBuffers) { ! alSourceUnqueueBuffers(source, 1, &buffers[bufferIndex]); ! //fill the buffer active = Stream(buffers[bufferIndex]); --- 321,330 ---- while (active && nFreeBuffers) { ! if (nProcessed) ! { ! alSourceUnqueueBuffers(source, 1, &buffers[bufferIndex]); ! nProcessed--; ! } ! Check(); //fill the buffer active = Stream(buffers[bufferIndex]); Index: simmath.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/simmath.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** simmath.cpp 14 Nov 2004 22:52:20 -0000 1.19 --- simmath.cpp 5 Dec 2004 02:49:47 -0000 1.20 *************** *** 384,388 **** td.mnAlliance = mnAlliance; td.mnClassification = mnClassification; ! if (td.mfAlt_m < 0) {td.mfAlt_m = 0;} } --- 384,388 ---- td.mnAlliance = mnAlliance; td.mnClassification = mnClassification; ! if ((mfAlt_m >= 0)&&(td.mfAlt_m < 0)) {td.mfAlt_m = 0;} } *************** *** 460,464 **** float v = C_KTSTOMPS*mfSpeed_kts; ! float vc = C_KTSTOMPS*mfSpeed_kts; float dvz = v*sinf(mfPitch_rad) - vc*sinf(collider.mfPitch_rad); float cospitch = cosf(mfPitch_rad); --- 460,464 ---- float v = C_KTSTOMPS*mfSpeed_kts; ! float vc = C_KTSTOMPS*collider.mfSpeed_kts; float dvz = v*sinf(mfPitch_rad) - vc*sinf(collider.mfPitch_rad); float cospitch = cosf(mfPitch_rad); *************** *** 467,470 **** --- 467,472 ---- float dvy = v*cospitch*cosf(mfHeading_rad) - vc*cospitchc*cosf(collider.mfHeading_rad); + wxASSERT(dvx*dvx + dvy*dvy + dvz*dvz != 0); + float tclosest = -(dx*dvx + dy*dvy + dz*dvz) / (dvx*dvx + dvy*dvy + dvz*dvz); |