SBSPSS/source/player/pmbloon.cpp

175 lines
4.1 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-05-25 21:04:29 +02:00
#include "game/game.h"
2001-03-23 22:15:46 +01:00
/* Std Lib
------- */
/* Data
---- */
2001-04-09 22:08:56 +02:00
#ifndef __ANIM_SPONGEBOB_HEADER__
#include <ACTOR_SPONGEBOB_ANIM.h>
#endif
2001-04-20 16:53:35 +02:00
#ifndef __SPR_SPRITES_H__
#include <sprites.h>
2001-03-27 22:29:02 +02:00
#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-04-11 17:48:16 +02:00
DEFAULT_BUTT_FALL_VELOCITY, // PM__BUTT_FALL_VELOCITY
2001-05-11 21:49:41 +02:00
DEFAULT_HITREACT_XVELOCITY, // PM__HITREACT_XVELOCITY
DEFAULT_HITREACT_YVELOCITY, // PM__HITREACT_YVELOCITY
DEFAULT_HITREACT_FRAMES, // PM__HITREACT_FRAMES
2001-03-23 22:15:46 +01:00
} };
2001-05-25 20:48:58 +02:00
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CPlayerModeBalloon::enter()
{
CPlayerModeBase::enter();
m_timer=0;
2001-05-25 21:30:03 +02:00
m_playedPopSound=false;
2001-05-25 20:48:58 +02:00
}
2001-03-25 23:33:20 +02:00
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CPlayerModeBalloon::think()
{
CPlayerModeBase::think();
2001-05-25 20:48:58 +02:00
if(++m_timer>BALLOON_TIMEOUT)
{
2001-05-25 21:30:03 +02:00
if(!m_playedPopSound)
{
CSoundMediator::playSfx(CSoundMediator::SFX_BALLOON_POP);
}
2001-05-25 20:48:58 +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;
2001-04-05 18:26:17 +02:00
int balloony=-120;
int balloonsize=350;
void CPlayerModeBalloon::render(DVECTOR *_pos)
2001-03-27 22:29:02 +02:00
{
2001-04-05 18:26:17 +02:00
DVECTOR pos;
2001-05-25 21:27:38 +02:00
int frame;
2001-04-05 18:26:17 +02:00
2001-03-27 22:29:02 +02:00
CPlayerModeBase::render();
2001-04-05 18:26:17 +02:00
pos.vx=_pos->vx+balloonx;
pos.vy=_pos->vy+balloony;
2001-05-25 21:27:38 +02:00
if(m_timer<BALLOON_TIMEOUT-BALLOON_POP_FRAMES)
{
frame=FRM__BALLOON;
}
else
{
frame=FRM__BALLOONBURST;
2001-05-25 21:30:03 +02:00
if(!m_playedPopSound)
{
CSoundMediator::playSfx(CSoundMediator::SFX_BALLOON_POP);
m_playedPopSound=true;
}
2001-05-25 21:27:38 +02:00
}
CGameScene::getSpriteBank()->printFT4Scaled(frame,pos.vx,pos.vy,0,0,5,balloonsize);
2001-03-27 22:29:02 +02:00
}
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;
}
2001-04-09 22:08:56 +02:00
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CPlayerModeBalloon::setAnimNo(int _animNo)
{
// I think I'll overload the JUMP anim to the BALLOONJUMP here..
// Just 'cos I can :)
if(_animNo==ANIM_SPONGEBOB_JUMP)
{
_animNo=ANIM_SPONGEBOB_BALLOONJUMP;
}
CPlayerModeBase::setAnimNo(_animNo);
}
2001-03-23 22:15:46 +01:00
/*===========================================================================
end */