Conditional BGA System

This commit is contained in:
Andrew Livy
2004-02-11 22:34:04 +00:00
parent b75dd3f4be
commit fa7c70adf4
5 changed files with 824 additions and 49 deletions
+645
View File
@@ -0,0 +1,645 @@
#include "global.h"
#include <time.h>
#include "GameState.h"
#include "GameManager.h"
#include "Song.h"
#include "GameConstantsAndTypes.h"
#include "RageLog.h"
#include "BGAnimation.h"
#include "ConditionalBGA.h"
#include "ThemeManager.h"
#include "RageUtil.h"
#include "RageFile.h"
#include "StageStats.h"
#include "Steps.h"
ConditionalBGA::ConditionalBGA()
{
}
ConditionalBGA::~ConditionalBGA()
{
}
void ConditionalBGA::Load(CString szScreenName)
{
RageFile file;
CString szThemeDir = THEME->GetCurThemeDir();
CString szConditionalBGAFile = szThemeDir += szScreenName += " ConditionalBGA.ini";
// char filepath[512];
// strcpy(filepath,""); // empty the path first
// strcpy(filepath,szConditionalBGAFile.c_str());
LOG->Trace("ConditionalBGA Load:%s",szConditionalBGAFile.c_str());
bool loaded = file.Open(szConditionalBGAFile,RageFile::READ);
// FILE* fp = NULL;
// fp = fopen(filepath,"r");
if(!loaded)
{
LOG->Warn("ConditionalBGA File Not Found");
return;
}
else
{
CString currentline;
int bgano=0;
while(!file.AtEOF())
{
file.GetLine(currentline); // get the current line
// kill any possible comments
CStringArray asKillComments;
asKillComments.clear(); // get rid of anything in there
split(currentline, "#",asKillComments); // A comment starting with #
if(!asKillComments.empty())
{
currentline = asKillComments[0]; // there was some commentstuff here, take the first bit to be the actual data
}
asKillComments.clear(); // get rid of anything in there
split(currentline, "/",asKillComments); // A comment starting with // or /*
if(!asKillComments.empty())
{
currentline = asKillComments[0]; // there was some commentstuff here, take the first bit to be the actual data
}
TrimRight(currentline); // nuke trailing whitespace
// start parsing the data
if(currentline.c_str()[0] == '[') // we found a new bganimation
{
if(!m_bgainfo.empty()) // last one wasnt empty
{
CheckBgaRequirements(m_bgainfo[bgano]);
bgano++;
}
BgaCondInfo temp;
m_bgainfo.push_back(temp);
ClearINFO(bgano); // wipe out the old info structure.
CStringArray asSplitLine;
split(currentline,"[",asSplitLine);
split(asSplitLine[0],"]",asSplitLine);
if(!asSplitLine.empty() && asSplitLine.size() - 1 >= 0)
m_bgainfo[bgano].bganame = asSplitLine[asSplitLine.size() - 1];
}
else
{
CStringArray asSplitLine;
split(currentline,":",asSplitLine);
if(asSplitLine.empty()) continue;
if(!asSplitLine[0].CompareNoCase("clear") && asSplitLine.size() > 1)
{
if(!asSplitLine[1].CompareNoCase("true") || !asSplitLine[1].CompareNoCase("cleared") || !asSplitLine[1].CompareNoCase("clear")) // true / clear (any clear condition)
m_bgainfo[bgano].cleared = CBGA_CSCLEARED;
else if(!asSplitLine[1].CompareNoCase("false") || !asSplitLine[1].CompareNoCase("failed")) // false / failed
m_bgainfo[bgano].cleared = CBGA_CSFAILED;
else if(!asSplitLine[1].CompareNoCase("maxcombo") || !asSplitLine[1].CompareNoCase("fullcombo")) // passed with maxcombo
m_bgainfo[bgano].cleared = CBGA_CSMAXCOMBO;
else if(!asSplitLine[1].CompareNoCase("brokencombo")) // passed with a broken combo
m_bgainfo[bgano].cleared = CBGA_CSBROKECOMBO;
// LOG->Trace("Clear Conditon: %d",info.cleared);
}
if(!asSplitLine[0].CompareNoCase("songtitle") && asSplitLine.size() > 1)
{
m_bgainfo[bgano].songtitle = asSplitLine[1];
// LOG->Trace("SongTitle: %s",info.songtitle.c_str());
}
if(!asSplitLine[0].CompareNoCase("songartist") && asSplitLine.size() > 1)
{
m_bgainfo[bgano].songartist = asSplitLine[1];
// LOG->Trace("SongArtist: %s",info.songartist.c_str());
}
if(!asSplitLine[0].CompareNoCase("songday") && asSplitLine.size() > 1)
{
CStringArray asDays;
split( asSplitLine[1], ",", asDays );
for( unsigned d=0; d<asDays.size(); d++ )
{
int dn = atoi(asDays[d].c_str());
if(!(dn < 1 || dn > 32)) // ignore if date is out of range
{
m_bgainfo[bgano].songdays.push_back(dn);
}
}
// for(d=0; d<info.songdays.size(); d++)
// {
// LOG->Trace("SongDay: %d",info.songdays[d]);
// }
}
if(!asSplitLine[0].CompareNoCase("songmonth") && asSplitLine.size() > 1)
{
CStringArray asMonths;
split( asSplitLine[1], ",", asMonths );
for( unsigned d=0; d<asMonths.size(); d++ )
{
int dn = atoi(asMonths[d].c_str());
if(!(dn < 1 || dn > 12)) // ignore if date is out of range
{
m_bgainfo[bgano].songmonths.push_back(dn);
}
}
// for(d=0; d<info.songmonths.size(); d++)
// {
// LOG->Trace("SongMonth: %d",info.songmonths[d]);
// }
}
// foot meter ratings
if(!asSplitLine[0].CompareNoCase("songdifficulty") && asSplitLine.size() > 1)
{
CStringArray asDifficulties;
split( asSplitLine[1], ",", asDifficulties );
for(unsigned d=0;d<asDifficulties.size();d++)
{
// check to see if the last character is a +
bool bHandled = false;
if(asDifficulties[d].c_str()[strlen(asDifficulties[d].c_str())-1] == '+')
{
bHandled = true;
CStringArray asVal;
split(asDifficulties[d],"+",asVal);
int temp=0;
temp = 0 - atoi(asVal[0].c_str()); // negative numbers will indicate 'greater than' for this system
m_bgainfo[bgano].songmeters.push_back(temp);
}
if(!bHandled) // didnt find the + (gt) so find a - (range)
{
bool isarange=false;
for(unsigned b=0; b<strlen(asDifficulties[d].c_str());b++)
{
if(asDifficulties[d].c_str()[b] == '-')
{
bHandled = isarange = true;
break;
}
}
if(isarange)
{
CStringArray asVal;
split(asDifficulties[d],"-",asVal);
int imin=0,imax=0,itmp=0;
imin=atoi(asVal[0].c_str());
imax=atoi(asVal[1].c_str());
itmp=imin;
while(itmp<=imax) // fill in the values between the min and max range inclusive
{
m_bgainfo[bgano].songmeters.push_back(itmp);
itmp++;
}
}
}
if(!bHandled) // its not a range so must be a value on its own
{
int tmp = atoi(asDifficulties[d].c_str());
m_bgainfo[bgano].songmeters.push_back(tmp);
}
}
}
// mods that mustn't be present
if(!asSplitLine[0].CompareNoCase("moddisallow") && asSplitLine.size() > 1)
{
m_bgainfo[bgano].dpoused = true;
m_bgainfo[bgano].disallowedpo.FromString(asSplitLine[1]);
}
// heavy, light e.t.c.
if(!asSplitLine[0].CompareNoCase("songrating") && asSplitLine.size() > 1)
{
CStringArray asDifficulties;
split( asSplitLine[1], ",", asDifficulties );
for( unsigned d=0; d<asDifficulties.size(); d++ )
{
m_bgainfo[bgano].difficulties.push_back(StringToDifficulty(asDifficulties[d]));
}
// for(d=0; d<info.difficulties.size(); d++)
// {
// LOG->Trace("Difficulty: %d",info.difficulties[d]);
// }
}
if(!asSplitLine[0].CompareNoCase("grade") && asSplitLine.size() > 1)
{
CStringArray asGrades;
split( asSplitLine[1], ",", asGrades );
for( unsigned d=0; d<asGrades.size(); d++ )
{
m_bgainfo[bgano].grades.push_back(StringToGrade(asGrades[d]));
}
}
if(!asSplitLine[0].CompareNoCase("style") && asSplitLine.size() > 1)
{
LOG->Info("Comparing Styles");
CStringArray asStyles;
split( asSplitLine[1], ",", asStyles );
for( unsigned d=0; d<asStyles.size(); d++ )
{
LOG->Info("Style:%s (%d) (current: %d)",asStyles[d].c_str(),GAMEMAN->GameAndStringToStyle(GAMESTATE->m_CurGame,asStyles[d]),GAMESTATE->m_CurStyle);
m_bgainfo[bgano].styles.push_back(GAMEMAN->GameAndStringToStyle(GAMESTATE->m_CurGame,asStyles[d]));
}
}
}
}
if(bganimtouse.CompareNoCase("")!=0)
{
LOG->Info("Best Match BGA Was: %s",bganimtouse.c_str());
bganim.LoadFromAniDir( THEME->GetPathToB(bganimtouse) );
}
}
file.Close();
}
void ConditionalBGA::Update( float fDeltaTime )
{
bganim.Update(fDeltaTime);
}
void ConditionalBGA::DrawPrimitives()
{
bganim.Draw();
}
void ConditionalBGA::ClearINFO(int iEntry)
{
m_bgainfo[iEntry].bganame = "";
m_bgainfo[iEntry].songtitle = "";
m_bgainfo[iEntry].songartist = "";
m_bgainfo[iEntry].songdays.clear();
m_bgainfo[iEntry].songdows.clear();
m_bgainfo[iEntry].songmeters.clear();
m_bgainfo[iEntry].difficulties.clear();
m_bgainfo[iEntry].songmonths.clear();
m_bgainfo[iEntry].styles.clear();
m_bgainfo[iEntry].cleared = CBGA_CSUNUSED;
m_bgainfo[iEntry].dpoused = false;
}
void ConditionalBGA::CheckBgaRequirements(BgaCondInfo info)
{
LOG->Trace("Checking Conditions For BGA: %s",info.bganame.c_str());
/*
for(unsigned d=0; d<info.difficulties.size(); d++)
{
LOG->Trace("Difficulty: %d",info.difficulties[d]);
}
for(d=0; d<info.songmonths.size(); d++)
{
LOG->Trace("SongMonth: %d",info.songmonths[d]);
}
for(d=0; d<info.songdays.size(); d++)
{
LOG->Trace("SongDay: %d",info.songdays[d]);
}
LOG->Trace("Clear Conditon: %d",info.cleared);
LOG->Trace("SongTitle: %s",info.songtitle.c_str());
LOG->Trace("SongArtist: %s",info.songartist.c_str());
*/
bool valid = true; // valid until proven otherwise.
bool hasconditions = false; // if there is a bga with no conditions for display
// then we dont want it to appear
if(info.songtitle.CompareNoCase("")!=0) // not equal
{
// LOG->Info("COMP: %s",info.songtitle.c_str());
hasconditions = true;
if(GAMESTATE->m_pCurSong != NULL)
{
if(!GAMESTATE->m_pCurSong->m_sMainTitle.CompareNoCase(info.songtitle))
{
LOG->Info("SongTitle Matches");
// valid
}
else
valid = false; // different song
}
else // song not being played at the time
{
valid = false;
}
}
if(info.songartist.CompareNoCase("")!=0 && valid) // not equal
{
// LOG->Info("COMP: %s",info.songtitle.c_str());
hasconditions = true;
if(GAMESTATE->m_pCurSong != NULL)
{
if(!GAMESTATE->m_pCurSong->m_sArtist.CompareNoCase(info.songartist))
{
LOG->Info("SongArtist Matches");
// valid
}
else
valid = false; // different song
}
else // song not being played at the time
{
valid = false;
}
}
if(!info.difficulties.empty() && valid) // dont bother checking any more if its already been invalidated.
{
// LOG->Info("Checking Difficulties");
hasconditions = true;
bool foundmatchingdiff=false;
for(unsigned d=0;d<info.difficulties.size();d++)
{
for(unsigned pn=0; pn<NUM_PLAYERS;pn++)
{
if(GAMESTATE->IsPlayerEnabled(pn))
{
if(GAMESTATE->m_pCurNotes[pn] != NULL)
{
if(GAMESTATE->m_pCurNotes[pn]->GetDifficulty() == info.difficulties[d])
{
foundmatchingdiff = true;
LOG->Info("Found Valid Difficulty");
}
}
}
}
}
valid = foundmatchingdiff;
}
if(info.dpoused)
{
PlayerOptions po = info.disallowedpo;
bool bModsValid = true;
for(unsigned pn=0;pn<NUM_PLAYERS;pn++)
{
if(GAMESTATE->IsPlayerEnabled(pn))
{
for(unsigned md=0;md<PlayerOptions::NUM_ACCELS;md++)
{
if(po.m_fAccels[md] != 0.0f && GAMESTATE->m_PlayerOptions[pn].m_fAccels[md] != 0.0f)
{
bModsValid=false;
LOG->Info("Found Invalid Accel Mod");
}
}
for(md=0;md<PlayerOptions::NUM_EFFECTS;md++)
{
if(po.m_fEffects[md] != 0.0f && GAMESTATE->m_PlayerOptions[pn].m_fEffects[md] != 0.0f)
{
bModsValid=false;
LOG->Info("Found Invalid Effect Mod");
}
}
for(md=0;md<PlayerOptions::NUM_APPEARANCES;md++)
{
if(po.m_fAppearances[md] != 0.0f && GAMESTATE->m_PlayerOptions[pn].m_fAppearances[md] != 0.0f)
{
bModsValid=false;
LOG->Info("Found Invalid Appearance Mod");
}
}
if((po.m_Turn != PlayerOptions::TURN_NONE) && (po.m_Turn == GAMESTATE->m_PlayerOptions[pn].m_Turn))
{
bModsValid=false;
LOG->Info("Found Invalid Turn Mod");
}
for(md=0;md<PlayerOptions::NUM_TRANSFORMS;md++)
{
if(po.m_bTransforms[md] != 0.0f && GAMESTATE->m_PlayerOptions[pn].m_bTransforms[md] != 0.0f)
{
bModsValid=false;
LOG->Info("Found Invalid Transform Mod");
}
}
}
}
valid = bModsValid;
}
if(!info.songmeters.empty() && valid) // dont bother checking any more if its already been invalidated.
{
hasconditions = true;
bool foundmatchingmeter=false;
for(unsigned d=0;d<info.songmeters.size();d++)
{
LOG->Info("MeterRating: %d",info.songmeters[d]);
for(int pn=0;pn<NUM_PLAYERS;pn++)
{
if(GAMESTATE->IsPlayerEnabled(pn))
{
if(GAMESTATE->m_pCurNotes[pn] != NULL)
{
if(info.songmeters[d] < 0) // negative values stored mean we want to check a value greaterthan or equal to its negative
{
// first make it positive then check to see if the footrating is >= to it
int tmp = 0 - info.songmeters[d];
if(GAMESTATE->m_pCurNotes[pn]->GetMeter() >= tmp)
{
LOG->Info("Found Valid MeterRating");
foundmatchingmeter = true;
}
}
else if(GAMESTATE->m_pCurNotes[pn]->GetMeter() == info.songmeters[d])
{
LOG->Info("Found Valid MeterRating");
foundmatchingmeter = true;
}
}
}
}
}
valid = foundmatchingmeter;
}
if(!info.styles.empty() && valid)
{
hasconditions = true;
bool foundmatchingstyle=false;
for(unsigned d=0;d<info.styles.size();d++)
{
LOG->Info("info.styles = %d m_CurStyle = %d",info.styles[d],GAMESTATE->m_CurStyle);
if(info.styles[d] == GAMESTATE->m_CurStyle)
{
foundmatchingstyle = true;
LOG->Info("Found Valid Style");
}
}
valid = foundmatchingstyle;
}
if(!info.grades.empty() && valid) // dont bother checking any more if its already been invalidated.
{
// LOG->Info("Checking Difficulties");
hasconditions = true;
bool foundmatchinggrades=true; // assume true until proven otherwise
if(info.grades.size() == 1) // only looking for a single grade
{
LOG->Info("Checking Single Grade");
bool foundaplayerwithgrade = false;
for(unsigned pn=0; pn<NUM_PLAYERS;pn++)
{
if(GAMESTATE->IsPlayerEnabled(pn))
{
if(g_CurStageStats.GetGrade((PlayerNumber)pn) == info.grades[0])
{
LOG->Info("Found Valid Grade");
foundaplayerwithgrade = true;
}
}
}
foundmatchinggrades = foundaplayerwithgrade;
}
else if(g_vPlayedStageStats.size() < info.grades.size()) // we've not played enough stages to achieve a grade history condition
{
LOG->Info("Not Enough Stages Played To Compare Grade History");
foundmatchinggrades = false;
}
else // we have to check the history of grades to ensure they met the spec asked
{
LOG->Info("Checking Grade History");
LOG->Info("Stage Stats Size: %d NumConditionalGrades: %d",g_vPlayedStageStats.size(),info.grades.size());
bool foundavalidgradeforstage = false;
for(unsigned d=info.grades.size()-1,g=g_vPlayedStageStats.size()-1;d>0;d--,g--)
{
if(d>g) ASSERT(0); // this should never happen.
for(unsigned pn=0; pn<NUM_PLAYERS;pn++)
{
if(GAMESTATE->IsPlayerEnabled((PlayerNumber)pn))
{
LOG->Info("Player%d Grade: %d :: Expected Grade: %d",pn,g_vPlayedStageStats[g].GetGrade((PlayerNumber)pn),info.grades[d]);
if(g_vPlayedStageStats[g].GetGrade((PlayerNumber)pn) == info.grades[d])
{
LOG->Info("One Valid Grade");
foundavalidgradeforstage = true;
}
}
}
}
foundmatchinggrades = foundavalidgradeforstage;
}
valid = foundmatchinggrades;
}
if(!info.songmonths.empty() && valid)
{
time_t rawtime;
time(&rawtime);
struct tm* ptm = localtime(&rawtime);
int month = ptm->tm_mon; /* Month 0..11 */
LOG->Info("Month: %d",month);
bool foundvalidmonth = false;
for(unsigned d=0;d<info.songmonths.size();d++)
{
LOG->Info("Month: %d, THIS Month: %d",info.songmonths[d],month);
if(info.songmonths[d] == month)
{
foundvalidmonth = true;
LOG->Info("Found Valid Month");
}
}
valid = foundvalidmonth;
}
if(!info.songdays.empty() && valid)
{
time_t rawtime;
time(&rawtime);
struct tm* ptm = localtime(&rawtime);
int day = ptm->tm_mday; /* day in the month */
LOG->Info("DAy: %d",day);
bool foundvalidday = false;
for(unsigned d=0;d<info.songdays.size();d++)
{
LOG->Info("Day: %d, THIS Day: %d",info.songdays[d],day);
if(info.songdays[d] == day)
{
foundvalidday = true;
LOG->Info("Found Valid Day");
}
}
valid = foundvalidday;
}
if(info.cleared != CBGA_CSUNUSED && valid) // already found invalid? forget it :>
{
bool foundclearcond = false;
if(info.cleared == CBGA_CSFAILED)
{
if(GAMESTATE->AllAreDead() || g_CurStageStats.AllFailed()) // they met the fail condition
{
LOG->Info("Failed Condition");
foundclearcond = true;
}
}
else if(info.cleared == CBGA_CSCLEARED)
{
if(!g_CurStageStats.AllFailed() || !GAMESTATE->AllAreDead() ) // stage was cleared
{
LOG->Info("Cleared Condition");
foundclearcond = true;
}
}
else if(info.cleared == CBGA_CSMAXCOMBO)
{
for(unsigned pn=0;pn<NUM_PLAYERS;pn++)
if(GAMESTATE->IsPlayerEnabled(pn))
if(g_CurStageStats.FullCombo((PlayerNumber)pn))
{
foundclearcond = true;
LOG->Info("MaxCombo Condition");
}
}
else if(info.cleared == CBGA_CSBROKECOMBO)
{
for(unsigned pn=0;pn<NUM_PLAYERS;pn++)
if(GAMESTATE->IsPlayerEnabled(pn))
if(!g_CurStageStats.FullCombo((PlayerNumber)pn))
{
LOG->Info("BrokenCombo Condition");
foundclearcond = true;
}
}
valid = foundclearcond;
}
if(valid && hasconditions)
{
LOG->Info("Valid");
bganimtouse = info.bganame;
}
}
+56
View File
@@ -0,0 +1,56 @@
#ifndef CONDITIONALBGA_H
#define CONDITIONALBGA_H
#include "Style.h"
#include "PlayerOptions.h"
//#include "StyleDef.h"
enum CBGACLEAREDSTATES
{
CBGA_CSUNUSED = 0, // unused is if the condition doesnt matter
CBGA_CSCLEARED, // if the player must have cleared the stage
CBGA_CSFAILED, // if the player must have failed the stage
CBGA_CSMAXCOMBO, // if the player cleared the song with full combo
CBGA_CSBROKECOMBO // if the player cleared the song with a broken combo
};
struct BgaCondInfo
{
// char bganame[512];
CString bganame;
// char songtitle[512];
CString songtitle;
// char songartist[512];
CString songartist;
int cleared;
vector<Difficulty> difficulties; // heavy, light e.t.c.
vector<int> songmeters; // footmeter
vector<int> songdays;
vector<int> songdows;
vector<int> songmonths;
vector<int> grades;
vector<Style> styles;
PlayerOptions disallowedpo;
bool dpoused; // indicate if disallowed po has been set
};
class ConditionalBGA
{
public:
ConditionalBGA();
~ConditionalBGA();
void Load(CString szScreenName);
void Update( float fDeltaTime );
void DrawPrimitives();
private:
void ClearINFO(int iEntry);
void CheckBgaRequirements(BgaCondInfo info);
vector<BgaCondInfo> m_bgainfo;
// BgaCondInfo bestmatch;
BGAnimation bganim;
CString bganimtouse;
};
#endif
+76 -19
View File
@@ -32,6 +32,7 @@
#include "ProfileManager.h"
#include "song.h"
#include "StageStats.h"
#include "Grade.h"
const int NUM_SCORE_DIGITS = 9;
@@ -77,6 +78,9 @@ const char* STATS_STRING[NUM_STATS_LINES] =
#define NUM_SEQUENCE_SOUNDS THEME->GetMetricI(m_sName,"NumSequenceSounds")
#define SOUNDSEQ_TIME( i ) THEME->GetMetricF(m_sName,ssprintf("SoundSeqTime%d", i+1))
#define SOUNDSEQ_NAME( i ) THEME->GetMetric (m_sName,ssprintf("SoundSeqName%d", i+1))
#define USE_GRADE_SPECIFIC_BG THEME->GetMetricB(m_sName,"UseGradeSpecificBG")
#define USE_STYLE_SPECIFIC_BG THEME->GetMetricB(m_sName,"UseStyleSpecificBG")
static const int NUM_SHOWN_RADAR_CATEGORIES = 5;
@@ -255,8 +259,8 @@ ScreenEvaluation::ScreenEvaluation( CString sClassName ) : Screen(sClassName)
//
// load pass/fail sound
//
if(m_Type==stage)
{
// if(m_Type==stage)
// {
int snd=0;
for(snd=0;snd<NUM_SEQUENCE_SOUNDS;snd++) // grab in any sound sequence the user may want to throw onto this screen
{
@@ -265,24 +269,68 @@ ScreenEvaluation::ScreenEvaluation( CString sClassName ) : Screen(sClassName)
temp.sSound.Load(THEME->GetPathToS(SOUNDSEQ_NAME(snd),false));
m_SoundSequences.push_back(temp);
}
}
// }
CString bgpath = m_sName;
m_bPassFailTriggered = false; // the sound hasn't been triggered yet
if(m_bFailed && m_Type==stage)
if(m_bFailed && (m_Type==stage||m_Type==course))
{
m_bgFailedBack.LoadFromAniDir( THEME->GetPathToB("ScreenEvaluationStage Failed Background") );
m_bgFailedOverlay.LoadFromAniDir( THEME->GetPathToB("ScreenEvaluationStage Failed Overlay") );
bgpath += " Failed Background";
m_bgFailedBack.LoadFromAniDir( THEME->GetPathToB(bgpath) );
bgpath = m_sName;
bgpath += " Failed Overlay";
m_bgFailedOverlay.LoadFromAniDir( THEME->GetPathToB(bgpath) );
m_sndPassFail.Load(THEME->GetPathToS("ScreenEvaluationStage Failed",false));
// m_sndPassFail.Play();
m_sndPassFail.Play(); // why was this commented out? the BGA's wont play sound so its a NEEDED element - Frieza
}
else if( m_Type == stage )
else if(m_Type==stage||m_Type==course)
{
bgpath += " Passed Overlay";
// the themer can use the regular background for passed background
m_bgPassedOverlay.LoadFromAniDir( THEME->GetPathToB("ScreenEvaluationStage Passed Overlay") );
m_bgPassedOverlay.LoadFromAniDir( THEME->GetPathToB(bgpath) );
m_sndPassFail.Load(THEME->GetPathToS("ScreenEvaluationStage Passed",false));
// m_sndPassFail.Play();
m_sndPassFail.Play();
}
m_bgCondBga.Load(m_sName);
// Special Background Stuff
/* if(m_Type == stage)
{
if(USE_GRADE_SPECIFIC_BG || USE_STYLE_SPECIFIC_BG) // put other 'whatever specific' checks here
{
CString bgpath = "ScreenEvaluationStage ";
if(USE_GRADE_SPECIFIC_BG) // individual check for grades
{
int highestgrade=GRADE_NO_DATA;
CString gradename = "";
unsigned pn=0;
for(pn=0;pn<NUM_PLAYERS;pn++)
{
if( GAMESTATE->IsPlayerEnabled( (PlayerNumber)pn ) )
{
int playergrade = stageStats.GetGrade((PlayerNumber)pn);
if(playergrade < highestgrade)
{
highestgrade = playergrade;
gradename = GradeToString((Grade)playergrade);
}
}
}
bgpath += gradename;
}
if(USE_STYLE_SPECIFIC_BG)
{
CString stylename = ssprintf("%d", GAMESTATE->m_CurStyle);
bgpath += stylename;
}
m_bgSpecialBack.LoadFromAniDir( THEME->GetPathToB(bgpath) );
}
}
*/
//
// load other sounds
//
@@ -1161,7 +1209,8 @@ void ScreenEvaluation::Update( float fDeltaTime )
{
Screen::Update( fDeltaTime );
if(m_bFailed && m_Type == stage)
m_bgCondBga.Update(fDeltaTime);
if(m_bFailed && (m_Type==stage||m_Type==course))
{
if( m_timerSoundSequences.Ago() > FAILED_SOUND_TIME && !m_bPassFailTriggered )
{
@@ -1171,7 +1220,7 @@ void ScreenEvaluation::Update( float fDeltaTime )
m_bgFailedBack.Update( fDeltaTime );
m_bgFailedOverlay.Update( fDeltaTime );
}
else if (m_Type == stage) // STAGE eval AND passed
else if (m_Type==stage||m_Type==course) // STAGE/NONSTOP eval AND passed
{
if( m_timerSoundSequences.Ago() > PASSED_SOUND_TIME && !m_bPassFailTriggered )
{
@@ -1182,8 +1231,8 @@ void ScreenEvaluation::Update( float fDeltaTime )
m_bgPassedOverlay.Update( fDeltaTime );
}
if(m_Type == stage) // stage eval ... pass / fail / whatever
{
// if(m_Type == stage) // stage eval ... pass / fail / whatever
// {
for( unsigned snd=0; snd<m_SoundSequences.size(); snd++ )
{
if(m_SoundSequences[snd].fTime != -1) // already played? skip...
@@ -1195,7 +1244,10 @@ void ScreenEvaluation::Update( float fDeltaTime )
}
}
}
}
// }
// if(USE_GRADE_SPECIFIC_BG)
// m_bgSpecialBack.Update(fDeltaTime);
for( int p=0; p<NUM_PLAYERS; p++)
{
@@ -1225,16 +1277,21 @@ void ScreenEvaluation::DrawPrimitives()
{
m_Menu.DrawBottomLayer();
m_bgCondBga.DrawPrimitives();
// draw the failed background here if the player(s) failed
if(m_bFailed && m_Type == stage)
if(m_bFailed && (m_Type==stage||m_Type==course))
m_bgFailedBack.Draw();
// draw any special backgrounds if the player failed.
// if(USE_GRADE_SPECIFIC_BG)
// m_bgSpecialBack.Draw();
Screen::DrawPrimitives();
// draw the pass / failed overlays here respectively
if(m_bFailed && m_Type == stage)
if(m_bFailed && (m_Type==stage||m_Type==course))
m_bgFailedOverlay.Draw();
else if (m_Type == stage)
else if (m_Type==stage||m_Type==course)
m_bgPassedOverlay.Draw();
m_Menu.DrawTopLayer();
+3 -1
View File
@@ -27,7 +27,7 @@
#include "ComboGraph.h"
#include "BGAnimation.h"
#include "ActorUtil.h"
#include "ConditionalBGA.h"
const int MAX_SONGS_TO_SHOW = 5; // In summary, we show last 3 stages, plus extra stages if passed
const int NUM_JUDGE_LINES = 9; // marvelous, perfect, great, good, boo, miss, ok, max_combo, error
@@ -69,6 +69,8 @@ protected:
BGAnimation m_bgFailedBack;
BGAnimation m_bgFailedOverlay;
BGAnimation m_bgPassedOverlay;
// BGAnimation m_bgSpecialBack;
ConditionalBGA m_bgCondBga;
MenuElements m_Menu;
+44 -29
View File
@@ -1,5 +1,5 @@
# Microsoft Developer Studio Project File - Name="StepMania" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 60000
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
@@ -82,29 +82,28 @@ PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania
# PROP Intermediate_Dir "../Debug_Xbox"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
CPP=cl.exe
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_XBOX" /D "_DEBUG" /YX /FD /G6 /Ztmp /c
# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "." /I "SDL-1.2.5\include" /I "SDL_image-1.2" /I "plib-1.6.0" /I "SDL_sound-1.0.0" /I "vorbis" /D "WIN32" /D "_DEBUG" /D "_XBOX" /D "OGG_ONLY" /D "DEBUG" /FR /YX"global.h" /FD /G6 /Ztmp /c
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
XBCP=xbecopy.exe
# ADD BASE XBCP /NOLOGO
# ADD XBCP /NOLOGO
XBE=imagebld.exe
# ADD BASE XBE /nologo /stack:0x10000 /debug
# ADD XBE /nologo /stack:0x10000 /debug /out:"../default.xbe"
LINK32=link.exe
# ADD BASE LINK32 xapilibd.lib d3d8d.lib d3dx8d.lib xgraphicsd.lib dsoundd.lib dmusicd.lib xnetd.lib xboxkrnl.lib /nologo /incremental:no /debug /machine:I386 /subsystem:xbox /fixed:no /TMP
# ADD LINK32 $(intdir)\verstub.obj xapilibd.lib d3d8d.lib d3dx8d.lib xgraphicsd.lib dsoundd.lib dmusicd.lib xnetd.lib xboxkrnl.lib /nologo /map /debug /machine:I386 /nodefaultlib:"libcd" /nodefaultlib:"libcmt" /out:"../StepManiaXbox-debug.exe" /subsystem:xbox /fixed:no /TMP
# SUBTRACT LINK32 /incremental:no
XBE=imagebld.exe
# ADD BASE XBE /nologo /stack:0x10000 /debug
# ADD XBE /nologo /stack:0x10000 /debug /out:"../default.xbe"
XBCP=xbecopy.exe
# ADD BASE XBCP /NOLOGO
# ADD XBCP /NOLOGO
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
CPP=cl.exe
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_XBOX" /D "_DEBUG" /YX /FD /G6 /Ztmp /c
# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "." /I "SDL-1.2.5\include" /I "SDL_image-1.2" /I "plib-1.6.0" /I "SDL_sound-1.0.0" /I "vorbis" /D "WIN32" /D "_DEBUG" /D "_XBOX" /D "OGG_ONLY" /D "DEBUG" /FR /YX"global.h" /FD /G6 /Ztmp /c
# Begin Special Build Tool
IntDir=.\../Debug_Xbox
TargetDir=\stepmania\stepmania
TargetName=default
SOURCE="$(InputPath)"
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c \
verstub.cpp /Fo$(IntDir)\
PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi ia32.vdi
# End Special Build Tool
@@ -162,30 +161,29 @@ PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania
# PROP Intermediate_Dir "../Release_Xbox"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
CPP=cl.exe
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /I "." /I "SDL-1.2.5\include" /I "SDL_image-1.2" /I "plib-1.6.0" /D "WIN32" /D "_XBOX" /D "_DEBUG" /Fr /YX"global.h" /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "." /I "SDL-1.2.5\include" /I "SDL_image-1.2" /I "plib-1.6.0" /I "SDL_sound-1.0.0" /I "vorbis" /D "WIN32" /D "NDEBUG" /D "_XBOX" /FR /YX /FD /c
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
XBCP=xbecopy.exe
# ADD BASE XBCP /NOLOGO
# ADD XBCP /NOLOGO
XBE=imagebld.exe
# ADD BASE XBE /nologo /stack:0x10000 /debug
# ADD XBE /nologo /testid:"123456" /stack:0x10000 /debug /out:"../default.xbe"
LINK32=link.exe
# ADD BASE LINK32 $(intdir)\verstub.obj xapilibd.lib d3d8d.lib d3dx8d.lib xgraphicsd.lib dsoundd.lib dmusicd.lib xnetd.lib xboxkrnl.lib /nologo /pdb:"../debug6/StepMania-debug.pdb" /map /debug /machine:IX86 /nodefaultlib:"libcmtd.lib" /out:"../StepMania-debug.exe"
# SUBTRACT BASE LINK32 /verbose /profile /pdb:none /incremental:no /nodefaultlib
# ADD LINK32 $(intdir)\verstub.obj xapilib.lib d3d8.lib d3dx8.lib xgraphics.lib dsound.lib dmusic.lib xnet.lib xboxkrnl.lib libcmt.lib /nologo /incremental:no /map /machine:I386 /nodefaultlib:"libc" /nodefaultlib:"libcmtd" /out:"../StepManiaXbox.exe" /subsystem:xbox /fixed:no /TMP /OPT:REF
# SUBTRACT LINK32 /pdb:none /debug
XBE=imagebld.exe
# ADD BASE XBE /nologo /stack:0x10000 /debug
# ADD XBE /nologo /testid:"123456" /stack:0x10000 /debug /out:"../default.xbe"
XBCP=xbecopy.exe
# ADD BASE XBCP /NOLOGO
# ADD XBCP /NOLOGO
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
CPP=cl.exe
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /I "." /I "SDL-1.2.5\include" /I "SDL_image-1.2" /I "plib-1.6.0" /D "WIN32" /D "_XBOX" /D "_DEBUG" /Fr /YX"global.h" /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "." /I "SDL-1.2.5\include" /I "SDL_image-1.2" /I "plib-1.6.0" /I "SDL_sound-1.0.0" /I "vorbis" /D "WIN32" /D "NDEBUG" /D "_XBOX" /FR /YX /FD /c
# Begin Special Build Tool
IntDir=.\../Release_Xbox
TargetDir=\stepmania\stepmania
TargetName=default
SOURCE="$(InputPath)"
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c \
verstub.cpp /Fo$(IntDir)\
PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi ia32.vdi
# End Special Build Tool
@@ -2879,8 +2877,6 @@ SOURCE=.\StepMania.cpp
!ELSEIF "$(CFG)" == "StepMania - Xbox Release"
# ADD CPP /D "OGG_ONLY"
!ENDIF
# End Source File
@@ -6031,6 +6027,25 @@ SOURCE=.\UnlockSystem.h
# End Group
# Begin Source File
SOURCE=.\ConditionalBGA.cpp
!IF "$(CFG)" == "StepMania - Win32 Debug"
!ELSEIF "$(CFG)" == "StepMania - Xbox Debug"
!ELSEIF "$(CFG)" == "StepMania - Win32 Release"
!ELSEIF "$(CFG)" == "StepMania - Xbox Release"
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\ConditionalBGA.h
# End Source File
# Begin Source File
SOURCE=.\cursor1.cur
# End Source File
# Begin Source File