This commit is contained in:
Charles 2001-06-01 22:03:24 +00:00
parent 6f467a179e
commit 6deb46042f
13 changed files with 309 additions and 36 deletions

View file

@ -0,0 +1,53 @@
/*=========================================================================
tfemit.h
Author: PKG
Created:
Project: Spongebob
Purpose:
Copyright (c) 2001 Climax Development Ltd
===========================================================================*/
#ifndef __TRIGGERS_TFEMIT_H__
#include "triggers\tfemit.h"
#endif
#ifndef __PLAYER_PLAYER_H__
#include "player\player.h"
#endif
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CFlameEmitterTrigger::setPositionAndSize(int _x,int _y,int _w,int _h)
{
CTrigger::setPositionAndSize( _x, _y, _w, _h );
m_effect = CFX::Create( CFX::FX_TYPE_FLAMES, Pos );
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CFlameEmitterTrigger::collidedWith(CThing *_thisThing)
{
switch(_thisThing->getThingType())
{
case TYPE_PLAYER:
{
CPlayer *player = (CPlayer *) _thisThing;
if ( !player->isRecoveringFromHit() )
{
player->takeDamage( DAMAGE__BURN_ENEMY );
}
break;
}
default:
break;
}
}

64
source/triggers/tfemit.h Normal file
View file

@ -0,0 +1,64 @@
/*=========================================================================
tfemit.h
Author: PKG
Created:
Project: Spongebob
Purpose:
Copyright (c) 2001 Climax Development Ltd
===========================================================================*/
#ifndef __TRIGGERS_TFEMIT_H__
#define __TRIGGERS_TFEMIT_H__
/*----------------------------------------------------------------------
Includes
-------- */
#ifndef __THING_THING_H__
#include "thing/thing.h"
#endif
#ifndef __TRIGGER_TRIGGER_HEADER__
#include "triggers\trigger.h"
#endif
#include "fx\fx.h"
/* Std Lib
------- */
/*----------------------------------------------------------------------
Tyepdefs && Defines
------------------- */
/*----------------------------------------------------------------------
Structure defintions
-------------------- */
class CFlameEmitterTrigger : public CTrigger
{
public:
virtual void setPositionAndSize(int _x,int _y,int _w,int _h);
protected:
virtual void collidedWith(CThing *_thisThing);
CFX *m_effect;
};
/*----------------------------------------------------------------------
Globals
------- */
/*----------------------------------------------------------------------
Functions
--------- */
/*---------------------------------------------------------------------- */
#endif /* __TRIGGERS_TLEVEXIT_H__ */
/*===========================================================================
end */

View file

@ -0,0 +1,79 @@
/*=========================================================================
tifemit.h
Author: PKG
Created:
Project: Spongebob
Purpose:
Copyright (c) 2001 Climax Development Ltd
===========================================================================*/
#ifndef __TRIGGERS_TIFEMIT_H__
#include "triggers\tifemit.h"
#endif
#ifndef __PLAYER_PLAYER_H__
#include "player\player.h"
#endif
#ifndef __GAME_GAME_H__
#include "game\game.h"
#endif
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CIntermittentFlameEmitterTrigger::init()
{
CFlameEmitterTrigger::init();
m_timer = 0;
m_isActive = true;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CIntermittentFlameEmitterTrigger::think(int _frames)
{
CTrigger::think(_frames);
if ( m_timer <= 0 )
{
m_timer = GameState::getOneSecondInFrames() * 2;
m_effect->toggleVisible();
m_isActive = !m_isActive;
}
else
{
m_timer -= _frames;
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CIntermittentFlameEmitterTrigger::collidedWith(CThing *_thisThing)
{
if ( m_isActive )
{
switch(_thisThing->getThingType())
{
case TYPE_PLAYER:
{
CPlayer *player = (CPlayer *) _thisThing;
if ( !player->isRecoveringFromHit() )
{
player->takeDamage( DAMAGE__BURN_ENEMY );
}
break;
}
default:
break;
}
}
}

66
source/triggers/tifemit.h Normal file
View file

@ -0,0 +1,66 @@
/*=========================================================================
tfemit.h
Author: PKG
Created:
Project: Spongebob
Purpose:
Copyright (c) 2001 Climax Development Ltd
===========================================================================*/
#ifndef __TRIGGERS_TIFEMIT_H__
#define __TRIGGERS_TIFEMIT_H__
/*----------------------------------------------------------------------
Includes
-------- */
#ifndef __THING_THING_H__
#include "thing/thing.h"
#endif
#ifndef __TRIGGER_TFEMIT__
#include "triggers\tfemit.h"
#endif
#include "fx\fx.h"
/* Std Lib
------- */
/*----------------------------------------------------------------------
Tyepdefs && Defines
------------------- */
/*----------------------------------------------------------------------
Structure defintions
-------------------- */
class CIntermittentFlameEmitterTrigger : public CFlameEmitterTrigger
{
public:
virtual void init();
virtual void think(int _frames);
protected:
virtual void collidedWith(CThing *_thisThing);
s32 m_timer;
u8 m_isActive;
};
/*----------------------------------------------------------------------
Globals
------- */
/*----------------------------------------------------------------------
Functions
--------- */
/*---------------------------------------------------------------------- */
#endif /* __TRIGGERS_TLEVEXIT_H__ */
/*===========================================================================
end */

View file

@ -43,6 +43,14 @@
#include "triggers\tgarygo.h"
#endif
#ifndef __TRIGGERS_TFEMIT_H__
#include "triggers\tfemit.h"
#endif
#ifndef __TRIGGERS_TIFEMIT_H__
#include "triggers\tifemit.h"
#endif
#ifndef __GAME_GAME_H__
#include "game\game.h"
#endif
@ -90,6 +98,15 @@ CTrigger *trigger;
trigger=(CGaryStartTrigger*)new( "GaryStartTrigger") CGaryStartTrigger();
break;
// Flame emitter
case TRIGGER_FLAMEEMITTER:
trigger=(CFlameEmitterTrigger*)new( "FlameEmitterTrigger") CFlameEmitterTrigger();
break;
case TRIGGER_INTERMITTENTFLAMEEMITTER:
trigger=(CIntermittentFlameEmitterTrigger*)new( "IntermittentFlameEmitterTrigger") CIntermittentFlameEmitterTrigger();
break;
case TRIGGER_PLATFORM:
trigger = (CPlatformTrigger*)new ("PlatformTrigger") CPlatformTrigger();
break;

View file

@ -30,6 +30,8 @@ enum TRIGGER_TYPE
TRIGGER_INWATER,
TRIGGER_OUTWATER,
TRIGGER_GARYSTART,
TRIGGER_FLAMEEMITTER,
TRIGGER_INTERMITTENTFLAMEEMITTER,
// Code based triggers
TRIGGER_PLATFORM,