Refactor TRACK_NAMES to take in a blob parameter

I'm going to introduce another binaryBlob object in to the mix, and I
want to be able to re-use an existing FOREACH_TRACK #define without
having to copy-paste it again. So, TRACK_NAMES now takes in a blob
parameter, which will be passed to the temporary FOREACH_TRACK #define.
This commit is contained in:
Misa
2021-02-15 16:38:10 -08:00
committed by Ethan Lee
parent 0ea1a0e28e
commit f39174b3e3
3 changed files with 27 additions and 27 deletions

View File

@@ -64,8 +64,8 @@ void musicclass::init()
#ifdef VVV_COMPILEMUSIC
binaryBlob musicWriteBlob;
#define FOREACH_TRACK(track_name) musicWriteBlob.AddFileToBinaryBlob(track_name);
TRACK_NAMES
#define FOREACH_TRACK(blob, track_name) blob.AddFileToBinaryBlob(track_name);
TRACK_NAMES(musicWriteBlob)
#undef FOREACH_TRACK
musicWriteBlob.writeBinaryBlob("data/BinaryMusic.vvv");
@@ -87,11 +87,11 @@ void musicclass::init()
int index;
SDL_RWops *rw;
#define FOREACH_TRACK(track_name) \
index = musicReadBlob.getIndex(track_name); \
if (index >= 0 && index < musicReadBlob.max_headers) \
#define FOREACH_TRACK(blob, track_name) \
index = blob.getIndex(track_name); \
if (index >= 0 && index < blob.max_headers) \
{ \
rw = SDL_RWFromMem(musicReadBlob.getAddress(index), musicReadBlob.getSize(index)); \
rw = SDL_RWFromMem(blob.getAddress(index), blob.getSize(index)); \
if (rw == NULL) \
{ \
printf("Unable to read music file header: %s\n", SDL_GetError()); \
@@ -102,7 +102,7 @@ void musicclass::init()
} \
}
TRACK_NAMES
TRACK_NAMES(musicReadBlob)
num_mmmmmm_tracks += musicTracks.size();
@@ -123,7 +123,7 @@ void musicclass::init()
int index;
SDL_RWops *rw;
TRACK_NAMES
TRACK_NAMES(musicReadBlob)
#undef FOREACH_TRACK