SBSPSS/source/player/psfly.cpp

108 lines
2.1 KiB
C++
Raw Normal View History

2001-02-12 21:36:56 +01:00
/*=========================================================================
psfly.cpp
Author: PKG
Created:
Project: Spongebob
Purpose: Debugginf mode to allow SB to fly around the map
Copyright (c) 2001 Climax Development Ltd
===========================================================================*/
/*----------------------------------------------------------------------
Includes
-------- */
#include "player\psfly.h"
#ifndef __PLAYER_PLAYER_H__
#include "player\player.h"
#endif
#ifndef __PAD_PADS_H__
#include "pad\pads.h"
#endif
/* Std Lib
------- */
/* Data
---- */
#ifndef __ANIM_PLAYER_ANIM_HEADER__
#include <player_anim.h>
#endif
/*----------------------------------------------------------------------
Tyepdefs && Defines
------------------- */
/*----------------------------------------------------------------------
Structure defintions
-------------------- */
/*----------------------------------------------------------------------
Function Prototypes
------------------- */
/*----------------------------------------------------------------------
Vars
---- */
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
2001-02-12 22:54:44 +01:00
void CPlayerStateFly::enter(CPlayer *_player)
2001-02-12 21:36:56 +01:00
{
setAnimNo(_player,ANIM_PLAYER_ANIM_IDLEHOOLA);
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
2001-02-12 22:54:44 +01:00
void CPlayerStateFly::think(CPlayer *_player)
2001-02-12 21:36:56 +01:00
{
int controlHeld;
DVECTOR pos;
controlHeld=getPadInputHeld(_player);
pos=getPlayerPos(_player);
2001-02-12 22:54:44 +01:00
if(controlHeld&PI_LEFT)
2001-02-12 21:36:56 +01:00
{
2001-02-12 22:54:44 +01:00
pos.vx-=8;
2001-02-12 21:36:56 +01:00
}
2001-02-12 22:54:44 +01:00
else if(controlHeld&PI_RIGHT)
2001-02-12 21:36:56 +01:00
{
2001-02-12 22:54:44 +01:00
pos.vx+=8;
2001-02-12 21:36:56 +01:00
}
2001-02-12 22:54:44 +01:00
if(controlHeld&PI_UP)
2001-02-12 21:36:56 +01:00
{
2001-02-12 22:54:44 +01:00
pos.vy-=8;
2001-02-12 21:36:56 +01:00
}
2001-02-12 22:54:44 +01:00
else if(controlHeld&PI_DOWN)
2001-02-12 21:36:56 +01:00
{
2001-02-12 22:54:44 +01:00
pos.vy+=8;
2001-02-12 21:36:56 +01:00
}
2001-02-12 22:54:44 +01:00
this->setPlayerPos(_player,&pos);
2001-02-12 21:36:56 +01:00
advanceAnimFrameAndCheckForEndOfAnim(_player);
}
/*===========================================================================
end */