2001-04-23 17:27:50 +02:00
|
|
|
/*=========================================================================
|
|
|
|
|
2001-04-23 22:40:13 +02:00
|
|
|
platform.h
|
2001-04-23 17:27:50 +02:00
|
|
|
|
|
|
|
Author: CRB
|
2001-04-27 13:52:40 +02:00
|
|
|
Created:
|
2001-04-23 17:27:50 +02:00
|
|
|
Project: Spongebob
|
2001-04-27 13:52:40 +02:00
|
|
|
Purpose:
|
2001-04-23 17:27:50 +02:00
|
|
|
|
|
|
|
Copyright (c) 2000 Climax Development Ltd
|
|
|
|
|
|
|
|
===========================================================================*/
|
|
|
|
|
2001-04-23 22:40:13 +02:00
|
|
|
#ifndef __PLATFORM_PLATFORM_H__
|
|
|
|
#define __PLATFORM_PLATFORM_H__
|
2001-04-23 17:27:50 +02:00
|
|
|
|
|
|
|
//#include <dstructs.h>
|
|
|
|
|
|
|
|
#ifndef __THING_THING_H__
|
|
|
|
#include "thing/thing.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "Gfx/Actor.h"
|
|
|
|
|
|
|
|
#ifndef __ENEMY_NPCPATH_H__
|
|
|
|
#include "enemy\npcpath.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __PLAYER_PLAYER_H__
|
|
|
|
#include "player\player.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// temporary
|
|
|
|
#ifndef __GFX_SPRBANK_H__
|
|
|
|
#include "gfx\sprbank.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
class CNpcPlatform : public CPlatformThing
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
enum NPC_PLATFORM_UNIT_TYPE
|
|
|
|
{
|
|
|
|
NPC_LINEAR_PLATFORM = 0,
|
|
|
|
NPC_CIRCULAR_PLATFORM = 1,
|
|
|
|
NPC_BUBBLE_PLATFORM,
|
|
|
|
NPC_COLLAPSING_BUBBLE_PLATFORM,
|
|
|
|
NPC_FISH_HOOK_PLATFORM,
|
|
|
|
NPC_RETRACTING_PLATFORM,
|
|
|
|
NPC_GEYSER_PLATFORM,
|
|
|
|
NPC_BOBBING_PLATFORM,
|
|
|
|
NPC_FALLING_PLATFORM,
|
|
|
|
NPC_CART_PLATFORM,
|
2001-04-25 00:05:29 +02:00
|
|
|
NPC_FISH_HOOK_2_PLATFORM,
|
2001-04-25 21:22:15 +02:00
|
|
|
NPC_BRANCH_PLATFORM,
|
2001-04-23 17:27:50 +02:00
|
|
|
NPC_PLAYER_BUBBLE_PLATFORM,
|
|
|
|
NPC_PLATFORM_TYPE_MAX,
|
|
|
|
};
|
|
|
|
|
|
|
|
void init();
|
|
|
|
void init( DVECTOR initPos );
|
|
|
|
void init( DVECTOR initPos, s32 initLifetime );
|
2001-04-23 22:40:13 +02:00
|
|
|
virtual void postInit();
|
2001-04-23 17:27:50 +02:00
|
|
|
void shutdown();
|
|
|
|
void think(int _frames);
|
|
|
|
void render();
|
|
|
|
void setLayerCollision( class CLayerCollision *_layer ) {m_layerCollision=_layer;}
|
|
|
|
void setType( NPC_PLATFORM_UNIT_TYPE newType ) {m_type = newType;}
|
|
|
|
void setTypeFromMapEdit( u16 newType );
|
2001-04-27 04:05:05 +02:00
|
|
|
#ifdef REMOVETHIS
|
|
|
|
// virtual int checkCollisionAgainst(CThing *_thisThing, int _frames);
|
2001-04-23 17:27:50 +02:00
|
|
|
virtual s32 getNewYPos( CThing *_thisThing );
|
2001-04-27 04:05:05 +02:00
|
|
|
#endif
|
|
|
|
int getHeightFromPlatformAtPosition(int _x,int _y);
|
2001-04-23 17:27:50 +02:00
|
|
|
void setTiltable( bool isTiltable );
|
|
|
|
void addWaypoint( s32 xPos, s32 yPos );
|
2001-04-25 00:05:29 +02:00
|
|
|
void setGraphic( sThingPlatform *ThisPlatform );
|
2001-04-27 13:52:40 +02:00
|
|
|
void setGraphic( u8 graphicNum );
|
2001-04-25 00:05:29 +02:00
|
|
|
virtual void setWaypoints( sThingPlatform *ThisPlatform );
|
2001-04-27 13:52:40 +02:00
|
|
|
|
2001-04-23 22:40:13 +02:00
|
|
|
static NPC_PLATFORM_UNIT_TYPE getTypeFromMapEdit( u16 newType );
|
|
|
|
static CNpcPlatform *Create(sThingPlatform *ThisPlatform);
|
2001-04-23 17:27:50 +02:00
|
|
|
|
2001-04-25 22:09:36 +02:00
|
|
|
void setToShutdown();
|
|
|
|
u8 isSetToShutdown() {return( m_isShuttingDown );}
|
|
|
|
|
2001-04-23 17:27:50 +02:00
|
|
|
protected:
|
|
|
|
// NPC data structure definitions //
|
|
|
|
|
|
|
|
enum NPC_PLATFORM_LIFETIME_TYPE
|
|
|
|
{
|
|
|
|
NPC_PLATFORM_FINITE_LIFE = 0,
|
|
|
|
NPC_PLATFORM_INFINITE_LIFE = 1,
|
|
|
|
NPC_PLATFORM_FINITE_LIFE_RESPAWN,
|
|
|
|
NPC_PLATFORM_INFINITE_LIFE_COLLAPSIBLE,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum NPC_PLATFORM_TIMER_TYPE
|
|
|
|
{
|
|
|
|
NPC_PLATFORM_TIMER_NONE = 0,
|
|
|
|
NPC_PLATFORM_TIMER_RESPAWN = 1,
|
|
|
|
};
|
|
|
|
|
2001-04-25 00:05:29 +02:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
EXTEND_UP = true,
|
|
|
|
EXTEND_DOWN = false,
|
|
|
|
EXTEND_RIGHT = true,
|
|
|
|
EXTEND_LEFT = false,
|
|
|
|
EXTEND_CLOCKWISE = true,
|
|
|
|
EXTEND_ANTICLOCKWISE = false,
|
|
|
|
};
|
|
|
|
|
2001-04-23 17:27:50 +02:00
|
|
|
typedef struct NPC_PLATFORM_DATA_TYPE
|
|
|
|
{
|
|
|
|
FileEquate ActorType;
|
|
|
|
// FileEquate animData;
|
|
|
|
u16 initAnim;
|
|
|
|
u8 speed;
|
|
|
|
u16 turnSpeed;
|
|
|
|
bool detectCollision;
|
|
|
|
DAMAGE_TYPE damageToUserType;
|
|
|
|
u16 initHealth;
|
|
|
|
s32 lifetime;
|
|
|
|
NPC_PLATFORM_LIFETIME_TYPE lifetimeType;
|
|
|
|
s32 initTimer;
|
2001-04-23 22:40:13 +02:00
|
|
|
u8 initTimerType;
|
2001-04-23 17:27:50 +02:00
|
|
|
}
|
|
|
|
NPC_PLATFORM_DATA;
|
|
|
|
|
|
|
|
// functions
|
|
|
|
|
|
|
|
void reinit();
|
|
|
|
bool processSensor();
|
2001-04-23 22:40:13 +02:00
|
|
|
virtual void processMovement( int _frames );
|
|
|
|
virtual void processLifetime( int _frames );
|
2001-04-23 17:27:50 +02:00
|
|
|
void processShot();
|
|
|
|
void processClose( int _frames );
|
|
|
|
void processCollision();
|
2001-04-23 22:40:13 +02:00
|
|
|
virtual void processTimer( int _frames );
|
2001-04-23 17:27:50 +02:00
|
|
|
void processTilt( int _frames );
|
|
|
|
bool isCollisionWithGround();
|
|
|
|
|
|
|
|
// data
|
|
|
|
|
|
|
|
static NPC_PLATFORM_DATA m_data[NPC_PLATFORM_TYPE_MAX];
|
|
|
|
|
|
|
|
static s32 playerXDist;
|
|
|
|
static s32 playerYDist;
|
|
|
|
|
|
|
|
static s32 playerXDistSqr;
|
|
|
|
static s32 playerYDistSqr;
|
|
|
|
|
|
|
|
static class CLayerCollision *m_layerCollision;
|
|
|
|
|
|
|
|
// internal variables
|
2001-04-27 13:52:40 +02:00
|
|
|
|
2001-04-23 17:27:50 +02:00
|
|
|
NPC_PLATFORM_UNIT_TYPE m_type;
|
|
|
|
CNpcPath m_npcPath;
|
|
|
|
s32 m_heading;
|
|
|
|
s32 m_velocity;
|
|
|
|
s16 m_rotation;
|
|
|
|
DVECTOR m_base;
|
|
|
|
DVECTOR m_initPos;
|
|
|
|
u8 m_state;
|
|
|
|
bool m_animPlaying;
|
|
|
|
bool m_reversed;
|
|
|
|
s32 m_extension;
|
|
|
|
s32 m_lifetime;
|
|
|
|
s32 m_initLifetime;
|
|
|
|
NPC_PLATFORM_LIFETIME_TYPE m_lifetimeType;
|
|
|
|
bool m_contact;
|
|
|
|
s32 m_timer;
|
|
|
|
bool m_isActive;
|
2001-04-23 22:40:13 +02:00
|
|
|
u8 m_timerType;
|
2001-04-23 17:27:50 +02:00
|
|
|
bool m_detectCollision;
|
|
|
|
bool m_tiltable;
|
|
|
|
s32 m_tiltAngle;
|
|
|
|
s32 m_tiltVelocity;
|
2001-04-25 00:05:29 +02:00
|
|
|
bool m_extendDir;
|
2001-04-23 17:27:50 +02:00
|
|
|
|
|
|
|
int m_frame;
|
|
|
|
int m_animNo;
|
|
|
|
CModelGfx *m_modelGfx;
|
2001-04-25 22:09:36 +02:00
|
|
|
u8 m_isShuttingDown;
|
2001-04-23 17:27:50 +02:00
|
|
|
|
|
|
|
virtual void collidedWith(CThing *_thisThing);
|
|
|
|
|
|
|
|
static NPC_PLATFORM_UNIT_TYPE mapEditConvertTable[NPC_PLATFORM_TYPE_MAX];
|
2001-04-27 22:13:09 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void setCollisionAngle(int newAngle); // Actually.. this probly doesn't need to be in the base calss anymore.. :/
|
|
|
|
void calculateBoundingBoxSize();
|
|
|
|
|
|
|
|
|
2001-04-23 17:27:50 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2001-04-27 13:52:40 +02:00
|
|
|
#endif
|