diff --git a/source/thing/thing.cpp b/source/thing/thing.cpp index 7a2ee8e6c..606bc0829 100644 --- a/source/thing/thing.cpp +++ b/source/thing/thing.cpp @@ -559,8 +559,8 @@ int Type=thing->getThingType(); ---------------------------------------------------------------------- */ void CThing::init() { - Parent=NULL; - Next=NULL; + ParentThing=NULL; + NextThing=NULL; m_numChildren = 0; Pos.vx=Pos.vy=10; @@ -582,9 +582,9 @@ void CThing::init() ---------------------------------------------------------------------- */ void CThing::shutdown() { - if (Parent) + if (ParentThing) { // Is child - Parent->removeChild(this); + ParentThing->removeChild(this); } else { // Is Parent @@ -762,24 +762,24 @@ void CThing::ShowBBox() ---------------------------------------------------------------------- */ void CThing::addChild(CThing *Child) { -CThing *List=Next; +CThing *List=NextThing; if ( List ) { // Find end of list - while (List->Next) + while (List->NextThing) { - List=List->Next; + List=List->NextThing; } - List->Next=Child; - Child->Parent=this; + List->NextThing=Child; + Child->ParentThing=this; m_numChildren++; } else { // List does not exist, create - Next = Child; - Child->Parent=this; + NextThing = Child; + Child->ParentThing=this; m_numChildren++; } } @@ -792,14 +792,14 @@ CThing *List=Next; ---------------------------------------------------------------------- */ void CThing::removeChild(CThing *Child) { -CThing *List=Next; +CThing *List=NextThing; CThing *Last=NULL; // Find Child - while ( List != Child && List->Next ) + while ( List != Child && List->NextThing ) { Last = List; - List = List->Next; + List = List->NextThing; } // if there are no more links to continue down, the current 'List' must either be the correct item, or the item does not @@ -809,16 +809,16 @@ CThing *Last=NULL; if ( Last ) { - Last->Next = List->Next; + Last->NextThing = List->NextThing; } else { - this->Next = List->Next; + this->NextThing = List->NextThing; } m_numChildren--; - Child->Parent=NULL; + Child->ParentThing=NULL; } /*---------------------------------------------------------------------- @@ -829,16 +829,16 @@ CThing *Last=NULL; ---------------------------------------------------------------------- */ void CThing::removeAllChild() { -CThing *List=Next; +CThing *List=NextThing; while (List) { - CThing *Next=List->Next; - List->Parent=NULL; - List->Next=NULL; - List=Next; + CThing *NextThing=List->NextThing; + List->ParentThing=NULL; + List->NextThing=NULL; + List=NextThing; } - Next=NULL; + NextThing=NULL; m_numChildren = 0; } @@ -851,18 +851,18 @@ CThing *List=Next; ---------------------------------------------------------------------- */ void CThing::deleteAllChild() { -CThing *List=Next; +CThing *List=NextThing; while (List) { - CThing *Next=List->Next; - List->Parent=NULL; - List->Next=NULL; + CThing *NextThing=List->NextThing; + List->ParentThing=NULL; + List->NextThing=NULL; List->shutdown(); delete List; - List=Next; + List=NextThing; } - Next=NULL; + NextThing=NULL; m_numChildren = 0; } @@ -886,7 +886,7 @@ int CThing::getNumChildren() ---------------------------------------------------------------------- */ bool CThing::hasChild(CThing *Child) { - CThing *nextChild = Next; +CThing *nextChild = NextThing; while( nextChild ) { @@ -895,7 +895,7 @@ bool CThing::hasChild(CThing *Child) return( true ); } - nextChild = nextChild->Next; + nextChild = nextChild->NextThing; } return( false ); diff --git a/source/thing/thing.h b/source/thing/thing.h index 2e6d7df96..745d5c913 100644 --- a/source/thing/thing.h +++ b/source/thing/thing.h @@ -82,6 +82,9 @@ private: static CThing *s_CollisionLists[]; static sBBox m_RenderBBox; static sBBox m_ThinkBBox; + +// static CThing *s_FreeList[]; + }; /*----------------------------------------------------------------------*/ @@ -130,24 +133,28 @@ virtual int dontKillDuringLevelRespawn() {return false;} DVECTOR const &getPos() {return Pos;} void setPos(DVECTOR newPos) {Pos=newPos;} DVECTOR getPosDelta() {return PosDelta;} - CThing *getNext() {return Next;} + CThing *getParent() {return ParentThing;} + CThing *getNext() {return NextThing;} virtual void processEvent(GAME_EVENT _event,CThing *_sourceThing); protected: - -// Parent Child Linkage - CThing *Parent,*Next; -// Count - int m_numChildren; // Pos DVECTOR Pos, PosLast, PosDelta; -public: - CThing *m_nextListThing; - CThing *m_nextCollisionThing; +// Parent Child Linkage + CThing *ParentThing,*NextThing; + int m_numChildren; - // -- Collision -- +public: +// Collision/List Link List + CThing *m_nextCollisionThing; + CThing *m_nextListThing; + +public: + CThing *m_NextFreeThing; + +// -- Collision -- public: virtual CRECT const *getRenderBBox() {return &m_collisionArea;} virtual CRECT const *getThinkBBox() {return &m_collisionArea;} @@ -172,11 +179,18 @@ virtual bool getHasPlatformCollided() {return false;} virtual s32 getNewYPos( CThing *_thisThing ); void setNewCollidedPos(DVECTOR newPos) {m_newCollidedPos = newPos;} // pkg - to be removed? + +public: +// Thing states void setRenderFlag(bool f) {m_renderFlag=f;} void setThinkFlag(bool f) {m_thinkFlag=f;} bool canRender() {return (m_renderFlag);} DVECTOR &getRenderPos() {return(m_RenderPos);} bool canThink() {return (m_thinkFlag);} +protected: + bool m_renderFlag,m_thinkFlag; + DVECTOR m_RenderPos; + bool m_isShuttingDown; protected: virtual void setCollisionSize(int _w,int _h); @@ -192,9 +206,9 @@ private: s16 m_collisionAngle; // pkg - move to CNpcPlatform? DVECTOR m_newCollidedPos; // pkg - to be removed? - bool m_renderFlag,m_thinkFlag; - DVECTOR m_RenderPos; - bool m_isShuttingDown; +// Free List Stuff +public: +//virtual int getMaxType()=0; }; /*---------------------------------------------------------------------- */