This commit is contained in:
Charles 2001-05-05 17:34:26 +00:00
parent 5cf79f93ac
commit 4135b52516
5 changed files with 105 additions and 33 deletions

View File

@ -15,15 +15,20 @@
#include "platform\pgeyser.h" #include "platform\pgeyser.h"
#endif #endif
#ifndef __UTILS_HEADER__
#include "utils\utils.h"
#endif
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcGeyserPlatform::postInit() void CNpcGeyserPlatform::postInit()
{ {
CNpcPlatform::postInit(); CNpcPlatform::postInit();
m_npcPath.setPathType( CNpcPath::SINGLE_USE_PATH );
m_isFiring = false; m_isFiring = false;
m_state = GEYSER_READY;
} }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -32,46 +37,86 @@ void CNpcGeyserPlatform::processMovement( int _frames )
{ {
if ( m_isFiring ) if ( m_isFiring )
{ {
s32 moveY = 0; s32 minY, maxY;
s32 distX, distY, heading; m_npcPath.getPathYExtents( &minY, &maxY );
bool pathComplete;
m_npcPath.thinkVertical( Pos, &pathComplete, &distX, &distY, &heading ); switch ( m_state )
if ( pathComplete )
{ {
m_npcPath.resetPath(); case GEYSER_DROPPING:
reinit();
m_isFiring = false;
}
else
{
s32 minY, maxY;
m_npcPath.getPathYExtents( &minY, &maxY );
moveY = m_data[m_type].speed * _frames;
if ( Pos.vy < ( minY + 64 ) )
{ {
s32 multiplier = Pos.vy - minY; if ( maxY - Pos.vy == 0 )
moveY = ( multiplier * moveY ) >> 6;
if ( moveY < 1 )
{ {
moveY = 1; m_isFiring = false;
reinit();
m_state = GEYSER_READY;
} }
else
{
s32 moveY = m_data[m_type].speed * _frames;
if ( Pos.vy < ( minY + 64 ) )
{
s32 multiplier = Pos.vy - minY;
moveY = ( multiplier * moveY ) >> 6;
if ( moveY < 1 )
{
moveY = 1;
}
}
Pos.vy += moveY;
if ( Pos.vy > maxY )
{
Pos.vy = maxY;
}
}
break;
} }
if ( heading == 3072 ) case GEYSER_RISING:
{ {
moveY = -moveY; if ( minY - Pos.vy == 0 )
} {
m_state = GEYSER_DROPPING;
}
else
{
s32 moveY = m_data[m_type].speed * _frames;
Pos.vy += moveY; if ( Pos.vy < ( minY + 64 ) )
{
s32 multiplier = Pos.vy - minY;
moveY = ( multiplier * moveY ) >> 6;
if ( moveY < 1 )
{
moveY = 1;
}
}
Pos.vy -= moveY;
if ( Pos.vy < minY )
{
Pos.vy = minY;
}
}
break;
}
} }
} }
else
{
Pos.vx = m_base.vx + ( -3 + ( getRnd() % 7 ) );
Pos.vy = m_base.vy + ( -3 + ( getRnd() % 7 ) );
}
} }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -84,6 +129,11 @@ void CNpcGeyserPlatform::processTimer( int _frames )
} }
else else
{ {
m_isFiring = true; if ( m_state == GEYSER_READY )
{
m_isFiring = true;
Pos = m_base;
m_state = GEYSER_RISING;
}
} }
} }

View File

@ -27,6 +27,13 @@ protected:
virtual void processTimer( int _frames ); virtual void processTimer( int _frames );
bool m_isFiring; bool m_isFiring;
enum GEYSER_STATE
{
GEYSER_READY,
GEYSER_RISING,
GEYSER_DROPPING,
};
}; };
#endif #endif

View File

@ -107,6 +107,7 @@ BubbleGeyserGenerator=22
BigWheelPlatform=23 BigWheelPlatform=23
FixedPathBarrelPlatform=1 FixedPathBarrelPlatform=1
SteerableBarrelPlatform=24 SteerableBarrelPlatform=24
RockGeyser=7
################################################ ################################################
# Triggers # Triggers
@ -138,5 +139,6 @@ Masher=7
Fan=8 Fan=8
Spikes=9 Spikes=9
Wheel=10 Wheel=10
BarrelHazard=3

View File

@ -139,3 +139,13 @@ Collision=0
Health=0 Health=0
AttackStrength=0 AttackStrength=0
Respawn=2 Respawn=2
[BarrelHazard]
Gfx=..\..\graphics\platforms\barrel\barrel.gin
WayPoints=16
Speed=0
TurnRate=0
Collision=0
Health=0
AttackStrength=0
Respawn=2

View File

@ -95,4 +95,7 @@ Gfx=..\..\Graphics\platforms\carriage\carriage.gin
Gfx=..\..\Graphics\platforms\barrel\barrel.gin Gfx=..\..\Graphics\platforms\barrel\barrel.gin
[SteerableBarrelPlatform] [SteerableBarrelPlatform]
Gfx=..\..\Graphics\platforms\barrel\barrel.gin Gfx=..\..\Graphics\platforms\barrel\barrel.gin
[RockGeyser]
Gfx=..\..\Graphics\platforms\rockplateau\rockplateau.gin