diff --git a/makefile.gaz b/makefile.gaz index bf98f0f92..dc97bb967 100644 --- a/makefile.gaz +++ b/makefile.gaz @@ -110,7 +110,8 @@ platform_src := platform \ pfgen \ pfallnor \ praft \ - plantern + plantern \ + pbgeyser hazard_src := hazard \ hfalling \ diff --git a/source/platform/pbgeyser.cpp b/source/platform/pbgeyser.cpp index e69de29bb..266e8ae14 100644 --- a/source/platform/pbgeyser.cpp +++ b/source/platform/pbgeyser.cpp @@ -0,0 +1,87 @@ +/*========================================================================= + + pbgeyser.h + + Author: CRB + Created: + Project: Spongebob + Purpose: + + Copyright (c) 2001 Climax Development Ltd + +===========================================================================*/ + +#ifndef __PLATFORM_PBGEYSER_H__ +#include "platform\pbgeyser.h" +#endif + +#ifndef __UTILS_HEADER__ +#include "utils\utils.h" +#endif + +#ifndef __GAME_GAME_H__ +#include "game\game.h" +#endif + +#ifndef __PLATFORM_PBUBBLE_H__ +#include "platform\pbubble.h" +#endif + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CNpcGeyserPlatformGenerator::collidedWith(CThing *_thisThing) +{ + // do nothing +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CNpcGeyserPlatformGenerator::render() +{ + // no rendering +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CNpcGeyserPlatformGenerator::think( int _frames ) +{ + m_timer -= _frames; + + if ( m_timer < 0 ) + { + m_timer = getRnd() % ( m_data[m_type].initTimer * GameState::getOneSecondInFrames() ); + + // generate new falling platform + + CNpcPlatform *newPlatform; + newPlatform = NULL; + + switch( m_targetType ) + { + case NPC_BUBBLE_PLATFORM: + { + newPlatform = new ("falling platform") CNpcBubblePlatform; + break; + } + + default: + { + ASSERT( 0 ); + break; + } + } + + ASSERT(newPlatform); + + newPlatform->setType( m_targetType ); + newPlatform->setGraphic( m_graphicNum ); + + DVECTOR startPos = Pos; + startPos.vx += ( -5 + ( getRnd() % 11 ) ); + newPlatform->init( startPos ); + + newPlatform->setLayerCollision( m_layerCollision ); + newPlatform->setTiltable( false ); + newPlatform->postInit(); + } +} diff --git a/source/platform/pbgeyser.h b/source/platform/pbgeyser.h index e69de29bb..bd05590cf 100644 --- a/source/platform/pbgeyser.h +++ b/source/platform/pbgeyser.h @@ -0,0 +1,33 @@ +/*========================================================================= + + pbgeyser.h + + Author: CRB + Created: + Project: Spongebob + Purpose: + + Copyright (c) 2001 Climax Development Ltd + +===========================================================================*/ + +#ifndef __PLATFORM_PBGEYSER_H__ +#define __PLATFORM_PBGEYSER_H__ + +#ifndef __PLATFORM_PLATFORM_H__ +#include "platform\platform.h" +#endif + +class CNpcGeyserPlatformGenerator : public CNpcPlatform +{ +public: + void setTargetType( NPC_PLATFORM_UNIT_TYPE targetType ) {m_targetType = targetType;} + virtual void render(); +protected: + virtual void think( int _frames ); + virtual void collidedWith(CThing *_thisThing); + + NPC_PLATFORM_UNIT_TYPE m_targetType; +}; + +#endif \ No newline at end of file diff --git a/source/platform/pbubble.cpp b/source/platform/pbubble.cpp index 77d1c2e7f..0f98934d9 100644 --- a/source/platform/pbubble.cpp +++ b/source/platform/pbubble.cpp @@ -20,4 +20,9 @@ void CNpcBubblePlatform::processMovement( int _frames ) { Pos.vy -= m_data[m_type].speed * _frames; + + if ( Pos.vy < 0 ) + { + setToShutdown(); + } } \ No newline at end of file diff --git a/source/platform/platdata.cpp b/source/platform/platdata.cpp index 81d8ec5bc..c1e3bd594 100644 --- a/source/platform/platdata.cpp +++ b/source/platform/platdata.cpp @@ -53,7 +53,7 @@ CNpcPlatform::NPC_PLATFORM_DATA CNpcPlatform::m_data[NPC_PLATFORM_TYPE_MAX] = DAMAGE__NONE, 0, 4, - NPC_PLATFORM_FINITE_LIFE_RESPAWN, + NPC_PLATFORM_INFINITE_LIFE, 0, NPC_PLATFORM_TIMER_NONE, }, @@ -298,6 +298,18 @@ CNpcPlatform::NPC_PLATFORM_DATA CNpcPlatform::m_data[NPC_PLATFORM_TYPE_MAX] = NPC_PLATFORM_TIMER_NONE, }, + { // NPC_BUBBLE_GEYSER_GENERATOR + 2, + 128, + true, + DAMAGE__NONE, + 0, + 4, + NPC_PLATFORM_INFINITE_LIFE, + 1, + NPC_PLATFORM_TIMER_NONE, + }, + { // NPC_PLAYER_BUBBLE_PLATFORM 3, 128, @@ -335,5 +347,6 @@ CNpcPlatform::NPC_PLATFORM_UNIT_TYPE CNpcPlatform::mapEditConvertTable[NPC_PLATF NPC_RAFT_PLATFORM, NPC_VERTICAL_OILDRUM_GENERATOR, NPC_LANTERN_PLATFORM, + NPC_BUBBLE_GEYSER_GENERATOR, NPC_PLAYER_BUBBLE_PLATFORM, }; diff --git a/source/platform/platform.cpp b/source/platform/platform.cpp index 887acb316..a91664fc4 100644 --- a/source/platform/platform.cpp +++ b/source/platform/platform.cpp @@ -119,6 +119,10 @@ #include "platform\plantern.h" #endif +#ifndef __PLATFORM_PBGEYSER_H__ +#include "platform\pbgeyser.h" +#endif + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -268,6 +272,15 @@ CNpcPlatform *CNpcPlatform::Create(sThingPlatform *ThisPlatform) break; } + case NPC_BUBBLE_GEYSER_GENERATOR: + { + CNpcGeyserPlatformGenerator *generator; + generator = new ("bubble geyser generator") CNpcGeyserPlatformGenerator; + generator->setTargetType( NPC_BUBBLE_PLATFORM ); + platform = generator; + break; + } + case NPC_LANTERN_PLATFORM: { platform = new ("lantern platform") CNpcLanternPlatform; diff --git a/source/platform/platform.h b/source/platform/platform.h index b7ad3cbd8..c64d67176 100644 --- a/source/platform/platform.h +++ b/source/platform/platform.h @@ -75,6 +75,7 @@ public: NPC_VERTICAL_OILDRUM_GENERATOR, NPC_VERTICAL_OILDRUM_PLATFORM, NPC_LANTERN_PLATFORM, + NPC_BUBBLE_GEYSER_GENERATOR, NPC_PLAYER_BUBBLE_PLATFORM, NPC_PLATFORM_TYPE_MAX, }; diff --git a/tools/Data/bin/MkLevel.ini b/tools/Data/bin/MkLevel.ini index 66a9b8fd1..78a7de841 100644 --- a/tools/Data/bin/MkLevel.ini +++ b/tools/Data/bin/MkLevel.ini @@ -103,6 +103,7 @@ Wooden=6 Raft=19 VertOilDrumGenerator=20 SwingingLantern=21 +BubbleGeyserGenerator=22 ################################################ # Triggers @@ -133,5 +134,6 @@ SpinningBlades=6 Masher=7 Fan=8 Spikes=9 +#Wheel=10 diff --git a/tools/MapEdit/Hazard.ini b/tools/MapEdit/Hazard.ini index 802118aa7..f2e7e585f 100644 --- a/tools/MapEdit/Hazard.ini +++ b/tools/MapEdit/Hazard.ini @@ -129,3 +129,13 @@ Collision=0 Health=0 AttackStrength=0 Respawn=2 + +#[Wheel] +#Gfx=..\..\graphics\hazards\wheel\wheel.gin +#WayPoints=0 +#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 0a2a475bc..f7a429f6f 100644 --- a/tools/MapEdit/platform.ini +++ b/tools/MapEdit/platform.ini @@ -85,3 +85,5 @@ Gfx=..\..\Graphics\platforms\vert_Oildrum\vert_Oildrum.gin [SwingingLantern] Gfx=..\..\Graphics\platforms\wooden\wooden.gin +[BubbleGeyserGenerator] +Gfx=..\..\Graphics\platforms\Bubble\bubble.gin diff --git a/users/paul/spongebob project/spongebob project.dsp b/users/paul/spongebob project/spongebob project.dsp index da47e8e1c..51dddeb29 100644 --- a/users/paul/spongebob project/spongebob project.dsp +++ b/users/paul/spongebob project/spongebob project.dsp @@ -1125,6 +1125,14 @@ SOURCE=..\..\..\source\pickups\pspatula.h # PROP Default_Filter "" # Begin Source File +SOURCE=..\..\..\source\platform\pbgeyser.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\source\platform\pbgeyser.h +# End Source File +# Begin Source File + SOURCE=..\..\..\source\platform\pbob.cpp # End Source File # Begin Source File