This commit is contained in:
Charles 2001-05-18 12:55:34 +00:00
parent 2c6919e7b2
commit aab3c0ec22
6 changed files with 68 additions and 15 deletions

View File

@ -83,6 +83,10 @@
#include "hazard\hbbarrel.h"
#endif
#ifndef __HAZARD_HFIREBAL_H__
#include "hazard\hfirebal.h"
#endif
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -101,6 +105,7 @@ CNpcHazard::NPC_HAZARD_UNIT_TYPE CNpcHazard::mapEditConvertTable[NPC_HAZARD_TYPE
NPC_BIG_WHEEL_HAZARD,
NPC_DUAL_PLATFORM_BARREL_HAZARD,
NPC_BOUNCING_BARREL_HAZARD,
NPC_FIREBALL_HAZARD,
};
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -191,6 +196,12 @@ CNpcHazard *CNpcHazard::Create(sThingHazard *ThisHazard)
break;
}
case NPC_FIREBALL_HAZARD:
{
hazard = new ("fireball hazard") CNpcFireballHazard;
break;
}
default:
{
hazard = NULL;

View File

@ -49,6 +49,7 @@ public:
NPC_BIG_WHEEL_HAZARD,
NPC_DUAL_PLATFORM_BARREL_HAZARD,
NPC_BOUNCING_BARREL_HAZARD,
NPC_FIREBALL_HAZARD,
NPC_HAZARD_TYPE_MAX,
};

View File

@ -19,6 +19,10 @@
#include "game\game.h"
#endif
#ifndef __UTILS_HEADER__
#include "utils\utils.h"
#endif
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -26,18 +30,6 @@ void CNpcFireballHazard::init()
{
CNpcHazard::init();
DVECTOR newPos;
Pos.vx = 100;
Pos.vy = 100;
m_base = Pos;
newPos.vx = 300;
newPos.vy = 100;
m_npcPath.addWaypoint( newPos );
m_npcPath.setPathType( CNpcPath::SINGLE_USE_PATH );
m_extension = 0;
m_velocity = 40;
@ -46,15 +38,52 @@ void CNpcFireballHazard::init()
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcFireballHazard::setWaypoints( sThingHazard *ThisHazard )
{
int pointNum;
u16 *PntList=(u16*)MakePtr(ThisHazard,sizeof(sThingHazard));
u16 newXPos, newYPos;
newXPos = (u16) *PntList;
PntList++;
newYPos = (u16) *PntList;
PntList++;
DVECTOR startPos;
startPos.vx = newXPos << 4;
startPos.vy = newYPos << 4;
Pos = startPos;
m_base = Pos;
if ( ThisHazard->PointCount > 1 )
{
for ( pointNum = 1 ; pointNum < ThisHazard->PointCount ; pointNum++ )
{
newXPos = (u16) *PntList;
PntList++;
newYPos = (u16) *PntList;
PntList++;
addWaypoint( newXPos, newYPos );
}
}
else
{
addWaypoint( newXPos, newYPos );
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcFireballHazard::processMovement( int _frames )
{
s32 distX;
s32 distY;
s32 velocity;
s32 distSourceX;
s32 distSourceY;
m_npcPath.getDistToNextWaypoint( Pos, &distX, &distY );
m_npcPath.getDistToNextWaypoint( m_base, &distSourceX, &distSourceY );
if ( m_extension < 4096 )

View File

@ -22,6 +22,7 @@ class CNpcFireballHazard : public CNpcHazard
{
public:
void init();
virtual void setWaypoints( sThingHazard *ThisHazard );
protected:
void processMovement( int _frames );
void processTimer( int _frames );

View File

@ -145,5 +145,6 @@ Wheel=10
BarrelHazard=3
DualPlatformBarrelHazard=11
BouncingBarrel=12
Fireball=13

View File

@ -169,3 +169,13 @@ Collision=0
Health=0
AttackStrength=0
Respawn=2
[Fireball]
Gfx=..\..\graphics\hazards\fireball\fireball.gin
WayPoints=32
Speed=0
TurnRate=0
Collision=0
Health=0
AttackStrength=0
Respawn=2