1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-11-17 16:39:42 +01:00

De-duplicate track names

Instead of copy-pasting the entire list three times over, why not put it
in an easy to use "X" macro?
This commit is contained in:
Misa 2020-06-30 15:17:02 -07:00 committed by Ethan Lee
parent ad540d57f4
commit 09dbe8113b
2 changed files with 32 additions and 138 deletions

View file

@ -4,6 +4,24 @@
/* Laaaazyyyyyyy -flibit */ /* Laaaazyyyyyyy -flibit */
// #define VVV_COMPILEMUSIC // #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 struct resourceheader
{ {
char name[48]; char name[48];

View file

@ -50,22 +50,9 @@ void musicclass::init()
#ifdef VVV_COMPILEMUSIC #ifdef VVV_COMPILEMUSIC
binaryBlob musicWriteBlob; binaryBlob musicWriteBlob;
musicWriteBlob.AddFileToBinaryBlob("data/music/0levelcomplete.ogg"); #define FOREACH_TRACK(track_name) musicWriteBlob.AddFileToBinaryBlob(track_name);
musicWriteBlob.AddFileToBinaryBlob("data/music/1pushingonwards.ogg"); TRACK_NAMES
musicWriteBlob.AddFileToBinaryBlob("data/music/2positiveforce.ogg"); #undef FOREACH_TRACK
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");
musicWriteBlob.writeBinaryBlob("data/BinaryMusic.vvv"); musicWriteBlob.writeBinaryBlob("data/BinaryMusic.vvv");
#endif #endif
@ -81,137 +68,26 @@ void musicclass::init()
{ {
mmmmmm = true; mmmmmm = true;
usingmmmmmm = true; usingmmmmmm = true;
int index = musicReadBlob.getIndex("data/music/0levelcomplete.ogg"); int index;
SDL_RWops *rw = SDL_RWFromMem(musicReadBlob.getAddress(index), musicReadBlob.getSize(index)); SDL_RWops *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 )); musicTracks.push_back(MusicTrack( rw ));
index = musicReadBlob.getIndex("data/music/1pushingonwards.ogg"); TRACK_NAMES
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 ));
bool ohCrap = musicReadBlob.unPackBinary("vvvvvvmusic.vvv"); bool ohCrap = musicReadBlob.unPackBinary("vvvvvvmusic.vvv");
SDL_assert(ohCrap && "Music not found!"); SDL_assert(ohCrap && "Music not found!");
} }
int index = musicReadBlob.getIndex("data/music/0levelcomplete.ogg"); int index;
SDL_RWops *rw = SDL_RWFromMem(musicReadBlob.getAddress(index), musicReadBlob.getSize(index)); SDL_RWops *rw;
musicTracks.push_back(MusicTrack( rw ));
index = musicReadBlob.getIndex("data/music/1pushingonwards.ogg"); TRACK_NAMES
rw = SDL_RWFromMem(musicReadBlob.getAddress(index), musicReadBlob.getSize(index));
musicTracks.push_back(MusicTrack( rw ));
index = musicReadBlob.getIndex("data/music/2positiveforce.ogg"); #undef FOREACH_TRACK
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 ));
safeToProcessMusic= false; safeToProcessMusic= false;
m_doFadeInVol = false; m_doFadeInVol = false;