SBSPSS/source/platform/pdrop.cpp

77 lines
1.5 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-08-14 17:53:38 +02:00
#ifndef __PAD_VIBE_H__
#include "pad\vibe.h"
#endif
2001-06-05 22:44:30 +02:00
2001-07-12 22:53:17 +02:00
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcDropPlatform::postInit()
{
2001-08-14 17:53:38 +02:00
m_dropHit = true;
2001-07-12 22:53:17 +02:00
CNpcPlatform::postInit();
2001-08-14 17:53:38 +02:00
m_initTimer = 2 * GameState::getOneSecondInFrames();
2001-07-12 22:53:17 +02:00
}
2001-06-05 22:44:30 +02:00
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcDropPlatform::processMovement( int _frames )
{
2001-08-14 17:53:38 +02:00
if ( m_initTimer > 0 )
{
m_initTimer -= _frames;
}
2001-06-05 22:44:30 +02:00
s32 moveY = m_speed * _frames;
2001-08-14 17:53:38 +02:00
s32 groundHeight = CGameScene::getCollision()->getHeightFromGround( Pos.vx, Pos.vy, moveY );
2001-06-05 22:44:30 +02:00
if ( groundHeight < moveY )
{
2001-08-14 17:53:38 +02:00
if ( !m_dropHit && m_initTimer <= 0 )
2001-07-12 22:53:17 +02:00
{
if( m_soundId != NOT_PLAYING )
{
CSoundMediator::stopAndUnlockSfx( (xmPlayingId) m_soundId );
}
m_soundId = (int) CSoundMediator::playSfx( CSoundMediator::SFX_HAZARD__FALLING_ROCK_LAND, true );
2001-08-14 17:53:38 +02:00
CGameScene::setCameraShake(0,8);
CPadVibrationManager::setVibration(0,CPadVibrationManager::VIBE_MEDIUM);
2001-07-12 22:53:17 +02:00
}
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;
}