This commit is contained in:
Charles 2001-06-06 13:27:46 +00:00
parent c3a34bf180
commit 4411c013b1
14 changed files with 209 additions and 32 deletions

View file

@ -35,13 +35,19 @@
#include <ACTOR_IRONDOGFISH_ANIM.h> #include <ACTOR_IRONDOGFISH_ANIM.h>
#endif #endif
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcIronDogfishEnemy::postInit() void CNpcIronDogfishEnemy::postInit()
{ {
m_state = IRON_DOGFISH_THUMP_1; m_state = IRON_DOGFISH_THUMP_1;
m_extendDir = EXTEND_RIGHT; m_extendDir = EXTEND_RIGHT;
m_npcPath.setPathType( CNpcPath::PONG_PATH ); m_npcPath.setPathType( CNpcPath::PONG_PATH );
m_steamTimer = 0;
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool CNpcIronDogfishEnemy::processSensor() bool CNpcIronDogfishEnemy::processSensor()
{ {
/*switch( m_sensorFunc ) /*switch( m_sensorFunc )
@ -67,6 +73,8 @@ bool CNpcIronDogfishEnemy::processSensor()
return( false ); return( false );
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcIronDogfishEnemy::processMovement( int _frames ) void CNpcIronDogfishEnemy::processMovement( int _frames )
{ {
s32 moveX = 0, moveY = 0; s32 moveX = 0, moveY = 0;
@ -95,6 +103,8 @@ void CNpcIronDogfishEnemy::processMovement( int _frames )
} }
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcIronDogfishEnemy::processWalkToUser( int _frames, int speed ) void CNpcIronDogfishEnemy::processWalkToUser( int _frames, int speed )
{ {
s32 minX, maxX; s32 minX, maxX;
@ -149,6 +159,8 @@ void CNpcIronDogfishEnemy::processWalkToUser( int _frames, int speed )
} }
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcIronDogfishEnemy::processStandardIronDogfishAttack( int _frames ) void CNpcIronDogfishEnemy::processStandardIronDogfishAttack( int _frames )
{ {
if ( playerXDist > 0 ) if ( playerXDist > 0 )
@ -256,6 +268,8 @@ void CNpcIronDogfishEnemy::processStandardIronDogfishAttack( int _frames )
} }
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcIronDogfishEnemy::processClose( int _frames ) void CNpcIronDogfishEnemy::processClose( int _frames )
{ {
// swipe at player // swipe at player
@ -275,6 +289,8 @@ void CNpcIronDogfishEnemy::processClose( int _frames )
} }
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcIronDogfishEnemy::processAttackCollision() void CNpcIronDogfishEnemy::processAttackCollision()
{ {
switch( m_animNo ) switch( m_animNo )
@ -294,3 +310,26 @@ void CNpcIronDogfishEnemy::processAttackCollision()
break; break;
} }
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcIronDogfishEnemy::hasBeenSteamed( DVECTOR &steamPos )
{
if ( m_steamTimer <= 0 )
{
hasBeenAttacked();
m_steamTimer = 4 * GameState::getOneSecondInFrames();
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcIronDogfishEnemy::processTimer(int _frames)
{
if ( m_steamTimer > 0 )
{
m_steamTimer -= _frames;
}
CNpcEnemy::processTimer( _frames );
}

View file

@ -19,12 +19,14 @@ class CNpcIronDogfishEnemy : public CNpcEnemy
public: public:
virtual void postInit(); virtual void postInit();
protected: protected:
virtual void processTimer( int _frames );
virtual bool processSensor(); virtual bool processSensor();
virtual void processClose( int _frames ); virtual void processClose( int _frames );
virtual void processMovement( int _frames ); virtual void processMovement( int _frames );
void processStandardIronDogfishAttack( int _frames ); void processStandardIronDogfishAttack( int _frames );
void processWalkToUser( int _frames, int speed ); void processWalkToUser( int _frames, int speed );
virtual void processAttackCollision(); virtual void processAttackCollision();
virtual void hasBeenSteamed( DVECTOR &steamPos );
enum NPC_IRON_DOGFISH_STATE enum NPC_IRON_DOGFISH_STATE
{ {
@ -34,6 +36,8 @@ protected:
IRON_DOGFISH_ROLL, IRON_DOGFISH_ROLL,
IRON_DOGFISH_LASER_EYE_2, IRON_DOGFISH_LASER_EYE_2,
}; };
s32 m_steamTimer;
}; };
#endif #endif

View file

@ -111,6 +111,7 @@ public:
void setPathType( u8 newType ) {m_npcPath.setPathType( newType );} void setPathType( u8 newType ) {m_npcPath.setPathType( newType );}
void setStartPos( s32 xPos, s32 yPos ); void setStartPos( s32 xPos, s32 yPos );
virtual u8 hasBeenAttacked(); virtual u8 hasBeenAttacked();
virtual void hasBeenSteamed( DVECTOR &steamPos ) {hasBeenAttacked();}
virtual u8 canBeCaughtByNet(); virtual u8 canBeCaughtByNet();
void caughtWithNet(); void caughtWithNet();
virtual int getFrameCount(); virtual int getFrameCount();
@ -252,7 +253,7 @@ protected:
virtual void processAttackCollision(); virtual void processAttackCollision();
virtual void processGraphicFlipping(); virtual void processGraphicFlipping();
virtual void processAnimFrames( int _frames ); virtual void processAnimFrames( int _frames );
void processTimer( int _frames ); virtual void processTimer( int _frames );
bool isCollisionWithGround(); bool isCollisionWithGround();
void processGenericGotoTarget( int _frames, s32 xDist, s32 yDist, s32 speed ); void processGenericGotoTarget( int _frames, s32 xDist, s32 yDist, s32 speed );

View file

@ -32,16 +32,22 @@
#endif #endif
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcSkullStomperEnemy::processEnemyCollision( CThing *thisThing ) void CNpcSkullStomperEnemy::processEnemyCollision( CThing *thisThing )
{ {
// do nothing // do nothing
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcSkullStomperEnemy::postInit() void CNpcSkullStomperEnemy::postInit()
{ {
m_extendDir = EXTEND_DOWN; m_extendDir = EXTEND_DOWN;
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool CNpcSkullStomperEnemy::processSensor() bool CNpcSkullStomperEnemy::processSensor()
{ {
switch( m_sensorFunc ) switch( m_sensorFunc )
@ -67,6 +73,8 @@ bool CNpcSkullStomperEnemy::processSensor()
} }
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcSkullStomperEnemy::processClose( int _frames ) void CNpcSkullStomperEnemy::processClose( int _frames )
{ {
s8 groundHeight; s8 groundHeight;
@ -127,4 +135,19 @@ void CNpcSkullStomperEnemy::processClose( int _frames )
} }
} }
} }
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
const CRECT *CNpcSkullStomperEnemy::getThinkBBox()
{
CRECT objThinkBox = getCollisionArea();
sBBox &thinkBBox = CThingManager::getThinkBBox();
objThinkBox.x1 = thinkBBox.XMin;
objThinkBox.x2 = thinkBBox.XMax;
objThinkBox.y1 = thinkBBox.YMin;
objThinkBox.y2 = thinkBBox.YMax;
return &objThinkBox;
}

View file

@ -18,6 +18,7 @@ class CNpcSkullStomperEnemy : public CNpcEnemy
{ {
public: public:
virtual void postInit(); virtual void postInit();
virtual CRECT const *getThinkBBox();
protected: protected:
virtual void processEnemyCollision( CThing *thisThing ); virtual void processEnemyCollision( CThing *thisThing );
virtual bool processSensor(); virtual bool processSensor();

View file

@ -48,9 +48,12 @@ bool hasParent=getFXParentPos(Pos);
/*****************************************************************************/ /*****************************************************************************/
CFXBaseTrail::sList &CFXBaseTrail::moveHead() CFXBaseTrail::sList &CFXBaseTrail::moveHead()
{ {
HeadIdx--; if ( IsVisible )
if (HeadIdx<0) HeadIdx+=LIST_SIZE; {
if (ListCount<LIST_SIZE) ListCount++; HeadIdx--;
if (HeadIdx<0) HeadIdx+=LIST_SIZE;
if (ListCount<LIST_SIZE) ListCount++;
}
return(List[HeadIdx]); return(List[HeadIdx]);
} }

View file

@ -75,7 +75,23 @@ void CNpcSteamSwitchPlatform::processMovement( int _frames )
} }
else else
{ {
trigger->toggleVisible();
m_state = NPC_STEAM_SWITCH_OFF;
m_timer = GameState::getOneSecondInFrames();
}
break;
}
case NPC_STEAM_SWITCH_OFF:
{
if ( m_timer <= 0 )
{
trigger->toggleVisible();
m_state = NPC_STEAM_SWITCH_RETURN; m_state = NPC_STEAM_SWITCH_RETURN;
m_timer = 5 * GameState::getOneSecondInFrames();
} }
break; break;
@ -83,25 +99,28 @@ void CNpcSteamSwitchPlatform::processMovement( int _frames )
case NPC_STEAM_SWITCH_RETURN: case NPC_STEAM_SWITCH_RETURN:
{ {
s32 extension = -m_extension; if ( m_timer <= 0 )
s32 maxMove = m_speed * _frames; {
s32 extension = -m_extension;
s32 maxMove = m_speed * _frames;
if ( extension > maxMove ) if ( extension > maxMove )
{ {
extension = maxMove; extension = maxMove;
} }
else if ( extension < -maxMove ) else if ( extension < -maxMove )
{ {
extension = -maxMove; extension = -maxMove;
} }
if ( extension ) if ( extension )
{ {
m_extension += extension; m_extension += extension;
} }
else else
{ {
m_state = NPC_STEAM_SWITCH_STOP; m_state = NPC_STEAM_SWITCH_STOP;
}
} }
break; break;
@ -115,6 +134,8 @@ void CNpcSteamSwitchPlatform::processMovement( int _frames )
void CNpcSteamSwitchPlatform::setWaypoints( sThingPlatform *ThisPlatform ) void CNpcSteamSwitchPlatform::setWaypoints( sThingPlatform *ThisPlatform )
{ {
ASSERT( ThisPlatform->PointCount == 3 );
int pointNum; int pointNum;
u16 *PntList=(u16*)MakePtr(ThisPlatform,sizeof(sThingPlatform)); u16 *PntList=(u16*)MakePtr(ThisPlatform,sizeof(sThingPlatform));
@ -132,17 +153,29 @@ void CNpcSteamSwitchPlatform::setWaypoints( sThingPlatform *ThisPlatform )
init( startPos ); init( startPos );
if ( ThisPlatform->PointCount > 1 ) newXPos = (u16) *PntList;
{ PntList++;
newXPos = (u16) *PntList; newYPos = (u16) *PntList;
PntList++; PntList++;
newYPos = (u16) *PntList;
PntList++;
m_maxExtension = ( ( newYPos << 4 ) + 16 ) - startPos.vy; m_maxExtension = ( ( newYPos << 4 ) + 16 ) - startPos.vy;
}
else newXPos = (u16) *PntList;
PntList++;
newYPos = (u16) *PntList;
PntList++;
trigger=(CSteamSwitchEmitterTrigger*)CTrigger::Create(CTrigger::TRIGGER_STEAM_SWITCH_EMITTER);
trigger->setPositionAndSize( ( newXPos << 4 ) + 8, ( newYPos << 4 ) + 16 - 50, 100, 100 );
trigger->toggleVisible();
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcSteamSwitchPlatform::processTimer( int _frames )
{
if ( m_timer > 0 )
{ {
m_maxExtension = 100; m_timer -= _frames;
} }
} }

View file

@ -18,6 +18,10 @@
#include "platform\platform.h" #include "platform\platform.h"
#endif #endif
#ifndef __TRIGGERS_TSSWITCH_H__
#include "triggers\tsswitch.h"
#endif
class CNpcSteamSwitchPlatform : public CNpcPlatform class CNpcSteamSwitchPlatform : public CNpcPlatform
{ {
public: public:
@ -25,15 +29,18 @@ public:
virtual void setWaypoints( sThingPlatform *ThisPlatform ); virtual void setWaypoints( sThingPlatform *ThisPlatform );
protected: protected:
virtual void processMovement( int _frames ); virtual void processMovement( int _frames );
virtual void processTimer( int _frames );
enum NPC_STEAM_SWITCH_STATE enum NPC_STEAM_SWITCH_STATE
{ {
NPC_STEAM_SWITCH_STOP = 0, NPC_STEAM_SWITCH_STOP = 0,
NPC_STEAM_SWITCH_DEPRESS = 1, NPC_STEAM_SWITCH_DEPRESS = 1,
NPC_STEAM_SWITCH_OFF,
NPC_STEAM_SWITCH_RETURN, NPC_STEAM_SWITCH_RETURN,
}; };
s32 m_maxExtension; s32 m_maxExtension;
CSteamSwitchEmitterTrigger *trigger;
}; };
#endif #endif

View file

@ -559,6 +559,22 @@ DVECTOR const &CamPos=CLevel::getCameraPos();
thing1=thing1->m_nextCollisionThing; thing1=thing1->m_nextCollisionThing;
} }
// Enemy -> Trigger collision
thing1=s_CollisionLists[CThing::TYPE_TRIGGER];
while(thing1)
{
thing2=s_CollisionLists[CThing::TYPE_ENEMY];
while(thing2)
{
if(thing1->checkCollisionAgainst(thing2, _frames))
{
thing1->collidedWith(thing2);
}
thing2=thing2->m_nextCollisionThing;
}
thing1=thing1->m_nextCollisionThing;
}
// Enemy -> Player projectile collision // Enemy -> Player projectile collision
thing1=s_CollisionLists[CThing::TYPE_PLAYERPROJECTILE]; thing1=s_CollisionLists[CThing::TYPE_PLAYERPROJECTILE];
while(thing1) while(thing1)

View file

@ -83,6 +83,10 @@
#include "triggers\tsemit.h" #include "triggers\tsemit.h"
#endif #endif
#ifndef __TRIGGERS_TSSWITCH_H__
#include "triggers\tsswitch.h"
#endif
#ifndef __GAME_GAME_H__ #ifndef __GAME_GAME_H__
#include "game\game.h" #include "game\game.h"
#endif #endif
@ -183,6 +187,11 @@ CTrigger *trigger;
trigger = (CHazardWalkTrigger*)new("HazardWalkTrigger") CHazardWalkTrigger(); trigger = (CHazardWalkTrigger*)new("HazardWalkTrigger") CHazardWalkTrigger();
break; break;
// Steam switch emitter
case TRIGGER_STEAM_SWITCH_EMITTER:
trigger=(CSteamSwitchEmitterTrigger*)new("SteamSwitchEmitterTrigger") CSteamSwitchEmitterTrigger();
break;
default: default:
trigger=NULL; trigger=NULL;
} }

View file

@ -45,6 +45,7 @@ enum TRIGGER_TYPE
TRIGGER_PLATFORM, TRIGGER_PLATFORM,
TRIGGER_HAZARD, TRIGGER_HAZARD,
TRIGGER_HAZARD_WALK, TRIGGER_HAZARD_WALK,
TRIGGER_STEAM_SWITCH_EMITTER,
TRIGGER_MAX, TRIGGER_MAX,
}; };

View file

@ -19,6 +19,10 @@
#include "game\game.h" #include "game\game.h"
#endif #endif
#ifndef __ENEMY_NPC_H__
#include "enemy\npc.h"
#endif
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -27,6 +31,7 @@ void CSteamSwitchEmitterTrigger::setPositionAndSize(int _x,int _y,int _w,int _h)
CTrigger::setPositionAndSize( _x, _y, _w, _h ); CTrigger::setPositionAndSize( _x, _y, _w, _h );
m_effect = CFX::Create( CFX::FX_TYPE_STEAM, Pos ); m_effect = CFX::Create( CFX::FX_TYPE_STEAM, Pos );
m_active = true;
} }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -34,4 +39,28 @@ void CSteamSwitchEmitterTrigger::setPositionAndSize(int _x,int _y,int _w,int _h)
void CSteamSwitchEmitterTrigger::toggleVisible() void CSteamSwitchEmitterTrigger::toggleVisible()
{ {
m_effect->toggleVisible(); m_effect->toggleVisible();
m_active = !m_active;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CSteamSwitchEmitterTrigger::collidedWith(CThing *_thisThing)
{
if ( m_active )
{
switch(_thisThing->getThingType())
{
case TYPE_ENEMY:
{
CNpcEnemy *enemy = (CNpcEnemy *) _thisThing;
enemy->hasBeenSteamed( Pos );
break;
}
default:
break;
}
}
} }

View file

@ -46,7 +46,10 @@ public:
virtual void setPositionAndSize(int _x,int _y,int _w,int _h); virtual void setPositionAndSize(int _x,int _y,int _w,int _h);
void toggleVisible(); void toggleVisible();
protected: protected:
virtual void collidedWith(CThing *_thisThing);
CFX *m_effect; CFX *m_effect;
u8 m_active;
}; };
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------

View file

@ -2189,6 +2189,14 @@ SOURCE=..\..\..\source\triggers\tsemit.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\..\..\source\triggers\tsswitch.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\source\triggers\tsswitch.h
# End Source File
# Begin Source File
SOURCE=..\..\..\source\triggers\tteleprt.cpp SOURCE=..\..\..\source\triggers\tteleprt.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File