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>
#endif
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcIronDogfishEnemy::postInit()
{
m_state = IRON_DOGFISH_THUMP_1;
m_extendDir = EXTEND_RIGHT;
m_npcPath.setPathType( CNpcPath::PONG_PATH );
m_steamTimer = 0;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool CNpcIronDogfishEnemy::processSensor()
{
/*switch( m_sensorFunc )
@ -67,6 +73,8 @@ bool CNpcIronDogfishEnemy::processSensor()
return( false );
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcIronDogfishEnemy::processMovement( int _frames )
{
s32 moveX = 0, moveY = 0;
@ -95,6 +103,8 @@ void CNpcIronDogfishEnemy::processMovement( int _frames )
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcIronDogfishEnemy::processWalkToUser( int _frames, int speed )
{
s32 minX, maxX;
@ -149,6 +159,8 @@ void CNpcIronDogfishEnemy::processWalkToUser( int _frames, int speed )
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcIronDogfishEnemy::processStandardIronDogfishAttack( int _frames )
{
if ( playerXDist > 0 )
@ -256,6 +268,8 @@ void CNpcIronDogfishEnemy::processStandardIronDogfishAttack( int _frames )
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcIronDogfishEnemy::processClose( int _frames )
{
// swipe at player
@ -275,6 +289,8 @@ void CNpcIronDogfishEnemy::processClose( int _frames )
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcIronDogfishEnemy::processAttackCollision()
{
switch( m_animNo )
@ -294,3 +310,26 @@ void CNpcIronDogfishEnemy::processAttackCollision()
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:
virtual void postInit();
protected:
virtual void processTimer( int _frames );
virtual bool processSensor();
virtual void processClose( int _frames );
virtual void processMovement( int _frames );
void processStandardIronDogfishAttack( int _frames );
void processWalkToUser( int _frames, int speed );
virtual void processAttackCollision();
virtual void hasBeenSteamed( DVECTOR &steamPos );
enum NPC_IRON_DOGFISH_STATE
{
@ -34,6 +36,8 @@ protected:
IRON_DOGFISH_ROLL,
IRON_DOGFISH_LASER_EYE_2,
};
s32 m_steamTimer;
};
#endif

View File

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

View File

@ -32,16 +32,22 @@
#endif
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcSkullStomperEnemy::processEnemyCollision( CThing *thisThing )
{
// do nothing
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcSkullStomperEnemy::postInit()
{
m_extendDir = EXTEND_DOWN;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool CNpcSkullStomperEnemy::processSensor()
{
switch( m_sensorFunc )
@ -67,6 +73,8 @@ bool CNpcSkullStomperEnemy::processSensor()
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcSkullStomperEnemy::processClose( int _frames )
{
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:
virtual void postInit();
virtual CRECT const *getThinkBBox();
protected:
virtual void processEnemyCollision( CThing *thisThing );
virtual bool processSensor();

View File

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

View File

@ -75,7 +75,23 @@ void CNpcSteamSwitchPlatform::processMovement( int _frames )
}
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_timer = 5 * GameState::getOneSecondInFrames();
}
break;
@ -83,25 +99,28 @@ void CNpcSteamSwitchPlatform::processMovement( int _frames )
case NPC_STEAM_SWITCH_RETURN:
{
s32 extension = -m_extension;
s32 maxMove = m_speed * _frames;
if ( m_timer <= 0 )
{
s32 extension = -m_extension;
s32 maxMove = m_speed * _frames;
if ( extension > maxMove )
{
extension = maxMove;
}
else if ( extension < -maxMove )
{
extension = -maxMove;
}
if ( extension > maxMove )
{
extension = maxMove;
}
else if ( extension < -maxMove )
{
extension = -maxMove;
}
if ( extension )
{
m_extension += extension;
}
else
{
m_state = NPC_STEAM_SWITCH_STOP;
if ( extension )
{
m_extension += extension;
}
else
{
m_state = NPC_STEAM_SWITCH_STOP;
}
}
break;
@ -115,6 +134,8 @@ void CNpcSteamSwitchPlatform::processMovement( int _frames )
void CNpcSteamSwitchPlatform::setWaypoints( sThingPlatform *ThisPlatform )
{
ASSERT( ThisPlatform->PointCount == 3 );
int pointNum;
u16 *PntList=(u16*)MakePtr(ThisPlatform,sizeof(sThingPlatform));
@ -132,17 +153,29 @@ void CNpcSteamSwitchPlatform::setWaypoints( sThingPlatform *ThisPlatform )
init( startPos );
if ( ThisPlatform->PointCount > 1 )
{
newXPos = (u16) *PntList;
PntList++;
newYPos = (u16) *PntList;
PntList++;
newXPos = (u16) *PntList;
PntList++;
newYPos = (u16) *PntList;
PntList++;
m_maxExtension = ( ( newYPos << 4 ) + 16 ) - startPos.vy;
}
else
m_maxExtension = ( ( newYPos << 4 ) + 16 ) - startPos.vy;
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"
#endif
#ifndef __TRIGGERS_TSSWITCH_H__
#include "triggers\tsswitch.h"
#endif
class CNpcSteamSwitchPlatform : public CNpcPlatform
{
public:
@ -25,15 +29,18 @@ public:
virtual void setWaypoints( sThingPlatform *ThisPlatform );
protected:
virtual void processMovement( int _frames );
virtual void processTimer( int _frames );
enum NPC_STEAM_SWITCH_STATE
{
NPC_STEAM_SWITCH_STOP = 0,
NPC_STEAM_SWITCH_DEPRESS = 1,
NPC_STEAM_SWITCH_OFF,
NPC_STEAM_SWITCH_RETURN,
};
s32 m_maxExtension;
CSteamSwitchEmitterTrigger *trigger;
};
#endif

View File

@ -559,6 +559,22 @@ DVECTOR const &CamPos=CLevel::getCameraPos();
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
thing1=s_CollisionLists[CThing::TYPE_PLAYERPROJECTILE];
while(thing1)

View File

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

View File

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

View File

@ -19,6 +19,10 @@
#include "game\game.h"
#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 );
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()
{
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);
void toggleVisible();
protected:
virtual void collidedWith(CThing *_thisThing);
CFX *m_effect;
u8 m_active;
};
/*----------------------------------------------------------------------

View File

@ -2189,6 +2189,14 @@ SOURCE=..\..\..\source\triggers\tsemit.h
# End 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
# End Source File
# Begin Source File