2001-05-11 17:14:29 +02:00
|
|
|
/*=========================================================================
|
|
|
|
|
|
|
|
psjmpbck.cpp
|
|
|
|
|
|
|
|
Author: PKG
|
|
|
|
Created:
|
|
|
|
Project: Spongebob
|
|
|
|
Purpose:
|
|
|
|
|
|
|
|
Copyright (c) 2001 Climax Development Ltd
|
|
|
|
|
|
|
|
===========================================================================*/
|
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Includes
|
|
|
|
-------- */
|
|
|
|
|
|
|
|
#include "player\psjmpbck.h"
|
|
|
|
|
|
|
|
#ifndef __PLAYER_PLAYER_H__
|
|
|
|
#include "player\player.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __PLAYER_PMODES_H__
|
|
|
|
#include "player\pmodes.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __SOUND_SOUND_H__
|
|
|
|
#include "sound\sound.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/* Std Lib
|
|
|
|
------- */
|
|
|
|
|
|
|
|
/* Data
|
|
|
|
---- */
|
|
|
|
|
|
|
|
#ifndef __ANIM_SPONGEBOB_HEADER__
|
|
|
|
#include <ACTOR_SPONGEBOB_ANIM.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Tyepdefs && Defines
|
|
|
|
------------------- */
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Structure defintions
|
|
|
|
-------------------- */
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function Prototypes
|
|
|
|
------------------- */
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Vars
|
|
|
|
---- */
|
|
|
|
|
|
|
|
CPlayerStateJumpBack s_stateJumpBack;
|
|
|
|
|
|
|
|
|
2001-05-11 21:49:41 +02:00
|
|
|
|
2001-05-11 17:14:29 +02:00
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
|
|
|
void CPlayerStateJumpBack::enter(CPlayerModeBase *_playerMode)
|
|
|
|
{
|
2001-08-14 23:03:31 +02:00
|
|
|
_playerMode->setAnimNo(_playerMode->getPlayer()->wasLastHitElectrical()?ANIM_SPONGEBOB_ELECTROCUTED:ANIM_SPONGEBOB_GETHIT);
|
|
|
|
|
2001-06-18 23:07:57 +02:00
|
|
|
if(_playerMode->getState()!=STATE_JUMPBACK)
|
|
|
|
{
|
|
|
|
m_reactFrames=0;
|
|
|
|
}
|
2001-05-11 17:14:29 +02:00
|
|
|
|
2001-05-11 21:49:41 +02:00
|
|
|
_playerMode->jumpback();
|
2001-05-11 17:14:29 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
|
|
|
void CPlayerStateJumpBack::think(CPlayerModeBase *_playerMode)
|
|
|
|
{
|
|
|
|
const PlayerMetrics *metrics;
|
2001-05-11 21:49:41 +02:00
|
|
|
int xvel;
|
2001-05-11 17:14:29 +02:00
|
|
|
|
|
|
|
metrics=_playerMode->getPlayerMetrics();
|
|
|
|
|
|
|
|
_playerMode->advanceAnimFrameAndCheckForEndOfAnim();
|
|
|
|
|
2001-05-11 21:49:41 +02:00
|
|
|
if(m_reactFrames<=metrics->m_metric[PM__HITREACT_FRAMES])
|
2001-05-11 17:14:29 +02:00
|
|
|
{
|
|
|
|
m_reactFrames++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_playerMode->setState(STATE_FALL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*===========================================================================
|
|
|
|
end */
|