When clicked, locked widgets reveal the name behind. Also, there is some help about locks in the first help page.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@2063 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
cosmosninja 2008-05-26 01:12:57 +00:00
parent b5d4930f87
commit 2dd0211ede
3 changed files with 117 additions and 69 deletions

View File

@ -70,9 +70,10 @@ GameMode::GameMode()
if(unlock_manager->isLocked("followleader"))
{
widget_manager->hideWgtText( WTOK_FOLLOW_LEADER );
widget_manager->deactivateWgt( WTOK_FOLLOW_LEADER );
widget_manager->setWgtColor( WTOK_FOLLOW_LEADER, WGT_WHITE);
// widget_manager->deactivateWgt( WTOK_FOLLOW_LEADER );
widget_manager->setWgtColor( WTOK_FOLLOW_LEADER, WGT_GRAY);
widget_manager->setWgtTexture( WTOK_FOLLOW_LEADER, "gui_lock.rgb", false );
widget_manager->showWgtTexture( WTOK_FOLLOW_LEADER );
}
@ -110,8 +111,17 @@ void GameMode::select()
menu_manager->pushMenu(MENUID_CHARSEL_P1);
break;
case WTOK_FOLLOW_LEADER:
race_manager->setRaceMode(RaceManager::RM_FOLLOW_LEADER);
menu_manager->pushMenu(MENUID_CHARSEL_P1);
if(unlock_manager->isLocked("followleader"))
{
widget_manager->showWgtText( WTOK_FOLLOW_LEADER );
widget_manager->setWgtTextColor( WTOK_FOLLOW_LEADER, WGT_TRANS_GRAY);
widget_manager->setWgtColor( WTOK_FOLLOW_LEADER, WGT_TRANS_GRAY);
}
else
{
race_manager->setRaceMode(RaceManager::RM_FOLLOW_LEADER);
menu_manager->pushMenu(MENUID_CHARSEL_P1);
}
break;
case WTOK_TIMETRIAL:
race_manager->setRaceMode(RaceManager::RM_TIME_TRIAL);

View File

@ -35,6 +35,9 @@ enum WidgetTokens
WTOK_MSG4,
WTOK_MSG5,
WTOK_MSG6,
WTOK_MSG7,
WTOK_LOCK,
WTOK_SECOND_PAGE,
WTOK_QUIT
@ -102,16 +105,21 @@ HelpPageOne::HelpPageOne()
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 100, 15);
widget_manager->breakLine();
widget_manager->addTextWgt(WTOK_MSG4, 100, 15,
widget_manager->addTextWgt(WTOK_MSG4, 100, 13,
//Next line starts at column 0 to avoid spaces in the GUI
_("At high speeds wheelies drive you faster, but you can't steer. If you\n\
get stuck or fall too far, use the rescue button to get back on track."));
widget_manager->setWgtResizeToText( WTOK_MSG4, false );
widget_manager->breakLine();
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 100, 1);
widget_manager->breakLine();
widget_manager->addTextWgt(WTOK_MSG5, 80, 10,
_("The current key bindings can be seen/changed in the\nOptions->Player Config menu."));
widget_manager->breakLine();
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 100, 1);
widget_manager->breakLine();
widget_manager->addTextWgt(WTOK_MSG6, 100, 17,
_("Collecting coins increases the number of collectables you receive.\n\
@ -120,8 +128,19 @@ After 5 silver coins, each blue box will yield 2 collectables,\nafter 10,\
so look out for them!"));
widget_manager->setWgtResizeToText( WTOK_MSG6, false);
widget_manager->breakLine();
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 100, 1);
widget_manager->breakLine();
widget_manager->addTextWgt(WTOK_MSG7, 87, 13,
_("If you see a button with a lock like the one to the right,\n\
you need to complete a challenge to unlock it. You can click on\n\
the locks to know the name of what is behind the lock."));
widget_manager->addImgWgt(WTOK_LOCK, 10, 13, 0);
widget_manager->setWgtTexture(WTOK_LOCK, "gui_help_lock.rgb", false);
widget_manager->breakLine();
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 100, 1);
widget_manager->breakLine();
/*Buttons at the bottom*/

View File

@ -63,9 +63,9 @@ TrackSel::TrackSel()
if(!isAvailable)
{
widget_manager->hideWgtText(WTOK_TRACK0 + i);
widget_manager->deactivateWgt(WTOK_TRACK0 + i);
// widget_manager->deactivateWgt(WTOK_TRACK0 + i);
widget_manager->setWgtColor( WTOK_TRACK0 + i, WGT_WHITE);
widget_manager->setWgtColor( WTOK_TRACK0 + i, WGT_GRAY );
widget_manager->setWgtTexture( WTOK_TRACK0 + i, "gui_lock.rgb", false );
widget_manager->showWgtTexture( WTOK_TRACK0 + i );
}
@ -104,71 +104,77 @@ void TrackSel::update(float dt)
SELECTED_TRACK < (int)track_manager->getTrackCount() )
{
const Track* TRACK = track_manager->getTrack( SELECTED_TRACK );
const std::string& description = TRACK->getDescription();
if(description!="")
{
widget_manager->setWgtText( WTOK_AUTHOR, TRACK->getDescription() );
}
else
{
char designedby[MAX_MESSAGE_LENGTH];
snprintf(designedby, MAX_MESSAGE_LENGTH,
"Designed by %s", TRACK->getDesigner().c_str());
widget_manager->setWgtText( WTOK_AUTHOR, designedby );
}
const std::string& screenshot = TRACK->getScreenshotFile();
const std::string& topview = TRACK->getTopviewFile();
bool isAvailable = !unlock_manager->isLocked(TRACK->getIdent());
if( !screenshot.empty() && !topview.empty() )
if( isAvailable )
{
widget_manager->setWgtColor( WTOK_IMG0, WGT_WHITE);
widget_manager->showWgtRect( WTOK_IMG0 );
widget_manager->setWgtTexture( WTOK_IMG0, screenshot.c_str() );
widget_manager->showWgtTexture( WTOK_IMG0 );
widget_manager->hideWgtTrack( WTOK_IMG0 );
widget_manager->setWgtColor( WTOK_IMG1, WGT_WHITE);
widget_manager->showWgtRect( WTOK_IMG1 );
widget_manager->setWgtTexture( WTOK_IMG1, topview.c_str() );
widget_manager->showWgtTexture( WTOK_IMG1 );
widget_manager->hideWgtTrack( WTOK_IMG1 );
}
else if( topview.empty() )
{
widget_manager->setWgtColor( WTOK_IMG0, WGT_WHITE);
widget_manager->showWgtRect( WTOK_IMG0 );
widget_manager->setWgtTexture( WTOK_IMG0, screenshot.c_str() );
widget_manager->showWgtTexture( WTOK_IMG0 );
widget_manager->hideWgtTrack( WTOK_IMG0 );
const std::string& description = TRACK->getDescription();
if(description!="")
{
widget_manager->setWgtText( WTOK_AUTHOR, TRACK->getDescription() );
}
else
{
char designedby[MAX_MESSAGE_LENGTH];
snprintf(designedby, MAX_MESSAGE_LENGTH,
"Designed by %s", TRACK->getDesigner().c_str());
widget_manager->setWgtText( WTOK_AUTHOR, designedby );
}
const std::string& screenshot = TRACK->getScreenshotFile();
const std::string& topview = TRACK->getTopviewFile();
widget_manager->hideWgtRect( WTOK_IMG1 );
widget_manager->hideWgtTexture( WTOK_IMG1 );
widget_manager->setWgtTrackNum( WTOK_IMG1, SELECTED_TRACK );
widget_manager->showWgtTrack( WTOK_IMG1 );
}
else if( screenshot.empty() )
{
widget_manager->hideWgtRect( WTOK_IMG0 );
widget_manager->hideWgtTexture( WTOK_IMG0 );
widget_manager->setWgtTrackNum( WTOK_IMG0, SELECTED_TRACK );
widget_manager->showWgtTrack( WTOK_IMG0 );
if( !screenshot.empty() && !topview.empty() )
{
widget_manager->setWgtColor( WTOK_IMG0, WGT_WHITE);
widget_manager->showWgtRect( WTOK_IMG0 );
widget_manager->setWgtTexture( WTOK_IMG0, screenshot.c_str() );
widget_manager->showWgtTexture( WTOK_IMG0 );
widget_manager->hideWgtTrack( WTOK_IMG0 );
widget_manager->setWgtColor( WTOK_IMG1, WGT_WHITE);
widget_manager->showWgtRect( WTOK_IMG1 );
widget_manager->setWgtTexture( WTOK_IMG1, topview.c_str() );
widget_manager->showWgtTexture( WTOK_IMG1 );
widget_manager->hideWgtTrack( WTOK_IMG1 );
}
else //if( screenshot.empty() && topview.empty() )
{
widget_manager->hideWgtRect( WTOK_IMG0 );
widget_manager->hideWgtTexture( WTOK_IMG0 );
widget_manager->setWgtTrackNum( WTOK_IMG0, SELECTED_TRACK );
widget_manager->showWgtTrack( WTOK_IMG0 );
widget_manager->setWgtColor( WTOK_IMG1, WGT_WHITE);
widget_manager->showWgtRect( WTOK_IMG1 );
widget_manager->setWgtTexture( WTOK_IMG1, topview.c_str() );
widget_manager->showWgtTexture( WTOK_IMG1 );
widget_manager->hideWgtTrack( WTOK_IMG1 );
}
else if( topview.empty() )
{
widget_manager->setWgtColor( WTOK_IMG0, WGT_WHITE);
widget_manager->showWgtRect( WTOK_IMG0 );
widget_manager->setWgtTexture( WTOK_IMG0, screenshot.c_str() );
widget_manager->showWgtTexture( WTOK_IMG0 );
widget_manager->hideWgtTrack( WTOK_IMG0 );
widget_manager->hideWgtRect( WTOK_IMG1 );
widget_manager->hideWgtTexture( WTOK_IMG1 );
widget_manager->hideWgtTrack( WTOK_IMG1 );
widget_manager->hideWgtRect( WTOK_IMG1 );
widget_manager->hideWgtTexture( WTOK_IMG1 );
widget_manager->setWgtTrackNum( WTOK_IMG1, SELECTED_TRACK );
widget_manager->showWgtTrack( WTOK_IMG1 );
}
else if( screenshot.empty() )
{
widget_manager->hideWgtRect( WTOK_IMG0 );
widget_manager->hideWgtTexture( WTOK_IMG0 );
widget_manager->setWgtTrackNum( WTOK_IMG0, SELECTED_TRACK );
widget_manager->showWgtTrack( WTOK_IMG0 );
widget_manager->setWgtColor( WTOK_IMG1, WGT_WHITE);
widget_manager->showWgtRect( WTOK_IMG1 );
widget_manager->setWgtTexture( WTOK_IMG1, topview.c_str() );
widget_manager->showWgtTexture( WTOK_IMG1 );
widget_manager->hideWgtTrack( WTOK_IMG1 );
}
else //if( screenshot.empty() && topview.empty() )
{
widget_manager->hideWgtRect( WTOK_IMG0 );
widget_manager->hideWgtTexture( WTOK_IMG0 );
widget_manager->setWgtTrackNum( WTOK_IMG0, SELECTED_TRACK );
widget_manager->showWgtTrack( WTOK_IMG0 );
widget_manager->hideWgtRect( WTOK_IMG1 );
widget_manager->hideWgtTexture( WTOK_IMG1 );
widget_manager->hideWgtTrack( WTOK_IMG1 );
}
}
}
@ -184,9 +190,22 @@ void TrackSel::select()
{
return; // not clicked on a track, ignore
}
const Track* TRACK = track_manager->getTrack(CLICKED_TOKEN - WTOK_TRACK0);
race_manager->setTrack(TRACK->getIdent());
menu_manager->pushMenu(MENUID_RACE_OPTIONS);
bool isAvailable = !unlock_manager->isLocked(TRACK->getIdent());
if( isAvailable )
{
race_manager->setTrack(TRACK->getIdent());
menu_manager->pushMenu(MENUID_RACE_OPTIONS);
}
else
{
widget_manager->showWgtText( CLICKED_TOKEN );
widget_manager->setWgtTextColor( CLICKED_TOKEN, WGT_TRANS_GRAY);
widget_manager->setWgtColor( CLICKED_TOKEN, WGT_TRANS_GRAY);
}
} // select
/* EOF */