mirror of
https://github.com/AllenSeitz/dance-maniax-update.git
synced 2026-08-28 04:44:05 -05:00
Added Alternate Music Feature
Songs may now use an alternate mp3 for their maniax chart by setting a new flag in the song database.
This commit is contained in:
@@ -406,7 +406,7 @@ struct SongEntry
|
||||
char maniaxDouble;
|
||||
char version; // for sorting
|
||||
int numPlays; // the only non-static data in this structure
|
||||
char unlockFlag;
|
||||
char specialFlag; //
|
||||
bool isNew;
|
||||
|
||||
SongEntry::SongEntry()
|
||||
@@ -428,7 +428,7 @@ struct SongEntry
|
||||
maniaxDouble = xd;
|
||||
version = v;
|
||||
numPlays = 0;
|
||||
unlockFlag = 0;
|
||||
specialFlag = 0;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -439,11 +439,11 @@ struct SongEntry
|
||||
#define DOUBLE_WILD 11
|
||||
#define DOUBLE_ANOTHER 12
|
||||
|
||||
#define UNLOCK_METHOD_NONE 0
|
||||
#define UNLOCK_METHOD_EXTRA_STAGE 1
|
||||
#define UNLOCK_METHOD_CLEAR 2
|
||||
#define UNLOCK_METHOD_SPECIAL 3
|
||||
#define UNLOCK_METHOD_ROULETTE 4
|
||||
#define SPECIAL_FLAG_NONE 0
|
||||
#define SPECIAL_FLAG_UNLOCK_METHOD_EXTRA_STAGE 1
|
||||
#define SPECIAL_FLAG_HAS_ALTERNATE_MUSIC 2
|
||||
#define SPECIAL_FLAG_UNUSED_DELTA 4
|
||||
#define SPECIAL_FLAG_UNUSED_EPSILON 8
|
||||
|
||||
int songID_to_listID(int songID);
|
||||
int listID_to_songID(int index);
|
||||
|
||||
@@ -291,38 +291,40 @@ public:
|
||||
isFreestyleMode = false;
|
||||
}
|
||||
|
||||
void loadSong(int songID, bool preview = false)
|
||||
void loadSong(int songID, bool preview = false, bool useAlternateMusic = false)
|
||||
{
|
||||
char filename[64] = "DATA/audio/112.mp3";
|
||||
filename[11] = (songID/100 % 10) + '0';
|
||||
filename[12] = (songID/10 % 10) + '0';
|
||||
filename[13] = (songID % 10) + '0';
|
||||
int digitsOffset = 11;
|
||||
int fileextOffset = 15;
|
||||
|
||||
if ( preview )
|
||||
{
|
||||
strcpy_s(filename, 64, "DATA/audio/pre_112.mp3");
|
||||
filename[15] = (songID/100 % 10) + '0';
|
||||
filename[16] = (songID/10 % 10) + '0';
|
||||
filename[17] = (songID % 10) + '0';
|
||||
digitsOffset = 15;
|
||||
fileextOffset = 19;
|
||||
}
|
||||
if ( useAlternateMusic )
|
||||
{
|
||||
strcpy_s(filename, 64, "DATA/audio/112b.mp3");
|
||||
digitsOffset = 11;
|
||||
fileextOffset = 16;
|
||||
}
|
||||
|
||||
// str replace the song id
|
||||
filename[digitsOffset] = (songID/100 % 10) + '0';
|
||||
filename[digitsOffset+1] = (songID/10 % 10) + '0';
|
||||
filename[digitsOffset+2] = (songID % 10) + '0';
|
||||
|
||||
currentSongIsPreview = preview;
|
||||
killSong();
|
||||
currentSongSample = FSOUND_Sample_Load(FSOUND_UNMANAGED, filename, FSOUND_NORMAL | FSOUND_MPEGACCURATE, 0, 0);
|
||||
if ( currentSongSample == NULL )
|
||||
{
|
||||
// try again as an ogg
|
||||
if ( preview )
|
||||
{
|
||||
filename[19] = 'o';
|
||||
filename[20] = 'g';
|
||||
filename[21] = 'g';
|
||||
}
|
||||
else
|
||||
{
|
||||
filename[15] = 'o';
|
||||
filename[16] = 'g';
|
||||
filename[17] = 'g';
|
||||
}
|
||||
// str replace the file extension
|
||||
filename[fileextOffset] = 'o';
|
||||
filename[fileextOffset+1] = 'g';
|
||||
filename[fileextOffset+2] = 'g';
|
||||
|
||||
currentSongSample = FSOUND_Sample_Load(FSOUND_UNMANAGED, filename, FSOUND_NORMAL, 0, 0);
|
||||
|
||||
if ( currentSongSample == NULL )
|
||||
|
||||
@@ -1144,8 +1144,18 @@ void loadNextSong()
|
||||
arrangeChart(&gs.player[p].currentChart, &gs.player[p].freezeArrows, gs.player[p].arrangeModifier, gs.isDoubles);
|
||||
}
|
||||
}
|
||||
|
||||
// check for alternate versions of songs? (used for maniax charts)
|
||||
bool useAlternateMusic = false;
|
||||
if ( (songs[songID_to_listID(gs.player[0].stagesPlayed[gs.currentStage])].specialFlag & SPECIAL_FLAG_HAS_ALTERNATE_MUSIC) != 0 )
|
||||
{
|
||||
if ( gs.player[0].stagesLevels[gs.currentStage] == SINGLE_ANOTHER || gs.player[0].stagesLevels[gs.currentStage] == DOUBLE_ANOTHER || (gs.isVersus && gs.player[1].stagesLevels[gs.currentStage] == SINGLE_ANOTHER) )
|
||||
{
|
||||
useAlternateMusic = true;
|
||||
}
|
||||
}
|
||||
|
||||
gs.loadSong(gs.player[0].stagesPlayed[gs.currentStage]);
|
||||
gs.loadSong(gs.player[0].stagesPlayed[gs.currentStage], false, useAlternateMusic);
|
||||
vm.loadScript(movieScripts[songID_to_listID(gs.player[0].stagesPlayed[gs.currentStage])].c_str()); // I love the "])]" on this line!!!
|
||||
gs.playSong();
|
||||
vm.play();
|
||||
@@ -1372,7 +1382,7 @@ int checkForExtraStages()
|
||||
{
|
||||
songIndexError(gs.player[0].stagesPlayed[gs.numSongsPerSet]);
|
||||
}
|
||||
if ( awardedExtra && songs[songIndex].unlockFlag == UNLOCK_METHOD_EXTRA_STAGE )
|
||||
if ( awardedExtra && songs[songIndex].specialFlag & SPECIAL_FLAG_UNLOCK_METHOD_EXTRA_STAGE )
|
||||
{
|
||||
if ( sm.player[0].currentSet[gs.numSongsPerSet].getScore() >= 900000 )
|
||||
{
|
||||
|
||||
@@ -1582,7 +1582,7 @@ int loadSongDB()
|
||||
songArtists[i].assign(artist, strlen(artist));
|
||||
movieScripts[i].assign(movie, strlen(movie));
|
||||
songs[i].initialize(id, minbpm, maxbpm, sm, sw, sx, dm, dw, dx, version); // BROKEN MY HEART
|
||||
songs[i].unlockFlag = flag;
|
||||
songs[i].specialFlag = flag;
|
||||
songs[i].isNew = isNew == 1;
|
||||
|
||||
if ( version == 101 )
|
||||
|
||||
@@ -146,7 +146,7 @@ void firstNonstopLoop()
|
||||
{
|
||||
if ( songs[i].version == 101 )
|
||||
{
|
||||
if ( songs[i].unlockFlag != UNLOCK_METHOD_NONE )
|
||||
if ( songs[i].specialFlag != SPECIAL_FLAG_NONE )
|
||||
{
|
||||
continue; // course is locked
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ bool isSongAvailable(int index)
|
||||
{
|
||||
bool earnedIt = true;
|
||||
|
||||
if ( songs[index].unlockFlag != UNLOCK_METHOD_NONE )
|
||||
if ( (songs[index].specialFlag & SPECIAL_FLAG_UNLOCK_METHOD_EXTRA_STAGE) != 0 )
|
||||
{
|
||||
earnedIt = false;
|
||||
|
||||
@@ -295,24 +295,27 @@ void firstSongwheelLoop()
|
||||
songlist[nextIndex] = songs[i];
|
||||
|
||||
// certain charts may be locked
|
||||
if ( songs[i].unlockFlag != UNLOCK_METHOD_NONE && !allsongsDebug )
|
||||
if ( ((songs[i].specialFlag & SPECIAL_FLAG_UNLOCK_METHOD_EXTRA_STAGE) != 0) && !allsongsDebug )
|
||||
{
|
||||
if ( sm.player[0].allTime[i][3].unlockStatus == 0 )
|
||||
bool hasWildChart = true; // if they have the wild chart, they get mild for free
|
||||
if ( sm.player[0].allTime[i][SINGLE_WILD].unlockStatus == 0 && sm.player[1].allTime[i][SINGLE_WILD].unlockStatus == 0 )
|
||||
{
|
||||
songlist[nextIndex].mildDouble = 0;
|
||||
songlist[nextIndex].wildSingle = 0;
|
||||
hasWildChart = false;
|
||||
}
|
||||
if ( sm.player[0].allTime[i][4].unlockStatus == 0 )
|
||||
{
|
||||
songlist[nextIndex].wildDouble = 0;
|
||||
hasWildChart = false;
|
||||
}
|
||||
if ( sm.player[0].allTime[i][SINGLE_MILD].unlockStatus == 0 && sm.player[1].allTime[i][SINGLE_MILD].unlockStatus == 0 )
|
||||
if ( sm.player[0].allTime[i][3].unlockStatus == 0 && !hasWildChart )
|
||||
{
|
||||
songlist[nextIndex].mildDouble = 0;
|
||||
}
|
||||
if ( sm.player[0].allTime[i][SINGLE_MILD].unlockStatus == 0 && sm.player[1].allTime[i][SINGLE_MILD].unlockStatus == 0 && !hasWildChart )
|
||||
{
|
||||
songlist[nextIndex].mildSingle = 0;
|
||||
}
|
||||
if ( sm.player[0].allTime[i][SINGLE_WILD].unlockStatus == 0 && sm.player[1].allTime[i][SINGLE_WILD].unlockStatus == 0 )
|
||||
{
|
||||
songlist[nextIndex].wildSingle = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if ( songlist[nextIndex].version == 5 && futureStartIndex == maxSongwheelIndex )
|
||||
|
||||
Reference in New Issue
Block a user