If a bubble gum is dropped while items are switched,

immediately switch this item.


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@4726 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2010-02-15 03:07:19 +00:00
parent 0827c95c35
commit b28011ede2
2 changed files with 14 additions and 11 deletions

View File

@ -141,12 +141,16 @@ void ItemManager::loadDefaultItems()
Item* ItemManager::newItem(Item::ItemType type, const Vec3& xyz,
const Vec3 &normal, Kart *parent)
{
Item* h;
h = new Item(type, xyz, normal, m_item_mesh[type], m_all_items.size());
if(parent != NULL) h->setParent(parent);
m_all_items.push_back(h);
return h;
Item* item;
item = new Item(type, xyz, normal, m_item_mesh[type], m_all_items.size());
if(parent != NULL) item->setParent(parent);
if(m_switch_time>=0)
{
Item::ItemType new_type = m_switch_to[item->getType()];
item->switchTo(new_type, m_item_mesh[(int)new_type]);
}
m_all_items.push_back(item);
return item;
} // newItem
//-----------------------------------------------------------------------------

View File

@ -47,15 +47,14 @@ private:
/** What item is item is switched to. */
std::vector<Item::ItemType> m_switch_to;
void setItem(const lisp::Lisp *item_node, const char *colour,
Item::ItemType type);
public:
// DEBUG only, this variable should become private again.
/** Remaining time that items should remain switched. If the
* value is <0, it indicates that the items are not switched atm. */
float m_switch_time;
void setItem(const lisp::Lisp *item_node, const char *colour,
Item::ItemType type);
public:
ItemManager();
~ItemManager();
void loadDefaultItems();