From 4135b5251694a759bca4b97973d430efbb9f673e Mon Sep 17 00:00:00 2001 From: Charles Date: Sat, 5 May 2001 17:34:26 +0000 Subject: [PATCH] --- source/platform/pgeyser.cpp | 114 ++++++++++++++++++++++++++---------- source/platform/pgeyser.h | 7 +++ tools/Data/bin/MkLevel.ini | 2 + tools/MapEdit/Hazard.ini | 10 ++++ tools/MapEdit/platform.ini | 5 +- 5 files changed, 105 insertions(+), 33 deletions(-) diff --git a/source/platform/pgeyser.cpp b/source/platform/pgeyser.cpp index 00cf8d3f6..af7510216 100644 --- a/source/platform/pgeyser.cpp +++ b/source/platform/pgeyser.cpp @@ -15,15 +15,20 @@ #include "platform\pgeyser.h" #endif +#ifndef __UTILS_HEADER__ +#include "utils\utils.h" +#endif + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void CNpcGeyserPlatform::postInit() { CNpcPlatform::postInit(); - m_npcPath.setPathType( CNpcPath::SINGLE_USE_PATH ); - m_isFiring = false; + + m_state = GEYSER_READY; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -32,46 +37,86 @@ void CNpcGeyserPlatform::processMovement( int _frames ) { if ( m_isFiring ) { - s32 moveY = 0; - s32 distX, distY, heading; - bool pathComplete; + s32 minY, maxY; + m_npcPath.getPathYExtents( &minY, &maxY ); - m_npcPath.thinkVertical( Pos, &pathComplete, &distX, &distY, &heading ); - - if ( pathComplete ) + switch ( m_state ) { - m_npcPath.resetPath(); - 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 ) ) + case GEYSER_DROPPING: { - s32 multiplier = Pos.vy - minY; - - moveY = ( multiplier * moveY ) >> 6; - - if ( moveY < 1 ) + if ( maxY - Pos.vy == 0 ) { - 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 { - m_isFiring = true; + if ( m_state == GEYSER_READY ) + { + m_isFiring = true; + Pos = m_base; + m_state = GEYSER_RISING; + } } } diff --git a/source/platform/pgeyser.h b/source/platform/pgeyser.h index 69284fcfa..98664f54d 100644 --- a/source/platform/pgeyser.h +++ b/source/platform/pgeyser.h @@ -27,6 +27,13 @@ protected: virtual void processTimer( int _frames ); bool m_isFiring; + + enum GEYSER_STATE + { + GEYSER_READY, + GEYSER_RISING, + GEYSER_DROPPING, + }; }; #endif \ No newline at end of file diff --git a/tools/Data/bin/MkLevel.ini b/tools/Data/bin/MkLevel.ini index f94f70541..d01a55e3d 100644 --- a/tools/Data/bin/MkLevel.ini +++ b/tools/Data/bin/MkLevel.ini @@ -107,6 +107,7 @@ BubbleGeyserGenerator=22 BigWheelPlatform=23 FixedPathBarrelPlatform=1 SteerableBarrelPlatform=24 +RockGeyser=7 ################################################ # Triggers @@ -138,5 +139,6 @@ Masher=7 Fan=8 Spikes=9 Wheel=10 +BarrelHazard=3 diff --git a/tools/MapEdit/Hazard.ini b/tools/MapEdit/Hazard.ini index 8f26c189c..63b0c3982 100644 --- a/tools/MapEdit/Hazard.ini +++ b/tools/MapEdit/Hazard.ini @@ -139,3 +139,13 @@ Collision=0 Health=0 AttackStrength=0 Respawn=2 + +[BarrelHazard] +Gfx=..\..\graphics\platforms\barrel\barrel.gin +WayPoints=16 +Speed=0 +TurnRate=0 +Collision=0 +Health=0 +AttackStrength=0 +Respawn=2 diff --git a/tools/MapEdit/platform.ini b/tools/MapEdit/platform.ini index 685f7b1e5..8bdbaeff2 100644 --- a/tools/MapEdit/platform.ini +++ b/tools/MapEdit/platform.ini @@ -95,4 +95,7 @@ Gfx=..\..\Graphics\platforms\carriage\carriage.gin Gfx=..\..\Graphics\platforms\barrel\barrel.gin [SteerableBarrelPlatform] -Gfx=..\..\Graphics\platforms\barrel\barrel.gin \ No newline at end of file +Gfx=..\..\Graphics\platforms\barrel\barrel.gin + +[RockGeyser] +Gfx=..\..\Graphics\platforms\rockplateau\rockplateau.gin \ No newline at end of file