This commit is contained in:
parent
097c54d7cc
commit
dfd36d956e
@ -45,6 +45,7 @@ void CNpcGaryFriend::postInit()
|
|||||||
m_started = false;
|
m_started = false;
|
||||||
m_fallDeath = false;
|
m_fallDeath = false;
|
||||||
m_drawRotation = 0;
|
m_drawRotation = 0;
|
||||||
|
m_obstructed = false;
|
||||||
|
|
||||||
m_soundId = (int) NOT_PLAYING;
|
m_soundId = (int) NOT_PLAYING;
|
||||||
}
|
}
|
||||||
@ -216,7 +217,7 @@ void CNpcGaryFriend::think( int _frames )
|
|||||||
m_soundId = (int) CSoundMediator::playSfx( CSoundMediator::SFX_GARY_DE_SNAIL, true );
|
m_soundId = (int) CSoundMediator::playSfx( CSoundMediator::SFX_GARY_DE_SNAIL, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !conveyorOverride )
|
if ( !conveyorOverride && !m_obstructed )
|
||||||
{
|
{
|
||||||
Pos.vx += multiplier * 2 * _frames;
|
Pos.vx += multiplier * 2 * _frames;
|
||||||
}
|
}
|
||||||
@ -248,7 +249,7 @@ void CNpcGaryFriend::think( int _frames )
|
|||||||
m_soundId = (int) CSoundMediator::playSfx( CSoundMediator::SFX_GARY_DE_SNAIL, true );
|
m_soundId = (int) CSoundMediator::playSfx( CSoundMediator::SFX_GARY_DE_SNAIL, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !conveyorOverride )
|
if ( !conveyorOverride && !m_obstructed )
|
||||||
{
|
{
|
||||||
Pos.vx += multiplier * 2 * _frames;
|
Pos.vx += multiplier * 2 * _frames;
|
||||||
}
|
}
|
||||||
@ -261,6 +262,8 @@ void CNpcGaryFriend::think( int _frames )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_obstructed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -32,6 +32,7 @@ public:
|
|||||||
void startLeft();
|
void startLeft();
|
||||||
void startRight();
|
void startRight();
|
||||||
void render();
|
void render();
|
||||||
|
void setObstructed() {m_obstructed = true;}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
DVECTOR m_triggerPos;
|
DVECTOR m_triggerPos;
|
||||||
@ -40,6 +41,7 @@ protected:
|
|||||||
s16 m_speed;
|
s16 m_speed;
|
||||||
s16 m_drawRotation;
|
s16 m_drawRotation;
|
||||||
int m_soundId;
|
int m_soundId;
|
||||||
|
u8 m_obstructed;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -58,6 +58,7 @@ public:
|
|||||||
void setPlatform( CNpcPlatform *platform ) {m_platform = platform;}
|
void setPlatform( CNpcPlatform *platform ) {m_platform = platform;}
|
||||||
void clearPlatform() {m_platform = NULL;}
|
void clearPlatform() {m_platform = NULL;}
|
||||||
virtual void setupWaypoints( sThingActor *ThisActor );
|
virtual void setupWaypoints( sThingActor *ThisActor );
|
||||||
|
virtual void setObstructed() {}
|
||||||
|
|
||||||
static CNpcFriend *Create(sThingActor *ThisActor);
|
static CNpcFriend *Create(sThingActor *ThisActor);
|
||||||
static NPC_FRIEND_UNIT_TYPE getTypeFromMapEdit( u16 newType );
|
static NPC_FRIEND_UNIT_TYPE getTypeFromMapEdit( u16 newType );
|
||||||
|
@ -542,6 +542,9 @@ void CNpcHazard::collidedWith( CThing *_thisThing )
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case TYPE_NPC:
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ASSERT(0);
|
ASSERT(0);
|
||||||
break;
|
break;
|
||||||
|
@ -27,6 +27,10 @@
|
|||||||
#include "game\game.h"
|
#include "game\game.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __FRIEND_FRIEND_H__
|
||||||
|
#include "friend\friend.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@ -216,3 +220,39 @@ void CNpcRisingWeightHazard::render()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CNpcRisingWeightHazard::collidedWith( CThing *_thisThing )
|
||||||
|
{
|
||||||
|
if ( m_isActive )
|
||||||
|
{
|
||||||
|
switch(_thisThing->getThingType())
|
||||||
|
{
|
||||||
|
case TYPE_PLAYER:
|
||||||
|
{
|
||||||
|
CPlayer *player = (CPlayer *) _thisThing;
|
||||||
|
|
||||||
|
if ( !player->isRecoveringFromHit() )
|
||||||
|
{
|
||||||
|
player->takeDamage( DAMAGE__HIT_ENEMY );
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case TYPE_NPC:
|
||||||
|
{
|
||||||
|
CNpcFriend *npcFriend = (CNpcFriend *) _thisThing;
|
||||||
|
|
||||||
|
npcFriend->setObstructed();
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
ASSERT(0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -27,6 +27,7 @@ public:
|
|||||||
void setTriggered() {m_triggered = true;}
|
void setTriggered() {m_triggered = true;}
|
||||||
CRECT const *getThinkBBox() {return( CThing::getThinkBBox() );}
|
CRECT const *getThinkBBox() {return( CThing::getThinkBBox() );}
|
||||||
protected:
|
protected:
|
||||||
|
virtual void collidedWith(CThing *_thisThing);
|
||||||
void setWaypoints( sThingHazard *ThisHazard );
|
void setWaypoints( sThingHazard *ThisHazard );
|
||||||
void processMovement( int _frames );
|
void processMovement( int _frames );
|
||||||
|
|
||||||
|
@ -750,6 +750,26 @@ DVECTOR const &CamPos=CLevel::getCameraPos();
|
|||||||
thing1=thing1->m_nextCollisionThing;
|
thing1=thing1->m_nextCollisionThing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// gary collision with hazards
|
||||||
|
|
||||||
|
thing2=s_CollisionLists[CThing::TYPE_NPC];
|
||||||
|
while(thing2)
|
||||||
|
{
|
||||||
|
if ( thing2->getThingSubType() == CNpcFriend::NPC_FRIEND_GARY )
|
||||||
|
{
|
||||||
|
thing1=s_CollisionLists[CThing::TYPE_HAZARD];
|
||||||
|
while(thing1)
|
||||||
|
{
|
||||||
|
if(thing1->checkCollisionAgainst(thing2, _frames))
|
||||||
|
{
|
||||||
|
thing1->collidedWith(thing2);
|
||||||
|
}
|
||||||
|
thing1=thing1->m_nextCollisionThing;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
thing2=thing2->m_nextCollisionThing;
|
||||||
|
}
|
||||||
|
|
||||||
player->detectHazardousSurface();
|
player->detectHazardousSurface();
|
||||||
}
|
}
|
||||||
// Shut emm down, sh sh shut em down, we shutem down
|
// Shut emm down, sh sh shut em down, we shutem down
|
||||||
|
Loading…
Reference in New Issue
Block a user