From be70fbdcfa91605e8d1b69ba779afde88429f9e4 Mon Sep 17 00:00:00 2001 From: Charles Date: Tue, 24 Apr 2001 22:05:29 +0000 Subject: [PATCH] --- makefile.gaz | 4 +- source/platform/platdata.cpp | 15 +++++++ source/platform/platform.cpp | 44 +++++++++++++++---- source/platform/platform.h | 14 ++++++ source/platform/ppendulm.cpp | 41 ++++++++++++++++- source/platform/ppendulm.h | 1 + tools/Data/bin/MkLevel.ini | 3 ++ tools/MapEdit/platform.ini | 8 ++++ .../spongebob project/spongebob project.dsp | 16 +++++++ 9 files changed, 135 insertions(+), 11 deletions(-) diff --git a/makefile.gaz b/makefile.gaz index a7e486e45..cd1a25b3a 100644 --- a/makefile.gaz +++ b/makefile.gaz @@ -91,7 +91,9 @@ platform_src := platform \ pbob \ pfalling \ pcart \ - pretract + pretract \ + pbranch \ + ppendulm hazard_src := hazard \ hfalling \ diff --git a/source/platform/platdata.cpp b/source/platform/platdata.cpp index d326c17d9..93b9bb32d 100644 --- a/source/platform/platdata.cpp +++ b/source/platform/platdata.cpp @@ -162,6 +162,20 @@ CNpcPlatform::NPC_PLATFORM_DATA CNpcPlatform::m_data[NPC_PLATFORM_TYPE_MAX] = NPC_PLATFORM_TIMER_NONE, }, + { // NPC_FISH_HOOK_2_PLATFORM + ACTORS_CLAM_SBK, + ANIM_CLAM_SIDESNAP, + 3, + 128, + true, + DAMAGE__NONE, + 0, + 4, + NPC_PLATFORM_INFINITE_LIFE, + 0, + NPC_PLATFORM_TIMER_NONE, + }, + { // NPC_PLAYER_BUBBLE_PLATFORM ACTORS_CLAM_SBK, ANIM_CLAM_SIDESNAP, @@ -189,5 +203,6 @@ CNpcPlatform::NPC_PLATFORM_UNIT_TYPE CNpcPlatform::mapEditConvertTable[NPC_PLATF NPC_GEYSER_PLATFORM, NPC_BOBBING_PLATFORM, NPC_CART_PLATFORM, + NPC_FISH_HOOK_2_PLATFORM, NPC_PLAYER_BUBBLE_PLATFORM, }; diff --git a/source/platform/platform.cpp b/source/platform/platform.cpp index d9cd6e8d3..c2eb15f65 100644 --- a/source/platform/platform.cpp +++ b/source/platform/platform.cpp @@ -79,6 +79,10 @@ #include "platform\pfalling.h" #endif +#ifndef __PLATFORM_PPENDULM_H__ +#include "platform\ppendulm.h" +#endif + #ifndef __PLATFORM_PPLAYER_H__ #include "platform\pplayer.h" #endif @@ -91,7 +95,6 @@ class CLayerCollision *CNpcPlatform::m_layerCollision; CNpcPlatform *CNpcPlatform::Create(sThingPlatform *ThisPlatform) { - int pointNum; CNpcPlatform *platform; NPC_PLATFORM_UNIT_TYPE platformType = getTypeFromMapEdit( ThisPlatform->Type ); @@ -152,8 +155,15 @@ CNpcPlatform *CNpcPlatform::Create(sThingPlatform *ThisPlatform) break; } + case NPC_FISH_HOOK_2_PLATFORM: + { + platform = new ("fish hook 2 platform") CNpcPendulumPlatform; + break; + } + default: { + ASSERT( 0 ); platform = new ("platform") CNpcPlatform; break; } @@ -161,6 +171,20 @@ CNpcPlatform *CNpcPlatform::Create(sThingPlatform *ThisPlatform) ASSERT(platform); platform->setType( platformType ); + platform->setGraphic( ThisPlatform ); + + platform->setWaypoints( ThisPlatform ); + + platform->setTiltable( false ); + + return( platform ); +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CNpcPlatform::setWaypoints( sThingPlatform *ThisPlatform ) +{ + int pointNum; u16 *PntList=(u16*)MakePtr(ThisPlatform,sizeof(sThingPlatform)); @@ -175,10 +199,9 @@ CNpcPlatform *CNpcPlatform::Create(sThingPlatform *ThisPlatform) startPos.vx = newXPos << 4; startPos.vy = newYPos << 4; - platform->init( startPos ); - platform->setTiltable( false ); + init( startPos ); - platform->addWaypoint( newXPos, newYPos ); + addWaypoint( newXPos, newYPos ); if ( ThisPlatform->PointCount > 1 ) { @@ -189,11 +212,17 @@ CNpcPlatform *CNpcPlatform::Create(sThingPlatform *ThisPlatform) newYPos = (u16) *PntList; PntList++; - platform->addWaypoint( newXPos, newYPos ); + addWaypoint( newXPos, newYPos ); } } +} - return( platform ); +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CNpcPlatform::setGraphic( sThingPlatform *ThisPlatform ) +{ + m_modelGfx = new ("ModelGfx") CModelGfx; + m_modelGfx->SetModel( ThisPlatform->Gfx ); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -203,9 +232,6 @@ void CNpcPlatform::init() CPlatformThing::init(); - m_modelGfx=new ("ModelGfx") CModelGfx; - m_modelGfx->SetModel(0); - m_animPlaying = true; m_animNo = m_data[m_type].initAnim; m_frame = 0; diff --git a/source/platform/platform.h b/source/platform/platform.h index ecb1c761d..a05a2407a 100644 --- a/source/platform/platform.h +++ b/source/platform/platform.h @@ -52,6 +52,7 @@ public: NPC_BOBBING_PLATFORM, NPC_FALLING_PLATFORM, NPC_CART_PLATFORM, + NPC_FISH_HOOK_2_PLATFORM, NPC_PLAYER_BUBBLE_PLATFORM, NPC_PLATFORM_TYPE_MAX, }; @@ -70,6 +71,8 @@ public: virtual s32 getNewYPos( CThing *_thisThing ); void setTiltable( bool isTiltable ); void addWaypoint( s32 xPos, s32 yPos ); + void setGraphic( sThingPlatform *ThisPlatform ); + virtual void setWaypoints( sThingPlatform *ThisPlatform ); static NPC_PLATFORM_UNIT_TYPE getTypeFromMapEdit( u16 newType ); static CNpcPlatform *Create(sThingPlatform *ThisPlatform); @@ -91,6 +94,16 @@ protected: NPC_PLATFORM_TIMER_RESPAWN = 1, }; + enum + { + EXTEND_UP = true, + EXTEND_DOWN = false, + EXTEND_RIGHT = true, + EXTEND_LEFT = false, + EXTEND_CLOCKWISE = true, + EXTEND_ANTICLOCKWISE = false, + }; + typedef struct NPC_PLATFORM_DATA_TYPE { FileEquate ActorType; @@ -157,6 +170,7 @@ protected: bool m_tiltable; s32 m_tiltAngle; s32 m_tiltVelocity; + bool m_extendDir; int m_frame; int m_animNo; diff --git a/source/platform/ppendulm.cpp b/source/platform/ppendulm.cpp index d35004d77..763a9da7d 100644 --- a/source/platform/ppendulm.cpp +++ b/source/platform/ppendulm.cpp @@ -15,14 +15,53 @@ #include "platform\ppendulm.h" #endif +#ifndef __UTILS_HEADER__ +#include "utils\utils.h" +#endif + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + void CNpcPendulumPlatform::postInit() { m_extendDir = EXTEND_LEFT; m_extension = 0; m_heading = 1024; - m_length = 200; } +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CNpcPendulumPlatform::setWaypoints( sThingPlatform *ThisPlatform ) +{ + int pointNum; + + u16 *PntList=(u16*)MakePtr(ThisPlatform,sizeof(sThingPlatform)); + + u16 initYPos, newXPos, newYPos; + + newXPos = (u16) *PntList; + PntList++; + initYPos = newYPos = (u16) *PntList; + PntList++; + + DVECTOR startPos; + startPos.vx = newXPos << 4; + startPos.vy = newYPos << 4; + + init( startPos ); + + if ( ThisPlatform->PointCount > 1 ) + { + newXPos = (u16) *PntList; + PntList++; + newYPos = (u16) *PntList; + PntList++; + + m_length = ( newYPos - initYPos ) << 4; + } +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + void CNpcPendulumPlatform::processMovement( int _frames ) { if ( m_extendDir == EXTEND_LEFT ) diff --git a/source/platform/ppendulm.h b/source/platform/ppendulm.h index 0ca43d31b..70b4c643d 100644 --- a/source/platform/ppendulm.h +++ b/source/platform/ppendulm.h @@ -23,6 +23,7 @@ class CNpcPendulumPlatform : public CNpcPlatform public: virtual void postInit(); protected: + virtual void setWaypoints( sThingPlatform *ThisPlatform ); virtual void processMovement( int _frames ); s32 m_length; diff --git a/tools/Data/bin/MkLevel.ini b/tools/Data/bin/MkLevel.ini index 1daf20b72..79a0aab3c 100644 --- a/tools/Data/bin/MkLevel.ini +++ b/tools/Data/bin/MkLevel.ini @@ -80,6 +80,9 @@ Bubble=0 Jellyfish=1 Industrial=1 Leaf=2 +FishHook1=5 +FishHook2=5 +SwingingFishHook=10 ################################################ # Triggers diff --git a/tools/MapEdit/platform.ini b/tools/MapEdit/platform.ini index e8a798fc6..c37258b91 100644 --- a/tools/MapEdit/platform.ini +++ b/tools/MapEdit/platform.ini @@ -18,3 +18,11 @@ Gfx=..\..\Graphics\platforms\Industrial\Industrial.gin [Leaf] Gfx=..\..\Graphics\platforms\Leaf\Leaf.gin +[FishHook1] +Gfx=..\..\Graphics\platforms\FishHook1\FishHook1.gin + +[FishHook2] +Gfx=..\..\Graphics\platforms\FishHook2\FishHook2.gin + +[SwingingFishHook] +Gfx=..\..\Graphics\platforms\FishHook3\FishHook3.gin diff --git a/users/paul/spongebob project/spongebob project.dsp b/users/paul/spongebob project/spongebob project.dsp index 7fed6b846..9f5737575 100644 --- a/users/paul/spongebob project/spongebob project.dsp +++ b/users/paul/spongebob project/spongebob project.dsp @@ -1369,6 +1369,14 @@ SOURCE=..\..\..\source\platform\pbob.h # End Source File # Begin Source File +SOURCE=..\..\..\source\platform\pbranch.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\source\platform\pbranch.h +# End Source File +# Begin Source File + SOURCE=..\..\..\source\platform\pbubble.cpp # End Source File # Begin Source File @@ -1441,6 +1449,14 @@ SOURCE=..\..\..\source\platform\plinear.h # End Source File # Begin Source File +SOURCE=..\..\..\source\platform\ppendulm.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\source\platform\ppendulm.h +# End Source File +# Begin Source File + SOURCE=..\..\..\source\platform\pplayer.h # End Source File # Begin Source File