This commit is contained in:
Paul 2001-03-30 19:27:26 +00:00
parent 10d3f9e01d
commit d2f4fea8a9
2 changed files with 47 additions and 30 deletions

View file

@ -53,7 +53,10 @@
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CPlayerModeBubbleMixture::enter() 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() 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 // doing the think so that the rest of the code doesn't know what
// is going on ;) // is going on ;)
if(m_chopping) if(m_blowing)
{ {
setAnimNo(m_savedAnimNo); setAnimNo(m_savedAnimNo);
setAnimFrame(m_savedAnimFrame); setAnimFrame(m_savedAnimFrame);
} }
CPlayerModeBase::think(); CPlayerModeBase::think();
// Start to chop? if(m_bubbleDelay)
if(!m_chopping&&getPadInputDown()&PI_ACTION&&canAttackFromThisState())
{ {
m_chopFrame=0; // Delay so that you can't blow all of your bubbles really quickly
m_chopping=true; 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? // Blowing?
if(m_chopping) if(m_blowing)
{ {
m_player->setAnimNo(ANIM_SPONGEBOB_KARATE); m_player->setAnimNo(ANIM_SPONGEBOB_KARATE);
m_player->setAnimFrame(m_chopFrame); m_player->setAnimFrame(m_blowFrame);
m_chopFrame++; m_blowFrame++;
if(m_chopFrame>=m_player->getAnimFrameCount()) if(m_blowFrame>=m_player->getAnimFrameCount())
{ {
m_player->setAnimNo(m_savedAnimNo); m_player->setAnimNo(m_savedAnimNo);
m_player->setAnimFrame(m_savedAnimFrame); 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: Params:
Returns: Returns:
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
int CPlayerModeBubbleMixture::isInAttackState() int CPlayerModeBubbleMixture::canBlowBubbleFromThisState()
{
return m_chopping||CPlayerModeBase::isInAttackState();
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
int CPlayerModeBubbleMixture::canAttackFromThisState()
{ {
int ret=false; int ret=false;

View file

@ -43,14 +43,21 @@ public:
virtual void setAnimNo(int _animNo); virtual void setAnimNo(int _animNo);
virtual void setAnimFrame(int _animFrame); virtual void setAnimFrame(int _animFrame);
virtual int isInAttackState();
private: private:
int canAttackFromThisState(); enum
{
BUBBLE_AMMO=10,
BUBBLE_DELAY=60*1,
};
int canBlowBubbleFromThisState();
int m_savedAnimNo,m_savedAnimFrame; int m_savedAnimNo,m_savedAnimFrame;
int m_chopFrame; int m_blowFrame;
int m_chopping; int m_blowing;
int m_bubbleDelay;
int m_bubbleCount;
}; };