From 0f12ceedddea5bd5fc62591b707903b6aec7e94b Mon Sep 17 00:00:00 2001 From: Charles Date: Thu, 14 Jun 2001 20:05:14 +0000 Subject: [PATCH] --- source/hazard/hsrdfish.cpp | 96 ++++++++++++++++++++++++++++++++++++++ source/hazard/hsrdfish.h | 28 +++++++++++ 2 files changed, 124 insertions(+) create mode 100644 source/hazard/hsrdfish.cpp create mode 100644 source/hazard/hsrdfish.h diff --git a/source/hazard/hsrdfish.cpp b/source/hazard/hsrdfish.cpp new file mode 100644 index 000000000..33c287139 --- /dev/null +++ b/source/hazard/hsrdfish.cpp @@ -0,0 +1,96 @@ +/*========================================================================= + + hsrdfish.cpp + + Author: CRB + Created: + Project: Spongebob + Purpose: + + Copyright (c) 2001 Climax Development Ltd + +===========================================================================*/ + +#ifndef __HAZARD_HSRDFISH_H__ +#include "hazard\hsrdfish.h" +#endif + +#ifndef __UTILS_HEADER__ +#include "utils\utils.h" +#endif + + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CNpcSwordfishHazard::render() +{ + if ( m_isActive ) + { + CHazardThing::render(); + + if (canRender()) + { + DVECTOR &renderPos=getRenderPos(); + + VECTOR flip; + + if ( m_heading ) + { + flip.vx = ONE; + } + else + { + flip.vx = -ONE; + } + + flip.vy = ONE; + flip.vz = ONE; + + m_modelGfx->Render( renderPos, NULL, &flip ); + } + } +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CNpcSwordfishHazard::setWaypoints( sThingHazard *ThisHazard ) +{ + int pointNum; + + u16 *PntList=(u16*)MakePtr(ThisHazard,sizeof(sThingHazard)); + + u16 newXPos, newYPos; + + m_npcPath.setWaypointCount( ThisHazard->PointCount - 1 ); + + newXPos = (u16) *PntList; + setWaypointPtr( PntList ); + PntList++; + newYPos = (u16) *PntList; + PntList++; + + DVECTOR startPos; + startPos.vx = ( newXPos << 4 ) + 8; + startPos.vy = ( newYPos << 4 ) + 16; + + Pos = startPos; + m_base = Pos; + + s32 minX, maxX, minY, maxY; + + m_npcPath.getPathXExtents( &minX, &maxX ); + m_width = maxX - minX; + m_npcPath.getPathYExtents( &minY, &maxY ); + m_height = maxY - minY; + + if ( ThisHazard->PointCount > 1 ) + { + newXPos = (u16) *PntList; + + if ( ( ( newXPos << 4 ) + 8 ) < startPos.vx ) + { + m_width = -m_width; + m_heading = 2048; + } + } +} diff --git a/source/hazard/hsrdfish.h b/source/hazard/hsrdfish.h new file mode 100644 index 000000000..b050ce713 --- /dev/null +++ b/source/hazard/hsrdfish.h @@ -0,0 +1,28 @@ +/*========================================================================= + + hsrdfish.h + + Author: CRB + Created: + Project: Spongebob + Purpose: + + Copyright (c) 2001 Climax Development Ltd + +===========================================================================*/ + +#ifndef __HAZARD_HSRDFISH_H__ +#define __HAZARD_HSRDFISH_H__ + +#ifndef __HAZARD_HFIREBAL_H__ +#include "hazard\hfirebal.h" +#endif + +class CNpcSwordfishHazard : public CNpcFireballHazard +{ +public: + void render(); + virtual void setWaypoints( sThingHazard *ThisHazard ); +}; + +#endif \ No newline at end of file