mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-11-05 02:39:41 +01:00
Remove data/ from track name list, refactor music loading, and support loose ogg music
(these should be separate commits but they're annoying to split after the fact, oh well)
This commit is contained in:
parent
5b6c4b6b28
commit
f86a67456b
3 changed files with 53 additions and 28 deletions
|
@ -134,9 +134,8 @@ bool binaryBlob::nextExtra(size_t* start)
|
|||
for (idx = start; *idx < SDL_arraysize(m_headers); *idx += 1)
|
||||
{
|
||||
if (m_headers[*idx].valid
|
||||
#define FOREACH_TRACK(_, track_name) && SDL_strcmp(m_headers[*idx].name, track_name) != 0
|
||||
#define FOREACH_TRACK(_, track_name) && SDL_strcmp(m_headers[*idx].name, "data/" track_name) != 0
|
||||
TRACK_NAMES(_)
|
||||
#undef FOREACH_TRACK
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -7,22 +7,22 @@
|
|||
// #define VVV_COMPILEMUSIC
|
||||
|
||||
#define TRACK_NAMES(blob) \
|
||||
FOREACH_TRACK(blob, "data/music/0levelcomplete.ogg") \
|
||||
FOREACH_TRACK(blob, "data/music/1pushingonwards.ogg") \
|
||||
FOREACH_TRACK(blob, "data/music/2positiveforce.ogg") \
|
||||
FOREACH_TRACK(blob, "data/music/3potentialforanything.ogg") \
|
||||
FOREACH_TRACK(blob, "data/music/4passionforexploring.ogg") \
|
||||
FOREACH_TRACK(blob, "data/music/5intermission.ogg") \
|
||||
FOREACH_TRACK(blob, "data/music/6presentingvvvvvv.ogg") \
|
||||
FOREACH_TRACK(blob, "data/music/7gamecomplete.ogg") \
|
||||
FOREACH_TRACK(blob, "data/music/8predestinedfate.ogg") \
|
||||
FOREACH_TRACK(blob, "data/music/9positiveforcereversed.ogg") \
|
||||
FOREACH_TRACK(blob, "data/music/10popularpotpourri.ogg") \
|
||||
FOREACH_TRACK(blob, "data/music/11pipedream.ogg") \
|
||||
FOREACH_TRACK(blob, "data/music/12pressurecooker.ogg") \
|
||||
FOREACH_TRACK(blob, "data/music/13pacedenergy.ogg") \
|
||||
FOREACH_TRACK(blob, "data/music/14piercingthesky.ogg") \
|
||||
FOREACH_TRACK(blob, "data/music/predestinedfatefinallevel.ogg")
|
||||
FOREACH_TRACK(blob, "music/0levelcomplete.ogg") \
|
||||
FOREACH_TRACK(blob, "music/1pushingonwards.ogg") \
|
||||
FOREACH_TRACK(blob, "music/2positiveforce.ogg") \
|
||||
FOREACH_TRACK(blob, "music/3potentialforanything.ogg") \
|
||||
FOREACH_TRACK(blob, "music/4passionforexploring.ogg") \
|
||||
FOREACH_TRACK(blob, "music/5intermission.ogg") \
|
||||
FOREACH_TRACK(blob, "music/6presentingvvvvvv.ogg") \
|
||||
FOREACH_TRACK(blob, "music/7gamecomplete.ogg") \
|
||||
FOREACH_TRACK(blob, "music/8predestinedfate.ogg") \
|
||||
FOREACH_TRACK(blob, "music/9positiveforcereversed.ogg") \
|
||||
FOREACH_TRACK(blob, "music/10popularpotpourri.ogg") \
|
||||
FOREACH_TRACK(blob, "music/11pipedream.ogg") \
|
||||
FOREACH_TRACK(blob, "music/12pressurecooker.ogg") \
|
||||
FOREACH_TRACK(blob, "music/13pacedenergy.ogg") \
|
||||
FOREACH_TRACK(blob, "music/14piercingthesky.ogg") \
|
||||
FOREACH_TRACK(blob, "music/predestinedfatefinallevel.ogg")
|
||||
|
||||
struct resourceheader
|
||||
{
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include <SDL.h>
|
||||
#include <stdio.h>
|
||||
#include <physfsrwops.h>
|
||||
|
||||
#include "BinaryBlob.h"
|
||||
#include "Game.h"
|
||||
|
@ -62,7 +63,7 @@ void musicclass::init(void)
|
|||
|
||||
#ifdef VVV_COMPILEMUSIC
|
||||
binaryBlob musicWriteBlob;
|
||||
#define FOREACH_TRACK(blob, track_name) blob.AddFileToBinaryBlob(track_name);
|
||||
#define FOREACH_TRACK(blob, track_name) blob.AddFileToBinaryBlob("data/" track_name);
|
||||
TRACK_NAMES(musicWriteBlob)
|
||||
#undef FOREACH_TRACK
|
||||
|
||||
|
@ -75,19 +76,46 @@ void musicclass::init(void)
|
|||
|
||||
if (!mmmmmm_blob.unPackBinary("mmmmmm.vvv"))
|
||||
{
|
||||
mmmmmm = false;
|
||||
usingmmmmmm=false;
|
||||
bool ohCrap = pppppp_blob.unPackBinary("vvvvvvmusic.vvv");
|
||||
SDL_assert(ohCrap && "Music not found!");
|
||||
if (pppppp_blob.unPackBinary("vvvvvvmusic.vvv")) {
|
||||
puts("Loading music from PPPPPP blob...");
|
||||
|
||||
mmmmmm = false;
|
||||
usingmmmmmm=false;
|
||||
|
||||
int index;
|
||||
SDL_RWops* rw;
|
||||
|
||||
#define FOREACH_TRACK(blob, track_name) \
|
||||
index = blob.getIndex("data/" track_name); \
|
||||
rw = SDL_RWFromMem(blob.getAddress(index), blob.getSize(index)); \
|
||||
musicTracks.push_back(MusicTrack( rw ));
|
||||
|
||||
TRACK_NAMES(pppppp_blob)
|
||||
|
||||
#undef FOREACH_TRACK
|
||||
} else {
|
||||
puts("Loading music from loose files...");
|
||||
|
||||
SDL_RWops* rw;
|
||||
#define FOREACH_TRACK(_, track_name) \
|
||||
rw = PHYSFSRWOPS_openRead(track_name); \
|
||||
musicTracks.push_back(MusicTrack( rw ));
|
||||
|
||||
TRACK_NAMES(_)
|
||||
|
||||
#undef FOREACH_TRACK
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
puts("Loading PPPPPP and MMMMMM blobs...");
|
||||
|
||||
mmmmmm = true;
|
||||
int index;
|
||||
SDL_RWops *rw;
|
||||
|
||||
#define FOREACH_TRACK(blob, track_name) \
|
||||
index = blob.getIndex(track_name); \
|
||||
index = blob.getIndex("data/" track_name); \
|
||||
if (index >= 0 && index < blob.max_headers) \
|
||||
{ \
|
||||
rw = SDL_RWFromConstMem(blob.getAddress(index), blob.getSize(index)); \
|
||||
|
@ -117,17 +145,15 @@ void musicclass::init(void)
|
|||
|
||||
bool ohCrap = pppppp_blob.unPackBinary("vvvvvvmusic.vvv");
|
||||
SDL_assert(ohCrap && "Music not found!");
|
||||
}
|
||||
|
||||
int index;
|
||||
SDL_RWops *rw;
|
||||
|
||||
TRACK_NAMES(pppppp_blob)
|
||||
|
||||
#undef FOREACH_TRACK
|
||||
}
|
||||
|
||||
num_pppppp_tracks += musicTracks.size() - num_mmmmmm_tracks;
|
||||
|
||||
SDL_RWops* rw;
|
||||
size_t index_ = 0;
|
||||
while (pppppp_blob.nextExtra(&index_))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue