diff --git a/source/platform/psbarrel.cpp b/source/platform/psbarrel.cpp index 28927fba7..eb4ae2d6e 100644 --- a/source/platform/psbarrel.cpp +++ b/source/platform/psbarrel.cpp @@ -56,7 +56,7 @@ void CNpcSteerableBarrelPlatform::processMovement( int _frames ) { DVECTOR playerPos = player->getPos(); - DVECTOR *playerVel = player->getMoveVelocity(); + s32 playerMovement = player->getMovement(); /*s32 speedChange = -playerVel->vx << 8; @@ -80,7 +80,7 @@ void CNpcSteerableBarrelPlatform::processMovement( int _frames ) m_currentSpeed = -( m_speed << 8 ); }*/ - m_currentSpeed = -playerVel->vx << 4; + m_currentSpeed = -playerMovement; /*s32 playerX = playerPos.vx - this->Pos.vx; @@ -130,17 +130,17 @@ void CNpcSteerableBarrelPlatform::processMovement( int _frames ) moveX = m_moveXHighRes >> 8; m_moveXHighRes -= moveX << 8;*/ - moveX = ( m_currentSpeed * _frames ) >> 8; + moveX = m_currentSpeed; // check for collision - if ( CGameScene::getCollision()->getHeightFromGround( Pos.vx + moveX, Pos.vy + 14 ) < -maxHeight ) + if ( CGameScene::getCollision()->getHeightFromGround( Pos.vx + moveX, Pos.vy ) < -maxHeight ) { moveX = 0; m_currentSpeed = 0; } - m_rotation += ( m_currentSpeed * 30 * _frames ) >> 10; + m_rotation += ( m_currentSpeed * 30 * _frames ) >> 2; m_rotation &= 4095; if ( m_contact ) @@ -153,7 +153,7 @@ void CNpcSteerableBarrelPlatform::processMovement( int _frames ) // check for vertical movement - groundHeight = CGameScene::getCollision()->getHeightFromGround( Pos.vx + moveX, Pos.vy + 14, yMovement + 16 ); + groundHeight = CGameScene::getCollision()->getHeightFromGround( Pos.vx + moveX, Pos.vy, yMovement + 16 ); if ( groundHeight <= yMovement ) { diff --git a/source/platform/psoil.cpp b/source/platform/psoil.cpp index fb3228d91..19bcb9656 100644 --- a/source/platform/psoil.cpp +++ b/source/platform/psoil.cpp @@ -46,7 +46,7 @@ void CNpcSteerableOildrumPlatform::processMovement( int _frames ) { DVECTOR playerPos = player->getPos(); - DVECTOR *playerVel = player->getMoveVelocity(); + s32 playerMovement = player->getMovement(); /*s32 speedChange = -playerVel->vx << 8; @@ -70,7 +70,8 @@ void CNpcSteerableOildrumPlatform::processMovement( int _frames ) m_currentSpeed = -( m_speed << 8 ); }*/ - m_currentSpeed = -playerVel->vx << 4; + //m_currentSpeed = -playerVel->vx << 4; + m_currentSpeed = -playerMovement; /*s32 playerX = playerPos.vx - this->Pos.vx; @@ -120,17 +121,17 @@ void CNpcSteerableOildrumPlatform::processMovement( int _frames ) moveX = m_moveXHighRes >> 8; m_moveXHighRes -= moveX << 8;*/ - moveX = ( m_currentSpeed * _frames ) >> 8; + moveX = m_currentSpeed; // check for collision - if ( CGameScene::getCollision()->getHeightFromGround( Pos.vx + moveX, Pos.vy + 20 ) < -maxHeight ) + if ( CGameScene::getCollision()->getHeightFromGround( Pos.vx + moveX, Pos.vy ) < -maxHeight ) { moveX = 0; m_currentSpeed = 0; } - m_rotation += ( m_currentSpeed * 30 * _frames ) >> 10; + m_rotation += ( m_currentSpeed * 30 * _frames ) >> 2; m_rotation &= 4095; if ( m_contact ) @@ -143,7 +144,7 @@ void CNpcSteerableOildrumPlatform::processMovement( int _frames ) // check for vertical movement - groundHeight = CGameScene::getCollision()->getHeightFromGround( Pos.vx + moveX, Pos.vy + 20, yMovement + 16 ); + groundHeight = CGameScene::getCollision()->getHeightFromGround( Pos.vx + moveX, Pos.vy, yMovement + 16 ); if ( groundHeight <= yMovement ) { diff --git a/source/player/player.cpp b/source/player/player.cpp index 1d485cbbe..38758cda1 100644 --- a/source/player/player.cpp +++ b/source/player/player.cpp @@ -741,6 +741,9 @@ if(newmode!=-1) m_tryingToManuallyPickupWeapon=false; m_tryingToAutomaticallyPickupWeapon=false; + + m_xMove = Pos.vx; + for(i=0;i<_frames;i++) { updatePadInput(); @@ -1022,6 +1025,8 @@ if(newmode!=-1) playAnimFrameSfx(m_animNo,m_animFrame); } + m_xMove = Pos.vx - m_xMove; + // Out of water and wearing helmet..? ASSERT(!(getIsInWater()==false&&isWearingDivingHelmet()==false)); if(isWearingDivingHelmet()&&getIsInWater()==false&& diff --git a/source/player/player.h b/source/player/player.h index 1b3cc879c..8ff900586 100644 --- a/source/player/player.h +++ b/source/player/player.h @@ -455,6 +455,15 @@ public: private: class FontBank *m_fontBank; + +public: + + // Movement tracking for barrels + + s32 getMovement() {return( m_xMove );} + +private: + s32 m_xMove; };