2001-01-18 22:18:53 +01:00
|
|
|
/*=========================================================================
|
|
|
|
|
|
|
|
nclam.cpp
|
|
|
|
|
|
|
|
Author: CRB
|
|
|
|
Created:
|
|
|
|
Project: Spongebob
|
|
|
|
Purpose:
|
|
|
|
|
|
|
|
Copyright (c) 2000 Climax Development Ltd
|
|
|
|
|
|
|
|
===========================================================================*/
|
|
|
|
|
|
|
|
#ifndef __ENEMY_NPC_H__
|
|
|
|
#include "enemy\npc.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __GAME_GAME_H__
|
|
|
|
#include "game\game.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __PLAYER_PLAYER_H__
|
|
|
|
#include "player\player.h"
|
|
|
|
#endif
|
|
|
|
|
2001-02-28 22:05:39 +01:00
|
|
|
#ifndef __ANIM_CLAM_HEADER__
|
|
|
|
#include <ACTOR_CLAM_ANIM.h>
|
|
|
|
#endif
|
|
|
|
|
2001-01-18 22:18:53 +01:00
|
|
|
|
2001-03-01 17:48:45 +01:00
|
|
|
void CNpcEnemy::processCloseClamJumpAttack( int _frames )
|
2001-01-18 22:18:53 +01:00
|
|
|
{
|
|
|
|
s32 velocity;
|
|
|
|
|
2001-01-19 22:46:30 +01:00
|
|
|
if ( m_extendDir == EXTEND_UP )
|
2001-01-18 22:18:53 +01:00
|
|
|
{
|
|
|
|
m_movementTimer -= _frames;
|
|
|
|
|
|
|
|
if ( m_movementTimer > 0 )
|
|
|
|
{
|
|
|
|
// extend
|
|
|
|
|
|
|
|
velocity = m_velocity * _frames;
|
|
|
|
|
|
|
|
m_extension += velocity;
|
|
|
|
|
|
|
|
Pos.vx += ( velocity * rcos( m_heading ) ) >> 12;
|
|
|
|
Pos.vy += ( velocity * rsin( m_heading ) ) >> 12;
|
2001-02-28 22:05:39 +01:00
|
|
|
|
|
|
|
if ( !m_animPlaying )
|
|
|
|
{
|
|
|
|
m_animPlaying = true;
|
2001-03-01 17:48:45 +01:00
|
|
|
m_animNo = ANIM_CLAM_CLAMSNAPUP;
|
2001-02-28 22:05:39 +01:00
|
|
|
m_frame = 0;
|
|
|
|
}
|
2001-01-18 22:18:53 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-01-19 22:46:30 +01:00
|
|
|
m_extendDir = EXTEND_DOWN;
|
2001-01-18 22:18:53 +01:00
|
|
|
}
|
|
|
|
}
|
2001-01-19 22:46:30 +01:00
|
|
|
else if ( m_extendDir == EXTEND_DOWN )
|
2001-01-18 22:18:53 +01:00
|
|
|
{
|
|
|
|
// retract
|
|
|
|
|
|
|
|
if ( m_extension > 0 )
|
|
|
|
{
|
|
|
|
velocity = -_frames;
|
|
|
|
|
|
|
|
if ( m_extension < _frames )
|
|
|
|
{
|
|
|
|
velocity = m_extension - _frames;
|
|
|
|
}
|
|
|
|
|
|
|
|
m_extension += velocity;
|
|
|
|
|
|
|
|
|
|
|
|
Pos.vx += ( velocity * rcos( m_heading ) ) >> 12;
|
|
|
|
Pos.vy += ( velocity * rsin( m_heading ) ) >> 12;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-02-28 22:05:39 +01:00
|
|
|
if ( !m_animPlaying )
|
|
|
|
{
|
|
|
|
m_controlFunc = NPC_CONTROL_MOVEMENT;
|
|
|
|
m_timerFunc = NPC_TIMER_ATTACK_DONE;
|
|
|
|
m_timerTimer = GameState::getOneSecondInFrames();
|
|
|
|
m_sensorFunc = NPC_SENSOR_NONE;
|
|
|
|
}
|
2001-01-18 22:18:53 +01:00
|
|
|
}
|
|
|
|
}
|
2001-02-06 22:25:25 +01:00
|
|
|
}
|
2001-03-01 17:48:45 +01:00
|
|
|
|
|
|
|
void CNpcEnemy::processCloseClamSnapAttack( int _frames )
|
|
|
|
{
|
|
|
|
if ( !m_animPlaying )
|
|
|
|
{
|
|
|
|
m_animPlaying = true;
|
|
|
|
m_animNo = ANIM_CLAM_CLAMSIDESNAP;
|
|
|
|
m_frame = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
m_controlFunc = NPC_CONTROL_MOVEMENT;
|
|
|
|
}
|