This commit is contained in:
Charles 2001-06-11 19:32:41 +00:00
parent 95708325a7
commit f53a8ac365
14 changed files with 215 additions and 88 deletions

View file

@ -135,7 +135,8 @@ platform_src := platform \
psswitch \ psswitch \
plift \ plift \
plurve \ plurve \
psoil psoil \
pbubtube
hazard_src := hazard \ hazard_src := hazard \
hfalling \ hfalling \

View file

@ -39,11 +39,6 @@
#include "player\player.h" #include "player\player.h"
#endif #endif
#include "fx\fx.h"
#include "fx\fxjfish.h"
#include "fx\fxnrgbar.h"
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -58,7 +53,25 @@ void CNpcMotherJellyfishEnemy::postInit()
m_health = CLevel::getBossHealth(); m_health = CLevel::getBossHealth();
} }
CFXJellyFishLegs *T=(CFXJellyFishLegs*)CFX::Create(CFX::FX_TYPE_JELLYFISH_LEGS,this); legsPos[0].vx = 80;
legsPos[0].vy = -5;
legsPos[1].vx = 40;
legsPos[1].vy = 0;
legsPos[2].vx = -40;
legsPos[2].vy = -5;
legsPos[3].vx = -80;
legsPos[3].vy = 0;
for ( int i = 0 ; i < 4 ; i++ )
{
legs[i] = (CFXJellyFishLegs*)CFX::Create(CFX::FX_TYPE_JELLYFISH_LEGS,this);
legs[i]->Setup( legsPos[i].vx, legsPos[i].vy, i > 1 );
}
/*CFXJellyFishLegs *T=(CFXJellyFishLegs*)CFX::Create(CFX::FX_TYPE_JELLYFISH_LEGS,this);
T->Setup(80,-5,0); T->Setup(80,-5,0);
T=(CFXJellyFishLegs*)CFX::Create(CFX::FX_TYPE_JELLYFISH_LEGS,this); T=(CFXJellyFishLegs*)CFX::Create(CFX::FX_TYPE_JELLYFISH_LEGS,this);
@ -68,7 +81,7 @@ void CNpcMotherJellyfishEnemy::postInit()
T->Setup(-40,-5,1); T->Setup(-40,-5,1);
T=(CFXJellyFishLegs*)CFX::Create(CFX::FX_TYPE_JELLYFISH_LEGS,this); T=(CFXJellyFishLegs*)CFX::Create(CFX::FX_TYPE_JELLYFISH_LEGS,this);
T->Setup(-80,0,1); T->Setup(-80,0,1);*/
} }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -384,8 +397,11 @@ void CNpcMotherJellyfishEnemy::render()
DVECTOR &renderPos=getRenderPos(); DVECTOR &renderPos=getRenderPos();
s16 scale;
scale = 2048 + ( ( ( 8192 - 2048 ) * m_health ) / m_data[m_type].initHealth );
SprFrame = m_actorGfx->Render(renderPos,m_animNo,( m_frame >> 8 ),false); SprFrame = m_actorGfx->Render(renderPos,m_animNo,( m_frame >> 8 ),false);
m_actorGfx->RotateScale( SprFrame, renderPos, 0, 8192, 8192 ); m_actorGfx->RotateScale( SprFrame, renderPos, 0, scale, scale );
sBBox boundingBox = m_actorGfx->GetBBox(); sBBox boundingBox = m_actorGfx->GetBBox();
setCollisionSize( ( boundingBox.XMax - boundingBox.XMin ), ( boundingBox.YMax - boundingBox.YMin ) ); setCollisionSize( ( boundingBox.XMax - boundingBox.XMin ), ( boundingBox.YMax - boundingBox.YMin ) );
@ -396,6 +412,20 @@ void CNpcMotherJellyfishEnemy::render()
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcMotherJellyfishEnemy::processUserCollision( CThing *thisThing ) /*void CNpcMotherJellyfishEnemy::processUserCollision( CThing *thisThing )
{ {
}*/
void CNpcMotherJellyfishEnemy::processShot( int _frames )
{
s16 scale;
scale = 2048 + ( ( ( 8192 - 2048 ) * m_health ) / m_data[m_type].initHealth );
for ( int i = 0 ; i < 4 ; i++ )
{
legs[i]->Setup( ( legsPos[i].vx * scale ) >> 13, legsPos[i].vy, i > 1 );
legs[i]->setScale( scale >> 1 );
}
CNpcEnemy::processShot( _frames );
} }

View file

@ -14,6 +14,10 @@
#ifndef __ENEMY_NMJFISH_H__ #ifndef __ENEMY_NMJFISH_H__
#define __ENEMY_NMJFISH_H__ #define __ENEMY_NMJFISH_H__
#include "fx\fx.h"
#include "fx\fxjfish.h"
#include "fx\fxnrgbar.h"
class CNpcMotherJellyfishEnemy : public CNpcEnemy class CNpcMotherJellyfishEnemy : public CNpcEnemy
{ {
public: public:
@ -24,8 +28,9 @@ public:
protected: protected:
virtual void processClose( int _frames ); virtual void processClose( int _frames );
virtual void processMovement( int _frames ); virtual void processMovement( int _frames );
virtual void processShot( int _frames );
void spawnJellyfish( int _frames ); void spawnJellyfish( int _frames );
virtual void processUserCollision( CThing *thisThing ); //virtual void processUserCollision( CThing *thisThing );
enum NPC_MOTHER_JELLYFISH_STATE enum NPC_MOTHER_JELLYFISH_STATE
{ {
@ -45,6 +50,9 @@ protected:
s32 m_cycleWidth; s32 m_cycleWidth;
s32 m_halfCycleWidth; s32 m_halfCycleWidth;
bool m_meterOn; bool m_meterOn;
CFXJellyFishLegs *legs[4];
DVECTOR legsPos[4];
}; };
#endif #endif

View file

@ -33,7 +33,7 @@ void CNpcShellEnemy::postInit()
m_shellType = FRM_SHELL_STATIC0000 + ( getRnd() % ( FRM_SHELL_STATIC0002 - FRM_SHELL_STATIC0000 + 1 ) ); m_shellType = FRM_SHELL_STATIC0000 + ( getRnd() % ( FRM_SHELL_STATIC0002 - FRM_SHELL_STATIC0000 + 1 ) );
Pos.vy -= 12; Pos.vy -= 20;
} }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

View file

@ -29,6 +29,7 @@ void CFXJellyFishLegs::init(DVECTOR const &_Pos)
Ofs.vx=0; Ofs.vy=0; Ofs.vx=0; Ofs.vy=0;
Angle=getRnd(); Angle=getRnd();
AngleInc=LegAngleInc+getRndRange(3); AngleInc=LegAngleInc+getRndRange(3);
Scale = ONE;
} }
/*****************************************************************************/ /*****************************************************************************/
@ -72,6 +73,8 @@ int WOfs=0;
int H; int H;
int ThisAngle=Angle; int ThisAngle=Angle;
int LegHeight=SprBank->getFrameHeight(FRM__LEG)-4; int LegHeight=SprBank->getFrameHeight(FRM__LEG)-4;
int ScaleWInc=(Scale*LegWInc)>>12;
int ScaleHInc=(Scale*LegHInc)>>12;
RenderPos.vx+=Ofs.vx; RenderPos.vx+=Ofs.vx;
RenderPos.vy+=Ofs.vy; RenderPos.vy+=Ofs.vy;
@ -82,7 +85,18 @@ int LegHeight=SprBank->getFrameHeight(FRM__LEG)-4;
ThisAngle&=CIRCLE_TAB_MASK; ThisAngle&=CIRCLE_TAB_MASK;
H=LegHeight+(CircleTable[ThisAngle]>>5); H=LegHeight+(CircleTable[ThisAngle]>>5);
POLY_FT4 *Ft4=SprBank->printFT4(FRM__LEG,RenderPos.vx,RenderPos.vy,XFlip,0,OtPos); int spriteWidth = ( Scale * CGameScene::getSpriteBank()->getFrameWidth(FRM__LEG) ) >> 12;
POLY_FT4 *Ft4;
if ( XFlip )
{
Ft4=SprBank->printFT4Scaled(FRM__LEG,RenderPos.vx + 6 + ( spriteWidth >> 1 ),RenderPos.vy,XFlip,0,OtPos,Scale>>4);
}
else
{
Ft4=SprBank->printFT4Scaled(FRM__LEG,RenderPos.vx - 6 - ( spriteWidth >> 1 ),RenderPos.vy,XFlip,0,OtPos,Scale>>4);
}
if (!XFlip) if (!XFlip)
{ {
@ -98,7 +112,10 @@ int LegHeight=SprBank->getFrameHeight(FRM__LEG)-4;
Ft4->y2=Ft4->y0+H; Ft4->y2=Ft4->y0+H;
Ft4->y3=Ft4->y1+H; Ft4->y3=Ft4->y1+H;
RenderPos.vy+=H+LegHInc; // RenderPos.vy+=H+LegHInc;
WOfs+=LegWInc; // WOfs+=LegWInc;
RenderPos.vy+=H+ScaleHInc;
WOfs+=ScaleWInc;
} }
} }

View file

@ -18,12 +18,14 @@ virtual void think(int _frames);
virtual void render(); virtual void render();
void Setup(int XOfs,int YOfs,bool XFlip); void Setup(int XOfs,int YOfs,bool XFlip);
void setScale( s16 newScale ) {Scale = newScale;}
protected: protected:
DVECTOR Ofs; DVECTOR Ofs;
int Angle,AngleInc; int Angle,AngleInc;
bool XFlip; bool XFlip;
s16 Scale;
}; };

View file

@ -36,6 +36,13 @@ void CNpcCartPlatform::postInit()
m_npcPath.setPathType( CNpcPath::SINGLE_USE_PATH ); m_npcPath.setPathType( CNpcPath::SINGLE_USE_PATH );
m_carSpeed = m_speed << 8; m_carSpeed = m_speed << 8;
m_isActivated = false;
sBBox boundingBox = m_modelGfx->GetBBox();
boundingBox.YMin = boundingBox.YMax - 32;
setCollisionSize( ( boundingBox.XMax - boundingBox.XMin ), ( boundingBox.YMax - boundingBox.YMin ) );
setCollisionCentreOffset( ( boundingBox.XMax + boundingBox.XMin ) >> 1, ( boundingBox.YMax + boundingBox.YMin ) >> 1 );
calculateNonRotatedCollisionData();
} }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -51,95 +58,120 @@ void CNpcCartPlatform::processMovement( int _frames )
bool pathComplete; bool pathComplete;
m_npcPath.thinkFlat( Pos, &pathComplete, &distX, &distY, &heading ); if ( m_isActivated )
if ( !pathComplete )
{ {
moveX = ( m_carSpeed >> 8 ) * _frames; m_npcPath.thinkFlat( Pos, &pathComplete, &distX, &distY, &heading );
if ( heading == 2048 ) if ( !pathComplete )
{ {
moveX = -moveX; moveX = ( m_carSpeed >> 8 ) * _frames;
if ( heading == 2048 )
{
moveX = -moveX;
}
} }
}
// check for vertical movement // check for vertical movement
s32 checkDist = yMovement + 50; s32 checkDist = yMovement + 50;
groundHeight = CGameScene::getCollision()->getHeightFromGround( Pos.vx + moveX, Pos.vy, checkDist ); groundHeight = CGameScene::getCollision()->getHeightFromGround( Pos.vx + moveX, Pos.vy, checkDist );
if ( groundHeight < checkDist ) if ( groundHeight < checkDist )
{ {
// groundHeight <= yMovement indicates either just above ground or on or below ground // groundHeight <= yMovement indicates either just above ground or on or below ground
moveY = groundHeight; moveY = groundHeight;
}
else
{
// fall
moveY = yMovement;
}
if ( moveY < 0 )
{
m_carSpeed -= 20;
if ( m_carSpeed < ( 2 << 8 ) )
{
m_carSpeed = ( 2 << 8 );
}
}
else if ( moveY > 0 )
{
m_carSpeed += 20;
if ( m_carSpeed > ( 6 << 8 ) )
{
m_carSpeed = ( 6 << 8 );
}
}
Pos.vx += moveX;
Pos.vy += moveY;
// sort out draw rotation
DVECTOR testPos1, testPos2;
testPos1 = testPos2 = Pos;
testPos1.vx -= 10;
testPos2.vx += 10;
u8 sensorDist = 16;
s32 yDiff;
yDiff = CGameScene::getCollision()->getHeightFromGround( testPos1.vx, testPos1.vy, sensorDist + 1 );
if ( yDiff <= sensorDist )
{
// only use if there is ground present
testPos1.vy += yDiff;
}
yDiff = CGameScene::getCollision()->getHeightFromGround( testPos2.vx, testPos2.vy, sensorDist + 1 );
if ( yDiff <= sensorDist )
{
// only use if there is ground present
testPos2.vy += yDiff;
}
s32 xDist = testPos2.vx - testPos1.vx;
s32 yDist = testPos2.vy - testPos1.vy;
heading = ratan2( yDist, xDist );
setCollisionAngle( heading );
} }
else else
{ {
// fall groundHeight = CGameScene::getCollision()->getHeightFromGround( Pos.vx, Pos.vy, yMovement + 16 );
moveY = yMovement; if ( groundHeight <= yMovement )
}
if ( moveY < 0 )
{
m_carSpeed -= 20;
if ( m_carSpeed < ( 2 << 8 ) )
{ {
m_carSpeed = ( 2 << 8 ); moveY = groundHeight;
}
else
{
// fall
moveY = yMovement;
}
Pos.vy += moveY;
if ( m_contact )
{
m_isActivated = true;
} }
} }
else if ( moveY > 0 )
{
m_carSpeed += 20;
if ( m_carSpeed > ( 6 << 8 ) )
{
m_carSpeed = ( 6 << 8 );
}
}
Pos.vx += moveX;
Pos.vy += moveY;
// sort out draw rotation
DVECTOR testPos1, testPos2;
testPos1 = testPos2 = Pos;
testPos1.vx -= 10;
testPos2.vx += 10;
u8 sensorDist = 16;
s32 yDiff;
yDiff = CGameScene::getCollision()->getHeightFromGround( testPos1.vx, testPos1.vy, sensorDist + 1 );
if ( yDiff <= sensorDist )
{
// only use if there is ground present
testPos1.vy += yDiff;
}
yDiff = CGameScene::getCollision()->getHeightFromGround( testPos2.vx, testPos2.vy, sensorDist + 1 );
if ( yDiff <= sensorDist )
{
// only use if there is ground present
testPos2.vy += yDiff;
}
s32 xDist = testPos2.vx - testPos1.vx;
s32 yDist = testPos2.vy - testPos1.vy;
heading = ratan2( yDist, xDist );
setCollisionAngle( heading );
} }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

View file

@ -27,6 +27,7 @@ protected:
virtual void processMovement( int _frames ); virtual void processMovement( int _frames );
s32 m_carSpeed; s32 m_carSpeed;
u8 m_isActivated;
}; };
#endif #endif

View file

@ -526,6 +526,18 @@ CNpcPlatform::NPC_PLATFORM_DATA CNpcPlatform::m_data[NPC_PLATFORM_TYPE_MAX] =
0, 0,
NPC_PLATFORM_TIMER_NONE, NPC_PLATFORM_TIMER_NONE,
}, },
{ // NPC_BUBBLE_TUBE_PLATFORM
2,
128,
true,
DAMAGE__NONE,
0,
2,
NPC_PLATFORM_INFINITE_LIFE,
0,
NPC_PLATFORM_TIMER_NONE,
},
}; };
CNpcPlatform::NPC_PLATFORM_UNIT_TYPE CNpcPlatform::mapEditConvertTable[NPC_PLATFORM_TYPE_MAX] = CNpcPlatform::NPC_PLATFORM_UNIT_TYPE CNpcPlatform::mapEditConvertTable[NPC_PLATFORM_TYPE_MAX] =
@ -567,6 +579,7 @@ CNpcPlatform::NPC_PLATFORM_UNIT_TYPE CNpcPlatform::mapEditConvertTable[NPC_PLATF
NPC_LIFT_PLATFORM, NPC_LIFT_PLATFORM,
NPC_LOVE_BOAT_PLATFORM, NPC_LOVE_BOAT_PLATFORM,
NPC_STEERABLE_OILDRUM_PLATFORM, NPC_STEERABLE_OILDRUM_PLATFORM,
NPC_BUBBLE_TUBE_PLATFORM,
NPC_CONVEYOR_PLATFORM, NPC_CONVEYOR_PLATFORM,
NPC_PLAYER_BUBBLE_PLATFORM, NPC_PLAYER_BUBBLE_PLATFORM,
NPC_CLAM_PLATFORM, NPC_CLAM_PLATFORM,

View file

@ -191,6 +191,10 @@
#include "platform\psoil.h" #include "platform\psoil.h"
#endif #endif
#ifndef __PLATFORM_PBUBTUBE_H__
#include "platform\pbubtube.h"
#endif
#include "fx\fx.h" #include "fx\fx.h"
#include "fx\fxjfish.h" #include "fx\fxjfish.h"
@ -441,6 +445,12 @@ CNpcPlatform *CNpcPlatform::Create(int Type)
break; break;
} }
case NPC_BUBBLE_TUBE_PLATFORM:
{
platform = new ("bubble tube platform") CNpcBubbleTubePlatform;
break;
}
default: default:
{ {
ASSERT( 0 ); ASSERT( 0 );

View file

@ -94,6 +94,7 @@ public:
NPC_LIFT_PLATFORM, NPC_LIFT_PLATFORM,
NPC_LOVE_BOAT_PLATFORM, NPC_LOVE_BOAT_PLATFORM,
NPC_STEERABLE_OILDRUM_PLATFORM, NPC_STEERABLE_OILDRUM_PLATFORM,
NPC_BUBBLE_TUBE_PLATFORM,
NPC_PLATFORM_TYPE_MAX, NPC_PLATFORM_TYPE_MAX,
}; };
enum enum

View file

@ -124,6 +124,7 @@ OilRigPlatform=1
RockBridge=32 RockBridge=32
SteamSwitch=33 SteamSwitch=33
LiftPlatform=34 LiftPlatform=34
BubbleTubePlatform=37
################################################ ################################################
# Triggers # Triggers

View file

@ -144,3 +144,6 @@ Gfx=..\..\Graphics\platforms\steam_switch\steam_switch.gin
[LiftPlatform] [LiftPlatform]
Gfx=..\..\Graphics\platforms\Industrial\Industrial.gin Gfx=..\..\Graphics\platforms\Industrial\Industrial.gin
[BubbleTubePlatform]
Gfx=..\..\Graphics\platforms\Oilrig2\oilrigplatform2.gin

View file

@ -1425,6 +1425,14 @@ SOURCE=..\..\..\source\platform\pbubble.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\..\..\source\platform\pbubtube.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\source\platform\pbubtube.h
# End Source File
# Begin Source File
SOURCE=..\..\..\source\platform\pbwheel.cpp SOURCE=..\..\..\source\platform\pbwheel.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File