From d2f4fea8a9841a5e56d0b1866c87377a21c2b00f Mon Sep 17 00:00:00 2001 From: Paul Date: Fri, 30 Mar 2001 19:27:26 +0000 Subject: [PATCH] --- source/player/pmbubble.cpp | 60 ++++++++++++++++++++++---------------- source/player/pmbubble.h | 17 +++++++---- 2 files changed, 47 insertions(+), 30 deletions(-) diff --git a/source/player/pmbubble.cpp b/source/player/pmbubble.cpp index 6da573aa5..d04c12531 100644 --- a/source/player/pmbubble.cpp +++ b/source/player/pmbubble.cpp @@ -53,7 +53,10 @@ ---------------------------------------------------------------------- */ void CPlayerModeBubbleMixture::enter() { - m_chopping=false; + CSoundMediator::playSfx(CSoundMediator::SFX_BUBBLE_WAND); + m_blowing=false; + m_bubbleDelay=0; + m_bubbleCount=BUBBLE_AMMO; } /*---------------------------------------------------------------------- @@ -64,34 +67,52 @@ void CPlayerModeBubbleMixture::enter() ---------------------------------------------------------------------- */ void CPlayerModeBubbleMixture::think() { - // If we're chopping then restore the 'real' anim number/frame before + // If we're blowing then restore the 'real' anim number/frame before // doing the think so that the rest of the code doesn't know what // is going on ;) - if(m_chopping) + if(m_blowing) { setAnimNo(m_savedAnimNo); setAnimFrame(m_savedAnimFrame); } CPlayerModeBase::think(); - // Start to chop? - if(!m_chopping&&getPadInputDown()&PI_ACTION&&canAttackFromThisState()) + if(m_bubbleDelay) { - m_chopFrame=0; - m_chopping=true; + // Delay so that you can't blow all of your bubbles really quickly + m_bubbleDelay--; + } + else + { + // Start to blow? + if(!m_blowing&&getPadInputDown()&PI_ACTION&&canBlowBubbleFromThisState()) + { + // Spawn the bubbly platform thingy..! + // pos is m_player->getPos(); + // dir is m_player->getFacing(); + + // Start the anim off + m_blowFrame=0; + m_blowing=true; + } } - // Chopping? - if(m_chopping) + // Blowing? + if(m_blowing) { m_player->setAnimNo(ANIM_SPONGEBOB_KARATE); - m_player->setAnimFrame(m_chopFrame); - m_chopFrame++; - if(m_chopFrame>=m_player->getAnimFrameCount()) + m_player->setAnimFrame(m_blowFrame); + m_blowFrame++; + if(m_blowFrame>=m_player->getAnimFrameCount()) { m_player->setAnimNo(m_savedAnimNo); m_player->setAnimFrame(m_savedAnimFrame); - m_chopping=false; + m_blowing=false; + m_bubbleDelay=BUBBLE_DELAY; + if(--m_bubbleCount==0) + { + m_player->setMode(PLAYER_MODE_FULLUNARMED); + } } } } @@ -120,18 +141,7 @@ void CPlayerModeBubbleMixture::setAnimFrame(int _animFrame) Params: Returns: ---------------------------------------------------------------------- */ -int CPlayerModeBubbleMixture::isInAttackState() -{ - return m_chopping||CPlayerModeBase::isInAttackState(); -} - -/*---------------------------------------------------------------------- - Function: - Purpose: - Params: - Returns: - ---------------------------------------------------------------------- */ -int CPlayerModeBubbleMixture::canAttackFromThisState() +int CPlayerModeBubbleMixture::canBlowBubbleFromThisState() { int ret=false; diff --git a/source/player/pmbubble.h b/source/player/pmbubble.h index d0ae46232..51fe62356 100644 --- a/source/player/pmbubble.h +++ b/source/player/pmbubble.h @@ -43,14 +43,21 @@ public: virtual void setAnimNo(int _animNo); virtual void setAnimFrame(int _animFrame); - virtual int isInAttackState(); - private: - int canAttackFromThisState(); + enum + { + BUBBLE_AMMO=10, + BUBBLE_DELAY=60*1, + }; + + int canBlowBubbleFromThisState(); int m_savedAnimNo,m_savedAnimFrame; - int m_chopFrame; - int m_chopping; + int m_blowFrame; + int m_blowing; + int m_bubbleDelay; + + int m_bubbleCount; };