This commit is contained in:
Benau 2018-11-17 01:40:51 +08:00
parent 99eefa3797
commit 22999c1e2b
3 changed files with 15 additions and 3 deletions

View File

@ -8,7 +8,7 @@
isn't an item, it is internally isn't an item, it is internally
handled as one, so list it here --> handled as one, so list it here -->
<bubblegum model="bubblegum.spm" lowmodel="bubblegum-low.spm" glow="246 150 209"/> <bubblegum model="bubblegum.spm" lowmodel="bubblegum-low.spm" glow="246 150 209"/>
<bubblegum-nolok model="bubblegum-nolok.spm" lowmodel="bubblegum-nolok-low.spm"/> <bubblegum-nolok model="bubblegum-nolok.spm" lowmodel="bubblegum-nolok-low.spm" glow="20 190 0"/>
<easter-egg model="easter_egg.spm" glow="0 60 120" /> <easter-egg model="easter_egg.spm" glow="0 60 120" />
</items> </items>

View File

@ -136,6 +136,16 @@ void ItemState::collected(const AbstractKart *kart)
} }
} // collected } // collected
// ----------------------------------------------------------------------------
/** Returns the graphical type of this item should be using (takes nolok into
* account). */
Item::ItemType ItemState::getGrahpicalType() const
{
return m_previous_owner && m_previous_owner->getIdent() == "nolok" &&
getType() == ITEM_BUBBLEGUM ?
ITEM_BUBBLEGUM_NOLOK : getType();
} // getGrahpicalType
// ============================================================================ // ============================================================================
/** Constructor for an item. /** Constructor for an item.
* \param type Type of the item. * \param type Type of the item.
@ -184,7 +194,7 @@ Item::Item(ItemType type, const Vec3& xyz, const Vec3& normal,
} }
m_node = lodnode; m_node = lodnode;
setType(type); setType(type);
handleNewMesh(getType()); handleNewMesh(getGrahpicalType());
#ifdef DEBUG #ifdef DEBUG
std::string debug_name("item: "); std::string debug_name("item: ");
@ -350,7 +360,7 @@ void Item::updateGraphics(float dt)
if (m_graphical_type != getType()) if (m_graphical_type != getType())
{ {
handleNewMesh(getType()); handleNewMesh(getGrahpicalType());
m_graphical_type = getType(); m_graphical_type = getType();
} }

View File

@ -280,6 +280,8 @@ public:
/** Returns the type of this item. */ /** Returns the type of this item. */
ItemType getType() const { return m_type; } ItemType getType() const { return m_type; }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
ItemType getGrahpicalType() const;
// ------------------------------------------------------------------------
/** Returns the original type of this item. */ /** Returns the original type of this item. */
ItemType getOriginalType() const { return m_original_type; } ItemType getOriginalType() const { return m_original_type; }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------