diff --git a/Graphics/levels/Chapter02/Level04/Level04.MEX b/Graphics/levels/Chapter02/Level04/Level04.MEX index da6f4fccc..05d6a9120 100644 Binary files a/Graphics/levels/Chapter02/Level04/Level04.MEX and b/Graphics/levels/Chapter02/Level04/Level04.MEX differ diff --git a/Graphics/levels/Chapter02/Level04/level04.Mep b/Graphics/levels/Chapter02/Level04/level04.Mep index d2813aec6..50549c115 100644 Binary files a/Graphics/levels/Chapter02/Level04/level04.Mep and b/Graphics/levels/Chapter02/Level04/level04.Mep differ diff --git a/makefile.gaz b/makefile.gaz index a4d595341..8534a54c9 100644 --- a/makefile.gaz +++ b/makefile.gaz @@ -157,7 +157,6 @@ hazard_src := hazard \ hrrock \ hflytrap \ hrweight \ - hrwheel \ hpswitch \ hrckshrd \ hinert \ diff --git a/source/hazard/hazard.cpp b/source/hazard/hazard.cpp index d6a8bb2d2..2c902c374 100644 --- a/source/hazard/hazard.cpp +++ b/source/hazard/hazard.cpp @@ -99,10 +99,6 @@ #include "hazard\hrweight.h" #endif -#ifndef __HAZARD_HRWHEEL_H__ -#include "hazard\hrwheel.h" -#endif - #ifndef __HAZARD_HPSWITCH_H__ #include "hazard\hpswitch.h" #endif diff --git a/source/hazard/hrweight.cpp b/source/hazard/hrweight.cpp index 37276ed15..4fe086a71 100644 --- a/source/hazard/hrweight.cpp +++ b/source/hazard/hrweight.cpp @@ -121,7 +121,7 @@ void CNpcRisingWeightHazard::processMovement( int _frames ) if ( m_triggered ) { m_triggered = false; - m_extension += ( 3 * _frames ) << 8; + m_extension += ( 16 * _frames ) << 8; if ( m_extension > m_maxExtension ) { m_extension = m_maxExtension; @@ -148,6 +148,8 @@ void CNpcRisingWeightHazard::processMovement( int _frames ) { m_soundId = (int) CSoundMediator::playSfx( CSoundMediator::SFX_PULLEY, true, true ); } + + m_wheel->weightDrop(); } } @@ -272,3 +274,121 @@ void CNpcRisingWeightHazard::collidedWith( CThing *_thisThing ) } } } + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CNpcRisingWeightWheelHazard::init() +{ + CNpcHazard::init(); + + m_rotation = 0; +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CNpcRisingWeightWheelHazard::setWaypoints( sThingHazard *ThisHazard ) +{ + u16 *PntList=(u16*)MakePtr(ThisHazard,sizeof(sThingHazard)); + + u16 newXPos, newYPos; + + // get init pos + + newXPos = (u16) *PntList; + PntList++; + newYPos = (u16) *PntList; + PntList++; + + DVECTOR startPos; + startPos.vx = ( newXPos << 4 ) + 8; + startPos.vy = ( newYPos << 4 ) + 16; + + Pos = startPos; + m_base = Pos; + + m_wheelPos.vx = newXPos; + m_wheelPos.vy = newYPos; + + s32 minX, maxX, minY, maxY; + + m_npcPath.getPathXExtents( &minX, &maxX ); + m_npcPath.getPathYExtents( &minY, &maxY ); + + m_thinkArea.x1 = minX; + m_thinkArea.x2 = maxX; + m_thinkArea.y1 = minY; + m_thinkArea.y2 = maxY; +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CNpcRisingWeightWheelHazard::collidedWith( CThing *_thisThing ) +{ + if ( m_isActive ) + { + switch(_thisThing->getThingType()) + { + case TYPE_PLAYER: + { + CPlayer *player = (CPlayer *) _thisThing; + + ATTACK_STATE playerState = player->getAttackState(); + + if ( playerState == ATTACK_STATE__BUTT_BOUNCE ) + { + m_weight->setTriggered(); + + m_rotation += 256; + m_rotation &= 4095; + } + + break; + } + + case TYPE_PLAYERPROJECTILE: + { + m_weight->setTriggered(); + + m_rotation += 256; + m_rotation &= 4095; + + _thisThing->setToShutdown(); + } + + default: + break; + } + } +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CNpcRisingWeightWheelHazard::weightDrop() +{ + m_rotation -= 128; + m_rotation &= 4095; +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CNpcRisingWeightWheelHazard::render() +{ + CHazardThing::render(); + + if (canRender()) + { + DVECTOR &renderPos=getRenderPos(); + + SVECTOR rotation; + rotation.vx = 0; + rotation.vy = 0; + rotation.vz = m_rotation; + + VECTOR scale; + scale.vx = ONE; + scale.vy = ONE; + scale.vz = ONE; + + m_modelGfx->Render(renderPos,&rotation,&scale); + } +} diff --git a/source/hazard/hrweight.h b/source/hazard/hrweight.h index 944d29457..380a6707f 100644 --- a/source/hazard/hrweight.h +++ b/source/hazard/hrweight.h @@ -18,6 +18,8 @@ #include "hazard\hazard.h" #endif +class CNpcRisingWeightWheelHazard; + class CNpcRisingWeightHazard : public CNpcHazard { public: @@ -26,15 +28,35 @@ public: DVECTOR const &getWheelPos() {return( m_wheelPos );} void setTriggered() {m_triggered = true;} bool alwaysThink() {return(true);} + void linkToWheel( CNpcRisingWeightWheelHazard *wheel ) {m_wheel = wheel;} protected: virtual void collidedWith(CThing *_thisThing); void setWaypoints( sThingHazard *ThisHazard ); void processMovement( int _frames ); + CNpcRisingWeightWheelHazard *m_wheel; s32 m_maxExtension; DVECTOR m_wheelPos; DVECTOR m_pulleyPos; u8 m_triggered; }; +class CNpcRisingWeightWheelHazard : public CNpcHazard +{ +public: + void init(); + DVECTOR const &getWheelPos() {return( m_wheelPos );} + void linkToWeight( CNpcRisingWeightHazard *weight ) {m_weight = weight;} + void render(); + bool alwaysThink() {return(true);} + void weightDrop(); +protected: + void setWaypoints( sThingHazard *ThisHazard ); + void collidedWith(CThing *_thisThing); + + DVECTOR m_wheelPos; + CNpcRisingWeightHazard *m_weight; + s16 m_rotation; +}; + #endif \ No newline at end of file diff --git a/source/hazard/hrwheel.cpp b/source/hazard/hrwheel.cpp index d1625218d..ae9903b2a 100644 --- a/source/hazard/hrwheel.cpp +++ b/source/hazard/hrwheel.cpp @@ -112,6 +112,14 @@ void CNpcRisingWeightWheelHazard::collidedWith( CThing *_thisThing ) //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +void CNpcRisingWeightWheelHazard::weightDrop() +{ + m_rotation -= 128; + m_rotation &= 4095; +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + void CNpcRisingWeightWheelHazard::render() { CHazardThing::render(); diff --git a/source/hazard/hrwheel.h b/source/hazard/hrwheel.h index 173bb3eca..58023a4db 100644 --- a/source/hazard/hrwheel.h +++ b/source/hazard/hrwheel.h @@ -30,6 +30,7 @@ public: void linkToWeight( CNpcRisingWeightHazard *weight ) {m_weight = weight;} void render(); bool alwaysThink() {return(true);} + void weightDrop(); protected: void setWaypoints( sThingHazard *ThisHazard ); void collidedWith(CThing *_thisThing); diff --git a/source/thing/thing.cpp b/source/thing/thing.cpp index eafa0f9cc..e3e45774d 100644 --- a/source/thing/thing.cpp +++ b/source/thing/thing.cpp @@ -54,10 +54,6 @@ #include "hazard\hrweight.h" #endif -#ifndef __HAZARD_HRWHEEL_H__ -#include "hazard\hrwheel.h" -#endif - #ifndef __HAZARD_HPSWITCH_H__ #include "hazard\hpswitch.h" #endif @@ -321,6 +317,7 @@ void CThingManager::matchWheelsAndWeights() if ( testPos.vx == wheelPos.vx && testPos.vy == wheelPos.vy ) { wheel->linkToWeight( weight ); + weight->linkToWheel( wheel ); } } diff --git a/users/paul/spongebob project/spongebob project.dsp b/users/paul/spongebob project/spongebob project.dsp index 6075dbab3..eaa08afb7 100644 --- a/users/paul/spongebob project/spongebob project.dsp +++ b/users/paul/spongebob project/spongebob project.dsp @@ -1137,14 +1137,6 @@ 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