This commit is contained in:
parent
3ab73bd6e1
commit
bcc448ecca
1 changed files with 69 additions and 32 deletions
|
@ -829,7 +829,12 @@ if(newmode!=-1)
|
||||||
// Out of spats?
|
// Out of spats?
|
||||||
if(m_numSpatulasHeld==0)
|
if(m_numSpatulasHeld==0)
|
||||||
{
|
{
|
||||||
|
int oldTimer=m_spatulaWarningTimer;
|
||||||
m_spatulaWarningTimer++;
|
m_spatulaWarningTimer++;
|
||||||
|
if((m_spatulaWarningTimer&64)!=(oldTimer&64))
|
||||||
|
{
|
||||||
|
CSoundMediator::playSfx(CSoundMediator::SFX_BEEP10);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Trying to converate?
|
// Trying to converate?
|
||||||
|
@ -854,32 +859,26 @@ if(newmode!=-1)
|
||||||
|
|
||||||
|
|
||||||
// Is player stood on any special collision?
|
// Is player stood on any special collision?
|
||||||
if(getHeightFromGroundNoPlatform(Pos.vx,Pos.vy,5)==0)
|
for(int j=0;j<2;j++)
|
||||||
{
|
{
|
||||||
int block;
|
int x=Pos.vx+((j==0)?-checkx:+checkx);
|
||||||
block=CGameScene::getCollision()->getCollisionBlock(Pos.vx,Pos.vy)&COLLISION_TYPE_MASK;
|
if(getHeightFromGroundNoPlatform(x,Pos.vy,5)==0)
|
||||||
|
{
|
||||||
|
int block;
|
||||||
|
block=CGameScene::getCollision()->getCollisionBlock(x,Pos.vy)&COLLISION_TYPE_MASK;
|
||||||
|
|
||||||
// Conveyor belt movement
|
// Conveyor belt movement
|
||||||
if(block==COLLISION_TYPE_FLAG_MOVE_LEFT)
|
if(block==COLLISION_TYPE_FLAG_MOVE_LEFT)
|
||||||
{
|
{
|
||||||
moveHorizontal(-1);
|
moveHorizontal(-1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else if(block==COLLISION_TYPE_FLAG_MOVE_RIGHT)
|
||||||
|
{
|
||||||
|
moveHorizontal(+1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if(block==COLLISION_TYPE_FLAG_MOVE_RIGHT)
|
|
||||||
{
|
|
||||||
moveHorizontal(+1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Death?
|
|
||||||
/*else if(m_currentMode!=PLAYER_MODE_DEAD&&
|
|
||||||
block==COLLISION_TYPE_FLAG_DEATH_LIQUID)
|
|
||||||
{
|
|
||||||
dieYouPorousFreak(DEATHTYPE__LIQUID);
|
|
||||||
}
|
|
||||||
else if(m_currentMode!=PLAYER_MODE_DEAD&&
|
|
||||||
block==COLLISION_TYPE_FLAG_DEATH_INSTANT)
|
|
||||||
{
|
|
||||||
dieYouPorousFreak(DEATHTYPE__NORMAL);
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Powerups
|
// Powerups
|
||||||
|
@ -1090,10 +1089,16 @@ if(newmode!=-1)
|
||||||
// Out of water and wearing helmet!
|
// Out of water and wearing helmet!
|
||||||
|
|
||||||
// Drain water/health
|
// Drain water/health
|
||||||
|
int oldLevel=m_healthWaterLevel/WATER_COUNTER_SECONDTIME;
|
||||||
m_healthWaterLevel-=waterDrainSpeed*_frames;
|
m_healthWaterLevel-=waterDrainSpeed*_frames;
|
||||||
|
if(oldLevel<=6&&oldLevel>m_healthWaterLevel/WATER_COUNTER_SECONDTIME)
|
||||||
|
{
|
||||||
|
CSoundMediator::playSfx(CSoundMediator::SFX_BEEP5);
|
||||||
|
}
|
||||||
if(m_healthWaterLevel<=0)
|
if(m_healthWaterLevel<=0)
|
||||||
{
|
{
|
||||||
dieYouPorousFreak(DEATHTYPE__DRYUP);
|
dieYouPorousFreak(DEATHTYPE__DRYUP);
|
||||||
|
CSoundMediator::playSfx(CSoundMediator::SFX_BEEP5);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Breath sound
|
// Breath sound
|
||||||
|
@ -2779,6 +2784,7 @@ int CPlayer::moveVertical(int _moveDistance)
|
||||||
Params:
|
Params:
|
||||||
Returns:
|
Returns:
|
||||||
---------------------------------------------------------------------- */
|
---------------------------------------------------------------------- */
|
||||||
|
int checkside=+1;
|
||||||
int CPlayer::moveHorizontal(int _moveDistance)
|
int CPlayer::moveHorizontal(int _moveDistance)
|
||||||
{
|
{
|
||||||
int hitWall;
|
int hitWall;
|
||||||
|
@ -2796,13 +2802,13 @@ int CPlayer::moveHorizontal(int _moveDistance)
|
||||||
dirToMove=_moveDistance<0?-1:+1;
|
dirToMove=_moveDistance<0?-1:+1;
|
||||||
for(i=abs(_moveDistance);i&&!hitWall;i--)
|
for(i=abs(_moveDistance);i&&!hitWall;i--)
|
||||||
{
|
{
|
||||||
int touchingGround,x;
|
int touchingGround,x,x2;
|
||||||
|
|
||||||
colHeightEdges[0]=getHeightFromGround(pos.vx-checkx,pos.vy,16);
|
colHeightEdges[0]=getHeightFromGround(pos.vx-checkx,pos.vy,16);
|
||||||
colHeightEdges[1]=getHeightFromGround(pos.vx+checkx,pos.vy,16);
|
colHeightEdges[1]=getHeightFromGround(pos.vx+checkx,pos.vy,16);
|
||||||
|
|
||||||
touchingGround=false;
|
touchingGround=false;
|
||||||
x=pos.vx+dirToMove;
|
x=x2=pos.vx+dirToMove;
|
||||||
|
|
||||||
if(dirToMove>0)
|
if(dirToMove>0)
|
||||||
{
|
{
|
||||||
|
@ -2811,12 +2817,14 @@ int CPlayer::moveHorizontal(int _moveDistance)
|
||||||
{
|
{
|
||||||
// Right side of SB touching ground
|
// Right side of SB touching ground
|
||||||
x+=checkx;
|
x+=checkx;
|
||||||
|
x2-=checkx;
|
||||||
touchingGround=true;
|
touchingGround=true;
|
||||||
}
|
}
|
||||||
else if(colHeightEdges[0]==0)
|
else if(colHeightEdges[0]==0)
|
||||||
{
|
{
|
||||||
// Left side of SB touching ground
|
// Left side of SB touching ground
|
||||||
x-=checkx;
|
x-=checkx;
|
||||||
|
x2+=checkx;
|
||||||
touchingGround=true;
|
touchingGround=true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2827,12 +2835,14 @@ int CPlayer::moveHorizontal(int _moveDistance)
|
||||||
{
|
{
|
||||||
// Left side of SB touching ground
|
// Left side of SB touching ground
|
||||||
x-=checkx;
|
x-=checkx;
|
||||||
|
x2+=checkx;
|
||||||
touchingGround=true;
|
touchingGround=true;
|
||||||
}
|
}
|
||||||
else if(colHeightEdges[1]==0)
|
else if(colHeightEdges[1]==0)
|
||||||
{
|
{
|
||||||
// Right side of SB touching ground
|
// Right side of SB touching ground
|
||||||
x+=checkx;
|
x+=checkx;
|
||||||
|
x2-=checkx;
|
||||||
touchingGround=true;
|
touchingGround=true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2846,6 +2856,13 @@ int CPlayer::moveHorizontal(int _moveDistance)
|
||||||
// Move along the ground
|
// Move along the ground
|
||||||
pos.vx+=dirToMove;
|
pos.vx+=dirToMove;
|
||||||
pos.vy+=colHeight;
|
pos.vy+=colHeight;
|
||||||
|
|
||||||
|
// Heh - these 4 lines stop SB going down a slope on the 'wrong edge' :)
|
||||||
|
colHeight=getHeightFromGround(x2,pos.vy,16);
|
||||||
|
if(colHeight<0)
|
||||||
|
{
|
||||||
|
pos.vy+=colHeight;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if(colHeight<0)
|
else if(colHeight<0)
|
||||||
{
|
{
|
||||||
|
@ -2856,6 +2873,7 @@ int CPlayer::moveHorizontal(int _moveDistance)
|
||||||
{
|
{
|
||||||
// Moved off edge of ledge
|
// Moved off edge of ledge
|
||||||
pos.vx+=dirToMove;
|
pos.vx+=dirToMove;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2869,16 +2887,35 @@ int CPlayer::moveHorizontal(int _moveDistance)
|
||||||
{
|
{
|
||||||
x+=checkx;
|
x+=checkx;
|
||||||
}
|
}
|
||||||
colHeight=getHeightFromGround(x,pos.vy,16);
|
|
||||||
if(colHeight>=0)
|
// Head collision ( cheers Charles! :)
|
||||||
|
colHeight = getHeightFromGround( x, pos.vy-HEIGHT_FOR_HEAD_COLLISION, 16 );
|
||||||
|
if ( colHeight < 0 )
|
||||||
{
|
{
|
||||||
// Move in air
|
switch ( CGameScene::getCollision()->getCollisionBlock( x, pos.vy-HEIGHT_FOR_HEAD_COLLISION ) & COLLISION_TYPE_MASK )
|
||||||
pos.vx+=dirToMove;
|
{
|
||||||
|
case COLLISION_TYPE_NORMAL:
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
hitWall=true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if ( !hitWall )
|
||||||
{
|
{
|
||||||
// Hit wall
|
colHeight=getHeightFromGround(x,pos.vy,16);
|
||||||
hitWall=true;
|
if(colHeight>=0)
|
||||||
|
{
|
||||||
|
// Move in air
|
||||||
|
pos.vx+=dirToMove;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Hit wall
|
||||||
|
hitWall=true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue