This commit is contained in:
parent
367505e887
commit
4c0a773f2a
@ -169,7 +169,7 @@ void CNpcGaryFriend::think( int _frames )
|
|||||||
|
|
||||||
if ( m_started )
|
if ( m_started )
|
||||||
{
|
{
|
||||||
CSoundMediator::playSfx( CSoundMediator::SFX_GARY_DE_SNAIL );
|
//CSoundMediator::playSfx( CSoundMediator::SFX_GARY_DE_SNAIL );
|
||||||
|
|
||||||
Pos.vx += multiplier * 2 * _frames;
|
Pos.vx += multiplier * 2 * _frames;
|
||||||
}
|
}
|
||||||
@ -195,7 +195,7 @@ void CNpcGaryFriend::think( int _frames )
|
|||||||
{
|
{
|
||||||
if ( m_started )
|
if ( m_started )
|
||||||
{
|
{
|
||||||
CSoundMediator::playSfx( CSoundMediator::SFX_GARY_DE_SNAIL );
|
//CSoundMediator::playSfx( CSoundMediator::SFX_GARY_DE_SNAIL );
|
||||||
|
|
||||||
Pos.vx += multiplier * 2 * _frames;
|
Pos.vx += multiplier * 2 * _frames;
|
||||||
}
|
}
|
||||||
|
@ -233,7 +233,7 @@ void CPlayerModeNet::think()
|
|||||||
|
|
||||||
projectile->init( launchPos,
|
projectile->init( launchPos,
|
||||||
fireHeading,
|
fireHeading,
|
||||||
CPlayerProjectile::PLAYER_PROJECTILE_DUMBFIRE,
|
CPlayerProjectile::PLAYER_PROJECTILE_BOUNCING,
|
||||||
CPlayerProjectile::PLAYER_PROJECTILE_FINITE_LIFE,
|
CPlayerProjectile::PLAYER_PROJECTILE_FINITE_LIFE,
|
||||||
5*60);
|
5*60);
|
||||||
|
|
||||||
|
@ -419,6 +419,9 @@ void CPlayerProjectile::init( DVECTOR initPos, s16 initHeading )
|
|||||||
|
|
||||||
m_heading = initHeading;
|
m_heading = initHeading;
|
||||||
m_initPos = Pos = initPos;
|
m_initPos = Pos = initPos;
|
||||||
|
m_vertVelocity = 0;
|
||||||
|
m_bounceCount = 0;
|
||||||
|
m_hitTarget = false;
|
||||||
|
|
||||||
if ( m_heading > 1024 && m_heading < 3072 )
|
if ( m_heading > 1024 && m_heading < 3072 )
|
||||||
{
|
{
|
||||||
@ -489,6 +492,68 @@ void CPlayerProjectile::think(int _frames)
|
|||||||
|
|
||||||
switch( m_movementType )
|
switch( m_movementType )
|
||||||
{
|
{
|
||||||
|
case PLAYER_PROJECTILE_BOUNCING:
|
||||||
|
{
|
||||||
|
if ( !m_hitTarget )
|
||||||
|
{
|
||||||
|
Pos.vx += ( _frames * 5 * rcos( m_heading ) ) >> 12;
|
||||||
|
|
||||||
|
m_vertVelocity += 128;
|
||||||
|
|
||||||
|
if ( m_vertVelocity > ( 5 << 8 ) )
|
||||||
|
{
|
||||||
|
m_vertVelocity = 5 << 8;
|
||||||
|
}
|
||||||
|
else if ( m_vertVelocity < -( 5 << 8 ) )
|
||||||
|
{
|
||||||
|
m_vertVelocity = -( 5 << 8 );
|
||||||
|
}
|
||||||
|
|
||||||
|
s16 moveY = ( m_vertVelocity >> 8 ) * _frames;
|
||||||
|
|
||||||
|
s32 groundHeight = CGameScene::getCollision()->getHeightFromGround( Pos.vx, Pos.vy + moveY, 32 );
|
||||||
|
|
||||||
|
if ( groundHeight < 0 )
|
||||||
|
{
|
||||||
|
// destroy destructable tiles
|
||||||
|
|
||||||
|
CLevel &level = GameScene.GetLevel();
|
||||||
|
|
||||||
|
level.destroyMapArea( Pos );
|
||||||
|
|
||||||
|
if ( groundHeight < -16 )
|
||||||
|
{
|
||||||
|
m_hitTarget = true;
|
||||||
|
m_lifetimeType = PLAYER_PROJECTILE_FINITE_LIFE;
|
||||||
|
m_lifetime = GameState::getOneSecondInFrames() >> 2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// reverse vertical velocity
|
||||||
|
|
||||||
|
m_vertVelocity = -m_vertVelocity;
|
||||||
|
|
||||||
|
if ( m_bounceCount > 2 )
|
||||||
|
{
|
||||||
|
m_hitTarget = true;
|
||||||
|
m_lifetimeType = PLAYER_PROJECTILE_FINITE_LIFE;
|
||||||
|
m_lifetime = GameState::getOneSecondInFrames() >> 2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_bounceCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Pos.vy += moveY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case PLAYER_PROJECTILE_DUMBFIRE:
|
case PLAYER_PROJECTILE_DUMBFIRE:
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
@ -531,11 +596,22 @@ void CPlayerProjectile::render()
|
|||||||
int x,y;
|
int x,y;
|
||||||
int scrnWidth = VidGetScrW();
|
int scrnWidth = VidGetScrW();
|
||||||
int scrnHeight = VidGetScrH();
|
int scrnHeight = VidGetScrH();
|
||||||
int spriteWidth = CGameScene::getSpriteBank()->getFrameWidth(m_frame);
|
|
||||||
int spriteHeight = CGameScene::getSpriteBank()->getFrameHeight(m_frame);
|
|
||||||
|
|
||||||
offset = getScreenOffset();
|
offset = getScreenOffset();
|
||||||
|
|
||||||
|
if ( m_hitTarget )
|
||||||
|
{
|
||||||
|
x = Pos.vx - offset.vx;
|
||||||
|
y = Pos.vy - offset.vy;
|
||||||
|
|
||||||
|
SprFrame = CGameScene::getSpriteBank()->printRotatedScaledSprite( FRM__BALLOONBURST, x, y, 4096 << 1, 4096 << 1, 0, 0 );
|
||||||
|
setRGB0( SprFrame, m_RGB.r, m_RGB.g, m_RGB.b );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int spriteWidth = CGameScene::getSpriteBank()->getFrameWidth(m_frame);
|
||||||
|
int spriteHeight = CGameScene::getSpriteBank()->getFrameHeight(m_frame);
|
||||||
|
|
||||||
if ( m_reversed )
|
if ( m_reversed )
|
||||||
{
|
{
|
||||||
x = Pos.vx - offset.vx + ( spriteWidth >> 1 );
|
x = Pos.vx - offset.vx + ( spriteWidth >> 1 );
|
||||||
@ -555,6 +631,7 @@ void CPlayerProjectile::render()
|
|||||||
SprFrame = CGameScene::getSpriteBank()->printFT4(FRM_JELLYFISH1_SWIM1 + m_frame,x,y,m_reversed,0,0);
|
SprFrame = CGameScene::getSpriteBank()->printFT4(FRM_JELLYFISH1_SWIM1 + m_frame,x,y,m_reversed,0,0);
|
||||||
setRGB0( SprFrame, m_RGB.r, m_RGB.g, m_RGB.b );
|
setRGB0( SprFrame, m_RGB.r, m_RGB.g, m_RGB.b );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
DVECTOR CPlayerProjectile::getScreenOffset()
|
DVECTOR CPlayerProjectile::getScreenOffset()
|
||||||
{
|
{
|
||||||
|
@ -92,6 +92,7 @@ public:
|
|||||||
enum PLAYER_PROJECTILE_MOVEMENT_TYPE
|
enum PLAYER_PROJECTILE_MOVEMENT_TYPE
|
||||||
{
|
{
|
||||||
PLAYER_PROJECTILE_DUMBFIRE = 0,
|
PLAYER_PROJECTILE_DUMBFIRE = 0,
|
||||||
|
PLAYER_PROJECTILE_BOUNCING = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum PLAYER_PROJECTILE_LIFETIME_TYPE
|
enum PLAYER_PROJECTILE_LIFETIME_TYPE
|
||||||
@ -135,6 +136,9 @@ protected:
|
|||||||
POLY_FT4 *SprFrame;
|
POLY_FT4 *SprFrame;
|
||||||
u8 m_reversed;
|
u8 m_reversed;
|
||||||
CVECTOR m_RGB;
|
CVECTOR m_RGB;
|
||||||
|
s16 m_vertVelocity;
|
||||||
|
u8 m_bounceCount;
|
||||||
|
u8 m_hitTarget;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user