This commit is contained in:
Daveo 2001-05-10 23:51:14 +00:00
parent 367143790d
commit 92e2df722d
3 changed files with 36 additions and 20 deletions

View File

@ -421,7 +421,6 @@ void CLevel::initThings(int _respawningLevel)
trigger->setPositionAndSize(TriggerList->Pos.X<<4,TriggerList->Pos.Y<<4,
TriggerList->Width<<4,TriggerList->Height<<4);
trigger->setTargetBox(TriggerList->TargetPos.X<<4,TriggerList->TargetPos.Y<<4,TriggerList->TargetSize.X<<4,TriggerList->TargetSize.Y<<4);
trigger->updateCollisionArea();
}
TriggerList++;
}
@ -444,7 +443,6 @@ void CLevel::initThings(int _respawningLevel)
pos.vx=ItemList->Pos.X<<4;
pos.vy=ItemList->Pos.Y<<4;
newPickup=createPickup((PICKUP_TYPE)ItemList->Type,&pos);
newPickup->updateCollisionArea();
if(isSpat)
{
((CSpatulaPickup*)newPickup)->setSpatulaNumber(spatNumber);
@ -479,7 +477,6 @@ void CLevel::initThings(int _respawningLevel)
enemy->setLayerCollision( getCollisionLayer() );
enemy->setupWaypoints( ThisActor );
enemy->postInit();
enemy->updateCollisionArea();
if ( ThisActor->Speed )
{
@ -494,7 +491,6 @@ void CLevel::initThings(int _respawningLevel)
friendNpc=CNpcFriend::Create(ThisActor);
friendNpc->setLayerCollision( getCollisionLayer() );
friendNpc->postInit();
friendNpc->updateCollisionArea();
}
break;
@ -514,7 +510,6 @@ void CLevel::initThings(int _respawningLevel)
platform = CNpcPlatform::Create( ThisPlatform );
platform->setLayerCollision( getCollisionLayer() );
platform->postInit();
platform->updateCollisionArea();
if ( ThisPlatform->Speed )
{
@ -532,7 +527,6 @@ void CLevel::initThings(int _respawningLevel)
CNpcHazard *hazard;
hazard = CNpcHazard::Create( ThisHazard );
hazard->setLayerCollision( getCollisionLayer() );
hazard->updateCollisionArea();
if ( ThisHazard->Respawn )
{
hazard->setRespawnRate( ThisHazard->Respawn );
@ -543,6 +537,7 @@ void CLevel::initThings(int _respawningLevel)
// initialise jellyfish generator
CJellyfishGenerator::init();
CThingManager::initAllThings();
}

View File

@ -152,6 +152,25 @@ void CThingManager::killAllThingsForRespawn()
}
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CThingManager::initAllThings()
{
for(int i=0; i<CThing::MAX_TYPE; i++)
{
CThing *thing=s_thingLists[i];
while(thing)
{
thing->updateCollisionArea();
thing=thing->m_nextListThing;
}
}
}
/*----------------------------------------------------------------------
Function:
Purpose:
@ -172,9 +191,10 @@ DVECTOR const &CamPos=CLevel::getCameraPos();
int i;
CThing *thing;
CThing *thing1,*thing2,*playerThing;
initList(s_CollisionLists);
for(i=0;i<CThing::MAX_TYPE;i++)
for(i=0; i<CThing::MAX_TYPE; i++)
{
thing=s_thingLists[i];
while(thing)
@ -191,14 +211,14 @@ DVECTOR const &CamPos=CLevel::getCameraPos();
if (Flag)
{
thing->think(_frames);
// thing->updateCollisionArea();
thing->updateCollisionArea();
if (thing->canCollide())
{
CThingManager::addToCollisionList(thing);
}
}
/* THIS WILL NOT STAY HERE, THINGS MUST BE INITIALISED CORRECTLY */
thing->updateCollisionArea();
// thing->updateCollisionArea();
thing=thing->m_nextListThing;
}
@ -213,7 +233,7 @@ DVECTOR const &CamPos=CLevel::getCameraPos();
playerThing=s_CollisionLists[CThing::TYPE_PLAYER];
if (playerThing)
if (player && playerThing)
{
playerThing->setHasPlatformCollided( false );
playerThing->setNewCollidedPos( playerThing->getPos() );
@ -514,13 +534,12 @@ void CThingManager::removeFromThingList(CThing *_this)
Params:
Returns:
---------------------------------------------------------------------- */
void CThingManager::addToCollisionList(CThing *_this)
void CThingManager::addToCollisionList(CThing *thing)
{
int Type=_this->getThingType();
_this->m_nextCollisionThing=s_CollisionLists[Type];
s_CollisionLists[Type]=_this;
int Type=thing->getThingType();
thing->m_nextCollisionThing=s_CollisionLists[Type];
s_CollisionLists[Type]=thing;
}
/*----------------------------------------------------------------------
@ -536,13 +555,14 @@ void CThing::init()
m_numChildren = 0;
Pos.vx=Pos.vy=10;
// Add to thing list
CThingManager::addToThingList(this);
// These need to stay for init
setCollisionSize(20,20); // Some temporary defaults.. (pkg)
setCollisionCentreOffset(0,0);
setCollisionAngle(0);
// Add to thing list
CThingManager::addToThingList(this);
}
/*----------------------------------------------------------------------

View File

@ -55,6 +55,7 @@ public:
static void shutdown();
static void killAllThingsForRespawn();
static void initAllThings();
static void thinkAllThings(int _frames);
static void renderAllThings();
static void processEventAllThings(GAME_EVENT _event,CThing *_sourceThing);