This commit is contained in:
Charles 2001-05-25 19:08:35 +00:00
parent 68ca825123
commit 861c534304
8 changed files with 195 additions and 26 deletions

View file

@ -3,9 +3,9 @@
thing.cpp
Author: PKG
Created:
Created:
Project: Spongebob
Purpose:
Purpose:
Copyright (c) 2001 Climax Development Ltd
@ -40,6 +40,10 @@
#include "friend\friend.h"
#include "fx\fx.h"
#ifndef __FRIEND_FRIEND_H__
#include "friend\friend.h"
#endif
#ifndef __HAZARD_HRWEIGHT_H__
#include "hazard\hrweight.h"
#endif
@ -172,7 +176,7 @@ int i;
/*----------------------------------------------------------------------
Function:
Purpose:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
@ -346,7 +350,7 @@ DVECTOR const &CamPos=CLevel::getCameraPos();
CRECT const *ThingRect= thing->getThinkBBox();
bool Flag=true;
// Will speed this up
if (!thing->alwaysThink())
{
if (ThingRect->x2<m_ThinkBBox.XMin || ThingRect->x1>m_ThinkBBox.XMax) Flag=false;
@ -537,6 +541,32 @@ DVECTOR const &CamPos=CLevel::getCameraPos();
}
thing1=thing1->m_nextCollisionThing;
}
// Friendly npc -> Platform projectile collision - first clear platforms
CNpcFriend *friendNpc = (CNpcFriend *) s_CollisionLists[CThing::TYPE_NPC];
while( friendNpc )
{
friendNpc->clearPlatform();
friendNpc = (CNpcFriend *) friendNpc->m_nextCollisionThing;
}
// now detect new platform
thing1=s_CollisionLists[CThing::TYPE_PLATFORM];
while(thing1)
{
thing2=s_CollisionLists[CThing::TYPE_NPC];
while(thing2)
{
if(thing1->checkCollisionAgainst(thing2, _frames))
{
thing1->collidedWith(thing2);
}
thing2=thing2->m_nextCollisionThing;
}
thing1=thing1->m_nextCollisionThing;
}
}
// Shut emm down, sh sh shut em down, we shutem down
for(i=0;i<CThing::MAX_TYPE;i++)
@ -753,7 +783,7 @@ void CThingManager::resetFreeList()
}
List[t]=0;
}
}
#endif
}
@ -799,7 +829,7 @@ void CThingManager::DeleteThing(CThing *Thing)
int Type=Thing->getThingType();
int SubType=Thing->getThingSubType();
CThing **List=s_FreeList[Type];
// Check its been aquired/set correctly
ASSERT(SubType!=1234);
@ -851,7 +881,7 @@ void CThing::init()
---------------------------------------------------------------------- */
void CThing::shutdown()
{
if (ParentThing)
if (ParentThing)
{ // Is child
ParentThing->removeChild(this);
}
@ -872,7 +902,7 @@ void CThing::shutdown()
---------------------------------------------------------------------- */
void CThing::think(int _frames)
{
PosDelta.vx=Pos.vx-PosLast.vx;
PosDelta.vx=Pos.vx-PosLast.vx;
PosDelta.vy=Pos.vy-PosLast.vy;
PosLast=Pos;
@ -1036,7 +1066,7 @@ CThing *List=NextThing;
if ( List )
{
// Find end of list
while (List->NextThing)
while (List->NextThing)
{
List=List->NextThing;
}
@ -1327,4 +1357,3 @@ void CTriggerThing::setTargetBox(int _x,int _y,int _w,int _h)
}