add simple unlock screens
This commit is contained in:
@@ -76,6 +76,8 @@ ScreenStage.cpp ScreenStage.h \
|
||||
ScreenTest.cpp ScreenTest.h ScreenTestFonts.cpp ScreenTestFonts.h ScreenTestInput.cpp ScreenTestInput.h \
|
||||
ScreenTestLights.cpp ScreenTestLights.h ScreenTestSound.cpp ScreenTestSound.h ScreenTextEntry.cpp ScreenTextEntry.h \
|
||||
ScreenTitleMenu.cpp ScreenTitleMenu.h \
|
||||
ScreenUnlockBrowse.cpp ScreenUnlockBrowse.h \
|
||||
ScreenUnlockCelebrate.cpp ScreenUnlockCelebrate.h \
|
||||
ScreenUnlockStatus.cpp ScreenUnlockStatus.h \
|
||||
ScreenWithMenuElements.cpp ScreenWithMenuElements.h
|
||||
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
#include "global.h"
|
||||
#include "ScreenUnlockBrowse.h"
|
||||
#include "UnlockManager.h"
|
||||
|
||||
|
||||
REGISTER_SCREEN_CLASS( ScreenUnlockBrowse );
|
||||
|
||||
void ScreenUnlockBrowse::Init()
|
||||
{
|
||||
// fill m_aGameCommands before calling Init()
|
||||
FOREACH_CONST( UnlockEntry, UNLOCKMAN->m_UnlockEntries, ue )
|
||||
{
|
||||
GameCommand gc;
|
||||
if( !ue->IsLocked() )
|
||||
gc.m_bInvalid = false;
|
||||
gc.m_iIndex = ue - UNLOCKMAN->m_UnlockEntries.begin();
|
||||
gc.m_iUnlockEntryID = ue->m_iEntryID;
|
||||
gc.m_sName = ssprintf("%d",ue->m_iEntryID);
|
||||
|
||||
m_aGameCommands.push_back( gc );
|
||||
}
|
||||
|
||||
ScreenSelectMaster::Init();
|
||||
}
|
||||
|
||||
void ScreenUnlockBrowse::MenuStart( PlayerNumber pn )
|
||||
{
|
||||
this->PostScreenMessage( SM_BeginFadingOut, 0 );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* (c) 2006 Chris Danford
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, and/or sell copies of the Software, and to permit persons to
|
||||
* whom the Software is furnished to do so, provided that the above
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
||||
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
||||
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
@@ -0,0 +1,39 @@
|
||||
#ifndef ScreenUnlockBrowse_H
|
||||
#define ScreenUnlockBrowse_H
|
||||
|
||||
#include "ScreenSelectMaster.h"
|
||||
|
||||
class ScreenUnlockBrowse : public ScreenSelectMaster
|
||||
{
|
||||
public:
|
||||
virtual void Init();
|
||||
virtual void MenuStart( PlayerNumber pn );
|
||||
protected:
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* (c) 2006 Chris Danford
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, and/or sell copies of the Software, and to permit persons to
|
||||
* whom the Software is furnished to do so, provided that the above
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
||||
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
||||
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
@@ -0,0 +1,65 @@
|
||||
#include "global.h"
|
||||
#include "ScreenUnlockCelebrate.h"
|
||||
#include "UnlockManager.h"
|
||||
|
||||
|
||||
REGISTER_SCREEN_CLASS( ScreenUnlockCelebrate );
|
||||
|
||||
void ScreenUnlockCelebrate::Init()
|
||||
{
|
||||
// We shouldn't be called if there aren't any unlocks to celebrate
|
||||
ASSERT( UNLOCKMAN->AnyUnlocksToCelebrate() );
|
||||
|
||||
ScreenUnlockBrowse::Init();
|
||||
|
||||
// Mark this unlock as celebrated
|
||||
int iIndex = UNLOCKMAN->GetUnlockIndexToCelebrate();
|
||||
UNLOCKMAN->m_UnlockEntries[iIndex].m_bCelebrated = true;
|
||||
}
|
||||
|
||||
void ScreenUnlockCelebrate::MenuLeft( const InputEventPlus &input )
|
||||
{
|
||||
}
|
||||
|
||||
void ScreenUnlockCelebrate::MenuRight( const InputEventPlus &input )
|
||||
{
|
||||
}
|
||||
|
||||
void ScreenUnlockCelebrate::MenuUp( const InputEventPlus &input )
|
||||
{
|
||||
}
|
||||
|
||||
void ScreenUnlockCelebrate::MenuDown( const InputEventPlus &input )
|
||||
{
|
||||
}
|
||||
|
||||
void ScreenUnlockCelebrate::MenuBack( PlayerNumber pn )
|
||||
{
|
||||
this->MenuStart(pn);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* (c) 2006 Chris Danford
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, and/or sell copies of the Software, and to permit persons to
|
||||
* whom the Software is furnished to do so, provided that the above
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
||||
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
||||
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
@@ -0,0 +1,43 @@
|
||||
#ifndef ScreenUnlockCelebrate_H
|
||||
#define ScreenUnlockCelebrate_H
|
||||
|
||||
#include "ScreenUnlockBrowse.h"
|
||||
|
||||
class ScreenUnlockCelebrate : public ScreenUnlockBrowse
|
||||
{
|
||||
public:
|
||||
virtual void Init();
|
||||
virtual void MenuLeft( const InputEventPlus &input );
|
||||
virtual void MenuRight( const InputEventPlus &input );
|
||||
virtual void MenuUp( const InputEventPlus &input );
|
||||
virtual void MenuDown( const InputEventPlus &input );
|
||||
virtual void MenuBack( PlayerNumber pn );
|
||||
protected:
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* (c) 2006 Chris Danford
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, and/or sell copies of the Software, and to permit persons to
|
||||
* whom the Software is furnished to do so, provided that the above
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
||||
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
||||
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
@@ -709,6 +709,18 @@ cl /Zl /nologo /c verstub.cpp /Fo"$(IntDir)"\
|
||||
<File
|
||||
RelativePath="ScreenTitleMenu.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ScreenUnlockBrowse.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ScreenUnlockBrowse.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ScreenUnlockCelebrate.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ScreenUnlockCelebrate.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ScreenUnlockStatus.cpp">
|
||||
</File>
|
||||
|
||||
+18
-10
@@ -62,7 +62,7 @@ IntDir=.\../Debug6
|
||||
TargetDir=\cvs\stepmania\Program
|
||||
TargetName=StepMania-debug
|
||||
SOURCE="$(InputPath)"
|
||||
PreLink_Cmds=archutils\Win32\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
|
||||
PreLink_Cmds=archutils\Win32\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
|
||||
PostBuild_Cmds=archutils\Win32\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi
|
||||
# End Special Build Tool
|
||||
|
||||
@@ -99,7 +99,7 @@ IntDir=.\../Release6
|
||||
TargetDir=\cvs\stepmania\Program
|
||||
TargetName=StepMania
|
||||
SOURCE="$(InputPath)"
|
||||
PreLink_Cmds=archutils\Win32\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
|
||||
PreLink_Cmds=archutils\Win32\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
|
||||
PostBuild_Cmds=archutils\Win32\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi
|
||||
# End Special Build Tool
|
||||
|
||||
@@ -448,14 +448,6 @@ SOURCE=.\RageSoundReader_WAV.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\RageSoundResampler.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\RageSoundResampler.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\RageSoundUtil.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -3244,6 +3236,22 @@ SOURCE=.\ScreenTitleMenu.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ScreenUnlockBrowse.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ScreenUnlockBrowse.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ScreenUnlockCelebrate.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ScreenUnlockCelebrate.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ScreenUnlockStatus.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
@@ -427,6 +427,10 @@ void UnlockManager::Load()
|
||||
if( bRoulette )
|
||||
m_RouletteCodes.insert( current.m_iEntryID );
|
||||
|
||||
// TODO: Persist celebrated info?
|
||||
if( !current.IsLocked() )
|
||||
current.m_bCelebrated = false;
|
||||
|
||||
m_UnlockEntries.push_back( current );
|
||||
}
|
||||
|
||||
@@ -540,6 +544,31 @@ int UnlockManager::GetNumUnlocks() const
|
||||
return m_UnlockEntries.size();
|
||||
}
|
||||
|
||||
bool UnlockManager::AllAreLocked() const
|
||||
{
|
||||
FOREACH_CONST( UnlockEntry, m_UnlockEntries, ue )
|
||||
{
|
||||
if( !ue->IsLocked() )
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
int UnlockManager::GetUnlockIndexToCelebrate() const
|
||||
{
|
||||
FOREACH_CONST( UnlockEntry, m_UnlockEntries, ue )
|
||||
{
|
||||
if( !ue->IsLocked() && !ue->m_bCelebrated )
|
||||
return ue - m_UnlockEntries.begin();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool UnlockManager::AnyUnlocksToCelebrate() const
|
||||
{
|
||||
return GetUnlockIndexToCelebrate() != -1;
|
||||
}
|
||||
|
||||
void UnlockManager::GetUnlocksByType( UnlockRewardType t, vector<UnlockEntry *> &apEntries )
|
||||
{
|
||||
for( unsigned i = 0; i < m_UnlockEntries.size(); ++i )
|
||||
@@ -604,11 +633,14 @@ class LunaUnlockManager: public Luna<UnlockManager>
|
||||
public:
|
||||
LunaUnlockManager() { LUA->Register( Register ); }
|
||||
|
||||
static int FindEntryID( T* p, lua_State *L ) { RString sName = SArg(1); int i = p->FindEntryID(sName); if( i == -1 ) lua_pushnil(L); else lua_pushnumber(L, i); return 1; }
|
||||
static int UnlockEntryID( T* p, lua_State *L ) { int iUnlockEntryID = IArg(1); p->UnlockEntryID(iUnlockEntryID); return 0; }
|
||||
static int PreferUnlockEntryID( T* p, lua_State *L ) { int iUnlockEntryID = IArg(1); p->PreferUnlockEntryID(iUnlockEntryID); return 0; }
|
||||
static int GetNumUnlocks( T* p, lua_State *L ) { lua_pushnumber( L, p->GetNumUnlocks() ); return 1; }
|
||||
static int GetUnlockEntry( T* p, lua_State *L ) { int iIndex = IArg(1); p->m_UnlockEntries[iIndex].PushSelf(L); return 1; }
|
||||
static int FindEntryID( T* p, lua_State *L ) { RString sName = SArg(1); int i = p->FindEntryID(sName); if( i == -1 ) lua_pushnil(L); else lua_pushnumber(L, i); return 1; }
|
||||
static int UnlockEntryID( T* p, lua_State *L ) { int iUnlockEntryID = IArg(1); p->UnlockEntryID(iUnlockEntryID); return 0; }
|
||||
static int PreferUnlockEntryID( T* p, lua_State *L ) { int iUnlockEntryID = IArg(1); p->PreferUnlockEntryID(iUnlockEntryID); return 0; }
|
||||
static int GetNumUnlocks( T* p, lua_State *L ) { lua_pushnumber( L, p->GetNumUnlocks() ); return 1; }
|
||||
static int AllAreLocked( T* p, lua_State *L ) { lua_pushboolean( L, p->AllAreLocked() ); return 1; }
|
||||
static int GetUnlockIndexToCelebrate( T* p, lua_State *L ) { lua_pushnumber( L, p->GetUnlockIndexToCelebrate() ); return 1; }
|
||||
static int AnyUnlocksToCelebrate( T* p, lua_State *L ) { lua_pushboolean( L, p->AnyUnlocksToCelebrate() ); return 1; }
|
||||
static int GetUnlockEntry( T* p, lua_State *L ) { int iIndex = IArg(1); p->m_UnlockEntries[iIndex].PushSelf(L); return 1; }
|
||||
static int GetSongsUnlockedByEntryID( T* p, lua_State *L )
|
||||
{
|
||||
vector<Song *> apSongs;
|
||||
@@ -634,6 +666,9 @@ public:
|
||||
ADD_METHOD( UnlockEntryID );
|
||||
ADD_METHOD( PreferUnlockEntryID );
|
||||
ADD_METHOD( GetNumUnlocks );
|
||||
ADD_METHOD( AllAreLocked );
|
||||
ADD_METHOD( GetUnlockIndexToCelebrate );
|
||||
ADD_METHOD( AnyUnlocksToCelebrate );
|
||||
ADD_METHOD( GetUnlockEntry );
|
||||
ADD_METHOD( GetSongsUnlockedByEntryID );
|
||||
ADD_METHOD( GetStepsUnlockedByEntryID );
|
||||
|
||||
@@ -53,6 +53,7 @@ public:
|
||||
|
||||
ZERO( m_fRequirement );
|
||||
m_iEntryID = -1;
|
||||
m_bCelebrated = false;
|
||||
}
|
||||
|
||||
UnlockRewardType m_Type;
|
||||
@@ -66,6 +67,7 @@ public:
|
||||
|
||||
float m_fRequirement[NUM_UnlockRequirement];
|
||||
int m_iEntryID;
|
||||
bool m_bCelebrated;
|
||||
|
||||
bool IsValid() const;
|
||||
bool IsLocked() const;
|
||||
@@ -100,6 +102,9 @@ public:
|
||||
|
||||
// Gets number of unlocks for title screen
|
||||
int GetNumUnlocks() const;
|
||||
bool AllAreLocked() const;
|
||||
int GetUnlockIndexToCelebrate() const;
|
||||
bool AnyUnlocksToCelebrate() const;
|
||||
|
||||
void GetPoints( const Profile *pProfile, float fScores[NUM_UnlockRequirement] ) const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user