mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-22 17:49:43 +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)
|
for (idx = start; *idx < SDL_arraysize(m_headers); *idx += 1)
|
||||||
{
|
{
|
||||||
if (m_headers[*idx].valid
|
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(_)
|
TRACK_NAMES(_)
|
||||||
#undef FOREACH_TRACK
|
|
||||||
) {
|
) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,22 +7,22 @@
|
||||||
// #define VVV_COMPILEMUSIC
|
// #define VVV_COMPILEMUSIC
|
||||||
|
|
||||||
#define TRACK_NAMES(blob) \
|
#define TRACK_NAMES(blob) \
|
||||||
FOREACH_TRACK(blob, "data/music/0levelcomplete.ogg") \
|
FOREACH_TRACK(blob, "music/0levelcomplete.ogg") \
|
||||||
FOREACH_TRACK(blob, "data/music/1pushingonwards.ogg") \
|
FOREACH_TRACK(blob, "music/1pushingonwards.ogg") \
|
||||||
FOREACH_TRACK(blob, "data/music/2positiveforce.ogg") \
|
FOREACH_TRACK(blob, "music/2positiveforce.ogg") \
|
||||||
FOREACH_TRACK(blob, "data/music/3potentialforanything.ogg") \
|
FOREACH_TRACK(blob, "music/3potentialforanything.ogg") \
|
||||||
FOREACH_TRACK(blob, "data/music/4passionforexploring.ogg") \
|
FOREACH_TRACK(blob, "music/4passionforexploring.ogg") \
|
||||||
FOREACH_TRACK(blob, "data/music/5intermission.ogg") \
|
FOREACH_TRACK(blob, "music/5intermission.ogg") \
|
||||||
FOREACH_TRACK(blob, "data/music/6presentingvvvvvv.ogg") \
|
FOREACH_TRACK(blob, "music/6presentingvvvvvv.ogg") \
|
||||||
FOREACH_TRACK(blob, "data/music/7gamecomplete.ogg") \
|
FOREACH_TRACK(blob, "music/7gamecomplete.ogg") \
|
||||||
FOREACH_TRACK(blob, "data/music/8predestinedfate.ogg") \
|
FOREACH_TRACK(blob, "music/8predestinedfate.ogg") \
|
||||||
FOREACH_TRACK(blob, "data/music/9positiveforcereversed.ogg") \
|
FOREACH_TRACK(blob, "music/9positiveforcereversed.ogg") \
|
||||||
FOREACH_TRACK(blob, "data/music/10popularpotpourri.ogg") \
|
FOREACH_TRACK(blob, "music/10popularpotpourri.ogg") \
|
||||||
FOREACH_TRACK(blob, "data/music/11pipedream.ogg") \
|
FOREACH_TRACK(blob, "music/11pipedream.ogg") \
|
||||||
FOREACH_TRACK(blob, "data/music/12pressurecooker.ogg") \
|
FOREACH_TRACK(blob, "music/12pressurecooker.ogg") \
|
||||||
FOREACH_TRACK(blob, "data/music/13pacedenergy.ogg") \
|
FOREACH_TRACK(blob, "music/13pacedenergy.ogg") \
|
||||||
FOREACH_TRACK(blob, "data/music/14piercingthesky.ogg") \
|
FOREACH_TRACK(blob, "music/14piercingthesky.ogg") \
|
||||||
FOREACH_TRACK(blob, "data/music/predestinedfatefinallevel.ogg")
|
FOREACH_TRACK(blob, "music/predestinedfatefinallevel.ogg")
|
||||||
|
|
||||||
struct resourceheader
|
struct resourceheader
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <physfsrwops.h>
|
||||||
|
|
||||||
#include "BinaryBlob.h"
|
#include "BinaryBlob.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
|
@ -62,7 +63,7 @@ void musicclass::init(void)
|
||||||
|
|
||||||
#ifdef VVV_COMPILEMUSIC
|
#ifdef VVV_COMPILEMUSIC
|
||||||
binaryBlob musicWriteBlob;
|
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)
|
TRACK_NAMES(musicWriteBlob)
|
||||||
#undef FOREACH_TRACK
|
#undef FOREACH_TRACK
|
||||||
|
|
||||||
|
@ -75,19 +76,46 @@ void musicclass::init(void)
|
||||||
|
|
||||||
if (!mmmmmm_blob.unPackBinary("mmmmmm.vvv"))
|
if (!mmmmmm_blob.unPackBinary("mmmmmm.vvv"))
|
||||||
{
|
{
|
||||||
mmmmmm = false;
|
if (pppppp_blob.unPackBinary("vvvvvvmusic.vvv")) {
|
||||||
usingmmmmmm=false;
|
puts("Loading music from PPPPPP blob...");
|
||||||
bool ohCrap = pppppp_blob.unPackBinary("vvvvvvmusic.vvv");
|
|
||||||
SDL_assert(ohCrap && "Music not found!");
|
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
|
else
|
||||||
{
|
{
|
||||||
|
puts("Loading PPPPPP and MMMMMM blobs...");
|
||||||
|
|
||||||
mmmmmm = true;
|
mmmmmm = true;
|
||||||
int index;
|
int index;
|
||||||
SDL_RWops *rw;
|
SDL_RWops *rw;
|
||||||
|
|
||||||
#define FOREACH_TRACK(blob, track_name) \
|
#define FOREACH_TRACK(blob, track_name) \
|
||||||
index = blob.getIndex(track_name); \
|
index = blob.getIndex("data/" track_name); \
|
||||||
if (index >= 0 && index < blob.max_headers) \
|
if (index >= 0 && index < blob.max_headers) \
|
||||||
{ \
|
{ \
|
||||||
rw = SDL_RWFromConstMem(blob.getAddress(index), blob.getSize(index)); \
|
rw = SDL_RWFromConstMem(blob.getAddress(index), blob.getSize(index)); \
|
||||||
|
@ -117,17 +145,15 @@ void musicclass::init(void)
|
||||||
|
|
||||||
bool ohCrap = pppppp_blob.unPackBinary("vvvvvvmusic.vvv");
|
bool ohCrap = pppppp_blob.unPackBinary("vvvvvvmusic.vvv");
|
||||||
SDL_assert(ohCrap && "Music not found!");
|
SDL_assert(ohCrap && "Music not found!");
|
||||||
}
|
|
||||||
|
|
||||||
int index;
|
|
||||||
SDL_RWops *rw;
|
|
||||||
|
|
||||||
TRACK_NAMES(pppppp_blob)
|
TRACK_NAMES(pppppp_blob)
|
||||||
|
|
||||||
#undef FOREACH_TRACK
|
#undef FOREACH_TRACK
|
||||||
|
}
|
||||||
|
|
||||||
num_pppppp_tracks += musicTracks.size() - num_mmmmmm_tracks;
|
num_pppppp_tracks += musicTracks.size() - num_mmmmmm_tracks;
|
||||||
|
|
||||||
|
SDL_RWops* rw;
|
||||||
size_t index_ = 0;
|
size_t index_ = 0;
|
||||||
while (pppppp_blob.nextExtra(&index_))
|
while (pppppp_blob.nextExtra(&index_))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue