Merge branch 'master' of github.com:supertuxkart/stk-code

This commit is contained in:
hiker 2015-01-08 13:33:16 +11:00
commit b0879514fb
19 changed files with 231 additions and 168 deletions

View File

@ -24,5 +24,7 @@
<string>0.8.1</string>
<key>CSResourcesFileMapped</key>
<true/>
<key>LSMinimumSystemVersion</key>
<string>10.9</string>
</dict>
</plist>

View File

@ -1,9 +1,13 @@
<?xml version="1.0"?>
<graphical-restrictions>
<card is="Intel(R) HD Graphics 3000" os="windows" version="<9.17.11" disable="a b c"/>
<card is="Intel(R) HD Graphics 3000" os="windows" disable="UniformBufferObject"/>
<card contains="Intel" disable="TextureCompressionS3TC"/>
<card contains="NVIDIA" os="windows" version="<344.65" disable="BufferStorage"/>
<card contains="NVIDIA" os="linux" version="<343.22" disable="BufferStorage"/>
<card contains="Mesa" os="linux" version="<10.3" disable="BufferStorage"/>
<card contains="NVIDIA" os="linux" version="<343.22" disable="BufferStorage"/>
<card contains="NVIDIA" disable="ShaderAtomicCounters"/>
<card contains="Mesa" os="linux" version="<10.3" disable="BufferStorage"/>
<card contains="Mesa" os="linux" version="<10.6" disable="GeometryShader4"/>
<card is="Intel(R) HD Graphics 3000" os="osx" version="<=9.17.10" disable="a b c"/>
<card is="" os="bsd" version="<1.2.3" disable="a b c"/>

View File

@ -12,7 +12,7 @@
<spacer height="20" width="20" />
<button id="accept" I18N="In the 'add new grand prix' dialog" text="Create" align="center" proportion="1"/>
<button id="accept" I18N="In the 'add new grand prix' dialog" text="OK" align="center" proportion="1"/>
<spacer height="15" width="20" />
<button id="cancel" I18N="In the 'add new grand prix' dialog" text="Cancel" align="center" proportion="1"/>

View File

@ -8,7 +8,7 @@
<spacer width="1" height="5%"/>
<box width="95%" height="40%" padding="10" layout="horizontal-row">
<box width="100%" height="40%" padding="10" layout="horizontal-row">
<spacer width="10" height="100%"/>
<!-- Left pane -->
<div width="45%" height="100%" align="center" layout="vertical-row">
@ -24,37 +24,32 @@
</box>
<spacer width="1" height="5%"/>
<box width="95%" height="25%" padding="10" layout="horizontal-row">
<spacer width="1" height="5%"/>
<div width="50%" height="100%" layout="vertical-row">
<div width="100%" height="20%" layout="horizontal-row" >
<label id="ai-text" height="100%" width="50%" I18N="In the grand prix info screen" text="AI karts"/>
<spinner id="ai-spinner" width="50%" min_value="1" max_value="20" align="center"
wrap_around="true" />
</div>
<spacer height="5%" />
<div width="100%" height="20%" layout="horizontal-row" >
<label id="reverse-text" width="50%" height="100%" I18N="In the grand prix info screen" text="Reverse"/>
<spinner id="reverse-spinner" width="50%" align="center" wrap_around="true" />
</div>
<spacer height="5%" />
<div width="100%" height="20%" layout="horizontal-row">
<label id="track-text" width="50%" height="100%" text="Tracks"
I18N="In the grand prix info screen"/>
<spinner id="track-spinner" width="50%" min_value="1" max_value="20" align="center"
wrap_around="true" />
<spacer height="1%" />
</div>
<spacer height="5%" />
<div width="100%" height="20%" layout="horizontal-row" >
<label id="group-text" width="50%" height="100%" I18N="In the grand prix info screen" text="Track group"/>
<spinner id="group-spinner" width="50%" align="center" wrap_around="true" />
<spacer proportion="1" height="2" />
</div>
<box width="100%" height="28%" padding="20" layout="vertical-row">
<div width="100%" height="20%" layout="horizontal-row" >
<label id="ai-text" width="50%" I18N="In the grand prix info screen" text="AI karts" text_align="right"/>
<spacer width="30"/>
<spinner id="ai-spinner" width="30%" min_value="1" max_value="20" align="center" wrap_around="true" />
</div>
<spacer height="5%" />
<div width="100%" height="20%" layout="horizontal-row" >
<label id="reverse-text" width="50%" I18N="In the grand prix info screen" text="Reverse" text_align="right"/>
<spacer width="30"/>
<spinner id="reverse-spinner" width="30%" align="center" wrap_around="true" />
</div>
<spacer height="5%" />
<div width="100%" height="20%" layout="horizontal-row">
<label id="track-text" width="50%" I18N="In the grand prix info screen" text="Tracks" text_align="right"/>
<spacer width="30"/>
<spinner id="track-spinner" width="30%" min_value="1" max_value="20" align="center" wrap_around="true" />
</div>
<spacer height="5%" />
<div width="100%" height="20%" layout="horizontal-row" >
<label id="group-text" width="50%" I18N="In the grand prix info screen" text="Track group" text_align="right"/>
<spacer width="30"/>
<spinner id="group-spinner" width="30%" align="center" wrap_around="true" />
</div>
</box>
<spacer width="1" height="5%"/>
<spacer height="2%"/>
<buttonbar id="buttons" height="15%" width="100%" align="center">
<icon-button id="start" width="64" height="64" icon="gui/green_check.png"

View File

@ -5,7 +5,7 @@
<header height="5%" width="80%" text="Race Setup" align="center" text_align="center" />
<spacer height="5%" width="25"/>
<box width="95%" height="40%" padding="10" layout="vertical-row">
<box width="100%" height="40%" padding="10" layout="vertical-row">
<bright width="100%" text="Select a difficulty" align="center" text_align="left" />
<ribbon id="difficulty" height="135" width="100%" align="center">
@ -21,7 +21,7 @@
</box>
<spacer height="5%" width="25"/>
<box width="95%" height="40%" padding="10" layout="vertical-row">
<box width="100%" height="40%" padding="10" layout="vertical-row">
<bright width="100%" text="Select a game mode" align="center" text_align="left" />
<scrollable_toolbar id="gamemode" height="135" width="85%" label_location="bottom" align="center"

View File

@ -7,7 +7,7 @@
<spacer width="1" height="5%"/>
<box width="95%" height="40%" padding="10" layout="horizontal-row">
<box width="100%" height="40%" padding="10" layout="horizontal-row">
<!-- Left pane -->
<div proportion="1" height="100%" layout="vertical-row">
<icon-button proportion="1" width="100%" height="100%" id="screenshot" custom_ratio="1.33333"/>
@ -47,31 +47,33 @@
</box>
<spacer width="1" height="5%"/>
<box width="95%" height="25%" padding="10" layout="vertical-row">
<spacer width="1" height="5%"/>
<div width="75%" height="fit" layout="horizontal-row" >
<spacer width="40" height="2" />
<label id="lap-text" height="100%" width="40%" I18N="In the track info screen" text="Number of laps"/>
<spacer witdh="40" height="2" />
<spinner id="lap-spinner" width="20%" min_value="1" max_value="20" align="center"
wrap_around="true" />
<spacer proportion="1" height="2" />
<box width="100%" height="25%" padding="15" layout="vertical-row">
<div width="100%" height="fit" layout="horizontal-row" >
<label id="lap-text" proportion="1" I18N="In the track info screen" text="Number of laps" text_align="right"/>
<spacer width="40"/>
<div proportion="1" height="fit" layout="horizontal-row">
<spinner id="lap-spinner" width="50%" min_value="1" max_value="20" align="center"
wrap_around="true" />
</div>
</div>
<div width="75%" height="fit" layout="horizontal-row" >
<spacer width="40" height="2" />
<label id="ai-text" height="100%" width="40%" I18N="In the track info screen" text="Number of AI karts"/>
<spacer with="40" height="2" />
<spinner id="ai-spinner" width="20%" min_value="1" max_value="20" align="center"
wrap_around="true" />
<spacer proportion="1" height="2" />
<spacer height="10"/>
<div width="100%" height="fit" layout="horizontal-row" >
<label id="ai-text" proportion="1" I18N="In the track info screen" text="Number of AI karts" text_align="right"/>
<spacer width="40"/>
<div proportion="1" height="fit" layout="horizontal-row">
<spinner id="ai-spinner" width="50%" min_value="1" max_value="20" align="center"
wrap_around="true" />
</div>
</div>
<div width="75%" height="fit" layout="horizontal-row" >
<spacer width="40" height="2" />
<label id="reverse-text" height="100%" width="40%" I18N="In the track info screen" text="Drive in reverse"/>
<spacer width="40" height="2" />
<checkbox id="reverse"/>
<spacer proportion="1" height="2" />
<spacer height="10"/>
<div width="100%" height="fit" layout="horizontal-row" >
<label id="reverse-text" proportion="1" I18N="In the track info screen" text="Drive in reverse" text_align="right"/>
<spacer width="40"/>
<div proportion="1" height="fit" layout="horizontal-row">
<div width="50%" height="fit" text-align="center" layout="vertical-row" >
<checkbox id="reverse" align="center"/>
</div>
</div>
</div>
<spacer width="1" height="2%"/>
</box>

View File

@ -51,8 +51,8 @@ void main(void)
mat4 TransposeInverseModelView = transpose(getInverseWorldMatrix(Origin, Orientation, Scale) * InverseViewMatrix);
gl_Position = ProjectionViewMatrix * ModelMatrix * vec4(Position, 1.);
nor = (TransposeInverseModelView * vec4(Normal, 0.)).xyz;
tangent = (TransposeInverseModelView * vec4(Tangent, 1.)).xyz;
bitangent = (TransposeInverseModelView * vec4(Bitangent, 1.)).xyz;
tangent = (TransposeInverseModelView * vec4(Tangent, 0.)).xyz;
bitangent = (TransposeInverseModelView * vec4(Bitangent, 0.)).xyz;
uv = Texcoord;
uv_bis = SecondTexcoord;
color = Color.zyxw;

View File

@ -48,8 +48,8 @@ void main(void)
mat4 TransposeInverseModelView = transpose(InverseModelMatrix * InverseViewMatrix);
gl_Position = ModelViewProjectionMatrix * vec4(Position, 1.);
nor = (TransposeInverseModelView * vec4(Normal, 0.)).xyz;
tangent = (TransposeInverseModelView * vec4(Tangent, 1.)).xyz;
bitangent = (TransposeInverseModelView * vec4(Bitangent, 1.)).xyz;
tangent = (TransposeInverseModelView * vec4(Tangent, 0.)).xyz;
bitangent = (TransposeInverseModelView * vec4(Bitangent, 0.)).xyz;
uv = (TextureMatrix * vec4(Texcoord, 1., 1.)).xy;
uv_bis = SecondTexcoord;
}

View File

@ -475,9 +475,15 @@ namespace UserConfigParams
&m_video_group, "Enable Exponential Shadow Map (better but slower)"));
// ---- Debug - not saved to config file
/** If gamepad debugging is enabled. */
PARAM_PREFIX bool m_unit_testing PARAM_DEFAULT(false);
/** If gamepad debugging is enabled. */
PARAM_PREFIX bool m_gamepad_debug PARAM_DEFAULT( false );
/** If gamepad debugging is enabled. */
PARAM_PREFIX bool m_keyboard_debug PARAM_DEFAULT(false);
/** Wiimote debugging. */
PARAM_PREFIX bool m_wiimote_debug PARAM_DEFAULT( false );

View File

@ -67,85 +67,78 @@ void CentralVideoSettings::init()
hasBuffserStorage = true;
Log::info("GLDriver", "ARB Buffer Storage Present");
}
if (hasGLExtension("GL_ARB_base_instance")) {
if (!GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_BASE_INSTANCE) &&
hasGLExtension("GL_ARB_base_instance")) {
hasBaseInstance = true;
Log::info("GLDriver", "ARB Base Instance Present");
}
if (hasGLExtension("GL_ARB_draw_indirect")) {
if (!GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_DRAW_INDIRECT) &&
hasGLExtension("GL_ARB_draw_indirect")) {
hasDrawIndirect = true;
Log::info("GLDriver", "ARB Draw Indirect Present");
}
if (hasGLExtension("GL_ARB_compute_shader")) {
if (!GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_COMPUTE_SHADER) &&
hasGLExtension("GL_ARB_compute_shader")) {
hasComputeShaders = true;
Log::info("GLDriver", "ARB Compute Shader Present");
}
if (hasGLExtension("GL_ARB_texture_storage")) {
if (!GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_TEXTURE_STORAGE) &&
hasGLExtension("GL_ARB_texture_storage")) {
hasTextureStorage = true;
Log::info("GLDriver", "ARB Texture Storage Present");
}
if (hasGLExtension("GL_ARB_texture_view")) {
if (!GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_TEXTURE_VIEW) &&
hasGLExtension("GL_ARB_texture_view")) {
hasTextureView = true;
Log::info("GLDriver", "ARB Texture View Present");
}
if (hasGLExtension("GL_ARB_bindless_texture")) {
if (!GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_BINDLESS_TEXTURE) &&
hasGLExtension("GL_ARB_bindless_texture")) {
hasBindlessTexture = true;
Log::info("GLDriver", "ARB Bindless Texture Present");
}
if (hasGLExtension("GL_ARB_shader_image_load_store")) {
if (!GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_IMAGE_LOAD_STORE) &&
hasGLExtension("GL_ARB_shader_image_load_store")) {
hasImageLoadStore = true;
Log::info("GLDriver", "ARB Image Load Store Present");
}
if (hasGLExtension("GL_ARB_shader_atomic_counters")) {
if (!GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_SHADER_ATOMIC_COUNTERS) &&
hasGLExtension("GL_ARB_shader_atomic_counters")) {
hasAtomics = true;
Log::info("GLDriver", "ARB Shader Atomic Counters Present");
}
if (hasGLExtension("GL_ARB_shader_storage_buffer_object")) {
if (!GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_SHADER_STORAGE_BUFFER_OBJECT) &&
hasGLExtension("GL_ARB_shader_storage_buffer_object")) {
hasSSBO = true;
Log::info("GLDriver", "ARB Shader Storage Buffer Object Present");
}
if (hasGLExtension("GL_ARB_multi_draw_indirect")) {
if (!GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_MULTI_DRAW_INDIRECT) &&
hasGLExtension("GL_ARB_multi_draw_indirect")) {
hasMultiDrawIndirect = true;
Log::info("GLDriver", "ARB Multi Draw Indirect Present");
}
if (hasGLExtension("GL_EXT_texture_compression_s3tc")) {
if (!GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_EXT_TEXTURE_COMPRESSION_S3TC) &&
hasGLExtension("GL_EXT_texture_compression_s3tc")) {
hasTextureCompression = true;
Log::info("GLDriver", "EXT Texture Compression S3TC Present");
}
if (hasGLExtension("GL_ARB_uniform_buffer_object")) {
if (!GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_UNIFORM_BUFFER_OBJECT) &&
hasGLExtension("GL_ARB_uniform_buffer_object")) {
hasUBO = true;
Log::info("GLDriver", "ARB Uniform Buffer Object Present");
}
if (hasGLExtension("GL_ARB_geometry_shader4")) {
if (!GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_GEOMETRY_SHADER4) &&
hasGLExtension("GL_ARB_geometry_shader4")) {
hasGS = true;
Log::info("GLDriver", "ARB Geometry Shader 4 Present");
}
// Specific disablement
// (should use graphic restriction system)
if (strstr((const char *)glGetString(GL_VENDOR), "Intel") != NULL)
{
// Intel doesnt support sRGB compressed textures on some chip/OS
// TODO: Have a more precise list
// Sandy Bridge on Windows
hasTextureCompression = false;
#ifdef WIN32
// Fix for Intel Sandy Bridge on Windows which supports GL up to 3.1 only
// Works with Haswell and latest drivers
// Status unknown on Ivy Bridge
// Status unknown on older driver for Haswell
if (m_gl_major_version == 3 && m_gl_minor_version == 1)
hasUBO = false;
#endif
}
if (strstr((const char *)glGetString(GL_VENDOR), "NVIDIA") != NULL)
{
// Fix for Nvidia and instanced RH
// Compiler crashes with a big loop in RH or GI shaders
m_need_rh_workaround = true;
// Atomic counters make the driver crash on windows and linux
hasAtomics = false;
}
if (strstr((const char *)glGetString(GL_VENDOR), "ATI") != NULL)
@ -153,15 +146,6 @@ void CentralVideoSettings::init()
// Bindless textures are all treated RGB even sRGB one
m_need_srgb_workaround = true;
}
// Mesa
if (strstr((const char *)glGetString(GL_VENDOR), "Intel Open Source Technology Center") != NULL ||
strstr((const char *)glGetString(GL_VENDOR), "Gallium") != NULL)
{
// Needs a patched Mesa (current 10.4) to use array texture fbo
// Technically GS works but array texture fbo interacts with GS.
hasGS = false;
}
}
#endif
}

View File

@ -38,9 +38,24 @@ namespace GraphicsRestrictions
/** The list of names used in the XML file for the graphics
* restriction types. They must be in the same order as the types. */
char *m_names_of_restrictions[] = { "BufferStorage",
"GlobalIllumination",
NULL};
char *m_names_of_restrictions[] = {
"UniformBufferObject",
"GeometryShader4",
"DrawIndirect",
"TextureView",
"TextureStorage",
"ImageLoadStore",
"BaseInstance",
"ComputeShader",
"ShaderStorageBufferObject",
"MultiDrawIndirect",
"ShaderAtomicCounters",
"BufferStorage",
"BindlessTexture",
"TextureCompressionS3TC",
"AMDVertexShaderLayer"
};
} // namespace Private
using namespace Private;
@ -143,6 +158,19 @@ public:
}
// AMD: driver_version = "4.3.13283 Core Profile/Debug Context 14.501.1003.0"
// ----------------------------------------------
if (card_name.find("AMD") != std::string::npos)
{
std::vector<std::string> s = StringUtils::split(driver_version, ' ');
if (s.size() == 5)
{
convertVersionString(s[4]);
return;
}
}
Log::warn("Graphics", "Can not find version for '%s' '%s' - ignored.",
driver_version.c_str(), card_name.c_str());
@ -324,9 +352,9 @@ public:
*/
void unitTesting()
{
assert(Version("1") == Version("1"));
assert(Version("1") != Version("2"));
assert(Version("1") <= Version("2"));
assert(Version("1") == Version("1"));
assert(Version("1") != Version("2"));
assert(Version("1") <= Version("2"));
assert(Version("1") < Version("2"));
assert(Version("1.2.3") < Version("2"));
assert(Version("1.2.3") < Version("1.3"));

View File

@ -34,8 +34,21 @@ namespace GraphicsRestrictions
* type declaration needs a change in that variable as well. */
enum GraphicsRestrictionsType
{
GR_UNIFORM_BUFFER_OBJECT,
GR_GEOMETRY_SHADER4,
GR_DRAW_INDIRECT,
GR_TEXTURE_VIEW,
GR_TEXTURE_STORAGE,
GR_IMAGE_LOAD_STORE,
GR_BASE_INSTANCE,
GR_COMPUTE_SHADER,
GR_SHADER_STORAGE_BUFFER_OBJECT,
GR_MULTI_DRAW_INDIRECT,
GR_SHADER_ATOMIC_COUNTERS,
GR_BUFFER_STORAGE,
GR_GLOBAL_ILLUMINATION,
GR_BINDLESS_TEXTURE,
GR_EXT_TEXTURE_COMPRESSION_S3TC,
GR_AMD_VERTEX_SHADER_LAYER,
GR_COUNT /** MUST be last entry. */
} ;

View File

@ -181,6 +181,13 @@ bool EventHandler::OnEvent (const SEvent &event)
World::getWorld()->onMouseClick(event.MouseInput.X, event.MouseInput.Y);
}
if (UserConfigParams::m_keyboard_debug)
{
Log::verbose("keyboard", "char %d key %d ctrl %d down %d shift %d",
event.KeyInput.Char, event.KeyInput.Key,
event.KeyInput.Control, event.KeyInput.PressedDown,
event.KeyInput.Shift);
}
// FIXME? it may be a bit unclean that all input events go trough
// the gui module
const EventPropagation blockPropagation = input_manager->input(event);

View File

@ -555,6 +555,9 @@ void InputManager::dispatchInput(Input::InputType type, int deviceID,
if (type == Input::IT_STICKBUTTON || type == Input::IT_STICKMOTION)
{
GamePadDevice *gPad = m_device_manager->getGamePadFromIrrID(deviceID);
// This can happen in case of automatically ignored accelerator
// devices, which are not part of stk's gamepad mapping.
if (!gPad) return;
DeviceConfig *conf = gPad->getConfiguration();
if (!conf->isEnabled())
return;

View File

@ -657,9 +657,13 @@ int handleCmdLine()
bool try_login = false;
irr::core::stringw login, password;
if(CommandLine::has("--gamepad-debug"))
if (CommandLine::has("--unit-testing"))
UserConfigParams::m_unit_testing = true;
if (CommandLine::has("--gamepad-debug"))
UserConfigParams::m_gamepad_debug=true;
if(CommandLine::has("--wiimote-debug"))
if (CommandLine::has("--keyboard-debug"))
UserConfigParams::m_keyboard_debug = true;
if (CommandLine::has("--wiimote-debug"))
UserConfigParams::m_wiimote_debug = true;
if(CommandLine::has("--tutorial-debug"))
UserConfigParams::m_tutorial_debug = true;
@ -1284,10 +1288,11 @@ int main(int argc, char *argv[] )
}
}
//#define UNIT_TEST
#ifdef UNIT_TEST
GraphicsRestrictions::unitTesting();
#endif
if(UserConfigParams::m_unit_testing)
{
GraphicsRestrictions::unitTesting();
exit(0);
}
// Note that on the very first run of STK internet status is set to
// "not asked", so the report will only be sent in the next run.

View File

@ -297,30 +297,34 @@ void RaceManager::startNew(bool from_overworld)
m_num_laps = m_grand_prix.getLaps();
m_reverse_track = m_grand_prix.getReverse();
// We look if Player 1 has a saved version of this GP.
m_saved_gp = SavedGrandPrix::getSavedGP(
StateManager::get()
->getActivePlayerProfile(0)
->getUniqueID(),
m_grand_prix.getId(),
m_player_karts.size());
// Saved GP only in offline mode
if (m_continue_saved_gp && !NetworkWorld::getInstance<NetworkWorld>()->isRunning())
if (!NetworkWorld::getInstance<NetworkWorld>()->isRunning())
{
if (m_saved_gp == NULL)
// We look if Player 1 has a saved version of this GP.
m_saved_gp = SavedGrandPrix::getSavedGP(
StateManager::get()
->getActivePlayerProfile(0)
->getUniqueID(),
m_grand_prix.getId(),
m_player_karts.size());
// Saved GP only in offline mode
if (m_continue_saved_gp)
{
Log::error("Race Manager", "Can not continue Grand Prix '%s'"
"because it could not exist",
m_grand_prix.getId().c_str());
m_continue_saved_gp = false; // simple and working
}
else
{
setNumKarts(m_saved_gp->getTotalKarts());
setupPlayerKartInfo();
m_grand_prix.changeReverse((GrandPrixData::GPReverseType)m_saved_gp->getReverseType());
m_reverse_track = m_grand_prix.getReverse();
if (m_saved_gp == NULL)
{
Log::error("Race Manager", "Can not continue Grand Prix '%s'"
"because it could not exist",
m_grand_prix.getId().c_str());
m_continue_saved_gp = false; // simple and working
}
else
{
setNumKarts(m_saved_gp->getTotalKarts());
setupPlayerKartInfo();
m_grand_prix.changeReverse((GrandPrixData::GPReverseType)
m_saved_gp->getReverseType());
m_reverse_track = m_grand_prix.getReverse();
}
}
}
}
@ -381,13 +385,21 @@ void RaceManager::startNew(bool from_overworld)
{
if (m_continue_saved_gp)
{
m_track_number = m_saved_gp->getNextTrack();
m_track_number = m_saved_gp->getNextTrack();
m_saved_gp->loadKarts(m_kart_status);
}
else if (m_saved_gp != NULL)
else
{
m_saved_gp->remove();
m_saved_gp = NULL;
while (m_saved_gp != NULL)
{
m_saved_gp->remove();
m_saved_gp = SavedGrandPrix::getSavedGP(
StateManager::get()
->getActivePlayerProfile(0)
->getUniqueID(),
m_grand_prix.getId(),
m_player_karts.size());
}
}
}
@ -516,17 +528,7 @@ void RaceManager::next()
if(m_major_mode==MAJOR_MODE_GRAND_PRIX && !NetworkWorld::getInstance()->isRunning())
{
// Saving GP state
// If Player 1 has already saved a GP, we adapt it
if(m_saved_gp != NULL)
{
m_saved_gp->setKarts(m_kart_status);
m_saved_gp->setNextTrack(m_track_number);
user_config->saveConfig();
}
else
{
saveGP();
}
saveGP();
}
startNextRace();
}
@ -539,18 +541,26 @@ void RaceManager::next()
//-----------------------------------------------------------------------------
void RaceManager::saveGP()
{
UserConfigParams::m_saved_grand_prix_list.push_back(
new SavedGrandPrix(
StateManager::get()->getActivePlayerProfile(0)
->getUniqueID(),
// If Player 1 has already saved a GP, we adapt it
if (m_saved_gp != NULL)
{
m_saved_gp->setKarts(m_kart_status);
m_saved_gp->setNextTrack(m_track_number);
}
else
{
m_saved_gp = new SavedGrandPrix(
StateManager::get()->getActivePlayerProfile(0)->getUniqueID(),
m_grand_prix.getId(),
m_difficulty,
(int)m_player_karts.size(),
m_track_number,
m_grand_prix.getReverseType(),
m_kart_status
)
);
m_kart_status);
UserConfigParams::m_saved_grand_prix_list.push_back(m_saved_gp);
}
user_config->saveConfig();
}

View File

@ -135,10 +135,14 @@ void GPInfoScreen::beforeAddingWidget()
StateManager::get()->getActivePlayerProfile(0)->getUniqueID(),
m_gp.getId(),
race_manager->getNumLocalPlayers());
int tracks = m_gp.getTrackNames().size();
bool continue_visible = saved_gp && saved_gp->getNextTrack() > 0 &&
saved_gp->getNextTrack() < tracks;
RibbonWidget* ribbonButtons = getWidget<RibbonWidget>("buttons");
int id_continue_button = ribbonButtons->findItemNamed("continue");
ribbonButtons->setItemVisible(id_continue_button, saved_gp != NULL);
ribbonButtons->setItemVisible(id_continue_button, continue_visible);
ribbonButtons->setLabel(id_continue_button, _("Continue saved GP"));
}
else

View File

@ -431,10 +431,10 @@ void OptionsScreenInput2::gotSensedInput(const Input& sensed_input)
}
}
GamePadDevice *gpad = input_manager->getDeviceManager()
->getGamePadFromIrrID(sensed_input.m_device_id);
std::string gamepad_name = input_manager->getDeviceManager()
->getGamePadFromIrrID(sensed_input.m_device_id)
->getName();
std::string gamepad_name = gpad ? gpad->getName() : "UNKNOWN DEVICE";
if (m_config->getName() == gamepad_name)
{
GamepadConfig* config = (GamepadConfig*)m_config;

View File

@ -395,7 +395,7 @@ void RaceResultGUI::eventCallback(GUIEngine::Widget* widget,
void RaceResultGUI::onConfirm()
{
race_manager->saveGP(); // Save the aborted GP
//race_manager->saveGP(); // Save the aborted GP
GUIEngine::ModalDialog::dismiss();
cleanupGPProgress();
StateManager::get()->popMenu();