Big overhaul of challenges. Bumped challenge XML file format to version 2.0. Now each challenge file speficies 3 difficulty levels. Started adapting unlock manager for these changes.
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@10727 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
47a7076ab0
commit
57b727f68d
File diff suppressed because one or more lines are too long
@ -1,17 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<challenge
|
||||
version="1"
|
||||
id="worldsend"
|
||||
name="Win the At World's End Grand Prix"
|
||||
description="Come first in the At World's End Grand Prix with 3 Expert AI karts."
|
||||
unlock-gp="alltracks"
|
||||
depend-on="islandfollow minestime"
|
||||
major="grandprix"
|
||||
minor="quickrace"
|
||||
gp="atworldsend"
|
||||
difficulty="hard"
|
||||
karts="4"
|
||||
position="1"
|
||||
/>
|
||||
|
@ -1,19 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<challenge
|
||||
version="1"
|
||||
id="islandfollow"
|
||||
name="Follow the Leader on a Desert Island"
|
||||
description="Win a Follow the Leader race with 3 AI karts on a Desert Island."
|
||||
unlock-gp="atworldsend"
|
||||
depend-on="minigolf"
|
||||
major="single"
|
||||
minor="followtheleader"
|
||||
track="islandtrack"
|
||||
difficulty="hard"
|
||||
laps="3"
|
||||
karts="4"
|
||||
position="2"
|
||||
/>
|
||||
|
||||
|
18
data/challenges/city.challenge
Normal file
18
data/challenges/city.challenge
Normal file
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0"?>
|
||||
<challenge version="2">
|
||||
<track id="city" laps="3"/>
|
||||
<mode major="single" minor="quickrace"/>
|
||||
|
||||
<hard>
|
||||
<karts number="5"/>
|
||||
<requirements position="1"/>
|
||||
</hard>
|
||||
<medium>
|
||||
<karts number="4"/>
|
||||
<requirements position="1"/>
|
||||
</medium>
|
||||
<easy>
|
||||
<karts number="3"/>
|
||||
<requirements position="1"/>
|
||||
</easy>
|
||||
</challenge>
|
@ -1,19 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<challenge
|
||||
version="1"
|
||||
id="energymathclass"
|
||||
name="Collect Nitro in Math Class"
|
||||
description="Finish with at least 10 points of nitro on three laps of Oliver's Math Class in under 55 seconds."
|
||||
unlock-track="crescentcrossing"
|
||||
depend-on="penguinplaygroundgp"
|
||||
major="single"
|
||||
minor="quickrace"
|
||||
track="olivermath"
|
||||
difficulty="hard"
|
||||
laps="3"
|
||||
karts="1"
|
||||
energy="10"
|
||||
time="55"
|
||||
/>
|
||||
|
18
data/challenges/farm.challenge
Normal file
18
data/challenges/farm.challenge
Normal file
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0"?>
|
||||
<challenge version="2">
|
||||
<track id="farm" laps="3"/>
|
||||
<mode major="single" minor="quickrace"/>
|
||||
|
||||
<hard>
|
||||
<karts number="5"/>
|
||||
<requirements position="1" time="130"/>
|
||||
</hard>
|
||||
<medium>
|
||||
<karts number="4"/>
|
||||
<requirements time="140"/>
|
||||
</medium>
|
||||
<easy>
|
||||
<karts number="4"/>
|
||||
<requirements time="150"/>
|
||||
</easy>
|
||||
</challenge>
|
@ -1,16 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<challenge
|
||||
version="1"
|
||||
id="penguinplaygroundgp"
|
||||
name="Win Penguin Playground Grand Prix"
|
||||
description="Win Penguin Playground Grand Prix with 3 Expert Level AI karts."
|
||||
unlock-mode="FOLLOW_LEADER"
|
||||
major="grandprix"
|
||||
minor="quickrace"
|
||||
gp="penguinplayground"
|
||||
difficulty="hard"
|
||||
karts="4"
|
||||
position="1"
|
||||
/>
|
||||
|
@ -1,18 +1,18 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<challenge
|
||||
version="1"
|
||||
id="minestime"
|
||||
name="Finish Mines in 3:00"
|
||||
description="Finish 3 laps in mines with 3 expert AI karts in under 3:00 minutes."
|
||||
depend-on="energyxr591"
|
||||
unlock-track="fortmagma"
|
||||
major="single"
|
||||
minor="quickrace"
|
||||
track="mines"
|
||||
difficulty="hard"
|
||||
laps="3"
|
||||
karts="4"
|
||||
time="180"
|
||||
/>
|
||||
|
||||
<challenge version="2">
|
||||
<track id="fortmagma" laps="3"/>
|
||||
<mode major="single" minor="quickrace"/>
|
||||
|
||||
<hard>
|
||||
<karts number="2"/>
|
||||
<requirements position="1"/>
|
||||
</hard>
|
||||
<medium>
|
||||
<karts number="2"/>
|
||||
<requirements position="1"/>
|
||||
</medium>
|
||||
<easy>
|
||||
<karts number="2"/>
|
||||
<requirements position="1"/>
|
||||
</easy>
|
||||
</challenge>
|
||||
|
@ -1,18 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<challenge
|
||||
version="1"
|
||||
id="fortmagma"
|
||||
name="Win a race on Fort Magma"
|
||||
description="Win a 3 lap race on Fort Magma against 3 Expert level AI karts."
|
||||
depend-on="worldsend"
|
||||
unlock-kart="gnu"
|
||||
major="single"
|
||||
minor="quickrace"
|
||||
track="fortmagma"
|
||||
difficulty="hard"
|
||||
laps="3"
|
||||
karts="4"
|
||||
position="1"
|
||||
/>
|
||||
|
@ -1,17 +1,18 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<challenge
|
||||
version="1"
|
||||
id="farmtracktime"
|
||||
name="Finish Farm in 2:30"
|
||||
description="Finish 3 laps in Farm with 3 easy AI karts in under 2:30 minutes."
|
||||
unlock-track="hacienda"
|
||||
major="single"
|
||||
minor="quickrace"
|
||||
track="farm"
|
||||
difficulty="easy"
|
||||
laps="3"
|
||||
karts="4"
|
||||
time="150"
|
||||
/>
|
||||
|
||||
<challenge version="2">
|
||||
<track id="hacienda" laps="3"/>
|
||||
<mode major="single" minor="quickrace"/>
|
||||
|
||||
<hard>
|
||||
<karts number="5"/>
|
||||
<requirements position="1" time="152"/>
|
||||
</hard>
|
||||
<medium>
|
||||
<karts number="4"/>
|
||||
<requirements time="165"/>
|
||||
</medium>
|
||||
<easy>
|
||||
<karts number="4"/>
|
||||
<requirements time="175"/>
|
||||
</easy>
|
||||
</challenge>
|
||||
|
@ -1,17 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<challenge
|
||||
version="1"
|
||||
id="snowmountain"
|
||||
name="Win a race on Snow Mountain"
|
||||
description="Win a 3 lap race on Northern Resort under 3:05 against 3 medium AI karts."
|
||||
unlock-track="islandtrack"
|
||||
major="single"
|
||||
minor="quickrace"
|
||||
track="snowmountain"
|
||||
difficulty="medium"
|
||||
laps="3"
|
||||
karts="4"
|
||||
time="185"
|
||||
/>
|
||||
|
19
data/challenges/islandtrack.challenge
Normal file
19
data/challenges/islandtrack.challenge
Normal file
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0"?>
|
||||
<challenge verison="2">
|
||||
<track id="islandtrack" laps="3"/>
|
||||
<mode major="single" minor="followtheleader"/>
|
||||
|
||||
<hard>
|
||||
<karts number="5"/>
|
||||
<requirements position="2"/>
|
||||
</hard>
|
||||
<medium>
|
||||
<karts number="4"/>
|
||||
<requirements position="2"/>
|
||||
</medium>
|
||||
<easy>
|
||||
<karts number="3"/>
|
||||
<requirements position="2"/>
|
||||
</easy>
|
||||
</challenge>
|
||||
|
18
data/challenges/jungle.challenge
Normal file
18
data/challenges/jungle.challenge
Normal file
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0"?>
|
||||
<challenge version="2">
|
||||
<track id="jungle" laps="3"/>
|
||||
<mode major="single" minor="quickrace"/>
|
||||
|
||||
<hard>
|
||||
<karts number="5"/>
|
||||
<requirements position="1" time="155"/>
|
||||
</hard>
|
||||
<medium>
|
||||
<karts number="4"/>
|
||||
<requirements time="165"/>
|
||||
</medium>
|
||||
<easy>
|
||||
<karts number="4"/>
|
||||
<requirements time="175"/>
|
||||
</easy>
|
||||
</challenge>
|
@ -1,19 +1,19 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<challenge
|
||||
version="1"
|
||||
id="starfollow"
|
||||
name="Follow the Leader around the Solar System"
|
||||
description="Win a Follow the Leader race with 5 AI karts on Star track"
|
||||
unlock-track="lighthouse"
|
||||
depend-on="farmtracktime penguinplaygroundgp"
|
||||
major="single"
|
||||
minor="followtheleader"
|
||||
track="startrack"
|
||||
difficulty="medium"
|
||||
laps="3"
|
||||
karts="6"
|
||||
position="2"
|
||||
/>
|
||||
|
||||
<challenge version="2">
|
||||
<track id="lighthouse" laps="3"/>
|
||||
<mode major="single" minor="quickrace"/>
|
||||
|
||||
<hard>
|
||||
<karts number="5"/>
|
||||
<requirements time="90" position="1"/>
|
||||
</hard>
|
||||
<medium>
|
||||
<karts number="4"/>
|
||||
<requirements time="95"/>
|
||||
</medium>
|
||||
<easy>
|
||||
<karts number="3"/>
|
||||
<requirements time="105"/>
|
||||
</easy>
|
||||
</challenge>
|
||||
|
||||
|
@ -1,19 +1,18 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<challenge
|
||||
version="1"
|
||||
id="energyxr591"
|
||||
name="Collect fuel for your rocket"
|
||||
description="Finish with at least 16 nitro points on 2 laps of XR591 in under 2:30 minutes."
|
||||
unlock-track="mines"
|
||||
depend-on="lighthousetime minigolf"
|
||||
major="single"
|
||||
minor="quickrace"
|
||||
track="xr591"
|
||||
difficulty="hard"
|
||||
karts="1"
|
||||
laps="2"
|
||||
energy="16"
|
||||
time="150"
|
||||
/>
|
||||
|
||||
<challenge version="2">
|
||||
<track id="mines" laps="3"/>
|
||||
<mode major="single" minor="quickrace"/>
|
||||
|
||||
<hard>
|
||||
<karts number="4"/>
|
||||
<requirements time="175"/>
|
||||
</hard>
|
||||
<medium>
|
||||
<karts number="4"/>
|
||||
<requirements time="190"/>
|
||||
</medium>
|
||||
<easy>
|
||||
<karts number="4"/>
|
||||
<requirements time="200"/>
|
||||
</easy>
|
||||
</challenge>
|
||||
|
@ -1,18 +1,18 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<challenge
|
||||
version="1"
|
||||
id="tollway"
|
||||
name="Win a race on Tux Tollway"
|
||||
description="Win a 3 lap race on Tux Tollway against 4 Expert level AI karts."
|
||||
depend-on="lighthousetime tothemoonandbackgp"
|
||||
unlock-track="minigolf"
|
||||
major="single"
|
||||
minor="quickrace"
|
||||
track="tuxtollway"
|
||||
difficulty="hard"
|
||||
laps="3"
|
||||
karts="5"
|
||||
position="1"
|
||||
/>
|
||||
|
||||
<challenge version="2">
|
||||
<track id="minigolf" laps="3"/>
|
||||
<mode major="single" minor="quickrace"/>
|
||||
|
||||
<hard>
|
||||
<karts number="5"/>
|
||||
<requirements position="1"/>
|
||||
</hard>
|
||||
<medium>
|
||||
<karts number="4"/>
|
||||
<requirements position="1"/>
|
||||
</medium>
|
||||
<easy>
|
||||
<karts number="3"/>
|
||||
<requirements position="1"/>
|
||||
</easy>
|
||||
</challenge>
|
||||
|
19
data/challenges/olivermath.challenge
Normal file
19
data/challenges/olivermath.challenge
Normal file
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0"?>
|
||||
<challenge version="2">
|
||||
<track id="olivermath" laps="3"/>
|
||||
<mode major="single" minor="quickrace"/>
|
||||
|
||||
<hard>
|
||||
<karts number="1"/>
|
||||
<requirements energy="14" time="55"/>
|
||||
</hard>
|
||||
<medium>
|
||||
<karts number="1"/>
|
||||
<requirements energy="10" time="105"/>
|
||||
</medium>
|
||||
<easy>
|
||||
<karts number="1"/>
|
||||
<requirements energy="6" time="115"/>
|
||||
</easy>
|
||||
</challenge>
|
||||
|
18
data/challenges/sandtrack.challenge
Normal file
18
data/challenges/sandtrack.challenge
Normal file
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0"?>
|
||||
<challenge version="2">
|
||||
<track id="sandtrack" laps="3"/>
|
||||
<mode major="single" minor="quickrace"/>
|
||||
|
||||
<hard>
|
||||
<karts number="1"/>
|
||||
<requirements energy="16" time="130"/>
|
||||
</hard>
|
||||
<medium>
|
||||
<karts number="1"/>
|
||||
<requirements energy="12" time="140"/>
|
||||
</medium>
|
||||
<easy>
|
||||
<karts number="1"/>
|
||||
<requirements energy="10" time="150"/>
|
||||
</easy>
|
||||
</challenge>
|
18
data/challenges/scotland.challenge
Normal file
18
data/challenges/scotland.challenge
Normal file
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0"?>
|
||||
<challenge version="2">
|
||||
<track id="scotland" laps="3"/>
|
||||
<mode major="single" minor="quickrace"/>
|
||||
|
||||
<hard>
|
||||
<karts number="5"/>
|
||||
<requirements position="1" time="160"/>
|
||||
</hard>
|
||||
<medium>
|
||||
<karts number="4"/>
|
||||
<requirements time="175"/>
|
||||
</medium>
|
||||
<easy>
|
||||
<karts number="4"/>
|
||||
<requirements time="190"/>
|
||||
</easy>
|
||||
</challenge>
|
@ -1,18 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<challenge
|
||||
version="1"
|
||||
id="gardenhead"
|
||||
name="Win a Head to Head in the Zen Garden"
|
||||
description="Win a 3 lap Head to Head in the Zen Garden against 1 easy level AI kart."
|
||||
depend-on="snowmountain"
|
||||
unlock-track="subsea"
|
||||
major="single"
|
||||
minor="timetrial"
|
||||
track="zengarden"
|
||||
difficulty="easy"
|
||||
laps="3"
|
||||
karts="2"
|
||||
position="1"
|
||||
/>
|
||||
|
@ -1,17 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<challenge
|
||||
version="1"
|
||||
id="tothemoonandbackgp"
|
||||
name="Win To the Moon and Back Grand Prix"
|
||||
description="Win the To the Moon and Back Grand Prix with 3 Expert Level AI karts."
|
||||
unlock-gp="snagdrive"
|
||||
depend-on="energyshiftingsands starfollow gardenhead"
|
||||
major="grandprix"
|
||||
minor="quickrace"
|
||||
gp="tothemoonandback"
|
||||
difficulty="hard"
|
||||
karts="4"
|
||||
position="1"
|
||||
/>
|
||||
|
18
data/challenges/snowmountain.challenge
Normal file
18
data/challenges/snowmountain.challenge
Normal file
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0"?>
|
||||
<challenge version="2">
|
||||
<track id="snowmountain" laps="3"/>
|
||||
<mode major="single" minor="quickrace"/>
|
||||
|
||||
<hard>
|
||||
<karts number="5"/>
|
||||
<requirements time="170"/>
|
||||
</hard>
|
||||
<medium>
|
||||
<karts number="4"/>
|
||||
<requirements time="185"/>
|
||||
</medium>
|
||||
<easy>
|
||||
<karts number="4"/>
|
||||
<requirements time="195"/>
|
||||
</easy>
|
||||
</challenge>
|
18
data/challenges/snowpeak.challenge
Normal file
18
data/challenges/snowpeak.challenge
Normal file
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0"?>
|
||||
<challenge version="2">
|
||||
<track id="snowtuxpeak" laps="3"/>
|
||||
<mode major="single" minor="quickrace"/>
|
||||
|
||||
<hard>
|
||||
<karts number="5"/>
|
||||
<requirements position="1" time="137"/>
|
||||
</hard>
|
||||
<medium>
|
||||
<karts number="4"/>
|
||||
<requirements time="150"/>
|
||||
</medium>
|
||||
<easy>
|
||||
<karts number="4"/>
|
||||
<requirements time="160"/>
|
||||
</easy>
|
||||
</challenge>
|
18
data/challenges/startrack.challenge
Normal file
18
data/challenges/startrack.challenge
Normal file
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0"?>
|
||||
<challenge version="2">
|
||||
<track id="startrack" laps="3"/>
|
||||
<mode major="single" minor="followtheleader"/>
|
||||
|
||||
<hard>
|
||||
<karts number="6"/>
|
||||
<requirements position="2"/>
|
||||
</hard>
|
||||
<medium>
|
||||
<karts number="6"/>
|
||||
<requirements position="2"/>
|
||||
</medium>
|
||||
<easy>
|
||||
<karts number="6"/>
|
||||
<requirements position="2"/>
|
||||
</easy>
|
||||
</challenge>
|
18
data/challenges/subsea.challenge
Normal file
18
data/challenges/subsea.challenge
Normal file
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0"?>
|
||||
<challenge version="2">
|
||||
<track id="subsea" laps="2"/>
|
||||
<mode major="single" minor="quickrace"/>
|
||||
|
||||
<hard>
|
||||
<karts number="5"/>
|
||||
<requirements position="1" time="205"/>
|
||||
</hard>
|
||||
<medium>
|
||||
<karts number="4"/>
|
||||
<requirements time="215"/>
|
||||
</medium>
|
||||
<easy>
|
||||
<karts number="4"/>
|
||||
<requirements time="225"/>
|
||||
</easy>
|
||||
</challenge>
|
@ -1,18 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<challenge
|
||||
version="1"
|
||||
id="lighthousetime"
|
||||
name="Finish Lighthouse in 1:30"
|
||||
description="Finish 3 laps in Lighthouse with 3 Expert AI karts in under 1:30 minutes."
|
||||
unlock-track="tuxtollway"
|
||||
depend-on="starfollow"
|
||||
major="single"
|
||||
minor="quickrace"
|
||||
track="lighthouse"
|
||||
difficulty="hard"
|
||||
laps="3"
|
||||
karts="4"
|
||||
time="90"
|
||||
/>
|
||||
|
@ -1,19 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<challenge
|
||||
version="1"
|
||||
id="energyshiftingsands"
|
||||
name="Collect the Pharaohs Treasure"
|
||||
description="Finish with at least 12 nitro points on 3 laps of Shifting Sands in under 2:20 minutes."
|
||||
unlock-gp="tothemoonandback"
|
||||
depend-on="energymathclass farmtracktime"
|
||||
major="single"
|
||||
minor="quickrace"
|
||||
track="sandtrack"
|
||||
difficulty="medium"
|
||||
karts="1"
|
||||
laps="3"
|
||||
energy="12"
|
||||
time="140"
|
||||
/>
|
||||
|
18
data/challenges/tuxtollway.challenge
Normal file
18
data/challenges/tuxtollway.challenge
Normal file
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0"?>
|
||||
<challenge version="2">
|
||||
<track id="tuxtollway" laps="3"/>
|
||||
<mode major="single" minor="quickrace"/>
|
||||
|
||||
<hard>
|
||||
<karts number="5"/>
|
||||
<requirements position="1"/>
|
||||
</hard>
|
||||
<medium>
|
||||
<karts number="4"/>
|
||||
<requirements position="1"/>
|
||||
</medium>
|
||||
<easy>
|
||||
<karts number="4"/>
|
||||
<requirements position="1"/>
|
||||
</easy>
|
||||
</challenge>
|
@ -1,18 +1,20 @@
|
||||
<?xml version="1.0"?>
|
||||
<challenge version="2">
|
||||
<track id="xr591" laps="2"/>
|
||||
<mode major="single" minor="quickrace"/>
|
||||
|
||||
<hard>
|
||||
<karts number="1"/>
|
||||
<requirements energy="16" time="150"/>
|
||||
</hard>
|
||||
<medium>
|
||||
<karts number="1"/>
|
||||
<requirements energy="14" time="160"/>
|
||||
</medium>
|
||||
<easy>
|
||||
<karts number="1"/>
|
||||
<requirements energy="12" time="170"/>
|
||||
</easy>
|
||||
</challenge>
|
||||
|
||||
<challenge
|
||||
version="1"
|
||||
id="minigolf"
|
||||
name="Win a race on Minigolf"
|
||||
description="Win a 3 lap race on Minigolf against 4 Expert level AI karts."
|
||||
depend-on="tollway"
|
||||
unlock-track="xr591"
|
||||
major="single"
|
||||
minor="quickrace"
|
||||
track="minigolf"
|
||||
difficulty="hard"
|
||||
laps="3"
|
||||
karts="5"
|
||||
position="1"
|
||||
/>
|
||||
|
||||
|
18
data/challenges/zengarden.challenge
Normal file
18
data/challenges/zengarden.challenge
Normal file
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0"?>
|
||||
<challenge version="2">
|
||||
<track id="zengarden" laps="3"/>
|
||||
<mode major="single" minor="timetrial"/>
|
||||
|
||||
<hard>
|
||||
<karts number="2"/>
|
||||
<requirements position="1"/>
|
||||
</hard>
|
||||
<medium>
|
||||
<karts number="2"/>
|
||||
<requirements position="1"/>
|
||||
</medium>
|
||||
<easy>
|
||||
<karts number="2"/>
|
||||
<requirements position="1"/>
|
||||
</easy>
|
||||
</challenge>
|
@ -40,7 +40,8 @@ void Challenge::load(const XMLNode* challengesNode)
|
||||
const XMLNode* node = challengesNode->getNode( m_data->getId() );
|
||||
if(node == NULL)
|
||||
{
|
||||
fprintf(stderr, "[Challenge] WARNING: Couldn't find node <%s> in XML file\n",
|
||||
fprintf(stderr, "[Challenge] Couldn't find node <%s> in challenge list."
|
||||
"(If this is the first time you play this is normal)\n",
|
||||
m_data->getId().c_str());
|
||||
return;
|
||||
}
|
||||
|
@ -38,16 +38,19 @@ ChallengeData::ChallengeData(const std::string& filename)
|
||||
m_filename = filename;
|
||||
m_major = RaceManager::MAJOR_MODE_SINGLE;
|
||||
m_minor = RaceManager::MINOR_MODE_NORMAL_RACE;
|
||||
m_difficulty = RaceManager::RD_EASY;
|
||||
m_num_laps = -1;
|
||||
m_num_karts = -1;
|
||||
m_position = -1;
|
||||
m_time = -1.0f;
|
||||
m_track_id = "";
|
||||
m_track_id = "";
|
||||
m_gp_id = "";
|
||||
m_energy = -1;
|
||||
m_version = 0;
|
||||
|
||||
for (int d=0; d<RaceManager::DIFFICULTY_COUNT; d++)
|
||||
{
|
||||
m_num_karts[d] = -1;
|
||||
m_position[d] = -1;
|
||||
m_time[d] = -1.0f;
|
||||
m_energy[d] = -1;
|
||||
}
|
||||
|
||||
XMLNode *root = new XMLNode( filename );
|
||||
if(!root || root->getName()!="challenge")
|
||||
{
|
||||
@ -57,21 +60,50 @@ ChallengeData::ChallengeData(const std::string& filename)
|
||||
throw std::runtime_error(msg.str());
|
||||
}
|
||||
|
||||
std::string s;
|
||||
if(!root->get("id", &s) ) error("id");
|
||||
setId(s);
|
||||
setId(StringUtils::removeExtension(StringUtils::getBasename(filename)));
|
||||
|
||||
root->get("version", &m_version);
|
||||
// No need to get the rest of the data if this challenge
|
||||
// is not supported anyway (id is needed for warning message)
|
||||
if(!unlock_manager->isSupportedVersion(*this))
|
||||
{
|
||||
fprintf(stderr, "[ChallengeData] WARNING: challenge <%s> is older "
|
||||
"or newer than this version of STK, will be ignored.\n", filename.c_str());
|
||||
delete root;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
const XMLNode* track_node = root->getNode("track");
|
||||
|
||||
// TODO: add GP support
|
||||
if (track_node == NULL)
|
||||
{
|
||||
throw std::runtime_error("Challenge file " + filename + " has no <track> node!");
|
||||
}
|
||||
|
||||
|
||||
if (!track_node->get("id", &m_track_id ))
|
||||
{
|
||||
error("track");
|
||||
}
|
||||
if (track_manager->getTrack(m_track_id) == NULL)
|
||||
{
|
||||
error("track");
|
||||
}
|
||||
|
||||
if (!track_node->get("laps", &m_num_laps) && m_minor != RaceManager::MINOR_MODE_FOLLOW_LEADER)
|
||||
{
|
||||
error("laps");
|
||||
}
|
||||
|
||||
const XMLNode* mode_node = root->getNode("mode");
|
||||
if (mode_node == NULL)
|
||||
{
|
||||
throw std::runtime_error("Challenge file " + filename + " has no <mode> node!");
|
||||
}
|
||||
|
||||
std::string mode;
|
||||
root->get("major", &mode);
|
||||
mode_node->get("major", &mode);
|
||||
|
||||
if(mode=="grandprix")
|
||||
m_major = RaceManager::MAJOR_MODE_GRAND_PRIX;
|
||||
@ -80,7 +112,7 @@ ChallengeData::ChallengeData(const std::string& filename)
|
||||
else
|
||||
error("major");
|
||||
|
||||
root->get("minor", &mode);
|
||||
mode_node->get("minor", &mode);
|
||||
if(mode=="timetrial")
|
||||
m_minor = RaceManager::MINOR_MODE_TIME_TRIAL;
|
||||
else if(mode=="quickrace")
|
||||
@ -90,87 +122,78 @@ ChallengeData::ChallengeData(const std::string& filename)
|
||||
else
|
||||
error("minor");
|
||||
|
||||
if(!root->get("name", &s) ) error("name");
|
||||
//std::cout << " // Challenge name = <" << s.c_str() << ">\n";
|
||||
setName( s.c_str() );
|
||||
const XMLNode* difficulties[RaceManager::DIFFICULTY_COUNT];
|
||||
difficulties[0] = root->getNode("easy");
|
||||
difficulties[1] = root->getNode("medium");
|
||||
difficulties[2] = root->getNode("hard");
|
||||
|
||||
//if(!root->get("description", &s) ) error("description");
|
||||
//setChallengeDescription( s.c_str() );
|
||||
//std::cout << " // Challenge description = <" << s.c_str() << ">\n";
|
||||
|
||||
|
||||
|
||||
if(!root->get("karts", &m_num_karts) ) error("karts");
|
||||
|
||||
// Position is optional except in GP and FTL
|
||||
if(!root->get("position", &m_position) &&
|
||||
//RaceManager::getWorld()->areKartsOrdered() ) // FIXME - order and optional are not the same thing
|
||||
(m_minor==RaceManager::MINOR_MODE_FOLLOW_LEADER ||
|
||||
m_major==RaceManager::MAJOR_MODE_GRAND_PRIX))
|
||||
error("position");
|
||||
root->get("difficulty", &s);
|
||||
if(s=="easy")
|
||||
m_difficulty = RaceManager::RD_EASY;
|
||||
else if(s=="medium")
|
||||
m_difficulty = RaceManager::RD_MEDIUM;
|
||||
else if(s=="hard")
|
||||
m_difficulty = RaceManager::RD_HARD;
|
||||
else
|
||||
error("difficulty");
|
||||
|
||||
root->get("time", &m_time ); // one of time/position
|
||||
|
||||
root->get("position", &m_position ); // must be set
|
||||
if(m_time<0 && m_position<0) error("position/time");
|
||||
|
||||
root->get("energy", &m_energy ); // This is optional
|
||||
if(m_major==RaceManager::MAJOR_MODE_SINGLE)
|
||||
if (difficulties[0] == NULL || difficulties[1] == NULL ||
|
||||
difficulties[2] == NULL)
|
||||
{
|
||||
if (!root->get("track", &m_track_id ))
|
||||
error("<easy> or <medium> or <hard>");
|
||||
}
|
||||
|
||||
for (int d=0; d<RaceManager::DIFFICULTY_COUNT; d++)
|
||||
{
|
||||
const XMLNode* karts_node = difficulties[d]->getNode("karts");
|
||||
if (karts_node == NULL) error("<karts .../>");
|
||||
|
||||
int num_karts = -1;
|
||||
if (!karts_node->get("number", &num_karts)) error("karts");
|
||||
m_num_karts[d] = num_karts;
|
||||
|
||||
const XMLNode* requirements_node = difficulties[d]->getNode("requirements");
|
||||
if (requirements_node == NULL) error("<requirements .../>");
|
||||
|
||||
int position = -1;
|
||||
if (!requirements_node->get("position", &position) &&
|
||||
(m_minor==RaceManager::MINOR_MODE_FOLLOW_LEADER ||
|
||||
m_major==RaceManager::MAJOR_MODE_GRAND_PRIX))
|
||||
{
|
||||
error("track");
|
||||
error("position");
|
||||
}
|
||||
if (track_manager->getTrack(m_track_id) == NULL)
|
||||
else
|
||||
{
|
||||
error("track");
|
||||
m_position[d] = position;
|
||||
}
|
||||
|
||||
if (!root->get("laps", &m_num_laps ) && m_minor!=RaceManager::MINOR_MODE_FOLLOW_LEADER)
|
||||
{
|
||||
error("laps");
|
||||
}
|
||||
int time = -1;
|
||||
if (requirements_node->get("time", &time)) m_time[d] = time;
|
||||
|
||||
if (m_time[d] < 0 && m_position[d] < 0) error("position/time");
|
||||
|
||||
// This is optional
|
||||
int energy = -1;
|
||||
if (requirements_node->get("energy", &energy)) m_energy[d] = energy;
|
||||
|
||||
}
|
||||
|
||||
// TODO: add gp support
|
||||
/*
|
||||
else // GP
|
||||
{
|
||||
if (!root->get("gp", &m_gp_id )) error("gp");
|
||||
if (grand_prix_manager->getGrandPrix(m_gp_id) == NULL) error("gp");
|
||||
}
|
||||
|
||||
getUnlocks(root, "unlock-track", ChallengeData::UNLOCK_TRACK);
|
||||
getUnlocks(root, "unlock-gp", ChallengeData::UNLOCK_GP );
|
||||
getUnlocks(root, "unlock-mode", ChallengeData::UNLOCK_MODE );
|
||||
getUnlocks(root, "unlock-difficulty", ChallengeData::UNLOCK_DIFFICULTY);
|
||||
getUnlocks(root, "unlock-kart", ChallengeData::UNLOCK_KART);
|
||||
|
||||
if (getFeatures().size() == 0)
|
||||
{
|
||||
error("features to unlock");
|
||||
}
|
||||
*/
|
||||
|
||||
std::vector< std::string > deps;
|
||||
root->get("depend-on", &deps);
|
||||
for (unsigned int i=0; i<deps.size(); i++)
|
||||
const XMLNode* unlock_node = root->getNode("unlock");
|
||||
if (unlock_node != NULL)
|
||||
{
|
||||
if (deps[i].size() > 0) addDependency(deps[i]);
|
||||
getUnlocks(root, "unlock-track", ChallengeData::UNLOCK_TRACK);
|
||||
getUnlocks(root, "unlock-gp", ChallengeData::UNLOCK_GP );
|
||||
getUnlocks(root, "unlock-mode", ChallengeData::UNLOCK_MODE );
|
||||
getUnlocks(root, "unlock-difficulty", ChallengeData::UNLOCK_DIFFICULTY);
|
||||
getUnlocks(root, "unlock-kart", ChallengeData::UNLOCK_KART);
|
||||
}
|
||||
delete root;
|
||||
|
||||
|
||||
|
||||
core::stringw description;
|
||||
//I18N: number of laps to race in a challenge
|
||||
description += _("Laps : %i", m_num_laps);
|
||||
description += core::stringw(L"\n");
|
||||
|
||||
// TODO: add this info in the difficulties dialog perhaps?
|
||||
/*
|
||||
//I18N: number of AI karts in a challenge
|
||||
description += _("AI Karts : %i", m_num_karts - 1);
|
||||
if (m_position > 0)
|
||||
@ -191,6 +214,7 @@ ChallengeData::ChallengeData(const std::string& filename)
|
||||
//I18N: nitro points needed to win a challenge
|
||||
description += _("Collect %i points of nitro", m_energy);
|
||||
}
|
||||
*/
|
||||
|
||||
m_challenge_description = description;
|
||||
} // ChallengeData
|
||||
@ -294,26 +318,26 @@ void ChallengeData::getUnlocks(const XMLNode *root, const std:: string &type,
|
||||
} // switch
|
||||
} // getUnlocks
|
||||
// ----------------------------------------------------------------------------
|
||||
void ChallengeData::setRace() const
|
||||
void ChallengeData::setRace(RaceManager::Difficulty d) const
|
||||
{
|
||||
race_manager->setMajorMode(m_major);
|
||||
if(m_major==RaceManager::MAJOR_MODE_SINGLE)
|
||||
{
|
||||
race_manager->setMinorMode(m_minor);
|
||||
race_manager->setTrack(m_track_id);
|
||||
race_manager->setDifficulty(m_difficulty);
|
||||
race_manager->setNumLaps(m_num_laps);
|
||||
race_manager->setNumKarts(m_num_karts);
|
||||
race_manager->setNumKarts(m_num_karts[d]);
|
||||
race_manager->setNumLocalPlayers(1);
|
||||
race_manager->setCoinTarget(m_energy);
|
||||
race_manager->setCoinTarget(m_energy[d]);
|
||||
race_manager->setDifficulty(d);
|
||||
}
|
||||
else // GP
|
||||
{
|
||||
race_manager->setMinorMode(m_minor);
|
||||
const GrandPrixData *gp = grand_prix_manager->getGrandPrix(m_gp_id);
|
||||
race_manager->setGrandPrix(*gp);
|
||||
race_manager->setDifficulty(m_difficulty);
|
||||
race_manager->setNumKarts(m_num_karts);
|
||||
race_manager->setDifficulty(d);
|
||||
race_manager->setNumKarts(m_num_karts[d]);
|
||||
race_manager->setNumLocalPlayers(1);
|
||||
}
|
||||
} // setRace
|
||||
@ -328,12 +352,14 @@ bool ChallengeData::raceFinished()
|
||||
// ------------
|
||||
World *world = World::getWorld();
|
||||
std::string track_name = world->getTrack()->getIdent();
|
||||
if(track_name!=m_track_id ) return false;
|
||||
if((int)world->getNumKarts()<m_num_karts ) return false;
|
||||
|
||||
int d = race_manager->getDifficulty();
|
||||
|
||||
if (track_name != m_track_id ) return false;
|
||||
if ((int)world->getNumKarts() < m_num_karts[d] ) return false;
|
||||
Kart* kart = world->getPlayerKart(0);
|
||||
if(m_energy>0 && kart->getEnergy() < m_energy ) return false;
|
||||
if(m_position>0 && kart->getPosition()> m_position ) return false;
|
||||
if(race_manager->getDifficulty() < m_difficulty) return false;
|
||||
if (m_energy[d] > 0 && kart->getEnergy() < m_energy[d] ) return false;
|
||||
if (m_position[d] > 0 && kart->getPosition() > m_position[d]) return false;
|
||||
|
||||
// Follow the leader
|
||||
// -----------------
|
||||
@ -351,20 +377,21 @@ bool ChallengeData::raceFinished()
|
||||
{
|
||||
if(lworld->getLapForKart( kart->getWorldKartId() ) != m_num_laps) return false; // wrong number of laps
|
||||
}
|
||||
if(m_time>0.0f && kart->getFinishTime()>m_time) return false; // too slow
|
||||
if (m_time[d] > 0.0f && kart->getFinishTime() > m_time[d]) return false; // too slow
|
||||
return true;
|
||||
} // raceFinished
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
bool ChallengeData::grandPrixFinished()
|
||||
{
|
||||
int d = race_manager->getDifficulty();
|
||||
|
||||
// Note that we have to call race_manager->getNumKarts, since there
|
||||
// is no world objects to query at this stage.
|
||||
if (race_manager->getMajorMode() != RaceManager::MAJOR_MODE_GRAND_PRIX ||
|
||||
race_manager->getMinorMode() != m_minor ||
|
||||
race_manager->getGrandPrix()->getId() != m_gp_id ||
|
||||
race_manager->getDifficulty() < m_difficulty ||
|
||||
race_manager->getNumberOfKarts() < (unsigned int)m_num_karts ||
|
||||
race_manager->getNumberOfKarts() < (unsigned int)m_num_karts[d] ||
|
||||
race_manager->getNumPlayers() > 1) return false;
|
||||
|
||||
// check if the player came first.
|
||||
|
@ -55,14 +55,13 @@ public:
|
||||
private:
|
||||
RaceManager::MajorRaceModeType m_major;
|
||||
RaceManager::MinorRaceModeType m_minor;
|
||||
RaceManager::Difficulty m_difficulty;
|
||||
int m_num_laps;
|
||||
int m_position;
|
||||
int m_num_karts;
|
||||
float m_time;
|
||||
int m_position[RaceManager::DIFFICULTY_COUNT];
|
||||
int m_num_karts[RaceManager::DIFFICULTY_COUNT];
|
||||
float m_time[RaceManager::DIFFICULTY_COUNT];
|
||||
int m_energy[RaceManager::DIFFICULTY_COUNT];
|
||||
std::string m_gp_id;
|
||||
std::string m_track_id;
|
||||
int m_energy;
|
||||
std::string m_filename;
|
||||
/** Version number of the challenge. */
|
||||
int m_version;
|
||||
@ -73,15 +72,11 @@ private:
|
||||
|
||||
/** Short, internal name for this challenge. */
|
||||
std::string m_id;
|
||||
/** Name used in menu for this challenge. */
|
||||
irr::core::stringw m_name;
|
||||
/** Message the user gets when the feature is not yet unlocked. */
|
||||
irr::core::stringw m_challenge_description;
|
||||
|
||||
/** Features to unlock. */
|
||||
std::vector<UnlockableFeature> m_feature;
|
||||
/** What needs to be done before accessing this challenge. */
|
||||
std::vector<std::string> m_prerequisites;
|
||||
|
||||
irr::core::stringw m_challenge_description;
|
||||
|
||||
public:
|
||||
#ifdef WIN32
|
||||
@ -93,7 +88,7 @@ public:
|
||||
virtual ~ChallengeData() {}
|
||||
|
||||
/** sets the right parameters in RaceManager to try this challenge */
|
||||
void setRace() const;
|
||||
void setRace(RaceManager::Difficulty d) const;
|
||||
|
||||
virtual void check() const;
|
||||
virtual bool raceFinished();
|
||||
@ -103,32 +98,18 @@ public:
|
||||
|
||||
|
||||
const std::vector<UnlockableFeature>&
|
||||
getFeatures() const { return m_feature; }
|
||||
|
||||
const irr::core::stringw getChallengeDescription() const
|
||||
{return _(m_challenge_description.c_str()); }
|
||||
|
||||
void addDependency(const std::string id) {m_prerequisites.push_back(id);}
|
||||
|
||||
const std::vector<std::string>&
|
||||
getPrerequisites() const { return m_prerequisites; }
|
||||
getFeatures() const { return m_feature; }
|
||||
|
||||
/** Returns the id of the challenge. */
|
||||
const std::string &getId() const { return m_id; }
|
||||
|
||||
/** Returns the name of the challenge. */
|
||||
const irr::core::stringw getName() const
|
||||
{ return irr::core::stringw(_(m_name.c_str())); }
|
||||
|
||||
/** Sets the name of the challenge. */
|
||||
void setName(const irr::core::stringw & s) { m_name = s; }
|
||||
const std::string &getId() const { return m_id; }
|
||||
|
||||
/** Sets the id of this challenge. */
|
||||
void setId(const std::string& s) { m_id = s; }
|
||||
void setId(const std::string& s) { m_id = s; }
|
||||
|
||||
const std::string& getTrackId() const { return m_track_id; }
|
||||
const std::string& getTrackId() const { return m_track_id; }
|
||||
|
||||
int getNumLaps() const { return m_num_laps; }
|
||||
|
||||
|
||||
void addUnlockTrackReward(const std::string &track_name);
|
||||
void addUnlockModeReward(const std::string &internal_mode_name,
|
||||
const irr::core::stringw &user_mode_name);
|
||||
@ -141,13 +122,14 @@ public:
|
||||
|
||||
RaceManager::MajorRaceModeType getMajorMode() const { return m_major; }
|
||||
RaceManager::MinorRaceModeType getMinorMode() const { return m_minor; }
|
||||
RaceManager::Difficulty getDifficulty() const { return m_difficulty; }
|
||||
int getNumLaps() const { return m_num_laps; }
|
||||
int getPosition() const { return m_position; }
|
||||
int getNumKarts() const { return m_num_karts; }
|
||||
float getTime() const { return m_time; }
|
||||
int getEnergy() const { return m_energy; }
|
||||
|
||||
const irr::core::stringw& getChallengeDescription() const { return m_challenge_description; }
|
||||
|
||||
}; // ChallengeData
|
||||
int getPosition(RaceManager::Difficulty difficulty) const { return m_position[difficulty]; }
|
||||
int getNumKarts(RaceManager::Difficulty difficulty) const { return m_num_karts[difficulty]; }
|
||||
float getTime (RaceManager::Difficulty difficulty) const { return m_time[difficulty]; }
|
||||
int getEnergy (RaceManager::Difficulty difficulty) const { return m_energy[difficulty]; }
|
||||
|
||||
}; // Ch
|
||||
|
||||
#endif // HEADER_CHALLENGE_DATA_HPP
|
||||
|
@ -81,33 +81,10 @@ void GameSlot::computeActive()
|
||||
continue;
|
||||
}
|
||||
|
||||
// Otherwise lock the feature, and check if the challenge is active
|
||||
// ----------------------------------------------------------------
|
||||
// Otherwise lock the feature
|
||||
// --------------------------
|
||||
lockFeature(i->second);
|
||||
std::vector<std::string> pre_req=(i->second)->getData()->getPrerequisites();
|
||||
bool allSolved=true;
|
||||
for(std::vector<std::string>::iterator pre =pre_req.begin();
|
||||
pre!=pre_req.end(); pre++)
|
||||
{
|
||||
const Challenge* p = m_challenges_state[*pre];
|
||||
if(!p)
|
||||
{
|
||||
fprintf(stderr,"Challenge prerequisite '%s' of '%s' not found - ignored\n",
|
||||
pre->c_str(), i->first.c_str());
|
||||
//continue;
|
||||
allSolved=false;
|
||||
break;
|
||||
}
|
||||
else if(!p->isSolved())
|
||||
{
|
||||
allSolved=false;
|
||||
break;
|
||||
}
|
||||
} // for all pre in pre_req
|
||||
if(allSolved)
|
||||
{
|
||||
i->second->setActive();
|
||||
} // if solved
|
||||
i->second->setActive();
|
||||
} // for i
|
||||
clearUnlocked();
|
||||
} // computeActive
|
||||
|
@ -326,7 +326,7 @@ bool UnlockManager::isSupportedVersion(const ChallengeData &challenge)
|
||||
{
|
||||
// Test if challenge version number is in between minimum
|
||||
// and maximum supported version.
|
||||
return (challenge.getVersion()>=1 && challenge.getVersion()<=1);
|
||||
return (challenge.getVersion()>=2 && challenge.getVersion()<=2);
|
||||
} // isSupportedVersion
|
||||
|
||||
|
||||
|
@ -16,7 +16,6 @@
|
||||
950D45D1118E040E006CFC41 /* options_screen_input2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 950D45CF118E040E006CFC41 /* options_screen_input2.cpp */; };
|
||||
9516B07E12629C4E005F9493 /* sfx_buffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9516B07C12629C4E005F9493 /* sfx_buffer.cpp */; };
|
||||
951B50AE12C9698B004F6993 /* xml_writer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 951B50AD12C9698B004F6993 /* xml_writer.cpp */; };
|
||||
951B7D19108E52C900BC03AE /* challenges.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 951B7D18108E52C900BC03AE /* challenges.cpp */; };
|
||||
951BC65E0FFAF290006B5FF1 /* ipo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 951BC65C0FFAF290006B5FF1 /* ipo.cpp */; };
|
||||
9522F125107948AD0067ECF5 /* main_menu_screen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9522F124107948AD0067ECF5 /* main_menu_screen.cpp */; };
|
||||
9522F15B107949780067ECF5 /* race_setup_screen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9522F15A107949780067ECF5 /* race_setup_screen.cpp */; };
|
||||
@ -411,8 +410,6 @@
|
||||
9516B07D12629C4E005F9493 /* sfx_buffer.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = sfx_buffer.hpp; path = ../../audio/sfx_buffer.hpp; sourceTree = SOURCE_ROOT; };
|
||||
951B50AD12C9698B004F6993 /* xml_writer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = xml_writer.cpp; path = ../../io/xml_writer.cpp; sourceTree = SOURCE_ROOT; };
|
||||
951B50AF12C96A13004F6993 /* xml_writer.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = xml_writer.hpp; path = ../../io/xml_writer.hpp; sourceTree = SOURCE_ROOT; };
|
||||
951B7D17108E52C900BC03AE /* challenges.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = challenges.hpp; path = ../../states_screens/challenges.hpp; sourceTree = SOURCE_ROOT; };
|
||||
951B7D18108E52C900BC03AE /* challenges.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = challenges.cpp; path = ../../states_screens/challenges.cpp; sourceTree = SOURCE_ROOT; };
|
||||
951BC65C0FFAF290006B5FF1 /* ipo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ipo.cpp; path = ../../animations/ipo.cpp; sourceTree = SOURCE_ROOT; };
|
||||
951BC65D0FFAF290006B5FF1 /* ipo.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = ipo.hpp; path = ../../animations/ipo.hpp; sourceTree = SOURCE_ROOT; };
|
||||
951C357D0FC05BF400A48379 /* quad_set.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = quad_set.hpp; path = ../../tracks/quad_set.hpp; sourceTree = SOURCE_ROOT; };
|
||||
@ -2231,8 +2228,6 @@
|
||||
9551B26E11DC0D4D002DD140 /* addons_screen.hpp */,
|
||||
956541B910DD5F0A00C83E99 /* arenas_screen.cpp */,
|
||||
956541BA10DD5F0A00C83E99 /* arenas_screen.hpp */,
|
||||
951B7D18108E52C900BC03AE /* challenges.cpp */,
|
||||
951B7D17108E52C900BC03AE /* challenges.hpp */,
|
||||
958330C210122B4A00C5137E /* credits.cpp */,
|
||||
958330C310122B4A00C5137E /* credits.hpp */,
|
||||
95D2343E1078227A00625256 /* feature_unlocked.cpp */,
|
||||
@ -3011,7 +3006,6 @@
|
||||
9522F1E610795EFF0067ECF5 /* help_screen_3.cpp in Sources */,
|
||||
9522F1F0107961560067ECF5 /* options_screen_input.cpp in Sources */,
|
||||
9522F1F1107961560067ECF5 /* options_screen_players.cpp in Sources */,
|
||||
951B7D19108E52C900BC03AE /* challenges.cpp in Sources */,
|
||||
956541BB10DD5F0A00C83E99 /* arenas_screen.cpp in Sources */,
|
||||
956541E110DD628C00C83E99 /* add_device_dialog.cpp in Sources */,
|
||||
95C9C97210E93456005A418D /* stars.cpp in Sources */,
|
||||
|
@ -130,8 +130,9 @@ void OverWorld::onFirePressed(Controller* who)
|
||||
// network_manager else call race_manager).
|
||||
network_manager->initCharacterDataStructures();
|
||||
|
||||
// TODO: allow user to select difficulty
|
||||
// Launch challenge
|
||||
challenge->setRace();
|
||||
challenge->setRace(RaceManager::RD_HARD);
|
||||
|
||||
// Sets up kart info, including random list of kart for AI
|
||||
network_manager->setupPlayerKartInfo();
|
||||
|
@ -192,6 +192,8 @@ public:
|
||||
/** Game difficulty. */
|
||||
enum Difficulty { RD_EASY, RD_MEDIUM, RD_HARD };
|
||||
|
||||
static const int DIFFICULTY_COUNT = 3;
|
||||
|
||||
/** Different kart types: A local player, a player connected via network,
|
||||
* an AI kart, the leader kart (currently not used), a ghost kart
|
||||
* (currently not used). */
|
||||
|
@ -1,204 +0,0 @@
|
||||
// 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 "states_screens/challenges.hpp"
|
||||
|
||||
|
||||
#include "challenges/unlock_manager.hpp"
|
||||
#include "config/user_config.hpp"
|
||||
#include "guiengine/engine.hpp"
|
||||
#include "guiengine/widgets/dynamic_ribbon_widget.hpp"
|
||||
#include "input/device_manager.hpp"
|
||||
#include "input/input_manager.hpp"
|
||||
#include "io/file_manager.hpp"
|
||||
#include "karts/kart_properties_manager.hpp"
|
||||
#include "network/network_manager.hpp"
|
||||
#include "race/race_manager.hpp"
|
||||
#include "states_screens/state_manager.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
#include "irrString.h"
|
||||
using irr::core::stringw;
|
||||
using irr::core::stringc;
|
||||
|
||||
using namespace GUIEngine;
|
||||
|
||||
DEFINE_SCREEN_SINGLETON( ChallengesScreen );
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------
|
||||
|
||||
ChallengesScreen::ChallengesScreen() : Screen("challenges.stkgui")
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------
|
||||
|
||||
void ChallengesScreen::loadedFromFile()
|
||||
{
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------
|
||||
|
||||
void ChallengesScreen::onUpdate(float elapsed_time, irr::video::IVideoDriver*)
|
||||
{
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------
|
||||
|
||||
void ChallengesScreen::beforeAddingWidget()
|
||||
{
|
||||
DynamicRibbonWidget* w = this->getWidget<DynamicRibbonWidget>("challenges");
|
||||
assert( w != NULL );
|
||||
|
||||
GameSlot* slot = unlock_manager->getCurrentSlot();
|
||||
|
||||
const std::vector<const ChallengeData*>& activeChallenges = slot->getActiveChallenges();
|
||||
const std::vector<const ChallengeData*>& solvedChallenges = slot->getUnlockedFeatures();
|
||||
const std::vector<const ChallengeData*>& lockedChallenges = slot->getLockedChallenges();
|
||||
|
||||
const int activeChallengeAmount = activeChallenges.size();
|
||||
const int solvedChallengeAmount = solvedChallenges.size();
|
||||
const int lockedChallengeAmount = lockedChallenges.size();
|
||||
|
||||
|
||||
w->setItemCountHint(activeChallengeAmount + solvedChallengeAmount + lockedChallengeAmount);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------
|
||||
|
||||
void ChallengesScreen::init()
|
||||
{
|
||||
Screen::init();
|
||||
DynamicRibbonWidget* w = this->getWidget<DynamicRibbonWidget>("challenges");
|
||||
assert( w != NULL );
|
||||
|
||||
// Re-build track list everytime (accounts for locking changes, etc.)
|
||||
w->clearItems();
|
||||
|
||||
GameSlot* slot = unlock_manager->getCurrentSlot();
|
||||
|
||||
const std::vector<const ChallengeData*>& activeChallenges = slot->getActiveChallenges();
|
||||
const std::vector<const ChallengeData*>& solvedChallenges = slot->getUnlockedFeatures();
|
||||
const std::vector<const ChallengeData*>& lockedChallenges = slot->getLockedChallenges();
|
||||
|
||||
const int activeChallengeAmount = activeChallenges.size();
|
||||
const int solvedChallengeAmount = solvedChallenges.size();
|
||||
const int lockedChallengeAmount = lockedChallenges.size();
|
||||
|
||||
for (int n=0; n<activeChallengeAmount; n++)
|
||||
{
|
||||
w->addItem(activeChallenges[n]->getName() + L"\n" + activeChallenges[n]->getChallengeDescription(),
|
||||
activeChallenges[n]->getId(), "/gui/challenge.png");
|
||||
}
|
||||
for (int n=0; n<solvedChallengeAmount; n++)
|
||||
{
|
||||
// TODO : add bronze/silver/gold difficulties to challenges
|
||||
w->addItem(solvedChallenges[n]->getName() + L"\n" + solvedChallenges[n]->getChallengeDescription(),
|
||||
solvedChallenges[n]->getId(), "/textures/cup_gold.png");
|
||||
}
|
||||
for (int n=0; n<lockedChallengeAmount; n++)
|
||||
{
|
||||
w->addItem( _("Locked : solve active challenges to gain access to more!"), "locked",
|
||||
"/gui/challenge.png", LOCKED_BADGE);
|
||||
}
|
||||
|
||||
|
||||
w->updateItemDisplay();
|
||||
|
||||
if (w->getItems().empty())
|
||||
{
|
||||
fprintf(stderr, "Error, no challenge!\n");
|
||||
return;
|
||||
}
|
||||
w->setSelection(0 /* whatever is first */, PLAYER_ID_GAME_MASTER, true /* focus it */);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------
|
||||
|
||||
void ChallengesScreen::eventCallback(GUIEngine::Widget* widget, const std::string& name, const int playerID)
|
||||
{
|
||||
if (name == "back")
|
||||
{
|
||||
StateManager::get()->escapePressed();
|
||||
}
|
||||
else if (name == "challenges")
|
||||
{
|
||||
DynamicRibbonWidget* w = this->getWidget<DynamicRibbonWidget>("challenges");
|
||||
assert( w != NULL );
|
||||
|
||||
// only player 0 can start a challenge (i.e. we have no multiplayer challenges)
|
||||
std::string selection = w->getSelectionIDString( PLAYER_ID_GAME_MASTER );
|
||||
|
||||
if (selection == "locked")
|
||||
{
|
||||
unlock_manager->playLockSound();
|
||||
}
|
||||
else if (!selection.empty() && selection != RibbonWidget::NO_ITEM_ID)
|
||||
{
|
||||
//FIXME: simplify and centralize race start sequence!!
|
||||
|
||||
// Verify the kart in the config exists
|
||||
if (kart_properties_manager->getKart(UserConfigParams::m_default_kart) == NULL)
|
||||
{
|
||||
UserConfigParams::m_default_kart.revertToDefaults();
|
||||
}
|
||||
|
||||
const ChallengeData* c = unlock_manager->getChallenge(selection);
|
||||
if (c == NULL)
|
||||
{
|
||||
std::cerr << "[ChallengesScreen] ERROR: cannot find challenge '" << selection.c_str() << "'!\n";
|
||||
return;
|
||||
}
|
||||
|
||||
// Use latest used device
|
||||
InputDevice* device = input_manager->getDeviceList()->getLatestUsedDevice();
|
||||
|
||||
int id = StateManager::get()->createActivePlayer( unlock_manager->getCurrentPlayer(), device );
|
||||
input_manager->getDeviceList()->setSinglePlayer( StateManager::get()->getActivePlayer(id) );
|
||||
|
||||
// Set up race manager appropriately
|
||||
race_manager->setNumLocalPlayers(1);
|
||||
race_manager->setLocalKartInfo(0, UserConfigParams::m_default_kart);
|
||||
|
||||
// ASSIGN should make sure that only input from assigned devices is read.
|
||||
input_manager->getDeviceList()->setAssignMode(ASSIGN);
|
||||
|
||||
// Go straight to the race
|
||||
StateManager::get()->enterGameState();
|
||||
|
||||
// Initialise global data - necessary even in local games to avoid
|
||||
// many if tests in other places (e.g. if network_game call
|
||||
// network_manager else call race_manager).
|
||||
network_manager->initCharacterDataStructures();
|
||||
|
||||
// Launch challenge
|
||||
c->setRace();
|
||||
|
||||
// Sets up kart info, including random list of kart for AI
|
||||
network_manager->setupPlayerKartInfo();
|
||||
race_manager->startNew();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------
|
||||
|
@ -1,58 +0,0 @@
|
||||
// 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_CHALLENGES_HPP
|
||||
#define HEADER_CHALLENGES_HPP
|
||||
|
||||
#include "guiengine/screen.hpp"
|
||||
#include "utils/ptr_vector.hpp"
|
||||
|
||||
namespace irr
|
||||
{
|
||||
namespace video { class IVideoDriver; }
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Handles the screen where the player is shown active and solved challenges
|
||||
* \ingroup states_screens
|
||||
*/
|
||||
class ChallengesScreen : public GUIEngine::Screen, public GUIEngine::ScreenSingleton<ChallengesScreen>
|
||||
{
|
||||
friend class GUIEngine::ScreenSingleton<ChallengesScreen>;
|
||||
ChallengesScreen();
|
||||
|
||||
public:
|
||||
|
||||
/** \brief implement callback from parent class GUIEngine::Screen */
|
||||
virtual void loadedFromFile();
|
||||
|
||||
/** \brief implement optional callback from parent class GUIEngine::Screen */
|
||||
virtual void onUpdate(float dt, irr::video::IVideoDriver*);
|
||||
|
||||
/** \brief implement callback from parent class GUIEngine::Screen */
|
||||
virtual void beforeAddingWidget();
|
||||
|
||||
/** \brief implement callback from parent class GUIEngine::Screen */
|
||||
virtual void init();
|
||||
|
||||
/** \brief implement callback from parent class GUIEngine::Screen */
|
||||
virtual void eventCallback(GUIEngine::Widget* widget, const std::string& name, const int playerID);
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user