Applied changes from statistics branch to trunk (r9413 - r9484).

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@9503 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2011-08-15 02:00:50 +00:00
parent 8a9bdc1505
commit 2172f1c4df
8 changed files with 2390 additions and 2272 deletions

View File

@ -36,6 +36,7 @@
#include "items/projectile_manager.hpp" #include "items/projectile_manager.hpp"
#include "karts/kart_properties_manager.hpp" #include "karts/kart_properties_manager.hpp"
#include "main_loop.hpp" #include "main_loop.hpp"
#include "modes/profile_world.hpp"
#include "modes/world.hpp" #include "modes/world.hpp"
#include "states_screens/dialogs/confirm_resolution_dialog.hpp" #include "states_screens/dialogs/confirm_resolution_dialog.hpp"
#include "states_screens/state_manager.hpp" #include "states_screens/state_manager.hpp"
@ -83,139 +84,147 @@ IrrDriver::~IrrDriver()
void IrrDriver::initDevice() void IrrDriver::initDevice()
{ {
static bool firstTime = true; // If --no-graphics option was used, just create a device with NULL renderer
if (ProfileWorld::isNoGraphics())
// ---- the first time, get a list of available video modes
if (firstTime)
{ {
m_device = createDevice(video::EDT_NULL); m_device = createDevice(video::EDT_NULL);
video::IVideoModeList* modes = m_device->getVideoModeList();
const int count = modes->getVideoModeCount();
for(int i=0; i<count; i++)
{
// only consider 32-bit resolutions for now
if (modes->getVideoModeDepth(i) >= 24)
{
const int w = modes->getVideoModeResolution(i).Width;
const int h = modes->getVideoModeResolution(i).Height;
if (h < MIN_SUPPORTED_HEIGHT || w < MIN_SUPPORTED_WIDTH)
continue;
VideoMode mode;
mode.width = w;
mode.height = h;
m_modes.push_back( mode );
}
}
// The debug name is only set if irrlicht is compiled in debug
// mode. So we use this to print a warning to the user.
if(m_device->getDebugName())
{
printf("!!!!! Performance warning: Irrlicht compiled with debug mode.!!!!!\n");
printf("!!!!! This can have a significant performance impact !!!!!\n");
}
m_device->closeDevice();
// In some circumstances it would happen that a WM_QUIT message
// (apparently sent for this NULL device) is later received by
// the actual window, causing it to immediately quit.
// Following advise on the irrlicht forums I added the following
// two calles - the first one didn't make a difference (but
// certainly can't hurt), but the second one apparenlty solved
// the problem for now.
m_device->clearSystemMessages();
m_device->run();
firstTime = false;
} // end if firstTime
int numDrivers = 5;
// Test if user has chosen a driver or if we should try all to find a woring
// one.
if( UserConfigParams::m_renderer != 0 )
{
numDrivers = 1;
} }
else
// ---- open device
// Try different drivers: start with opengl, then DirectX
for(int driver_type=0; driver_type<numDrivers; driver_type++)
{ {
static bool firstTime = true;
video::E_DRIVER_TYPE type; // ---- the first time, get a list of available video modes
if (firstTime)
{
m_device = createDevice(video::EDT_NULL);
// Test if user has chosen a driver or if we should try all to find a video::IVideoModeList* modes = m_device->getVideoModeList();
// woring one. const int count = modes->getVideoModeCount();
for(int i=0; i<count; i++)
{
// only consider 32-bit resolutions for now
if (modes->getVideoModeDepth(i) >= 24)
{
const int w = modes->getVideoModeResolution(i).Width;
const int h = modes->getVideoModeResolution(i).Height;
if (h < MIN_SUPPORTED_HEIGHT || w < MIN_SUPPORTED_WIDTH)
continue;
VideoMode mode;
mode.width = w;
mode.height = h;
m_modes.push_back( mode );
}
}
// The debug name is only set if irrlicht is compiled in debug
// mode. So we use this to print a warning to the user.
if(m_device->getDebugName())
{
printf("!!!!! Performance warning: Irrlicht compiled with debug mode.!!!!!\n");
printf("!!!!! This can have a significant performance impact !!!!!\n");
}
m_device->closeDevice();
// In some circumstances it would happen that a WM_QUIT message
// (apparently sent for this NULL device) is later received by
// the actual window, causing it to immediately quit.
// Following advise on the irrlicht forums I added the following
// two calles - the first one didn't make a difference (but
// certainly can't hurt), but the second one apparenlty solved
// the problem for now.
m_device->clearSystemMessages();
m_device->run();
firstTime = false;
} // end if firstTime
int numDrivers = 5;
// Test if user has chosen a driver or if we should try all to find a woring
// one.
if( UserConfigParams::m_renderer != 0 ) if( UserConfigParams::m_renderer != 0 )
{ {
// Get the correct type. numDrivers = 1;
type = getEngineDriverType( UserConfigParams::m_renderer );
} else
{
// Get the correct type.
type = getEngineDriverType( driver_type );
} }
// Try 32 and, upon failure, 24 then 16 bit per pixels // ---- open device
for (int bits=32; bits>15; bits -=8) // Try different drivers: start with opengl, then DirectX
for(int driver_type=0; driver_type<numDrivers; driver_type++)
{ {
printf("[IrrDriver] Trying to create device with %i bits\n", bits);
/* video::E_DRIVER_TYPE type;
m_device = createDevice(type,
// Test if user has chosen a driver or if we should try all to find a
// woring one.
if( UserConfigParams::m_renderer != 0 )
{
// Get the correct type.
type = getEngineDriverType( UserConfigParams::m_renderer );
} else
{
// Get the correct type.
type = getEngineDriverType( driver_type );
}
// Try 32 and, upon failure, 24 then 16 bit per pixels
for (int bits=32; bits>15; bits -=8)
{
printf("[IrrDriver] Trying to create device with %i bits\n", bits);
/*
m_device = createDevice(type,
core::dimension2d<u32>(UserConfigParams::m_width,
UserConfigParams::m_height ),
bits, //bits per pixel
UserConfigParams::m_fullscreen,
false, // stencil buffers
false, // vsync
this // event receiver
);
*/
SIrrlichtCreationParameters params;
params.DriverType = type;
params.WindowSize = core::dimension2d<u32>(UserConfigParams::m_width,
UserConfigParams::m_height);
params.Bits = bits;
params.EventReceiver = this;
params.Fullscreen = UserConfigParams::m_fullscreen;
if (UserConfigParams::m_fullscreen_antialiasing)
params.AntiAlias = 8;
params.Vsync = UserConfigParams::m_vsync;
m_device = createDeviceEx(params);
if(m_device) break;
} // for bits=32, 24, 16
if(m_device) break;
} // for edt_types
// if still no device, try with a standard 800x600 window size, maybe
// size is the problem
if(!m_device)
{
UserConfigParams::m_width = 800;
UserConfigParams::m_height = 600;
m_device = createDevice(video::EDT_OPENGL,
core::dimension2d<u32>(UserConfigParams::m_width, core::dimension2d<u32>(UserConfigParams::m_width,
UserConfigParams::m_height ), UserConfigParams::m_height ),
bits, //bits per pixel 32, //bits per pixel
UserConfigParams::m_fullscreen, UserConfigParams::m_fullscreen,
false, // stencil buffers false, // stencil buffers
false, // vsync false, // vsync
this // event receiver this // event receiver
); );
*/ if (m_device)
{
SIrrlichtCreationParameters params; fprintf(stderr, "An invalid resolution was set in the config file, reverting to saner values\n");
params.DriverType = type; }
params.WindowSize = core::dimension2d<u32>(UserConfigParams::m_width,
UserConfigParams::m_height);
params.Bits = bits;
params.EventReceiver = this;
params.Fullscreen = UserConfigParams::m_fullscreen;
if (UserConfigParams::m_fullscreen_antialiasing)
params.AntiAlias = 8;
params.Vsync = UserConfigParams::m_vsync;
m_device = createDeviceEx(params);
if(m_device) break;
} // for bits=32, 24, 16
if(m_device) break;
} // for edt_types
// if still no device, try with a standard 800x600 window size, maybe
// size is the problem
if(!m_device)
{
UserConfigParams::m_width = 800;
UserConfigParams::m_height = 600;
m_device = createDevice(video::EDT_OPENGL,
core::dimension2d<u32>(UserConfigParams::m_width,
UserConfigParams::m_height ),
32, //bits per pixel
UserConfigParams::m_fullscreen,
false, // stencil buffers
false, // vsync
this // event receiver
);
if (m_device)
{
fprintf(stderr, "An invalid resolution was set in the config file, reverting to saner values\n");
} }
} }
@ -225,26 +234,31 @@ void IrrDriver::initDevice()
exit(-1); exit(-1);
} }
m_device->setResizable(false); m_scene_manager = m_device->getSceneManager();
m_gui_env = m_device->getGUIEnvironment();
m_video_driver = m_device->getVideoDriver();
if (!UserConfigParams::m_fbo) // Only change video driver settings if we are showing graphics
{ if (!ProfileWorld::isNoGraphics()) {
m_device->getVideoDriver()->disableFeature(EVDF_FRAMEBUFFER_OBJECT); m_device->setResizable(false);
m_device->setWindowCaption(L"SuperTuxKart");
m_device->getVideoDriver()
->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, true);
m_device->getVideoDriver()
->setTextureCreationFlag(video::ETCF_OPTIMIZED_FOR_QUALITY, true);
if (!UserConfigParams::m_fbo)
{
m_device->getVideoDriver()->disableFeature(EVDF_FRAMEBUFFER_OBJECT);
}
// Force creation of mipmaps even if the mipmaps flag in a b3d file
// does not set the 'enable mipmap' flag.
m_scene_manager->getParameters()
->setAttribute(scene::B3D_LOADER_IGNORE_MIPMAP_FLAG, true);
} }
// Stores the new file system pointer. // Stores the new file system pointer.
file_manager->setDevice(m_device); file_manager->setDevice(m_device);
m_device->setWindowCaption(L"SuperTuxKart");
m_scene_manager = m_device->getSceneManager();
// Force creation of mipmaps even if the mipmaps flag in a b3d file
// does not set the 'enable mipmap' flag.
m_scene_manager->getParameters()
->setAttribute(scene::B3D_LOADER_IGNORE_MIPMAP_FLAG, true);
m_device->getVideoDriver()->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS,true);
m_device->getVideoDriver()->setTextureCreationFlag(video::ETCF_OPTIMIZED_FOR_QUALITY,true);
m_gui_env = m_device->getGUIEnvironment();
m_video_driver = m_device->getVideoDriver();
// Initialize material2D // Initialize material2D
video::SMaterial& material2D = m_video_driver->getMaterial2D(); video::SMaterial& material2D = m_video_driver->getMaterial2D();

View File

@ -121,6 +121,7 @@
<ClCompile Include="..\..\guiengine\widgets\CGUIEditBox.cpp" /> <ClCompile Include="..\..\guiengine\widgets\CGUIEditBox.cpp" />
<ClCompile Include="..\..\items\rubber_ball.cpp" /> <ClCompile Include="..\..\items\rubber_ball.cpp" />
<ClCompile Include="..\..\items\swatter.cpp" /> <ClCompile Include="..\..\items\swatter.cpp" />
<ClCompile Include="..\..\karts\kart_with_stats.cpp" />
<ClCompile Include="..\..\main.cpp" /> <ClCompile Include="..\..\main.cpp" />
<ClCompile Include="..\..\main_loop.cpp" /> <ClCompile Include="..\..\main_loop.cpp" />
<ClCompile Include="..\..\guiengine\abstract_state_manager.cpp" /> <ClCompile Include="..\..\guiengine\abstract_state_manager.cpp" />
@ -167,6 +168,7 @@
<ClCompile Include="..\..\tinygettext\po_parser.cpp" /> <ClCompile Include="..\..\tinygettext\po_parser.cpp" />
<ClCompile Include="..\..\tinygettext\stk_file_system.cpp" /> <ClCompile Include="..\..\tinygettext\stk_file_system.cpp" />
<ClCompile Include="..\..\tinygettext\tinygettext.cpp" /> <ClCompile Include="..\..\tinygettext\tinygettext.cpp" />
<ClCompile Include="..\..\tracks\track_sector.cpp" />
<ClCompile Include="..\..\utils\constants.cpp" /> <ClCompile Include="..\..\utils\constants.cpp" />
<ClCompile Include="..\..\utils\profiler.cpp" /> <ClCompile Include="..\..\utils\profiler.cpp" />
<ClCompile Include="..\..\utils\random_generator.cpp" /> <ClCompile Include="..\..\utils\random_generator.cpp" />
@ -337,6 +339,7 @@
<ClInclude Include="..\..\guiengine\widgets\CGUIEditBox.h" /> <ClInclude Include="..\..\guiengine\widgets\CGUIEditBox.h" />
<ClInclude Include="..\..\items\rubber_ball.hpp" /> <ClInclude Include="..\..\items\rubber_ball.hpp" />
<ClInclude Include="..\..\items\swatter.hpp" /> <ClInclude Include="..\..\items\swatter.hpp" />
<ClInclude Include="..\..\karts\kart_with_stats.hpp" />
<ClInclude Include="..\..\main_loop.hpp" /> <ClInclude Include="..\..\main_loop.hpp" />
<ClInclude Include="..\..\guiengine\abstract_state_manager.hpp" /> <ClInclude Include="..\..\guiengine\abstract_state_manager.hpp" />
<ClInclude Include="..\..\guiengine\abstract_top_level_container.hpp" /> <ClInclude Include="..\..\guiengine\abstract_top_level_container.hpp" />
@ -397,6 +400,7 @@
<ClInclude Include="..\..\tinygettext\po_parser.hpp" /> <ClInclude Include="..\..\tinygettext\po_parser.hpp" />
<ClInclude Include="..\..\tinygettext\stk_file_system.hpp" /> <ClInclude Include="..\..\tinygettext\stk_file_system.hpp" />
<ClInclude Include="..\..\tinygettext\tinygettext.hpp" /> <ClInclude Include="..\..\tinygettext\tinygettext.hpp" />
<ClInclude Include="..\..\tracks\track_sector.hpp" />
<ClInclude Include="..\..\utils\constants.hpp" /> <ClInclude Include="..\..\utils\constants.hpp" />
<ClInclude Include="..\..\utils\no_copy.hpp" /> <ClInclude Include="..\..\utils\no_copy.hpp" />
<ClInclude Include="..\..\utils\profiler.hpp" /> <ClInclude Include="..\..\utils\profiler.hpp" />

View File

@ -792,6 +792,12 @@
<ClCompile Include="..\..\graphics\post_processing.cpp"> <ClCompile Include="..\..\graphics\post_processing.cpp">
<Filter>Quelldateien\graphics</Filter> <Filter>Quelldateien\graphics</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\karts\kart_with_stats.cpp">
<Filter>Quelldateien\karts</Filter>
</ClCompile>
<ClCompile Include="..\..\tracks\track_sector.cpp">
<Filter>Quelldateien\tracks</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\..\main_loop.hpp"> <ClInclude Include="..\..\main_loop.hpp">
@ -1502,5 +1508,11 @@
<ClInclude Include="..\..\graphics\post_processing.hpp"> <ClInclude Include="..\..\graphics\post_processing.hpp">
<Filter>Headerdateien\graphics</Filter> <Filter>Headerdateien\graphics</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\karts\kart_with_stats.hpp">
<Filter>Headerdateien\karts</Filter>
</ClInclude>
<ClInclude Include="..\..\tracks\track_sector.hpp">
<Filter>Headerdateien\tracks</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -235,7 +235,7 @@ public:
void adjustSpeed (float f); void adjustSpeed (float f);
void capSpeed (float max_speed); void capSpeed (float max_speed);
void updatedWeight (); void updatedWeight ();
void collectedItem (Item *item, int random_attachment); virtual void collectedItem (Item *item, int random_attachment);
virtual void reset (); virtual void reset ();
void handleZipper (const Material *m=NULL, bool play_sound=false); void handleZipper (const Material *m=NULL, bool play_sound=false);
void setSquash (float time, float slowdown); void setSquash (float time, float slowdown);

View File

@ -19,6 +19,8 @@
#include "karts/kart_with_stats.hpp" #include "karts/kart_with_stats.hpp"
#include "items/item.hpp"
KartWithStats::KartWithStats(const std::string& ident, Track* track, KartWithStats::KartWithStats(const std::string& ident, Track* track,
int position, bool is_first_kart, int position, bool is_first_kart,
const btTransform& init_transform, const btTransform& init_transform,
@ -34,12 +36,17 @@ KartWithStats::KartWithStats(const std::string& ident, Track* track,
*/ */
void KartWithStats::reset() void KartWithStats::reset()
{ {
m_top_speed = 0.0f; m_top_speed = 0.0f;
m_explosion_time = 0.0f; m_explosion_time = 0.0f;
m_explosion_count = 0; m_explosion_count = 0;
m_skidding_time = 0.0f; m_skidding_time = 0.0f;
m_rescue_count = 0; m_rescue_count = 0;
m_rescue_time = 0.0f; m_rescue_time = 0.0f;
m_bonus_count = 0;
m_banana_count = 0;
m_small_nitro_count = 0;
m_large_nitro_count = 0;
m_bubblegum_count = 0;
} // reset } // reset
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -97,3 +104,38 @@ void KartWithStats::forceRescue(bool is_auto_rescue)
} // forceRescue } // forceRescue
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
/** Called when an item is collected. It will increment private variables that
* represent counters for each type of item hit.
* \param item The item that was hit.
* \param add_info Additional info, used in networking games to force
* a specific item to be used (instead of a random item) to keep
* all karts in synch.
*/
void KartWithStats::collectedItem(Item *item, int add_info)
{
Kart::collectedItem(item, add_info);
const Item::ItemType type = item->getType();
switch (type)
{
case Item::ITEM_BANANA:
m_banana_count++;
break;
case Item::ITEM_NITRO_SMALL:
m_small_nitro_count++;
break;
case Item::ITEM_NITRO_BIG:
m_large_nitro_count++;
break;
case Item::ITEM_BONUS_BOX:
m_bonus_count++;
break;
case Item::ITEM_BUBBLEGUM:
m_bubblegum_count++;
break;
default : break;
} // switch TYPE
} // collectedItem
//-----------------------------------------------------------------------------

View File

@ -44,6 +44,21 @@ private:
/** How often a kart was rescued. */ /** How often a kart was rescued. */
unsigned int m_rescue_count; unsigned int m_rescue_count;
/** How many bonuses were taken */
unsigned int m_bonus_count;
/** How many bananas were taken */
unsigned int m_banana_count;
/** How many small nitro tanks were taken */
unsigned int m_small_nitro_count;
/** How many large nitro tanks were taken */
unsigned int m_large_nitro_count;
/** How many bubblegums were taken */
unsigned int m_bubblegum_count;
/** How much time was spent in rescue. */ /** How much time was spent in rescue. */
float m_rescue_time; float m_rescue_time;
@ -59,6 +74,7 @@ public:
virtual void reset(); virtual void reset();
virtual void handleExplosion(const Vec3& pos, bool direct_hit); virtual void handleExplosion(const Vec3& pos, bool direct_hit);
virtual void forceRescue(bool is_auto_rescue=false); virtual void forceRescue(bool is_auto_rescue=false);
virtual void collectedItem(Item *item, int add_info);
/** Returns the top speed of this kart. */ /** Returns the top speed of this kart. */
float getTopSpeed() const { return m_top_speed; } float getTopSpeed() const { return m_top_speed; }
@ -75,6 +91,21 @@ public:
/** Returns how often a kart was rescued. */ /** Returns how often a kart was rescued. */
unsigned int getRescueCount() const { return m_rescue_count; } unsigned int getRescueCount() const { return m_rescue_count; }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
/** Returns the number of bonuses that were taken */
unsigned int getBonusCount() const { return m_bonus_count; }
// ------------------------------------------------------------------------
/** Returns the number of bananas that were taken */
unsigned int getBananaCount() const { return m_banana_count; }
// ------------------------------------------------------------------------
/** Returns the number of small nitro tanks that were taken */
unsigned int getSmallNitroCount() const { return m_small_nitro_count; }
// ------------------------------------------------------------------------
/** Returns the number of large nitro tanks that were taken */
unsigned int getLargeNitroCount() const { return m_large_nitro_count; }
// ------------------------------------------------------------------------
/** Returns the number of bubblegums that were taken */
unsigned int getBubblegumCount() const { return m_bubblegum_count; }
// ------------------------------------------------------------------------
/** Returns how long a kart was rescued all in all. */ /** Returns how long a kart was rescued all in all. */
float getRescueTime() const { return m_rescue_time; } float getRescueTime() const { return m_rescue_time; }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------

View File

@ -239,7 +239,7 @@ void cmdLineHelp (char* invocation)
" -N, --no-start-screen Immediately start race without showing a menu.\n" " -N, --no-start-screen Immediately start race without showing a menu.\n"
" -R, --race-now Same as -N but also skip the ready-set-go phase and the music.\n" " -R, --race-now Same as -N but also skip the ready-set-go phase and the music.\n"
" -t, --track NAME Start at track NAME (see --list-tracks).\n" " -t, --track NAME Start at track NAME (see --list-tracks).\n"
" --gp name Start the specified Grand Prix.\n" " --gp NAME Start the specified Grand Prix.\n"
" --stk-config FILE use ./data/FILE instead of ./data/stk_config.xml\n" " --stk-config FILE use ./data/FILE instead of ./data/stk_config.xml\n"
" -l, --list-tracks Show available tracks.\n" " -l, --list-tracks Show available tracks.\n"
" -k, --numkarts NUM Number of karts on the racetrack.\n" " -k, --numkarts NUM Number of karts on the racetrack.\n"
@ -249,35 +249,35 @@ void cmdLineHelp (char* invocation)
" --laps N Define number of laps to N.\n" " --laps N Define number of laps to N.\n"
" --mode N N=1 novice, N=2 driver, N=3 racer.\n" " --mode N N=1 novice, N=2 driver, N=3 racer.\n"
// TODO: add back "--players" switch // TODO: add back "--players" switch
//" --players n Define number of players to between 1 and 4.\n" // " --players n Define number of players to between 1 and 4.\n"
" --item STYLE Use STYLE as your item style.\n" " --item STYLE Use STYLE as your item style.\n"
" -f, --fullscreen Select fullscreen display.\n" " -f, --fullscreen Select fullscreen display.\n"
" -w, --windowed Windowed display (default).\n" " -w, --windowed Windowed display (default).\n"
" -s, --screensize WxH Set the screen size (e.g. 320x200).\n" " -s, --screensize WxH Set the screen size (e.g. 320x200).\n"
" -v, --version Show version of SuperTuxKart.\n" " -v, --version Show version of SuperTuxKart.\n"
" --trackdir DIR A directory from which additional tracks are loaded.\n" " --trackdir DIR A directory from which additional tracks are loaded.\n"
" --renderer NUM Choose the renderer. Valid renderers are:" " --renderer NUM Choose the renderer. Valid renderers are:\n"
" (Default: 0, OpenGL: 1, Direct3D9: 2, \n" " Default: 0, OpenGL: 1, Direct3D9: 2, \n"
" Direct3D8: 3, Software: 4, \n" " Direct3D8: 3, Software: 4, \n"
" Burning's Software: 5, Null device: 6).\n" " Burning's Software: 5, Null device: 6\n"
" --animations=n Play karts' animations (All: 2, Humans only: 1, Nobody: 0).\n" " --animations=n Play karts' animations (All: 2, Humans only: 1, Nobody: 0).\n"
" --gfx=n Play other graphical effects like impact stars dance,\n" " --gfx=n Play other graphical effects like impact stars dance,\n"
" water animations or explosions (Enable: 1, Disable: 0).\n" " water animations or explosions (Enable: 1, Disable: 0).\n"
" --weather=n Show weather effects like rain or snow (0 or 1 as --gfx).\n" " --weather=n Show weather effects like rain or snow (0 or 1 as --gfx).\n"
" --camera-style=n Flexible (0) or hard like v0.6 (1) kart-camera link.\n" " --camera-style=n Flexible (0) or hard like v0.6 (1) kart-camera link.\n"
" --profile-laps=n Enable automatic driven profile mode for n laps.\n" " --profile-laps=n Enable automatic driven profile mode for n laps.\n"
" --profile-time=n Enable automatic driven profile mode for n seconds.\n" " --profile-time=n Enable automatic driven profile mode for n seconds.\n"
" --no-graphics Do not display the actual race.\n" " --no-graphics Do not display the actual race.\n"
// " --history Replay history file 'history.dat'.\n" // " --history Replay history file 'history.dat'.\n"
// " --history=n Replay history file 'history.dat' using mode:\n" // " --history=n Replay history file 'history.dat' using mode:\n"
// " n=1: use recorded positions\n" // " n=1: use recorded positions\n"
// " n=2: use recorded key strokes\n" // " n=2: use recorded key strokes\n"
" --server[=port] This is the server (running on the specified port).\n" " --server[=port] This is the server (running on the specified port).\n"
" --client=ip This is a client, connect to the specified ip address.\n" " --client=ip This is a client, connect to the specified ip address.\n"
" --port=n Port number to use.\n" " --port=n Port number to use.\n"
" --numclients=n Number of clients to wait for (server only).\n" " --numclients=n Number of clients to wait for (server only).\n"
" --log=terminal Write messages to screen.\n" " --log=terminal Write messages to screen.\n"
" --log=file Write messages/warning to log files stdout.log/stderr.log.\n" " --log=file Write messages/warning to log files stdout.log/stderr.log.\n"
" -h, --help Show this help.\n" " -h, --help Show this help.\n"
"\n" "\n"
"You can visit SuperTuxKart's homepage at " "You can visit SuperTuxKart's homepage at "
@ -348,6 +348,10 @@ int handleCmdLinePreliminary(int argc, char **argv)
KartPropertiesManager::addKartSearchDir(argv[i+1]); KartPropertiesManager::addKartSearchDir(argv[i+1]);
i++; i++;
} }
else if( !strcmp(argv[i], "--no-graphics") )
{
ProfileWorld::disableGraphics();
}
#if !defined(WIN32) && !defined(__CYGWIN) #if !defined(WIN32) && !defined(__CYGWIN)
else if ( !strcmp(argv[i], "--fullscreen") || !strcmp(argv[i], "-f")) else if ( !strcmp(argv[i], "--fullscreen") || !strcmp(argv[i], "-f"))
{ {
@ -648,7 +652,7 @@ int handleCmdLine(int argc, char **argv)
const Track *track = track_manager->getTrack(i); const Track *track = track_manager->getTrack(i);
if (!unlock_manager->isLocked(track->getIdent())) if (!unlock_manager->isLocked(track->getIdent()))
{ {
fprintf ( stdout, "\t%10s: %ls\n", fprintf ( stdout, "\t%14s: %ls\n",
track->getIdent().c_str(), track->getIdent().c_str(),
track->getName()); track->getName());
} }
@ -709,7 +713,12 @@ int handleCmdLine(int argc, char **argv)
} }
else if( !strcmp(argv[i], "--no-graphics") ) else if( !strcmp(argv[i], "--no-graphics") )
{ {
ProfileWorld::disableGraphics(); // Set default profile mode of 1 lap if we haven't already set one
if (!ProfileWorld::isProfileMode()) {
UserConfigParams::m_no_start_screen = true;
ProfileWorld::setProfileModeLaps(1);
race_manager->setNumLaps(1);
}
} }
else if( sscanf(argv[i], "--history=%d", &n)==1) else if( sscanf(argv[i], "--history=%d", &n)==1)
{ {

View File

@ -178,9 +178,12 @@ void ProfileWorld::enterRaceOverState()
m_karts[i]->finishedRace(estimateFinishTimeForKart(m_karts[i])); m_karts[i]->finishedRace(estimateFinishTimeForKart(m_karts[i]));
} }
// Print framerate statistics
float runtime = (irr_driver->getRealTime()-m_start_time)*0.001f; float runtime = (irr_driver->getRealTime()-m_start_time)*0.001f;
printf("Number of frames: %d time %f, Average FPS: %f\n", printf("Number of frames: %d time %f, Average FPS: %f\n",
m_frame_count, runtime, (float)m_frame_count/runtime); m_frame_count, runtime, (float)m_frame_count/runtime);
// Print geometry statistics if we're not in no-graphics mode
if(!m_no_graphics) if(!m_no_graphics)
{ {
printf("Average # drawn nodes %f k\n", printf("Average # drawn nodes %f k\n",
@ -195,45 +198,48 @@ void ProfileWorld::enterRaceOverState()
(float)m_num_trans_effect/m_frame_count); (float)m_num_trans_effect/m_frame_count);
} }
// Print race statistics for each individual kart
float min_t=999999.9f, max_t=0.0, av_t=0.0; float min_t=999999.9f, max_t=0.0, av_t=0.0;
printf("Name\t\tstart\tend\ttime\t"); printf("name,start_position,end_position,time,");
if(m_profile_mode==PROFILE_LAPS)
printf("aver.\t"); if (m_profile_mode==PROFILE_LAPS) {
printf("top\tskid\trescue\trescue\t" printf("average_speed,");
"expl.\texpl.\n"); }
printf("\t\t\t\t\t");
if(m_profile_mode==PROFILE_LAPS) printf("top_speed,skid_time,rescue_time,rescue_count,explosion_time,explosion_count,bonus_count,banana_count,small_nitro_count,large_nitro_count,bubblegum_count\n");
printf("speed\t");
printf("speed\ttime\ttime\tcount\ttime\tcount\n");
for ( KartList::size_type i = 0; i < m_karts.size(); ++i) for ( KartList::size_type i = 0; i < m_karts.size(); ++i)
{ {
max_t = std::max(max_t, m_karts[i]->getFinishTime()); KartWithStats* kart = dynamic_cast<KartWithStats*>(m_karts[i]);
min_t = std::min(min_t, m_karts[i]->getFinishTime());
av_t += m_karts[i]->getFinishTime(); max_t = std::max(max_t, kart->getFinishTime());
printf("%s\t%s", m_karts[i]->getIdent().c_str(), min_t = std::min(min_t, kart->getFinishTime());
m_karts[i]->getIdent().size()<8 ? "\t" : ""); av_t += kart->getFinishTime();
printf("%d\t%d\t", 1 + (int)i, m_karts[i]->getPosition()); printf("%s,", kart->getIdent().c_str());
printf("%4.2f\t", m_karts[i]->getFinishTime()); printf("%d,", 1 + (int)i);
printf("%d,", kart->getPosition());
printf("%4.2f,", kart->getFinishTime());
if(m_profile_mode==PROFILE_LAPS) if(m_profile_mode==PROFILE_LAPS)
{ {
float distance = race_manager->getNumLaps() float distance = race_manager->getNumLaps()
* m_track->getTrackLength(); * m_track->getTrackLength();
printf("%4.2f\t",distance/m_karts[i]->getFinishTime()); printf("%4.2f,", distance/kart->getFinishTime());
} }
printf("%3.2f\t", dynamic_cast<KartWithStats*> printf("%3.2f,", kart->getTopSpeed());
(m_karts[i])->getTopSpeed()); printf("%4.2f,", kart->getSkiddingTime());
printf("%4.2f\t", dynamic_cast<KartWithStats*> printf("%4.2f,%d,", kart->getRescueTime(),
(m_karts[i])->getSkiddingTime()); kart->getRescueCount());
printf("%4.2f\t%d\t", dynamic_cast<KartWithStats*> printf("%4.2f,%d,", kart->getExplosionTime(),
(m_karts[i])->getRescueTime(), kart->getExplosionCount() );
dynamic_cast<KartWithStats*> printf("%d,", kart->getBonusCount() );
(m_karts[i])->getRescueCount()); printf("%d,", kart->getBananaCount() );
printf("%4.2f\t%d\t", dynamic_cast<KartWithStats*> printf("%d,", kart->getSmallNitroCount() );
(m_karts[i])->getExplosionTime(), printf("%d,", kart->getLargeNitroCount() );
dynamic_cast<KartWithStats*> printf("%d", kart->getBubblegumCount() );
(m_karts[i])->getExplosionCount() );
printf("\n"); printf("\n");
} }
// Print group statistics of all karts
printf("min %f max %f av %f\n",min_t, max_t, av_t/m_karts.size()); printf("min %f max %f av %f\n",min_t, max_t, av_t/m_karts.size());
std::exit(-2); std::exit(-2);