From c48fce126a00c65b982a1dcd2d50baa67f593f92 Mon Sep 17 00:00:00 2001 From: Paul Date: Fri, 11 May 2001 20:56:43 +0000 Subject: [PATCH] --- source/enemy/npc.cpp | 60 ++++++++++++++++++-------------------- source/player/player.cpp | 14 +++++++++ source/player/player.h | 3 ++ source/player/pmbubble.cpp | 1 + source/player/pmchop.cpp | 1 + source/player/pmcoral.cpp | 1 + source/player/pmjelly.cpp | 2 ++ source/player/pmnet.cpp | 1 + source/player/pmodes.cpp | 7 +++-- source/player/psbutt.cpp | 51 ++++++++++++++++++++++++++++++++ source/player/psbutt.h | 12 +++++++- source/player/psfall.cpp | 2 +- 12 files changed, 119 insertions(+), 36 deletions(-) diff --git a/source/enemy/npc.cpp b/source/enemy/npc.cpp index a7b1ed852..6b256f2aa 100644 --- a/source/enemy/npc.cpp +++ b/source/enemy/npc.cpp @@ -860,55 +860,51 @@ void CNpcEnemy::collidedWith( CThing *_thisThing ) 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: - { - m_oldControlFunc = m_controlFunc; - m_controlFunc = NPC_CONTROL_COLLISION; + case DETECT_ALL_COLLISION: + { + m_oldControlFunc = m_controlFunc; + m_controlFunc = NPC_CONTROL_COLLISION; - processUserCollision( _thisThing ); + processUserCollision( _thisThing ); - break; - } + break; + } - case DETECT_ATTACK_COLLISION_GENERIC: - { - processAttackCollision(); - processUserCollision( _thisThing ); + case DETECT_ATTACK_COLLISION_GENERIC: + { + processAttackCollision(); + processUserCollision( _thisThing ); - break; - } + break; } } - - break; } + } + else + { + // player is attacking, respond appropriately - default: + if ( m_controlFunc != NPC_CONTROL_SHOT ) { - // player is attacking, respond appropriately - - if ( m_controlFunc != NPC_CONTROL_SHOT ) + if(playerState==ATTACK_STATE__BUTT_BOUNCE) { - m_controlFunc = NPC_CONTROL_SHOT; - m_state = NPC_GENERIC_HIT_CHECK_HEALTH; + player->justButtBouncedABadGuy(); } - - break; + m_controlFunc = NPC_CONTROL_SHOT; + m_state = NPC_GENERIC_HIT_CHECK_HEALTH; } } diff --git a/source/player/player.cpp b/source/player/player.cpp index 60966b30a..627142e83 100644 --- a/source/player/player.cpp +++ b/source/player/player.cpp @@ -1812,6 +1812,20 @@ PLAYERINPUT CPlayer::readPadInput() return input; } + + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +void CPlayer::justButtBouncedABadGuy() +{ + m_currentPlayerModeClass->setState(STATE_BUTTBOUNCEUP); +} + + /*---------------------------------------------------------------------- Function: Purpose: diff --git a/source/player/player.h b/source/player/player.h index a097590b7..586b5a169 100644 --- a/source/player/player.h +++ b/source/player/player.h @@ -75,6 +75,7 @@ typedef enum STATE_BUTTBOUNCE, STATE_BUTTFALL, STATE_BUTTLAND, + STATE_BUTTBOUNCEUP, STATE_DUCK, STATE_SOAKUP, STATE_GETUP, @@ -356,6 +357,8 @@ public: int isHoldingNet() {return m_currentMode==PLAYER_MODE_NET;} + void justButtBouncedABadGuy(); // Also fugly.. :/ + private: int m_glassesFlag; int m_squeakyBootsTimer; diff --git a/source/player/pmbubble.cpp b/source/player/pmbubble.cpp index f13d0f6f1..cfd5447c2 100644 --- a/source/player/pmbubble.cpp +++ b/source/player/pmbubble.cpp @@ -204,6 +204,7 @@ int CPlayerModeBubbleMixture::canBlowBubbleFromThisState() case STATE_BUTTBOUNCE: case STATE_BUTTFALL: case STATE_BUTTLAND: + case STATE_BUTTBOUNCEUP: case STATE_DUCK: case STATE_SOAKUP: case STATE_GETUP: diff --git a/source/player/pmchop.cpp b/source/player/pmchop.cpp index 8d9007593..2aa333c35 100644 --- a/source/player/pmchop.cpp +++ b/source/player/pmchop.cpp @@ -186,6 +186,7 @@ int CPlayerModeChop::canAttackFromThisState() case STATE_BUTTBOUNCE: case STATE_BUTTFALL: case STATE_BUTTLAND: + case STATE_BUTTBOUNCEUP: case STATE_DUCK: case STATE_SOAKUP: case STATE_GETUP: diff --git a/source/player/pmcoral.cpp b/source/player/pmcoral.cpp index a034b6ea0..6aa58d275 100644 --- a/source/player/pmcoral.cpp +++ b/source/player/pmcoral.cpp @@ -115,6 +115,7 @@ static CPlayerState *s_stateTable[]= NULL, // STATE_BUTTBOUNCE NULL, // STATE_BUTTFALL NULL, // STATE_BUTTLAND + NULL, // STATE_BUTTBOUNCEUP NULL, // STATE_DUCK NULL, // STATE_SOAKUP &s_stateGetUp, // STATE_GETUP diff --git a/source/player/pmjelly.cpp b/source/player/pmjelly.cpp index e33db632d..dcb435e17 100644 --- a/source/player/pmjelly.cpp +++ b/source/player/pmjelly.cpp @@ -209,6 +209,7 @@ int CPlayerModeJellyLauncher::setState(int _state) case STATE_BUTTBOUNCE: case STATE_BUTTFALL: case STATE_BUTTLAND: + case STATE_BUTTBOUNCEUP: case STATE_DUCK: case STATE_SOAKUP: case STATE_GETUP: @@ -252,6 +253,7 @@ int CPlayerModeJellyLauncher::canFireFromThisState() case STATE_BUTTBOUNCE: case STATE_BUTTFALL: case STATE_BUTTLAND: + case STATE_BUTTBOUNCEUP: case STATE_DUCK: case STATE_SOAKUP: case STATE_GETUP: diff --git a/source/player/pmnet.cpp b/source/player/pmnet.cpp index f3b1a6275..4fd4f08d2 100644 --- a/source/player/pmnet.cpp +++ b/source/player/pmnet.cpp @@ -321,6 +321,7 @@ int CPlayerModeNet::canSwingNetFromThisState() case STATE_BUTTBOUNCE: case STATE_BUTTFALL: case STATE_BUTTLAND: + case STATE_BUTTBOUNCEUP: case STATE_DUCK: case STATE_SOAKUP: case STATE_GETUP: diff --git a/source/player/pmodes.cpp b/source/player/pmodes.cpp index cb5aa7f50..20871de2b 100644 --- a/source/player/pmodes.cpp +++ b/source/player/pmodes.cpp @@ -107,6 +107,7 @@ static CPlayerState *s_stateTable[]= &s_stateButtBounce, // STATE_BUTTBOUNCE &s_stateButtBounceFall, // STATE_BUTTFALL &s_stateButtBounceLand, // STATE_BUTTLAND + &s_stateButtBounceUp, // STATE_BUTTBOUNCEUP &s_stateDuck, // STATE_DUCK &s_stateSoakUp, // STATE_SOAKUP &s_stateGetUp, // STATE_GETUP @@ -227,6 +228,7 @@ int CPlayerModeBase::canDoLookAround() case STATE_BUTTBOUNCE: case STATE_BUTTFALL: case STATE_BUTTLAND: + case STATE_BUTTBOUNCEUP: case STATE_DUCK: case STATE_GETUP: case STATE_JUMPBACK: @@ -250,6 +252,7 @@ ATTACK_STATE CPlayerModeBase::getAttackState() { case STATE_BUTTFALL: case STATE_BUTTLAND: + case STATE_BUTTBOUNCEUP: ret=ATTACK_STATE__BUTT_BOUNCE; break; @@ -283,10 +286,10 @@ void CPlayerModeBase::thinkVerticalMovement() { 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_JUMP&&m_currentState!=STATE_SPRINGUP&& - m_currentState!=STATE_JUMPBACK) + m_currentState!=STATE_JUMPBACK&&m_currentState!=STATE_BUTTBOUNCEUP) { DVECTOR pos; pos=m_player->getPlayerPos(); diff --git a/source/player/psbutt.cpp b/source/player/psbutt.cpp index dde1294c1..28e1b7c75 100644 --- a/source/player/psbutt.cpp +++ b/source/player/psbutt.cpp @@ -62,6 +62,7 @@ CPlayerStateButtBounce s_stateButtBounce; CPlayerStateButtBounceFall s_stateButtBounceFall; 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 */ diff --git a/source/player/psbutt.h b/source/player/psbutt.h index 1dd085932..7e9ee121e 100644 --- a/source/player/psbutt.h +++ b/source/player/psbutt.h @@ -53,9 +53,18 @@ class CPlayerStateButtBounceLand : public CPlayerState public: virtual void enter(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: - + int m_bounceFrames; + }; @@ -66,6 +75,7 @@ private: extern CPlayerStateButtBounce s_stateButtBounce; extern CPlayerStateButtBounceFall s_stateButtBounceFall; extern CPlayerStateButtBounceLand s_stateButtBounceLand; +extern CPlayerStateButtBounceUp s_stateButtBounceUp; /*---------------------------------------------------------------------- diff --git a/source/player/psfall.cpp b/source/player/psfall.cpp index 6a2b7c8f6..e8ac2077f 100644 --- a/source/player/psfall.cpp +++ b/source/player/psfall.cpp @@ -105,7 +105,7 @@ void CPlayerStateFall::think(CPlayerModeBase *_playerMode) } _playerMode->fall(); - if(controlHeld&PI_DOWN) + if(controlDown&PI_DOWN) { _playerMode->setState(STATE_BUTTBOUNCE); }