This commit is contained in:
parent
5ebc73e91c
commit
a816643c57
6 changed files with 185 additions and 7 deletions
|
@ -87,6 +87,11 @@ bool CNpcSpiderCrabEnemy::processSensor()
|
||||||
|
|
||||||
m_attackDist = abs( playerXDist );
|
m_attackDist = abs( playerXDist );
|
||||||
|
|
||||||
|
if ( abs( m_attackDist ) < 1 )
|
||||||
|
{
|
||||||
|
m_attackDist = 1;
|
||||||
|
}
|
||||||
|
|
||||||
m_controlFunc = NPC_CONTROL_CLOSE;
|
m_controlFunc = NPC_CONTROL_CLOSE;
|
||||||
m_extension = 0;
|
m_extension = 0;
|
||||||
m_velocity = 5;
|
m_velocity = 5;
|
||||||
|
|
|
@ -27,6 +27,161 @@
|
||||||
#include "utils\utils.h"
|
#include "utils\utils.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __GAME_GAME_H__
|
||||||
|
#include "game\game.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CNpcJellyfishPlatform::postInit()
|
||||||
|
{
|
||||||
|
CNpcLinearPlatform::postInit();
|
||||||
|
|
||||||
|
m_vertScale = 0;
|
||||||
|
m_dipCount = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CNpcJellyfishPlatform::collidedWith( CThing *_thisThing )
|
||||||
|
{
|
||||||
|
switch(_thisThing->getThingType())
|
||||||
|
{
|
||||||
|
case TYPE_PLAYER:
|
||||||
|
{
|
||||||
|
if ( m_detectCollision && m_isActive )
|
||||||
|
{
|
||||||
|
CPlayer *player;
|
||||||
|
DVECTOR playerPos;
|
||||||
|
CRECT collisionArea;
|
||||||
|
CRECT playerArea;
|
||||||
|
|
||||||
|
// Only interested in SBs feet colliding with the box (pkg)
|
||||||
|
player=(CPlayer*)_thisThing;
|
||||||
|
playerPos=player->getPos();
|
||||||
|
playerArea=player->getCollisionArea();
|
||||||
|
collisionArea=getCollisionArea();
|
||||||
|
|
||||||
|
s32 height = getHeightFromPlatformAtPosition(playerPos.vx,playerPos.vy);
|
||||||
|
|
||||||
|
if(playerPos.vx>=collisionArea.x1&&playerPos.vx<=collisionArea.x2&&
|
||||||
|
playerPos.vy>=collisionArea.y1&&playerPos.vy<=collisionArea.y2)
|
||||||
|
//if(((playerArea.x1>=collisionArea.x1&&playerArea.x1<=collisionArea.x2)||(playerArea.x2>=collisionArea.x1&&playerArea.x2<=collisionArea.x2)||(playerArea.x1<=collisionArea.x1&&playerArea.x2>=collisionArea.x2))&&
|
||||||
|
//((playerArea.y1>=thatRect.y1&&playerArea.y1<=thatRect.y2)||(playerArea.y2>=thatRect.y1&&playerArea.y2<=thatRect.y2)||(playerArea.y1<=thatRect.y1&&playerArea.y2>=thatRect.y2)))
|
||||||
|
{
|
||||||
|
player->setPlatform( this );
|
||||||
|
|
||||||
|
if( height == 0 )
|
||||||
|
{
|
||||||
|
m_contact = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( height < -30 )
|
||||||
|
{
|
||||||
|
// shock player
|
||||||
|
|
||||||
|
player->takeDamage( DAMAGE__SHOCK_ENEMY, REACT__GET_DIRECTION_FROM_THING, _thisThing );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CNpcJellyfishPlatform::think( int _frames )
|
||||||
|
{
|
||||||
|
/*if ( m_contact )
|
||||||
|
{
|
||||||
|
if ( m_vertScale > -2048 )
|
||||||
|
{
|
||||||
|
m_vertScale -= 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
Pos.vy += 3;
|
||||||
|
}
|
||||||
|
else if ( m_vertScale < 0 )
|
||||||
|
{
|
||||||
|
m_vertScale += 10;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
if ( m_contact )
|
||||||
|
{
|
||||||
|
if ( m_dipCount < GameState::getOneSecondInFrames() )
|
||||||
|
{
|
||||||
|
s16 sineVal = ( m_dipCount << 10 ) / GameState::getOneSecondInFrames();
|
||||||
|
|
||||||
|
Pos.vy += ( 3 * rcos( sineVal ) ) >> 12;
|
||||||
|
|
||||||
|
m_dipCount += _frames;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_dipCount = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
CNpcLinearPlatform::think( _frames );
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CNpcJellyfishPlatform::render()
|
||||||
|
{
|
||||||
|
if ( m_isActive )
|
||||||
|
{
|
||||||
|
CPlatformThing::render();
|
||||||
|
|
||||||
|
if (canRender())
|
||||||
|
{
|
||||||
|
DVECTOR &renderPos=getRenderPos();
|
||||||
|
SVECTOR rotation;
|
||||||
|
rotation.vx = 0;
|
||||||
|
rotation.vy = 0;
|
||||||
|
rotation.vz = 0;
|
||||||
|
|
||||||
|
VECTOR scale;
|
||||||
|
scale.vx = ONE;
|
||||||
|
//scale.vy = ONE + m_vertScale;
|
||||||
|
scale.vy = ONE;
|
||||||
|
scale.vz = ONE;
|
||||||
|
|
||||||
|
m_modelGfx->Render(renderPos,&rotation,&scale);
|
||||||
|
|
||||||
|
#if defined (__USER_paul__) || defined (__USER_charles__)
|
||||||
|
DVECTOR offset = CLevel::getCameraPos();
|
||||||
|
DVECTOR centre;
|
||||||
|
DVECTOR size;
|
||||||
|
int halfLength;
|
||||||
|
int x1,y1,x2,y2;
|
||||||
|
|
||||||
|
centre=getCollisionCentre();
|
||||||
|
size=getCollisionSize();
|
||||||
|
halfLength=size.vx>>1;
|
||||||
|
|
||||||
|
x1=-halfLength*mcos(getCollisionAngle()&4095)>>12;
|
||||||
|
y1=-halfLength*msin(getCollisionAngle()&4095)>>12;
|
||||||
|
x2=+halfLength*mcos(getCollisionAngle()&4095)>>12;
|
||||||
|
y2=+halfLength*msin(getCollisionAngle()&4095)>>12;
|
||||||
|
|
||||||
|
centre.vx-=offset.vx;
|
||||||
|
centre.vy-=offset.vy;
|
||||||
|
x1+=centre.vx;
|
||||||
|
y1+=centre.vy;
|
||||||
|
x2+=centre.vx;
|
||||||
|
y2+=centre.vy;
|
||||||
|
|
||||||
|
DrawLine(x1,y1,x2,y2,0,255,0,0);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -14,14 +14,21 @@
|
||||||
#ifndef __PLATFORM_PJELLFSH_H__
|
#ifndef __PLATFORM_PJELLFSH_H__
|
||||||
#define __PLATFORM_PLANTERN_H__
|
#define __PLATFORM_PLANTERN_H__
|
||||||
|
|
||||||
#ifndef __PLATFORM_PLATFORM_H__
|
#ifndef __PLATFORM_PLINEAR_H__
|
||||||
#include "platform\platform.h"
|
#include "platform\plinear.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class CNpcJellyfishPlatform : public CNpcPlatform
|
class CNpcJellyfishPlatform : public CNpcLinearPlatform
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
virtual void render();
|
||||||
|
virtual void postInit();
|
||||||
|
virtual void think( int _frames );
|
||||||
|
protected:
|
||||||
|
virtual void collidedWith(CThing *_thisThing);
|
||||||
|
|
||||||
|
s32 m_vertScale;
|
||||||
|
u8 m_dipCount;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -399,5 +399,6 @@ CNpcPlatform::NPC_PLATFORM_UNIT_TYPE CNpcPlatform::mapEditConvertTable[NPC_PLATF
|
||||||
NPC_BUBBLE_GEYSER_GENERATOR,
|
NPC_BUBBLE_GEYSER_GENERATOR,
|
||||||
NPC_BIG_WHEEL_PLATFORM,
|
NPC_BIG_WHEEL_PLATFORM,
|
||||||
NPC_STEERABLE_BARREL_PLATFORM,
|
NPC_STEERABLE_BARREL_PLATFORM,
|
||||||
|
NPC_JELLYFISH_PLATFORM,
|
||||||
NPC_PLAYER_BUBBLE_PLATFORM,
|
NPC_PLAYER_BUBBLE_PLATFORM,
|
||||||
};
|
};
|
||||||
|
|
|
@ -139,6 +139,10 @@
|
||||||
#include "platform\psbarrel.h"
|
#include "platform\psbarrel.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __PLATFORM_PJELLFSH_H__
|
||||||
|
#include "platform\pjellfsh.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "fx\fx.h"
|
#include "fx\fx.h"
|
||||||
#include "fx\fxjfish.h"
|
#include "fx\fxjfish.h"
|
||||||
|
|
||||||
|
@ -324,6 +328,12 @@ CNpcPlatform *CNpcPlatform::Create(sThingPlatform *ThisPlatform)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case NPC_JELLYFISH_PLATFORM:
|
||||||
|
{
|
||||||
|
platform = new ("jellyfish platform") CNpcJellyfishPlatform;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
ASSERT( 0 );
|
ASSERT( 0 );
|
||||||
|
@ -482,7 +492,7 @@ void CNpcPlatform::postInit()
|
||||||
setCollisionSize( ( boundingBox.XMax - boundingBox.XMin ), PLATFORMCOLLISIONHEIGHT);
|
setCollisionSize( ( boundingBox.XMax - boundingBox.XMin ), PLATFORMCOLLISIONHEIGHT);
|
||||||
setCollisionCentreOffset( ( boundingBox.XMax + boundingBox.XMin ) >> 1, boundingBox.YMin );
|
setCollisionCentreOffset( ( boundingBox.XMax + boundingBox.XMin ) >> 1, boundingBox.YMin );
|
||||||
|
|
||||||
if ( m_type == NPC_LINEAR_PLATFORM )
|
/*if ( m_type == NPC_LINEAR_PLATFORM )
|
||||||
{
|
{
|
||||||
switch( CLevel::getCurrentChapter() )
|
switch( CLevel::getCurrentChapter() )
|
||||||
{
|
{
|
||||||
|
@ -509,7 +519,7 @@ void CNpcPlatform::postInit()
|
||||||
|
|
||||||
// CFXJellyFishLegs *T=(CFXJellyFishLegs*)CFX::Create(CFX::FX_TYPE_JELLYFISH_LEGS,this);
|
// CFXJellyFishLegs *T=(CFXJellyFishLegs*)CFX::Create(CFX::FX_TYPE_JELLYFISH_LEGS,this);
|
||||||
// T->SetUp(64,4,8,8);
|
// T->SetUp(64,4,8,8);
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -79,7 +79,7 @@ Jelly_Launcher=16
|
||||||
# Platforms
|
# Platforms
|
||||||
[PLATFORM]
|
[PLATFORM]
|
||||||
Bubble=4
|
Bubble=4
|
||||||
Jellyfish=1
|
Jellyfish=25
|
||||||
Industrial=1
|
Industrial=1
|
||||||
Leaf=2
|
Leaf=2
|
||||||
FishHook1=5
|
FishHook1=5
|
||||||
|
|
Loading…
Add table
Reference in a new issue