This commit is contained in:
parent
de12f0f1ed
commit
94d54f2e5d
1 changed files with 2 additions and 118 deletions
|
@ -2579,8 +2579,6 @@ void CPlayer::clearPlatform()
|
||||||
Params:
|
Params:
|
||||||
Returns:
|
Returns:
|
||||||
---------------------------------------------------------------------- */
|
---------------------------------------------------------------------- */
|
||||||
#define CRAP_COLLISION
|
|
||||||
#ifdef CRAP_COLLISION
|
|
||||||
int CPlayer::moveVertical(int _moveDistance)
|
int CPlayer::moveVertical(int _moveDistance)
|
||||||
{
|
{
|
||||||
DVECTOR pos;
|
DVECTOR pos;
|
||||||
|
@ -2694,16 +2692,8 @@ int CPlayer::moveVertical(int _moveDistance)
|
||||||
for(i=0;i<+2;i++)
|
for(i=0;i<+2;i++)
|
||||||
{
|
{
|
||||||
int x=pos.vx+((i==0?-checkx:+checkx));
|
int x=pos.vx+((i==0?-checkx:+checkx));
|
||||||
// if(!isOnPlatform())
|
|
||||||
{
|
|
||||||
colHeightBefore[i]=getHeightFromGround(x,y,16);
|
colHeightBefore[i]=getHeightFromGround(x,y,16);
|
||||||
colHeightAfter[i]=getHeightFromGround(x,y+_moveDistance,16);
|
colHeightAfter[i]=getHeightFromGround(x,y+_moveDistance,16);
|
||||||
}
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// colHeightBefore[i]=getHeightFromPlatformNoGround(x,y,16);
|
|
||||||
// colHeightAfter[i]=getHeightFromPlatformNoGround(x,y+_moveDistance,16);
|
|
||||||
// }
|
|
||||||
blockAfter[i]=CGameScene::getCollision()->getCollisionBlock(x,y+_moveDistance);
|
blockAfter[i]=CGameScene::getCollision()->getCollisionBlock(x,y+_moveDistance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2775,112 +2765,6 @@ int CPlayer::moveVertical(int _moveDistance)
|
||||||
|
|
||||||
return hitGround;
|
return hitGround;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
int CPlayer::moveVertical(int _moveDistance)
|
|
||||||
{
|
|
||||||
DVECTOR pos;
|
|
||||||
int hitGround;
|
|
||||||
|
|
||||||
pos=Pos;
|
|
||||||
hitGround=false;
|
|
||||||
|
|
||||||
// Are we falling?
|
|
||||||
if(_moveDistance>0)
|
|
||||||
{
|
|
||||||
int colHeightBefore,colHeightAfter;
|
|
||||||
|
|
||||||
// Yes.. Check to see if we're about to hit/go through the ground/platform
|
|
||||||
colHeightBefore=getHeightFromGround(pos.vx,pos.vy,16);
|
|
||||||
colHeightAfter=getHeightFromGround(pos.vx,pos.vy+_moveDistance,16);
|
|
||||||
if(isOnPlatform()&&
|
|
||||||
!(colHeightBefore>=0&&colHeightAfter<=0))
|
|
||||||
{
|
|
||||||
colHeightBefore=getHeightFromPlatformNoGround(pos.vx,pos.vy,16);
|
|
||||||
colHeightAfter=getHeightFromPlatformNoGround(pos.vx,pos.vy+_moveDistance,16);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(colHeightBefore>=0&&colHeightAfter<=0)
|
|
||||||
{
|
|
||||||
// About to hit a 'fall to death' block?
|
|
||||||
if((CGameScene::getCollision()->getCollisionBlock(pos.vx,pos.vy+_moveDistance)&COLLISION_TYPE_MASK)!=COLLISION_TYPE_FLAG_DEATH_FALL)
|
|
||||||
{
|
|
||||||
// No
|
|
||||||
// Stick at ground level
|
|
||||||
pos.vy+=colHeightAfter+_moveDistance;
|
|
||||||
_moveDistance=0;
|
|
||||||
hitGround=true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Yeah!
|
|
||||||
if(m_currentMode!=PLAYER_MODE_DEAD)
|
|
||||||
{
|
|
||||||
// Lock the camera, kill the player and let him fall to his death..
|
|
||||||
dieYouPorousFreak(DEATHTYPE__FALL_TO_DEATH);
|
|
||||||
m_lockCamera=true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(_moveDistance<0)
|
|
||||||
{
|
|
||||||
// Are we jumping into an impassable block?
|
|
||||||
if((CGameScene::getCollision()->getCollisionBlock(pos.vx,pos.vy+_moveDistance)&COLLISION_TYPE_MASK)!=COLLISION_TYPE_FLAG_NORMAL&&
|
|
||||||
getHeightFromGround(pos.vx,pos.vy+_moveDistance)<=0)
|
|
||||||
{
|
|
||||||
pos.vy=(pos.vy&0xfff0);
|
|
||||||
_moveDistance=0;
|
|
||||||
hitGround=true;
|
|
||||||
}
|
|
||||||
else if((CGameScene::getCollision()->getCollisionBlock(pos.vx,pos.vy+_moveDistance-HEIGHT_FOR_HEAD_COLLISION)&COLLISION_TYPE_MASK)!=COLLISION_TYPE_FLAG_NORMAL&&
|
|
||||||
getHeightFromGround(pos.vx,pos.vy+_moveDistance-HEIGHT_FOR_HEAD_COLLISION)<=0)
|
|
||||||
{
|
|
||||||
switch(CGameScene::getCollision()->getCollisionBlock(pos.vx,pos.vy+_moveDistance-HEIGHT_FOR_HEAD_COLLISION)&COLLISION_TYPE_MASK)
|
|
||||||
{
|
|
||||||
case COLLISION_TYPE_FLAG_DAMAGE:
|
|
||||||
takeDamage(DAMAGE__COLLISION_DAMAGE);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case COLLISION_TYPE_FLAG_ELECTRIC:
|
|
||||||
if(!isWearingBoots())
|
|
||||||
{
|
|
||||||
takeDamage(DAMAGE__COLLISION_DAMAGE);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
pos.vy=((pos.vy+_moveDistance)&0xfff0);
|
|
||||||
_moveDistance=0;
|
|
||||||
hitGround=true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Stood on any important types of collision?
|
|
||||||
switch(CGameScene::getCollision()->getCollisionBlock(pos.vx,pos.vy+_moveDistance)&COLLISION_TYPE_MASK)
|
|
||||||
{
|
|
||||||
case COLLISION_TYPE_FLAG_DAMAGE:
|
|
||||||
takeDamage(DAMAGE__COLLISION_DAMAGE);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case COLLISION_TYPE_FLAG_ELECTRIC:
|
|
||||||
if(!isWearingBoots())
|
|
||||||
{
|
|
||||||
takeDamage(DAMAGE__COLLISION_DAMAGE);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pos.vy+=_moveDistance;
|
|
||||||
setPlayerPos(&pos);
|
|
||||||
|
|
||||||
return hitGround;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------------
|
/*----------------------------------------------------------------------
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue