From 3de584bf8b4a3dfac31b0a46722c9e07a5431af5 Mon Sep 17 00:00:00 2001 From: Charles Date: Wed, 9 May 2001 16:04:17 +0000 Subject: [PATCH] --- makefile.gaz | 3 +- source/enemy/npc.cpp | 16 ++++- source/enemy/npc.h | 1 + source/enemy/npcdata.cpp | 23 +++++++ source/hazard/hboat.cpp | 65 ++++++++++++++++++- source/hazard/hboat.h | 3 + .../spongebob project/spongebob project.dsp | 8 +++ 7 files changed, 116 insertions(+), 3 deletions(-) diff --git a/makefile.gaz b/makefile.gaz index b9df1da3c..3aa6da115 100644 --- a/makefile.gaz +++ b/makefile.gaz @@ -80,7 +80,8 @@ enemy_src := npc \ nsdart \ ndustdev \ npbug \ - nprojjf + nprojjf \ + nmjback friend_src := friend \ fdata \ diff --git a/source/enemy/npc.cpp b/source/enemy/npc.cpp index 3f733a4c0..8938c8128 100644 --- a/source/enemy/npc.cpp +++ b/source/enemy/npc.cpp @@ -185,6 +185,10 @@ #include "enemy\nshell.h" #endif +#ifndef __ENEMY_NMJBACK_H__ +#include "enemy\nmjback.h" +#endif + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Enemy NPCs @@ -357,7 +361,17 @@ CNpcEnemy *CNpcEnemy::Create(sThingActor *ThisActor) case CNpcEnemy::NPC_MOTHER_JELLYFISH: { printf("NPC_MOTHER_JELLYFISH\n"); - enemy = new ("mother jellyfish") CNpcMotherJellyfishEnemy; + + if ( CLevel::getCurrentChapterLevel() == 4 ) + { + enemy = new ("mother jellyfish background") CNpcMotherJellyfishBackground; + enemyType = NPC_MOTHER_JELLYFISH_BACKGROUND; + } + else + { + enemy = new ("mother jellyfish") CNpcMotherJellyfishEnemy; + } + break; } diff --git a/source/enemy/npc.h b/source/enemy/npc.h index bd1e8d799..1e34522eb 100644 --- a/source/enemy/npc.h +++ b/source/enemy/npc.h @@ -81,6 +81,7 @@ public: NPC_BALL_BLOB, NPC_SHELL, NPC_PROJECTILE_JELLYFISH, + NPC_MOTHER_JELLYFISH_BACKGROUND, NPC_UNIT_TYPE_MAX, }; diff --git a/source/enemy/npcdata.cpp b/source/enemy/npcdata.cpp index d35867d0c..bc995e198 100644 --- a/source/enemy/npcdata.cpp +++ b/source/enemy/npcdata.cpp @@ -971,6 +971,28 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] = true, false, }, + + { // NPC_SMALL_JELLYFISH_1 + ACTORS_MOTHERJELLYFISH_SBK, + ANIM_CLAM_SIDESNAP, + NPC_SENSOR_NONE, + NPC_MOVEMENT_FIXED_PATH, + NPC_CLOSE_NONE, + NPC_TIMER_NONE, + false, + 2, + 128, + DETECT_NO_COLLISION, + DAMAGE__SHOCK_ENEMY, + 256, + 0, + NPC_SHOT_GENERIC, + 0, + 0, + false, + false, + false, + }, }; CNpcEnemy::NPC_UNIT_TYPE CNpcEnemy::mapEditConvertTable[NPC_UNIT_TYPE_MAX] = @@ -1015,4 +1037,5 @@ CNpcEnemy::NPC_UNIT_TYPE CNpcEnemy::mapEditConvertTable[NPC_UNIT_TYPE_MAX] = NPC_GHOST_PIRATE, NPC_OIL_BLOB, NPC_PARASITIC_WORM_SEGMENT, + NPC_MOTHER_JELLYFISH_BACKGROUND, }; diff --git a/source/hazard/hboat.cpp b/source/hazard/hboat.cpp index 9c29d8817..804f06d74 100644 --- a/source/hazard/hboat.cpp +++ b/source/hazard/hboat.cpp @@ -19,6 +19,14 @@ #include "level\layercollision.h" #endif +#ifndef __GAME_GAME_H__ +#include "game\game.h" +#endif + +#ifndef __VID_HEADER_ +#include "system\vid.h" +#endif + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void CNpcBoatHazard::init() @@ -72,6 +80,15 @@ void CNpcBoatHazard::processMovement( int _frames ) distX = distX / abs( distX ); + if ( distX > 0 ) + { + m_reversed = false; + } + else + { + m_reversed = true; + } + if ( m_layerCollision->getHeightFromGround( Pos.vx + ( distX * 3 * _frames ), Pos.vy ) < -maxHeight ) { // there is an obstacle in the way, increment the path point (hopefully this will resolve the problem) @@ -102,4 +119,50 @@ void CNpcBoatHazard::processMovement( int _frames ) Pos.vx += moveX; Pos.vy += moveY; -} \ No newline at end of file +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CNpcBoatHazard::render() +{ + if ( m_isActive ) + { + CHazardThing::render(); + + // Render + DVECTOR renderPos; + DVECTOR offset = CLevel::getCameraPos(); + + renderPos.vx = Pos.vx - offset.vx; + renderPos.vy = Pos.vy - offset.vy; + + CRECT collisionRect = getCollisionArea(); + collisionRect.x1 -= Pos.vx; + collisionRect.x2 -= Pos.vx; + collisionRect.y1 -= Pos.vy; + collisionRect.y2 -= Pos.vy; + + if ( renderPos.vx + collisionRect.x2 >= 0 && renderPos.vx + collisionRect.x1 <= VidGetScrW() ) + { + if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() ) + { + VECTOR flip; + + if ( m_reversed ) + { + flip.vx = ONE; + } + else + { + flip.vx = -ONE; + } + + flip.vy = ONE; + flip.vz = ONE; + + m_modelGfx->Render( renderPos, NULL, NULL, &flip ); + //m_actorGfx->Render(renderPos,0,0,0); + } + } + } +} diff --git a/source/hazard/hboat.h b/source/hazard/hboat.h index fb514ebf0..c3d47b7fd 100644 --- a/source/hazard/hboat.h +++ b/source/hazard/hboat.h @@ -22,8 +22,11 @@ class CNpcBoatHazard : public CNpcHazard { public: void init(); + virtual void render(); protected: void processMovement( int _frames ); + + u8 m_reversed; }; #endif \ No newline at end of file diff --git a/users/paul/spongebob project/spongebob project.dsp b/users/paul/spongebob project/spongebob project.dsp index d521fe61a..c51acb3a9 100644 --- a/users/paul/spongebob project/spongebob project.dsp +++ b/users/paul/spongebob project/spongebob project.dsp @@ -229,6 +229,14 @@ SOURCE=..\..\..\source\enemy\nmine.h # End Source File # Begin Source File +SOURCE=..\..\..\source\enemy\nmjback.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\source\enemy\nmjback.h +# End Source File +# Begin Source File + SOURCE=..\..\..\source\enemy\nmjfish.cpp # End Source File # Begin Source File