This commit is contained in:
parent
f04edb8544
commit
c616369ec5
7 changed files with 123 additions and 34 deletions
Binary file not shown.
Binary file not shown.
|
@ -72,6 +72,32 @@ void CNpcCartPlatform::processMovement( int _frames )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( m_inJump )
|
||||||
|
{
|
||||||
|
m_vertSpeed += 64;
|
||||||
|
|
||||||
|
if ( m_vertSpeed > ( 5 << 8 ) )
|
||||||
|
{
|
||||||
|
m_vertSpeed = 5 << 8;
|
||||||
|
}
|
||||||
|
else if ( m_vertSpeed < -( 6 << 8 ) )
|
||||||
|
{
|
||||||
|
m_vertSpeed = -( 6 << 8 );
|
||||||
|
}
|
||||||
|
|
||||||
|
moveY = ( m_vertSpeed >> 8 ) * _frames;
|
||||||
|
|
||||||
|
groundHeight = CGameScene::getCollision()->getHeightFromGround( Pos.vx + moveX, Pos.vy + moveY, 16 );
|
||||||
|
|
||||||
|
if ( groundHeight < 0 )
|
||||||
|
{
|
||||||
|
// have touched down
|
||||||
|
|
||||||
|
m_inJump = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// check for vertical movement
|
// check for vertical movement
|
||||||
|
|
||||||
s32 checkDist = yMovement + 50;
|
s32 checkDist = yMovement + 50;
|
||||||
|
@ -93,7 +119,7 @@ void CNpcCartPlatform::processMovement( int _frames )
|
||||||
|
|
||||||
if ( moveY < 0 )
|
if ( moveY < 0 )
|
||||||
{
|
{
|
||||||
m_carSpeed -= 20;
|
m_carSpeed -= 1;
|
||||||
|
|
||||||
if ( m_carSpeed < ( 2 << 8 ) )
|
if ( m_carSpeed < ( 2 << 8 ) )
|
||||||
{
|
{
|
||||||
|
@ -109,6 +135,7 @@ void CNpcCartPlatform::processMovement( int _frames )
|
||||||
m_carSpeed = ( 6 << 8 );
|
m_carSpeed = ( 6 << 8 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Pos.vx += moveX;
|
Pos.vx += moveX;
|
||||||
Pos.vy += moveY;
|
Pos.vy += moveY;
|
||||||
|
@ -200,3 +227,14 @@ void CNpcCartPlatform::render()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CNpcCartPlatform::jump()
|
||||||
|
{
|
||||||
|
if ( !m_inJump )
|
||||||
|
{
|
||||||
|
m_inJump = true;
|
||||||
|
m_vertSpeed = -6 << 8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -23,11 +23,15 @@ class CNpcCartPlatform : public CNpcPlatform
|
||||||
public:
|
public:
|
||||||
virtual void postInit();
|
virtual void postInit();
|
||||||
virtual void render();
|
virtual void render();
|
||||||
|
virtual u8 isCart() {return( true );}
|
||||||
|
virtual void jump();
|
||||||
protected:
|
protected:
|
||||||
virtual void processMovement( int _frames );
|
virtual void processMovement( int _frames );
|
||||||
|
|
||||||
s32 m_carSpeed;
|
s32 m_carSpeed;
|
||||||
u8 m_isActivated;
|
u8 m_isActivated;
|
||||||
|
u8 m_inJump;
|
||||||
|
s32 m_vertSpeed;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -121,6 +121,8 @@ public:
|
||||||
void setGraphic( u8 graphicNum );
|
void setGraphic( u8 graphicNum );
|
||||||
virtual void setWaypoints( sThingPlatform *ThisPlatform );
|
virtual void setWaypoints( sThingPlatform *ThisPlatform );
|
||||||
virtual void trigger() {;}
|
virtual void trigger() {;}
|
||||||
|
virtual u8 isCart() {return( false );}
|
||||||
|
virtual void jump() {;}
|
||||||
|
|
||||||
static NPC_PLATFORM_UNIT_TYPE getTypeFromMapEdit( u16 newType );
|
static NPC_PLATFORM_UNIT_TYPE getTypeFromMapEdit( u16 newType );
|
||||||
static CNpcPlatform *Create(int Type);
|
static CNpcPlatform *Create(int Type);
|
||||||
|
|
|
@ -727,6 +727,16 @@ if(newmode!=-1)
|
||||||
CThing *platform;
|
CThing *platform;
|
||||||
platform=isOnPlatform();
|
platform=isOnPlatform();
|
||||||
if(platform)
|
if(platform)
|
||||||
|
{
|
||||||
|
if ( ( (CNpcPlatform *) platform )->isCart() )
|
||||||
|
{
|
||||||
|
Pos.vx = platform->getPos().vx;
|
||||||
|
Pos.vy = platform->getPos().vy;
|
||||||
|
|
||||||
|
int platformOffset = ( ( CNpcPlatform* ) platform )->getHeightFromPlatformAtPosition( Pos.vx, Pos.vy );
|
||||||
|
Pos.vy += platformOffset;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
DVECTOR posDelta;
|
DVECTOR posDelta;
|
||||||
posDelta=platform->getPosDelta();
|
posDelta=platform->getPosDelta();
|
||||||
|
@ -741,6 +751,7 @@ if(newmode!=-1)
|
||||||
Pos.vy += platformOffset;
|
Pos.vy += platformOffset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
m_allowConversation=false;
|
m_allowConversation=false;
|
||||||
|
|
|
@ -70,6 +70,10 @@
|
||||||
#include "player\psspring.h"
|
#include "player\psspring.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __PLATFORM_PLATFORM_H__
|
||||||
|
#include "platform\platform.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "game/game.h"
|
#include "game/game.h"
|
||||||
/* Std Lib
|
/* Std Lib
|
||||||
------- */
|
------- */
|
||||||
|
@ -195,7 +199,19 @@ void CPlayerModeBase::think()
|
||||||
{
|
{
|
||||||
getStateTable()[m_currentState]->think(this);
|
getStateTable()[m_currentState]->think(this);
|
||||||
thinkVerticalMovement();
|
thinkVerticalMovement();
|
||||||
|
|
||||||
|
if ( m_player->isOnPlatform() )
|
||||||
|
{
|
||||||
|
CNpcPlatform *platform = (CNpcPlatform *) m_player->isOnPlatform();
|
||||||
|
if ( !platform->isCart() )
|
||||||
|
{
|
||||||
thinkHorizontalMovement();
|
thinkHorizontalMovement();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
thinkHorizontalMovement();
|
||||||
|
}
|
||||||
|
|
||||||
// Teeter if on an edge
|
// Teeter if on an edge
|
||||||
if(canTeeter()&&isOnEdge())
|
if(canTeeter()&&isOnEdge())
|
||||||
|
@ -618,6 +634,24 @@ int CPlayerModeBase::slowdown()
|
||||||
}
|
}
|
||||||
void CPlayerModeBase::jump()
|
void CPlayerModeBase::jump()
|
||||||
{
|
{
|
||||||
|
CNpcPlatform *platform;
|
||||||
|
platform = (CNpcPlatform *) m_player->isOnPlatform();
|
||||||
|
if(platform)
|
||||||
|
{
|
||||||
|
if ( platform->isCart() )
|
||||||
|
{
|
||||||
|
/*Pos.vx = platform->getPos().vx;
|
||||||
|
Pos.vy = platform->getPos().vy;
|
||||||
|
|
||||||
|
int platformOffset = ( ( CNpcPlatform* ) platform )->getHeightFromPlatformAtPosition( Pos.vx, Pos.vy );
|
||||||
|
Pos.vy += platformOffset;*/
|
||||||
|
|
||||||
|
platform->jump();
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
DVECTOR moveVel;
|
DVECTOR moveVel;
|
||||||
moveVel=*m_player->getMoveVelocity();
|
moveVel=*m_player->getMoveVelocity();
|
||||||
moveVel.vy=-getPlayerMetrics()->m_metric[PM__JUMP_VELOCITY]<<VELOCITY_SHIFT;
|
moveVel.vy=-getPlayerMetrics()->m_metric[PM__JUMP_VELOCITY]<<VELOCITY_SHIFT;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue