This commit is contained in:
Daveo 2001-05-25 18:43:47 +00:00
parent 5b785068c2
commit fa5105d783
96 changed files with 550 additions and 406 deletions

View file

@ -49,7 +49,7 @@ void CBridgeBalloon::render()
renderPos.vx = Pos.vx - CamPos.vx;
renderPos.vy = Pos.vy - CamPos.vy;
m_spriteBank->printFT4(FRM__BALLOON,renderPos.vx,renderPos.vy,0,0,10);
CGameScene::getSpriteBank()->printFT4(FRM__BALLOON,renderPos.vx,renderPos.vy,0,0,10);
}
}
@ -57,15 +57,12 @@ void CBridgeBalloon::render()
void CBridgeBalloon::init()
{
m_spriteBank=new ("enemy sprites") SpriteBank();
m_spriteBank->load(SPRITES_SPRITES_SPR);
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CBridgeBalloon::shutdown()
{
if (m_spriteBank) m_spriteBank->dump(); delete m_spriteBank;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

View file

@ -28,7 +28,6 @@ public:
virtual int checkCollisionAgainst(CThing *_thisThing, int _frames);
protected:
DVECTOR Pos;
SpriteBank *m_spriteBank;
};
class CNpcBalloonBridgePlatform : public CNpcPlatform

View file

@ -92,7 +92,6 @@ void CNpcGeyserPlatformGenerator::think( int _frames )
}
}
newPlatform->setLayerCollision( m_layerCollision );
newPlatform->setTiltable( false );
newPlatform->postInit();
}

View file

@ -67,7 +67,7 @@ void CNpcCartPlatform::processMovement( int _frames )
s32 checkDist = yMovement + 50;
groundHeight = m_layerCollision->getHeightFromGround( Pos.vx + moveX, Pos.vy, checkDist );
groundHeight = CGameScene::getCollision()->getHeightFromGround( Pos.vx + moveX, Pos.vy, checkDist );
if ( groundHeight < checkDist )
{
@ -116,7 +116,7 @@ void CNpcCartPlatform::processMovement( int _frames )
s32 yDiff;
yDiff = m_layerCollision->getHeightFromGround( testPos1.vx, testPos1.vy, sensorDist + 1 );
yDiff = CGameScene::getCollision()->getHeightFromGround( testPos1.vx, testPos1.vy, sensorDist + 1 );
if ( yDiff <= sensorDist )
{
@ -125,7 +125,7 @@ void CNpcCartPlatform::processMovement( int _frames )
testPos1.vy += yDiff;
}
yDiff = m_layerCollision->getHeightFromGround( testPos2.vx, testPos2.vy, sensorDist + 1 );
yDiff = CGameScene::getCollision()->getHeightFromGround( testPos2.vx, testPos2.vy, sensorDist + 1 );
if ( yDiff <= sensorDist )
{

View file

@ -62,7 +62,7 @@ void CNpcFallingPlatform::processMovement( int _frames )
moveY = -moveY;
}
s32 groundHeight = m_layerCollision->getHeightFromGround( Pos.vx + moveX, Pos.vy + moveY, 16 );
s32 groundHeight = CGameScene::getCollision()->getHeightFromGround( Pos.vx + moveX, Pos.vy + moveY, 16 );
if ( groundHeight < moveY )
{

View file

@ -56,11 +56,11 @@ void CNpcFallingNoRespawnPlatform::processMovement( int _frames )
moveY = -moveY;
}
s32 groundHeight = m_layerCollision->getHeightFromGround( Pos.vx + moveX, Pos.vy + moveY, 16 );
s32 groundHeight = CGameScene::getCollision()->getHeightFromGround( Pos.vx + moveX, Pos.vy + moveY, 16 );
if ( groundHeight < moveY )
{
if ( ( m_layerCollision->getCollisionBlock( Pos.vx, Pos.vy + groundHeight + 8 ) & COLLISION_TYPE_MASK ) != (7<<COLLISION_TYPE_FLAG_SHIFT) )
if ( ( CGameScene::getCollision()->getCollisionBlock( Pos.vx, Pos.vy + groundHeight + 8 ) & COLLISION_TYPE_MASK ) != (7<<COLLISION_TYPE_FLAG_SHIFT) )
{
moveY = groundHeight;
moveX = 2 * _frames;

View file

@ -97,7 +97,6 @@ void CNpcFallingPlatformGenerator::think( int _frames )
//startPos.vy = 100;
newPlatform->init( startPos );
ASSERT(m_layerCollision);
while( sourceWaypoint )
{
@ -106,7 +105,6 @@ void CNpcFallingPlatformGenerator::think( int _frames )
}
}
newPlatform->setLayerCollision( m_layerCollision );
newPlatform->setTiltable( false );
newPlatform->postInit();
}

View file

@ -169,9 +169,11 @@ CNpcPlatform *CNpcPlatform::Create(sThingPlatform *ThisPlatform)
{
CNpcPlatform *platform;
NPC_PLATFORM_UNIT_TYPE platformType = getTypeFromMapEdit( ThisPlatform->Type );
NPC_PLATFORM_UNIT_TYPE Type = getTypeFromMapEdit( ThisPlatform->Type );
switch( platformType )
platform = (CNpcPlatform*)CThingManager::GetThing(CThing::TYPE_PLATFORM,Type);
if (!platform)
switch( Type )
{
case NPC_LINEAR_PLATFORM:
{
@ -271,7 +273,7 @@ CNpcPlatform *CNpcPlatform::Create(sThingPlatform *ThisPlatform)
dualPlatformMaster->setOtherPlatform( dualPlatformSlave );
dualPlatformSlave->setOtherPlatform( dualPlatformMaster );
dualPlatformSlave->setType( platformType );
dualPlatformSlave->setType( Type );
dualPlatformSlave->setGraphic( ThisPlatform );
dualPlatformSlave->setTiltable( false );
@ -383,7 +385,8 @@ CNpcPlatform *CNpcPlatform::Create(sThingPlatform *ThisPlatform)
}
ASSERT(platform);
platform->setType( platformType );
platform->setType( Type );
platform->setThingSubType( Type );
platform->setGraphic( ThisPlatform );
platform->setWaypoints( ThisPlatform );
@ -471,8 +474,6 @@ void CNpcPlatform::init()
m_tiltable = false;
m_initRotation = 0;
m_layerCollision = NULL;
m_lifetime = 0;
m_lifetimeType = m_data[m_type].lifetimeType;
@ -664,7 +665,8 @@ void CNpcPlatform::think(int _frames)
void CNpcPlatform::setCollisionAngle(int newAngle)
{
CPlatformThing::setCollisionAngle(newAngle);
m_collisionAngle=newAngle;
// CPlatformThing::setCollisionAngle(newAngle);
calculateBoundingBoxSize();
CPlayer *player;

View file

@ -88,6 +88,10 @@ public:
NPC_CLAM_PLATFORM,
NPC_PLATFORM_TYPE_MAX,
};
enum
{ // For Dynamic ThingCache
MAX_SUBTYPE =NPC_PLATFORM_TYPE_MAX,
};
void init();
void init( DVECTOR initPos );
@ -99,7 +103,6 @@ public:
virtual u8 canDrop() {return true;}
void setType( NPC_PLATFORM_UNIT_TYPE newType ) {m_type = newType;}
void setTypeFromMapEdit( u16 newType );
void setLayerCollision( class CLayerCollision *_layer ) {m_layerCollision=_layer;}
virtual int checkCollisionAgainst(CThing *_thisThing, int _frames);
virtual u8 checkCollisionDelta( CThing *_thisThing, int threshold, CRECT collisionArea );
virtual int getHeightFromPlatformAtPosition(int _x,int _y, int offsetX = 0, int offsetY = 0);
@ -179,8 +182,6 @@ protected:
static s32 playerXDistSqr;
static s32 playerYDistSqr;
class CLayerCollision *m_layerCollision;
// internal variables
NPC_PLATFORM_UNIT_TYPE m_type;
@ -223,10 +224,13 @@ protected:
protected:
virtual void setCollisionAngle(int newAngle); // Actually.. this probly doesn't need to be in the base calss anymore.. :/
virtual void calculateNonRotatedCollisionData();
virtual void calculateBoundingBoxSize();
virtual void setCollisionAngle(int newAngle); // Actually.. this probly doesn't need to be in the base calss anymore.. :/
s16 getCollisionAngle() {return m_collisionAngle;}
s16 m_collisionAngle;
};

View file

@ -66,7 +66,7 @@ void CNpcLeafPlatform::processMovement( int _frames )
moveY = -moveY;
}
s32 groundHeight = m_layerCollision->getHeightFromGround( Pos.vx + moveX, Pos.vy + moveY, 16 );
s32 groundHeight = CGameScene::getCollision()->getHeightFromGround( Pos.vx + moveX, Pos.vy + moveY, 16 );
if ( groundHeight < moveY )
{

View file

@ -55,7 +55,7 @@ void CNpcRaftPlatform::processMovement( int _frames )
{
Pos.vy += _frames;
groundHeight = m_layerCollision->getHeightFromGround( Pos.vx, Pos.vy - 32 );
groundHeight = CGameScene::getCollision()->getHeightFromGround( Pos.vx, Pos.vy - 32 );
if ( groundHeight <= 0 )
{
@ -85,7 +85,7 @@ void CNpcRaftPlatform::processMovement( int _frames )
distX = distX / abs( distX );
if ( m_layerCollision->getHeightFromGround( Pos.vx + ( distX * m_speed * _frames ), Pos.vy ) < -maxHeight )
if ( CGameScene::getCollision()->getHeightFromGround( Pos.vx + ( distX * m_speed * _frames ), Pos.vy ) < -maxHeight )
{
// there is an obstacle in the way, increment the path point (hopefully this will resolve the problem)
@ -95,7 +95,7 @@ void CNpcRaftPlatform::processMovement( int _frames )
{
// check for vertical movement
groundHeight = m_layerCollision->getHeightFromGround( Pos.vx, Pos.vy, yMovement + 16 );
groundHeight = CGameScene::getCollision()->getHeightFromGround( Pos.vx, Pos.vy, yMovement + 16 );
if ( groundHeight <= yMovement )
{
@ -119,7 +119,7 @@ void CNpcRaftPlatform::processMovement( int _frames )
}
else
{
groundHeight = m_layerCollision->getHeightFromGround( Pos.vx, Pos.vy, yMovement + 16 );
groundHeight = CGameScene::getCollision()->getHeightFromGround( Pos.vx, Pos.vy, yMovement + 16 );
if ( groundHeight <= yMovement )
{

View file

@ -61,7 +61,7 @@ void CNpcSteerableBarrelPlatform::processMovement( int _frames )
// check for collision
if ( m_layerCollision->getHeightFromGround( Pos.vx + moveX, Pos.vy ) < -maxHeight )
if ( CGameScene::getCollision()->getHeightFromGround( Pos.vx + moveX, Pos.vy ) < -maxHeight )
{
moveX = 0;
}
@ -80,7 +80,7 @@ void CNpcSteerableBarrelPlatform::processMovement( int _frames )
// check for vertical movement
groundHeight = m_layerCollision->getHeightFromGround( Pos.vx + moveX, Pos.vy, yMovement + 16 );
groundHeight = CGameScene::getCollision()->getHeightFromGround( Pos.vx + moveX, Pos.vy, yMovement + 16 );
if ( groundHeight <= yMovement )
{