From d6314f9564912393134d832b8cc268dd3dbfcbaa Mon Sep 17 00:00:00 2001 From: Filip Gawin Date: Sat, 18 Apr 2020 12:29:28 +0200 Subject: Revert "Part one" This reverts commit 63951d9b957b30a110f42a03edb4833cbbaf380e. --- src/audio/AudioManager.cpp | 2 +- src/audio/DMAudio.h | 1 - src/audio/sampman.cpp | 119 +++++++++++++++++++-------------------------- 3 files changed, 51 insertions(+), 71 deletions(-) (limited to 'src/audio') diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp index 0a156cd4..4d5f8474 100644 --- a/src/audio/AudioManager.cpp +++ b/src/audio/AudioManager.cpp @@ -10035,7 +10035,7 @@ cAudioManager::UpdateReflections() if(CWorld::ProcessVerticalLine( camPos, m_avecReflectionsPos[4].z, colpoint, ent, true, false, false, false, true, false, - nil)) { + false)) { m_afReflectionsDistances[4] = colpoint.point.z - camPos.z; } else { diff --git a/src/audio/DMAudio.h b/src/audio/DMAudio.h index 00bf75ad..9ce073b4 100644 --- a/src/audio/DMAudio.h +++ b/src/audio/DMAudio.h @@ -1,7 +1,6 @@ #pragma once #include "audio_enums.h" -#include "CrimeType.h" enum eSound : int16 { diff --git a/src/audio/sampman.cpp b/src/audio/sampman.cpp index a375b847..d24de27f 100644 --- a/src/audio/sampman.cpp +++ b/src/audio/sampman.cpp @@ -1986,59 +1986,50 @@ cSampleManager::StartStreamedFile(uint8 nFile, uint32 nPos, uint8 nStream) if ( nFile == STREAMED_SOUND_RADIO_MP3_PLAYER ) { uint32 i = 0; - do { - if(i != 0 || _bIsMp3Active) { - if(++_CurMP3Index >= nNumMP3s) _CurMP3Index = 0; - - _CurMP3Pos = 0; - - tMP3Entry *mp3 = _GetMP3EntryByIndex(_CurMP3Index); - - if(mp3) { - mp3 = _pMP3List; - if(mp3 == NULL) { - _bIsMp3Active = false; - nFile = 0; - strcpy(filename, m_szCDRomRootPath); - strcat(filename, StreamedNameTable[nFile]); - - mp3Stream[nStream] = - AIL_open_stream(DIG, filename, 0); - if(mp3Stream[nStream]) { - AIL_set_stream_loop_count( - mp3Stream[nStream], 1); - AIL_set_stream_ms_position( - mp3Stream[nStream], position); - AIL_pause_stream(mp3Stream[nStream], - 0); - return true; - } - - return false; - } - } - - if(mp3->pLinkPath != NULL) - mp3Stream[nStream] = - AIL_open_stream(DIG, mp3->pLinkPath, 0); - else { - strcpy(filename, _mp3DirectoryPath); - strcat(filename, mp3->aFilename); - - mp3Stream[nStream] = - AIL_open_stream(DIG, filename, 0); - } - - if(mp3Stream[nStream]) { - AIL_set_stream_loop_count(mp3Stream[nStream], 1); - AIL_set_stream_ms_position(mp3Stream[nStream], 0); - AIL_pause_stream(mp3Stream[nStream], 0); - return true; + + if ( !_bIsMp3Active ) goto FIND_MP3TRACK; + + do + { + if ( ++_CurMP3Index >= nNumMP3s ) + _CurMP3Index = 0; + + _CurMP3Pos = 0; + + tMP3Entry *mp3 = _GetMP3EntryByIndex(_CurMP3Index); + + if ( mp3 ) + { + mp3 = _pMP3List; + if ( mp3 == NULL ) + { + _bIsMp3Active = false; + nFile = 0; + goto PLAY_STREAMEDTRACK; } - - _bIsMp3Active = false; - continue; } + + if ( mp3->pLinkPath != NULL ) + mp3Stream[nStream] = AIL_open_stream(DIG, mp3->pLinkPath, 0); + else + { + strcpy(filename, _mp3DirectoryPath); + strcat(filename, mp3->aFilename); + + mp3Stream[nStream] = AIL_open_stream(DIG, filename, 0); + } + + if ( mp3Stream[nStream] ) + { + AIL_set_stream_loop_count(mp3Stream[nStream], 1); + AIL_set_stream_ms_position(mp3Stream[nStream], 0); + AIL_pause_stream(mp3Stream[nStream], 0); + return true; + } + + goto NEXT_MP3TRACK; + +FIND_MP3TRACK: if ( nPos > nStreamLength[STREAMED_SOUND_RADIO_MP3_PLAYER] ) position = 0; @@ -2048,23 +2039,10 @@ cSampleManager::StartStreamedFile(uint8 nFile, uint32 nPos, uint8 nStream) if ( e == NULL ) { nFile = 0; - strcpy(filename, m_szCDRomRootPath); - strcat(filename, StreamedNameTable[nFile]); - mp3Stream[nStream] = - AIL_open_stream(DIG, filename, 0); - if(mp3Stream[nStream]) { - AIL_set_stream_loop_count( - mp3Stream[nStream], 1); - AIL_set_stream_ms_position( - mp3Stream[nStream], position); - AIL_pause_stream(mp3Stream[nStream], 0); - return true; - } - - return false; + goto PLAY_STREAMEDTRACK; } } - + if ( e->pLinkPath != NULL ) mp3Stream[nStream] = AIL_open_stream(DIG, e->pLinkPath, 0); else @@ -2086,14 +2064,17 @@ cSampleManager::StartStreamedFile(uint8 nFile, uint32 nPos, uint8 nStream) return true; } +NEXT_MP3TRACK: _bIsMp3Active = false; - - } while(++i < nNumMP3s); - + + } while ( ++i < nNumMP3s ); + position = 0; nFile = 0; + goto PLAY_STREAMEDTRACK; } +PLAY_STREAMEDTRACK: strcpy(filename, m_szCDRomRootPath); strcat(filename, StreamedNameTable[nFile]); -- cgit v1.2.3