This commit is contained in:
Charles 2001-07-03 18:32:04 +00:00
parent cbfc0e6fa9
commit 9a0ce0adc6
11 changed files with 81 additions and 229 deletions

View file

@ -28,25 +28,33 @@
void CNpcBubblePlatform::postInit()
{
CNpcPlatform::postInit();
setCollisionSize( 30, 30 );
setCollisionCentreOffset( 0, -15 );
calculateNonRotatedCollisionData();
setCollisionAngle( m_tiltAngle >> 8 );
m_pop = false;
m_scale = ONE;
}
s32 minX, maxX, minY, maxY;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
m_npcPath.getPathXExtents( &minX, &maxX );
m_npcPath.getPathYExtents( &minY, &maxY );
void CNpcBubblePlatform::shutdown()
{
if ( m_soundId != NOT_PLAYING )
{
CSoundMediator::stopAndUnlockSfx( (xmPlayingId) m_soundId );
}
m_thinkArea.x1 = minX;
m_thinkArea.x2 = maxX;
m_thinkArea.y1 = minY;
m_thinkArea.y2 = maxY;
CPlatformThing::shutdown();
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcBubblePlatform::render()
{
SprFrame=0;
if ( m_isActive || m_pop )
{
CPlatformThing::render();
@ -58,15 +66,14 @@ void CNpcBubblePlatform::render()
if ( m_pop )
{
POLY_FT4 *SprFrame = CGameScene::getSpriteBank()->printRotatedScaledSprite( FRM__BALLOONBURST, renderPos.vx, renderPos.vy - 16, 4096 << 1, 4096 << 1, 0, 10 );
SprFrame = CGameScene::getSpriteBank()->printRotatedScaledSprite( FRM__BALLOONBURST, renderPos.vx, renderPos.vy - 16, 4096 << 1, 4096 << 1, 0, 10 );
setRGB0( SprFrame, 128, 128, 255 );
}
else
{
// Evil hard coded Offsets
POLY_FT4 *SprFrame = CGameScene::getSpriteBank()->printFT4( FRM__BUBBLE_1, renderPos.vx-16, renderPos.vy-32, 0, 0, 10 );
POLY_FT4 *SprFrame = CGameScene::getSpriteBank()->printRotatedScaledSprite( FRM__BUBBLE_1, renderPos.vx, renderPos.vy - 16, m_scale, ONE, 0, 10 );
setRGB0( SprFrame, 128, 128, 255 );
// m_modelGfx->Render(renderPos);
}
}
}
@ -74,57 +81,43 @@ void CNpcBubblePlatform::render()
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcBubblePlatform::processMovement( int _frames )
int CNpcBubblePlatform::checkCollisionAgainst(CThing *_thisThing, int _frames)
{
if ( !isSetToShutdown() && !m_pop )
switch(_thisThing->getThingType())
{
Pos.vy -= m_speed * _frames;
case TYPE_PLAYERPROJECTILE:
return( false );
if ( m_npcPath.getWaypointCount() )
default:
{
s32 minY, maxY;
int collided = false;
m_npcPath.getPathYExtents( &minY, &maxY );
if ( Pos.vy < minY )
if ( m_detectCollision && m_isActive && !isSetToShutdown() && !m_pop )
{
m_lifetime = GameState::getOneSecondInFrames() >> 2;
m_pop = true;
CRECT thisRect, thatRect;
thisRect = getCollisionArea();
thatRect = _thisThing->getCollisionArea();
DVECTOR posDelta = getPosDelta();
thisRect.y1 -= abs( posDelta.vy ) >> 1;
thisRect.y2 += abs( posDelta.vy ) >> 1;
posDelta = _thisThing->getPosDelta();
thatRect.y1 -= abs( posDelta.vy ) >> 1;
thatRect.y2 += abs( posDelta.vy ) >> 1;
if(((thisRect.x1>=thatRect.x1&&thisRect.x1<=thatRect.x2)||(thisRect.x2>=thatRect.x1&&thisRect.x2<=thatRect.x2)||(thisRect.x1<=thatRect.x1&&thisRect.x2>=thatRect.x2))&&
((thisRect.y1>=thatRect.y1&&thisRect.y1<=thatRect.y2)||(thisRect.y2>=thatRect.y1&&thisRect.y2<=thatRect.y2)||(thisRect.y1<=thatRect.y1&&thisRect.y2>=thatRect.y2)))
{
collided = true;
}
}
}
else
{
if ( Pos.vy < 0 )
{
m_lifetime = GameState::getOneSecondInFrames() >> 2;
m_pop = true;
}
}
DVECTOR offset = CLevel::getCameraPos();
s32 yPos = Pos.vy - offset.vy;
if ( yPos < 0 )
{
setToShutdown();
return( collided );
}
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcBubblePlatform::processLifetime( int _frames )
{
if ( m_pop )
{
if ( m_lifetime <= 0 )
{
setToShutdown();
}
else
{
m_lifetime = 0;
}
}
}