git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/christmas@12270 178a84e3-b1eb-0310-8ba1-8eac791a3b58

This commit is contained in:
funto66 2012-12-12 00:07:23 +00:00
parent eb91514076
commit 047d075a45
4 changed files with 23 additions and 4 deletions

View File

@ -97,9 +97,11 @@ KartModel::KartModel(bool is_master)
* does not actually load the models (see load()).
* \param node XML object of configuration file.
*/
void KartModel::loadInfo(const XMLNode &node)
void KartModel::loadInfo(const XMLNode &node, bool xmas_mode)
{
node.get("model-file", &m_model_filename);
if(xmas_mode)
node.get("xmas-model-file", &m_model_filename);
if(const XMLNode *animation_node=node.getNode("animations"))
{
animation_node->get("left", &m_animation_frame[AF_LEFT] );

View File

@ -142,7 +142,7 @@ public:
~KartModel();
KartModel* makeCopy();
void reset();
void loadInfo(const XMLNode &node);
void loadInfo(const XMLNode &node, bool xmas_mode);
bool loadModels(const KartProperties &kart_properties);
void update(float rotation_dt, float steer,
const float suspension[4]);

View File

@ -21,6 +21,7 @@
#include <iostream>
#include <stdexcept>
#include <string>
#include <ctime>
#include "config/stk_config.hpp"
#include "config/user_config.hpp"
@ -54,6 +55,12 @@ KartProperties::KartProperties(const std::string &filename)
m_shadow_scale = 1.0f;
m_shadow_x_offset = 0.0f;
m_shadow_y_offset = 0.0f;
time_t rawtime;
struct tm* timeinfo;
std::time(&rawtime);
timeinfo = std::localtime(&rawtime);
m_xmas_mode = (timeinfo->tm_mon == 11); // Xmas mode happens in December
m_groups.clear();
m_custom_sfx_id.resize(SFXManager::NUM_CUSTOMS);
@ -273,6 +280,14 @@ void KartProperties::getAllData(const XMLNode * root)
root->get("icon-file", &m_icon_file );
root->get("minimap-icon-file", &m_minimap_icon_file);
// Override file paths on Christmas
root->get("force-xmas-mode", &m_xmas_mode);
if(m_xmas_mode)
{
root->get("xmas-icon-file", &m_icon_file);
root->get("xmas-minimap-icon-file", &m_minimap_icon_file);
}
root->get("shadow-file", &m_shadow_file );
Vec3 c;
@ -560,7 +575,7 @@ void KartProperties::getAllData(const XMLNode * root)
} // if sounds-node exist
if(m_kart_model)
m_kart_model->loadInfo(*root);
m_kart_model->loadInfo(*root, m_xmas_mode);
} // getAllData
// ----------------------------------------------------------------------------

View File

@ -78,11 +78,13 @@ private:
/** The texture to use in the minimap. If not defined, a simple
* color dot is used. */
video::ITexture *m_minimap_icon;
/** The kart model and wheels. It is mutable since the wheels of the
* KartModel can rotate and turn, and animations are played, but otherwise
* the kart_properties object is const. */
mutable KartModel *m_kart_model;
bool m_xmas_mode;
/** List of all groups the kart belongs to. */
std::vector<std::string> m_groups;