This commit is contained in:
Charles 2001-04-03 15:14:53 +00:00
parent 1627c733fd
commit dd254b2a47
4 changed files with 79 additions and 7 deletions

View File

@ -23,28 +23,36 @@
#include "player\player.h" #include "player\player.h"
#endif #endif
#ifndef __UTILS_HEADER__
#include "utils\utils.h"
#endif
#ifndef __ANIM_BABYOCTOPUS_HEADER__
#include <ACTOR_BABYOCTOPUS_ANIM.h>
#endif
void CNpcEnemy::processBabyOctopusMovementModifier( int _frames, s32 dist, s16 headingChange ) void CNpcEnemy::processBabyOctopusMovementModifier( int _frames, s32 dist, s16 headingChange )
{ {
s32 newX, newY; s32 newX, newY;
s32 preShiftX, preShiftY; s32 preShiftX, preShiftY;
u16 octopusData[11] = { 96, 192, 256, 256, 256, 192, 192, 192, 128, 128, 96 }; //u16 octopusData[11] = { 96, 192, 256, 256, 256, 192, 192, 192, 128, 128, 96 };
u16 octopusData[11] = { 96, 256, 96, 256, 96, 256, 96, 256, 96, 256, 96 };
u32 dataPoint; u32 dataPoint;
m_movementTimer += _frames; m_movementTimer += _frames;
if ( m_movementTimer > ( 3 * GameState::getOneSecondInFrames() ) ) if ( m_movementTimer > ( 2 * GameState::getOneSecondInFrames() ) )
{ {
m_movementTimer = 0; m_movementTimer -= ( 2 * GameState::getOneSecondInFrames() );
} }
dataPoint = 10 * m_movementTimer; dataPoint = 10 * m_movementTimer;
if ( dataPoint != 0 ) if ( dataPoint != 0 )
{ {
dataPoint /= ( 3 * GameState::getOneSecondInFrames() ); dataPoint /= ( 2 * GameState::getOneSecondInFrames() );
} }
s32 resistance; s32 resistance;
@ -99,3 +107,45 @@ void CNpcEnemy::processBabyOctopusMovementModifier( int _frames, s32 dist, s16 h
Pos.vx += newX; Pos.vx += newX;
Pos.vy += newY; Pos.vy += newY;
} }
void CNpcEnemy::processCloseOctopusAttack( int _frames )
{
if ( !m_animPlaying || m_animNo == m_data[m_type].initAnim || m_animNo == m_data[m_type].moveAnim )
{
// not playing an attack anim, hence choose one
u8 newAction = getRnd() % 3;
switch( newAction )
{
case 0:
{
m_animNo = ANIM_BABYOCTOPUS_HEAD_BUTT;
break;
}
case 1:
{
m_animNo = ANIM_BABYOCTOPUS_HIT;
break;
}
case 2:
{
m_animNo = ANIM_BABYOCTOPUS_INK;
break;
}
}
m_animPlaying = true;
m_frame = 0;
m_controlFunc = NPC_CONTROL_MOVEMENT;
m_timerFunc = NPC_TIMER_ATTACK_DONE;
m_timerTimer = GameState::getOneSecondInFrames();
m_sensorFunc = NPC_SENSOR_NONE;
}
}

View File

@ -947,6 +947,20 @@ bool CNpcEnemy::processSensor()
} }
} }
case NPC_SENSOR_OCTOPUS_USER_CLOSE:
{
if ( playerXDistSqr + playerYDistSqr < 400 )
{
m_controlFunc = NPC_CONTROL_CLOSE;
return( true );
}
else
{
return( false );
}
}
default: default:
return( false ); return( false );
} }
@ -1253,6 +1267,11 @@ void CNpcEnemy::processClose(int _frames)
break; break;
case NPC_CLOSE_OCTOPUS_ATTACK:
processCloseOctopusAttack( _frames );
break;
default: default:
break; break;
} }
@ -1316,7 +1335,7 @@ void CNpcEnemy::render()
//renderPos.vy = ( Pos.vy + m_drawOffset.vy - offset.vy - ( VidGetScrH() >> 1 ) );// * 20; //renderPos.vy = ( Pos.vy + m_drawOffset.vy - offset.vy - ( VidGetScrH() >> 1 ) );// * 20;
renderPos.vx = Pos.vx - offset.vx; renderPos.vx = Pos.vx - offset.vx;
renderPos.vy = Pos.vy - offset.vy; renderPos.vy = Pos.vy - offset.vy - 100;
m_actorGfx->Render(renderPos,m_animNo,m_frame,m_reversed); m_actorGfx->Render(renderPos,m_animNo,m_frame,m_reversed);
} }

View File

@ -230,6 +230,7 @@ protected:
NPC_SENSOR_FISH_HOOK_USER_CLOSE, NPC_SENSOR_FISH_HOOK_USER_CLOSE,
NPC_SENSOR_FLAMING_SKULL_USER_CLOSE, NPC_SENSOR_FLAMING_SKULL_USER_CLOSE,
NPC_SENSOR_HERMIT_CRAB_USER_CLOSE, NPC_SENSOR_HERMIT_CRAB_USER_CLOSE,
NPC_SENSOR_OCTOPUS_USER_CLOSE,
}; };
enum NPC_CLOSE_FUNC enum NPC_CLOSE_FUNC
@ -257,6 +258,7 @@ protected:
NPC_CLOSE_FLAMING_SKULL_ATTACK, NPC_CLOSE_FLAMING_SKULL_ATTACK,
NPC_CLOSE_SKELETAL_FISH_ATTACK, NPC_CLOSE_SKELETAL_FISH_ATTACK,
NPC_CLOSE_HERMIT_CRAB_ATTACK, NPC_CLOSE_HERMIT_CRAB_ATTACK,
NPC_CLOSE_OCTOPUS_ATTACK,
}; };
enum NPC_MOVEMENT_FUNC enum NPC_MOVEMENT_FUNC
@ -409,6 +411,7 @@ protected:
// baby octopus functions // baby octopus functions
void processBabyOctopusMovementModifier( int _frames, s32 dist, s16 headingChange ); void processBabyOctopusMovementModifier( int _frames, s32 dist, s16 headingChange );
void processCloseOctopusAttack( int _frames );
// fish folk functions // fish folk functions

View File

@ -631,10 +631,10 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
ACTORS_BABYOCTOPUS_SBK, ACTORS_BABYOCTOPUS_SBK,
ANIM_BABYOCTOPUS_IDLE, ANIM_BABYOCTOPUS_IDLE,
NPC_INIT_DEFAULT, NPC_INIT_DEFAULT,
NPC_SENSOR_NONE, NPC_SENSOR_OCTOPUS_USER_CLOSE,
NPC_MOVEMENT_FIXED_PATH, NPC_MOVEMENT_FIXED_PATH,
NPC_MOVEMENT_MODIFIER_OCTOPUS, NPC_MOVEMENT_MODIFIER_OCTOPUS,
NPC_CLOSE_NONE, NPC_CLOSE_OCTOPUS_ATTACK,
NPC_TIMER_NONE, NPC_TIMER_NONE,
false, false,
2, 2,