This commit is contained in:
Paul 2001-05-11 20:56:43 +00:00
parent 15d3aff1ab
commit c48fce126a
12 changed files with 119 additions and 36 deletions

View File

@ -860,55 +860,51 @@ void CNpcEnemy::collidedWith( CThing *_thisThing )
ATTACK_STATE playerState = player->getAttackState(); ATTACK_STATE playerState = player->getAttackState();
switch( playerState ) if(playerState==ATTACK_STATE__NONE)
{ {
case ATTACK_STATE__NONE: if ( !player->isRecoveringFromHit() )
{ {
if ( !player->isRecoveringFromHit() ) switch( m_data[m_type].detectCollision )
{ {
switch( m_data[m_type].detectCollision ) case DETECT_NO_COLLISION:
{ {
case DETECT_NO_COLLISION: // ignore
{
// ignore
break; break;
} }
case DETECT_ALL_COLLISION: case DETECT_ALL_COLLISION:
{ {
m_oldControlFunc = m_controlFunc; m_oldControlFunc = m_controlFunc;
m_controlFunc = NPC_CONTROL_COLLISION; m_controlFunc = NPC_CONTROL_COLLISION;
processUserCollision( _thisThing ); processUserCollision( _thisThing );
break; break;
} }
case DETECT_ATTACK_COLLISION_GENERIC: case DETECT_ATTACK_COLLISION_GENERIC:
{ {
processAttackCollision(); processAttackCollision();
processUserCollision( _thisThing ); processUserCollision( _thisThing );
break; break;
}
} }
} }
break;
} }
}
else
{
// player is attacking, respond appropriately
default: if ( m_controlFunc != NPC_CONTROL_SHOT )
{ {
// player is attacking, respond appropriately if(playerState==ATTACK_STATE__BUTT_BOUNCE)
if ( m_controlFunc != NPC_CONTROL_SHOT )
{ {
m_controlFunc = NPC_CONTROL_SHOT; player->justButtBouncedABadGuy();
m_state = NPC_GENERIC_HIT_CHECK_HEALTH;
} }
m_controlFunc = NPC_CONTROL_SHOT;
break; m_state = NPC_GENERIC_HIT_CHECK_HEALTH;
} }
} }

View File

@ -1812,6 +1812,20 @@ PLAYERINPUT CPlayer::readPadInput()
return input; return input;
} }
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CPlayer::justButtBouncedABadGuy()
{
m_currentPlayerModeClass->setState(STATE_BUTTBOUNCEUP);
}
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
Function: Function:
Purpose: Purpose:

View File

@ -75,6 +75,7 @@ typedef enum
STATE_BUTTBOUNCE, STATE_BUTTBOUNCE,
STATE_BUTTFALL, STATE_BUTTFALL,
STATE_BUTTLAND, STATE_BUTTLAND,
STATE_BUTTBOUNCEUP,
STATE_DUCK, STATE_DUCK,
STATE_SOAKUP, STATE_SOAKUP,
STATE_GETUP, STATE_GETUP,
@ -356,6 +357,8 @@ public:
int isHoldingNet() {return m_currentMode==PLAYER_MODE_NET;} int isHoldingNet() {return m_currentMode==PLAYER_MODE_NET;}
void justButtBouncedABadGuy(); // Also fugly.. :/
private: private:
int m_glassesFlag; int m_glassesFlag;
int m_squeakyBootsTimer; int m_squeakyBootsTimer;

View File

@ -204,6 +204,7 @@ int CPlayerModeBubbleMixture::canBlowBubbleFromThisState()
case STATE_BUTTBOUNCE: case STATE_BUTTBOUNCE:
case STATE_BUTTFALL: case STATE_BUTTFALL:
case STATE_BUTTLAND: case STATE_BUTTLAND:
case STATE_BUTTBOUNCEUP:
case STATE_DUCK: case STATE_DUCK:
case STATE_SOAKUP: case STATE_SOAKUP:
case STATE_GETUP: case STATE_GETUP:

View File

@ -186,6 +186,7 @@ int CPlayerModeChop::canAttackFromThisState()
case STATE_BUTTBOUNCE: case STATE_BUTTBOUNCE:
case STATE_BUTTFALL: case STATE_BUTTFALL:
case STATE_BUTTLAND: case STATE_BUTTLAND:
case STATE_BUTTBOUNCEUP:
case STATE_DUCK: case STATE_DUCK:
case STATE_SOAKUP: case STATE_SOAKUP:
case STATE_GETUP: case STATE_GETUP:

View File

@ -115,6 +115,7 @@ static CPlayerState *s_stateTable[]=
NULL, // STATE_BUTTBOUNCE NULL, // STATE_BUTTBOUNCE
NULL, // STATE_BUTTFALL NULL, // STATE_BUTTFALL
NULL, // STATE_BUTTLAND NULL, // STATE_BUTTLAND
NULL, // STATE_BUTTBOUNCEUP
NULL, // STATE_DUCK NULL, // STATE_DUCK
NULL, // STATE_SOAKUP NULL, // STATE_SOAKUP
&s_stateGetUp, // STATE_GETUP &s_stateGetUp, // STATE_GETUP

View File

@ -209,6 +209,7 @@ int CPlayerModeJellyLauncher::setState(int _state)
case STATE_BUTTBOUNCE: case STATE_BUTTBOUNCE:
case STATE_BUTTFALL: case STATE_BUTTFALL:
case STATE_BUTTLAND: case STATE_BUTTLAND:
case STATE_BUTTBOUNCEUP:
case STATE_DUCK: case STATE_DUCK:
case STATE_SOAKUP: case STATE_SOAKUP:
case STATE_GETUP: case STATE_GETUP:
@ -252,6 +253,7 @@ int CPlayerModeJellyLauncher::canFireFromThisState()
case STATE_BUTTBOUNCE: case STATE_BUTTBOUNCE:
case STATE_BUTTFALL: case STATE_BUTTFALL:
case STATE_BUTTLAND: case STATE_BUTTLAND:
case STATE_BUTTBOUNCEUP:
case STATE_DUCK: case STATE_DUCK:
case STATE_SOAKUP: case STATE_SOAKUP:
case STATE_GETUP: case STATE_GETUP:

View File

@ -321,6 +321,7 @@ int CPlayerModeNet::canSwingNetFromThisState()
case STATE_BUTTBOUNCE: case STATE_BUTTBOUNCE:
case STATE_BUTTFALL: case STATE_BUTTFALL:
case STATE_BUTTLAND: case STATE_BUTTLAND:
case STATE_BUTTBOUNCEUP:
case STATE_DUCK: case STATE_DUCK:
case STATE_SOAKUP: case STATE_SOAKUP:
case STATE_GETUP: case STATE_GETUP:

View File

@ -107,6 +107,7 @@ static CPlayerState *s_stateTable[]=
&s_stateButtBounce, // STATE_BUTTBOUNCE &s_stateButtBounce, // STATE_BUTTBOUNCE
&s_stateButtBounceFall, // STATE_BUTTFALL &s_stateButtBounceFall, // STATE_BUTTFALL
&s_stateButtBounceLand, // STATE_BUTTLAND &s_stateButtBounceLand, // STATE_BUTTLAND
&s_stateButtBounceUp, // STATE_BUTTBOUNCEUP
&s_stateDuck, // STATE_DUCK &s_stateDuck, // STATE_DUCK
&s_stateSoakUp, // STATE_SOAKUP &s_stateSoakUp, // STATE_SOAKUP
&s_stateGetUp, // STATE_GETUP &s_stateGetUp, // STATE_GETUP
@ -227,6 +228,7 @@ int CPlayerModeBase::canDoLookAround()
case STATE_BUTTBOUNCE: case STATE_BUTTBOUNCE:
case STATE_BUTTFALL: case STATE_BUTTFALL:
case STATE_BUTTLAND: case STATE_BUTTLAND:
case STATE_BUTTBOUNCEUP:
case STATE_DUCK: case STATE_DUCK:
case STATE_GETUP: case STATE_GETUP:
case STATE_JUMPBACK: case STATE_JUMPBACK:
@ -250,6 +252,7 @@ ATTACK_STATE CPlayerModeBase::getAttackState()
{ {
case STATE_BUTTFALL: case STATE_BUTTFALL:
case STATE_BUTTLAND: case STATE_BUTTLAND:
case STATE_BUTTBOUNCEUP:
ret=ATTACK_STATE__BUTT_BOUNCE; ret=ATTACK_STATE__BUTT_BOUNCE;
break; break;
@ -283,10 +286,10 @@ void CPlayerModeBase::thinkVerticalMovement()
{ {
playerHasHitGround(); playerHasHitGround();
} }
else if(m_currentState!=STATE_FALL&&m_currentState!=STATE_FALLFAR&& else if(m_currentState!=STATE_FALL&&m_currentState!=STATE_FALLFAR&& // Hmm.. (pkg)
m_currentState!=STATE_BUTTFALL&&m_currentState!=STATE_BUTTBOUNCE&& m_currentState!=STATE_BUTTFALL&&m_currentState!=STATE_BUTTBOUNCE&&
m_currentState!=STATE_JUMP&&m_currentState!=STATE_SPRINGUP&& m_currentState!=STATE_JUMP&&m_currentState!=STATE_SPRINGUP&&
m_currentState!=STATE_JUMPBACK) m_currentState!=STATE_JUMPBACK&&m_currentState!=STATE_BUTTBOUNCEUP)
{ {
DVECTOR pos; DVECTOR pos;
pos=m_player->getPlayerPos(); pos=m_player->getPlayerPos();

View File

@ -62,6 +62,7 @@
CPlayerStateButtBounce s_stateButtBounce; CPlayerStateButtBounce s_stateButtBounce;
CPlayerStateButtBounceFall s_stateButtBounceFall; CPlayerStateButtBounceFall s_stateButtBounceFall;
CPlayerStateButtBounceLand s_stateButtBounceLand; CPlayerStateButtBounceLand s_stateButtBounceLand;
CPlayerStateButtBounceUp s_stateButtBounceUp;
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
@ -146,5 +147,55 @@ void CPlayerStateButtBounceLand::think(CPlayerModeBase *_playerMode)
} }
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CPlayerStateButtBounceUp::enter(CPlayerModeBase *_playerMode)
{
_playerMode->setAnimNo(ANIM_SPONGEBOB_BUTTBOUNCEEND);
m_bounceFrames=0;
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
int bounceUpFrames=5;
void CPlayerStateButtBounceUp::think(CPlayerModeBase *_playerMode)
{
int controlHeld;
controlHeld=_playerMode->getPadInputHeld();
if(controlHeld&PI_LEFT)
{
_playerMode->moveLeft();
}
else if(controlHeld&PI_RIGHT)
{
_playerMode->moveRight();
}
else
{
_playerMode->slowdown();
}
if(m_bounceFrames<=bounceUpFrames)
{
m_bounceFrames++;
_playerMode->jump();
}
else
{
_playerMode->setState(STATE_FALL);
}
}
/*=========================================================================== /*===========================================================================
end */ end */

View File

@ -53,9 +53,18 @@ class CPlayerStateButtBounceLand : public CPlayerState
public: public:
virtual void enter(class CPlayerModeBase *_playerMode); virtual void enter(class CPlayerModeBase *_playerMode);
virtual void think(class CPlayerModeBase *_playerMode); virtual void think(class CPlayerModeBase *_playerMode);
};
class CPlayerStateButtBounceUp : public CPlayerState
{
public:
virtual void enter(class CPlayerModeBase *_playerMode);
virtual void think(class CPlayerModeBase *_playerMode);
private: private:
int m_bounceFrames;
}; };
@ -66,6 +75,7 @@ private:
extern CPlayerStateButtBounce s_stateButtBounce; extern CPlayerStateButtBounce s_stateButtBounce;
extern CPlayerStateButtBounceFall s_stateButtBounceFall; extern CPlayerStateButtBounceFall s_stateButtBounceFall;
extern CPlayerStateButtBounceLand s_stateButtBounceLand; extern CPlayerStateButtBounceLand s_stateButtBounceLand;
extern CPlayerStateButtBounceUp s_stateButtBounceUp;
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------

View File

@ -105,7 +105,7 @@ void CPlayerStateFall::think(CPlayerModeBase *_playerMode)
} }
_playerMode->fall(); _playerMode->fall();
if(controlHeld&PI_DOWN) if(controlDown&PI_DOWN)
{ {
_playerMode->setState(STATE_BUTTBOUNCE); _playerMode->setState(STATE_BUTTBOUNCE);
} }