This commit is contained in:
Charles 2001-04-24 13:24:26 +00:00
parent a39f762eeb
commit 630b615a33
2 changed files with 131 additions and 0 deletions

82
source/hazard/hazard.cpp Normal file
View File

@ -0,0 +1,82 @@
/*=========================================================================
hazard.h
Author: CRB
Created:
Project: Spongebob
Purpose:
Copyright (c) 2001 Climax Development Ltd
===========================================================================*/
#ifndef __HAZARD_HAZARD_H__
#include "hazard\hazard.h"
#endif
#ifndef __GAME_GAME_H__
#include "game\game.h"
#endif
#ifndef __VID_HEADER_
#include "system\vid.h"
#endif
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcHazard::init()
{
CHazardThing::init();
m_actorGfx=CActorPool::GetActor( (FileEquate) ACTORS_CLAM_SBK );
m_spriteBank=0;
m_npcPath.initPath();
Pos.vx = 300;
Pos.vy = 300;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcHazard::shutdown()
{
if (m_spriteBank) m_spriteBank->dump(); delete m_spriteBank;
// remove waypoints
m_npcPath.removeAllWaypoints();
if (m_actorGfx) delete m_actorGfx;
CHazardThing::shutdown();
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcHazard::think(int _frames)
{
CHazardThing::think(_frames);
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcHazard::render()
{
CHazardThing::render();
// Render
DVECTOR renderPos;
DVECTOR offset = CLevel::getCameraPos();
renderPos.vx = Pos.vx - offset.vx;
renderPos.vy = Pos.vy - offset.vy;
if ( renderPos.vx >= 0 && renderPos.vx <= VidGetScrW() )
{
if ( renderPos.vy >= 0 && renderPos.vy <= VidGetScrH() )
{
m_actorGfx->Render(renderPos,0,0,0);
}
}
}

49
source/hazard/hazard.h Normal file
View File

@ -0,0 +1,49 @@
/*=========================================================================
hazard.h
Author: CRB
Created:
Project: Spongebob
Purpose:
Copyright (c) 2001 Climax Development Ltd
===========================================================================*/
#ifndef __HAZARD_HAZARD_H__
#define __HAZARD_HAZARD_H__
#ifndef __THING_THING_H__
#include "thing/thing.h"
#endif
#ifndef __ENEMY_NPCPATH_H__
#include "enemy\npcpath.h"
#endif
#ifndef __GFX_SPRBANK_H__
#include "gfx\sprbank.h"
#endif
#ifndef __ACTOR_HEADER__
#include "gfx\actor.h"
#endif
class CNpcHazard : public CHazardThing
{
public:
void init();
void shutdown();
void think(int _frames);
void render();
protected:
CNpcPath m_npcPath;
CActorGfx *m_actorGfx;
SpriteBank *m_spriteBank;
};
#endif