This commit is contained in:
parent
4caddd162d
commit
45435136f8
10 changed files with 153 additions and 18 deletions
Binary file not shown.
Binary file not shown.
|
@ -157,7 +157,6 @@ hazard_src := hazard \
|
|||
hrrock \
|
||||
hflytrap \
|
||||
hrweight \
|
||||
hrwheel \
|
||||
hpswitch \
|
||||
hrckshrd \
|
||||
hinert \
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
|
@ -112,6 +112,14 @@ void CNpcRisingWeightWheelHazard::collidedWith( CThing *_thisThing )
|
|||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void CNpcRisingWeightWheelHazard::weightDrop()
|
||||
{
|
||||
m_rotation -= 128;
|
||||
m_rotation &= 4095;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void CNpcRisingWeightWheelHazard::render()
|
||||
{
|
||||
CHazardThing::render();
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue