This commit is contained in:
Charles 2001-05-04 13:45:55 +00:00
parent d1db681fec
commit 4a1605fe92
8 changed files with 242 additions and 65 deletions

View File

@ -0,0 +1,2 @@
bodystatic
headstatic

View File

@ -188,4 +188,5 @@ actors/SPIKEYANENOME.SBK
actors/STOMPER.SBK
actors/SHARKSUB.SBK
actors/MOTHERJELLYFISH.SBK
actors/MOTHERJELLYFISH.SBK
actors/SEASNAKE.SBK

View File

@ -113,7 +113,7 @@ ACTOR_NPC := BarnacleBoy Krusty Squidward Gary Sandy Patrick MermaidMan
ACTOR_ENEMY := Anenome BabyOctopus Ballblob Caterpillar clam Dustdevil Eyeball \
Flamingskull FlyingDutchman Ghost HermitCrab IronDogFish Lrgjellyfish \
PuffaFish Sharkman Skeletalfish SpiderCrab SpikeyAnenome Stomper \
SharkSub Motherjellyfish
SharkSub Motherjellyfish SeaSnake
# Boogermonster GiantWorm Jellyfish2 Motherjellyfish Nautilus Neptune SeaSnake SharkSub

View File

@ -107,6 +107,10 @@
#include <ACTOR_SHARKSUB_ANIM.h>
#endif
#ifndef __ANIM_SEASNAKE_HEADER__
#include <ACTOR_SEASNAKE_ANIM.h>
#endif
CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
{
@ -815,8 +819,8 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
},
{ // NPC_PARASITIC_WORM
ACTORS_CLAM_SBK,
ANIM_CLAM_SIDESNAP,
ACTORS_SEASNAKE_SBK,
ANIM_SEASNAKE_HEADSTATIC,
NPC_SENSOR_USER_CLOSE,
NPC_MOVEMENT_STATIC,
NPC_CLOSE_NONE,
@ -881,8 +885,8 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
},
{ // NPC_PARASITIC_WORM_SEGMENT
ACTORS_CLAM_SBK,
ANIM_CLAM_SIDESNAP,
ACTORS_SEASNAKE_SBK,
ANIM_SEASNAKE_BODYSTATIC,
NPC_SENSOR_NONE,
NPC_MOVEMENT_STATIC,
NPC_CLOSE_NONE,
@ -979,11 +983,8 @@ CNpcEnemy::NPC_UNIT_TYPE CNpcEnemy::mapEditConvertTable[NPC_UNIT_TYPE_MAX] =
NPC_DUST_DEVIL,
NPC_SPIDER_CRAB_SPAWNER,
NPC_SHELL,
//NPC_FALLING_ITEM,
//NPC_FISH_HOOK,
//NPC_PENDULUM,
//NPC_FIREBALL,
//NPC_SAW_BLADE,
//
NPC_FISH_FOLK,
NPC_ANGLER_FISH,
NPC_MINE,

View File

@ -27,35 +27,15 @@
#include "player\player.h"
#endif
#ifndef __VID_HEADER_
#include "system\vid.h"
#endif
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcParasiticWormEnemy::postInit()
{
DVECTOR newPos;
newPos.vx = 100;
//newPos.vy = 10;
newPos.vy = 100;
m_npcPath.addWaypoint( newPos );
newPos.vx = 500;
//newPos.vy = 10;
newPos.vy = 100;
m_npcPath.addWaypoint( newPos );
newPos.vx = 500;
//newPos.vy = 100;
newPos.vy = 300;
m_npcPath.addWaypoint( newPos );
newPos.vx = 100;
//newPos.vy = 100;
newPos.vy = 300;
m_npcPath.addWaypoint( newPos );
m_npcPath.setPathType( CNpcPath::PONG_PATH );
m_npcPath.setPathType( CNpcPath::REPEATING_PATH );
// create start of list
CNpcPositionHistory *newPosition;
@ -83,14 +63,39 @@ void CNpcParasiticWormEnemy::postInit()
currentPosition->next = m_positionHistory;
m_positionHistory->prev = currentPosition;
u16 segScale;
int initLength = NPC_PARASITIC_WORM_LENGTH / 3;
int remLength = NPC_PARASITIC_WORM_LENGTH - initLength;
for ( int segCount = 0 ; segCount < NPC_PARASITIC_WORM_LENGTH ; segCount++ )
{
CNpcEnemy *segment;
segment = new ("segment") CNpcParasiticWormSegment;
segment->setType( CNpcEnemy::NPC_PARASITIC_WORM_SEGMENT );
segment->init();
segment->setLayerCollision( m_layerCollision );
segment->postInit();
CNpcParasiticWormSegment *wormSegment;
wormSegment = new ("segment") CNpcParasiticWormSegment;
wormSegment->setType( CNpcEnemy::NPC_PARASITIC_WORM_SEGMENT );
wormSegment->init();
wormSegment->setLayerCollision( m_layerCollision );
wormSegment->postInit();
if ( segCount < initLength )
{
u16 sum = ONE;
u16 start = ONE >> 1;
u16 end = sum - start;
segScale = start + ( ( end * segCount ) / initLength );
}
else
{
u16 sum = ONE;
u16 start = ONE >> 3;
u16 end = sum - start;
segScale = start + ( ( end * ( NPC_PARASITIC_WORM_LENGTH - segCount ) ) / remLength );
}
wormSegment->setScale( segScale );
segment = wormSegment;
this->addChild( segment );
}
@ -98,19 +103,31 @@ void CNpcParasiticWormEnemy::postInit()
m_movementTimer = 2 * GameState::getOneSecondInFrames();
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcParasiticWormEnemy::shutdown()
{
deleteAllChild();
CNpcEnemy::shutdown();
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcParasiticWormSegment::think( int _frames )
{
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcParasiticWormSegment::postInit()
{
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool CNpcParasiticWormEnemy::processSensor()
{
if ( playerXDistSqr + playerYDistSqr < 40000 )
/*if ( playerXDistSqr + playerYDistSqr < 40000 )
{
m_controlFunc = NPC_CONTROL_CLOSE;
@ -119,9 +136,13 @@ bool CNpcParasiticWormEnemy::processSensor()
else
{
return( false );
}
}*/
return( false );
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcParasiticWormEnemy::processMovement( int _frames )
{
s32 moveX = 0, moveY = 0;
@ -177,17 +198,17 @@ void CNpcParasiticWormEnemy::processMovement( int _frames )
s16 headingToTarget = ratan2( yDist, xDist );
segment->setHeading( headingToTarget );
//segment->setHeading( headingToTarget );
DVECTOR sinPos;
sinPos = newPos->pos;
s32 diff = ( ( ( 10 >> downShift ) * rsin( extension ) ) >> 12 ) >> timeShift;
s32 diff = ( ( ( 5 >> downShift ) * rsin( extension ) ) >> 12 ) >> timeShift;
sinPos.vx += ( diff * rcos( headingToTarget + 1024 ) ) >> 12;
sinPos.vy += ( diff * rsin( headingToTarget + 1024 ) ) >> 12;
List->setPos( sinPos );
oldPos = newPos->pos;
oldPos = sinPos;
List = List->getNext();
@ -207,8 +228,68 @@ void CNpcParasiticWormEnemy::processMovement( int _frames )
downShift--;
}
}
List=Next;
oldPos = Pos;
while( List )
{
CNpcEnemy *segment = (CNpcEnemy *) List;
DVECTOR currentPos = segment->getPos();
s32 xDist = oldPos.vx - currentPos.vx;
s32 yDist = oldPos.vy - currentPos.vy;
s16 headingToPrev = ratan2( yDist, xDist );
s16 headingFromNext;
s16 heading = headingToPrev;
oldPos = currentPos;
List = List->getNext();
if ( List )
{
DVECTOR nextPos = List->getPos();
xDist = currentPos.vx - nextPos.vx;
yDist = currentPos.vy - nextPos.vy;
headingFromNext = ratan2( yDist, xDist );
s16 decDir, incDir, moveDist;
decDir = headingFromNext - headingToPrev;
if ( decDir < 0 )
{
decDir += ONE;
}
incDir = headingToPrev - headingFromNext;
if ( incDir < 0 )
{
incDir += ONE;
}
if ( decDir < incDir )
{
moveDist = -decDir;
}
else
{
moveDist = incDir;
}
heading -= moveDist >> 1;
}
segment->setHeading( heading );
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcParasiticWormEnemy::resetParasiticWormHeadToTail()
{
DVECTOR startPos;
@ -281,6 +362,8 @@ void CNpcParasiticWormEnemy::resetParasiticWormHeadToTail()
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcParasiticWormEnemy::processClose( int _frames )
{
resetParasiticWormHeadToTail();
@ -293,3 +376,81 @@ void CNpcParasiticWormEnemy::processClose( int _frames )
m_sensorFunc = NPC_SENSOR_NONE;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcParasiticWormEnemy::processEnemyCollision( CThing *thisThing )
{
// do nothing
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcParasiticWormSegment::processEnemyCollision( CThing *thisThing )
{
// do nothing
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcParasiticWormEnemy::render()
{
SprFrame = NULL;
if ( m_isActive )
{
CEnemyThing::render();
// Render
DVECTOR renderPos;
DVECTOR offset = CLevel::getCameraPos();
renderPos.vx = Pos.vx - offset.vx;
renderPos.vy = Pos.vy - offset.vy;
if ( renderPos.vx >= 0 && renderPos.vx <= VidGetScrW() )
{
if ( renderPos.vy >= 0 && renderPos.vy <= VidGetScrH() )
{
SprFrame = m_actorGfx->Render(renderPos,m_animNo,( m_frame >> 8 ),m_reversed);
m_actorGfx->RotateScale( SprFrame, renderPos, m_heading, 4096, 4096 );
sBBox boundingBox = m_actorGfx->GetBBox();
setCollisionSize( ( boundingBox.XMax - boundingBox.XMin ), ( boundingBox.YMax - boundingBox.YMin ) );
setCollisionCentreOffset( ( boundingBox.XMax + boundingBox.XMin ) >> 1, ( boundingBox.YMax + boundingBox.YMin ) >> 1 );
}
}
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcParasiticWormSegment::render()
{
SprFrame = NULL;
if ( m_isActive )
{
CEnemyThing::render();
// Render
DVECTOR renderPos;
DVECTOR offset = CLevel::getCameraPos();
renderPos.vx = Pos.vx - offset.vx;
renderPos.vy = Pos.vy - offset.vy;
if ( renderPos.vx >= 0 && renderPos.vx <= VidGetScrW() )
{
if ( renderPos.vy >= 0 && renderPos.vy <= VidGetScrH() )
{
SprFrame = m_actorGfx->Render(renderPos,m_animNo,( m_frame >> 8 ),m_reversed);
m_actorGfx->RotateScale( SprFrame, renderPos, m_heading, 4096, m_scale );
sBBox boundingBox = m_actorGfx->GetBBox();
setCollisionSize( ( boundingBox.XMax - boundingBox.XMin ), ( boundingBox.YMax - boundingBox.YMin ) );
setCollisionCentreOffset( ( boundingBox.XMax + boundingBox.XMin ) >> 1, ( boundingBox.YMax + boundingBox.YMin ) >> 1 );
}
}
}
}

View File

@ -19,15 +19,17 @@ class CNpcParasiticWormEnemy : public CNpcEnemy
public:
virtual void postInit();
virtual void shutdown();
virtual void render();
protected:
virtual bool processSensor();
virtual void processClose( int _frames );
virtual void processMovement( int _frames );
void resetParasiticWormHeadToTail();
virtual void processEnemyCollision( CThing *thisThing );
enum
{
NPC_PARASITIC_WORM_SPACING = 6,
NPC_PARASITIC_WORM_SPACING = 4,
NPC_PARASITIC_WORM_LENGTH = 10,
};
};
@ -35,7 +37,13 @@ protected:
class CNpcParasiticWormSegment : public CNpcParasiticWormEnemy
{
public:
virtual void render();
virtual void think( int _frames );
virtual void postInit();
virtual void processEnemyCollision( CThing *thisThing );
virtual void setScale( u16 scale ) {m_scale = scale;}
u16 m_scale;
};
#endif

View File

@ -243,14 +243,14 @@ Collision=0
Health=0
AttackStrength=20
#[GiantWorm]
#Gfx=..\..\graphics\characters\
#WayPoints=16
#Speed=3
#TurnRate=128
#Collision=0
#Health=256
#AttackStrength=0
[GiantWorm]
Gfx=..\..\graphics\characters\seasnake\render\psx\seasnake_headstatic0000.bmp
WayPoints=16
Speed=3
TurnRate=128
Collision=0
Health=256
AttackStrength=0
[HermitCrab]
Gfx=..\..\graphics\characters\hermitcrab\render\psx\hermitcrab_idle0001.bmp
@ -280,14 +280,14 @@ Collision=0
Health=64
AttackStrength=20
#[SeaSnake]
#Gfx=..\..\graphics\characters\seasnake\render\psx\seasnake_headstatic0000.bmp
#WayPoints=16
#Speed=3
#TurnRate=256
#Collision=0
#Health=56
#AttackStrength=20
[SeaSnake]
Gfx=..\..\graphics\characters\seasnake\render\psx\seasnake_headstatic0000.bmp
WayPoints=16
Speed=3
TurnRate=256
Collision=0
Health=56
AttackStrength=20
[Sharkman]
Gfx=..\..\graphics\characters\sharkman\render\psx\SharkMan_Idle1_0001.bmp

View File

@ -1928,6 +1928,10 @@ SOURCE=..\..\..\out\USA\include\ACTOR_SANDY_Anim.h
# End Source File
# Begin Source File
SOURCE=..\..\..\out\USA\include\ACTOR_SEASNAKE_Anim.h
# End Source File
# Begin Source File
SOURCE=..\..\..\out\USA\include\ACTOR_SHARKMAN_Anim.h
# End Source File
# Begin Source File