This commit is contained in:
parent
c429fd833a
commit
6867ac9812
4 changed files with 280 additions and 0 deletions
117
source/player/psfloat.cpp
Normal file
117
source/player/psfloat.cpp
Normal file
|
@ -0,0 +1,117 @@
|
|||
/*=========================================================================
|
||||
|
||||
psfloat.cpp
|
||||
|
||||
Author: CRB
|
||||
Created:
|
||||
Project: Spongebob
|
||||
Purpose:
|
||||
|
||||
Copyright (c) 2001 Climax Development Ltd
|
||||
|
||||
===========================================================================*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Includes
|
||||
-------- */
|
||||
|
||||
#include "player\psfloat.h"
|
||||
|
||||
#ifndef __PLAYER_PLAYER_H__
|
||||
#include "player\player.h"
|
||||
#endif
|
||||
|
||||
#ifndef __PLAYER_PMODES_H__
|
||||
#include "player\pmodes.h"
|
||||
#endif
|
||||
|
||||
#ifndef __SOUND_SOUND_H__
|
||||
#include "sound\sound.h"
|
||||
#endif
|
||||
|
||||
#ifndef __PLATFORM_PLATFORM_H__
|
||||
#include "platform\platform.h"
|
||||
#endif
|
||||
|
||||
|
||||
/* Std Lib
|
||||
------- */
|
||||
|
||||
/* Data
|
||||
---- */
|
||||
|
||||
#ifndef __ANIM_SPONGEBOB_HEADER__
|
||||
#include <ACTOR_SPONGEBOB_ANIM.h>
|
||||
#endif
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Tyepdefs && Defines
|
||||
------------------- */
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Structure defintions
|
||||
-------------------- */
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Function Prototypes
|
||||
------------------- */
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Vars
|
||||
---- */
|
||||
|
||||
CPlayerStateFloat s_stateFloat;
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose:
|
||||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CPlayerStateFloat::enter(CPlayerModeBase *_playerMode)
|
||||
{
|
||||
m_isActive = true;
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose:
|
||||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CPlayerStateFloat::think(CPlayerModeBase *_playerMode)
|
||||
{
|
||||
if ( _playerMode->advanceAnimFrameAndCheckForEndOfAnim() )
|
||||
{
|
||||
_playerMode->setAnimNo( ANIM_SPONGEBOB_IDLEBREATH );
|
||||
}
|
||||
|
||||
int controlHeld;
|
||||
|
||||
controlHeld=_playerMode->getPadInputHeld();
|
||||
|
||||
if(controlHeld&PI_LEFT)
|
||||
{
|
||||
_playerMode->moveLeft();
|
||||
}
|
||||
else if(controlHeld&PI_RIGHT)
|
||||
{
|
||||
_playerMode->moveRight();
|
||||
}
|
||||
|
||||
if ( m_isActive )
|
||||
{
|
||||
m_isActive = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
_playerMode->setState( STATE_IDLE );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*===========================================================================
|
||||
end */
|
60
source/player/psfloat.h
Normal file
60
source/player/psfloat.h
Normal file
|
@ -0,0 +1,60 @@
|
|||
/*=========================================================================
|
||||
|
||||
psfloat.h
|
||||
|
||||
Author: CRB
|
||||
Created:
|
||||
Project: Spongebob
|
||||
Purpose:
|
||||
|
||||
Copyright (c) 2001 Climax Development Ltd
|
||||
|
||||
===========================================================================*/
|
||||
|
||||
#ifndef __PLAYER_PSFLOAT_H__
|
||||
#define __PLAYER_PSFLOAT_H__
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Includes
|
||||
-------- */
|
||||
|
||||
#include "player\pstates.h"
|
||||
|
||||
|
||||
/* Std Lib
|
||||
------- */
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Tyepdefs && Defines
|
||||
------------------- */
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Structure defintions
|
||||
-------------------- */
|
||||
|
||||
class CPlayerStateFloat : public CPlayerState
|
||||
{
|
||||
public:
|
||||
void enter(class CPlayerModeBase *_playerMode);
|
||||
void think(class CPlayerModeBase *_playerMode);
|
||||
protected:
|
||||
bool m_isActive;
|
||||
};
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Globals
|
||||
------- */
|
||||
|
||||
extern CPlayerStateFloat s_stateFloat;
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Functions
|
||||
--------- */
|
||||
|
||||
/*---------------------------------------------------------------------- */
|
||||
|
||||
#endif /* __PLAYER_PSFLOAT_H__ */
|
||||
|
||||
/*===========================================================================
|
||||
end */
|
48
source/triggers/twindup.cpp
Normal file
48
source/triggers/twindup.cpp
Normal file
|
@ -0,0 +1,48 @@
|
|||
/*=========================================================================
|
||||
|
||||
twindup.cpp
|
||||
|
||||
Author: Charles Blair
|
||||
Created:
|
||||
Project: Spongebob
|
||||
Purpose:
|
||||
|
||||
Copyright (c) 2001 Climax Development Ltd
|
||||
|
||||
===========================================================================*/
|
||||
|
||||
#ifndef __TRIGGERS_TWINDUP_H__
|
||||
#include "triggers\twindup.h"
|
||||
#endif
|
||||
|
||||
#ifndef __PLAYER_PLAYER_H__
|
||||
#include "player\player.h"
|
||||
#endif
|
||||
|
||||
#ifndef __SYSTEM_GSTATE_H__
|
||||
#include "system\gstate.h"
|
||||
#endif
|
||||
|
||||
|
||||
void CWindUpTrigger::collidedWith(CThing *_thisThing)
|
||||
{
|
||||
switch( _thisThing->getThingType() )
|
||||
{
|
||||
case TYPE_PLAYER:
|
||||
{
|
||||
CPlayer *player = (CPlayer *) _thisThing;
|
||||
|
||||
DVECTOR move;
|
||||
move.vy = -4 * GameState::getFramesSinceLast();
|
||||
|
||||
player->shove( move );
|
||||
player->setFloating();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
55
source/triggers/twindup.h
Normal file
55
source/triggers/twindup.h
Normal file
|
@ -0,0 +1,55 @@
|
|||
/*=========================================================================
|
||||
|
||||
twindup.h
|
||||
|
||||
Author: Charles Blair
|
||||
Created:
|
||||
Project: Spongebob
|
||||
Purpose:
|
||||
|
||||
Copyright (c) 2001 Climax Development Ltd
|
||||
|
||||
===========================================================================*/
|
||||
|
||||
#ifndef __TRIGGERS_TWINDUP_H__
|
||||
#define __TRIGGERS_TWINDUP_H__
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Includes
|
||||
-------- */
|
||||
|
||||
#ifndef __TRIGGERS_THAZARD_H__
|
||||
#include "triggers\thazard.h"
|
||||
#endif
|
||||
|
||||
/* Std Lib
|
||||
------- */
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Tyepdefs && Defines
|
||||
------------------- */
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Structure defintions
|
||||
-------------------- */
|
||||
|
||||
class CWindUpTrigger : public CTrigger
|
||||
{
|
||||
protected:
|
||||
virtual void collidedWith(CThing *_thisThing);
|
||||
};
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Globals
|
||||
------- */
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Functions
|
||||
--------- */
|
||||
|
||||
/*---------------------------------------------------------------------- */
|
||||
|
||||
#endif
|
||||
|
||||
/*===========================================================================
|
||||
end */
|
Loading…
Add table
Reference in a new issue