From 3eabd82c8e0473fe37ff6ced196d15d929638e1e Mon Sep 17 00:00:00 2001 From: Charles Date: Tue, 23 Jan 2001 17:02:45 +0000 Subject: [PATCH] --- source/enemy/nsstomp.cpp | 103 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 source/enemy/nsstomp.cpp diff --git a/source/enemy/nsstomp.cpp b/source/enemy/nsstomp.cpp new file mode 100644 index 000000000..bb56e7fdd --- /dev/null +++ b/source/enemy/nsstomp.cpp @@ -0,0 +1,103 @@ +/*========================================================================= + + nsstomp.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::processCloseSkullStomperAttack( int _frames ) +{ + if ( m_timerTimer > 0 ) + { + // wait + } + else + { + s32 velocity; + bool pathComplete; + bool waypointChange; + s16 headingToTarget = m_npcPath.think( Pos, &pathComplete, &waypointChange ); + s32 moveX, moveY; + + if ( waypointChange && !pathComplete ) + { + m_timerTimer = GameState::getOneSecondInFrames(); + } + else + { + if ( pathComplete ) + { + m_controlFunc = NPC_CONTROL_MOVEMENT; + m_timerFunc = NPC_TIMER_ATTACK_DONE; + m_timerTimer = GameState::getOneSecondInFrames(); + m_sensorFunc = NPC_SENSOR_NONE; + } + else + { + if ( m_npcPath.currentWaypoint == 0 ) + { + m_heading = headingToTarget; + + s32 preShiftX = _frames * 8 * rcos( m_heading ); + s32 preShiftY = _frames * 8 * rsin( m_heading ); + + moveX = preShiftX >> 12; + if ( !moveX && preShiftX ) + { + moveX = preShiftX / abs( preShiftX ); + } + + moveY = preShiftY >> 12; + if ( !moveY && preShiftY ) + { + moveY = preShiftY / abs( preShiftY ); + } + + Pos.vx += moveX; + Pos.vy += moveY; + } + else + { + m_heading = headingToTarget; + + s32 preShiftX = _frames * 2 * rcos( m_heading ); + s32 preShiftY = _frames * 2 * rsin( m_heading ); + + moveX = preShiftX >> 12; + if ( !moveX && preShiftX ) + { + moveX = preShiftX / abs( preShiftX ); + } + + moveY = preShiftY >> 12; + if ( !moveY && preShiftY ) + { + moveY = preShiftY / abs( preShiftY ); + } + + Pos.vx += moveX; + Pos.vy += moveY; + } + } + } + } +} \ No newline at end of file