Add ghost icon, use it in race setup screen

This commit is contained in:
Benau 2016-02-15 09:28:36 +08:00
parent bd1380a240
commit a6412d7a07
7 changed files with 18 additions and 15 deletions

BIN
data/gui/mode_ghost.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -25,8 +25,6 @@
<!-- Populated dynamically at runtime -->
<tabs width="100%" height="25" id="trackgroups"> </tabs>
<spacer width="100%" height="3%" />
<button id="ghost" I18N="In the track selection screen" text="Load Ghost Replay" />
<spacer width="100%" height="2%" />
</div>
</stkgui>

View File

@ -45,6 +45,7 @@ static const std::string IDENT_FTL ("FOLLOW_LEADER" );
static const std::string IDENT_STRIKES ("BATTLE_3_STRIKES");
static const std::string IDENT_EASTER ("EASTER_EGG_HUNT" );
static const std::string IDENT_SOCCER ("SOCCER" );
static const std::string IDENT_GHOST ("GHOST" );
static const std::string IDENT_OVERWORLD("OVERWORLD" );
static const std::string IDENT_CUTSCENE ("CUTSCENE" );

View File

@ -39,7 +39,6 @@ ReplayRecorder *ReplayRecorder::m_replay_recorder = NULL;
*/
ReplayRecorder::ReplayRecorder()
{
m_filename = "";
} // ReplayRecorder
//-----------------------------------------------------------------------------

View File

@ -33,7 +33,6 @@ DEFINE_SCREEN_SINGLETON( GhostReplaySelection );
*/
GhostReplaySelection::GhostReplaySelection() : Screen("ghost_replay_selection.stkgui")
{
m_file_to_be_deleted = "";
m_sort_desc = true;
} // GhostReplaySelection

View File

@ -28,6 +28,7 @@
#include "race/race_manager.hpp"
#include "states_screens/arenas_screen.hpp"
#include "states_screens/easter_egg_screen.hpp"
#include "states_screens/ghost_replay_selection.hpp"
#include "states_screens/soccer_setup_screen.hpp"
#include "states_screens/state_manager.hpp"
#include "states_screens/tracks_screen.hpp"
@ -39,6 +40,7 @@ const int CONFIG_CODE_FTL = 2;
const int CONFIG_CODE_3STRIKES = 3;
const int CONFIG_CODE_EASTER = 4;
const int CONFIG_CODE_SOCCER = 5;
const int CONFIG_CODE_GHOST = 6;
using namespace GUIEngine;
DEFINE_SCREEN_SINGLETON( RaceSetupScreen );
@ -131,6 +133,10 @@ void RaceSetupScreen::init()
}
#endif
irr::core::stringw name6 = irr::core::stringw( _("Ghost replay race")) + L"\n";
name6 += _("Race against ghost karts and try to beat them!");
w2->addItem( name6, IDENT_GHOST, "/gui/mode_ghost.png");
w2->updateItemDisplay();
// restore saved game mode
@ -154,6 +160,9 @@ void RaceSetupScreen::init()
case CONFIG_CODE_SOCCER :
w2->setSelection(IDENT_SOCCER, PLAYER_ID_GAME_MASTER, true);
break;
case CONFIG_CODE_GHOST :
w2->setSelection(IDENT_GHOST, PLAYER_ID_GAME_MASTER, true);
break;
}
{
@ -232,6 +241,12 @@ void RaceSetupScreen::eventCallback(Widget* widget, const std::string& name,
UserConfigParams::m_game_mode = CONFIG_CODE_SOCCER;
SoccerSetupScreen::getInstance()->push();
}
else if (selectedMode == IDENT_GHOST)
{
race_manager->setMinorMode(RaceManager::MINOR_MODE_TIME_TRIAL);
UserConfigParams::m_game_mode = CONFIG_CODE_GHOST;
GhostReplaySelection::getInstance()->push();
}
else if (selectedMode == "locked")
{
unlock_manager->playLockSound();

View File

@ -31,10 +31,9 @@
#include "network/stk_host.hpp"
#include "race/grand_prix_data.hpp"
#include "race/grand_prix_manager.hpp"
#include "states_screens/ghost_replay_selection.hpp"
#include "states_screens/gp_info_screen.hpp"
#include "states_screens/state_manager.hpp"
#include "states_screens/track_info_screen.hpp"
#include "states_screens/gp_info_screen.hpp"
#include "tracks/track.hpp"
#include "tracks/track_manager.hpp"
#include "utils/translation.hpp"
@ -139,15 +138,10 @@ void TracksScreen::eventCallback(Widget* widget, const std::string& name,
UserConfigParams::m_last_used_track_group = tabs->getSelectionIDString(0);
buildTrackList();
}
else if (name == "ghost")
{
GhostReplaySelection::getInstance()->push();
}
else if (name == "back")
{
StateManager::get()->escapePressed();
}
} // eventCallback
// -----------------------------------------------------------------------------
@ -261,9 +255,6 @@ void TracksScreen::init()
tracks_widget->setSelection(0, PLAYER_ID_GAME_MASTER, true);
}
irr_driver->unsetTextureErrorMessage();
const bool ghost_available = race_manager->getMinorMode() == RaceManager::MINOR_MODE_TIME_TRIAL;
getWidget<ButtonWidget>("ghost")->setVisible(ghost_available);
} // init
// -----------------------------------------------------------------------------