updated unlock screen - now it can be configured to be MAX2-style (shows the numbers 1-30)
This commit is contained in:
@@ -1,3 +1,15 @@
|
|||||||
|
/*
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
Class: ScreenUnlock
|
||||||
|
|
||||||
|
Desc: See header.
|
||||||
|
|
||||||
|
Copyright (c) 2003 by the person(s) listed below. All rights reserved.
|
||||||
|
curewater
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "PrefsManager.h"
|
#include "PrefsManager.h"
|
||||||
#include "ScreenUnlock.h"
|
#include "ScreenUnlock.h"
|
||||||
@@ -6,22 +18,44 @@
|
|||||||
#include "RageLog.h"
|
#include "RageLog.h"
|
||||||
#include "UnlockSystem.h"
|
#include "UnlockSystem.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ScreenUnlock::ScreenUnlock() : ScreenAttract("ScreenUnlock")
|
ScreenUnlock::ScreenUnlock() : ScreenAttract("ScreenUnlock")
|
||||||
{
|
{
|
||||||
LOG->Trace("ScreenUnlock::ScreenUnlock()");
|
LOG->Trace("ScreenUnlock::ScreenUnlock()");
|
||||||
PointsUntilNextUnlock.LoadFromFont( THEME->GetPathToF("Common normal") );
|
PointsUntilNextUnlock.LoadFromFont( THEME->GetPathToF("Common normal") );
|
||||||
PointsUntilNextUnlock.SetHorizAlign( Actor::align_left );
|
PointsUntilNextUnlock.SetHorizAlign( Actor::align_left );
|
||||||
|
|
||||||
CString sDP = ssprintf( "%f", GAMESTATE->m_pUnlockingSys->NumPointsUntilNextUnlock() );
|
CString sDP = ssprintf( "%d", (int)GAMESTATE->m_pUnlockingSys->NumPointsUntilNextUnlock() );
|
||||||
|
|
||||||
// Remove the decimal
|
for(int i=1; i <= THEME->GetMetricI("ScreenUnlock", "NumUnlocks"); i++)
|
||||||
|
{
|
||||||
|
// new unlock graphic
|
||||||
|
char filename[30];
|
||||||
|
|
||||||
|
sprintf(filename, "UnlockGraphic%d", i);
|
||||||
|
Unlocks[i].Load( THEME->GetPathToG(filename) );
|
||||||
|
|
||||||
|
sprintf(filename, "Unlock%d", i);
|
||||||
|
PointsUntilNextUnlock.SetXY(
|
||||||
|
THEME->GetMetricI("ScreenUnlock",ssprintf("Unlock%dX", i)),
|
||||||
|
THEME->GetMetricI("ScreenUnlock",ssprintf("Unlock%dX", i)) );
|
||||||
|
|
||||||
|
Unlocks[i].SetName( ssprintf("Unlock%d",i) );
|
||||||
|
|
||||||
|
UtilSetXY( Unlocks[i], "ScreenUnlock" );
|
||||||
|
|
||||||
|
if (!GAMESTATE->m_pUnlockingSys->SongIsLocked
|
||||||
|
(THEME->GetMetric
|
||||||
|
("ScreenUnlock", ssprintf
|
||||||
|
("Unlock%dSong", i))))
|
||||||
|
this->AddChild(&Unlocks[i]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Remove the decimal
|
||||||
if( sDP.Find(".",1) > 0 )
|
if( sDP.Find(".",1) > 0 )
|
||||||
{
|
{
|
||||||
sDP = sDP.Left(sDP.Find(".",1));
|
sDP = sDP.Left(sDP.Find(".",1));
|
||||||
}
|
} no longer necessary since its an int*/
|
||||||
|
|
||||||
// No negative numbers
|
// No negative numbers
|
||||||
if( sDP.Left(1) == "-" )
|
if( sDP.Left(1) == "-" )
|
||||||
|
|||||||
@@ -6,12 +6,15 @@
|
|||||||
|
|
||||||
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
||||||
Chris Danford
|
Chris Danford
|
||||||
|
curewater
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
#include "ScreenAttract.h"
|
#include "ScreenAttract.h"
|
||||||
#include "GameConstantsAndTypes.h" // for NUM_RANKING_LINES
|
#include "GameConstantsAndTypes.h" // for NUM_RANKING_LINES
|
||||||
#include "Style.h"
|
#include "Style.h"
|
||||||
|
#include "ActorUtil.h"
|
||||||
|
|
||||||
|
#define NUM_UNLOCKS 30
|
||||||
|
|
||||||
class Course;
|
class Course;
|
||||||
|
|
||||||
@@ -22,4 +25,5 @@ public:
|
|||||||
ScreenUnlock();
|
ScreenUnlock();
|
||||||
protected:
|
protected:
|
||||||
BitmapText PointsUntilNextUnlock;
|
BitmapText PointsUntilNextUnlock;
|
||||||
|
Sprite Unlocks[NUM_UNLOCKS]; // support 30 unlocks right now
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
Copyright (c) 2001-2003 by the person(s) listed below. All rights reserved.
|
Copyright (c) 2001-2003 by the person(s) listed below. All rights reserved.
|
||||||
Kevin Slaughter
|
Kevin Slaughter
|
||||||
|
curewater
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -21,8 +22,6 @@ using namespace std;
|
|||||||
|
|
||||||
#include "stdio.h"
|
#include "stdio.h"
|
||||||
|
|
||||||
// #define POINTS_ACCUMULATED_BEFORE_LAST_ROUND // Load from file here
|
|
||||||
|
|
||||||
UnlockSystem::UnlockSystem()
|
UnlockSystem::UnlockSystem()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -32,6 +31,7 @@ bool UnlockSystem::SongIsLocked( CString sSongName )
|
|||||||
{
|
{
|
||||||
sSongName.MakeUpper(); //Avoid case-sensitive problems
|
sSongName.MakeUpper(); //Avoid case-sensitive problems
|
||||||
|
|
||||||
|
// searches for song in unlock list
|
||||||
for(unsigned i = 0; i < m_SongEntries.size(); i++)
|
for(unsigned i = 0; i < m_SongEntries.size(); i++)
|
||||||
if (m_SongEntries[i].m_sSongName == sSongName)
|
if (m_SongEntries[i].m_sSongName == sSongName)
|
||||||
return m_SongEntries[i].isLocked;
|
return m_SongEntries[i].isLocked;
|
||||||
@@ -50,40 +50,6 @@ bool UnlockSystem::SongIsRoulette( CString sSongName )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* These don't appear to be used. If you need them, I'd suggest making them
|
|
||||||
* members. They also need return types. */
|
|
||||||
#if 0
|
|
||||||
operator == (const SongEntry &a, const SongEntry &b)
|
|
||||||
{
|
|
||||||
return a.m_sSongName == b.m_sSongName;
|
|
||||||
}
|
|
||||||
|
|
||||||
operator != (const SongEntry &a, const SongEntry &b)
|
|
||||||
{
|
|
||||||
return a.m_sSongName != b.m_sSongName;
|
|
||||||
}
|
|
||||||
|
|
||||||
operator >= (const SongEntry &a, const SongEntry &b)
|
|
||||||
{
|
|
||||||
return a.m_sSongName >= b.m_sSongName;
|
|
||||||
}
|
|
||||||
|
|
||||||
operator <= (const SongEntry &a, const SongEntry &b)
|
|
||||||
{
|
|
||||||
return a.m_sSongName <= b.m_sSongName;
|
|
||||||
}
|
|
||||||
|
|
||||||
operator > (const SongEntry &a, const SongEntry &b)
|
|
||||||
{
|
|
||||||
return a.m_sSongName > b.m_sSongName;
|
|
||||||
}
|
|
||||||
|
|
||||||
operator < (const SongEntry &a, const SongEntry &b)
|
|
||||||
{
|
|
||||||
return a.m_sSongName <= b.m_sSongName;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
SongEntry::SongEntry()
|
SongEntry::SongEntry()
|
||||||
{
|
{
|
||||||
m_fDancePointsRequired = 0;
|
m_fDancePointsRequired = 0;
|
||||||
@@ -108,7 +74,7 @@ bool UnlockSystem::ParseRow(CString text, CString &type, float &qty,
|
|||||||
CString &songname)
|
CString &songname)
|
||||||
{
|
{
|
||||||
int pos = -1;
|
int pos = -1;
|
||||||
int end;
|
int end = text.GetLength(); // sets a value in case | does not exist
|
||||||
char unlock_type[4];
|
char unlock_type[4];
|
||||||
char qty_text[20];
|
char qty_text[20];
|
||||||
|
|
||||||
@@ -128,6 +94,9 @@ bool UnlockSystem::ParseRow(CString text, CString &type, float &qty,
|
|||||||
* I havn't looked at this code to see if it's a problem, but I don't want
|
* I havn't looked at this code to see if it's a problem, but I don't want
|
||||||
* to simply silence the warning without being sure. (Can this just be
|
* to simply silence the warning without being sure. (Can this just be
|
||||||
* a standard INI--does it actually need to be another file format?) -glenn */
|
* a standard INI--does it actually need to be another file format?) -glenn */
|
||||||
|
|
||||||
|
// glenn: ok, i set it at the beginning.
|
||||||
|
|
||||||
songname = text.Right(text.GetLength() - 1 - end);
|
songname = text.Right(text.GetLength() - 1 - end);
|
||||||
|
|
||||||
sscanf(text, "%s %s|", unlock_type, qty_text);
|
sscanf(text, "%s %s|", unlock_type, qty_text);
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
#ifndef UNLOCK_SYSTEM_H
|
#ifndef UNLOCK_SYSTEM_H
|
||||||
#define UNLOCK_SYSTEM_H
|
#define UNLOCK_SYSTEM_H
|
||||||
|
|
||||||
#include "Grade.h"
|
#include "grade.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
Class: UnlockSystem
|
Class: UnlockSystem
|
||||||
|
|
||||||
Desc: See header.
|
Desc: The unlock system for Stepmania.
|
||||||
|
|
||||||
Copyright (c) 2001-2003 by the person(s) listed below. All rights reserved.
|
Copyright (c) 2001-2003 by the person(s) listed below. All rights reserved.
|
||||||
Kevin Slaughter
|
Kevin Slaughter
|
||||||
|
curewater
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
enum UnlockTypes { UNLOCK_AP, UNLOCK_DP, UNLOCK_SP,
|
enum UnlockTypes { UNLOCK_AP, UNLOCK_DP, UNLOCK_SP,
|
||||||
@@ -23,7 +23,8 @@ struct SongEntry
|
|||||||
for a lot easier compatibility since a lot of people's
|
for a lot easier compatibility since a lot of people's
|
||||||
song folders are named differantly, song names tend to
|
song folders are named differantly, song names tend to
|
||||||
be the same in the file.*/
|
be the same in the file.*/
|
||||||
float m_fDancePointsRequired; // Amount of Dance Points needed to unlock this song
|
|
||||||
|
float m_fDancePointsRequired; // Ways to unlock/lock songs.
|
||||||
float m_fArcadePointsRequired;
|
float m_fArcadePointsRequired;
|
||||||
float m_fSongPointsRequired;
|
float m_fSongPointsRequired;
|
||||||
float m_fExtraStagesCleared;
|
float m_fExtraStagesCleared;
|
||||||
@@ -32,14 +33,15 @@ struct SongEntry
|
|||||||
float m_fToastysSeen;
|
float m_fToastysSeen;
|
||||||
int m_iRouletteSeed;
|
int m_iRouletteSeed;
|
||||||
|
|
||||||
bool isLocked;
|
bool isLocked; // cached locked tag
|
||||||
|
|
||||||
SongEntry();
|
SongEntry();
|
||||||
|
|
||||||
|
// if song is selectable vai two means
|
||||||
bool SelectableWheel();
|
bool SelectableWheel();
|
||||||
bool SelectableRoulette();
|
bool SelectableRoulette();
|
||||||
|
|
||||||
bool updateLocked();
|
bool updateLocked(); //updates isLocked flag
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -51,9 +53,9 @@ public:
|
|||||||
bool SongIsLocked( CString sSongName );
|
bool SongIsLocked( CString sSongName );
|
||||||
bool SongIsRoulette( CString sSongName );
|
bool SongIsRoulette( CString sSongName );
|
||||||
bool LoadFromDATFile( CString sPath );
|
bool LoadFromDATFile( CString sPath );
|
||||||
// bool m_bAllSongsAreUnlocked; // Quick way to check if all songs are unlocked
|
|
||||||
vector<SongEntry> m_SongEntries; // All locked songs are stored here
|
vector<SongEntry> m_SongEntries; // All locked songs are stored here
|
||||||
|
|
||||||
|
// functions that add to values, which don't really work.
|
||||||
float UnlockAddAP(Grade credit);
|
float UnlockAddAP(Grade credit);
|
||||||
float UnlockAddDP(float credit);
|
float UnlockAddDP(float credit);
|
||||||
float UnlockAddSP(Grade credit);
|
float UnlockAddSP(Grade credit);
|
||||||
@@ -64,7 +66,7 @@ public:
|
|||||||
bool UnlockRouletteSeed(int seed);
|
bool UnlockRouletteSeed(int seed);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void SortSongEntriesArray();
|
void SortSongEntriesArray(); // sorts unlocks
|
||||||
bool ParseRow(CString text, CString &type, float &qty, CString &songname);
|
bool ParseRow(CString text, CString &type, float &qty, CString &songname);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user