SBSPSS/source/enemy/nssnake.h

117 lines
3.2 KiB
C
Raw Normal View History

2001-04-21 18:46:16 +02:00
/*=========================================================================
nssnake.h
Author: CRB
Created:
Project: Spongebob
Purpose:
Copyright (c) 2001 Climax Development Ltd
===========================================================================*/
2001-05-24 16:07:13 +02:00
#ifndef __ENEMY_NSSNAKE_H__
#define __ENEMY_NSSNAKE_H__
2001-06-30 17:39:43 +02:00
#ifndef __ENEMY_NBOSS_H__
#include "enemy\nboss.h"
#endif
2001-06-27 20:28:21 +02:00
2001-05-24 16:07:13 +02:00
class CNpcSeaSnakeSegment
{
public:
2001-07-04 00:17:20 +02:00
void init();
void shutdown();
void render();
void processEnemyCollision( CThing *thisThing );
void setScale( u16 scale ) {m_scale = scale;}
2001-06-20 16:21:09 +02:00
CNpcSeaSnakeSegment *m_nextSegment;
2001-07-23 21:26:37 +02:00
void setPos( DVECTOR const &newPos ) {Pos = newPos;}
DVECTOR const &getPos() {return( Pos );}
2001-07-04 00:17:20 +02:00
void setHeading( s16 newHeading ) {m_heading = newHeading;}
2001-05-24 16:07:13 +02:00
void updateCollisionArea();
2001-07-04 00:17:20 +02:00
int checkCollisionAgainst(CThing *_thisThing, int _frames);
void setCollisionSize(int _w,int _h);
void setCollisionCentreOffset(int _x,int _y) {m_collisionCentreOffset.vx=_x;m_collisionCentreOffset.vy=_y;}
CRECT const &getCollisionArea() {return m_collisionArea;}
2001-05-24 16:07:13 +02:00
DVECTOR const &getCollisionCentre() {return m_collisionCentre;}
int getCollisionRadius() {return m_collisionRadius;}
2001-06-20 16:21:09 +02:00
void setAnim( int newAnim ) {m_anim = newAnim;}
2001-05-24 16:07:13 +02:00
protected:
u16 m_scale;
CActorGfx *m_actorGfx;
2001-06-20 16:21:09 +02:00
int m_anim;
2001-05-24 16:07:13 +02:00
DVECTOR Pos;
s16 m_heading;
CRECT m_collisionArea;
DVECTOR m_collisionCentre;
DVECTOR m_collisionCentreOffset;
DVECTOR m_collisionSize;
int m_collisionRadius;
};
2001-04-21 18:46:16 +02:00
2001-06-30 17:39:43 +02:00
class CNpcSeaSnakeEnemy : public CNpcBossEnemy
2001-04-21 18:46:16 +02:00
{
2001-05-24 16:07:13 +02:00
public:
2001-07-04 00:17:20 +02:00
void postInit();
void shutdown();
2001-07-04 16:26:36 +02:00
void render();
2001-08-03 21:30:35 +02:00
virtual void renderOnMapScreen( DVECTOR drawPos );
2001-07-04 16:26:36 +02:00
int checkCollisionAgainst(CThing *_thisThing, int _frames);
2001-05-24 16:07:13 +02:00
protected:
2001-07-04 16:26:36 +02:00
s32 getFrameShift( int _frames );
bool processSensor();
void processClose( int _frames );
void processMovement( int _frames );
void processShot( int _frames );
void processEnemyCollision( CThing *thisThing );
void processUserCollision( CThing *thisThing );
2001-06-27 22:50:28 +02:00
u8 processPathMove( int _frames, s32 *moveX, s32 *moveY, s32 *moveVel, s32 *moveDist );
2001-06-21 22:10:19 +02:00
u8 isSnakeStopped();
2001-07-23 21:26:37 +02:00
void moveEntireSnake( DVECTOR const &newPos );
2001-07-04 16:26:36 +02:00
void addHealthMeter();
2001-07-05 00:02:56 +02:00
void updateTail( DVECTOR &oldPos, int _frames );
2001-08-02 18:26:54 +02:00
void collidedWith(CThing *_thisThing);
2001-05-24 16:07:13 +02:00
enum
{
2001-07-06 00:46:04 +02:00
NPC_SEA_SNAKE_SPACING = 4,
2001-08-03 16:24:08 +02:00
NPC_SEA_SNAKE_LENGTH = 9,
2001-06-21 22:10:19 +02:00
NPC_SEA_SNAKE_CIRCLE_CLOCKWISE = 1,
NPC_SEA_SNAKE_CIRCLE_ANTICLOCKWISE = 2,
2001-05-24 16:07:13 +02:00
};
2001-07-05 00:02:56 +02:00
enum SEA_SNAKE_STATES
{
SEA_SNAKE_VERTICAL_LINEUP = 0,
SEA_SNAKE_CHARGE = 1,
};
2001-05-24 16:07:13 +02:00
// position history stuff
class CNpcPositionHistory
{
public:
DVECTOR pos;
CNpcPositionHistory *next;
CNpcPositionHistory *prev;
};
2001-06-14 18:07:48 +02:00
u8 m_segmentCount;
CNpcSeaSnakeSegment m_segmentArray[NPC_SEA_SNAKE_LENGTH];
2001-05-24 16:07:13 +02:00
CNpcPositionHistory *m_positionHistory;
2001-06-14 18:07:48 +02:00
CNpcPositionHistory m_positionHistoryArray[NPC_SEA_SNAKE_SPACING * NPC_SEA_SNAKE_LENGTH];
2001-05-24 16:07:13 +02:00
s32 m_collTimer;
2001-06-12 21:30:01 +02:00
s32 m_snapTimer;
2001-06-19 23:43:18 +02:00
//s32 m_openTimer;
2001-06-21 22:10:19 +02:00
u8 m_turnDir;
s16 m_circleHeading;
s16 m_origHeading;
2001-06-25 22:44:53 +02:00
s32 m_waitTimer;
2001-04-21 18:46:16 +02:00
};
2001-05-24 16:07:13 +02:00
#endif