This commit is contained in:
parent
c2e12f8c57
commit
1d72f15761
3 changed files with 195 additions and 0 deletions
46
source/enemy/nanemone.cpp
Normal file
46
source/enemy/nanemone.cpp
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
/*=========================================================================
|
||||||
|
|
||||||
|
nanemone.cpp
|
||||||
|
|
||||||
|
Author: CRB
|
||||||
|
Created:
|
||||||
|
Project: Spongebob
|
||||||
|
Purpose:
|
||||||
|
|
||||||
|
Copyright (c) 2000 Climax Development Ltd
|
||||||
|
|
||||||
|
===========================================================================*/
|
||||||
|
|
||||||
|
#ifndef __ENEMY_NPC_H__
|
||||||
|
#include "enemy\npc.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __PROJECTL_PROJECTL_H__
|
||||||
|
#include "projectl\projectl.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __GAME_GAME_H__
|
||||||
|
#include "game\game.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
void CNpc::processCloseAnemone2Attack( int _frames )
|
||||||
|
{
|
||||||
|
int fireLoop;
|
||||||
|
CProjectile *projectile;
|
||||||
|
s16 heading;
|
||||||
|
|
||||||
|
for ( fireLoop = 0 ; fireLoop < 5 ; fireLoop++ )
|
||||||
|
{
|
||||||
|
heading = m_baseHeading - 1024 + ( fireLoop * 512 );
|
||||||
|
heading %= 4096;
|
||||||
|
|
||||||
|
projectile = new( "test projectile" ) CProjectile;
|
||||||
|
projectile->init( Pos, heading );
|
||||||
|
}
|
||||||
|
|
||||||
|
m_controlFunc = NPC_CONTROL_MOVEMENT;
|
||||||
|
m_timerFunc = NPC_TIMER_ATTACK_DONE;
|
||||||
|
m_timerTimer = GameState::getOneSecondInFrames();
|
||||||
|
m_sensorFunc = NPC_SENSOR_NONE;
|
||||||
|
}
|
107
source/projectl/projectl.cpp
Normal file
107
source/projectl/projectl.cpp
Normal file
|
@ -0,0 +1,107 @@
|
||||||
|
/*=========================================================================
|
||||||
|
|
||||||
|
projectl.cpp
|
||||||
|
|
||||||
|
Author: CRB
|
||||||
|
Created:
|
||||||
|
Project: Spongebob
|
||||||
|
Purpose:
|
||||||
|
|
||||||
|
Copyright (c) 2000 Climax Development Ltd
|
||||||
|
|
||||||
|
===========================================================================*/
|
||||||
|
|
||||||
|
#ifndef __PROJECTL_PROJECTL_H__
|
||||||
|
#include "projectl\projectl.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __GFX_SPRBANK_H__
|
||||||
|
#include "gfx\sprbank.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __LEVEL_LEVEL_H__
|
||||||
|
#include "level\level.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __FILE_EQUATES_H__
|
||||||
|
#include <biglump.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __SPR_UIGFX_H__
|
||||||
|
#include <uigfx.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __VID_HEADER_
|
||||||
|
#include "system\vid.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __GAME_GAME_H__
|
||||||
|
#include "game\game.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
void CProjectile::init()
|
||||||
|
{
|
||||||
|
m_spriteBank=new ("projectile sprites") SpriteBank();
|
||||||
|
m_spriteBank->load(UI_UIGFX_SPR);
|
||||||
|
|
||||||
|
m_heading = 0;
|
||||||
|
m_lifetime = GameState::getOneSecondInFrames() * 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CProjectile::init( DVECTOR initPos, s16 initHeading )
|
||||||
|
{
|
||||||
|
init();
|
||||||
|
|
||||||
|
m_heading = initHeading;
|
||||||
|
Pos = initPos;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CProjectile::shutdown()
|
||||||
|
{
|
||||||
|
m_spriteBank->dump(); delete m_spriteBank;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CProjectile::think(int _frames)
|
||||||
|
{
|
||||||
|
Pos.vx += ( _frames * 3 * rcos( m_heading ) ) >> 12;
|
||||||
|
Pos.vy += ( _frames * 3 * rsin( m_heading ) ) >> 12;
|
||||||
|
|
||||||
|
m_lifetime -= _frames;
|
||||||
|
|
||||||
|
if ( m_lifetime <= 0 )
|
||||||
|
{
|
||||||
|
shutdown();
|
||||||
|
delete this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CProjectile::render()
|
||||||
|
{
|
||||||
|
DVECTOR offset;
|
||||||
|
int x,y;
|
||||||
|
int scrnWidth = VidGetScrW();
|
||||||
|
int scrnHeight = VidGetScrH();
|
||||||
|
int spriteWidth = m_spriteBank->getFrameWidth(FRM_BARNACLEBOY);
|
||||||
|
int spriteHeight = m_spriteBank->getFrameHeight(FRM_BARNACLEBOY);
|
||||||
|
|
||||||
|
offset = getScreenOffset();
|
||||||
|
|
||||||
|
x = Pos.vx - offset.vx + ( scrnWidth >> 1 ) - ( spriteWidth >> 1 );
|
||||||
|
y = Pos.vy - offset.vy + ( scrnHeight >> 1 ) - ( spriteHeight >> 1 );
|
||||||
|
|
||||||
|
m_spriteBank->printFT4(FRM_BARNACLEBOY,x,y,0,0,0);
|
||||||
|
}
|
||||||
|
|
||||||
|
DVECTOR CProjectile::getScreenOffset()
|
||||||
|
{
|
||||||
|
return CLevel::getCameraPos();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CProjectile::processEvent( GAME_EVENT evt, CThing *sourceThing )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
42
source/projectl/projectl.h
Normal file
42
source/projectl/projectl.h
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
/*=========================================================================
|
||||||
|
|
||||||
|
projectl.h
|
||||||
|
|
||||||
|
Author: CRB
|
||||||
|
Created:
|
||||||
|
Project: Spongebob
|
||||||
|
Purpose:
|
||||||
|
|
||||||
|
Copyright (c) 2000 Climax Development Ltd
|
||||||
|
|
||||||
|
===========================================================================*/
|
||||||
|
|
||||||
|
#ifndef __PROJECTL_PROJECTL_H__
|
||||||
|
#define __PROJECTL_PROJECTL_H__
|
||||||
|
|
||||||
|
#include "Game/Thing.h"
|
||||||
|
#include "Gfx/Skel.h"
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
class CProjectile : public CThing
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void init();
|
||||||
|
void init( DVECTOR initPos, s16 initHeading );
|
||||||
|
void shutdown();
|
||||||
|
void think(int _frames);
|
||||||
|
virtual void render();
|
||||||
|
void processEvent( GAME_EVENT evt, CThing *sourceThing );
|
||||||
|
|
||||||
|
protected:
|
||||||
|
DVECTOR getScreenOffset();
|
||||||
|
|
||||||
|
class SpriteBank *m_spriteBank;
|
||||||
|
s16 m_heading;
|
||||||
|
s32 m_lifetime;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
#endif
|
Loading…
Add table
Reference in a new issue