Started adding back support for 3 strikes mode (which doesn't work since no arena was converted yet)

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@4324 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2009-12-19 19:25:12 +00:00
parent a950d93332
commit 7703fa76ae
6 changed files with 157 additions and 1 deletions

View File

@ -266,6 +266,8 @@ supertuxkart_SOURCES = \
states_screens/dialogs/race_over_dialog.hpp \
states_screens/dialogs/race_paused_dialog.hpp \
states_screens/dialogs/race_paused_dialog.cpp \
states_screens/arenas_screen.cpp \
states_screens/arenas_screen.hpp \
states_screens/feature_unlocked.cpp \
states_screens/feature_unlocked.hpp \
states_screens/help_screen_1.cpp \

View File

@ -245,6 +245,7 @@
9551DB34104CABFC001C53E5 /* race_over_dialog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9551DB33104CABFC001C53E5 /* race_over_dialog.cpp */; };
955DE88310042701006A4F3C /* check_manager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 955DE88110042701006A4F3C /* check_manager.cpp */; };
955DE88C1004273B006A4F3C /* check_structure.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 955DE8871004273B006A4F3C /* check_structure.cpp */; };
956541BB10DD5F0A00C83E99 /* arenas_screen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 956541B910DD5F0A00C83E99 /* arenas_screen.cpp */; };
956D36A710095035007FCB95 /* player.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 956D36A610095035007FCB95 /* player.cpp */; };
958330CC10122B4A00C5137E /* engine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 958330B210122B4A00C5137E /* engine.cpp */; };
958330CD10122B4A00C5137E /* event_handler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 958330B410122B4A00C5137E /* event_handler.cpp */; };
@ -432,6 +433,8 @@
955DE88210042701006A4F3C /* check_manager.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = check_manager.hpp; path = ../../tracks/check_manager.hpp; sourceTree = SOURCE_ROOT; };
955DE8871004273B006A4F3C /* check_structure.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = check_structure.cpp; path = ../../tracks/check_structure.cpp; sourceTree = SOURCE_ROOT; };
955DE8881004273B006A4F3C /* check_structure.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = check_structure.hpp; path = ../../tracks/check_structure.hpp; sourceTree = SOURCE_ROOT; };
956541B910DD5F0A00C83E99 /* arenas_screen.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = arenas_screen.cpp; path = games/supertuxkart/src/states_screens/arenas_screen.cpp; sourceTree = SYSTEM_DEVELOPER_DIR; };
956541BA10DD5F0A00C83E99 /* arenas_screen.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = arenas_screen.hpp; path = games/supertuxkart/src/states_screens/arenas_screen.hpp; sourceTree = SYSTEM_DEVELOPER_DIR; };
956D36A610095035007FCB95 /* player.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = player.cpp; path = ../../config/player.cpp; sourceTree = SOURCE_ROOT; };
958330B210122B4A00C5137E /* engine.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = engine.cpp; path = ../../guiengine/engine.cpp; sourceTree = SOURCE_ROOT; };
958330B310122B4A00C5137E /* engine.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = engine.hpp; path = ../../guiengine/engine.hpp; sourceTree = SOURCE_ROOT; };
@ -1261,6 +1264,8 @@
isa = PBXGroup;
children = (
95833236101243ED00C5137E /* dialogs */,
956541B910DD5F0A00C83E99 /* arenas_screen.cpp */,
956541BA10DD5F0A00C83E99 /* arenas_screen.hpp */,
951B7D18108E52C900BC03AE /* challenges.cpp */,
951B7D17108E52C900BC03AE /* challenges.hpp */,
958330C210122B4A00C5137E /* credits.cpp */,
@ -2564,6 +2569,7 @@
951B7D19108E52C900BC03AE /* challenges.cpp in Sources */,
95FB16DB10A7796800645974 /* new_ai.cpp in Sources */,
953C3CCA10CAF3EE0025F78A /* CGUIFont.cpp in Sources */,
956541BB10DD5F0A00C83E99 /* arenas_screen.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View File

@ -0,0 +1,105 @@
// SuperTuxKart - a fun racing game with go-kart
// Copyright (C) 2009 Marianne Gagnon
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 3
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "challenges/unlock_manager.hpp"
#include "guiengine/widget.hpp"
#include "io/file_manager.hpp"
#include "states_screens/state_manager.hpp"
#include "states_screens/arenas_screen.hpp"
#include "states_screens/dialogs/track_info_dialog.hpp"
#include "tracks/track.hpp"
#include "tracks/track_manager.hpp"
#include "utils/translation.hpp"
using namespace GUIEngine;
using namespace irr::core;
using namespace irr::video;
ArenasScreen::ArenasScreen() : Screen("arenas.stkgui")
{
}
void ArenasScreen::eventCallback(Widget* widget, const std::string& name, const int playerID)
{
if (name == "tracks")
{
DynamicRibbonWidget* w2 = dynamic_cast<DynamicRibbonWidget*>(widget);
if (w2 != NULL)
{
const std::string selection = w2->getSelectionIDString(GUI_PLAYER_ID);
std::cout << "Clicked on arena " << selection.c_str() << std::endl;
if (selection == "random_track")
{
// TODO
}
else
{
Track* clickedTrack = track_manager->getTrack(selection);
if (clickedTrack != NULL)
{
ITexture* screenshot = GUIEngine::getDriver()->getTexture( clickedTrack->getScreenshotFile().c_str() );
new TrackInfoDialog( clickedTrack->getIdent(), clickedTrack->getName().c_str(), screenshot, 0.8f, 0.7f);
}
}
}
}
}
void ArenasScreen::init()
{
DynamicRibbonWidget* w = this->getWidget<DynamicRibbonWidget>("tracks");
assert( w != NULL );
// Re-build track list everytime (accounts for locking changes, etc.)
w->clearItems();
const int trackAmount = track_manager->getNumberOfTracks();
//bool hasLockedTracks = false;
for (int n=0; n<trackAmount; n++)
{
Track* curr = track_manager->getTrack(n);
if (!curr->isArena()) continue;
if (unlock_manager->isLocked(curr->getIdent()))
{
w->addItem( _("Locked : solve active challenges to gain access to more!"), "locked", curr->getScreenshotFile(), true );
}
else
{
w->addItem( curr->getName(), curr->getIdent(), curr->getScreenshotFile(), false );
}
}
w->addItem(_("Random Arena"), "random_track", "/gui/track_random.png");
w->updateItemDisplay();
}
void ArenasScreen::tearDown()
{
}
void ArenasScreen::setFocusOnTrack(const std::string& trackName)
{
DynamicRibbonWidget* w = this->getWidget<DynamicRibbonWidget>("tracks");
assert( w != NULL );
// FIXME: don't hardcode player 0?
w->setSelection(trackName, 0, true);
}

View File

@ -0,0 +1,40 @@
// SuperTuxKart - a fun racing game with go-kart
// Copyright (C) 2009 Marianne Gagnon
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 3
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef HEADER_ARENAS_SCREEN_HPP
#define HEADER_ARENAS_SCREEN_HPP
#include "guiengine/screen.hpp"
namespace GUIEngine { class Widget; }
class ArenasScreen : public GUIEngine::Screen, public GUIEngine::ScreenSingleton<ArenasScreen>
{
friend class GUIEngine::ScreenSingleton<ArenasScreen>;
ArenasScreen();
public:
void eventCallback(GUIEngine::Widget* widget, const std::string& name, const int playerID);
void init();
void tearDown();
void setFocusOnTrack(const std::string& trackName);
};
#endif

View File

@ -19,6 +19,7 @@
#include "guiengine/widget.hpp"
#include "io/file_manager.hpp"
#include "race/race_manager.hpp"
#include "states_screens/arenas_screen.hpp"
#include "states_screens/race_setup_screen.hpp"
#include "states_screens/state_manager.hpp"
#include "states_screens/tracks_screen.hpp"
@ -77,8 +78,8 @@ void RaceSetupScreen::eventCallback(Widget* widget, const std::string& name, con
}
else if (selectedMode == "3strikes")
{
// TODO - 3 strikes battle track selection
race_manager->setMinorMode(RaceManager::MINOR_MODE_3_STRIKES);
StateManager::get()->pushScreen( ArenasScreen::getInstance() );
}
else if (selectedMode == "locked")
{

View File

@ -83,6 +83,8 @@ void TracksScreen::init()
for (int n=0; n<trackAmount; n++)
{
Track* curr = track_manager->getTrack(n);
if (curr->isArena()) continue;
/*
if (unlock_manager->isLocked(curr->getIdent()))
{