Make FFA and CTF minor mode

This commit is contained in:
Benau 2018-11-24 01:41:36 +08:00
parent 17075082e6
commit 689376dd0f
30 changed files with 142 additions and 128 deletions

View File

@ -396,7 +396,7 @@ void InputManager::handleStaticAction(int key, int value)
{ {
AbstractKart* kart = world->getLocalPlayerKart(0); AbstractKart* kart = world->getLocalPlayerKart(0);
if(control_is_pressed && race_manager->getMinorMode()!= if(control_is_pressed && race_manager->getMinorMode()!=
RaceManager::MINOR_MODE_BATTLE) RaceManager::MINOR_MODE_3_STRIKES)
kart->setPowerup(PowerupManager::POWERUP_RUBBERBALL, kart->setPowerup(PowerupManager::POWERUP_RUBBERBALL,
10000); 10000);
else else

View File

@ -345,7 +345,7 @@ void Attachment::hitBanana(ItemState *item_state)
bool add_a_new_item = true; bool add_a_new_item = true;
if (race_manager->getMinorMode() == RaceManager::MINOR_MODE_BATTLE) if (race_manager->isBattleMode())
{ {
World::getWorld()->kartHit(m_kart->getWorldKartId()); World::getWorld()->kartHit(m_kart->getWorldKartId());
if (m_kart->getKartAnimation() == NULL) if (m_kart->getKartAnimation() == NULL)

View File

@ -130,7 +130,7 @@ void ItemState::collected(const AbstractKart *kart)
m_ticks_till_return = stk_config->time2Ticks(2.0f); m_ticks_till_return = stk_config->time2Ticks(2.0f);
} }
if (race_manager->getMinorMode() == RaceManager::MINOR_MODE_BATTLE) if (race_manager->isBattleMode())
{ {
m_ticks_till_return *= 3; m_ticks_till_return *= 3;
} }

View File

@ -518,7 +518,9 @@ void PowerupManager::computeWeightsForRace(int num_karts)
case RaceManager::MINOR_MODE_TIME_TRIAL: /* fall through */ case RaceManager::MINOR_MODE_TIME_TRIAL: /* fall through */
case RaceManager::MINOR_MODE_NORMAL_RACE: class_name="race"; break; case RaceManager::MINOR_MODE_NORMAL_RACE: class_name="race"; break;
case RaceManager::MINOR_MODE_FOLLOW_LEADER: class_name="ftl"; break; case RaceManager::MINOR_MODE_FOLLOW_LEADER: class_name="ftl"; break;
case RaceManager::MINOR_MODE_BATTLE: class_name="battle"; break; case RaceManager::MINOR_MODE_3_STRIKES: class_name="battle"; break;
case RaceManager::MINOR_MODE_FREE_FOR_ALL: class_name="battle"; break;
case RaceManager::MINOR_MODE_CAPTURE_THE_FLAG: class_name="battle"; break;
case RaceManager::MINOR_MODE_TUTORIAL: class_name="tutorial"; break; case RaceManager::MINOR_MODE_TUTORIAL: class_name="tutorial"; break;
case RaceManager::MINOR_MODE_EASTER_EGG: /* fall through */ case RaceManager::MINOR_MODE_EASTER_EGG: /* fall through */
case RaceManager::MINOR_MODE_OVERWORLD: case RaceManager::MINOR_MODE_OVERWORLD:

View File

@ -238,8 +238,7 @@ int Swatter::updateAndTestFinished(int ticks)
squashThingsAround(); squashThingsAround();
m_animation_phase = SWATTER_FROM_TARGET; m_animation_phase = SWATTER_FROM_TARGET;
const int end_ticks = ticks_start + 60; const int end_ticks = ticks_start + 60;
if (race_manager if (race_manager->isBattleMode() ||
->getMinorMode()==RaceManager::MINOR_MODE_BATTLE ||
race_manager race_manager
->getMinorMode()==RaceManager::MINOR_MODE_SOCCER) ->getMinorMode()==RaceManager::MINOR_MODE_SOCCER)
{ {

View File

@ -87,7 +87,7 @@ AIBaseLapController::AIBaseLapController(AbstractKart *kart)
: AIBaseController(kart) : AIBaseController(kart)
{ {
if (race_manager->getMinorMode()!=RaceManager::MINOR_MODE_BATTLE && if (!race_manager->isBattleMode() &&
race_manager->getMinorMode()!=RaceManager::MINOR_MODE_SOCCER) race_manager->getMinorMode()!=RaceManager::MINOR_MODE_SOCCER)
{ {
m_world = dynamic_cast<LinearWorld*>(World::getWorld()); m_world = dynamic_cast<LinearWorld*>(World::getWorld());

View File

@ -56,7 +56,7 @@ EndController::EndController(AbstractKart *kart,
: AIBaseLapController(kart) : AIBaseLapController(kart)
{ {
m_previous_controller = prev_controller; m_previous_controller = prev_controller;
if(race_manager->getMinorMode()!=RaceManager::MINOR_MODE_BATTLE && if(!race_manager->isBattleMode() &&
race_manager->getMinorMode()!=RaceManager::MINOR_MODE_SOCCER) race_manager->getMinorMode()!=RaceManager::MINOR_MODE_SOCCER)
{ {
// Overwrite the random selected default path from AIBaseLapController // Overwrite the random selected default path from AIBaseLapController
@ -130,7 +130,7 @@ void EndController::reset()
m_track_node = Graph::UNKNOWN_SECTOR; m_track_node = Graph::UNKNOWN_SECTOR;
// In battle mode there is no quad graph, so nothing to do in this case // In battle mode there is no quad graph, so nothing to do in this case
if(race_manager->getMinorMode()!=RaceManager::MINOR_MODE_BATTLE && if(!race_manager->isBattleMode() &&
race_manager->getMinorMode()!=RaceManager::MINOR_MODE_SOCCER) race_manager->getMinorMode()!=RaceManager::MINOR_MODE_SOCCER)
{ {
DriveGraph::get()->findRoadSector(m_kart->getXYZ(), &m_track_node); DriveGraph::get()->findRoadSector(m_kart->getXYZ(), &m_track_node);
@ -184,7 +184,7 @@ void EndController::update(int ticks)
AIBaseLapController::update(ticks); AIBaseLapController::update(ticks);
// In case of battle mode: don't do anything // In case of battle mode: don't do anything
if(race_manager->getMinorMode()==RaceManager::MINOR_MODE_BATTLE || if(race_manager->isBattleMode() ||
race_manager->getMinorMode()==RaceManager::MINOR_MODE_SOCCER || race_manager->getMinorMode()==RaceManager::MINOR_MODE_SOCCER ||
race_manager->getMinorMode()==RaceManager::MINOR_MODE_EASTER_EGG) race_manager->getMinorMode()==RaceManager::MINOR_MODE_EASTER_EGG)
{ {

View File

@ -99,8 +99,8 @@ ExplosionAnimation::ExplosionAnimation(AbstractKart *kart,
} }
// Put the kart back to its own flag base like rescue if direct hit in CTF // Put the kart back to its own flag base like rescue if direct hit in CTF
if (race_manager->getMajorMode() == if (race_manager->getMinorMode() ==
RaceManager::MAJOR_MODE_CAPTURE_THE_FLAG && m_direct_hit) RaceManager::MINOR_MODE_CAPTURE_THE_FLAG && m_direct_hit)
{ {
m_reset_ticks = stk_config->time2Ticks(timer * 0.2f); m_reset_ticks = stk_config->time2Ticks(timer * 0.2f);
} }

View File

@ -1005,7 +1005,7 @@ void Kart::finishedRace(float time, bool from_server)
if (race_manager->getMinorMode() == RaceManager::MINOR_MODE_NORMAL_RACE || if (race_manager->getMinorMode() == RaceManager::MINOR_MODE_NORMAL_RACE ||
race_manager->getMinorMode() == RaceManager::MINOR_MODE_TIME_TRIAL || race_manager->getMinorMode() == RaceManager::MINOR_MODE_TIME_TRIAL ||
race_manager->getMinorMode() == RaceManager::MINOR_MODE_FOLLOW_LEADER || race_manager->getMinorMode() == RaceManager::MINOR_MODE_FOLLOW_LEADER ||
race_manager->getMinorMode() == RaceManager::MINOR_MODE_BATTLE || race_manager->isBattleMode() ||
race_manager->getMinorMode() == RaceManager::MINOR_MODE_SOCCER || race_manager->getMinorMode() == RaceManager::MINOR_MODE_SOCCER ||
race_manager->getMinorMode() == RaceManager::MINOR_MODE_EASTER_EGG) race_manager->getMinorMode() == RaceManager::MINOR_MODE_EASTER_EGG)
{ {
@ -1065,17 +1065,17 @@ void Kart::setRaceResult()
} }
} }
else if (race_manager->getMinorMode() == RaceManager::MINOR_MODE_FOLLOW_LEADER || else if (race_manager->getMinorMode() == RaceManager::MINOR_MODE_FOLLOW_LEADER ||
race_manager->getMajorMode() == RaceManager::MAJOR_MODE_3_STRIKES) race_manager->getMinorMode() == RaceManager::MINOR_MODE_3_STRIKES)
{ {
// the kart wins if it isn't eliminated // the kart wins if it isn't eliminated
m_race_result = !this->isEliminated(); m_race_result = !this->isEliminated();
} }
else if (race_manager->getMajorMode() == RaceManager::MAJOR_MODE_FREE_FOR_ALL) else if (race_manager->getMinorMode() == RaceManager::MINOR_MODE_FREE_FOR_ALL)
{ {
FreeForAll* ffa = dynamic_cast<FreeForAll*>(World::getWorld()); FreeForAll* ffa = dynamic_cast<FreeForAll*>(World::getWorld());
m_race_result = ffa->getKartFFAResult(getWorldKartId()); m_race_result = ffa->getKartFFAResult(getWorldKartId());
} }
else if (race_manager->getMajorMode() == RaceManager::MAJOR_MODE_CAPTURE_THE_FLAG) else if (race_manager->getMinorMode() == RaceManager::MINOR_MODE_CAPTURE_THE_FLAG)
{ {
CaptureTheFlag* ctf = dynamic_cast<CaptureTheFlag*>(World::getWorld()); CaptureTheFlag* ctf = dynamic_cast<CaptureTheFlag*>(World::getWorld());
m_race_result = ctf->getKartCTFResult(getWorldKartId()); m_race_result = ctf->getKartCTFResult(getWorldKartId());

View File

@ -78,7 +78,7 @@ RescueAnimation::RescueAnimation(AbstractKart *kart, bool is_auto_rescue,
m_velocity = max_height / timer; m_velocity = max_height / timer;
// Add a hit unless it was auto-rescue // Add a hit unless it was auto-rescue
if (race_manager->getMinorMode()==RaceManager::MINOR_MODE_BATTLE && if (race_manager->isBattleMode() &&
!is_auto_rescue) !is_auto_rescue)
{ {
World::getWorld()->kartHit(m_kart->getWorldKartId()); World::getWorld()->kartHit(m_kart->getWorldKartId());
@ -103,8 +103,8 @@ RescueAnimation::RescueAnimation(AbstractKart *kart, bool is_auto_rescue,
// Clear powerups when rescue in CTF // Clear powerups when rescue in CTF
if (!from_state) if (!from_state)
{ {
addNetworkAnimationChecker(race_manager->getMajorMode() == addNetworkAnimationChecker(race_manager->getMinorMode() ==
RaceManager::MAJOR_MODE_CAPTURE_THE_FLAG); RaceManager::MINOR_MODE_CAPTURE_THE_FLAG);
} }
} // RescueAnimation } // RescueAnimation

View File

@ -997,7 +997,7 @@ int handleCmdLine(bool has_server_config, bool has_parent_process)
if (!CommandLine::has("--track", &track)) if (!CommandLine::has("--track", &track))
track = "temple"; track = "temple";
UserConfigParams::m_arena_ai_stats=true; UserConfigParams::m_arena_ai_stats=true;
race_manager->setMinorMode(RaceManager::MINOR_MODE_BATTLE); race_manager->setMinorMode(RaceManager::MINOR_MODE_3_STRIKES);
std::vector<std::string> l; std::vector<std::string> l;
for (int i = 0; i < 8; i++) for (int i = 0; i < 8; i++)
l.push_back("tux"); l.push_back("tux");
@ -1113,7 +1113,7 @@ int handleCmdLine(bool has_server_config, bool has_parent_process)
case 2: case 2:
{ {
ServerConfig::m_server_mode = 7; ServerConfig::m_server_mode = 7;
race_manager->setMinorMode(RaceManager::MINOR_MODE_BATTLE); race_manager->setMinorMode(RaceManager::MINOR_MODE_FREE_FOR_ALL);
break; break;
} }
case 3: case 3:
@ -1134,8 +1134,7 @@ int handleCmdLine(bool has_server_config, bool has_parent_process)
const bool is_soccer = const bool is_soccer =
race_manager->getMinorMode() == RaceManager::MINOR_MODE_SOCCER; race_manager->getMinorMode() == RaceManager::MINOR_MODE_SOCCER;
const bool is_battle = const bool is_battle = race_manager->isBattleMode();
race_manager->getMinorMode() == RaceManager::MINOR_MODE_BATTLE;
if (!has_server_config) if (!has_server_config)
{ {
@ -1453,7 +1452,7 @@ int handleCmdLine(bool has_server_config, bool has_parent_process)
race_manager->setDefaultAIKartList(l); race_manager->setDefaultAIKartList(l);
// Add 1 for the player kart // Add 1 for the player kart
race_manager->setNumKarts(1); race_manager->setNumKarts(1);
race_manager->setMinorMode(RaceManager::MINOR_MODE_BATTLE); race_manager->setMinorMode(RaceManager::MINOR_MODE_3_STRIKES);
} }
else if (t->isSoccer()) else if (t->isSoccer())
{ {

View File

@ -564,3 +564,11 @@ unsigned int CaptureTheFlag::getRescuePositionIndex(AbstractKart *kart)
{ {
return m_kart_position_map.at(kart->getWorldKartId()); return m_kart_position_map.at(kart->getWorldKartId());
} // getRescuePositionIndex } // getRescuePositionIndex
// ----------------------------------------------------------------------------
/** Returns the internal identifier for this race.
*/
const std::string& CaptureTheFlag::getIdent() const
{
return IDENT_CTF;
} // getIdent

View File

@ -87,6 +87,8 @@ public:
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
virtual unsigned int getRescuePositionIndex(AbstractKart *kart) OVERRIDE; virtual unsigned int getRescuePositionIndex(AbstractKart *kart) OVERRIDE;
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
virtual const std::string& getIdent() const OVERRIDE;
// ------------------------------------------------------------------------
void attachFlag(NetworkString& ns); void attachFlag(NetworkString& ns);
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
void resetFlag(NetworkString& ns); void resetFlag(NetworkString& ns);

View File

@ -123,7 +123,7 @@ void FreeForAll::setKartScoreFromServer(NetworkString& ns)
*/ */
const std::string& FreeForAll::getIdent() const const std::string& FreeForAll::getIdent() const
{ {
return IDENT_STRIKES; return IDENT_FFA;
} // getIdent } // getIdent
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------

View File

@ -469,7 +469,7 @@ Controller* World::loadAIController(AbstractKart* kart)
Controller *controller; Controller *controller;
int turn=0; int turn=0;
if(race_manager->getMinorMode()==RaceManager::MINOR_MODE_BATTLE) if(race_manager->getMinorMode()==RaceManager::MINOR_MODE_3_STRIKES)
turn=1; turn=1;
else if(race_manager->getMinorMode()==RaceManager::MINOR_MODE_SOCCER) else if(race_manager->getMinorMode()==RaceManager::MINOR_MODE_SOCCER)
turn=2; turn=2;
@ -1678,15 +1678,13 @@ void World::updateAchievementModeCounters(bool start)
PlayerManager::increaseAchievement(start ? ACS::EGG_HUNT_STARTED : ACS::EGG_HUNT_FINISHED,1); PlayerManager::increaseAchievement(start ? ACS::EGG_HUNT_STARTED : ACS::EGG_HUNT_FINISHED,1);
else if (race_manager->isSoccerMode()) else if (race_manager->isSoccerMode())
PlayerManager::increaseAchievement(start ? ACS::SOCCER_STARTED : ACS::SOCCER_FINISHED,1); PlayerManager::increaseAchievement(start ? ACS::SOCCER_STARTED : ACS::SOCCER_FINISHED,1);
// FIXME : that the specific battle modes are defined as major modes
// is completely illogical !
else if (race_manager->isBattleMode()) else if (race_manager->isBattleMode())
{ {
if (race_manager->getMajorMode() == RaceManager::MAJOR_MODE_3_STRIKES) if (race_manager->getMinorMode() == RaceManager::MINOR_MODE_3_STRIKES)
PlayerManager::increaseAchievement(start ? ACS::THREE_STRIKES_STARTED : ACS::THREE_STRIKES_FINISHED,1); PlayerManager::increaseAchievement(start ? ACS::THREE_STRIKES_STARTED : ACS::THREE_STRIKES_FINISHED,1);
else if (race_manager->getMajorMode() == RaceManager::MAJOR_MODE_CAPTURE_THE_FLAG) else if (race_manager->getMinorMode() == RaceManager::MINOR_MODE_CAPTURE_THE_FLAG)
PlayerManager::increaseAchievement(start ? ACS::CTF_STARTED : ACS::CTF_FINISHED,1); PlayerManager::increaseAchievement(start ? ACS::CTF_STARTED : ACS::CTF_FINISHED,1);
else if (race_manager->getMajorMode() == RaceManager::MAJOR_MODE_FREE_FOR_ALL) else if (race_manager->getMinorMode() == RaceManager::MINOR_MODE_FREE_FOR_ALL)
PlayerManager::increaseAchievement(start ? ACS::FFA_STARTED : ACS::FFA_FINISHED,1); PlayerManager::increaseAchievement(start ? ACS::FFA_STARTED : ACS::FFA_FINISHED,1);
} }
else // normal races else // normal races

View File

@ -147,10 +147,10 @@ void GameSetup::loadWorld()
PlayerManager::getCurrentPlayer()->setCurrentChallenge(""); PlayerManager::getCurrentPlayer()->setCurrentChallenge("");
race_manager->setTimeTarget(0.0f); race_manager->setTimeTarget(0.0f);
if (race_manager->getMinorMode() == RaceManager::MINOR_MODE_SOCCER || if (race_manager->getMinorMode() == RaceManager::MINOR_MODE_SOCCER ||
race_manager->getMinorMode() == RaceManager::MINOR_MODE_BATTLE) race_manager->isBattleMode())
{ {
const bool is_ctf = race_manager->getMajorMode() == const bool is_ctf = race_manager->getMinorMode() ==
RaceManager::MAJOR_MODE_CAPTURE_THE_FLAG; RaceManager::MINOR_MODE_CAPTURE_THE_FLAG;
bool prev_val = UserConfigParams::m_random_arena_item; bool prev_val = UserConfigParams::m_random_arena_item;
if (is_ctf) if (is_ctf)
UserConfigParams::m_random_arena_item = false; UserConfigParams::m_random_arena_item = false;

View File

@ -275,7 +275,7 @@ void ClientLobby::addAllPlayers(Event* event)
} }
uint32_t random_seed = data.getUInt32(); uint32_t random_seed = data.getUInt32();
ItemManager::updateRandomSeed(random_seed); ItemManager::updateRandomSeed(random_seed);
if (race_manager->getMinorMode() == RaceManager::MINOR_MODE_BATTLE) if (race_manager->isBattleMode())
{ {
int hit_capture_limit = data.getUInt32(); int hit_capture_limit = data.getUInt32();
float time_limit = data.getFloat(); float time_limit = data.getFloat();
@ -466,16 +466,16 @@ void ClientLobby::displayPlayerVote(Event* event)
core::stringw yes = _("Yes"); core::stringw yes = _("Yes");
core::stringw no = _("No"); core::stringw no = _("No");
core::stringw vote_msg; core::stringw vote_msg;
if (race_manager->getMinorMode() == RaceManager::MINOR_MODE_BATTLE && if (race_manager->isBattleMode() &&
race_manager->getMajorMode() == RaceManager::MAJOR_MODE_FREE_FOR_ALL) race_manager->getMinorMode() == RaceManager::MINOR_MODE_FREE_FOR_ALL)
{ {
//I18N: Vote message in network game from a player //I18N: Vote message in network game from a player
vote_msg = _("Track: %s,\nrandom item location: %s", vote_msg = _("Track: %s,\nrandom item location: %s",
track_readable, rev == 1 ? yes : no); track_readable, rev == 1 ? yes : no);
} }
else if (race_manager->getMinorMode() == RaceManager::MINOR_MODE_BATTLE && else if (race_manager->isBattleMode() &&
race_manager->getMajorMode() == race_manager->getMinorMode() ==
RaceManager::MAJOR_MODE_CAPTURE_THE_FLAG) RaceManager::MINOR_MODE_CAPTURE_THE_FLAG)
{ {
//I18N: Vote message in network game from a player //I18N: Vote message in network game from a player
vote_msg = _("Track: %s", track_readable); vote_msg = _("Track: %s", track_readable);
@ -607,13 +607,8 @@ void ClientLobby::handleServerInfo(Event* event)
ServerConfig::m_server_mode = u_data; ServerConfig::m_server_mode = u_data;
auto game_mode = ServerConfig::getLocalGameMode(); auto game_mode = ServerConfig::getLocalGameMode();
race_manager->setMinorMode(game_mode.first); race_manager->setMinorMode(game_mode.first);
if (game_mode.first == RaceManager::MINOR_MODE_BATTLE) // We use single mode in network even it's grand prix
race_manager->setMajorMode(game_mode.second); race_manager->setMajorMode(RaceManager::MAJOR_MODE_SINGLE);
else
{
// We use single mode in network even it's grand prix
race_manager->setMajorMode(RaceManager::MAJOR_MODE_SINGLE);
}
//I18N: In the networking lobby //I18N: In the networking lobby
core::stringw mode_name = ServerConfig::getModeName(u_data); core::stringw mode_name = ServerConfig::getModeName(u_data);

View File

@ -175,14 +175,15 @@ void ServerLobby::setup()
} }
break; break;
} }
case RaceManager::MINOR_MODE_BATTLE: case RaceManager::MINOR_MODE_FREE_FOR_ALL:
case RaceManager::MINOR_MODE_CAPTURE_THE_FLAG:
{ {
auto it = m_available_kts.second.begin(); auto it = m_available_kts.second.begin();
while (it != m_available_kts.second.end()) while (it != m_available_kts.second.end())
{ {
Track* t = track_manager->getTrack(*it); Track* t = track_manager->getTrack(*it);
if (race_manager->getMajorMode() == if (race_manager->getMinorMode() ==
RaceManager::MAJOR_MODE_CAPTURE_THE_FLAG) RaceManager::MINOR_MODE_CAPTURE_THE_FLAG)
{ {
if (!t->isCTF() || t->isInternal()) if (!t->isCTF() || t->isInternal())
{ {
@ -541,7 +542,7 @@ void ServerLobby::asynchronousUpdate()
uint32_t random_seed = (uint32_t)StkTime::getTimeSinceEpoch(); uint32_t random_seed = (uint32_t)StkTime::getTimeSinceEpoch();
ItemManager::updateRandomSeed(random_seed); ItemManager::updateRandomSeed(random_seed);
load_world->addUInt32(random_seed); load_world->addUInt32(random_seed);
if (race_manager->getMinorMode() == RaceManager::MINOR_MODE_BATTLE) if (race_manager->isBattleMode())
{ {
auto hcl = getHitCaptureLimit((float)players.size()); auto hcl = getHitCaptureLimit((float)players.size());
load_world->addUInt32(hcl.first).addFloat(hcl.second); load_world->addUInt32(hcl.first).addFloat(hcl.second);
@ -904,8 +905,7 @@ void ServerLobby::startSelection(const Event *event)
m_available_kts.second.erase(track_erase); m_available_kts.second.erase(track_erase);
} }
if (race_manager->getMinorMode() == RaceManager::MINOR_MODE_BATTLE && if (race_manager->getMinorMode() == RaceManager::MINOR_MODE_FREE_FOR_ALL)
race_manager->getMajorMode() == RaceManager::MAJOR_MODE_FREE_FOR_ALL)
{ {
auto it = m_available_kts.second.begin(); auto it = m_available_kts.second.begin();
while (it != m_available_kts.second.end()) while (it != m_available_kts.second.end())
@ -2044,8 +2044,8 @@ std::pair<int, float> ServerLobby::getHitCaptureLimit(float num_karts)
// Read user_config.hpp for formula // Read user_config.hpp for formula
int hit_capture_limit = std::numeric_limits<int>::max(); int hit_capture_limit = std::numeric_limits<int>::max();
float time_limit = 0.0f; float time_limit = 0.0f;
if (race_manager->getMajorMode() == if (race_manager->getMinorMode() ==
RaceManager::MAJOR_MODE_CAPTURE_THE_FLAG) RaceManager::MINOR_MODE_CAPTURE_THE_FLAG)
{ {
if (ServerConfig::m_capture_limit_threshold > 0.0f) if (ServerConfig::m_capture_limit_threshold > 0.0f)
{ {

View File

@ -204,11 +204,11 @@ std::pair<RaceManager::MinorRaceModeType, RaceManager::MajorRaceModeType>
return { RaceManager::MINOR_MODE_SOCCER, return { RaceManager::MINOR_MODE_SOCCER,
RaceManager::MAJOR_MODE_SINGLE }; RaceManager::MAJOR_MODE_SINGLE };
case 7: case 7:
return { RaceManager::MINOR_MODE_BATTLE, return { RaceManager::MINOR_MODE_FREE_FOR_ALL,
RaceManager::MAJOR_MODE_FREE_FOR_ALL }; RaceManager::MAJOR_MODE_SINGLE };
case 8: case 8:
return { RaceManager::MINOR_MODE_BATTLE, return { RaceManager::MINOR_MODE_CAPTURE_THE_FLAG,
RaceManager::MAJOR_MODE_CAPTURE_THE_FLAG }; RaceManager::MAJOR_MODE_SINGLE };
default: default:
break; break;
} }
@ -278,8 +278,7 @@ void loadServerLobbyFromConfig()
race_manager->getMinorMode() == RaceManager::MINOR_MODE_SOCCER; race_manager->getMinorMode() == RaceManager::MINOR_MODE_SOCCER;
const bool is_gp = const bool is_gp =
race_manager->getMajorMode() == RaceManager::MAJOR_MODE_GRAND_PRIX; race_manager->getMajorMode() == RaceManager::MAJOR_MODE_GRAND_PRIX;
const bool is_battle = const bool is_battle = race_manager->isBattleMode();
race_manager->getMinorMode() == RaceManager::MINOR_MODE_BATTLE;
std::shared_ptr<LobbyProtocol> server_lobby; std::shared_ptr<LobbyProtocol> server_lobby;
server_lobby = STKHost::create(); server_lobby = STKHost::create();

View File

@ -551,13 +551,13 @@ void RaceManager::startNextRace()
World::setWorld(new StandardRace()); World::setWorld(new StandardRace());
else if(m_minor_mode==MINOR_MODE_TUTORIAL) else if(m_minor_mode==MINOR_MODE_TUTORIAL)
World::setWorld(new TutorialWorld()); World::setWorld(new TutorialWorld());
else if(m_minor_mode==MINOR_MODE_BATTLE) else if (isBattleMode())
{ {
if (m_major_mode == MAJOR_MODE_3_STRIKES) if (m_minor_mode == MINOR_MODE_3_STRIKES)
World::setWorld(new ThreeStrikesBattle()); World::setWorld(new ThreeStrikesBattle());
else if (m_major_mode == MAJOR_MODE_FREE_FOR_ALL) else if (m_minor_mode == MINOR_MODE_FREE_FOR_ALL)
World::setWorld(new FreeForAll()); World::setWorld(new FreeForAll());
else if (m_major_mode == MAJOR_MODE_CAPTURE_THE_FLAG) else if (m_minor_mode == MINOR_MODE_CAPTURE_THE_FLAG)
World::setWorld(new CaptureTheFlag()); World::setWorld(new CaptureTheFlag());
} }
else if(m_minor_mode==MINOR_MODE_SOCCER) else if(m_minor_mode==MINOR_MODE_SOCCER)
@ -959,8 +959,7 @@ void RaceManager::startSingleRace(const std::string &track_ident,
if (num_laps != -1) setNumLaps( num_laps ); if (num_laps != -1) setNumLaps( num_laps );
if (m_minor_mode != MINOR_MODE_BATTLE) setMajorMode(RaceManager::MAJOR_MODE_SINGLE);
setMajorMode(RaceManager::MAJOR_MODE_SINGLE);
setCoinTarget( 0 ); // Might still be set from a previous challenge setCoinTarget( 0 ); // Might still be set from a previous challenge

View File

@ -44,6 +44,8 @@ static const std::string IDENT_STD ("STANDARD" );
static const std::string IDENT_TTRIAL ("STD_TIMETRIAL" ); static const std::string IDENT_TTRIAL ("STD_TIMETRIAL" );
static const std::string IDENT_FTL ("FOLLOW_LEADER" ); static const std::string IDENT_FTL ("FOLLOW_LEADER" );
static const std::string IDENT_STRIKES ("BATTLE_3_STRIKES"); static const std::string IDENT_STRIKES ("BATTLE_3_STRIKES");
static const std::string IDENT_FFA ("BATTLE_FFA" );
static const std::string IDENT_CTF ("BATTLE_CTF" );
static const std::string IDENT_EASTER ("EASTER_EGG_HUNT" ); static const std::string IDENT_EASTER ("EASTER_EGG_HUNT" );
static const std::string IDENT_SOCCER ("SOCCER" ); static const std::string IDENT_SOCCER ("SOCCER" );
static const std::string IDENT_GHOST ("GHOST" ); static const std::string IDENT_GHOST ("GHOST" );
@ -89,11 +91,7 @@ public:
enum MajorRaceModeType enum MajorRaceModeType
{ {
MAJOR_MODE_GRAND_PRIX = 0, MAJOR_MODE_GRAND_PRIX = 0,
MAJOR_MODE_SINGLE, MAJOR_MODE_SINGLE
MAJOR_MODE_FREE_FOR_ALL,
MAJOR_MODE_CAPTURE_THE_FLAG,
MAJOR_MODE_3_STRIKES
}; };
// quick method to tell the difference between battle modes and race modes // quick method to tell the difference between battle modes and race modes
@ -115,8 +113,10 @@ public:
MINOR_MODE_TIME_TRIAL = LINEAR_RACE(1, true), MINOR_MODE_TIME_TRIAL = LINEAR_RACE(1, true),
MINOR_MODE_FOLLOW_LEADER = LINEAR_RACE(2, false), MINOR_MODE_FOLLOW_LEADER = LINEAR_RACE(2, false),
MINOR_MODE_BATTLE = BATTLE_ARENA(0), MINOR_MODE_3_STRIKES = BATTLE_ARENA(0),
MINOR_MODE_SOCCER = BATTLE_ARENA(1), MINOR_MODE_FREE_FOR_ALL = BATTLE_ARENA(1),
MINOR_MODE_CAPTURE_THE_FLAG = BATTLE_ARENA(2),
MINOR_MODE_SOCCER = BATTLE_ARENA(3),
MINOR_MODE_EASTER_EGG = EASTER_EGG(0), MINOR_MODE_EASTER_EGG = EASTER_EGG(0),
@ -142,12 +142,14 @@ public:
{ {
switch (mode) switch (mode)
{ {
case MINOR_MODE_NORMAL_RACE: return IDENT_STD; case MINOR_MODE_NORMAL_RACE: return IDENT_STD;
case MINOR_MODE_TIME_TRIAL: return IDENT_TTRIAL; case MINOR_MODE_TIME_TRIAL: return IDENT_TTRIAL;
case MINOR_MODE_FOLLOW_LEADER: return IDENT_FTL; case MINOR_MODE_FOLLOW_LEADER: return IDENT_FTL;
case MINOR_MODE_BATTLE: return IDENT_STRIKES; case MINOR_MODE_3_STRIKES: return IDENT_STRIKES;
case MINOR_MODE_EASTER_EGG: return IDENT_EASTER; case MINOR_MODE_FREE_FOR_ALL: return IDENT_FFA;
case MINOR_MODE_SOCCER: return IDENT_SOCCER; case MINOR_MODE_CAPTURE_THE_FLAG: return IDENT_CTF;
case MINOR_MODE_EASTER_EGG: return IDENT_EASTER;
case MINOR_MODE_SOCCER: return IDENT_SOCCER;
default: assert(false); default: assert(false);
return IDENT_STD; // stop compiler warning return IDENT_STD; // stop compiler warning
} }
@ -164,7 +166,9 @@ public:
case MINOR_MODE_NORMAL_RACE: return "/gui/icons/mode_normal.png"; case MINOR_MODE_NORMAL_RACE: return "/gui/icons/mode_normal.png";
case MINOR_MODE_TIME_TRIAL: return "/gui/icons/mode_tt.png"; case MINOR_MODE_TIME_TRIAL: return "/gui/icons/mode_tt.png";
case MINOR_MODE_FOLLOW_LEADER: return "/gui/icons/mode_ftl.png"; case MINOR_MODE_FOLLOW_LEADER: return "/gui/icons/mode_ftl.png";
case MINOR_MODE_BATTLE: return "/gui/icons/mode_3strikes.png"; case MINOR_MODE_3_STRIKES: return "/gui/icons/mode_3strikes.png";
case MINOR_MODE_FREE_FOR_ALL: return "/gui/icons/weapons.png";
case MINOR_MODE_CAPTURE_THE_FLAG: return "/gui/icons/weapons.png";
case MINOR_MODE_EASTER_EGG: return "/gui/icons/mode_easter.png"; case MINOR_MODE_EASTER_EGG: return "/gui/icons/mode_easter.png";
case MINOR_MODE_SOCCER: return "/gui/icons/mode_soccer.png"; case MINOR_MODE_SOCCER: return "/gui/icons/mode_soccer.png";
default: assert(false); return NULL; default: assert(false); return NULL;
@ -186,7 +190,11 @@ public:
//I18N: Game mode //I18N: Game mode
case MINOR_MODE_FOLLOW_LEADER: return _("Follow the Leader"); case MINOR_MODE_FOLLOW_LEADER: return _("Follow the Leader");
//I18N: Game mode //I18N: Game mode
case MINOR_MODE_BATTLE: return _("3 Strikes Battle"); case MINOR_MODE_3_STRIKES: return _("3 Strikes Battle");
//I18N: Game mode
case MINOR_MODE_FREE_FOR_ALL: return _("Free-For-All");
//I18N: Game mode
case MINOR_MODE_CAPTURE_THE_FLAG: return _("Capture The Flag");
//I18N: Game mode //I18N: Game mode
case MINOR_MODE_EASTER_EGG: return _("Egg Hunt"); case MINOR_MODE_EASTER_EGG: return _("Egg Hunt");
//I18N: Game mode //I18N: Game mode
@ -204,7 +212,9 @@ public:
case MINOR_MODE_NORMAL_RACE: return true; case MINOR_MODE_NORMAL_RACE: return true;
case MINOR_MODE_TIME_TRIAL: return true; case MINOR_MODE_TIME_TRIAL: return true;
case MINOR_MODE_FOLLOW_LEADER: return true; case MINOR_MODE_FOLLOW_LEADER: return true;
case MINOR_MODE_BATTLE: return true; case MINOR_MODE_3_STRIKES: return true;
case MINOR_MODE_FREE_FOR_ALL: return false;
case MINOR_MODE_CAPTURE_THE_FLAG: return false;
case MINOR_MODE_EASTER_EGG: return false; case MINOR_MODE_EASTER_EGG: return false;
case MINOR_MODE_SOCCER: return true; case MINOR_MODE_SOCCER: return true;
default: assert(false); return false; default: assert(false); return false;
@ -223,7 +233,9 @@ public:
if (name==IDENT_STD ) return MINOR_MODE_NORMAL_RACE; if (name==IDENT_STD ) return MINOR_MODE_NORMAL_RACE;
else if (name==IDENT_TTRIAL ) return MINOR_MODE_TIME_TRIAL; else if (name==IDENT_TTRIAL ) return MINOR_MODE_TIME_TRIAL;
else if (name==IDENT_FTL ) return MINOR_MODE_FOLLOW_LEADER; else if (name==IDENT_FTL ) return MINOR_MODE_FOLLOW_LEADER;
else if (name==IDENT_STRIKES) return MINOR_MODE_BATTLE; else if (name==IDENT_STRIKES) return MINOR_MODE_3_STRIKES;
else if (name==IDENT_FFA) return MINOR_MODE_FREE_FOR_ALL;
else if (name==IDENT_CTF) return MINOR_MODE_CAPTURE_THE_FLAG;
else if (name==IDENT_EASTER ) return MINOR_MODE_EASTER_EGG; else if (name==IDENT_EASTER ) return MINOR_MODE_EASTER_EGG;
else if (name==IDENT_SOCCER) return MINOR_MODE_SOCCER; else if (name==IDENT_SOCCER) return MINOR_MODE_SOCCER;
@ -537,7 +549,9 @@ public:
case MINOR_MODE_NORMAL_RACE: return "normal"; case MINOR_MODE_NORMAL_RACE: return "normal";
case MINOR_MODE_TIME_TRIAL: return "time-trial"; case MINOR_MODE_TIME_TRIAL: return "time-trial";
case MINOR_MODE_FOLLOW_LEADER: return "follow-the-leader"; case MINOR_MODE_FOLLOW_LEADER: return "follow-the-leader";
case MINOR_MODE_BATTLE: return "battle"; case MINOR_MODE_3_STRIKES: return "battle";
case MINOR_MODE_FREE_FOR_ALL: return "ffa";
case MINOR_MODE_CAPTURE_THE_FLAG: return "ctf";
case MINOR_MODE_EASTER_EGG: return "egg-hunt"; case MINOR_MODE_EASTER_EGG: return "egg-hunt";
case MINOR_MODE_SOCCER: return "soccer"; case MINOR_MODE_SOCCER: return "soccer";
default: assert(false); return ""; default: assert(false); return "";
@ -557,7 +571,7 @@ public:
*/ */
int getNumLaps() const int getNumLaps() const
{ {
if(m_minor_mode==MINOR_MODE_BATTLE || if(isBattleMode() ||
m_minor_mode==MINOR_MODE_FOLLOW_LEADER || m_minor_mode==MINOR_MODE_FOLLOW_LEADER ||
m_minor_mode==MINOR_MODE_SOCCER || m_minor_mode==MINOR_MODE_SOCCER ||
m_minor_mode==MINOR_MODE_EASTER_EGG ) m_minor_mode==MINOR_MODE_EASTER_EGG )
@ -700,23 +714,23 @@ public:
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
/** \brief Returns true if the current mode is a battle mode. */ /** \brief Returns true if the current mode is a battle mode. */
bool isBattleMode() bool isBattleMode() const
{ {
const int id = (int)m_minor_mode; const int id = (int)m_minor_mode;
// This uses the numerical id of the mode, see the macros // This uses the numerical id of the mode, see the macros
// LINEAR_RACE and BATTLE_ARENA above for exact meaning. // LINEAR_RACE and BATTLE_ARENA above for exact meaning.
if (id >= 2000 && id != 2001) return true; if (id >= 2000 && id != 2003) return true;
else return false; else return false;
} // isBattleMode } // isBattleMode
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
/** \brief Returns true if the current mode is a soccer mode. */ /** \brief Returns true if the current mode is a soccer mode. */
bool isSoccerMode() bool isSoccerMode() const
{ {
const int id = (int)m_minor_mode; const int id = (int)m_minor_mode;
// This uses the numerical id of the mode, see the macros // This uses the numerical id of the mode, see the macros
// LINEAR_RACE and BATTLE_ARENA above for exact meaning. // LINEAR_RACE and BATTLE_ARENA above for exact meaning.
if (id == 2001) return true; if (id == 2003) return true;
else return false; else return false;
} // isSoccerMode } // isSoccerMode
@ -770,8 +784,8 @@ public:
// and each World may set m_use_highscores to true or false. // and each World may set m_use_highscores to true or false.
// The reason for this duplication is that we might want to know // The reason for this duplication is that we might want to know
// whether to display highscores without creating a World. // whether to display highscores without creating a World.
return m_minor_mode != MINOR_MODE_BATTLE && return !isBattleMode() &&
m_minor_mode != MINOR_MODE_SOCCER && !isSoccerMode() &&
m_minor_mode != MINOR_MODE_FOLLOW_LEADER; m_minor_mode != MINOR_MODE_FOLLOW_LEADER;
} // modeHasHighscore } // modeHasHighscore
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
@ -882,7 +896,7 @@ public:
bool teamEnabled() const bool teamEnabled() const
{ {
return m_minor_mode == MINOR_MODE_SOCCER || return m_minor_mode == MINOR_MODE_SOCCER ||
m_major_mode == MAJOR_MODE_CAPTURE_THE_FLAG; m_minor_mode == MINOR_MODE_CAPTURE_THE_FLAG;
} }
}; // RaceManager }; // RaceManager

View File

@ -212,7 +212,7 @@ void TracksScreen::beforeAddingWidget()
RaceManager::MinorRaceModeType minor_mode = race_manager->getMinorMode(); RaceManager::MinorRaceModeType minor_mode = race_manager->getMinorMode();
bool is_soccer = minor_mode == RaceManager::MINOR_MODE_SOCCER; bool is_soccer = minor_mode == RaceManager::MINOR_MODE_SOCCER;
bool is_arena = is_soccer || minor_mode == RaceManager::MINOR_MODE_BATTLE; bool is_arena = is_soccer || race_manager->isBattleMode();
const std::vector<std::string>& groups = const std::vector<std::string>& groups =
is_arena ? track_manager->getAllArenaGroups(is_soccer) is_arena ? track_manager->getAllArenaGroups(is_soccer)
@ -278,8 +278,7 @@ void TracksScreen::init()
if (UserConfigParams::m_num_laps == 0 || if (UserConfigParams::m_num_laps == 0 ||
UserConfigParams::m_num_laps > 20) UserConfigParams::m_num_laps > 20)
UserConfigParams::m_num_laps = 1; UserConfigParams::m_num_laps = 1;
if (race_manager->getMinorMode() == RaceManager::MINOR_MODE_BATTLE && if (race_manager->getMinorMode() == RaceManager::MINOR_MODE_FREE_FOR_ALL)
race_manager->getMajorMode() == RaceManager::MAJOR_MODE_FREE_FOR_ALL)
{ {
getWidget("lap-text")->setVisible(false); getWidget("lap-text")->setVisible(false);
m_laps->setVisible(false); m_laps->setVisible(false);
@ -289,8 +288,7 @@ void TracksScreen::init()
m_reversed->setVisible(true); m_reversed->setVisible(true);
m_reversed->setState(UserConfigParams::m_random_arena_item); m_reversed->setState(UserConfigParams::m_random_arena_item);
} }
else if (race_manager->getMinorMode() == RaceManager::MINOR_MODE_BATTLE && else if (race_manager->getMinorMode() == RaceManager::MINOR_MODE_CAPTURE_THE_FLAG)
race_manager->getMajorMode() == RaceManager::MAJOR_MODE_CAPTURE_THE_FLAG)
{ {
getWidget("lap-text")->setVisible(false); getWidget("lap-text")->setVisible(false);
m_laps->setVisible(false); m_laps->setVisible(false);
@ -471,7 +469,7 @@ void TracksScreen::voteForPlayer()
assert(m_laps); assert(m_laps);
assert(m_reversed); assert(m_reversed);
// Remember reverse globally for each stk instance if not arena // Remember reverse globally for each stk instance if not arena
if (race_manager->getMinorMode() != RaceManager::MINOR_MODE_BATTLE && if (!race_manager->isBattleMode() &&
race_manager->getMinorMode() != RaceManager::MINOR_MODE_SOCCER) race_manager->getMinorMode() != RaceManager::MINOR_MODE_SOCCER)
{ {
UserConfigParams::m_num_laps = m_laps->getValue(); UserConfigParams::m_num_laps = m_laps->getValue();
@ -482,13 +480,13 @@ void TracksScreen::voteForPlayer()
NetworkString vote(PROTOCOL_LOBBY_ROOM); NetworkString vote(PROTOCOL_LOBBY_ROOM);
vote.addUInt8(LobbyProtocol::LE_VOTE); vote.addUInt8(LobbyProtocol::LE_VOTE);
if (race_manager->getMajorMode() == RaceManager::MAJOR_MODE_FREE_FOR_ALL) if (race_manager->getMinorMode() == RaceManager::MINOR_MODE_FREE_FOR_ALL)
{ {
vote.encodeString(m_selected_track->getIdent()) vote.encodeString(m_selected_track->getIdent())
.addUInt8(0).addUInt8(m_reversed->getState() ? 1 : 0); .addUInt8(0).addUInt8(m_reversed->getState() ? 1 : 0);
} }
else if (race_manager->getMajorMode() == else if (race_manager->getMinorMode() ==
RaceManager::MAJOR_MODE_CAPTURE_THE_FLAG) RaceManager::MINOR_MODE_CAPTURE_THE_FLAG)
{ {
vote.encodeString(m_selected_track->getIdent()) vote.encodeString(m_selected_track->getIdent())
.addUInt8(0).addUInt8(0); .addUInt8(0).addUInt8(0);

View File

@ -85,7 +85,7 @@ RaceGUI::RaceGUI()
m_negative_timer_additional_width = area.Width; m_negative_timer_additional_width = area.Width;
if (race_manager->getMinorMode()==RaceManager::MINOR_MODE_FOLLOW_LEADER || if (race_manager->getMinorMode()==RaceManager::MINOR_MODE_FOLLOW_LEADER ||
race_manager->getMinorMode()==RaceManager::MINOR_MODE_BATTLE || race_manager->isBattleMode() ||
race_manager->getNumLaps() > 9) race_manager->getNumLaps() > 9)
m_lap_width = font->getDimension(L"99/99").Width; m_lap_width = font->getDimension(L"99/99").Width;
else else
@ -370,8 +370,8 @@ void RaceGUI::drawGlobalTimer()
float elapsed_time = World::getWorld()->getTime(); float elapsed_time = World::getWorld()->getTime();
if (!race_manager->hasTimeTarget() || if (!race_manager->hasTimeTarget() ||
race_manager ->getMinorMode()==RaceManager::MINOR_MODE_SOCCER || race_manager ->getMinorMode()==RaceManager::MINOR_MODE_SOCCER ||
race_manager->getMajorMode() == RaceManager::MAJOR_MODE_FREE_FOR_ALL || race_manager->getMinorMode() == RaceManager::MINOR_MODE_FREE_FOR_ALL ||
race_manager->getMajorMode() == RaceManager::MAJOR_MODE_CAPTURE_THE_FLAG) race_manager->getMinorMode() == RaceManager::MINOR_MODE_CAPTURE_THE_FLAG)
{ {
sw = core::stringw ( sw = core::stringw (
StringUtils::timeToString(elapsed_time).c_str() ); StringUtils::timeToString(elapsed_time).c_str() );

View File

@ -770,7 +770,7 @@ void RaceGUIBase::drawGlobalPlayerIcons(int bottom_margin)
if (kart->getPosition() == -1)//if position is not set if (kart->getPosition() == -1)//if position is not set
{ {
//we use karts ordered by id only //we use karts ordered by id only
//(needed for beginning of MINOR_MODE_BATTLE) //(needed for beginning of battle mode)
kart= world->getKart(position-1); kart= world->getKart(position-1);
} }
@ -782,7 +782,9 @@ void RaceGUIBase::drawGlobalPlayerIcons(int bottom_margin)
int lap = info.lap; int lap = info.lap;
// In battle mode mode there is no distance along track etc. // In battle mode mode there is no distance along track etc.
if( minor_mode==RaceManager::MINOR_MODE_BATTLE || if (minor_mode==RaceManager::MINOR_MODE_3_STRIKES ||
minor_mode==RaceManager::MINOR_MODE_FREE_FOR_ALL ||
minor_mode==RaceManager::MINOR_MODE_CAPTURE_THE_FLAG ||
minor_mode==RaceManager::MINOR_MODE_EASTER_EGG) minor_mode==RaceManager::MINOR_MODE_EASTER_EGG)
{ {
x = x_base; x = x_base;

View File

@ -699,8 +699,8 @@ void RaceResultGUI::displayCTFResults()
{ {
ri->m_finish_time_string = core::stringw(_("Eliminated")); ri->m_finish_time_string = core::stringw(_("Eliminated"));
} }
else if (race_manager->getMajorMode() == RaceManager::MAJOR_MODE_FREE_FOR_ALL || else if (race_manager->getMinorMode() == RaceManager::MINOR_MODE_FREE_FOR_ALL ||
race_manager->getMajorMode() == RaceManager::MAJOR_MODE_CAPTURE_THE_FLAG) race_manager->getMinorMode() == RaceManager::MINOR_MODE_CAPTURE_THE_FLAG)
{ {
assert(ffa); assert(ffa);
ri->m_finish_time_string = ri->m_finish_time_string =
@ -978,8 +978,8 @@ void RaceResultGUI::displayCTFResults()
{ {
displaySoccerResults(); displaySoccerResults();
} }
else if (race_manager->getMajorMode() == else if (race_manager->getMinorMode() ==
RaceManager::MAJOR_MODE_CAPTURE_THE_FLAG) RaceManager::MINOR_MODE_CAPTURE_THE_FLAG)
{ {
displayCTFResults(); displayCTFResults();
} }

View File

@ -109,10 +109,10 @@ void RaceSetupScreen::init()
} }
irr::core::stringw name4 = irr::core::stringw( irr::core::stringw name4 = irr::core::stringw(
RaceManager::getNameOf(RaceManager::MINOR_MODE_BATTLE)) + L"\n"; RaceManager::getNameOf(RaceManager::MINOR_MODE_3_STRIKES)) + L"\n";
//FIXME: avoid duplicating descriptions from the help menu! //FIXME: avoid duplicating descriptions from the help menu!
name4 += _("Hit others with weapons until they lose all their lives."); name4 += _("Hit others with weapons until they lose all their lives.");
w2->addItem( name4, IDENT_STRIKES, RaceManager::getIconOf(RaceManager::MINOR_MODE_BATTLE)); w2->addItem( name4, IDENT_STRIKES, RaceManager::getIconOf(RaceManager::MINOR_MODE_3_STRIKES));
irr::core::stringw name5 = irr::core::stringw( irr::core::stringw name5 = irr::core::stringw(
RaceManager::getNameOf(RaceManager::MINOR_MODE_SOCCER)) + L"\n"; RaceManager::getNameOf(RaceManager::MINOR_MODE_SOCCER)) + L"\n";
@ -224,8 +224,7 @@ void RaceSetupScreen::eventCallback(Widget* widget, const std::string& name,
} }
else if (selectedMode == IDENT_STRIKES) else if (selectedMode == IDENT_STRIKES)
{ {
race_manager->setMinorMode(RaceManager::MINOR_MODE_BATTLE); race_manager->setMinorMode(RaceManager::MINOR_MODE_3_STRIKES);
race_manager->setMajorMode(RaceManager::MAJOR_MODE_3_STRIKES);
UserConfigParams::m_game_mode = CONFIG_CODE_3STRIKES; UserConfigParams::m_game_mode = CONFIG_CODE_3STRIKES;
ArenasScreen::getInstance()->push(); ArenasScreen::getInstance()->push();
} }

View File

@ -153,7 +153,7 @@ void TrackInfoScreen::init()
// ------------- // -------------
const int local_players = race_manager->getNumLocalPlayers(); const int local_players = race_manager->getNumLocalPlayers();
const bool has_AI = const bool has_AI =
(race_manager->getMinorMode() == RaceManager::MINOR_MODE_BATTLE || (race_manager->getMinorMode() == RaceManager::MINOR_MODE_3_STRIKES ||
race_manager->getMinorMode() == RaceManager::MINOR_MODE_SOCCER ? race_manager->getMinorMode() == RaceManager::MINOR_MODE_SOCCER ?
m_track->hasNavMesh() && (max_arena_players - local_players) > 0 : m_track->hasNavMesh() && (max_arena_players - local_players) > 0 :
race_manager->hasAI()); race_manager->hasAI());
@ -175,7 +175,7 @@ void TrackInfoScreen::init()
race_manager->setNumKarts(num_ai + local_players); race_manager->setNumKarts(num_ai + local_players);
// Set the max karts supported based on the battle arena selected // Set the max karts supported based on the battle arena selected
if(race_manager->getMinorMode()==RaceManager::MINOR_MODE_BATTLE || if(race_manager->getMinorMode()==RaceManager::MINOR_MODE_3_STRIKES ||
race_manager->getMinorMode()==RaceManager::MINOR_MODE_SOCCER) race_manager->getMinorMode()==RaceManager::MINOR_MODE_SOCCER)
{ {
m_ai_kart_spinner->setMax(max_arena_players - local_players); m_ai_kart_spinner->setMax(max_arena_players - local_players);
@ -188,7 +188,7 @@ void TrackInfoScreen::init()
m_ai_kart_spinner->setMin(std::max(0, 3 - local_players)); m_ai_kart_spinner->setMin(std::max(0, 3 - local_players));
} }
// Make sure in battle and soccer mode at least 1 ai for single player // Make sure in battle and soccer mode at least 1 ai for single player
else if((race_manager->getMinorMode()==RaceManager::MINOR_MODE_BATTLE || else if((race_manager->getMinorMode()==RaceManager::MINOR_MODE_3_STRIKES ||
race_manager->getMinorMode()==RaceManager::MINOR_MODE_SOCCER) && race_manager->getMinorMode()==RaceManager::MINOR_MODE_SOCCER) &&
local_players == 1 && local_players == 1 &&
!UserConfigParams::m_artist_debug_mode) !UserConfigParams::m_artist_debug_mode)
@ -364,7 +364,7 @@ void TrackInfoScreen::onEnterPressedInternal()
const int max_arena_players = m_track->getMaxArenaPlayers(); const int max_arena_players = m_track->getMaxArenaPlayers();
const int local_players = race_manager->getNumLocalPlayers(); const int local_players = race_manager->getNumLocalPlayers();
const bool has_AI = const bool has_AI =
(race_manager->getMinorMode() == RaceManager::MINOR_MODE_BATTLE || (race_manager->getMinorMode() == RaceManager::MINOR_MODE_3_STRIKES ||
race_manager->getMinorMode() == RaceManager::MINOR_MODE_SOCCER ? race_manager->getMinorMode() == RaceManager::MINOR_MODE_SOCCER ?
m_track->hasNavMesh() && (max_arena_players - local_players) > 0 : m_track->hasNavMesh() && (max_arena_players - local_players) > 0 :
race_manager->hasAI()); race_manager->hasAI());

View File

@ -730,8 +730,8 @@ DriveNode* DriveGraph::getNode(unsigned int j) const
bool DriveGraph::hasLapLine() const bool DriveGraph::hasLapLine() const
{ {
if (Track::getCurrentTrack()->isCTF() && if (Track::getCurrentTrack()->isCTF() &&
race_manager->getMajorMode() == race_manager->getMinorMode() ==
RaceManager::MAJOR_MODE_CAPTURE_THE_FLAG) RaceManager::MINOR_MODE_CAPTURE_THE_FLAG)
return false; return false;
return true; return true;
} // hasLapLine } // hasLapLine

View File

@ -423,7 +423,7 @@ RenderTarget* Graph::makeMiniMap(const core::dimension2du &dimension,
// Adjust bounding boxes for flags in CTF // Adjust bounding boxes for flags in CTF
if (Track::getCurrentTrack()->isCTF() && if (Track::getCurrentTrack()->isCTF() &&
race_manager->getMajorMode() == RaceManager::MAJOR_MODE_CAPTURE_THE_FLAG) race_manager->getMinorMode() == RaceManager::MINOR_MODE_CAPTURE_THE_FLAG)
{ {
Vec3 red_flag = Track::getCurrentTrack()->getRedFlag().getOrigin(); Vec3 red_flag = Track::getCurrentTrack()->getRedFlag().getOrigin();
Vec3 blue_flag = Track::getCurrentTrack()->getBlueFlag().getOrigin(); Vec3 blue_flag = Track::getCurrentTrack()->getBlueFlag().getOrigin();

View File

@ -1828,7 +1828,7 @@ void Track::loadTrackModel(bool reverse_track, unsigned int mode_id)
// map to. // map to.
// Load the un-raycasted flag position first (for minimap) // Load the un-raycasted flag position first (for minimap)
if (m_is_ctf && if (m_is_ctf &&
race_manager->getMajorMode() == RaceManager::MAJOR_MODE_CAPTURE_THE_FLAG) race_manager->getMinorMode() == RaceManager::MINOR_MODE_CAPTURE_THE_FLAG)
{ {
for (unsigned int i=0; i<root->getNumNodes(); i++) for (unsigned int i=0; i<root->getNumNodes(); i++)
{ {
@ -2100,7 +2100,7 @@ void Track::loadTrackModel(bool reverse_track, unsigned int mode_id)
} // for i<root->getNumNodes() } // for i<root->getNumNodes()
} }
if (m_is_ctf && if (m_is_ctf &&
race_manager->getMajorMode() == RaceManager::MAJOR_MODE_CAPTURE_THE_FLAG) race_manager->getMinorMode() == RaceManager::MINOR_MODE_CAPTURE_THE_FLAG)
{ {
for (unsigned int i=0; i<root->getNumNodes(); i++) for (unsigned int i=0; i<root->getNumNodes(); i++)
{ {
@ -2127,7 +2127,7 @@ void Track::loadTrackModel(bool reverse_track, unsigned int mode_id)
// Only print warning if not in battle mode, since battle tracks don't have // Only print warning if not in battle mode, since battle tracks don't have
// any quads or check lines. // any quads or check lines.
if (CheckManager::get()->getCheckStructureCount()==0 && if (CheckManager::get()->getCheckStructureCount()==0 &&
race_manager->getMinorMode()!=RaceManager::MINOR_MODE_BATTLE && !m_is_cutscene) !race_manager->isBattleMode() && !m_is_cutscene)
{ {
Log::warn("track", "No check lines found in track '%s'.", Log::warn("track", "No check lines found in track '%s'.",
m_ident.c_str()); m_ident.c_str());
@ -2183,8 +2183,8 @@ void Track::loadObjects(const XMLNode* root, const std::string& path, ModelDefin
unsigned int start_position_counter = 0; unsigned int start_position_counter = 0;
unsigned int node_count = root->getNumNodes(); unsigned int node_count = root->getNumNodes();
const bool is_mode_ctf = m_is_ctf && race_manager->getMajorMode() == const bool is_mode_ctf = m_is_ctf && race_manager->getMinorMode() ==
RaceManager::MAJOR_MODE_CAPTURE_THE_FLAG; RaceManager::MINOR_MODE_CAPTURE_THE_FLAG;
for (unsigned int i = 0; i < node_count; i++) for (unsigned int i = 0; i < node_count; i++)
{ {
@ -2522,7 +2522,7 @@ void Track::itemCommand(const XMLNode *node)
const std::string &name = node->getName(); const std::string &name = node->getName();
const bool is_mode_ctf = m_is_ctf && const bool is_mode_ctf = m_is_ctf &&
race_manager->getMajorMode() == RaceManager::MAJOR_MODE_CAPTURE_THE_FLAG; race_manager->getMinorMode() == RaceManager::MINOR_MODE_CAPTURE_THE_FLAG;
bool ctf = false; bool ctf = false;
node->get("ctf", &ctf); node->get("ctf", &ctf);
if ((is_mode_ctf && !ctf) || (!is_mode_ctf && ctf)) if ((is_mode_ctf && !ctf) || (!is_mode_ctf && ctf))