This commit is contained in:
Charles 2001-04-24 15:01:42 +00:00
parent 16c139d989
commit 26aa7ecc90
9 changed files with 191 additions and 56 deletions

View File

@ -68,7 +68,6 @@ enemy_src := npc \
nfdutch \
nsshark \
ndogfish \
nhazard \
nffolk \
nocto \
nfskull \
@ -79,7 +78,8 @@ enemy_src := npc \
nbblob \
npuffa \
ngen \
nsdart
nsdart \
ndustdev
platform_src := platform \
platdata \
@ -93,6 +93,13 @@ platform_src := platform \
pcart \
pretract
hazard_src := hazard \
hfalling \
hpendulm \
hfirebal \
hsaw \
hbarrel
projectl_src := projectl
fileio_src := fileio \

View File

@ -142,8 +142,8 @@
#include "enemy\ndogfish.h"
#endif
#ifndef __ENEMY_NHAZARD_H__
#include "enemy\nhazard.h"
#ifndef __ENEMY_NDUSTDEV_H__
#include "enemy\ndustdev.h"
#endif
#ifndef __ENEMY_NSDART_H__
@ -507,45 +507,45 @@ CNpcEnemy *CNpcEnemy::Create(sThingActor *ThisActor)
break;
}
case CNpcEnemy::NPC_FALLING_ITEM:
/*case CNpcEnemy::NPC_FALLING_ITEM:
{
printf("NPC_FALLING_ITEM\n");
enemy = new ("falling item") CNpcFallingItemHazard;
break;
}
}*/
case CNpcEnemy::NPC_FISH_HOOK:
/*case CNpcEnemy::NPC_FISH_HOOK:
{
printf("NPC_FISH_HOOK\n");
enemy = new ("fish hook") CNpcFishHookHazard;
break;
}
}*/
case CNpcEnemy::NPC_PENDULUM:
/*case CNpcEnemy::NPC_PENDULUM:
{
printf("NPC_PENDULUM\n");
enemy = new ("pendulum") CNpcPendulumHazard;
break;
}
}*/
case CNpcEnemy::NPC_FIREBALL:
/*case CNpcEnemy::NPC_FIREBALL:
{
printf("NPC_FIREBALL\n");
enemy = new ("fireball") CNpcFireballHazard;
break;
}
}*/
case CNpcEnemy::NPC_SAW_BLADE:
/*case CNpcEnemy::NPC_SAW_BLADE:
{
printf("NPC_SAW_BLADE\n");
enemy = new ("saw blade") CNpcReturningHazard;
break;
}
}*/
case CNpcEnemy::NPC_DUST_DEVIL:
{
printf("NPC_DUST_DEVIL\n");
enemy = new ("dust devil") CNpcReturningGroundHazard;
enemy = new ("dust devil") CNpcDustDevilEnemy;
break;
}
@ -601,6 +601,7 @@ CNpcEnemy *CNpcEnemy::Create(sThingActor *ThisActor)
{
printf("UNKNOWN %i\n",enemyType);
enemy = new ("npc enemy") CNpcEnemy;
ASSERT(0);
break;
}
}

View File

@ -113,13 +113,13 @@ class CNpcEnemy : public CEnemyThing
public:
enum NPC_UNIT_TYPE
{
NPC_FALLING_ITEM = 0,
NPC_FISH_HOOK = 1,
NPC_DUST_DEVIL,
NPC_PENDULUM,
NPC_FIREBALL,
NPC_SAW_BLADE,
NPC_SMALL_JELLYFISH_1,
//NPC_FALLING_ITEM = 0,
//NPC_FISH_HOOK = 1,
NPC_DUST_DEVIL = 0,
//NPC_PENDULUM,
//NPC_FIREBALL,
//NPC_SAW_BLADE,
NPC_SMALL_JELLYFISH_1 = 1,
NPC_SMALL_JELLYFISH_2,
NPC_ANEMONE_1,
NPC_ANEMONE_2,

View File

@ -145,7 +145,7 @@ CNpcFriend::NPC_FRIEND_DATA CNpcFriend::m_data[NPC_FRIEND_UNIT_TYPE_MAX] =
CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
{
{ // NPC_FALLING_ITEM
/*{ // NPC_FALLING_ITEM
ACTORS_CLAM_SBK,
ANIM_CLAM_SIDESNAP,
NPC_SENSOR_USER_CLOSE,
@ -185,7 +185,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
0,
false,
false,
},
},*/
{ // NPC_DUST_DEVIL
ACTORS_DUSTDEVIL_SBK,
@ -208,7 +208,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
false,
},
{ // NPC_PENDULUM
/*{ // NPC_PENDULUM
ACTORS_CLAM_SBK,
ANIM_CLAM_SIDESNAP,
NPC_SENSOR_NONE,
@ -227,9 +227,9 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
0,
false,
false,
},
},*/
{ // NPC_FIREBALL
/*{ // NPC_FIREBALL
ACTORS_CLAM_SBK,
ANIM_CLAM_SIDESNAP,
NPC_SENSOR_NONE,
@ -248,9 +248,9 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
0,
false,
false,
},
},*/
{ // NPC_SAW_BLADE
/*{ // NPC_SAW_BLADE
ACTORS_CLAM_SBK,
ANIM_CLAM_SIDESNAP,
NPC_SENSOR_NONE,
@ -269,7 +269,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
0,
false,
false,
},
},*/
{ // NPC_SMALL_JELLYFISH_1
0,//ACTORS_JELLYFISH1_SBK,
@ -1059,11 +1059,11 @@ CNpcEnemy::NPC_UNIT_TYPE CNpcEnemy::mapEditConvertTable[NPC_UNIT_TYPE_MAX] =
NPC_SKULL_STOMPER,
NPC_DUST_DEVIL,
NPC_SPIDER_CRAB_SPAWNER,
NPC_FALLING_ITEM,
NPC_FISH_HOOK,
NPC_PENDULUM,
NPC_FIREBALL,
NPC_SAW_BLADE,
//NPC_FALLING_ITEM,
//NPC_FISH_HOOK,
//NPC_PENDULUM,
//NPC_FIREBALL,
//NPC_SAW_BLADE,
NPC_FISH_FOLK,
NPC_ANGLER_FISH,
NPC_MINE,

View File

@ -36,6 +36,16 @@ void CNpcHazard::init()
Pos.vx = 300;
Pos.vy = 300;
m_base = Pos;
m_timer = 0;
m_timerActive = false;
m_isActive = true;
m_extension = 0;
m_extendDir = 0;
m_heading = 0;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -57,26 +67,51 @@ void CNpcHazard::shutdown()
void CNpcHazard::think(int _frames)
{
CHazardThing::think(_frames);
if ( m_isActive )
{
processMovement( _frames );
}
if ( m_timerActive )
{
processTimer( _frames );
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcHazard::processMovement( int _frames )
{
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcHazard::processTimer( int _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 ( m_isActive )
{
if ( renderPos.vy >= 0 && renderPos.vy <= VidGetScrH() )
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() )
{
m_actorGfx->Render(renderPos,0,0,0);
if ( renderPos.vy >= 0 && renderPos.vy <= VidGetScrH() )
{
m_actorGfx->Render(renderPos,0,0,0);
}
}
}
}

View File

@ -34,15 +34,36 @@
class CNpcHazard : public CHazardThing
{
public:
void init();
virtual void init();
void shutdown();
void think(int _frames);
void render();
void setLayerCollision( class CLayerCollision *_layer ) {m_layerCollision=_layer;}
protected:
enum
{
EXTEND_UP = true,
EXTEND_DOWN = false,
EXTEND_RIGHT = true,
EXTEND_LEFT = false,
EXTEND_CLOCKWISE = true,
EXTEND_ANTICLOCKWISE = false,
};
virtual void processMovement( int _frames );
virtual void processTimer( int _frames );
CNpcPath m_npcPath;
CActorGfx *m_actorGfx;
SpriteBank *m_spriteBank;
DVECTOR m_base;
s32 m_timer;
bool m_timerActive;
bool m_isActive;
class CLayerCollision *m_layerCollision;
s32 m_extension;
bool m_extendDir;
s32 m_heading;
};
#endif

View File

@ -172,6 +172,19 @@ void CThingManager::thinkAllThings(int _frames)
thing1=thing1->m_nextThing;
}
// Player -> Hazard collision
thing1=s_thingLists[CThing::TYPE_HAZARD];
thing2=s_thingLists[CThing::TYPE_PLAYER];
while(thing1&&thing2)
{
if(thing1->canCollide()&&
thing1->checkCollisionAgainst(thing2, _frames))
{
thing1->collidedWith(thing2);
}
thing1=thing1->m_nextThing;
}
// Player -> Enemy projectile collision
thing1=s_thingLists[CThing::TYPE_ENEMYPROJECTILE];
thing2=s_thingLists[CThing::TYPE_PLAYER];

View File

@ -85,6 +85,7 @@ public:
TYPE_ENEMY,
TYPE_ENEMYPROJECTILE,
TYPE_TRIGGER,
TYPE_HAZARD,
MAX_TYPE,
}
@ -217,6 +218,11 @@ public:
virtual TYPE getThingType() {return TYPE_TRIGGER;}
virtual void setPositionAndSize(int _x,int _y,int _w,int _h); // Wonder if this might be better in CThing? (pkg)
};
class CHazardThing : public CThing
{
public:
virtual TYPE getThingType() {return TYPE_HAZARD;}
};
/*----------------------------------------------------------------------

View File

@ -153,6 +153,14 @@ SOURCE=..\..\..\source\enemy\ndogfish.h
# End Source File
# Begin Source File
SOURCE=..\..\..\source\enemy\ndustdev.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\source\enemy\ndustdev.h
# End Source File
# Begin Source File
SOURCE=..\..\..\source\enemy\neyeball.cpp
# End Source File
# Begin Source File
@ -213,14 +221,6 @@ SOURCE=..\..\..\source\enemy\ngpirate.h
# End Source File
# Begin Source File
SOURCE=..\..\..\source\enemy\nhazard.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\source\enemy\nhazard.h
# End Source File
# Begin Source File
SOURCE=..\..\..\source\enemy\nhcrab.cpp
# End Source File
# Begin Source File
@ -1452,6 +1452,58 @@ SOURCE=..\..\..\source\platform\pretract.cpp
SOURCE=..\..\..\source\platform\pretract.h
# End Source File
# End Group
# Begin Group "hazard"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\..\..\source\hazard\hazard.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\source\hazard\hazard.h
# End Source File
# Begin Source File
SOURCE=..\..\..\source\hazard\hbarrel.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\source\hazard\hbarrel.h
# End Source File
# Begin Source File
SOURCE=..\..\..\source\hazard\hfalling.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\source\hazard\hfalling.h
# End Source File
# Begin Source File
SOURCE=..\..\..\source\hazard\hfirebal.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\source\hazard\hfirebal.h
# End Source File
# Begin Source File
SOURCE=..\..\..\source\hazard\hpendulm.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\source\hazard\hpendulm.h
# End Source File
# Begin Source File
SOURCE=..\..\..\source\hazard\hsaw.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\source\hazard\hsaw.h
# End Source File
# End Group
# End Group
# Begin Group "makefiles"