working on lesson mode

This commit is contained in:
Chris Danford
2005-09-08 22:47:16 +00:00
parent 5c7f1346e6
commit 788f6e8126
6 changed files with 237 additions and 2 deletions
+1
View File
@@ -36,6 +36,7 @@ ScreenExit.cpp ScreenExit.h ScreenNetEvaluation.cpp ScreenNetEvaluation.h \
ScreenNetSelectMusic.cpp ScreenNetSelectMusic.h ScreenNetSelectBase.cpp ScreenNetSelectBase.h ScreenNetRoom.cpp ScreenNetRoom.h \
ScreenEz2SelectMusic.cpp ScreenEz2SelectMusic.h ScreenEz2SelectPlayer.cpp ScreenEz2SelectPlayer.h \
ScreenGameplay.cpp ScreenGameplay.h \
ScreenGameplayLesson.cpp ScreenGameplayLesson.h \
ScreenGameplayMultiplayer.cpp ScreenGameplayMultiplayer.h \
ScreenGameplayNormal.cpp ScreenGameplayNormal.h \
ScreenHowToPlay.cpp ScreenHowToPlay.h \
+161
View File
@@ -0,0 +1,161 @@
#include "global.h"
#include "ScreenGameplayLesson.h"
#include "RageLog.h"
#include "GameState.h"
#include "PrefsManager.h"
REGISTER_SCREEN_CLASS( ScreenGameplayLesson );
ScreenGameplayLesson::ScreenGameplayLesson( CString sName ) : ScreenGameplayNormal( sName )
{
LOG->Trace( "ScreenGameplayLesson::ScreenGameplayLesson()" );
m_iCurrentLessonPageIndex = 0;
}
void ScreenGameplayLesson::Init()
{
ASSERT( GAMESTATE->m_pCurStyle );
ASSERT( GAMESTATE->m_pCurSong );
/* Now that we've set up, init the base class. */
ScreenGameplay::Init();
ClearMessageQueue(); // remove all of the messages set in ScreenGameplay that animate "ready", "here we go", etc.
GAMESTATE->m_bPastHereWeGo = true;
m_DancingState = STATE_DANCING;
// Load lessons
Song *pSong = GAMESTATE->m_pCurSong;
CString sDir = pSong->GetSongDir();
vector<CString> vs;
GetDirListing( sDir+"Page*", vs, true, true );
m_vLessonPages.resize( vs.size() );
FOREACH( CString, vs, s )
{
int i = s - vs.begin();
AutoActor &aa = m_vLessonPages[i];
LUA->SetGlobal( "PageIndex", i );
LUA->SetGlobal( "NumPages", (int)vs.size() );
aa.Load( *s );
LUA->UnsetGlobal( "PageIndex" );
LUA->UnsetGlobal( "NumPages" );
aa->SetDrawOrder( DRAW_ORDER_OVERLAY );
this->AddChild( aa );
}
this->SortByDrawOrder();
// Show the first lesson page
if( !m_vLessonPages.empty() )
{
AutoActor &aa = m_vLessonPages[0];
aa->PlayCommand( "Show" );
}
FOREACH( AutoActor, m_vLessonPages, aa )
(*aa)->PlayCommand( "On" );
}
void ScreenGameplayLesson::Input( const InputEventPlus &input )
{
//LOG->Trace( "ScreenGameplayLesson::Input()" );
if( m_iCurrentLessonPageIndex != -1 )
{
// show a lesson page
Screen::Input( input );
}
else
{
// in the "your turn" section"
ScreenGameplay::Input( input );
}
}
void ScreenGameplayLesson::HandleScreenMessage( const ScreenMessage SM )
{
if( SM == SM_NotesEnded )
{
bool bShowingAPage = m_iCurrentLessonPageIndex != -1;
if( bShowingAPage )
{
// reload and loop
}
else
{
// show finish message if passed, loop if failed
}
}
ScreenGameplay::HandleScreenMessage( SM );
}
void ScreenGameplayLesson::MenuStart( PlayerNumber pn )
{
if( m_iCurrentLessonPageIndex == -1 )
return;
ChangeLessonPage( +1 );
}
void ScreenGameplayLesson::MenuBack( PlayerNumber pn )
{
if( m_iCurrentLessonPageIndex == -1 )
return;
ChangeLessonPage( -1 );
}
void ScreenGameplayLesson::ChangeLessonPage( int iDir )
{
if( m_iCurrentLessonPageIndex + iDir < 0 )
{
// don't change
return;
}
else if( m_iCurrentLessonPageIndex + iDir >= m_vLessonPages.size() )
{
// dismissed the last page. Proceed to the "your turn" portion.
FOREACH( AutoActor, m_vLessonPages, aa )
(*aa)->PlayCommand( "Off" );
m_iCurrentLessonPageIndex = -1;
}
else
{
m_vLessonPages[m_iCurrentLessonPageIndex]->PlayCommand( "Hide" );
m_iCurrentLessonPageIndex += iDir;
m_vLessonPages[m_iCurrentLessonPageIndex]->PlayCommand( "Show" );
}
}
/*
* (c) 2003-2004 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.
*/
+53
View File
@@ -0,0 +1,53 @@
/* ScreenGameplayLesson - Plays whole songs continuously. */
#ifndef ScreenGameplayLesson_H
#define ScreenGameplayLesson_H
#include "ScreenGameplayNormal.h"
class CourseEntry;
class ScreenGameplayLesson : public ScreenGameplayNormal
{
public:
ScreenGameplayLesson( CString sName );
virtual void Init();
virtual void Input( const InputEventPlus &input );
virtual void HandleScreenMessage( const ScreenMessage SM );
virtual void MenuStart( PlayerNumber pn );
virtual void MenuBack( PlayerNumber pn );
protected:
void ChangeLessonPage( int iDir );
vector<AutoActor> m_vLessonPages;
int m_iCurrentLessonPageIndex;
};
#endif
/*
* (c) 2003-2004 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.
*/
+6
View File
@@ -357,6 +357,12 @@ cl /Zl /nologo /c verstub.cpp /Fo&quot;$(IntDir)&quot;\
<File
RelativePath="ScreenGameplay.h">
</File>
<File
RelativePath=".\ScreenGameplayLesson.cpp">
</File>
<File
RelativePath=".\ScreenGameplayLesson.h">
</File>
<File
RelativePath="ScreenGameplayMultiplayer.cpp">
</File>
+10 -2
View File
@@ -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
@@ -2668,6 +2668,14 @@ SOURCE=.\ScreenGameplay.h
# End Source File
# Begin Source File
SOURCE=.\ScreenGameplayLesson.cpp
# End Source File
# Begin Source File
SOURCE=.\ScreenGameplayLesson.h
# End Source File
# Begin Source File
SOURCE=.\ScreenGameplayMultiplayer.cpp
# End Source File
# Begin Source File
+6
View File
@@ -1147,6 +1147,12 @@ cl /Zl /nologo /c verstub.cpp /Fo&quot;$(IntDir)&quot;\
<File
RelativePath="ProductInfo.h">
</File>
<File
RelativePath="ScreenGameplayLesson.cpp">
</File>
<File
RelativePath="ScreenGameplayLesson.h">
</File>
<File
RelativePath="StdString.h">
</File>