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, trigger->setPositionAndSize(TriggerList->Pos.X<<4,TriggerList->Pos.Y<<4,
TriggerList->Width<<4,TriggerList->Height<<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->setTargetBox(TriggerList->TargetPos.X<<4,TriggerList->TargetPos.Y<<4,TriggerList->TargetSize.X<<4,TriggerList->TargetSize.Y<<4);
trigger->updateCollisionArea();
} }
TriggerList++; TriggerList++;
} }
@ -444,7 +443,6 @@ void CLevel::initThings(int _respawningLevel)
pos.vx=ItemList->Pos.X<<4; pos.vx=ItemList->Pos.X<<4;
pos.vy=ItemList->Pos.Y<<4; pos.vy=ItemList->Pos.Y<<4;
newPickup=createPickup((PICKUP_TYPE)ItemList->Type,&pos); newPickup=createPickup((PICKUP_TYPE)ItemList->Type,&pos);
newPickup->updateCollisionArea();
if(isSpat) if(isSpat)
{ {
((CSpatulaPickup*)newPickup)->setSpatulaNumber(spatNumber); ((CSpatulaPickup*)newPickup)->setSpatulaNumber(spatNumber);
@ -479,7 +477,6 @@ void CLevel::initThings(int _respawningLevel)
enemy->setLayerCollision( getCollisionLayer() ); enemy->setLayerCollision( getCollisionLayer() );
enemy->setupWaypoints( ThisActor ); enemy->setupWaypoints( ThisActor );
enemy->postInit(); enemy->postInit();
enemy->updateCollisionArea();
if ( ThisActor->Speed ) if ( ThisActor->Speed )
{ {
@ -494,7 +491,6 @@ void CLevel::initThings(int _respawningLevel)
friendNpc=CNpcFriend::Create(ThisActor); friendNpc=CNpcFriend::Create(ThisActor);
friendNpc->setLayerCollision( getCollisionLayer() ); friendNpc->setLayerCollision( getCollisionLayer() );
friendNpc->postInit(); friendNpc->postInit();
friendNpc->updateCollisionArea();
} }
break; break;
@ -514,7 +510,6 @@ void CLevel::initThings(int _respawningLevel)
platform = CNpcPlatform::Create( ThisPlatform ); platform = CNpcPlatform::Create( ThisPlatform );
platform->setLayerCollision( getCollisionLayer() ); platform->setLayerCollision( getCollisionLayer() );
platform->postInit(); platform->postInit();
platform->updateCollisionArea();
if ( ThisPlatform->Speed ) if ( ThisPlatform->Speed )
{ {
@ -532,7 +527,6 @@ void CLevel::initThings(int _respawningLevel)
CNpcHazard *hazard; CNpcHazard *hazard;
hazard = CNpcHazard::Create( ThisHazard ); hazard = CNpcHazard::Create( ThisHazard );
hazard->setLayerCollision( getCollisionLayer() ); hazard->setLayerCollision( getCollisionLayer() );
hazard->updateCollisionArea();
if ( ThisHazard->Respawn ) if ( ThisHazard->Respawn )
{ {
hazard->setRespawnRate( ThisHazard->Respawn ); hazard->setRespawnRate( ThisHazard->Respawn );
@ -543,6 +537,7 @@ void CLevel::initThings(int _respawningLevel)
// initialise jellyfish generator // initialise jellyfish generator
CJellyfishGenerator::init(); 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: Function:
Purpose: Purpose:
@ -172,9 +191,10 @@ DVECTOR const &CamPos=CLevel::getCameraPos();
int i; int i;
CThing *thing; CThing *thing;
CThing *thing1,*thing2,*playerThing; CThing *thing1,*thing2,*playerThing;
initList(s_CollisionLists); initList(s_CollisionLists);
for(i=0;i<CThing::MAX_TYPE;i++) for(i=0; i<CThing::MAX_TYPE; i++)
{ {
thing=s_thingLists[i]; thing=s_thingLists[i];
while(thing) while(thing)
@ -191,14 +211,14 @@ DVECTOR const &CamPos=CLevel::getCameraPos();
if (Flag) if (Flag)
{ {
thing->think(_frames); thing->think(_frames);
// thing->updateCollisionArea(); thing->updateCollisionArea();
if (thing->canCollide()) if (thing->canCollide())
{ {
CThingManager::addToCollisionList(thing); CThingManager::addToCollisionList(thing);
} }
} }
/* THIS WILL NOT STAY HERE, THINGS MUST BE INITIALISED CORRECTLY */ /* THIS WILL NOT STAY HERE, THINGS MUST BE INITIALISED CORRECTLY */
thing->updateCollisionArea(); // thing->updateCollisionArea();
thing=thing->m_nextListThing; thing=thing->m_nextListThing;
} }
@ -213,7 +233,7 @@ DVECTOR const &CamPos=CLevel::getCameraPos();
playerThing=s_CollisionLists[CThing::TYPE_PLAYER]; playerThing=s_CollisionLists[CThing::TYPE_PLAYER];
if (playerThing) if (player && playerThing)
{ {
playerThing->setHasPlatformCollided( false ); playerThing->setHasPlatformCollided( false );
playerThing->setNewCollidedPos( playerThing->getPos() ); playerThing->setNewCollidedPos( playerThing->getPos() );
@ -514,13 +534,12 @@ void CThingManager::removeFromThingList(CThing *_this)
Params: Params:
Returns: Returns:
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CThingManager::addToCollisionList(CThing *_this) void CThingManager::addToCollisionList(CThing *thing)
{ {
int Type=_this->getThingType(); int Type=thing->getThingType();
_this->m_nextCollisionThing=s_CollisionLists[Type];
s_CollisionLists[Type]=_this;
thing->m_nextCollisionThing=s_CollisionLists[Type];
s_CollisionLists[Type]=thing;
} }
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
@ -536,13 +555,14 @@ void CThing::init()
m_numChildren = 0; m_numChildren = 0;
Pos.vx=Pos.vy=10; Pos.vx=Pos.vy=10;
// These need to stay for init
// Add to thing list
CThingManager::addToThingList(this);
setCollisionSize(20,20); // Some temporary defaults.. (pkg) setCollisionSize(20,20); // Some temporary defaults.. (pkg)
setCollisionCentreOffset(0,0); setCollisionCentreOffset(0,0);
setCollisionAngle(0); setCollisionAngle(0);
// Add to thing list
CThingManager::addToThingList(this);
} }
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------

View File

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