SBSPSS/source/player/pmbloon.cpp

160 lines
3.8 KiB
C++
Raw Normal View History

2001-03-23 22:15:46 +01:00
/*=========================================================================
pmbloon.cpp
Author: PKG
Created:
Project: Spongebob
Purpose:
Copyright (c) 2001 Climax Development Ltd
===========================================================================*/
/*----------------------------------------------------------------------
Includes
-------- */
2001-03-25 22:36:28 +02:00
#include "player\pmbloon.h"
2001-03-23 22:15:46 +01:00
2001-03-27 22:29:02 +02:00
#ifndef __GFX_SPRBANK_H__
#include "gfx\sprbank.h"
#endif
#ifndef __LEVEL_LEVEL_H__
#include "level\level.h"
#endif
2001-03-23 22:15:46 +01:00
/* Std Lib
------- */
/* Data
---- */
2001-03-27 22:29:02 +02:00
#ifndef __SPR_INGAMEFX_H__
#include <ingamefx.h>
#endif
2001-03-23 22:15:46 +01:00
/*----------------------------------------------------------------------
Tyepdefs && Defines
------------------- */
/*----------------------------------------------------------------------
Structure defintions
-------------------- */
/*----------------------------------------------------------------------
Function Prototypes
------------------- */
/*----------------------------------------------------------------------
Vars
---- */
2001-03-25 22:36:28 +02:00
static PlayerMetrics s_playerMetrics=
2001-03-23 22:15:46 +01:00
{ {
DEFAULT_PLAYER_JUMP_VELOCITY, // PM__JUMP_VELOCITY
2001-03-25 22:36:28 +02:00
DEFAULT_PLAYER_MAX_JUMP_FRAMES, // PM__MAX_JUMP_FRAMES
2001-03-23 22:15:46 +01:00
DEFAULT_PLAYER_MAX_SAFE_FALL_FRAMES, // PM__MAX_SAFE_FALL_FRAMES
DEFAULT_PLAYER_MAX_RUN_VELOCITY, // PM__MAX_RUN_VELOCITY
2001-03-25 22:36:28 +02:00
DEFAULT_PLAYER_RUN_SPEEDUP, // PM__RUN_SPEEDUP
DEFAULT_PLAYER_RUN_REVERSESLOWDOWN, // PM__RUN_REVERSESLOWDOWN
2001-03-23 22:15:46 +01:00
DEFAULT_PLAYER_RUN_SLOWDOWN, // PM__RUN_SLOWDOWN
2001-03-25 22:36:28 +02:00
DEFAULT_PLAYER_PLAYER_GRAVITY/3, // PM__GRAVITY
DEFAULT_PLAYER_TERMINAL_VELOCITY/3, // PM__TERMINAL_VELOCITY
2001-03-23 22:15:46 +01:00
} };
2001-03-27 22:29:02 +02:00
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CPlayerModeBalloon::initialise(class CPlayer *_player)
{
CPlayerModeBase::initialise(_player);
m_sprites=new ("BalloonSprite") SpriteBank();
m_sprites->load(INGAMEFX_INGAMEFX_SPR);
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CPlayerModeBalloon::shutdown()
{
m_sprites->dump(); delete m_sprites;
CPlayerModeBase::shutdown();
}
2001-03-25 23:33:20 +02:00
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CPlayerModeBalloon::enter()
{
CPlayerModeBase::enter();
2001-03-27 22:29:02 +02:00
m_balloonTimer=BALLOON_TIME;
2001-03-25 23:33:20 +02:00
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CPlayerModeBalloon::think()
{
CPlayerModeBase::think();
2001-03-27 22:29:02 +02:00
if(--m_balloonTimer==0||getPadInputDown()&PI_ACTION)
2001-03-25 23:33:20 +02:00
{
PAUL_DBGMSG("*pop*");
2001-03-25 23:45:52 +02:00
m_player->setMode(PLAYER_MODE_FULLUNARMED);
2001-03-25 23:33:20 +02:00
}
}
2001-03-27 22:29:02 +02:00
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
int balloonx=-14;
int balloony=-90;
void CPlayerModeBalloon::render()
{
DVECTOR ofs,pos;
CPlayerModeBase::render();
if(m_balloonTimer>BALLOON_FLASH_TIME||
m_balloonTimer&2)
{
ofs=CLevel::getCameraPos();
pos=m_player->getPlayerPos();
pos.vx+=balloonx-ofs.vx;
pos.vy+=balloony-ofs.vy;
m_sprites->printFT4(FRM__BALLOON,pos.vx,pos.vy,0,0,0);
}
}
2001-03-23 22:15:46 +01:00
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
2001-03-25 22:36:28 +02:00
const struct PlayerMetrics *CPlayerModeBalloon::getPlayerMetrics()
2001-03-23 22:15:46 +01:00
{
return &s_playerMetrics;
}
/*===========================================================================
end */