From 047d075a4573bcf120efb58fc45172933d21d8ef Mon Sep 17 00:00:00 2001 From: funto66 Date: Wed, 12 Dec 2012 00:07:23 +0000 Subject: [PATCH] git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/christmas@12270 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/karts/kart_model.cpp | 4 +++- src/karts/kart_model.hpp | 2 +- src/karts/kart_properties.cpp | 17 ++++++++++++++++- src/karts/kart_properties.hpp | 4 +++- 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/karts/kart_model.cpp b/src/karts/kart_model.cpp index 26bd4b108..7edabe174 100644 --- a/src/karts/kart_model.cpp +++ b/src/karts/kart_model.cpp @@ -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] ); diff --git a/src/karts/kart_model.hpp b/src/karts/kart_model.hpp index ef090032e..a36b44589 100644 --- a/src/karts/kart_model.hpp +++ b/src/karts/kart_model.hpp @@ -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]); diff --git a/src/karts/kart_properties.cpp b/src/karts/kart_properties.cpp index 25d096516..fb8de0884 100644 --- a/src/karts/kart_properties.cpp +++ b/src/karts/kart_properties.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #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 // ---------------------------------------------------------------------------- diff --git a/src/karts/kart_properties.hpp b/src/karts/kart_properties.hpp index 56cf0a32c..cace3b3be 100644 --- a/src/karts/kart_properties.hpp +++ b/src/karts/kart_properties.hpp @@ -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 m_groups;