SBSPSS/source/enemy/nscrab.cpp

69 lines
1.2 KiB
C++
Raw Normal View History

2001-01-19 20:11:00 +01:00
/*=========================================================================
nscrab.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::processCloseSpiderCrabAttack( int _frames )
{
s32 velocity;
velocity = m_velocity * _frames;
if ( m_extendDir == EXTEND_RIGHT )
{
Pos.vx += velocity;
2001-01-19 22:46:30 +01:00
m_heading = 0;
2001-01-19 20:11:00 +01:00
}
else
{
Pos.vx -= velocity;
2001-01-19 22:46:30 +01:00
m_heading = 2048;
2001-01-19 20:11:00 +01:00
}
2001-01-25 16:45:15 +01:00
s32 horizontalExtension = abs( Pos.vx - m_base.vx );
2001-01-19 20:11:00 +01:00
if ( horizontalExtension > 128 )
{
if ( m_extendDir == EXTEND_RIGHT )
{
2001-01-25 16:45:15 +01:00
Pos.vx = m_base.vx + 128;
2001-01-19 20:11:00 +01:00
}
else
{
2001-01-25 16:45:15 +01:00
Pos.vx = m_base.vx - 128;
2001-01-19 20:11:00 +01:00
}
2001-01-25 16:45:15 +01:00
Pos.vy = m_base.vy;
2001-01-19 20:11:00 +01:00
m_controlFunc = NPC_CONTROL_MOVEMENT;
m_timerFunc = NPC_TIMER_ATTACK_DONE;
m_timerTimer = GameState::getOneSecondInFrames();
m_sensorFunc = NPC_SENSOR_NONE;
}
else
{
2001-01-25 16:45:15 +01:00
Pos.vy = m_base.vy - ( ( 20 * rsin( horizontalExtension << 4 ) ) >> 12 );
2001-01-19 20:11:00 +01:00
}
}