void THAnimationBase::attachToTile(THMapNode *pMapNode)
{
    removeFromTile();

    THLinkList *pList;
    if(m_iFlags & THDF_EarlyList)
        pList = &pMapNode->oEarlyEntities;
    else
        pList = pMapNode;
#define GetFlags(x) (reinterpret_cast<THDrawable*>(x)->m_iFlags)
    while(pList->m_pNext && (GetFlags(pList->m_pNext) & THDF_ListBottom))
        pList = pList->m_pNext;
#undef GetFlags

    m_pPrev = pList;
    if(pList->m_pNext != NULL)
    {
        m_pNext = pList->m_pNext;
        m_pNext->m_pPrev = this;
    }
    else
    {
        m_pNext = NULL;
    }
    pList->m_pNext = this;
}
Example #2
0
void THAnimationBase::attachToTile(THMapNode *pMapNode, int layer)
{
    removeFromTile();
    THLinkList *pList;
    if(m_iFlags & THDF_EarlyList)
        pList = &pMapNode->oEarlyEntities;
    else
        pList = pMapNode;

    this->setDrawingLayer(layer);

#define GetFlags(x) (reinterpret_cast<THDrawable*>(x)->m_iFlags)
    while(pList->m_pNext && pList->m_pNext->getDrawingLayer() < layer)
    {
        pList = pList->m_pNext;
    }
#undef GetFlags

    m_pPrev = pList;
    if(pList->m_pNext != NULL)
    {
        pList->m_pNext->m_pPrev = this;
        this->m_pNext = pList->m_pNext;
    }
    else
    {
        m_pNext = NULL;
    }
    pList->m_pNext = this;
}
void THAnimation::setParent(THAnimation *pParent)
{
    removeFromTile();
    if(pParent == NULL)
    {
        m_fnDraw = THAnimation_Draw;
        m_fnHitTest = THAnimation_HitTest;
        m_iSpeedX = 0;
        m_iSpeedY = 0;
    }
    else
    {
        m_fnDraw = THAnimation_DrawChild;
        m_fnHitTest = THAnimation_HitTestChild;
        m_pParent = pParent;
        m_pNext = m_pParent->m_pNext;
        if(m_pNext)
            m_pNext->m_pPrev = this;
        m_pPrev = m_pParent;
        m_pParent->m_pNext = this;
    }
}