Added command line option for reversing tracks.
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/reverse_mode@10808 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
c49226aefc
commit
648eb17e0a
@ -361,6 +361,7 @@ void cmdLineHelp (char* invocation)
|
||||
" --list-karts Show available karts.\n"
|
||||
" --laps N Define number of laps to N.\n"
|
||||
" --mode N N=1 novice, N=2 driver, N=3 racer.\n"
|
||||
" --reverse Play track in reverse (if allowed)\n"
|
||||
// TODO: add back "--players" switch
|
||||
// " --players n Define number of players to between 1 and 4.\n"
|
||||
" --item STYLE Use STYLE as your item style.\n"
|
||||
@ -766,6 +767,10 @@ int handleCmdLine(int argc, char **argv)
|
||||
}
|
||||
i++;
|
||||
}
|
||||
else if( !strcmp(argv[i], "--reverse"))
|
||||
{
|
||||
race_manager->setReverseTrack(true);
|
||||
}
|
||||
else if( (!strcmp(argv[i], "--track") || !strcmp(argv[i], "-t"))
|
||||
&& i+1<argc )
|
||||
{
|
||||
|
@ -617,13 +617,12 @@ void RaceManager::startGP(const GrandPrixData* gp)
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void RaceManager::startSingleRace(const std::string trackIdent,
|
||||
const int num_laps, const bool reverse_track)
|
||||
const int num_laps)
|
||||
{
|
||||
StateManager::get()->enterGameState();
|
||||
setTrack(trackIdent.c_str());
|
||||
|
||||
if (num_laps != -1) setNumLaps( num_laps );
|
||||
setReverseTrack(reverse_track);
|
||||
|
||||
setMajorMode(RaceManager::MAJOR_MODE_SINGLE);
|
||||
|
||||
|
@ -496,10 +496,8 @@ public:
|
||||
* \param trackIdent Internal name of the track to race on
|
||||
* \param num_laps Number of laps to race, or -1 if number of laps is
|
||||
* not relevant in current mode
|
||||
* \param reverse_track True if the track should be driven reverse
|
||||
*/
|
||||
void startSingleRace(const std::string trackIdent, const int num_laps,
|
||||
const bool reverse_track);
|
||||
void startSingleRace(const std::string trackIdent, const int num_laps);
|
||||
|
||||
/** \} */
|
||||
|
||||
|
@ -168,7 +168,9 @@ TrackInfoDialog::TrackInfoDialog(const std::string& ribbonItem, const std::strin
|
||||
|
||||
IGUIStaticText* b = GUIEngine::getGUIEnv()->addStaticText(
|
||||
text_reverse.c_str(),
|
||||
core::rect< s32 >(m_checkbox->m_x+m_checkbox->m_w, m_checkbox->m_y+10, m_checkbox->m_x+200, m_checkbox->m_y+m_checkbox->m_h),
|
||||
core::rect< s32 >(m_checkbox->m_x+m_checkbox->m_w,
|
||||
m_checkbox->m_y+10, m_checkbox->m_x+200,
|
||||
m_checkbox->m_y+m_checkbox->m_h),
|
||||
false , true , // border, word warp
|
||||
m_irrlicht_window);
|
||||
b->setTabStop(false);
|
||||
@ -324,7 +326,8 @@ void TrackInfoDialog::onEnterPressedInternal()
|
||||
const int num_laps = (m_spinner == NULL ? -1 : m_spinner->getValue());
|
||||
const bool reverse_track = m_checkbox == NULL ? false
|
||||
: m_checkbox->getState();
|
||||
race_manager->startSingleRace(m_track_ident, num_laps, reverse_track);
|
||||
race_manager->setReverseTrack(reverse_track);
|
||||
race_manager->startSingleRace(m_track_ident, num_laps);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------
|
||||
@ -336,13 +339,15 @@ GUIEngine::EventPropagation TrackInfoDialog::processEvent(const std::string& eve
|
||||
// Create a copy of member variables we still need, since they will
|
||||
// not be accessible after dismiss:
|
||||
const int num_laps = (m_spinner == NULL ? -1 : m_spinner->getValue());
|
||||
const bool reverse_track = m_checkbox == NULL ? false
|
||||
: m_checkbox->getState();
|
||||
std::string track_ident = m_track_ident;
|
||||
ModalDialog::dismiss();
|
||||
race_manager->startSingleRace(track_ident, num_laps, reverse_track);
|
||||
race_manager->startSingleRace(track_ident, num_laps);
|
||||
return GUIEngine::EVENT_BLOCK;
|
||||
}
|
||||
else if (eventSource == "reversecheckbox")
|
||||
{
|
||||
race_manager->setReverseTrack(m_checkbox->getState());
|
||||
}
|
||||
else if (eventSource == "lapcountspinner")
|
||||
{
|
||||
assert(m_spinner != NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user