2001-01-22 21:58:36 +01:00
|
|
|
|
|
|
|
/*=========================================================================
|
|
|
|
|
|
|
|
psduck.cpp
|
|
|
|
|
|
|
|
Author: PKG
|
|
|
|
Created:
|
|
|
|
Project: Spongebob
|
|
|
|
Purpose:
|
|
|
|
|
|
|
|
Copyright (c) 2001 Climax Development Ltd
|
|
|
|
|
|
|
|
===========================================================================*/
|
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Includes
|
|
|
|
-------- */
|
|
|
|
|
|
|
|
#include "player\psduck.h"
|
|
|
|
|
|
|
|
#ifndef __PLAYER_PLAYER_H__
|
|
|
|
#include "player\player.h"
|
|
|
|
#endif
|
|
|
|
|
2001-03-23 21:09:14 +01:00
|
|
|
#ifndef __PLAYER_PMODES_H__
|
|
|
|
#include "player\pmodes.h"
|
|
|
|
#endif
|
|
|
|
|
2001-05-15 00:08:19 +02:00
|
|
|
#ifndef __GAME_GAMEBUBS_H__
|
|
|
|
#include "game\gamebubs.h"
|
|
|
|
#endif
|
|
|
|
|
2001-01-22 21:58:36 +01:00
|
|
|
|
|
|
|
/* Std Lib
|
|
|
|
------- */
|
|
|
|
|
|
|
|
/* Data
|
|
|
|
---- */
|
|
|
|
|
2001-02-26 21:05:31 +01:00
|
|
|
#ifndef __ANIM_SPONGEBOB_HEADER__
|
|
|
|
#include <ACTOR_SPONGEBOB_ANIM.h>
|
2001-01-22 21:58:36 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Tyepdefs && Defines
|
|
|
|
------------------- */
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Structure defintions
|
|
|
|
-------------------- */
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function Prototypes
|
|
|
|
------------------- */
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Vars
|
|
|
|
---- */
|
|
|
|
|
2001-04-03 18:47:07 +02:00
|
|
|
CPlayerStateSoakUp s_stateSoakUp;
|
|
|
|
CPlayerStateGetUp s_stateGetUp;
|
|
|
|
|
|
|
|
|
2001-01-22 21:58:36 +01:00
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
2001-03-25 22:36:28 +02:00
|
|
|
void CPlayerStateSoakUp::enter(CPlayerModeBase *_playerMode)
|
2001-01-22 21:58:36 +01:00
|
|
|
{
|
2001-03-23 21:09:14 +01:00
|
|
|
_playerMode->zeroMoveVelocity();
|
2001-06-21 22:51:55 +02:00
|
|
|
_playerMode->setAnimNo(ANIM_SPONGEBOB_DONOTDRAW);
|
2001-05-15 00:08:19 +02:00
|
|
|
m_breatheDelayFrames=0;
|
2001-07-12 22:15:10 +02:00
|
|
|
|
2001-01-22 21:58:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
2001-03-25 22:36:28 +02:00
|
|
|
void CPlayerStateSoakUp::think(CPlayerModeBase *_playerMode)
|
2001-01-22 21:58:36 +01:00
|
|
|
{
|
2001-07-31 21:17:09 +02:00
|
|
|
if(!_playerMode->getIsHelmetSoFullThatIDontNeedToSoakUp())
|
2001-01-22 21:58:36 +01:00
|
|
|
{
|
2001-05-15 00:08:19 +02:00
|
|
|
if(m_breatheDelayFrames==0)
|
|
|
|
{
|
2001-07-23 21:26:37 +02:00
|
|
|
DVECTOR const & pos=_playerMode->getPlayerPos();
|
2001-05-15 00:08:19 +02:00
|
|
|
CGameBubicleFactory::spawnBubicles(pos.vx+BUBBLE_XOFF,pos.vy+BUBBLE_YOFF,BUBBLE_W,BUBBLE_H,CGameBubicleFactory::TYPE_SPONGEBOBSOAKUP);
|
|
|
|
m_breatheDelayFrames=0;
|
|
|
|
}
|
|
|
|
if(++m_breatheDelayFrames>BUBBLE_SPAWNDELAY)
|
|
|
|
{
|
|
|
|
m_breatheDelayFrames=0;
|
|
|
|
}
|
|
|
|
_playerMode->inSoakUpState();
|
2001-01-22 21:58:36 +01:00
|
|
|
}
|
2001-05-04 01:45:28 +02:00
|
|
|
else
|
|
|
|
{
|
2001-05-15 00:08:19 +02:00
|
|
|
_playerMode->setState(STATE_GETUP);
|
2001-05-04 01:45:28 +02:00
|
|
|
}
|
2001-01-22 21:58:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
2001-03-25 22:36:28 +02:00
|
|
|
void CPlayerStateGetUp::enter(CPlayerModeBase *_playerMode)
|
2001-01-22 21:58:36 +01:00
|
|
|
{
|
2001-03-23 21:09:14 +01:00
|
|
|
_playerMode->setAnimNo(ANIM_SPONGEBOB_GETUP);
|
2001-01-22 21:58:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
2001-03-25 22:36:28 +02:00
|
|
|
void CPlayerStateGetUp::think(CPlayerModeBase *_playerMode)
|
2001-01-22 21:58:36 +01:00
|
|
|
{
|
2001-03-23 21:09:14 +01:00
|
|
|
if(_playerMode->advanceAnimFrameAndCheckForEndOfAnim())
|
2001-01-22 21:58:36 +01:00
|
|
|
{
|
2001-03-23 21:09:14 +01:00
|
|
|
_playerMode->setState(STATE_IDLE);
|
2001-01-22 21:58:36 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*===========================================================================
|
|
|
|
end */
|