SBSPSS/source/platform/pgeyser.cpp

90 lines
1.7 KiB
C++
Raw Normal View History

2001-04-23 20:27:08 +02:00
/*=========================================================================
pgeyser.cpp
Author: CRB
Created:
Project: Spongebob
Purpose:
Copyright (c) 2001 Climax Development Ltd
===========================================================================*/
#ifndef __PLATFORM_PGEYSER_H__
#include "platform\pgeyser.h"
#endif
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcGeyserPlatform::postInit()
{
2001-05-05 15:54:34 +02:00
CNpcPlatform::postInit();
2001-04-23 20:27:08 +02:00
m_npcPath.setPathType( CNpcPath::SINGLE_USE_PATH );
2001-04-23 22:40:13 +02:00
m_isFiring = false;
2001-04-23 20:27:08 +02:00
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcGeyserPlatform::processMovement( int _frames )
{
2001-04-23 22:40:13 +02:00
if ( m_isFiring )
{
s32 moveY = 0;
s32 distX, distY, heading;
bool pathComplete;
2001-04-23 20:27:08 +02:00
2001-04-23 22:40:13 +02:00
m_npcPath.thinkVertical( Pos, &pathComplete, &distX, &distY, &heading );
2001-04-23 20:27:08 +02:00
2001-04-23 22:40:13 +02:00
if ( pathComplete )
{
m_npcPath.resetPath();
reinit();
m_isFiring = false;
}
else
{
s32 minY, maxY;
2001-04-23 20:27:08 +02:00
2001-04-23 22:40:13 +02:00
m_npcPath.getPathYExtents( &minY, &maxY );
2001-04-23 20:27:08 +02:00
2001-04-23 22:40:13 +02:00
moveY = m_data[m_type].speed * _frames;
2001-04-23 20:27:08 +02:00
2001-04-23 22:40:13 +02:00
if ( Pos.vy < ( minY + 64 ) )
{
s32 multiplier = Pos.vy - minY;
moveY = ( multiplier * moveY ) >> 6;
2001-04-23 20:27:08 +02:00
2001-04-23 22:40:13 +02:00
if ( moveY < 1 )
{
moveY = 1;
}
}
2001-04-23 20:27:08 +02:00
2001-04-23 22:40:13 +02:00
if ( heading == 3072 )
2001-04-23 20:27:08 +02:00
{
2001-04-23 22:40:13 +02:00
moveY = -moveY;
2001-04-23 20:27:08 +02:00
}
2001-04-23 22:40:13 +02:00
Pos.vy += moveY;
2001-04-23 20:27:08 +02:00
}
2001-04-23 22:40:13 +02:00
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2001-04-23 20:27:08 +02:00
2001-04-23 22:40:13 +02:00
void CNpcGeyserPlatform::processTimer( int _frames )
{
if ( m_timer > 0 )
{
m_timer -= _frames;
}
else
{
m_isFiring = true;
2001-04-23 20:27:08 +02:00
}
2001-04-23 22:40:13 +02:00
}