From 673f7f4ce2e1802e04299c1b1a9cf22742cc67ed Mon Sep 17 00:00:00 2001 From: Charles Date: Wed, 23 May 2001 18:45:27 +0000 Subject: [PATCH] --- makefile.gaz | 4 +- source/hazard/hazard.cpp | 23 ++++++++ source/hazard/hazard.h | 5 ++ source/thing/thing.cpp | 57 +++++++++++++++++++ source/thing/thing.h | 1 + tools/Data/bin/MkLevel.ini | 4 +- tools/MapEdit/Hazard.ini | 20 +++++++ .../spongebob project/spongebob project.dsp | 16 ++++++ 8 files changed, 127 insertions(+), 3 deletions(-) diff --git a/makefile.gaz b/makefile.gaz index a8c855acb..f483af2e7 100644 --- a/makefile.gaz +++ b/makefile.gaz @@ -141,7 +141,9 @@ hazard_src := hazard \ hdbarrel \ hbbarrel \ hrrock \ - hflytrap + hflytrap \ + hrweight \ + hrwheel fx_src := fx \ fxtrail \ diff --git a/source/hazard/hazard.cpp b/source/hazard/hazard.cpp index 791445107..5f7602d78 100644 --- a/source/hazard/hazard.cpp +++ b/source/hazard/hazard.cpp @@ -95,6 +95,14 @@ #include "hazard\hflytrap.h" #endif +#ifndef __HAZARD_HRWEIGHT_H__ +#include "hazard\hrweight.h" +#endif + +#ifndef __HAZARD_HRWHEEL_H__ +#include "hazard\hrwheel.h" +#endif + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -116,6 +124,8 @@ CNpcHazard::NPC_HAZARD_UNIT_TYPE CNpcHazard::mapEditConvertTable[NPC_HAZARD_TYPE NPC_FIREBALL_HAZARD, NPC_ROLLING_ROCK_HAZARD, NPC_FLY_TRAP_HAZARD, + NPC_RISING_WEIGHT_HAZARD, + NPC_RISING_WEIGHT_WHEEL_HAZARD, }; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -224,6 +234,18 @@ CNpcHazard *CNpcHazard::Create(sThingHazard *ThisHazard) break; } + case NPC_RISING_WEIGHT_HAZARD: + { + hazard = new ("rising weight hazard") CNpcRisingWeightHazard; + break; + } + + case NPC_RISING_WEIGHT_WHEEL_HAZARD: + { + hazard = new ("rising weight wheel hazard") CNpcRisingWeightWheelHazard; + break; + } + default: { hazard = NULL; @@ -233,6 +255,7 @@ CNpcHazard *CNpcHazard::Create(sThingHazard *ThisHazard) ASSERT( hazard ); + hazard->setType( hazardType ); hazard->init(); hazard->setWaypoints( ThisHazard ); hazard->setGraphic( ThisHazard ); diff --git a/source/hazard/hazard.h b/source/hazard/hazard.h index 87cad3ac5..b87646a10 100644 --- a/source/hazard/hazard.h +++ b/source/hazard/hazard.h @@ -52,6 +52,8 @@ public: NPC_FIREBALL_HAZARD, NPC_ROLLING_ROCK_HAZARD, NPC_FLY_TRAP_HAZARD, + NPC_RISING_WEIGHT_HAZARD, + NPC_RISING_WEIGHT_WHEEL_HAZARD, NPC_HAZARD_TYPE_MAX, }; @@ -65,6 +67,8 @@ public: virtual void setWaypoints( sThingHazard *ThisHazard ); void addWaypoint( s32 xPos, s32 yPos ); virtual void setRespawnRate( s16 newRespawnRate ) {m_respawnRate=newRespawnRate;} + void setType( NPC_HAZARD_UNIT_TYPE type ) {m_type = type;} + NPC_HAZARD_UNIT_TYPE getType() {return( m_type );} static NPC_HAZARD_UNIT_TYPE getTypeFromMapEdit( u16 newType ); static CNpcHazard *Create(sThingHazard *ThisHazard); @@ -88,6 +92,7 @@ protected: virtual void processTimer( int _frames ); virtual void collidedWith(CThing *_thisThing); + NPC_HAZARD_UNIT_TYPE m_type; CNpcPath m_npcPath; //CActorGfx *m_actorGfx; //SpriteBank *m_spriteBank; diff --git a/source/thing/thing.cpp b/source/thing/thing.cpp index 606bc0829..7ec9be6ac 100644 --- a/source/thing/thing.cpp +++ b/source/thing/thing.cpp @@ -31,6 +31,18 @@ #include "level\level.h" +#ifndef __HAZARD_HAZARD_H__ +#include "hazard\hazard.h" +#endif + +#ifndef __HAZARD_HRWEIGHT_H__ +#include "hazard\hrweight.h" +#endif + +#ifndef __HAZARD_HRWHEEL_H__ +#include "hazard\hrwheel.h" +#endif + /* Std Lib ------- */ @@ -177,6 +189,51 @@ void CThingManager::initAllThings() } } +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ + +void CThingManager::matchWheelsAndWeights() +{ + CNpcHazard *hazard1; + CNpcHazard *hazard2; + + hazard1 = (CNpcHazard *) s_thingLists[CThing::TYPE_HAZARD]; + + while( hazard1 ) + { + if ( hazard1->getType() == CNpcHazard::NPC_RISING_WEIGHT_HAZARD ) + { + CNpcRisingWeightHazard *weight = (CNpcRisingWeightHazard *) hazard1; + DVECTOR wheelPos = weight->getWheelPos(); + + hazard2 = (CNpcHazard *) s_thingLists[CThing::TYPE_HAZARD]; + + while( hazard2 ) + { + if ( hazard2->getType() == CNpcHazard::NPC_RISING_WEIGHT_WHEEL_HAZARD ) + { + CNpcRisingWeightWheelHazard *wheel = (CNpcRisingWeightWheelHazard *) hazard2; + + DVECTOR testPos = wheel->getWheelPos(); + + if ( testPos.vx == wheelPos.vx && testPos.vy == wheelPos.vy ) + { + wheel->linkToWeight( weight ); + } + } + + hazard2 = (CNpcHazard *) hazard2->m_nextListThing; + } + } + + hazard1 = (CNpcHazard *) hazard1->m_nextListThing; + } +} + /*---------------------------------------------------------------------- Function: Purpose: diff --git a/source/thing/thing.h b/source/thing/thing.h index 745d5c913..24bc45c57 100644 --- a/source/thing/thing.h +++ b/source/thing/thing.h @@ -62,6 +62,7 @@ public: static CThing* checkCollisionAreaAgainstThings(CRECT *_area,int _type,int _continue); static void initCollision(); + static void matchWheelsAndWeights(); static sBBox &getRenderBBox() {return(m_RenderBBox);} static sBBox &getThinkBBox() {return(m_ThinkBBox);} diff --git a/tools/Data/bin/MkLevel.ini b/tools/Data/bin/MkLevel.ini index ac98d774b..e73367579 100644 --- a/tools/Data/bin/MkLevel.ini +++ b/tools/Data/bin/MkLevel.ini @@ -150,5 +150,5 @@ BouncingBarrel=12 Fireball=13 BouncingRock=12 FlyTrap=15 - - +RisingWeight=16 +RisingWeightWheel=17 \ No newline at end of file diff --git a/tools/MapEdit/Hazard.ini b/tools/MapEdit/Hazard.ini index aaa5cba41..52b7b8129 100644 --- a/tools/MapEdit/Hazard.ini +++ b/tools/MapEdit/Hazard.ini @@ -199,3 +199,23 @@ Collision=0 Health=0 AttackStrength=0 Respawn=2 + +[RisingWeight] +Gfx=..\..\graphics\hazards\1tonweight\1tonweight.gin +Waypoints=3 +Speed=0 +TurnRate=0 +Collision=0 +Health=0 +AttackStrength=0 +Respawn=2 + +[RisingWeightWheel] +Gfx=..\..\graphics\hazards\1tonlever\1tonlever.gin +Waypoints=3 +Speed=0 +TurnRate=0 +Collision=0 +Health=0 +AttackStrength=0 +Respawn=2 diff --git a/users/paul/spongebob project/spongebob project.dsp b/users/paul/spongebob project/spongebob project.dsp index cbe83d4ad..7d619f0bb 100644 --- a/users/paul/spongebob project/spongebob project.dsp +++ b/users/paul/spongebob project/spongebob project.dsp @@ -925,6 +925,22 @@ SOURCE=..\..\..\source\hazard\hrrock.h # End Source File # Begin Source File +SOURCE=..\..\..\source\hazard\hrweight.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\source\hazard\hrweight.h +# End Source File +# Begin Source File + +SOURCE=..\..\..\source\hazard\hrwheel.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\source\hazard\hrwheel.h +# End Source File +# Begin Source File + SOURCE=..\..\..\source\hazard\hsaw.cpp # End Source File # Begin Source File