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:
parent
8a9bdc1505
commit
2172f1c4df
@ -36,6 +36,7 @@
|
||||
#include "items/projectile_manager.hpp"
|
||||
#include "karts/kart_properties_manager.hpp"
|
||||
#include "main_loop.hpp"
|
||||
#include "modes/profile_world.hpp"
|
||||
#include "modes/world.hpp"
|
||||
#include "states_screens/dialogs/confirm_resolution_dialog.hpp"
|
||||
#include "states_screens/state_manager.hpp"
|
||||
@ -83,139 +84,147 @@ IrrDriver::~IrrDriver()
|
||||
|
||||
void IrrDriver::initDevice()
|
||||
{
|
||||
static bool firstTime = true;
|
||||
|
||||
// ---- the first time, get a list of available video modes
|
||||
if (firstTime)
|
||||
{
|
||||
// If --no-graphics option was used, just create a device with NULL renderer
|
||||
if (ProfileWorld::isNoGraphics())
|
||||
{
|
||||
m_device = createDevice(video::EDT_NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
static bool firstTime = true;
|
||||
|
||||
// ---- the first time, get a list of available video modes
|
||||
if (firstTime)
|
||||
{
|
||||
m_device = createDevice(video::EDT_NULL);
|
||||
|
||||
video::IVideoModeList* modes = m_device->getVideoModeList();
|
||||
const int count = modes->getVideoModeCount();
|
||||
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)
|
||||
for(int i=0; i<count; i++)
|
||||
{
|
||||
const int w = modes->getVideoModeResolution(i).Width;
|
||||
const int h = modes->getVideoModeResolution(i).Height;
|
||||
if (h < MIN_SUPPORTED_HEIGHT || w < MIN_SUPPORTED_WIDTH)
|
||||
continue;
|
||||
// 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 );
|
||||
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");
|
||||
}
|
||||
// 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();
|
||||
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
|
||||
firstTime = false;
|
||||
} // end if firstTime
|
||||
|
||||
|
||||
int numDrivers = 5;
|
||||
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;
|
||||
}
|
||||
|
||||
// ---- open device
|
||||
// Try different drivers: start with opengl, then DirectX
|
||||
for(int driver_type=0; driver_type<numDrivers; driver_type++)
|
||||
{
|
||||
|
||||
video::E_DRIVER_TYPE type;
|
||||
|
||||
// Test if user has chosen a driver or if we should try all to find a
|
||||
// woring one.
|
||||
// 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 );
|
||||
numDrivers = 1;
|
||||
}
|
||||
|
||||
// Try 32 and, upon failure, 24 then 16 bit per pixels
|
||||
for (int bits=32; bits>15; bits -=8)
|
||||
// ---- open device
|
||||
// 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);
|
||||
/*
|
||||
m_device = createDevice(type,
|
||||
|
||||
video::E_DRIVER_TYPE 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,
|
||||
UserConfigParams::m_height ),
|
||||
bits, //bits per pixel
|
||||
32, //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,
|
||||
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");
|
||||
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);
|
||||
}
|
||||
|
||||
m_device->setResizable(false);
|
||||
|
||||
if (!UserConfigParams::m_fbo)
|
||||
{
|
||||
m_device->getVideoDriver()->disableFeature(EVDF_FRAMEBUFFER_OBJECT);
|
||||
m_scene_manager = m_device->getSceneManager();
|
||||
m_gui_env = m_device->getGUIEnvironment();
|
||||
m_video_driver = m_device->getVideoDriver();
|
||||
|
||||
// Only change video driver settings if we are showing graphics
|
||||
if (!ProfileWorld::isNoGraphics()) {
|
||||
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.
|
||||
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
|
||||
video::SMaterial& material2D = m_video_driver->getMaterial2D();
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -235,7 +235,7 @@ public:
|
||||
void adjustSpeed (float f);
|
||||
void capSpeed (float max_speed);
|
||||
void updatedWeight ();
|
||||
void collectedItem (Item *item, int random_attachment);
|
||||
virtual void collectedItem (Item *item, int random_attachment);
|
||||
virtual void reset ();
|
||||
void handleZipper (const Material *m=NULL, bool play_sound=false);
|
||||
void setSquash (float time, float slowdown);
|
||||
|
@ -19,6 +19,8 @@
|
||||
|
||||
#include "karts/kart_with_stats.hpp"
|
||||
|
||||
#include "items/item.hpp"
|
||||
|
||||
KartWithStats::KartWithStats(const std::string& ident, Track* track,
|
||||
int position, bool is_first_kart,
|
||||
const btTransform& init_transform,
|
||||
@ -34,12 +36,17 @@ KartWithStats::KartWithStats(const std::string& ident, Track* track,
|
||||
*/
|
||||
void KartWithStats::reset()
|
||||
{
|
||||
m_top_speed = 0.0f;
|
||||
m_explosion_time = 0.0f;
|
||||
m_explosion_count = 0;
|
||||
m_skidding_time = 0.0f;
|
||||
m_rescue_count = 0;
|
||||
m_rescue_time = 0.0f;
|
||||
m_top_speed = 0.0f;
|
||||
m_explosion_time = 0.0f;
|
||||
m_explosion_count = 0;
|
||||
m_skidding_time = 0.0f;
|
||||
m_rescue_count = 0;
|
||||
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
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -97,3 +104,38 @@ void KartWithStats::forceRescue(bool is_auto_rescue)
|
||||
} // 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
|
||||
|
||||
//-----------------------------------------------------------------------------
|
@ -44,6 +44,21 @@ private:
|
||||
/** How often a kart was rescued. */
|
||||
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. */
|
||||
float m_rescue_time;
|
||||
|
||||
@ -59,6 +74,7 @@ public:
|
||||
virtual void reset();
|
||||
virtual void handleExplosion(const Vec3& pos, bool direct_hit);
|
||||
virtual void forceRescue(bool is_auto_rescue=false);
|
||||
virtual void collectedItem(Item *item, int add_info);
|
||||
|
||||
/** Returns the top speed of this kart. */
|
||||
float getTopSpeed() const { return m_top_speed; }
|
||||
@ -75,6 +91,21 @@ public:
|
||||
/** Returns how often a kart was rescued. */
|
||||
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. */
|
||||
float getRescueTime() const { return m_rescue_time; }
|
||||
// ------------------------------------------------------------------------
|
||||
|
63
src/main.cpp
63
src/main.cpp
@ -239,7 +239,7 @@ void cmdLineHelp (char* invocation)
|
||||
" -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"
|
||||
" -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"
|
||||
" -l, --list-tracks Show available tracks.\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"
|
||||
" --mode N N=1 novice, N=2 driver, N=3 racer.\n"
|
||||
// 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"
|
||||
" -f, --fullscreen Select fullscreen display.\n"
|
||||
" -w, --windowed Windowed display (default).\n"
|
||||
" -s, --screensize WxH Set the screen size (e.g. 320x200).\n"
|
||||
" -v, --version Show version of SuperTuxKart.\n"
|
||||
" --trackdir DIR A directory from which additional tracks are loaded.\n"
|
||||
" --renderer NUM Choose the renderer. Valid renderers are:"
|
||||
" (Default: 0, OpenGL: 1, Direct3D9: 2, \n"
|
||||
" Direct3D8: 3, Software: 4, \n"
|
||||
" Burning's Software: 5, Null device: 6).\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"
|
||||
" water animations or explosions (Enable: 1, Disable: 0).\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"
|
||||
" --profile-laps=n Enable automatic driven profile mode for n laps.\n"
|
||||
" --profile-time=n Enable automatic driven profile mode for n seconds.\n"
|
||||
" --no-graphics Do not display the actual race.\n"
|
||||
// " --history Replay history file 'history.dat'.\n"
|
||||
// " --history=n Replay history file 'history.dat' using mode:\n"
|
||||
// " n=1: use recorded positions\n"
|
||||
// " n=2: use recorded key strokes\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"
|
||||
" --port=n Port number to use.\n"
|
||||
" --numclients=n Number of clients to wait for (server only).\n"
|
||||
" --log=terminal Write messages to screen.\n"
|
||||
" --log=file Write messages/warning to log files stdout.log/stderr.log.\n"
|
||||
" --trackdir DIR A directory from which additional tracks are loaded.\n"
|
||||
" --renderer NUM Choose the renderer. Valid renderers are:\n"
|
||||
" Default: 0, OpenGL: 1, Direct3D9: 2, \n"
|
||||
" Direct3D8: 3, Software: 4, \n"
|
||||
" Burning's Software: 5, Null device: 6\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"
|
||||
" water animations or explosions (Enable: 1, Disable: 0).\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"
|
||||
" --profile-laps=n Enable automatic driven profile mode for n laps.\n"
|
||||
" --profile-time=n Enable automatic driven profile mode for n seconds.\n"
|
||||
" --no-graphics Do not display the actual race.\n"
|
||||
// " --history Replay history file 'history.dat'.\n"
|
||||
// " --history=n Replay history file 'history.dat' using mode:\n"
|
||||
// " n=1: use recorded positions\n"
|
||||
// " n=2: use recorded key strokes\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"
|
||||
" --port=n Port number to use.\n"
|
||||
" --numclients=n Number of clients to wait for (server only).\n"
|
||||
" --log=terminal Write messages to screen.\n"
|
||||
" --log=file Write messages/warning to log files stdout.log/stderr.log.\n"
|
||||
" -h, --help Show this help.\n"
|
||||
"\n"
|
||||
"You can visit SuperTuxKart's homepage at "
|
||||
@ -348,6 +348,10 @@ int handleCmdLinePreliminary(int argc, char **argv)
|
||||
KartPropertiesManager::addKartSearchDir(argv[i+1]);
|
||||
i++;
|
||||
}
|
||||
else if( !strcmp(argv[i], "--no-graphics") )
|
||||
{
|
||||
ProfileWorld::disableGraphics();
|
||||
}
|
||||
#if !defined(WIN32) && !defined(__CYGWIN)
|
||||
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);
|
||||
if (!unlock_manager->isLocked(track->getIdent()))
|
||||
{
|
||||
fprintf ( stdout, "\t%10s: %ls\n",
|
||||
fprintf ( stdout, "\t%14s: %ls\n",
|
||||
track->getIdent().c_str(),
|
||||
track->getName());
|
||||
}
|
||||
@ -709,7 +713,12 @@ int handleCmdLine(int argc, char **argv)
|
||||
}
|
||||
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)
|
||||
{
|
||||
|
@ -178,9 +178,12 @@ void ProfileWorld::enterRaceOverState()
|
||||
m_karts[i]->finishedRace(estimateFinishTimeForKart(m_karts[i]));
|
||||
}
|
||||
|
||||
// Print framerate statistics
|
||||
float runtime = (irr_driver->getRealTime()-m_start_time)*0.001f;
|
||||
printf("Number of frames: %d time %f, Average FPS: %f\n",
|
||||
m_frame_count, runtime, (float)m_frame_count/runtime);
|
||||
|
||||
// Print geometry statistics if we're not in no-graphics mode
|
||||
if(!m_no_graphics)
|
||||
{
|
||||
printf("Average # drawn nodes %f k\n",
|
||||
@ -195,45 +198,48 @@ void ProfileWorld::enterRaceOverState()
|
||||
(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;
|
||||
printf("Name\t\tstart\tend\ttime\t");
|
||||
if(m_profile_mode==PROFILE_LAPS)
|
||||
printf("aver.\t");
|
||||
printf("top\tskid\trescue\trescue\t"
|
||||
"expl.\texpl.\n");
|
||||
printf("\t\t\t\t\t");
|
||||
if(m_profile_mode==PROFILE_LAPS)
|
||||
printf("speed\t");
|
||||
printf("speed\ttime\ttime\tcount\ttime\tcount\n");
|
||||
printf("name,start_position,end_position,time,");
|
||||
|
||||
if (m_profile_mode==PROFILE_LAPS) {
|
||||
printf("average_speed,");
|
||||
}
|
||||
|
||||
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");
|
||||
|
||||
for ( KartList::size_type i = 0; i < m_karts.size(); ++i)
|
||||
{
|
||||
max_t = std::max(max_t, m_karts[i]->getFinishTime());
|
||||
min_t = std::min(min_t, m_karts[i]->getFinishTime());
|
||||
av_t += m_karts[i]->getFinishTime();
|
||||
printf("%s\t%s", m_karts[i]->getIdent().c_str(),
|
||||
m_karts[i]->getIdent().size()<8 ? "\t" : "");
|
||||
printf("%d\t%d\t", 1 + (int)i, m_karts[i]->getPosition());
|
||||
printf("%4.2f\t", m_karts[i]->getFinishTime());
|
||||
KartWithStats* kart = dynamic_cast<KartWithStats*>(m_karts[i]);
|
||||
|
||||
max_t = std::max(max_t, kart->getFinishTime());
|
||||
min_t = std::min(min_t, kart->getFinishTime());
|
||||
av_t += kart->getFinishTime();
|
||||
printf("%s,", kart->getIdent().c_str());
|
||||
printf("%d,", 1 + (int)i);
|
||||
printf("%d,", kart->getPosition());
|
||||
printf("%4.2f,", kart->getFinishTime());
|
||||
if(m_profile_mode==PROFILE_LAPS)
|
||||
{
|
||||
float distance = race_manager->getNumLaps()
|
||||
* 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*>
|
||||
(m_karts[i])->getTopSpeed());
|
||||
printf("%4.2f\t", dynamic_cast<KartWithStats*>
|
||||
(m_karts[i])->getSkiddingTime());
|
||||
printf("%4.2f\t%d\t", dynamic_cast<KartWithStats*>
|
||||
(m_karts[i])->getRescueTime(),
|
||||
dynamic_cast<KartWithStats*>
|
||||
(m_karts[i])->getRescueCount());
|
||||
printf("%4.2f\t%d\t", dynamic_cast<KartWithStats*>
|
||||
(m_karts[i])->getExplosionTime(),
|
||||
dynamic_cast<KartWithStats*>
|
||||
(m_karts[i])->getExplosionCount() );
|
||||
printf("%3.2f,", kart->getTopSpeed());
|
||||
printf("%4.2f,", kart->getSkiddingTime());
|
||||
printf("%4.2f,%d,", kart->getRescueTime(),
|
||||
kart->getRescueCount());
|
||||
printf("%4.2f,%d,", kart->getExplosionTime(),
|
||||
kart->getExplosionCount() );
|
||||
printf("%d,", kart->getBonusCount() );
|
||||
printf("%d,", kart->getBananaCount() );
|
||||
printf("%d,", kart->getSmallNitroCount() );
|
||||
printf("%d,", kart->getLargeNitroCount() );
|
||||
printf("%d", kart->getBubblegumCount() );
|
||||
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());
|
||||
|
||||
std::exit(-2);
|
||||
|
Loading…
Reference in New Issue
Block a user