Added GFX level slider in options + spell wheather correctly in options...

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@7410 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria
2011-01-14 03:10:04 +00:00
parent 4396695920
commit 7ae7fb5dfd
4 changed files with 33 additions and 33 deletions

View File

@@ -36,17 +36,8 @@
<label width="100%" I18N="In the graphics settings" text="Graphical Effects Settings"/>
<div width="100%" proportion="1" layout="horizontal-row" >
<checkbox id="anim" width="40" height="40" />
<spacer width="20" height="100%" />
<label proportion="1" height="100%" I18N="In the video settings" text="Animated Karts"/>
</div>
<div width="100%" proportion="1" layout="horizontal-row" >
<checkbox id="gfx" width="40" height="40" />
<spacer width="20" height="100%" />
<label proportion="1" height="100%" I18N="In the video settings" text="Animated Effects and Scenery"/>
</div>
<!-- FIXME: don't hardcode size -->
<gauge id="gfx_level" min_value="1" max_value="3" width="300" height="50"/>
</div>
</div>

View File

@@ -274,8 +274,8 @@ namespace UserConfigParams
PARAM_PREFIX BoolUserConfigParam m_graphical_effects
PARAM_DEFAULT( BoolUserConfigParam(true, "gfx", &m_video_group) );
PARAM_PREFIX BoolUserConfigParam m_wheater_effects
PARAM_DEFAULT( BoolUserConfigParam(true, "wheater_gfx", &m_video_group) );
PARAM_PREFIX BoolUserConfigParam m_wheather_effects
PARAM_DEFAULT( BoolUserConfigParam(true, "wheather_gfx", &m_video_group) );
PARAM_PREFIX BoolUserConfigParam m_show_steering_animations
PARAM_DEFAULT( BoolUserConfigParam(true, "steering_animations", &m_video_group, "Display steering animations in race") );

View File

@@ -41,6 +41,12 @@ using namespace GUIEngine;
DEFINE_SCREEN_SINGLETON( OptionsScreenVideo );
// Look-up table for GFX levels
const bool GFX_ANIM_KARTS[] = {false, true, true};
const bool GFX [] = {false, false, true};
const bool GFX_WHEATHER [] = {false, false, true};
const int GFX_LEVEL_AMOUNT = 3;
// -----------------------------------------------------------------------------
OptionsScreenVideo::OptionsScreenVideo() : Screen("options_video.stkgui")
@@ -107,11 +113,8 @@ void OptionsScreenVideo::init()
GUIEngine::ButtonWidget* applyBtn = this->getWidget<GUIEngine::ButtonWidget>("apply_resolution");
assert( applyBtn != NULL );
GUIEngine::CheckBoxWidget* animatedKarts = this->getWidget<GUIEngine::CheckBoxWidget>("anim");
assert( animatedKarts != NULL );
GUIEngine::CheckBoxWidget* gfx = this->getWidget<GUIEngine::CheckBoxWidget>("gfx");
GUIEngine::SpinnerWidget* gfx = this->getWidget<GUIEngine::SpinnerWidget>("gfx_level");
assert( gfx != NULL );
// ---- video modes
@@ -162,7 +165,6 @@ void OptionsScreenVideo::init()
res->setDeactivated();
full->setDeactivated();
applyBtn->setDeactivated();
animatedKarts->setDeactivated();
gfx->setDeactivated();
}
else
@@ -170,7 +172,6 @@ void OptionsScreenVideo::init()
res->setActivated();
full->setActivated();
applyBtn->setActivated();
animatedKarts->setActivated();
gfx->setActivated();
}
@@ -216,8 +217,16 @@ void OptionsScreenVideo::init()
}
// --- set gfx settings values
animatedKarts->setState( UserConfigParams::m_show_steering_animations );
gfx->setState( UserConfigParams::m_graphical_effects );
for (int l=0; l<GFX_LEVEL_AMOUNT; l++)
{
if (UserConfigParams::m_show_steering_animations == GFX_ANIM_KARTS[l] &&
UserConfigParams::m_graphical_effects == GFX[l] &&
UserConfigParams::m_wheather_effects == GFX_WHEATHER[l])
{
gfx->setValue(l+1);
break;
}
}
} // init
// -----------------------------------------------------------------------------
@@ -268,18 +277,18 @@ void OptionsScreenVideo::eventCallback(Widget* widget, const std::string& name,
UserConfigParams::m_skin_file = core::stringc(selectedSkin.c_str()).c_str() + std::string(".stkskin");
GUIEngine::reloadSkin();
}
else if (name == "anim")
else if (name == "gfx_level")
{
GUIEngine::CheckBoxWidget* animatedKarts = this->getWidget<GUIEngine::CheckBoxWidget>("anim");
assert( animatedKarts != NULL );
UserConfigParams::m_show_steering_animations = animatedKarts->getState();
}
else if (name == "gfx")
{
GUIEngine::CheckBoxWidget* gfx = this->getWidget<GUIEngine::CheckBoxWidget>("gfx");
assert( gfx != NULL );
UserConfigParams::m_graphical_effects = gfx->getState();
GUIEngine::SpinnerWidget* gfx_level = this->getWidget<GUIEngine::SpinnerWidget>("gfx_level");
assert( gfx_level != NULL );
const int level = gfx_level->getValue();
UserConfigParams::m_show_steering_animations = GFX_ANIM_KARTS[level-1];
UserConfigParams::m_graphical_effects = GFX[level-1];
UserConfigParams::m_wheather_effects = GFX_WHEATHER[level-1];
}
} // eventCallback

View File

@@ -985,7 +985,7 @@ void Track::loadTrackModel(World* parent, unsigned int mode_id)
createPhysicsModel(main_track_count);
if (UserConfigParams::m_track_debug) m_quad_graph->createDebugMesh();
if (UserConfigParams::m_wheater_effects && m_sky_particles != NULL)
if (UserConfigParams::m_wheather_effects && m_sky_particles != NULL)
{
const float x = (m_aabb_max.getX() + m_aabb_min.getX())/2.0f;
const float z = (m_aabb_max.getZ() + m_aabb_min.getZ())/2.0f;