2001-01-23 20:57:06 +01:00
|
|
|
/*=========================================================================
|
|
|
|
|
|
|
|
nbooger.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
|
|
|
|
|
|
|
|
|
|
|
|
void CNpc::processCloseBoogerMonsterAttack( int _frames )
|
|
|
|
{
|
|
|
|
s32 velocity;
|
|
|
|
|
2001-02-07 17:42:13 +01:00
|
|
|
if ( playerXDistSqr + playerYDistSqr > 10000 )
|
2001-01-23 20:57:06 +01:00
|
|
|
{
|
|
|
|
// user out of range, retract
|
|
|
|
|
|
|
|
if ( m_extension > 0 )
|
|
|
|
{
|
|
|
|
// retract
|
|
|
|
|
|
|
|
velocity = 1 * _frames;
|
|
|
|
|
|
|
|
if ( m_extension < velocity )
|
|
|
|
{
|
|
|
|
velocity = m_extension;
|
|
|
|
}
|
|
|
|
|
|
|
|
m_extension -= velocity;
|
|
|
|
|
|
|
|
Pos.vx += ( -velocity * rcos( m_heading ) ) >> 12;
|
|
|
|
Pos.vy += ( -velocity * rsin( m_heading ) ) >> 12;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_controlFunc = NPC_CONTROL_MOVEMENT;
|
|
|
|
m_timerFunc = NPC_TIMER_ATTACK_DONE;
|
|
|
|
m_timerTimer = GameState::getOneSecondInFrames();
|
|
|
|
m_sensorFunc = NPC_SENSOR_NONE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( m_extension < NPC_BOOGER_MONSTER_MAX_EXTENSION )
|
|
|
|
{
|
|
|
|
// extend
|
|
|
|
|
|
|
|
velocity = 1 * _frames;
|
|
|
|
|
|
|
|
if ( m_extension + velocity < NPC_BOOGER_MONSTER_MAX_EXTENSION )
|
|
|
|
{
|
|
|
|
m_extension += velocity;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
velocity = NPC_BOOGER_MONSTER_MAX_EXTENSION - m_extension;
|
|
|
|
|
|
|
|
m_extension = NPC_BOOGER_MONSTER_MAX_EXTENSION;
|
|
|
|
}
|
|
|
|
|
|
|
|
Pos.vx += ( velocity * rcos( m_heading ) ) >> 12;
|
|
|
|
Pos.vy += ( velocity * rsin( m_heading ) ) >> 12;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// grab player
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|