This commit is contained in:
Daveo 2001-08-15 14:14:13 +00:00
parent d79fba5228
commit c3f2c27e6d
6 changed files with 64 additions and 40 deletions

View File

@ -812,7 +812,7 @@ void CGameScene::initLevel()
{
m_player->setCanExitLevelNow();
}
DVECTOR mapSize=Level.getMapSize();
DVECTOR const &mapSize=Level.getMapSize();
CPlayer::CameraBox camBox={0,0,mapSize.vx<<4,mapSize.vy<<4};
m_player->setCameraBox(camBox);

View File

@ -159,7 +159,7 @@ sItem *item=ItemList;
int mapHeight;
CLayerCollision *ColLayer=CGameScene::getCollision();
mapHeight=GameScene.GetLevel().getMapSize().vy*16;
mapHeight=GameScene.GetLevel().getMapHeight16();
for (int i=0; i<ITEM_MAX; i++)
{

View File

@ -381,6 +381,10 @@ void CLevel::initLayers()
CLayerTile *NewLayer=new ("Action Layer") CLayerTile3d(LevelHdr,Layer,m_RGBMap,m_RGBTable);
NewLayer->init(MapPos,0);
TileLayers[CLayerTile::LAYER_TILE_TYPE_ACTION]=NewLayer;
MapSize.vx=Layer->Width;
MapSize.vy=Layer->Height;
MapSize16.vx=Layer->Width*16;
MapSize16.vy=Layer->Height*16;
}
// Collision
@ -726,6 +730,7 @@ void CLevel::think(int _frames)
/*****************************************************************************/
/*****************************************************************************/
/*****************************************************************************/
/*
DVECTOR CLevel::getMapSize()
{
DVECTOR size;
@ -737,7 +742,7 @@ sLayerHdr *layer;
return size;
}
*/
/*****************************************************************************/
/*****************************************************************************/

View File

@ -78,7 +78,14 @@ static CFmaScene::FMA_SCRIPT_NUMBER getFMAToFollow() {return LvlTable[s_glo
sThingHazard **getHazardList() {return HazardList;}
CLayerCollision *getCollisionLayer() {return CollisionLayer;}
DVECTOR getMapSize();
DVECTOR const &getMapSize() {return(MapSize);}
int getMapWidth() {return(MapSize.vx);}
int getMapHeight() {return(MapSize.vy);}
DVECTOR const &getMapSize16() {return(MapSize16);}
int getMapWidth16() {return(MapSize16.vx);}
int getMapHeight16() {return(MapSize16.vy);}
bool GetNextLevel(int &Lvl);
@ -132,6 +139,7 @@ static int s_playerFacing;
static u8 m_isBossRespawn;
static s32 m_bossHealth;
DVECTOR MapSize,MapSize16;
static CNpcCheckpointHazard *m_checkpoint;
// Level Repair stuff

View File

@ -124,7 +124,7 @@ void CPlayerModeDead::think()
m_player->setAnimFrame(frame);
}
if(m_player->getPos().vy<(GameScene.GetLevel().getMapSize().vy+4)*16)
if(m_player->getPos().vy<(GameScene.GetLevel().getMapHeight()+4)*16)
{
m_player->moveVertical(5);
}

View File

@ -440,6 +440,8 @@ DVECTOR const &CamPos=CLevel::getCameraPos();
m_ThinkBBox.XMax=s_ThinkBBoxX1+CamPos.vx;
m_ThinkBBox.YMin=s_ThinkBBoxY0+CamPos.vy;
m_ThinkBBox.YMax=s_ThinkBBoxY1+CamPos.vy;
CLevel &Lvl=GameScene.GetLevel();
DVECTOR const &MapSize=Lvl.getMapSize16();
int i;
CThing *thing;
@ -456,43 +458,52 @@ DVECTOR const &CamPos=CLevel::getCameraPos();
CRECT const *ThingRect= thing->getThinkBBox();
int lastFlag=thing->getThinkFlag()<<1;
int Flag=1;
// Will speed this up
if (!thing->alwaysThink())
{
if (ThingRect->x2<m_ThinkBBox.XMin || ThingRect->x1>m_ThinkBBox.XMax) Flag=0;
if (ThingRect->y2<m_ThinkBBox.YMin || ThingRect->y1>m_ThinkBBox.YMax) Flag=0;
}
thing->setThinkFlag(Flag);
// Is in think zone
if (Flag)
{
thing->think(_frames);
// thing->updateCollisionArea();
if (thing->canCollide())
{
CThingManager::addToCollisionList(thing);
}
}
Flag|=lastFlag;
// Handle enter/leave states (not sure of viabilty now)
switch (Flag)
{ // Last This
case 0: // 0 0
break;
case 1: // 0 1
// thing->enterThinkZone(_frames);
break;
case 2: // 1 0
thing->leftThinkZone(_frames);
break;
case 3: // 1 1
break;
default:
ASSERT("Invalid Think State");
}
DVECTOR const &ThingPos=thing->getPos();
// Will speed this up
if (ThingPos.vx<0 || ThingPos.vx>=MapSize.vx || ThingPos.vy<0 || ThingPos.vy>=MapSize.vy)
{
thing->setToShutdown();
SYSTEM_DBGMSG("ThingOffMap: T:%i S:%i TXY%i %i, MWH%i %i\n",(int)thing->getThingType(),(int)thing->getThingSubType(),ThingPos.vx,ThingPos.vy,MapSize.vx,MapSize.vy);
}
else
{
if (!thing->alwaysThink())
{
if (ThingRect->x2<m_ThinkBBox.XMin || ThingRect->x1>m_ThinkBBox.XMax) Flag=0;
if (ThingRect->y2<m_ThinkBBox.YMin || ThingRect->y1>m_ThinkBBox.YMax) Flag=0;
}
thing->setThinkFlag(Flag);
// Is in think zone
if (Flag)
{
thing->think(_frames);
// thing->updateCollisionArea();
if (thing->canCollide())
{
CThingManager::addToCollisionList(thing);
}
}
Flag|=lastFlag;
// Handle enter/leave states (not sure of viabilty now)
switch (Flag)
{ // Last This
case 0: // 0 0
break;
case 1: // 0 1
// thing->enterThinkZone(_frames);
break;
case 2: // 1 0
thing->leftThinkZone(_frames);
break;
case 3: // 1 1
break;
default:
ASSERT("Invalid Think State");
}
/* THIS WILL NOT STAY HERE, THINGS MUST BE INITIALISED CORRECTLY */
thing->updateCollisionArea();
thing->updateCollisionArea();
}
thing=thing->m_nextListThing;
}
}