This commit is contained in:
parent
6120b9bab8
commit
d81378013f
4 changed files with 220 additions and 0 deletions
78
source/platform/pbwheel.cpp
Normal file
78
source/platform/pbwheel.cpp
Normal file
|
@ -0,0 +1,78 @@
|
|||
/*=========================================================================
|
||||
|
||||
pbwheel.cpp
|
||||
|
||||
Author: CRB
|
||||
Created:
|
||||
Project: Spongebob
|
||||
Purpose:
|
||||
|
||||
Copyright (c) 2001 Climax Development Ltd
|
||||
|
||||
===========================================================================*/
|
||||
|
||||
#ifndef __PLATFORM_PBWHEEL_H__
|
||||
#include "platform\pbwheel.h"
|
||||
#endif
|
||||
|
||||
#ifndef __UTILS_HEADER__
|
||||
#include "utils\utils.h"
|
||||
#endif
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void CNpcBigWheelPlatform::processMovement( int _frames )
|
||||
{
|
||||
m_rotation += m_data[m_type].speed * _frames;
|
||||
m_rotation &= 4095;
|
||||
|
||||
Pos.vx = m_base.vx + ( ( m_extension * rcos( m_rotation ) ) >> 12 );
|
||||
Pos.vy = m_base.vy + ( ( m_extension * rsin( m_rotation ) ) >> 12 );
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void CNpcBigWheelPlatform::setWaypoints( sThingPlatform *ThisPlatform )
|
||||
{
|
||||
int pointNum;
|
||||
|
||||
u16 *PntList=(u16*)MakePtr(ThisPlatform,sizeof(sThingPlatform));
|
||||
|
||||
u16 newXPos, newYPos;
|
||||
|
||||
newXPos = (u16) *PntList;
|
||||
PntList++;
|
||||
newYPos = (u16) *PntList;
|
||||
PntList++;
|
||||
|
||||
DVECTOR startPos;
|
||||
startPos.vx = newXPos << 4;
|
||||
startPos.vy = newYPos << 4;
|
||||
|
||||
if ( ThisPlatform->PointCount > 1 )
|
||||
{
|
||||
newXPos = (u16) *PntList;
|
||||
PntList++;
|
||||
newYPos = (u16) *PntList;
|
||||
PntList++;
|
||||
|
||||
DVECTOR pivotPos;
|
||||
pivotPos.vx = newXPos << 4;
|
||||
pivotPos.vy = newYPos << 4;
|
||||
|
||||
s32 xDist = startPos.vx - pivotPos.vx;
|
||||
s32 yDist = startPos.vy - pivotPos.vy;
|
||||
|
||||
init( pivotPos );
|
||||
|
||||
m_rotation = ratan2( abs( yDist ), abs( xDist ) );
|
||||
|
||||
m_extension = isqrt2( ( xDist * xDist ) + ( yDist * yDist ) );
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
init( startPos );
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue