This commit is contained in:
parent
700c91949e
commit
160b480252
2 changed files with 96 additions and 0 deletions
67
source/platform/pgeyser.cpp
Normal file
67
source/platform/pgeyser.cpp
Normal file
|
@ -0,0 +1,67 @@
|
|||
/*=========================================================================
|
||||
|
||||
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()
|
||||
{
|
||||
m_npcPath.setPathType( CNpcPath::SINGLE_USE_PATH );
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void CNpcGeyserPlatform::processMovement( int _frames )
|
||||
{
|
||||
s32 moveY = 0;
|
||||
s32 distX, distY, heading;
|
||||
bool pathComplete;
|
||||
|
||||
m_npcPath.thinkVertical( Pos, &pathComplete, &distX, &distY, &heading );
|
||||
|
||||
if ( pathComplete )
|
||||
{
|
||||
m_npcPath.resetPath();
|
||||
reinit();
|
||||
}
|
||||
else
|
||||
{
|
||||
s32 minY, maxY;
|
||||
|
||||
m_npcPath.getPathYExtents( &minY, &maxY );
|
||||
|
||||
moveY = m_data[m_type].speed * _frames;
|
||||
|
||||
if ( Pos.vy < ( minY + 64 ) )
|
||||
{
|
||||
s32 multiplier = Pos.vy - minY;
|
||||
|
||||
moveY = ( multiplier * moveY ) >> 6;
|
||||
|
||||
if ( moveY < 1 )
|
||||
{
|
||||
moveY = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if ( heading == 3072 )
|
||||
{
|
||||
moveY = -moveY;
|
||||
}
|
||||
|
||||
Pos.vy += moveY;
|
||||
}
|
||||
}
|
29
source/platform/pgeyser.h
Normal file
29
source/platform/pgeyser.h
Normal file
|
@ -0,0 +1,29 @@
|
|||
/*=========================================================================
|
||||
|
||||
pgeyser.h
|
||||
|
||||
Author: CRB
|
||||
Created:
|
||||
Project: Spongebob
|
||||
Purpose:
|
||||
|
||||
Copyright (c) 2001 Climax Development Ltd
|
||||
|
||||
===========================================================================*/
|
||||
|
||||
#ifndef __PLATFORM_PGEYSER_H__
|
||||
#define __PLATFORM_PGEYSER_H__
|
||||
|
||||
#ifndef __PLATFORM_PLATFORM_H__
|
||||
#include "platform\platform.h"
|
||||
#endif
|
||||
|
||||
class CNpcGeyserPlatform : public CNpcPlatform
|
||||
{
|
||||
public:
|
||||
virtual void postInit();
|
||||
protected:
|
||||
virtual void processMovement( int _frames );
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue