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
|
|
|
|
---- */
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
|
|
|
void CPlayerModeDead::enter()
|
|
|
|
{
|
2001-05-17 20:42:59 +02:00
|
|
|
int deathAnim;
|
|
|
|
|
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-04 17:01:20 +02:00
|
|
|
deathAnim=ANIM_SPONGEBOB_DEATHFORWARDS;
|
2001-05-17 20:42:59 +02:00
|
|
|
break;
|
|
|
|
case DEATHTYPE__DRYUP:
|
|
|
|
deathAnim=ANIM_SPONGEBOB_DEATHDRY;
|
|
|
|
break;
|
|
|
|
case DEATHTYPE__SQUASH:
|
|
|
|
deathAnim=ANIM_SPONGEBOB_DEATHSQUASH;
|
|
|
|
break;
|
2001-06-04 16:41:56 +02:00
|
|
|
case DEATHTYPE__LIQUID:
|
2001-07-04 17:01:20 +02:00
|
|
|
deathAnim=ANIM_SPONGEBOB_DEATHFORWARDS;
|
2001-06-04 16:41:56 +02:00
|
|
|
break;
|
2001-07-18 01:26:21 +02:00
|
|
|
case DEATHTYPE__FALL_TO_DEATH:
|
|
|
|
deathAnim=-1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(deathAnim!=-1)
|
|
|
|
{
|
|
|
|
m_player->setAnimNo(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-18 01:26:21 +02:00
|
|
|
if(m_deadTime<m_player->getAnimFrameCount())
|
|
|
|
{
|
|
|
|
m_player->setAnimFrame(m_deadTime);
|
|
|
|
}
|
2001-04-19 16:33:27 +02:00
|
|
|
}
|
|
|
|
|
2001-05-15 23:41:39 +02:00
|
|
|
m_player->moveVertical(5);
|
2001-04-25 20:38:33 +02:00
|
|
|
|
2001-07-24 17:25:54 +02:00
|
|
|
if(!m_killed)
|
2001-05-18 20:05:24 +02:00
|
|
|
if((m_deadTime>DEATH_DELAY&&m_player->getPadInputDown()&(PI_JUMP|PI_FIRE))||
|
2001-03-25 23:33:20 +02:00
|
|
|
m_deadTime>DEATH_TIMEOUT)
|
2001-03-25 23:09:06 +02:00
|
|
|
{
|
2001-07-18 17:05:57 +02:00
|
|
|
// Take a life off..
|
|
|
|
CGameSlotManager::getSlotData()->m_lives--;
|
|
|
|
|
2001-05-11 03:58:36 +02:00
|
|
|
CGameScene::restartlevel();
|
2001-07-24 17:25:54 +02:00
|
|
|
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 */
|