SBSPSS/source/platform/pdrop.cpp

63 lines
1.3 KiB
C++
Raw Normal View History

2001-06-05 22:44:30 +02:00
/*=========================================================================
pdrop.cpp
Author: CRB
Created:
Project: Spongebob
Purpose:
Copyright (c) 2001 Climax Development Ltd
===========================================================================*/
#ifndef __PLATFORM_PDROP_H__
#include "platform\pdrop.h"
#endif
#ifndef __GAME_GAME_H__
#include "game\game.h"
#endif
2001-07-12 22:53:17 +02:00
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcDropPlatform::postInit()
{
m_dropHit = false;
CNpcPlatform::postInit();
}
2001-06-05 22:44:30 +02:00
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcDropPlatform::processMovement( int _frames )
{
s32 moveY = m_speed * _frames;
s32 groundHeight = CGameScene::getCollision()->getHeightFromGround( Pos.vx, Pos.vy + moveY, 16 );
if ( groundHeight < moveY )
{
2001-07-12 22:53:17 +02:00
if ( !m_dropHit )
{
if( m_soundId != NOT_PLAYING )
{
CSoundMediator::stopAndUnlockSfx( (xmPlayingId) m_soundId );
}
m_soundId = (int) CSoundMediator::playSfx( CSoundMediator::SFX_HAZARD__FALLING_ROCK_LAND, true );
}
m_dropHit = true;
2001-06-05 22:44:30 +02:00
moveY = groundHeight;
}
2001-07-12 22:53:17 +02:00
else
{
m_dropHit = false;
}
2001-06-05 22:44:30 +02:00
Pos.vy += moveY;
}