SBSPSS/source/player/psballoon.cpp

117 lines
2.3 KiB
C++
Raw Normal View History

2001-02-28 17:22:07 +01:00
/*=========================================================================
psballoon.cpp
Author: PKG
Created:
Project: Spongebob
Purpose:
Copyright (c) 2001 Climax Development Ltd
===========================================================================*/
/*----------------------------------------------------------------------
Includes
-------- */
#include "player\psballoon.h"
#ifndef __PLAYER_PLAYER_H__
#include "player\player.h"
#endif
/* Std Lib
------- */
/* Data
---- */
#ifndef __ANIM_SPONGEBOB_HEADER__
#include <ACTOR_SPONGEBOB_ANIM.h>
#endif
/*----------------------------------------------------------------------
Tyepdefs && Defines
------------------- */
2001-02-28 20:37:01 +01:00
#define MAX_BALLOON_VELOCITY 5
2001-02-28 17:22:07 +01:00
/*----------------------------------------------------------------------
Structure defintions
-------------------- */
/*----------------------------------------------------------------------
Function Prototypes
------------------- */
/*----------------------------------------------------------------------
Vars
---- */
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CPlayerStateBalloon::enter(CPlayer *_player)
{
2001-02-28 20:37:01 +01:00
setAnimNo(_player,ANIM_SPONGEBOB_HOVER);
m_canDropBalloon=false;
2001-02-28 17:22:07 +01:00
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CPlayerStateBalloon::think(CPlayer *_player)
{
int controlDown,controlHeld;
controlDown=getPadInputDown(_player);
controlHeld=getPadInputHeld(_player);
2001-02-28 20:37:01 +01:00
if(m_canDropBalloon&&controlDown&PI_ACTION)
2001-02-28 17:22:07 +01:00
{
2001-02-28 20:37:01 +01:00
setMode(_player,PLAYER_MODE_FULLUNARMED);
2001-02-28 17:22:07 +01:00
}
if(controlHeld&PI_LEFT)
{
moveLeft(_player);
}
else if(controlHeld&PI_RIGHT)
{
moveRight(_player);
}
else
{
2001-02-28 20:37:01 +01:00
slowdown(_player);
2001-02-28 17:22:07 +01:00
}
2001-02-28 20:37:01 +01:00
DVECTOR moveVel=getMoveVelocity(_player);
if(moveVel.vy>-MAX_BALLOON_VELOCITY)
{
moveVel.vy--;
}
if(moveVel.vy<-MAX_BALLOON_VELOCITY)
{
moveVel.vy++;
}
setMoveVelocity(_player,&moveVel);
2001-02-28 17:22:07 +01:00
if(advanceAnimFrameAndCheckForEndOfAnim(_player))
{
2001-02-28 20:37:01 +01:00
m_canDropBalloon=true;
2001-02-28 17:22:07 +01:00
}
}
/*===========================================================================
end */