This commit is contained in:
Charles 2001-04-11 16:39:31 +00:00
parent f677614d5e
commit 276a169b6b
5 changed files with 75 additions and 39 deletions

View File

@ -161,10 +161,10 @@ void CNpcEnemy::processGenericFixedPathMove( int _frames, s32 *moveX, s32 *moveY
s16 headingToTarget = m_npcPath.think( Pos, &pathComplete, &waypointChange );
if ( waypointChange )
/*if ( waypointChange )
{
m_movementTimer = 0;
}
}*/
if ( !pathComplete )
{

View File

@ -548,6 +548,8 @@ void CNpcEnemy::postInit()
this->addChild( segment );
}
m_movementTimer = 2 * GameState::getOneSecondInFrames();
break;
}
@ -986,6 +988,7 @@ bool CNpcEnemy::processSensor()
case NPC_SENSOR_ANEMONE_USER_CLOSE:
case NPC_SENSOR_EYEBALL_USER_CLOSE:
case NPC_SENSOR_FLAMING_SKULL_USER_CLOSE:
case NPC_SENSOR_PARASITIC_WORM_USER_CLOSE:
{
if ( playerXDistSqr + playerYDistSqr < 40000 )
{
@ -1487,6 +1490,11 @@ void CNpcEnemy::processClose(int _frames)
break;
case NPC_CLOSE_PARASITIC_WORM_ATTACK:
processCloseParasiticWormAttack( _frames );
break;
default:
break;
}

View File

@ -241,6 +241,7 @@ protected:
NPC_SENSOR_HERMIT_CRAB_USER_CLOSE,
NPC_SENSOR_OCTOPUS_USER_CLOSE,
NPC_SENSOR_PUFFA_FISH_USER_CLOSE,
NPC_SENSOR_PARASITIC_WORM_USER_CLOSE,
};
enum NPC_CLOSE_FUNC
@ -270,6 +271,7 @@ protected:
NPC_CLOSE_HERMIT_CRAB_ATTACK,
NPC_CLOSE_OCTOPUS_ATTACK,
NPC_CLOSE_PUFFA_FISH_INFLATE,
NPC_CLOSE_PARASITIC_WORM_ATTACK,
};
enum NPC_MOVEMENT_FUNC
@ -542,6 +544,8 @@ protected:
// parasitic worm functions
void processParasiticWormMovement( int _frames );
void resetParasiticWormHeadToTail();
void processCloseParasiticWormAttack( int _frames );
// flying dutchman functions

View File

@ -1147,10 +1147,10 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
ACTORS_CLAM_SBK,
ANIM_CLAM_SIDESNAP,
NPC_INIT_PARASITIC_WORM,
NPC_SENSOR_NONE,
NPC_SENSOR_PARASITIC_WORM_USER_CLOSE,
NPC_MOVEMENT_PARASITIC_WORM,
NPC_MOVEMENT_MODIFIER_NONE,
NPC_CLOSE_NONE,
NPC_CLOSE_PARASITIC_WORM_ATTACK,
NPC_TIMER_NONE,
false,
3,

View File

@ -15,9 +15,9 @@
#include "enemy\npc.h"
#endif
//#ifndef __GAME_GAME_H__
//#include "game\game.h"
//#endif
#ifndef __GAME_GAME_H__
#include "game\game.h"
#endif
#ifndef __PLAYER_PLAYER_H__
#include "player\player.h"
@ -55,6 +55,19 @@ void CNpcEnemy::processParasiticWormMovement( int _frames )
s32 extension = m_extension;
u8 downShift = 2;
u8 timeShift;
if ( m_movementTimer > 0 )
{
m_movementTimer -= _frames;
if ( m_movementTimer < 0 )
{
m_movementTimer = 0;
}
}
timeShift = m_movementTimer / GameState::getOneSecondInFrames();
while( List )
{
@ -70,7 +83,7 @@ void CNpcEnemy::processParasiticWormMovement( int _frames )
DVECTOR sinPos;
sinPos = newPos->pos;
s32 diff = ( ( 10 >> downShift ) * rsin( extension ) ) >> 12;
s32 diff = ( ( ( 10 >> downShift ) * rsin( extension ) ) >> 12 ) >> timeShift;
sinPos.vx += ( diff * rcos( headingToTarget + 1024 ) ) >> 12;
sinPos.vy += ( diff * rsin( headingToTarget + 1024 ) ) >> 12;
@ -95,29 +108,40 @@ void CNpcEnemy::processParasiticWormMovement( int _frames )
downShift--;
}
}
}
/*// add new (old) position onto list head
CNpcPositionHistory *newPos;
newPos = new ("position history") CNpcPositionHistory;
newPos->pos = oldPos;
newPos->next = m_positionHistory;
m_positionHistory = newPos;
void CNpcEnemy::resetParasiticWormHeadToTail()
{
DVECTOR startPos;
DVECTOR endPos;
int posCounter;
CNpcPositionHistory *currentPos;
// remove list end
CNpcPositionHistory *last;
last = newPos;
startPos = Pos;
while( newPos->next )
currentPos = m_positionHistory;
for ( posCounter = 0 ; posCounter < ( NPC_PARASITIC_WORM_LENGTH * NPC_PARASITIC_WORM_SPACING ) - 1 ; posCounter++ )
{
last = newPos;
newPos = newPos->next;
currentPos = currentPos->next;
}
delete newPos;
last->next = NULL;
endPos = currentPos->pos;
// assign positions
currentPos = m_positionHistory;
for ( posCounter = 0 ; posCounter < NPC_PARASITIC_WORM_LENGTH * NPC_PARASITIC_WORM_SPACING ; posCounter++ )
{
currentPos->pos.vx = startPos.vx + ( posCounter * ( endPos.vx - startPos.vx ) ) / ( ( NPC_PARASITIC_WORM_LENGTH * NPC_PARASITIC_WORM_SPACING ) - 1 );
currentPos->pos.vy = startPos.vy + ( posCounter * ( endPos.vy - startPos.vy ) ) / ( ( NPC_PARASITIC_WORM_LENGTH * NPC_PARASITIC_WORM_SPACING ) - 1 );
currentPos = currentPos->next;
}
CNpcPositionHistory *newPos;
newPos = m_positionHistory;
u8 skipCounter;
for ( skipCounter = 1 ; skipCounter < NPC_PARASITIC_WORM_SPACING ; skipCounter++ )
{
newPos = newPos->next;
@ -125,10 +149,9 @@ void CNpcEnemy::processParasiticWormMovement( int _frames )
CThing *List=Next;
oldPos = Pos;
DVECTOR oldPos = Pos;
s32 extension = m_extension;
u8 downShift = 2;
while( List )
{
@ -141,14 +164,7 @@ void CNpcEnemy::processParasiticWormMovement( int _frames )
segment->setHeading( headingToTarget );
DVECTOR sinPos;
sinPos = newPos->pos;
s32 diff = ( ( 10 >> downShift ) * rsin( extension ) ) >> 12;
sinPos.vx += ( diff * rcos( headingToTarget + 1024 ) ) >> 12;
sinPos.vy += ( diff * rsin( headingToTarget + 1024 ) ) >> 12;
List->setPos( sinPos );
List->setPos( newPos->pos );
oldPos = newPos->pos;
List = List->getNext();
@ -163,10 +179,18 @@ void CNpcEnemy::processParasiticWormMovement( int _frames )
extension += 1024;
extension &= 4095;
}
}
void CNpcEnemy::processCloseParasiticWormAttack( int _frames )
{
resetParasiticWormHeadToTail();
m_movementTimer = 2 * GameState::getOneSecondInFrames();
m_controlFunc = NPC_CONTROL_MOVEMENT;
m_timerFunc = NPC_TIMER_ATTACK_DONE;
m_timerTimer = GameState::getOneSecondInFrames();
m_sensorFunc = NPC_SENSOR_NONE;
}
if ( downShift > 0 )
{
downShift--;
}
}*/
}