From cec66557b607c453fc3d768419e2ee7874878125 Mon Sep 17 00:00:00 2001 From: Paul Date: Thu, 24 May 2001 20:00:19 +0000 Subject: [PATCH] --- source/player/player.cpp | 65 +++++++++++++++++++++++++++++++++++++++- source/player/player.h | 4 ++- source/player/pmodes.cpp | 2 ++ 3 files changed, 69 insertions(+), 2 deletions(-) diff --git a/source/player/player.cpp b/source/player/player.cpp index 0f7d90862..a5ebe5132 100644 --- a/source/player/player.cpp +++ b/source/player/player.cpp @@ -559,6 +559,19 @@ int CAMERA_SCROLLSPEED=1000; // Speed of the scroll int CAMERA_ACCURACYSHIFT=8; const int CAMERA_TILESIZE=16; + +int m_isFalling; +int m_fallFrames; +int m_cameraFallYScrollPos; +int m_cameraFallYScrollSpeed; +int CAMERA_FALL_DROP_SPEED=6; +int CAMERA_FALL_MAX_OFFSET=5*16; +int CAMERA_FALL_FRAME_THRESHOLD=20; +int CAMERA_FALL_RETURN_SPEED=1; + + + + #ifdef CAM_X_AUTO_CENTERING int returnspeed=1500; int returntimeout=25; @@ -844,6 +857,41 @@ if(newmode!=-1) else if(Pos.vy>m_playerPosLimitBox.y2) Pos.vy=m_playerPosLimitBox.y2; } + // Falling camera lag + if(m_isFalling) + { + if(m_fallFrames>CAMERA_FALL_FRAME_THRESHOLD) + { + if(m_cameraFallYScrollSpeed0) + { + m_cameraFallYScrollPos=0; + } + } + m_fallFrames=0; + m_cameraFallYScrollSpeed=0; + } + // Look around int pad=getPadInputHeld(); if(pad&PI_UP&&canDoLookAround()) @@ -1549,7 +1597,7 @@ void CPlayer::playAnimFrameSfx(int _animNo,int _animFrame) void CPlayer::calcCameraFocusPointTarget() { m_currentCamFocusPointTarget.vx=Pos.vx+MAP2D_CENTRE_X-(m_cameraXScrollPos>>CAMERA_ACCURACYSHIFT); - m_currentCamFocusPointTarget.vy=Pos.vy+MAP2D_CENTRE_Y; + m_currentCamFocusPointTarget.vy=Pos.vy+MAP2D_CENTRE_Y-m_cameraFallYScrollPos; } @@ -1575,6 +1623,12 @@ void CPlayer::respawn() m_lockCamera=false; m_cameraXScrollDir=0; m_cameraXScrollPos=0; + + m_cameraFallYScrollPos=0; + m_isFalling=false; + m_fallFrames=false; + m_cameraFallYScrollSpeed=0; + calcCameraFocusPointTarget(); m_currentCamFocusPoint=m_currentCamFocusPointTarget; m_cameraPos.vx=m_currentCamFocusPoint.vx; @@ -2138,6 +2192,15 @@ void CPlayer::moveRight() m_cameraXScrollDir=0; } } +void CPlayer::fall() +{ + m_isFalling=true; +} +void CPlayer::buttFall() +{ + m_cameraFallYScrollSpeed=CAMERA_FALL_DROP_SPEED; + m_isFalling=true; +} /*---------------------------------------------------------------------- diff --git a/source/player/player.h b/source/player/player.h index 8a2fd438a..081411e91 100644 --- a/source/player/player.h +++ b/source/player/player.h @@ -201,8 +201,10 @@ public: virtual void render(); virtual int dontKillDuringLevelRespawn() {return true;} virtual void shove(DVECTOR move); - void moveLeft(); // This is only for camera scroll right now.. + void moveLeft(); // This is only for camera scroll right now void moveRight(); // " " " " " + void fall(); // " " " " " + void buttFall(); // " " " " " virtual int moveVertical(int _moveDistance); virtual int moveHorizontal(int _moveDistance); virtual void setHasPlatformCollided( bool newVal ); diff --git a/source/player/pmodes.cpp b/source/player/pmodes.cpp index a4dd12575..e5fc07e3b 100644 --- a/source/player/pmodes.cpp +++ b/source/player/pmodes.cpp @@ -665,6 +665,7 @@ void CPlayerModeBase::fall() } } setMoveVelocity(&moveVel); + m_player->fall(); } int buttfallspeed=9; void CPlayerModeBase::buttFall() @@ -677,6 +678,7 @@ void CPlayerModeBase::buttFall() // moveVel.vy=metrics->m_metric[PM__BUTT_FALL_VELOCITY]<<(VELOCITY_SHIFT+1); moveVel.vy=metrics->m_metric[buttfallspeed]<buttFall(); }