Compare commits
44 Commits
LightOptim
...
v0.7.3
Author | SHA1 | Date | |
---|---|---|---|
|
8f824a503b | ||
|
1c811e4bde | ||
|
95af35e4b4 | ||
|
a728878ba7 | ||
|
1ccbad409b | ||
|
5f5d9e0a41 | ||
|
ac1eddfef5 | ||
|
030e265986 | ||
|
5e018e4b1a | ||
|
075753f519 | ||
|
070684672c | ||
|
0ab24ddc05 | ||
|
e556822a2c | ||
|
d23abc2937 | ||
|
1c438c0f59 | ||
|
7a4aa8a312 | ||
|
780d7c05c7 | ||
|
94f842d705 | ||
|
0680acda44 | ||
|
3b74312129 | ||
|
99f1958ff0 | ||
|
4a5df90d37 | ||
|
d165104ee8 | ||
|
0f09655333 | ||
|
bff721cceb | ||
|
f0b1179226 | ||
|
2982df5069 | ||
|
8e41de33db | ||
|
aa3bd6d00e | ||
|
504e31b388 | ||
|
870a90a048 | ||
|
224b3c4a07 | ||
|
49a6c9263f | ||
|
53727d0729 | ||
|
2d1bb2abb7 | ||
|
86214eb8a8 | ||
|
30e355789f | ||
|
5497882282 | ||
|
d2338a0947 | ||
|
e9bcc12dba | ||
|
9ab8fd09a7 | ||
|
426c1492b9 | ||
|
101677c3a1 | ||
|
61175c1a1c |
@@ -405,6 +405,8 @@ set( SRCS ${SRCS} src/main.cpp
|
|||||||
src/karts/max_speed.hpp
|
src/karts/max_speed.hpp
|
||||||
src/karts/moveable.cpp
|
src/karts/moveable.cpp
|
||||||
src/karts/moveable.hpp
|
src/karts/moveable.hpp
|
||||||
|
src/modes/demo_world.cpp
|
||||||
|
src/modes/demo_world.hpp
|
||||||
src/modes/follow_the_leader.cpp
|
src/modes/follow_the_leader.cpp
|
||||||
src/modes/follow_the_leader.hpp
|
src/modes/follow_the_leader.hpp
|
||||||
src/modes/game_tutorial.cpp
|
src/modes/game_tutorial.cpp
|
||||||
@@ -681,6 +683,9 @@ if (APPLE)
|
|||||||
add_definitions(`ln -sf ${PROJECT_SOURCE_DIR}/data ${CMAKE_BINARY_DIR}/bin/supertuxkart.app/Contents/Resources`)
|
add_definitions(`ln -sf ${PROJECT_SOURCE_DIR}/data ${CMAKE_BINARY_DIR}/bin/supertuxkart.app/Contents/Resources`)
|
||||||
|
|
||||||
else()
|
else()
|
||||||
|
|
||||||
|
add_definitions(-DSUPERTUXKART_DATADIR=\"${CMAKE_INSTALL_PREFIX}/share/games/supertuxkart\")
|
||||||
|
|
||||||
# Build the final executable
|
# Build the final executable
|
||||||
add_executable(supertuxkart ${SRCS})
|
add_executable(supertuxkart ${SRCS})
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
SuperTuxKart 0.7.3
|
SuperTuxKart 0.7.3
|
||||||
~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~
|
||||||
* New Zen Garden and Subsea tracks
|
* New Zen Garden, Minigolf and Subsea tracks
|
||||||
* New Island battle arena
|
* New Island battle arena
|
||||||
* New Suzanne kart
|
* New Suzanne kart
|
||||||
* New graphical effects
|
* New graphical effects
|
||||||
|
@@ -4,7 +4,7 @@ SUBDIRS = $(BULLETTREE) $(ENETTREE) src doc data tools
|
|||||||
|
|
||||||
pkgdatadir=$(datadir)/doc/$(PACKAGE)
|
pkgdatadir=$(datadir)/doc/$(PACKAGE)
|
||||||
dist_pkgdata_DATA=AUTHORS ChangeLog COPYING README
|
dist_pkgdata_DATA=AUTHORS ChangeLog COPYING README
|
||||||
EXTRA_DIST=autogen.sh m4
|
EXTRA_DIST=autogen.sh m4 CMakeLists.txt
|
||||||
|
|
||||||
# NEWS only contains "see changelog"
|
# NEWS only contains "see changelog"
|
||||||
# CHANGES only contains "see NEW"
|
# CHANGES only contains "see NEW"
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
# Process this file with autogen.sh to produce a configure script.
|
# Process this file with autogen.sh to produce a configure script.
|
||||||
|
|
||||||
AC_INIT(supertuxkart,SVN)
|
AC_INIT(supertuxkart,0.7.3)
|
||||||
AC_CONFIG_SRCDIR([src/main.cpp])
|
AC_CONFIG_SRCDIR([src/main.cpp])
|
||||||
|
|
||||||
AC_PREREQ(2.61)
|
AC_PREREQ(2.61)
|
||||||
|
BIN
data/CREDITS
@@ -6,7 +6,7 @@
|
|||||||
name="Follow the Leader on a Desert Island"
|
name="Follow the Leader on a Desert Island"
|
||||||
description="Win a Follow the Leader race with 3 AI karts on a Desert Island."
|
description="Win a Follow the Leader race with 3 AI karts on a Desert Island."
|
||||||
unlock-gp="atworldsend"
|
unlock-gp="atworldsend"
|
||||||
depend-on="canyon"
|
depend-on="minigolf"
|
||||||
major="single"
|
major="single"
|
||||||
minor="followtheleader"
|
minor="followtheleader"
|
||||||
track="islandtrack"
|
track="islandtrack"
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
name="Collect fuel for your rocket"
|
name="Collect fuel for your rocket"
|
||||||
description="Finish with at least 16 nitro points on 2 laps of XR591 in under 2:30 minutes."
|
description="Finish with at least 16 nitro points on 2 laps of XR591 in under 2:30 minutes."
|
||||||
unlock-track="mines"
|
unlock-track="mines"
|
||||||
depend-on="lighthousetime canyon"
|
depend-on="lighthousetime minigolf"
|
||||||
major="single"
|
major="single"
|
||||||
minor="quickrace"
|
minor="quickrace"
|
||||||
track="xr591"
|
track="xr591"
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
name="Win a race on Tux Tollway"
|
name="Win a race on Tux Tollway"
|
||||||
description="Win a 3 lap race on Tux Tollway against 4 Expert level AI karts."
|
description="Win a 3 lap race on Tux Tollway against 4 Expert level AI karts."
|
||||||
depend-on="lighthousetime tothemoonandbackgp"
|
depend-on="lighthousetime tothemoonandbackgp"
|
||||||
unlock-track="canyon"
|
unlock-track="minigolf"
|
||||||
major="single"
|
major="single"
|
||||||
minor="quickrace"
|
minor="quickrace"
|
||||||
track="tuxtollway"
|
track="tuxtollway"
|
@@ -2,14 +2,14 @@
|
|||||||
|
|
||||||
<challenge
|
<challenge
|
||||||
version="1"
|
version="1"
|
||||||
id="canyon"
|
id="minigolf"
|
||||||
name="Win a race on Canyon"
|
name="Win a race on Minigolf"
|
||||||
description="Win a 3 lap race on Canyon against 4 Expert level AI karts."
|
description="Win a 3 lap race on Minigolf against 4 Expert level AI karts."
|
||||||
depend-on="tollway"
|
depend-on="tollway"
|
||||||
unlock-track="xr591"
|
unlock-track="xr591"
|
||||||
major="single"
|
major="single"
|
||||||
minor="quickrace"
|
minor="quickrace"
|
||||||
track="canyon"
|
track="minigolf"
|
||||||
difficulty="hard"
|
difficulty="hard"
|
||||||
laps="3"
|
laps="3"
|
||||||
karts="5"
|
karts="5"
|
||||||
|
Before Width: | Height: | Size: 62 KiB After Width: | Height: | Size: 62 KiB |
Before Width: | Height: | Size: 72 KiB After Width: | Height: | Size: 72 KiB |
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 76 KiB |
Before Width: | Height: | Size: 79 KiB After Width: | Height: | Size: 78 KiB |
Before Width: | Height: | Size: 62 KiB After Width: | Height: | Size: 50 KiB |
Before Width: | Height: | Size: 40 KiB |
@@ -17,7 +17,7 @@
|
|||||||
<track id="zengarden" laps="4" />
|
<track id="zengarden" laps="4" />
|
||||||
<track id="city" laps="3" />
|
<track id="city" laps="3" />
|
||||||
<track id="xr591" laps="3" />
|
<track id="xr591" laps="3" />
|
||||||
<track id="canyon" laps="2" />
|
<track id="minigolf" laps="3" />
|
||||||
<track id="snowmountain" laps="3" />
|
<track id="snowmountain" laps="3" />
|
||||||
<track id="tuxtollway" laps="2" />
|
<track id="tuxtollway" laps="2" />
|
||||||
<track id="subsea" laps="2" />
|
<track id="subsea" laps="2" />
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
<supertuxkart_grand_prix name="At World's End">
|
<supertuxkart_grand_prix name="At World's End">
|
||||||
|
|
||||||
<track id="fortmagma" laps="3" />
|
<track id="fortmagma" laps="3" />
|
||||||
<track id="canyon" laps="2" />
|
<track id="minigolf" laps="3" />
|
||||||
<track id="xr591" laps="3" />
|
<track id="xr591" laps="3" />
|
||||||
<track id="mines" laps="3" />
|
<track id="mines" laps="3" />
|
||||||
<track id="city" laps="3" />
|
<track id="city" laps="3" />
|
||||||
|
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 80 KiB |
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 5.5 KiB |
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 6.9 KiB |
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 7.0 KiB |
Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 86 KiB |
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 5.5 KiB |
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 6.9 KiB |
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 6.8 KiB |
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 62 KiB |
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 5.5 KiB |
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 7.0 KiB |
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 6.9 KiB |
Before Width: | Height: | Size: 69 KiB After Width: | Height: | Size: 75 KiB |
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 23 KiB |
2030
data/po/ar.po
2027
data/po/bg.po
560
data/po/ca.po
562
data/po/cs.po
2042
data/po/da.po
572
data/po/de.po
2025
data/po/el.po
2024
data/po/eo.po
650
data/po/es.po
2026
data/po/eu.po
2025
data/po/fa.po
560
data/po/fi.po
564
data/po/fr.po
558
data/po/ga.po
560
data/po/gl.po
562
data/po/he.po
2041
data/po/hi.po
560
data/po/hr.po
559
data/po/hu.po
561
data/po/id.po
2025
data/po/is.po
563
data/po/it.po
2022
data/po/ja.po
2030
data/po/ko.po
908
data/po/lt.po
563
data/po/nb.po
560
data/po/nl.po
560
data/po/nn.po
562
data/po/pl.po
560
data/po/pt.po
563
data/po/pt_BR.po
2022
data/po/ro.po
564
data/po/ru.po
562
data/po/sk.po
576
data/po/sl.po
2039
data/po/sq.po
560
data/po/sr.po
560
data/po/sv.po
560
data/po/tr.po
2055
data/po/uk.po
558
data/po/vi.po
562
data/po/zh_CN.po
562
data/po/zh_TW.po
@@ -227,6 +227,8 @@ supertuxkart_SOURCES = \
|
|||||||
karts/max_speed.hpp \
|
karts/max_speed.hpp \
|
||||||
karts/moveable.cpp \
|
karts/moveable.cpp \
|
||||||
karts/moveable.hpp \
|
karts/moveable.hpp \
|
||||||
|
modes/demo_world.cpp \
|
||||||
|
modes/demo_world.hpp \
|
||||||
modes/follow_the_leader.cpp \
|
modes/follow_the_leader.cpp \
|
||||||
modes/follow_the_leader.hpp \
|
modes/follow_the_leader.hpp \
|
||||||
modes/game_tutorial.cpp \
|
modes/game_tutorial.cpp \
|
||||||
|
@@ -67,7 +67,11 @@ Addon::Addon(const XMLNode &xml)
|
|||||||
xml.get("id", &m_id );
|
xml.get("id", &m_id );
|
||||||
xml.get("designer", &designer );
|
xml.get("designer", &designer );
|
||||||
xml.get("status", &m_status );
|
xml.get("status", &m_status );
|
||||||
xml.get("date", &m_date );
|
|
||||||
|
int64_t date;
|
||||||
|
xml.get("date", &date );
|
||||||
|
m_date = date;
|
||||||
|
|
||||||
xml.get("installed", &m_installed );
|
xml.get("installed", &m_installed );
|
||||||
xml.get("installed-revision", &m_installed_revision);
|
xml.get("installed-revision", &m_installed_revision);
|
||||||
xml.get("revision", &m_revision );
|
xml.get("revision", &m_revision );
|
||||||
|
@@ -428,12 +428,12 @@ CURLcode NetworkHttp::loadAddonsList(const XMLNode *xml,
|
|||||||
const std::string &filename)
|
const std::string &filename)
|
||||||
{
|
{
|
||||||
std::string addon_list_url("");
|
std::string addon_list_url("");
|
||||||
Time::TimeType mtime(0);
|
int64_t mtime(0);
|
||||||
const XMLNode *include = xml->getNode("include");
|
const XMLNode *include = xml->getNode("include");
|
||||||
if(include)
|
if(include)
|
||||||
{
|
{
|
||||||
include->get("file", &addon_list_url);
|
include->get("file", &addon_list_url);
|
||||||
include->get("mtime", &mtime );
|
include->get("mtime", &mtime);
|
||||||
}
|
}
|
||||||
if(addon_list_url.size()==0)
|
if(addon_list_url.size()==0)
|
||||||
{
|
{
|
||||||
@@ -503,7 +503,7 @@ CURLcode NetworkHttp::downloadFileInternal(Request *request)
|
|||||||
uagent += (std::string)" (Windows)";
|
uagent += (std::string)" (Windows)";
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
uagent += (std::string)" (Macintosh)";
|
uagent += (std::string)" (Macintosh)";
|
||||||
#elif defined(FreeBSD)
|
#elif defined(__FreeBSD__)
|
||||||
uagent += (std::string)" (FreeBSD)";
|
uagent += (std::string)" (FreeBSD)";
|
||||||
#elif defined(linux)
|
#elif defined(linux)
|
||||||
uagent += (std::string)" (Linux)";
|
uagent += (std::string)" (Linux)";
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
SUBDIRS=src
|
SUBDIRS=src
|
||||||
|
|
||||||
EXTRA_DIST = BulletLicense.txt Changelog copy_bullet_files \
|
EXTRA_DIST = BulletLicense.txt Changelog copy_bullet_files \
|
||||||
LICENSE README VERSION
|
LICENSE README VERSION CMakeLists.txt
|
||||||
|
|
||||||
|
@@ -242,13 +242,18 @@ void TimeUserConfigParam::findYourDataInAChildOf(const XMLNode* node)
|
|||||||
//std::cout << "Couldn't find int parameter " << paramName <<std::endl;
|
//std::cout << "Couldn't find int parameter " << paramName <<std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
child->get( "value", &m_value );
|
|
||||||
|
int64_t val;
|
||||||
|
child->get( "value", &val );
|
||||||
|
m_value = val;
|
||||||
} // findYourDataInAChildOf
|
} // findYourDataInAChildOf
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
void TimeUserConfigParam::findYourDataInAnAttributeOf(const XMLNode* node)
|
void TimeUserConfigParam::findYourDataInAnAttributeOf(const XMLNode* node)
|
||||||
{
|
{
|
||||||
node->get( m_param_name, &m_value );
|
int64_t val;
|
||||||
|
node->get( m_param_name, &val );
|
||||||
|
m_value = val;
|
||||||
} // findYourDataInAnAttributeOf
|
} // findYourDataInAnAttributeOf
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
noinst_LIBRARIES = libenet.a
|
noinst_LIBRARIES = libenet.a
|
||||||
EXTRA_DIST = ChangeLog configure design.txt Doxyfile LICENSE tutorial.txt \
|
EXTRA_DIST = ChangeLog configure design.txt Doxyfile LICENSE tutorial.txt CMakeLists.txt\
|
||||||
$(shell find $(srcdir) -maxdepth 2 -name "*.dox")
|
$(shell find $(srcdir) -maxdepth 2 -name "*.dox")
|
||||||
libenet_a_SOURCES = callbacks.c compress.c host.c list.c packet.c peer.c \
|
libenet_a_SOURCES = callbacks.c compress.c host.c list.c packet.c peer.c \
|
||||||
protocol.c unix.c win32.c \
|
protocol.c unix.c win32.c \
|
||||||
|
@@ -617,6 +617,7 @@ namespace GUIEngine
|
|||||||
#include "guiengine/screen.hpp"
|
#include "guiengine/screen.hpp"
|
||||||
#include "guiengine/skin.hpp"
|
#include "guiengine/skin.hpp"
|
||||||
#include "guiengine/widget.hpp"
|
#include "guiengine/widget.hpp"
|
||||||
|
#include "modes/demo_world.hpp"
|
||||||
#include "modes/world.hpp"
|
#include "modes/world.hpp"
|
||||||
#include "states_screens/race_gui_base.hpp"
|
#include "states_screens/race_gui_base.hpp"
|
||||||
|
|
||||||
@@ -1117,6 +1118,20 @@ namespace GUIEngine
|
|||||||
|
|
||||||
g_driver->enableMaterial2D(false);
|
g_driver->enableMaterial2D(false);
|
||||||
|
|
||||||
|
|
||||||
|
if (gamestate == MENU)
|
||||||
|
{
|
||||||
|
if (DemoWorld::updateIdleTimeAndStartDemo(elapsed_time))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DemoWorld::resetIdleTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // render
|
} // render
|
||||||
|
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
@@ -30,6 +30,7 @@
|
|||||||
#include "guiengine/widgets/list_widget.hpp"
|
#include "guiengine/widgets/list_widget.hpp"
|
||||||
#include "guiengine/widgets/ribbon_widget.hpp"
|
#include "guiengine/widgets/ribbon_widget.hpp"
|
||||||
#include "input/input_manager.hpp"
|
#include "input/input_manager.hpp"
|
||||||
|
#include "modes/demo_world.hpp"
|
||||||
#include "states_screens/state_manager.hpp"
|
#include "states_screens/state_manager.hpp"
|
||||||
#include "utils/profiler.hpp"
|
#include "utils/profiler.hpp"
|
||||||
|
|
||||||
@@ -648,6 +649,8 @@ EventPropagation EventHandler::onGUIEvent(const SEvent& event)
|
|||||||
{
|
{
|
||||||
const s32 id = event.GUIEvent.Caller->getID();
|
const s32 id = event.GUIEvent.Caller->getID();
|
||||||
|
|
||||||
|
DemoWorld::resetIdleTime();
|
||||||
|
|
||||||
switch (event.GUIEvent.EventType)
|
switch (event.GUIEvent.EventType)
|
||||||
{
|
{
|
||||||
case EGET_BUTTON_CLICKED:
|
case EGET_BUTTON_CLICKED:
|
||||||
|
@@ -15,9 +15,9 @@
|
|||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>APPL</string>
|
<string>APPL</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>0.7.1b</string>
|
<string>0.7.3</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>0.7.1b</string>
|
<string>0.7.3</string>
|
||||||
<key>CSResourcesFileMapped</key>
|
<key>CSResourcesFileMapped</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>CFBundleIdentifier</key>
|
<key>CFBundleIdentifier</key>
|
||||||
|
@@ -494,6 +494,10 @@
|
|||||||
<Filter
|
<Filter
|
||||||
Name="modes"
|
Name="modes"
|
||||||
>
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\modes\demo_world.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\modes\follow_the_leader.cpp"
|
RelativePath="..\..\modes\follow_the_leader.cpp"
|
||||||
>
|
>
|
||||||
@@ -1576,6 +1580,10 @@
|
|||||||
<Filter
|
<Filter
|
||||||
Name="modes"
|
Name="modes"
|
||||||
>
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\modes\demo_world.hpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\modes\follow_the_leader.hpp"
|
RelativePath="..\..\modes\follow_the_leader.hpp"
|
||||||
>
|
>
|
||||||
|
@@ -96,14 +96,13 @@ bool DeviceManager::initialize()
|
|||||||
{
|
{
|
||||||
core::stringc name = m_irrlicht_gamepads[id].Name.c_str();
|
core::stringc name = m_irrlicht_gamepads[id].Name.c_str();
|
||||||
|
|
||||||
// On Windows, unless we use DirectInput, all gamepads are given the same name...
|
#ifdef WIN32
|
||||||
// This makes configuration totally useless, so append an ID to the name
|
// On Windows, unless we use DirectInput, all gamepads are given the
|
||||||
core::stringc name_lower = name;
|
// same name ('microsoft pc-joystick driver'). This makes configuration
|
||||||
name_lower.make_lower();
|
// totally useless, so append an ID to the name. We can't test for the
|
||||||
if (name_lower == "microsoft pc-joystick driver")
|
// name, since the name is even translated.
|
||||||
{
|
|
||||||
name = name + " " + StringUtils::toString(id).c_str();
|
name = name + " " + StringUtils::toString(id).c_str();
|
||||||
}
|
#endif
|
||||||
|
|
||||||
if (UserConfigParams::logMisc())
|
if (UserConfigParams::logMisc())
|
||||||
{
|
{
|
||||||
|
@@ -33,10 +33,12 @@
|
|||||||
#include "input/device_manager.hpp"
|
#include "input/device_manager.hpp"
|
||||||
#include "input/input.hpp"
|
#include "input/input.hpp"
|
||||||
#include "karts/kart.hpp"
|
#include "karts/kart.hpp"
|
||||||
|
#include "modes/demo_world.hpp"
|
||||||
#include "modes/profile_world.hpp"
|
#include "modes/profile_world.hpp"
|
||||||
#include "modes/world.hpp"
|
#include "modes/world.hpp"
|
||||||
#include "race/history.hpp"
|
#include "race/history.hpp"
|
||||||
#include "states_screens/kart_selection.hpp"
|
#include "states_screens/kart_selection.hpp"
|
||||||
|
#include "states_screens/main_menu_screen.hpp"
|
||||||
#include "states_screens/options_screen_input2.hpp"
|
#include "states_screens/options_screen_input2.hpp"
|
||||||
#include "states_screens/state_manager.hpp"
|
#include "states_screens/state_manager.hpp"
|
||||||
#include "utils/string_utils.hpp"
|
#include "utils/string_utils.hpp"
|
||||||
@@ -432,6 +434,14 @@ void InputManager::dispatchInput(Input::InputType type, int deviceID,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Abort demo mode if a key is pressed during the race in demo mode
|
||||||
|
if(dynamic_cast<DemoWorld*>(World::getWorld()))
|
||||||
|
{
|
||||||
|
race_manager->exitRace();
|
||||||
|
StateManager::get()->resetAndGoToScreen(MainMenuScreen::getInstance());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
StateManager::ActivePlayer* player = NULL;
|
StateManager::ActivePlayer* player = NULL;
|
||||||
PlayerAction action;
|
PlayerAction action;
|
||||||
bool action_found = m_device_manager->translateInput(type, deviceID,
|
bool action_found = m_device_manager->translateInput(type, deviceID,
|
||||||
|
@@ -287,7 +287,7 @@ int XMLNode::get(const std::string &attribute, video::SColorf *color) const
|
|||||||
return 1;
|
return 1;
|
||||||
} // get(SColor)
|
} // get(SColor)
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
int XMLNode::get(const std::string &attribute, int *value) const
|
int XMLNode::get(const std::string &attribute, int32_t *value) const
|
||||||
{
|
{
|
||||||
std::string s;
|
std::string s;
|
||||||
if(!get(attribute, &s)) return 0;
|
if(!get(attribute, &s)) return 0;
|
||||||
@@ -300,15 +300,15 @@ int XMLNode::get(const std::string &attribute, int *value) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
} // get(int)
|
} // get(int32_t)
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
int XMLNode::get(const std::string &attribute, Time::TimeType *value) const
|
int XMLNode::get(const std::string &attribute, int64_t *value) const
|
||||||
{
|
{
|
||||||
std::string s;
|
std::string s;
|
||||||
if(!get(attribute, &s)) return 0;
|
if(!get(attribute, &s)) return 0;
|
||||||
|
|
||||||
if (!StringUtils::parseString<Time::TimeType>(s, value))
|
if (!StringUtils::parseString<int64_t>(s, value))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "[XMLNode] WARNING: Expected int but found '%s' for attribute '%s' of node '%s' in file %s\n",
|
fprintf(stderr, "[XMLNode] WARNING: Expected int but found '%s' for attribute '%s' of node '%s' in file %s\n",
|
||||||
s.c_str(), attribute.c_str(), m_name.c_str(), m_file_name.c_str());
|
s.c_str(), attribute.c_str(), m_name.c_str(), m_file_name.c_str());
|
||||||
@@ -316,10 +316,11 @@ int XMLNode::get(const std::string &attribute, Time::TimeType *value) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
} // get(TimeType)
|
} // get(int64_t)
|
||||||
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
int XMLNode::get(const std::string &attribute, unsigned int *value) const
|
int XMLNode::get(const std::string &attribute, uint32_t *value) const
|
||||||
{
|
{
|
||||||
std::string s;
|
std::string s;
|
||||||
if(!get(attribute, &s)) return 0;
|
if(!get(attribute, &s)) return 0;
|
||||||
@@ -332,7 +333,7 @@ int XMLNode::get(const std::string &attribute, unsigned int *value) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
} // get(unsigned int)
|
} // get(uint32_t)
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
int XMLNode::get(const std::string &attribute, float *value) const
|
int XMLNode::get(const std::string &attribute, float *value) const
|
||||||
|
@@ -20,6 +20,15 @@
|
|||||||
#ifndef HEADER_XML_NODE_HPP
|
#ifndef HEADER_XML_NODE_HPP
|
||||||
#define HEADER_XML_NODE_HPP
|
#define HEADER_XML_NODE_HPP
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
typedef __int32 int32_t;
|
||||||
|
typedef unsigned __int32 uint32_t;
|
||||||
|
typedef __int64 int64_t;
|
||||||
|
typedef unsigned __int64 uint64_t;
|
||||||
|
#else
|
||||||
|
# include <stdint.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@@ -71,9 +80,9 @@ public:
|
|||||||
unsigned int getNumNodes() const {return m_nodes.size(); }
|
unsigned int getNumNodes() const {return m_nodes.size(); }
|
||||||
int get(const std::string &attribute, std::string *value) const;
|
int get(const std::string &attribute, std::string *value) const;
|
||||||
int get(const std::string &attribute, core::stringw *value) const;
|
int get(const std::string &attribute, core::stringw *value) const;
|
||||||
int get(const std::string &attribute, int *value) const;
|
int get(const std::string &attribute, int32_t *value) const;
|
||||||
int get(const std::string &attribute, unsigned int *value) const;
|
int get(const std::string &attribute, uint32_t *value) const;
|
||||||
int get(const std::string &attribute, Time::TimeType *value) const;
|
int get(const std::string &attribute, int64_t *value) const;
|
||||||
int get(const std::string &attribute, float *value) const;
|
int get(const std::string &attribute, float *value) const;
|
||||||
int get(const std::string &attribute, bool *value) const;
|
int get(const std::string &attribute, bool *value) const;
|
||||||
int get(const std::string &attribute, Vec3 *value) const;
|
int get(const std::string &attribute, Vec3 *value) const;
|
||||||
|
@@ -411,13 +411,8 @@ bool RubberBall::updateAndDelete(float dt)
|
|||||||
|
|
||||||
// Ball squashing:
|
// Ball squashing:
|
||||||
// ===============
|
// ===============
|
||||||
// If we start squashing the ball as soon as the height is smaller than
|
if(height<1.5f*m_extend.getY())
|
||||||
// then height of the ball, it looks to extreme. So a ratio r of the
|
m_node->setScale(core::vector3df(1.0f, height/m_extend.getY(),1.0f));
|
||||||
// height of the ball and the current height of the object is used to
|
|
||||||
// tweak the look a bit.
|
|
||||||
float r = 2.0f;
|
|
||||||
if(r*height<m_extend.getY())
|
|
||||||
m_node->setScale(core::vector3df(1.0f, r*height/m_extend.getY(),1.0f));
|
|
||||||
else
|
else
|
||||||
m_node->setScale(core::vector3df(1.0f, 1.0f, 1.0f));
|
m_node->setScale(core::vector3df(1.0f, 1.0f, 1.0f));
|
||||||
|
|
||||||
@@ -570,6 +565,12 @@ float RubberBall::updateHeight()
|
|||||||
{
|
{
|
||||||
// Some experimental formulas
|
// Some experimental formulas
|
||||||
m_current_max_height = 0.5f*sqrt(m_distance_to_target);
|
m_current_max_height = 0.5f*sqrt(m_distance_to_target);
|
||||||
|
// If the ball just missed the target, m_distance_to_target
|
||||||
|
// can be huge (close to track length) due to the order in
|
||||||
|
// which a lost target is detected. Avoid this by clamping
|
||||||
|
// m_current_max_height.
|
||||||
|
if(m_current_max_height>m_max_height)
|
||||||
|
m_current_max_height = m_max_height;
|
||||||
m_interval = m_current_max_height / 10.0f;
|
m_interval = m_current_max_height / 10.0f;
|
||||||
// Avoid too small hops and esp. a division by zero
|
// Avoid too small hops and esp. a division by zero
|
||||||
if(m_interval<0.01f)
|
if(m_interval<0.01f)
|
||||||
|
@@ -157,7 +157,8 @@ void PlayerController::action(PlayerAction action, int value)
|
|||||||
break;
|
break;
|
||||||
case PA_BRAKE:
|
case PA_BRAKE:
|
||||||
m_prev_brake = value!=0;
|
m_prev_brake = value!=0;
|
||||||
if(value)
|
// let's consider below that to be a deadzone
|
||||||
|
if(value > 32768/2)
|
||||||
{
|
{
|
||||||
m_controls->m_brake = true;
|
m_controls->m_brake = true;
|
||||||
m_controls->m_accel = 0.0f;
|
m_controls->m_accel = 0.0f;
|
||||||
|
@@ -28,7 +28,6 @@ KartWithStats::KartWithStats(const std::string& ident, Track* track,
|
|||||||
: Kart(ident, track, position, is_first_kart,
|
: Kart(ident, track, position, is_first_kart,
|
||||||
init_transform, type)
|
init_transform, type)
|
||||||
{
|
{
|
||||||
reset();
|
|
||||||
} // KartWithStats
|
} // KartWithStats
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -47,6 +46,7 @@ void KartWithStats::reset()
|
|||||||
m_small_nitro_count = 0;
|
m_small_nitro_count = 0;
|
||||||
m_large_nitro_count = 0;
|
m_large_nitro_count = 0;
|
||||||
m_bubblegum_count = 0;
|
m_bubblegum_count = 0;
|
||||||
|
Kart::reset();
|
||||||
} // reset
|
} // reset
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
39
src/main.cpp
@@ -165,6 +165,7 @@
|
|||||||
#include "items/projectile_manager.hpp"
|
#include "items/projectile_manager.hpp"
|
||||||
#include "karts/kart_properties_manager.hpp"
|
#include "karts/kart_properties_manager.hpp"
|
||||||
#include "karts/kart.hpp"
|
#include "karts/kart.hpp"
|
||||||
|
#include "modes/demo_world.hpp"
|
||||||
#include "modes/profile_world.hpp"
|
#include "modes/profile_world.hpp"
|
||||||
#include "network/network_manager.hpp"
|
#include "network/network_manager.hpp"
|
||||||
#include "race/grand_prix_manager.hpp"
|
#include "race/grand_prix_manager.hpp"
|
||||||
@@ -388,6 +389,12 @@ void cmdLineHelp (char* invocation)
|
|||||||
" --profile-time=n Enable automatic driven profile mode for n "
|
" --profile-time=n Enable automatic driven profile mode for n "
|
||||||
"seconds.\n"
|
"seconds.\n"
|
||||||
" --no-graphics Do not display the actual race.\n"
|
" --no-graphics Do not display the actual race.\n"
|
||||||
|
" --demo-mode t Enables demo mode after t seconds idle time in "
|
||||||
|
"main menu.\n"
|
||||||
|
" --demo-tracks t1,t2 List of tracks to be used in demo mode. No\n"
|
||||||
|
" spaces are allowed in the track names.\n"
|
||||||
|
" --demo-laps n Number of laps in a demo.\n"
|
||||||
|
" --demo-karts n Number of karts to use in a demo.\n"
|
||||||
// " --history Replay history file 'history.dat'.\n"
|
// " --history Replay history file 'history.dat'.\n"
|
||||||
// " --history=n Replay history file 'history.dat' using:\n"
|
// " --history=n Replay history file 'history.dat' using:\n"
|
||||||
// " n=1: recorded positions\n"
|
// " n=1: recorded positions\n"
|
||||||
@@ -904,6 +911,38 @@ int handleCmdLine(int argc, char **argv)
|
|||||||
UserConfigParams::m_no_start_screen = true;
|
UserConfigParams::m_no_start_screen = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else if( !strcmp(argv[i], "--demo-mode") && i+1<argc)
|
||||||
|
{
|
||||||
|
float t;
|
||||||
|
StringUtils::fromString(argv[i+1], t);
|
||||||
|
DemoWorld::enableDemoMode(t);
|
||||||
|
// The default number of laps is taken from ProfileWorld and
|
||||||
|
// is 0. So set a more useful default for demo mode.
|
||||||
|
DemoWorld::setNumLaps(2);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
else if( !strcmp(argv[i], "--demo-laps") && i+1<argc)
|
||||||
|
{
|
||||||
|
// Note that we use a separate setting for demo mode to avoid the
|
||||||
|
// problem that someone plays a game, and in further demos then
|
||||||
|
// the wrong (i.e. last selected) number of laps would be used
|
||||||
|
DemoWorld::setNumLaps(atoi(argv[i+1]));
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
else if( !strcmp(argv[i], "--demo-karts") && i+1<argc)
|
||||||
|
{
|
||||||
|
// Note that we use a separate setting for demo mode to avoid the
|
||||||
|
// problem that someone plays a game, and in further demos then
|
||||||
|
// the wrong (i.e. last selected) number of karts would be used
|
||||||
|
DemoWorld::setNumKarts(atoi(argv[i+1]));
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
else if( !strcmp(argv[i], "--demo-tracks") && i+1<argc)
|
||||||
|
{
|
||||||
|
DemoWorld::setTracks(StringUtils::split(std::string(argv[i+1]),
|
||||||
|
','));
|
||||||
|
i++;
|
||||||
|
}
|
||||||
else if( !strcmp(argv[i], "--item") && i+1<argc )
|
else if( !strcmp(argv[i], "--item") && i+1<argc )
|
||||||
{
|
{
|
||||||
item_manager->setUserFilename(argv[i+1]);
|
item_manager->setUserFilename(argv[i+1]);
|
||||||
|
143
src/modes/demo_world.cpp
Normal file
@@ -0,0 +1,143 @@
|
|||||||
|
//
|
||||||
|
// SuperTuxKart - a fun racing game with go-kart
|
||||||
|
// Copyright (C) 2012 Joerg Henrichs
|
||||||
|
//
|
||||||
|
// 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 "modes/demo_world.hpp"
|
||||||
|
|
||||||
|
#include "input/device_manager.hpp"
|
||||||
|
#include "input/input_manager.hpp"
|
||||||
|
#include "network/network_manager.hpp"
|
||||||
|
#include "race/race_manager.hpp"
|
||||||
|
#include "tracks/track.hpp"
|
||||||
|
#include "tracks/track_manager.hpp"
|
||||||
|
|
||||||
|
std::vector<std::string> DemoWorld::m_demo_tracks;
|
||||||
|
int DemoWorld::m_num_karts = 2;
|
||||||
|
float DemoWorld::m_max_idle_time = 99999.0f;
|
||||||
|
float DemoWorld::m_current_idle_time = 0;
|
||||||
|
bool DemoWorld::m_do_demo = false;
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
/** The constructor sets the number of (local) players to 0, since only AI
|
||||||
|
* karts are used.
|
||||||
|
*/
|
||||||
|
DemoWorld::DemoWorld()
|
||||||
|
{
|
||||||
|
m_abort = false;
|
||||||
|
ProfileWorld::setProfileModeLaps(m_num_laps);
|
||||||
|
race_manager->setMinorMode (RaceManager::MINOR_MODE_NORMAL_RACE);
|
||||||
|
race_manager->setDifficulty(RaceManager::RD_HARD);
|
||||||
|
race_manager->setNumKarts(m_num_karts);
|
||||||
|
race_manager->setNumLocalPlayers(1);
|
||||||
|
race_manager->setLocalKartInfo(0, UserConfigParams::m_default_kart);
|
||||||
|
|
||||||
|
} // DemoWorld
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
/** Destructor. Resets the flag that the next race is a demo mode.
|
||||||
|
*/
|
||||||
|
DemoWorld::~DemoWorld()
|
||||||
|
{
|
||||||
|
m_current_idle_time = 0;
|
||||||
|
m_do_demo = false;
|
||||||
|
} // ~DemoWorld
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
/** Sets the list of tracks that is to be used.
|
||||||
|
* \param tracks List of track identifiers.
|
||||||
|
*/
|
||||||
|
void DemoWorld::setTracks(const std::vector<std::string> &tracks)
|
||||||
|
{
|
||||||
|
m_demo_tracks = tracks;
|
||||||
|
} // setTracks
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
/** The race is over if either the requested number of laps have been done
|
||||||
|
* or the requested time is over.
|
||||||
|
*/
|
||||||
|
bool DemoWorld::isRaceOver()
|
||||||
|
{
|
||||||
|
if(m_abort) return true;
|
||||||
|
|
||||||
|
// Now it must be laps based profiling:
|
||||||
|
return race_manager->getFinishedKarts()==getNumKarts();
|
||||||
|
} // isRaceOver
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
/** This function is called when the race is finished, but end-of-race
|
||||||
|
* animations have still to be played. In the case of profiling,
|
||||||
|
* we can just abort here without waiting for the animations.
|
||||||
|
*/
|
||||||
|
void DemoWorld::enterRaceOverState()
|
||||||
|
{
|
||||||
|
// Do not call profile enterRaceOverState, since it will abort
|
||||||
|
StandardRace::enterRaceOverState();
|
||||||
|
} // enterRaceOverState
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
/** Updates the current idle time by dt. If the accumulated idle time is
|
||||||
|
* large enough, a demo race is started.
|
||||||
|
* \param dt Time step size, which is added to the idle time.
|
||||||
|
* \return true if a demo is started.
|
||||||
|
*/
|
||||||
|
bool DemoWorld::updateIdleTimeAndStartDemo(float dt)
|
||||||
|
{
|
||||||
|
m_current_idle_time += dt;
|
||||||
|
if(m_current_idle_time <= m_max_idle_time)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if(m_demo_tracks.size()==0)
|
||||||
|
m_demo_tracks = track_manager->getAllTrackIdentifiers();
|
||||||
|
Track *track = track_manager->getTrack(m_demo_tracks[0]);
|
||||||
|
// Remove arena tracks (outside the if statement above in case that
|
||||||
|
// a user requests a arena track ;) )
|
||||||
|
while((!track || track->isArena()) && m_demo_tracks.size()>1)
|
||||||
|
{
|
||||||
|
if(!track)
|
||||||
|
printf("Invalid demo track identifier '%s'.\n",
|
||||||
|
m_demo_tracks[0].c_str());
|
||||||
|
m_demo_tracks.erase(m_demo_tracks.begin());
|
||||||
|
track = track_manager->getTrack(m_demo_tracks[0]);
|
||||||
|
}
|
||||||
|
if(m_demo_tracks.size()==0)
|
||||||
|
{
|
||||||
|
printf("No valid tracks found, no demo started.\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
StateManager::get()->enterGameState();
|
||||||
|
race_manager->setNumLocalPlayers(1);
|
||||||
|
InputDevice *device;
|
||||||
|
|
||||||
|
// Use keyboard 0 by default in --no-start-screen
|
||||||
|
device = input_manager->getDeviceList()->getKeyboard(0);
|
||||||
|
StateManager::get()->createActivePlayer(
|
||||||
|
UserConfigParams::m_all_players.get(0), device );
|
||||||
|
// ASSIGN should make sure that only input from assigned devices
|
||||||
|
// is read.
|
||||||
|
input_manager->getDeviceList()->setAssignMode(ASSIGN);
|
||||||
|
|
||||||
|
m_do_demo = true;
|
||||||
|
race_manager->setNumKarts(m_num_karts);
|
||||||
|
race_manager->setLocalKartInfo(0, "tux");
|
||||||
|
network_manager->setupPlayerKartInfo();
|
||||||
|
race_manager->startSingleRace(m_demo_tracks[0], m_num_laps);
|
||||||
|
m_demo_tracks.push_back(m_demo_tracks[0]);
|
||||||
|
m_demo_tracks.erase(m_demo_tracks.begin());
|
||||||
|
|
||||||
|
return true;
|
||||||
|
} // updateIdleTime
|
87
src/modes/demo_world.hpp
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
//
|
||||||
|
// SuperTuxKart - a fun racing game with go-kart
|
||||||
|
// Copyright (C) 2012 Joerg Henrichs
|
||||||
|
//
|
||||||
|
// 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_DEMO_WORLD_HPP
|
||||||
|
#define HEADER_DEMO_WORLD_HPP
|
||||||
|
|
||||||
|
#include "modes/profile_world.hpp"
|
||||||
|
|
||||||
|
class Kart;
|
||||||
|
|
||||||
|
/** \brief This class is used to show a demo of STK (e.g. after being
|
||||||
|
* idle for a certain amount of time, or on certain command line options.
|
||||||
|
* This allows STK to be used as a demo in a shop.
|
||||||
|
* \ingroup modes
|
||||||
|
*/
|
||||||
|
class DemoWorld : public ProfileWorld
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
/** True if demo mode should be aborted, e.g. because a key was
|
||||||
|
* pressed. */
|
||||||
|
bool m_abort;
|
||||||
|
|
||||||
|
/** The list of tracks to use for demo mode. They will be picked randomly,
|
||||||
|
* but each track will be picked once before one track is repeated. */
|
||||||
|
static std::vector<std::string> m_demo_tracks;
|
||||||
|
|
||||||
|
/** Number of karts to use in demo mode. */
|
||||||
|
static int m_num_karts;
|
||||||
|
|
||||||
|
/** Idle time after which demo mode should be started. */
|
||||||
|
static float m_max_idle_time;
|
||||||
|
|
||||||
|
/** Used by the menu system to measure idle time. */
|
||||||
|
static float m_current_idle_time;
|
||||||
|
|
||||||
|
/** True if the next race is to be a demo race. */
|
||||||
|
static bool m_do_demo;
|
||||||
|
public:
|
||||||
|
DemoWorld();
|
||||||
|
virtual ~DemoWorld();
|
||||||
|
/** Returns identifier for this world. */
|
||||||
|
virtual std::string getInternalCode() const {return "DEMO"; }
|
||||||
|
virtual void update(float dt) {ProfileWorld::update(dt);};
|
||||||
|
virtual bool isRaceOver();
|
||||||
|
virtual void enterRaceOverState();
|
||||||
|
static bool updateIdleTimeAndStartDemo(float dt) ;
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
/** Sets the number of laps to use in demo mode. m_num_laps is from
|
||||||
|
* ProfileWorld. */
|
||||||
|
static void setNumLaps(unsigned int num_laps) { m_num_laps = num_laps; }
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
/** Sets the number of karts to use in demo mode. */
|
||||||
|
static void setNumKarts(unsigned int num_karts) { m_num_karts = num_karts;}
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
static void setTracks(const std::vector<std::string> &tracks);
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
/** Enables demo mode after the specified amount of time (default 1
|
||||||
|
* second).
|
||||||
|
* \param time The idle time after which demo mode should be started. */
|
||||||
|
static void enableDemoMode(float time=1.0f) { m_max_idle_time = time; }
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
/** Returns true if the menu detected enough idle time to run a demo. */
|
||||||
|
static bool isDemoMode() { return m_do_demo; }
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
/** Resets the idle time to 0. */
|
||||||
|
static void resetIdleTime() { m_current_idle_time = 0; }
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
/** Signals that the demo should be aborted. */
|
||||||
|
void abortDemo() {m_abort = true; }
|
||||||
|
}; // DemoWorld
|
||||||
|
|
||||||
|
#endif
|