From dec9d1139af9945d8f46f93b2b49c1ce6a7c45e1 Mon Sep 17 00:00:00 2001 From: Charles Date: Tue, 5 Jun 2001 20:44:30 +0000 Subject: [PATCH] --- makefile.gaz | 3 +- source/platform/pdrop.cpp | 52 +++++++++++++++++++ source/platform/pdrop.h | 29 +++++++++++ source/platform/platdata.cpp | 13 +++++ source/platform/platform.cpp | 10 ++++ source/platform/platform.h | 1 + tools/Data/bin/MkLevel.ini | 1 + tools/MapEdit/platform.ini | 3 ++ .../spongebob project/spongebob project.dsp | 8 +++ 9 files changed, 119 insertions(+), 1 deletion(-) create mode 100644 source/platform/pdrop.cpp create mode 100644 source/platform/pdrop.h diff --git a/makefile.gaz b/makefile.gaz index ee7f70c70..1ad15190a 100644 --- a/makefile.gaz +++ b/makefile.gaz @@ -129,7 +129,8 @@ platform_src := platform \ ptrpdoor \ pconveyr \ pplayer \ - pcbubble + pcbubble \ + pdrop hazard_src := hazard \ hfalling \ diff --git a/source/platform/pdrop.cpp b/source/platform/pdrop.cpp new file mode 100644 index 000000000..5c2223e03 --- /dev/null +++ b/source/platform/pdrop.cpp @@ -0,0 +1,52 @@ +/*========================================================================= + + pdrop.cpp + + Author: CRB + Created: + Project: Spongebob + Purpose: + + Copyright (c) 2001 Climax Development Ltd + +===========================================================================*/ + +#ifndef __PLATFORM_PDROP_H__ +#include "platform\pdrop.h" +#endif + +#ifndef __GAME_GAME_H__ +#include "game\game.h" +#endif + + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CNpcDropPlatform::processMovement( int _frames ) +{ + s32 moveY = m_speed * _frames; + + s32 groundHeight = CGameScene::getCollision()->getHeightFromGround( Pos.vx, Pos.vy + moveY, 16 ); + + if ( groundHeight < moveY ) + { + moveY = groundHeight; + } + + Pos.vy += moveY; +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +const CRECT *CNpcDropPlatform::getThinkBBox() +{ + CRECT objThinkBox = getCollisionArea(); + + sBBox &thinkBBox = CThingManager::getThinkBBox(); + objThinkBox.x1 = thinkBBox.XMin; + objThinkBox.x2 = thinkBBox.XMax; + objThinkBox.y1 = thinkBBox.YMin; + objThinkBox.y2 = thinkBBox.YMax; + + return &objThinkBox; +} \ No newline at end of file diff --git a/source/platform/pdrop.h b/source/platform/pdrop.h new file mode 100644 index 000000000..4cc991ac2 --- /dev/null +++ b/source/platform/pdrop.h @@ -0,0 +1,29 @@ +/*========================================================================= + + pdrop.h + + Author: CRB + Created: + Project: Spongebob + Purpose: + + Copyright (c) 2001 Climax Development Ltd + +===========================================================================*/ + +#ifndef __PLATFORM_PDROP_H__ +#define __PLATFORM_PDROP_H__ + +#ifndef __PLATFORM_PLATFORM_H__ +#include "platform\platform.h" +#endif + +class CNpcDropPlatform : public CNpcPlatform +{ +public: + virtual CRECT const *getThinkBBox(); +protected: + virtual void processMovement( int _frames ); +}; + +#endif \ No newline at end of file diff --git a/source/platform/platdata.cpp b/source/platform/platdata.cpp index 454b14f9b..458705c69 100644 --- a/source/platform/platdata.cpp +++ b/source/platform/platdata.cpp @@ -466,6 +466,18 @@ CNpcPlatform::NPC_PLATFORM_DATA CNpcPlatform::m_data[NPC_PLATFORM_TYPE_MAX] = 0, NPC_PLATFORM_TIMER_NONE, }, + + { // NPC_DROP_PLATFORM + 6, + 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] = @@ -502,6 +514,7 @@ CNpcPlatform::NPC_PLATFORM_UNIT_TYPE CNpcPlatform::mapEditConvertTable[NPC_PLATF NPC_TRAPDOOR_PLATFORM, NPC_CONVEYOR_GENERATOR, NPC_COLLAPSING_ACRID_PLATFORM, + NPC_DROP_PLATFORM, NPC_CONVEYOR_PLATFORM, NPC_PLAYER_BUBBLE_PLATFORM, NPC_CLAM_PLATFORM, diff --git a/source/platform/platform.cpp b/source/platform/platform.cpp index bd2376c0c..7eba30e44 100644 --- a/source/platform/platform.cpp +++ b/source/platform/platform.cpp @@ -171,6 +171,10 @@ #include "platform\pfallnor.h" #endif +#ifndef __PLATFORM_PDROP_H__ +#include "platform\pdrop.h" +#endif + #include "fx\fx.h" #include "fx\fxjfish.h" @@ -391,6 +395,12 @@ CNpcPlatform *CNpcPlatform::Create(int Type) break; } + case NPC_DROP_PLATFORM: + { + platform = new ("drop platform") CNpcDropPlatform; + break; + } + default: { ASSERT( 0 ); diff --git a/source/platform/platform.h b/source/platform/platform.h index fcb81c610..b09d71f6c 100644 --- a/source/platform/platform.h +++ b/source/platform/platform.h @@ -89,6 +89,7 @@ public: NPC_PLAYER_BUBBLE_PLATFORM, NPC_CLAM_PLATFORM, NPC_COLLAPSING_ACRID_PLATFORM, + NPC_DROP_PLATFORM, NPC_PLATFORM_TYPE_MAX, }; enum diff --git a/tools/Data/bin/MkLevel.ini b/tools/Data/bin/MkLevel.ini index 52ebf1aac..11a50709f 100644 --- a/tools/Data/bin/MkLevel.ini +++ b/tools/Data/bin/MkLevel.ini @@ -121,6 +121,7 @@ DualGreenPlatform=16 AcridBubble=31 LeafRaft=19 OilRigPlatform=1 +RockBridge=32 ################################################ # Triggers diff --git a/tools/MapEdit/platform.ini b/tools/MapEdit/platform.ini index 441d2ba64..af2883e66 100644 --- a/tools/MapEdit/platform.ini +++ b/tools/MapEdit/platform.ini @@ -136,3 +136,6 @@ Gfx=..\..\Graphics\platforms\Leaf\Leaf.gin [OilRigPlatform] Gfx=..\..\Graphics\platforms\oilrig\oilrigplatform.gin +[RockBridge] +Gfx=..\..\Graphics\platforms\rockbridge\rockbridge.gin + diff --git a/users/paul/spongebob project/spongebob project.dsp b/users/paul/spongebob project/spongebob project.dsp index 069fbc7a7..ffe215b44 100644 --- a/users/paul/spongebob project/spongebob project.dsp +++ b/users/paul/spongebob project/spongebob project.dsp @@ -1465,6 +1465,14 @@ SOURCE=..\..\..\source\platform\pconveyr.h # End Source File # Begin Source File +SOURCE=..\..\..\source\platform\pdrop.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\source\platform\pdrop.h +# End Source File +# Begin Source File + SOURCE=..\..\..\source\platform\pdual.cpp # End Source File # Begin Source File