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
|
|
|
|
|
2001-05-02 01:41:00 +02:00
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
// All platforms are fied to this width at the minute..
|
|
|
|
#define PLATFORMWIDTH 80
|
|
|
|
|
|
|
|
// The collision box is this high.. if SB keeps falling through platforms then it *should* be sufficient
|
|
|
|
// just to up this a bit
|
2001-05-10 21:22:34 +02:00
|
|
|
#define PLATFORMCOLLISIONHEIGHT 90
|
2001-05-02 01:41:00 +02:00
|
|
|
|
|
|
|
|
2001-04-23 17:27:50 +02:00
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
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-30 18:05:49 +02:00
|
|
|
NPC_SEESAW_PLATFORM,
|
2001-05-01 16:24:48 +02:00
|
|
|
NPC_OILDRUM_PLATFORM,
|
|
|
|
NPC_CRATE_PLATFORM,
|
2001-05-01 22:45:03 +02:00
|
|
|
NPC_BOUNCE_PLATFORM,
|
2001-05-02 21:52:33 +02:00
|
|
|
NPC_DUAL_PLATFORM,
|
2001-05-03 21:01:59 +02:00
|
|
|
NPC_OILDRUM_GENERATOR,
|
|
|
|
NPC_CRATE_GENERATOR,
|
2001-05-04 16:49:15 +02:00
|
|
|
NPC_RAFT_PLATFORM,
|
2001-05-04 18:47:09 +02:00
|
|
|
NPC_VERTICAL_OILDRUM_GENERATOR,
|
|
|
|
NPC_VERTICAL_OILDRUM_PLATFORM,
|
2001-05-04 20:54:27 +02:00
|
|
|
NPC_LANTERN_PLATFORM,
|
2001-05-05 01:12:26 +02:00
|
|
|
NPC_BUBBLE_GEYSER_GENERATOR,
|
2001-05-05 01:56:39 +02:00
|
|
|
NPC_LEAF_PLATFORM,
|
2001-05-05 15:54:34 +02:00
|
|
|
NPC_BIG_WHEEL_PLATFORM,
|
2001-05-05 18:47:51 +02:00
|
|
|
NPC_STEERABLE_BARREL_PLATFORM,
|
2001-05-05 21:08:02 +02:00
|
|
|
NPC_JELLYFISH_PLATFORM,
|
2001-05-23 16:46:23 +02:00
|
|
|
NPC_FISH_HOOK_3_PLATFORM,
|
2001-05-23 18:01:00 +02:00
|
|
|
NPC_RISING_BRIDGE_PLATFORM,
|
2001-05-23 23:27:29 +02:00
|
|
|
NPC_BALLOON_BRIDGE_PLATFORM,
|
2001-05-24 01:16:43 +02:00
|
|
|
NPC_TRAPDOOR_PLATFORM,
|
2001-05-29 17:29:56 +02:00
|
|
|
NPC_CONVEYOR_GENERATOR,
|
|
|
|
NPC_CONVEYOR_PLATFORM,
|
2001-04-23 17:27:50 +02:00
|
|
|
NPC_PLAYER_BUBBLE_PLATFORM,
|
2001-05-15 18:31:29 +02:00
|
|
|
NPC_CLAM_PLATFORM,
|
2001-06-01 20:36:50 +02:00
|
|
|
NPC_COLLAPSING_ACRID_PLATFORM,
|
2001-06-05 22:44:30 +02:00
|
|
|
NPC_DROP_PLATFORM,
|
2001-06-05 23:21:23 +02:00
|
|
|
NPC_STEAM_SWITCH_PLATFORM,
|
2001-06-06 16:14:47 +02:00
|
|
|
NPC_LIFT_PLATFORM,
|
2001-06-06 17:04:20 +02:00
|
|
|
NPC_LOVE_BOAT_PLATFORM,
|
2001-06-08 16:33:43 +02:00
|
|
|
NPC_STEERABLE_OILDRUM_PLATFORM,
|
2001-06-11 21:32:41 +02:00
|
|
|
NPC_BUBBLE_TUBE_PLATFORM,
|
2001-07-05 22:08:39 +02:00
|
|
|
NPC_FALLING_BLOCK_PLATFORM,
|
2001-07-13 17:18:50 +02:00
|
|
|
NPC_GHOST_TRAIN_PLATFORM,
|
2001-04-23 17:27:50 +02:00
|
|
|
NPC_PLATFORM_TYPE_MAX,
|
|
|
|
};
|
2001-05-25 20:43:47 +02:00
|
|
|
enum
|
|
|
|
{ // For Dynamic ThingCache
|
|
|
|
MAX_SUBTYPE =NPC_PLATFORM_TYPE_MAX,
|
|
|
|
};
|
2001-04-23 17:27:50 +02:00
|
|
|
|
|
|
|
void init();
|
|
|
|
void init( DVECTOR initPos );
|
|
|
|
void init( DVECTOR initPos, s32 initLifetime );
|
2001-04-23 22:40:13 +02:00
|
|
|
virtual void postInit();
|
2001-05-23 23:27:29 +02:00
|
|
|
virtual void shutdown();
|
2001-05-03 21:01:59 +02:00
|
|
|
virtual void think(int _frames);
|
2001-05-02 01:41:00 +02:00
|
|
|
virtual void render();
|
2001-05-08 18:25:45 +02:00
|
|
|
virtual u8 canDrop() {return true;}
|
2001-04-23 17:27:50 +02:00
|
|
|
void setTypeFromMapEdit( u16 newType );
|
2001-05-21 16:22:26 +02:00
|
|
|
virtual int checkCollisionAgainst(CThing *_thisThing, int _frames);
|
|
|
|
virtual u8 checkCollisionDelta( CThing *_thisThing, int threshold, CRECT collisionArea );
|
|
|
|
virtual int getHeightFromPlatformAtPosition(int _x,int _y, int offsetX = 0, int offsetY = 0);
|
2001-04-23 17:27:50 +02:00
|
|
|
void setTiltable( bool isTiltable );
|
2001-05-30 00:07:28 +02:00
|
|
|
void setWaypointPtr( u16 *newPtr ) {m_npcPath.setWaypointPtr( newPtr );}
|
|
|
|
void setWaypointCount( u8 newCount ) {m_npcPath.setWaypointCount( newCount );}
|
2001-07-03 20:32:04 +02:00
|
|
|
virtual void setGraphic( sThingPlatform *ThisPlatform );
|
|
|
|
virtual void setGraphic( u8 graphicNum );
|
2001-04-25 00:05:29 +02:00
|
|
|
virtual void setWaypoints( sThingPlatform *ThisPlatform );
|
2001-05-23 18:01:00 +02:00
|
|
|
virtual void trigger() {;}
|
2001-06-12 01:12:58 +02:00
|
|
|
virtual u8 isCart() {return( false );}
|
|
|
|
virtual void jump() {;}
|
2001-07-13 17:18:50 +02:00
|
|
|
virtual void slowDown() {;}
|
|
|
|
virtual void speedUp() {;}
|
2001-06-18 21:06:43 +02:00
|
|
|
virtual void leftThinkZone(int _frames);
|
2001-06-15 23:24:14 +02:00
|
|
|
s16 getCollisionAngle() {return m_collisionAngle;}
|
2001-06-19 22:07:57 +02:00
|
|
|
virtual CRECT const *getThinkBBox() {return &m_thinkArea;}
|
2001-04-27 13:52:40 +02:00
|
|
|
|
2001-04-23 22:40:13 +02:00
|
|
|
static NPC_PLATFORM_UNIT_TYPE getTypeFromMapEdit( u16 newType );
|
2001-05-25 22:00:13 +02:00
|
|
|
static CNpcPlatform *Create(int Type);
|
2001-04-23 22:40:13 +02:00
|
|
|
static CNpcPlatform *Create(sThingPlatform *ThisPlatform);
|
2001-04-23 17:27:50 +02:00
|
|
|
|
2001-07-10 19:08:34 +02:00
|
|
|
virtual void setSpeed( s16 newSpeed ) {m_speed = newSpeed;}
|
2001-07-16 22:50:07 +02:00
|
|
|
virtual bool alwaysThink();
|
2001-05-09 23:27:23 +02:00
|
|
|
|
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
|
|
|
|
{
|
|
|
|
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
|
|
|
|
|
2001-07-10 19:08:34 +02:00
|
|
|
virtual void reinit();
|
2001-04-23 17:27:50 +02:00
|
|
|
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 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;
|
|
|
|
|
|
|
|
// internal variables
|
2001-04-27 13:52:40 +02:00
|
|
|
|
2001-05-29 20:40:38 +02:00
|
|
|
// NPC_PLATFORM_UNIT_TYPE m_type;
|
|
|
|
NPC_PLATFORM_DATA *m_dataPtr;
|
2001-04-23 17:27:50 +02:00
|
|
|
CNpcPath m_npcPath;
|
|
|
|
s32 m_heading;
|
|
|
|
s32 m_velocity;
|
|
|
|
s16 m_rotation;
|
|
|
|
DVECTOR m_base;
|
|
|
|
DVECTOR m_initPos;
|
|
|
|
u8 m_state;
|
|
|
|
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-05-09 23:27:23 +02:00
|
|
|
s16 m_speed;
|
2001-05-23 16:46:23 +02:00
|
|
|
s16 m_initRotation;
|
2001-04-23 17:27:50 +02:00
|
|
|
|
|
|
|
CModelGfx *m_modelGfx;
|
|
|
|
|
2001-05-03 21:01:59 +02:00
|
|
|
int m_graphicNum;
|
|
|
|
|
2001-05-23 16:46:23 +02:00
|
|
|
sBBox m_nonRotatedCollisionArea;
|
|
|
|
DVECTOR m_nonRotatedCollisionOffset;
|
|
|
|
|
2001-06-18 21:06:43 +02:00
|
|
|
int m_soundId;
|
|
|
|
|
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:
|
2001-05-23 16:46:23 +02:00
|
|
|
virtual void calculateNonRotatedCollisionData();
|
2001-05-10 01:14:35 +02:00
|
|
|
virtual void calculateBoundingBoxSize();
|
2001-04-27 22:13:09 +02:00
|
|
|
|
2001-05-25 20:43:47 +02:00
|
|
|
virtual void setCollisionAngle(int newAngle); // Actually.. this probly doesn't need to be in the base calss anymore.. :/
|
|
|
|
s16 m_collisionAngle;
|
|
|
|
|
2001-06-19 22:07:57 +02:00
|
|
|
CRECT m_thinkArea;
|
2001-04-27 22:13:09 +02:00
|
|
|
|
2001-04-23 17:27:50 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2001-04-27 13:52:40 +02:00
|
|
|
#endif
|