This commit is contained in:
Paul 2001-04-11 15:48:16 +00:00
parent 6718a6ceb0
commit 96ac8236d9
6 changed files with 91 additions and 5 deletions

View File

@ -181,6 +181,7 @@ static const char *s_modeText[NUM_PLAYERMODES]=
int s_screenPos;
DVECTOR m_cameraScrollPos={0,600};
int m_cameraLookOffset=0;
int SCREEN_GEOM_CENTRE_X=248;
int SCREEN_GEOM_CENTRE_Y=165;
@ -289,6 +290,13 @@ void CPlayer::shutdown()
CPlayerThing::shutdown();
}
int looktimeout=80;
int lookmaxoffsetup=3*256;
int lookmaxoffsetdown=6*256;
int lookspeed=40;
int lookreturnspeed=80;
/*----------------------------------------------------------------------
Function:
Purpose:
@ -348,15 +356,76 @@ else if(Pos.vy>m_mapEdge.vy-64)Pos.vy=m_mapEdge.vy-64;
// Look around
int pad=getPadInputHeld();
static int padLookAroundTimer=0;
if(pad&PI_UP)
{
if(padLookAroundTimer>0)
{
padLookAroundTimer=0;
}
else if(padLookAroundTimer>-looktimeout)
{
padLookAroundTimer--;
}
else if(m_cameraLookOffset>-lookmaxoffsetup)
{
m_cameraLookOffset-=lookspeed;
if(m_cameraLookOffset<-lookmaxoffsetup)
{
m_cameraLookOffset=-lookmaxoffsetup;
}
}
}
else if(pad&PI_DOWN)
{
if(padLookAroundTimer<0)
{
padLookAroundTimer=0;
}
else if(padLookAroundTimer<looktimeout)
{
padLookAroundTimer++;
}
else if(m_cameraLookOffset<lookmaxoffsetdown)
{
m_cameraLookOffset+=lookspeed;
if(m_cameraLookOffset>lookmaxoffsetdown)
{
m_cameraLookOffset=lookmaxoffsetdown;
}
}
}
else
{
padLookAroundTimer=0;
}
// Return to centre
if(padLookAroundTimer>=0&&m_cameraLookOffset<0)
{
m_cameraLookOffset+=lookreturnspeed;
if(m_cameraLookOffset>0)
{
m_cameraLookOffset=0;
}
}
if(padLookAroundTimer<=0&&m_cameraLookOffset>0)
{
m_cameraLookOffset-=lookreturnspeed;
if(m_cameraLookOffset<0)
{
m_cameraLookOffset=0;
}
}
}
// Move the camera offset
m_playerScreenGeomPos.vx=SCREEN_GEOM_PLAYER_OFS_X+((MAP2D_BLOCKSTEPSIZE*m_cameraScrollPos.vx)>>8);
m_playerScreenGeomPos.vy=SCREEN_GEOM_PLAYER_OFS_Y+((MAP2D_BLOCKSTEPSIZE*m_cameraScrollPos.vy)>>8);
m_playerScreenGeomPos.vy=SCREEN_GEOM_PLAYER_OFS_Y+((MAP2D_BLOCKSTEPSIZE*(m_cameraScrollPos.vy-m_cameraLookOffset))>>8);
m_cameraOffset.vx=MAP2D_CENTRE_X+((MAP2D_BLOCKSTEPSIZE*(-m_cameraScrollPos.vx))>>8);
m_cameraOffset.vy=MAP2D_CENTRE_Y+((MAP2D_BLOCKSTEPSIZE*(-m_cameraScrollPos.vy))>>8);
m_cameraOffset.vy=MAP2D_CENTRE_Y+((MAP2D_BLOCKSTEPSIZE*(-m_cameraScrollPos.vy+m_cameraLookOffset))>>8);
m_cameraPos.vx=Pos.vx+m_cameraOffset.vx;
@ -697,6 +766,8 @@ void CPlayer::respawn()
m_bubbleAmmo=0;
m_jellyAmmo=0;
m_cameraLookOffset=0;
clearPlatform();
}

View File

@ -68,6 +68,7 @@ static PlayerMetrics s_playerMetrics=
DEFAULT_PLAYER_RUN_SLOWDOWN, // PM__RUN_SLOWDOWN
DEFAULT_PLAYER_PLAYER_GRAVITY/3, // PM__GRAVITY
DEFAULT_PLAYER_TERMINAL_VELOCITY/3, // PM__TERMINAL_VELOCITY
DEFAULT_BUTT_FALL_VELOCITY, // PM__BUTT_FALL_VELOCITY
} };

View File

@ -108,6 +108,7 @@ static PlayerMetrics s_playerMetrics=
DEFAULT_PLAYER_RUN_SLOWDOWN, // PM__RUN_SLOWDOWN
DEFAULT_PLAYER_PLAYER_GRAVITY, // PM__GRAVITY
DEFAULT_PLAYER_TERMINAL_VELOCITY, // PM__TERMINAL_VELOCITY
DEFAULT_BUTT_FALL_VELOCITY, // PM__BUTT_FALL_VELOCITY
} };

View File

@ -114,6 +114,7 @@ static PlayerMetrics s_playerMetrics=
DEFAULT_PLAYER_RUN_SLOWDOWN, // PM__RUN_SLOWDOWN
DEFAULT_PLAYER_PLAYER_GRAVITY, // PM__GRAVITY
DEFAULT_PLAYER_TERMINAL_VELOCITY, // PM__TERMINAL_VELOCITY
DEFAULT_BUTT_FALL_VELOCITY, // PM__BUTT_FALL_VELOCITY
} };
@ -665,6 +666,17 @@ void CPlayerModeBase::fall()
}
}
}
int buttfallspeed=14;
void CPlayerModeBase::buttFall()
{
const PlayerMetrics *metrics;
metrics=getPlayerMetrics();
// m_moveVelocity.vy=metrics->m_metric[PM__BUTT_FALL_VELOCITY]<<(VELOCITY_SHIFT+1);
m_moveVelocity.vy=metrics->m_metric[buttfallspeed]<<VELOCITY_SHIFT;
}
/*----------------------------------------------------------------------
Function:

View File

@ -49,6 +49,7 @@ typedef enum
PM__RUN_SLOWDOWN,
PM__GRAVITY,
PM__TERMINAL_VELOCITY,
PM__BUTT_FALL_VELOCITY,
NUM_PLAYER_METRICS
}PLAYER_METRIC;
@ -69,6 +70,7 @@ enum
DEFAULT_PLAYER_RUN_SLOWDOWN=3<<2,
DEFAULT_PLAYER_PLAYER_GRAVITY=4<<2,
DEFAULT_PLAYER_TERMINAL_VELOCITY=8,
DEFAULT_BUTT_FALL_VELOCITY=14,
};
@ -146,6 +148,7 @@ public:
int slowdown();
void jump();
void fall();
void buttFall();
private:

View File

@ -101,7 +101,6 @@ void CPlayerStateButtBounce::think(CPlayerModeBase *_playerMode)
void CPlayerStateButtBounceFall::enter(CPlayerModeBase *_playerMode)
{
_playerMode->setAnimNo(ANIM_SPONGEBOB_BUTTBOUNCEEND);
PAUL_DBGMSG("[PM__BUTTFALL_VELOCITY]");
}
@ -113,8 +112,7 @@ PAUL_DBGMSG("[PM__BUTTFALL_VELOCITY]");
---------------------------------------------------------------------- */
void CPlayerStateButtBounceFall::think(CPlayerModeBase *_playerMode)
{
// _playerMode->buttFall();
_playerMode->fall();
_playerMode->buttFall();
}