This commit is contained in:
Paul 2001-05-04 21:19:00 +00:00
parent b2fa0e5a67
commit d51859e085
2 changed files with 24 additions and 6 deletions

View file

@ -783,8 +783,11 @@ if(newmode!=-1)
yoff=m_cameraLookOffset+(m_ledgeLookOffset>>ledgeShift); yoff=m_cameraLookOffset+(m_ledgeLookOffset>>ledgeShift);
if(yoff<-lookmaxoffsetup)yoff=-lookmaxoffsetup; if(yoff<-lookmaxoffsetup)yoff=-lookmaxoffsetup;
else if(yoff>lookmaxoffsetdown)yoff=lookmaxoffsetdown; else if(yoff>lookmaxoffsetdown)yoff=lookmaxoffsetdown;
m_cameraPos.vx=m_currentCamFocusPoint.vx; if(!m_lockCamera)
m_cameraPos.vy=m_currentCamFocusPoint.vy+yoff; {
m_cameraPos.vx=m_currentCamFocusPoint.vx;
m_cameraPos.vy=m_currentCamFocusPoint.vy+yoff;
}
// Limit camera scroll to the edges of the map // Limit camera scroll to the edges of the map
if(m_cameraPos.vx<m_cameraPosLimitBox.x1) m_cameraPos.vx=m_cameraPosLimitBox.x1; if(m_cameraPos.vx<m_cameraPosLimitBox.x1) m_cameraPos.vx=m_cameraPosLimitBox.x1;
@ -1286,6 +1289,7 @@ void CPlayer::respawn()
Pos=m_respawnPos; Pos=m_respawnPos;
m_cameraLookOffset=0; m_cameraLookOffset=0;
m_lockCamera=false;
m_leftRightScrollPosition=0; m_leftRightScrollPosition=0;
calcCameraFocusPointTarget(); calcCameraFocusPointTarget();
m_currentCamFocusPoint=m_currentCamFocusPointTarget; m_currentCamFocusPoint=m_currentCamFocusPointTarget;
@ -1702,10 +1706,23 @@ int CPlayer::moveVertical(int _moveDistance)
colHeightAfter=getHeightFromGround(pos.vx,pos.vy+_moveDistance,16); colHeightAfter=getHeightFromGround(pos.vx,pos.vy+_moveDistance,16);
if(colHeightBefore>=0&&colHeightAfter<=0) if(colHeightBefore>=0&&colHeightAfter<=0)
{ {
// Stick at ground level // About to hit a 'fall to death' block?
pos.vy+=colHeightAfter+_moveDistance; if((m_layerCollision->getCollisionBlock(pos.vx,pos.vy+_moveDistance)&COLLISION_TYPE_MASK)!=(7<<COLLISION_TYPE_FLAG_SHIFT))
_moveDistance=0; {
hitGround=true; // Stick at ground level
pos.vy+=colHeightAfter+_moveDistance;
_moveDistance=0;
hitGround=true;
}
else
{
if(m_currentMode!=PLAYER_MODE_DEAD)
{
// Lock the camera, kill the player and let him fall to his death..
setMode(PLAYER_MODE_DEAD);
m_lockCamera=true;
}
}
} }
} }
else// if(getHeightFromGround(pos.vx,pos.vy+_moveDistance,1)) else// if(getHeightFromGround(pos.vx,pos.vy+_moveDistance,1))

View file

@ -261,6 +261,7 @@ private:
int m_animNo; int m_animNo;
CActorGfx *m_actorGfx; CActorGfx *m_actorGfx;
int m_lockCamera;
DVECTOR m_cameraPos; DVECTOR m_cameraPos;
DVECTOR m_currentCamFocusPointTarget; DVECTOR m_currentCamFocusPointTarget;
DVECTOR m_currentCamFocusPoint; DVECTOR m_currentCamFocusPoint;