diff --git a/source/hazard/hazard.cpp b/source/hazard/hazard.cpp index 0ce40eca0..b607031b6 100644 --- a/source/hazard/hazard.cpp +++ b/source/hazard/hazard.cpp @@ -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; diff --git a/source/hazard/hazard.h b/source/hazard/hazard.h index e00f1ef05..1d65f5116 100644 --- a/source/hazard/hazard.h +++ b/source/hazard/hazard.h @@ -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, }; diff --git a/source/hazard/hfirebal.cpp b/source/hazard/hfirebal.cpp index 443289e28..548ac933d 100644 --- a/source/hazard/hfirebal.cpp +++ b/source/hazard/hfirebal.cpp @@ -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 ) diff --git a/source/hazard/hfirebal.h b/source/hazard/hfirebal.h index 0747fe227..6537674a8 100644 --- a/source/hazard/hfirebal.h +++ b/source/hazard/hfirebal.h @@ -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 ); diff --git a/tools/Data/bin/MkLevel.ini b/tools/Data/bin/MkLevel.ini index 2ed992f95..f4e1da2c6 100644 --- a/tools/Data/bin/MkLevel.ini +++ b/tools/Data/bin/MkLevel.ini @@ -145,5 +145,6 @@ Wheel=10 BarrelHazard=3 DualPlatformBarrelHazard=11 BouncingBarrel=12 +Fireball=13 diff --git a/tools/MapEdit/Hazard.ini b/tools/MapEdit/Hazard.ini index 2c94cebf9..5201da4c1 100644 --- a/tools/MapEdit/Hazard.ini +++ b/tools/MapEdit/Hazard.ini @@ -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