diff --git a/desktop_version/src/BinaryBlob.h b/desktop_version/src/BinaryBlob.h index 41396c66..50137bbc 100644 --- a/desktop_version/src/BinaryBlob.h +++ b/desktop_version/src/BinaryBlob.h @@ -4,6 +4,24 @@ /* Laaaazyyyyyyy -flibit */ // #define VVV_COMPILEMUSIC +#define TRACK_NAMES \ + FOREACH_TRACK("data/music/0levelcomplete.ogg") \ + FOREACH_TRACK("data/music/1pushingonwards.ogg") \ + FOREACH_TRACK("data/music/2positiveforce.ogg") \ + FOREACH_TRACK("data/music/3potentialforanything.ogg") \ + FOREACH_TRACK("data/music/4passionforexploring.ogg") \ + FOREACH_TRACK("data/music/5intermission.ogg") \ + FOREACH_TRACK("data/music/6presentingvvvvvv.ogg") \ + FOREACH_TRACK("data/music/7gamecomplete.ogg") \ + FOREACH_TRACK("data/music/8predestinedfate.ogg") \ + FOREACH_TRACK("data/music/9positiveforcereversed.ogg") \ + FOREACH_TRACK("data/music/10popularpotpourri.ogg") \ + FOREACH_TRACK("data/music/11pipedream.ogg") \ + FOREACH_TRACK("data/music/12pressurecooker.ogg") \ + FOREACH_TRACK("data/music/13pacedenergy.ogg") \ + FOREACH_TRACK("data/music/14piercingthesky.ogg") \ + FOREACH_TRACK("data/music/predestinedfatefinallevel.ogg") + struct resourceheader { char name[48]; diff --git a/desktop_version/src/Music.cpp b/desktop_version/src/Music.cpp index 511a23ce..3a57a787 100644 --- a/desktop_version/src/Music.cpp +++ b/desktop_version/src/Music.cpp @@ -50,22 +50,9 @@ void musicclass::init() #ifdef VVV_COMPILEMUSIC binaryBlob musicWriteBlob; - musicWriteBlob.AddFileToBinaryBlob("data/music/0levelcomplete.ogg"); - musicWriteBlob.AddFileToBinaryBlob("data/music/1pushingonwards.ogg"); - musicWriteBlob.AddFileToBinaryBlob("data/music/2positiveforce.ogg"); - musicWriteBlob.AddFileToBinaryBlob("data/music/3potentialforanything.ogg"); - musicWriteBlob.AddFileToBinaryBlob("data/music/4passionforexploring.ogg"); - musicWriteBlob.AddFileToBinaryBlob("data/music/5intermission.ogg"); - musicWriteBlob.AddFileToBinaryBlob("data/music/6presentingvvvvvv.ogg"); - musicWriteBlob.AddFileToBinaryBlob("data/music/7gamecomplete.ogg"); - musicWriteBlob.AddFileToBinaryBlob("data/music/8predestinedfate.ogg"); - musicWriteBlob.AddFileToBinaryBlob("data/music/9positiveforcereversed.ogg"); - musicWriteBlob.AddFileToBinaryBlob("data/music/10popularpotpourri.ogg"); - musicWriteBlob.AddFileToBinaryBlob("data/music/11pipedream.ogg"); - musicWriteBlob.AddFileToBinaryBlob("data/music/12pressurecooker.ogg"); - musicWriteBlob.AddFileToBinaryBlob("data/music/13pacedenergy.ogg"); - musicWriteBlob.AddFileToBinaryBlob("data/music/14piercingthesky.ogg"); - musicWriteBlob.AddFileToBinaryBlob("data/music/predestinedfatefinallevel.ogg"); +#define FOREACH_TRACK(track_name) musicWriteBlob.AddFileToBinaryBlob(track_name); + TRACK_NAMES +#undef FOREACH_TRACK musicWriteBlob.writeBinaryBlob("data/BinaryMusic.vvv"); #endif @@ -81,137 +68,26 @@ void musicclass::init() { mmmmmm = true; usingmmmmmm = true; - int index = musicReadBlob.getIndex("data/music/0levelcomplete.ogg"); - SDL_RWops *rw = SDL_RWFromMem(musicReadBlob.getAddress(index), musicReadBlob.getSize(index)); - musicTracks.push_back(MusicTrack( rw )); + int index; + SDL_RWops *rw; - index = musicReadBlob.getIndex("data/music/1pushingonwards.ogg"); - rw = SDL_RWFromMem(musicReadBlob.getAddress(index), musicReadBlob.getSize(index)); - musicTracks.push_back(MusicTrack( rw )); +#define FOREACH_TRACK(track_name) \ + index = musicReadBlob.getIndex(track_name); \ + rw = SDL_RWFromMem(musicReadBlob.getAddress(index), musicReadBlob.getSize(index)); \ + musicTracks.push_back(MusicTrack( rw )); - index = musicReadBlob.getIndex("data/music/2positiveforce.ogg"); - rw = SDL_RWFromMem(musicReadBlob.getAddress(index), musicReadBlob.getSize(index)); - musicTracks.push_back(MusicTrack( rw )); - - index = musicReadBlob.getIndex("data/music/3potentialforanything.ogg"); - rw = SDL_RWFromMem(musicReadBlob.getAddress(index), musicReadBlob.getSize(index)); - musicTracks.push_back(MusicTrack( rw )); - - index = musicReadBlob.getIndex("data/music/4passionforexploring.ogg"); - rw = SDL_RWFromMem(musicReadBlob.getAddress(index), musicReadBlob.getSize(index)); - musicTracks.push_back(MusicTrack( rw )); - - index = musicReadBlob.getIndex("data/music/5intermission.ogg"); - rw = SDL_RWFromMem(musicReadBlob.getAddress(index), musicReadBlob.getSize(index)); - musicTracks.push_back(MusicTrack( rw )); - - index = musicReadBlob.getIndex("data/music/6presentingvvvvvv.ogg"); - rw = SDL_RWFromMem(musicReadBlob.getAddress(index), musicReadBlob.getSize(index)); - musicTracks.push_back(MusicTrack( rw )); - - index = musicReadBlob.getIndex("data/music/7gamecomplete.ogg"); - rw = SDL_RWFromMem(musicReadBlob.getAddress(index), musicReadBlob.getSize(index)); - musicTracks.push_back(MusicTrack( rw )); - - index = musicReadBlob.getIndex("data/music/8predestinedfate.ogg"); - rw = SDL_RWFromMem(musicReadBlob.getAddress(index), musicReadBlob.getSize(index)); - musicTracks.push_back(MusicTrack( rw )); - - index = musicReadBlob.getIndex("data/music/9positiveforcereversed.ogg"); - rw = SDL_RWFromMem(musicReadBlob.getAddress(index), musicReadBlob.getSize(index)); - musicTracks.push_back(MusicTrack( rw )); - - index = musicReadBlob.getIndex("data/music/10popularpotpourri.ogg"); - rw = SDL_RWFromMem(musicReadBlob.getAddress(index), musicReadBlob.getSize(index)); - musicTracks.push_back(MusicTrack( rw )); - - index = musicReadBlob.getIndex("data/music/11pipedream.ogg"); - rw = SDL_RWFromMem(musicReadBlob.getAddress(index), musicReadBlob.getSize(index)); - musicTracks.push_back(MusicTrack( rw )); - - index = musicReadBlob.getIndex("data/music/12pressurecooker.ogg"); - rw = SDL_RWFromMem(musicReadBlob.getAddress(index), musicReadBlob.getSize(index)); - musicTracks.push_back(MusicTrack( rw )); - - index = musicReadBlob.getIndex("data/music/13pacedenergy.ogg"); - rw = SDL_RWFromMem(musicReadBlob.getAddress(index), musicReadBlob.getSize(index)); - musicTracks.push_back(MusicTrack( rw )); - - index = musicReadBlob.getIndex("data/music/14piercingthesky.ogg"); - rw = SDL_RWFromMem(musicReadBlob.getAddress(index), musicReadBlob.getSize(index)); - musicTracks.push_back(MusicTrack( rw )); - - index = musicReadBlob.getIndex("data/music/predestinedfatefinallevel.ogg"); - rw = SDL_RWFromMem(musicReadBlob.getAddress(index), musicReadBlob.getSize(index)); - musicTracks.push_back(MusicTrack( rw )); + TRACK_NAMES bool ohCrap = musicReadBlob.unPackBinary("vvvvvvmusic.vvv"); SDL_assert(ohCrap && "Music not found!"); } - int index = musicReadBlob.getIndex("data/music/0levelcomplete.ogg"); - SDL_RWops *rw = SDL_RWFromMem(musicReadBlob.getAddress(index), musicReadBlob.getSize(index)); - musicTracks.push_back(MusicTrack( rw )); + int index; + SDL_RWops *rw; - index = musicReadBlob.getIndex("data/music/1pushingonwards.ogg"); - rw = SDL_RWFromMem(musicReadBlob.getAddress(index), musicReadBlob.getSize(index)); - musicTracks.push_back(MusicTrack( rw )); + TRACK_NAMES - index = musicReadBlob.getIndex("data/music/2positiveforce.ogg"); - rw = SDL_RWFromMem(musicReadBlob.getAddress(index), musicReadBlob.getSize(index)); - musicTracks.push_back(MusicTrack( rw )); - - index = musicReadBlob.getIndex("data/music/3potentialforanything.ogg"); - rw = SDL_RWFromMem(musicReadBlob.getAddress(index), musicReadBlob.getSize(index)); - musicTracks.push_back(MusicTrack( rw )); - - index = musicReadBlob.getIndex("data/music/4passionforexploring.ogg"); - rw = SDL_RWFromMem(musicReadBlob.getAddress(index), musicReadBlob.getSize(index)); - musicTracks.push_back(MusicTrack( rw )); - - index = musicReadBlob.getIndex("data/music/5intermission.ogg"); - rw = SDL_RWFromMem(musicReadBlob.getAddress(index), musicReadBlob.getSize(index)); - musicTracks.push_back(MusicTrack( rw )); - - index = musicReadBlob.getIndex("data/music/6presentingvvvvvv.ogg"); - rw = SDL_RWFromMem(musicReadBlob.getAddress(index), musicReadBlob.getSize(index)); - musicTracks.push_back(MusicTrack( rw )); - - index = musicReadBlob.getIndex("data/music/7gamecomplete.ogg"); - rw = SDL_RWFromMem(musicReadBlob.getAddress(index), musicReadBlob.getSize(index)); - musicTracks.push_back(MusicTrack( rw )); - - index = musicReadBlob.getIndex("data/music/8predestinedfate.ogg"); - rw = SDL_RWFromMem(musicReadBlob.getAddress(index), musicReadBlob.getSize(index)); - musicTracks.push_back(MusicTrack( rw )); - - index = musicReadBlob.getIndex("data/music/9positiveforcereversed.ogg"); - rw = SDL_RWFromMem(musicReadBlob.getAddress(index), musicReadBlob.getSize(index)); - musicTracks.push_back(MusicTrack( rw )); - - index = musicReadBlob.getIndex("data/music/10popularpotpourri.ogg"); - rw = SDL_RWFromMem(musicReadBlob.getAddress(index), musicReadBlob.getSize(index)); - musicTracks.push_back(MusicTrack( rw )); - - index = musicReadBlob.getIndex("data/music/11pipedream.ogg"); - rw = SDL_RWFromMem(musicReadBlob.getAddress(index), musicReadBlob.getSize(index)); - musicTracks.push_back(MusicTrack( rw )); - - index = musicReadBlob.getIndex("data/music/12pressurecooker.ogg"); - rw = SDL_RWFromMem(musicReadBlob.getAddress(index), musicReadBlob.getSize(index)); - musicTracks.push_back(MusicTrack( rw )); - - index = musicReadBlob.getIndex("data/music/13pacedenergy.ogg"); - rw = SDL_RWFromMem(musicReadBlob.getAddress(index), musicReadBlob.getSize(index)); - musicTracks.push_back(MusicTrack( rw )); - - index = musicReadBlob.getIndex("data/music/14piercingthesky.ogg"); - rw = SDL_RWFromMem(musicReadBlob.getAddress(index), musicReadBlob.getSize(index)); - musicTracks.push_back(MusicTrack( rw )); - - index = musicReadBlob.getIndex("data/music/predestinedfatefinallevel.ogg"); - rw = SDL_RWFromMem(musicReadBlob.getAddress(index), musicReadBlob.getSize(index)); - musicTracks.push_back(MusicTrack( rw )); +#undef FOREACH_TRACK safeToProcessMusic= false; m_doFadeInVol = false;