SBSPSS/source/player/pmdead.cpp

188 lines
3.7 KiB
C++
Raw Normal View History

2001-03-25 23:09:06 +02:00
/*=========================================================================
pmdead.cpp
Author: PKG
Created:
Project: Spongebob
Purpose:
Copyright (c) 2001 Climax Development Ltd
===========================================================================*/
/*----------------------------------------------------------------------
Includes
-------- */
#include "player\pmdead.h"
2001-05-11 03:58:36 +02:00
#ifndef __GAME_GAME_H__
#include "game\game.h"
#endif
2001-07-18 17:05:57 +02:00
#ifndef __GAME_GAMESLOT_H__
#include "game\gameslot.h"
#endif
2001-03-25 23:09:06 +02:00
/* Std Lib
------- */
/* Data
---- */
2001-04-05 18:26:17 +02:00
#ifndef __ANIM_SPONGEBOB_HEADER__
#include <ACTOR_SPONGEBOB_ANIM.h>
#endif
2001-03-25 23:09:06 +02:00
/*----------------------------------------------------------------------
Tyepdefs && Defines
------------------- */
/*----------------------------------------------------------------------
Structure defintions
-------------------- */
/*----------------------------------------------------------------------
Function Prototypes
------------------- */
/*----------------------------------------------------------------------
Vars
---- */
2001-07-30 17:08:29 +02:00
static int anim=0;
2001-03-25 23:09:06 +02:00
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CPlayerModeDead::enter()
{
2001-03-25 23:33:20 +02:00
m_deadTime=0;
2001-05-17 20:42:59 +02:00
switch(m_player->getDeathType())
{
default:
case DEATHTYPE__NORMAL:
2001-07-30 17:08:29 +02:00
m_deathAnim=ANIM_SPONGEBOB_DEATHFORWARDS;
2001-05-17 20:42:59 +02:00
break;
case DEATHTYPE__DRYUP:
2001-07-30 17:08:29 +02:00
m_deathAnim=ANIM_SPONGEBOB_DEATHDRY;
2001-05-17 20:42:59 +02:00
break;
case DEATHTYPE__SQUASH:
2001-08-14 23:03:31 +02:00
m_deathAnim=ANIM_SPONGEBOB_DEATHFORWARDS;
2001-05-17 20:42:59 +02:00
break;
2001-06-04 16:41:56 +02:00
case DEATHTYPE__LIQUID:
2001-08-14 23:03:31 +02:00
m_deathAnim=ANIM_SPONGEBOB_DEATHTAR;
2001-06-04 16:41:56 +02:00
break;
2001-07-18 01:26:21 +02:00
case DEATHTYPE__FALL_TO_DEATH:
2001-07-30 17:08:29 +02:00
m_deathAnim=-1;
2001-07-18 01:26:21 +02:00
break;
}
2001-07-30 17:08:29 +02:00
if(m_deathAnim!=-1)
2001-07-18 01:26:21 +02:00
{
2001-07-30 17:08:29 +02:00
m_player->setAnimNo(m_deathAnim);
2001-05-17 20:42:59 +02:00
}
2001-07-24 17:25:54 +02:00
2001-07-26 17:22:34 +02:00
CSoundMediator::stopSpeech();
2001-07-24 17:25:54 +02:00
m_killed=false;
2001-03-25 23:09:06 +02:00
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CPlayerModeDead::think()
{
2001-03-25 23:33:20 +02:00
m_deadTime++;
2001-07-18 01:26:21 +02:00
if(m_player->getDeathType()!=DEATHTYPE__FALL_TO_DEATH)
2001-04-19 16:33:27 +02:00
{
2001-07-30 17:08:29 +02:00
int frameCount,frame;
if(m_deathAnim!=-1)
{
m_player->setAnimNo(m_deathAnim);
}
frameCount=m_player->getAnimFrameCount()-1;
if(m_deadTime<=frameCount)
{
frame=m_deadTime;
}
else
2001-07-18 01:26:21 +02:00
{
2001-07-30 17:08:29 +02:00
frame=frameCount;
2001-07-18 01:26:21 +02:00
}
2001-07-30 17:08:29 +02:00
m_player->setAnimFrame(frame);
2001-04-19 16:33:27 +02:00
}
2001-08-14 20:36:21 +02:00
if(m_player->getPos().vy<(GameScene.GetLevel().getMapSize().vy+4)*16)
{
m_player->moveVertical(5);
}
2001-04-25 20:38:33 +02:00
2001-07-24 17:25:54 +02:00
if(!m_killed)
2001-03-25 23:09:06 +02:00
{
2001-07-30 17:08:29 +02:00
if((m_deadTime>DEATH_DELAY&&m_player->getPadInputDown()&(PI_JUMP|PI_FIRE))||
m_deadTime>DEATH_TIMEOUT)
{
2001-07-31 23:01:04 +02:00
if(GameScene.getLevelNumber()!=5)
{
// Take a life off..
CGameSlotManager::getSlotData()->m_lives--;
}
2001-07-18 17:05:57 +02:00
2001-07-30 17:08:29 +02:00
CGameScene::restartlevel();
m_killed=true;
}
2001-03-25 23:09:06 +02:00
}
}
2001-04-05 18:26:17 +02:00
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
/*
void CPlayerModeDead::render(DVECTOR *_pos)
{
DVECTOR deadSbPos;
deadSbPos=*_pos;
deadSbPos.vy-=m_deadTime;
m_player->renderSb(&deadSbPos,ANIM_SPONGEBOB_DEATHANGLE,0);
}
*/
2001-04-19 16:33:27 +02:00
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CPlayerModeDead::fall()
{
2001-04-25 20:38:33 +02:00
/*
m_yVelocity+=getPlayerMetrics()->m_metric[DEFAULT_PLAYER_PLAYER_GRAVITY];
if(m_yVelocity>=metrics->m_metric[DEFAULT_PLAYER_TERMINAL_VELOCITY]<<VELOCITY_SHIFT)
2001-04-19 16:33:27 +02:00
{
2001-04-25 20:38:33 +02:00
m_yVelocity=metrics->m_metric[DEFAULT_PLAYER_TERMINAL_VELOCITY]<<VELOCITY_SHIFT;
2001-04-19 16:33:27 +02:00
}
2001-04-25 20:38:33 +02:00
*/
2001-04-19 16:33:27 +02:00
}
2001-03-25 23:09:06 +02:00
/*===========================================================================
end */