From d4dc0ef1d249ea179a5b1eb2235a69a92c57120f Mon Sep 17 00:00:00 2001 From: Charles Date: Thu, 3 May 2001 21:39:27 +0000 Subject: [PATCH] --- Graphics/characters/SharkSub/AnimList.txt | 15 +++-- data/DataCache.scr | 2 + makefile.gfx | 3 +- source/enemy/nmjfish.cpp | 73 ++++++++++++++++++++++- source/enemy/nmjfish.h | 1 + source/enemy/npc.h | 5 -- source/enemy/npcdata.cpp | 10 ++-- source/enemy/nsshark.cpp | 49 ++++++++++++--- source/platform/platdata.cpp | 4 +- tools/MapEdit/actor.ini | 32 +++++----- 10 files changed, 148 insertions(+), 46 deletions(-) diff --git a/Graphics/characters/SharkSub/AnimList.txt b/Graphics/characters/SharkSub/AnimList.txt index 95bb5e0e6..8bfab7457 100644 --- a/Graphics/characters/SharkSub/AnimList.txt +++ b/Graphics/characters/SharkSub/AnimList.txt @@ -1,8 +1,7 @@ -sharksubchomp -sharksubdeath -sharksubidle -sharksubspit -sharksubsprintclosed -sharksubsprintopen -sharksubswim -sharksubswipe +chomp +death +gethit +sprintclosed +sprintopen +swim +swipe diff --git a/data/DataCache.scr b/data/DataCache.scr index 0e6b312d4..e37919d75 100644 --- a/data/DataCache.scr +++ b/data/DataCache.scr @@ -186,3 +186,5 @@ actors/SKELETALFISH.SBK actors/SPIDERCRAB.SBK actors/SPIKEYANENOME.SBK actors/STOMPER.SBK + +actors/SHARKSUB.SBK \ No newline at end of file diff --git a/makefile.gfx b/makefile.gfx index 1599b98cc..1dd0831c6 100644 --- a/makefile.gfx +++ b/makefile.gfx @@ -112,7 +112,8 @@ ACTOR_NPC := BarnacleBoy Krusty Squidward Gary Sandy Patrick MermaidMan ACTOR_ENEMY := Anenome BabyOctopus Ballblob Caterpillar clam Dustdevil Eyeball \ Flamingskull FlyingDutchman Ghost HermitCrab IronDogFish Lrgjellyfish \ - PuffaFish Sharkman Skeletalfish SpiderCrab SpikeyAnenome Stomper + PuffaFish Sharkman Skeletalfish SpiderCrab SpikeyAnenome Stomper \ + SharkSub # Boogermonster GiantWorm Jellyfish2 Motherjellyfish Nautilus Neptune SeaSnake SharkSub diff --git a/source/enemy/nmjfish.cpp b/source/enemy/nmjfish.cpp index 793fe31e3..289baaf1f 100644 --- a/source/enemy/nmjfish.cpp +++ b/source/enemy/nmjfish.cpp @@ -19,6 +19,10 @@ #include "enemy\nmjfish.h" #endif +#ifndef __VID_HEADER_ +#include "system\vid.h" +#endif + #ifndef __GAME_GAME_H__ #include "game\game.h" #endif @@ -217,4 +221,71 @@ void CNpcMotherJellyfishEnemy::processClose( int _frames ) break; } } -} \ No newline at end of file +} + +/*void CNpcMotherJellyfishEnemy::render() +{ + SprFrame = NULL; + + if ( m_isActive ) + { + CEnemyThing::render(); + + // Render + DVECTOR renderPos; + DVECTOR origRenderPos; + DVECTOR offset = CLevel::getCameraPos(); + int spriteWidth = m_spriteBank->getFrameWidth( m_frame >> 8 ); + int spriteHeight = m_spriteBank->getFrameHeight( m_frame >> 8 ); + + renderPos.vx = Pos.vx - offset.vx; + origRenderPos.vx = renderPos.vx; + renderPos.vx += m_drawOffset.vx; + + renderPos.vy = Pos.vy - offset.vy; + origRenderPos.vy = renderPos.vy; + renderPos.vy += m_drawOffset.vy - ( spriteHeight >> 1 ); + + if ( renderPos.vx >= 0 && renderPos.vx <= VidGetScrW() ) + { + if ( renderPos.vy >= 0 && renderPos.vy <= VidGetScrH() ) + { + SprFrame = m_spriteBank->printRotatedScaledSprite( FRM_JELLYFISH1_SWIM1,renderPos.vx,renderPos.vy,4096,4096,0,10); + setRGB0( SprFrame, 255, 128, 255 ); + + // get xmax, xmin, ymax, ymin + + s32 XMax; + s32 XMin; + + s32 YMax; + s32 YMin; + + XMin=SprFrame->x0; + if (XMin>SprFrame->x1) XMin=SprFrame->x1; + if (XMin>SprFrame->x2) XMin=SprFrame->x2; + if (XMin>SprFrame->x3) XMin=SprFrame->x3; + XMax=SprFrame->x0; + if (XMaxx1) XMax=SprFrame->x1; + if (XMaxx2) XMax=SprFrame->x2; + if (XMaxx3) XMax=SprFrame->x3; + YMin=SprFrame->y0; + if (YMin>SprFrame->y1) YMin=SprFrame->y1; + if (YMin>SprFrame->y2) YMin=SprFrame->y2; + if (YMin>SprFrame->y3) YMin=SprFrame->y3; + YMax=SprFrame->y0; + if (YMaxy1) YMax=SprFrame->y1; + if (YMaxy2) YMax=SprFrame->y2; + if (YMaxy3) YMax=SprFrame->y3; + + XMax -= origRenderPos.vx; + XMin -= origRenderPos.vx; + YMax -= origRenderPos.vy; + YMin -= origRenderPos.vy; + + setCollisionSize( ( XMax - XMin ), ( YMax - YMin ) ); + setCollisionCentreOffset( ( XMax + XMin ) >> 1, ( YMax + YMin ) >> 1 ); + } + } + } +}*/ diff --git a/source/enemy/nmjfish.h b/source/enemy/nmjfish.h index 68b047a6d..43475312d 100644 --- a/source/enemy/nmjfish.h +++ b/source/enemy/nmjfish.h @@ -18,6 +18,7 @@ class CNpcMotherJellyfishEnemy : public CNpcEnemy { public: virtual void postInit(); + //void render(); protected: virtual void processClose( int _frames ); virtual void processMovement( int _frames ); diff --git a/source/enemy/npc.h b/source/enemy/npc.h index c3dde2c56..e5812f826 100644 --- a/source/enemy/npc.h +++ b/source/enemy/npc.h @@ -42,12 +42,7 @@ class CNpcEnemy : public CEnemyThing public: enum NPC_UNIT_TYPE { - //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, diff --git a/source/enemy/npcdata.cpp b/source/enemy/npcdata.cpp index a02cfef9c..b004fe4b4 100644 --- a/source/enemy/npcdata.cpp +++ b/source/enemy/npcdata.cpp @@ -103,9 +103,9 @@ #include #endif -//#ifndef __ANIM_SHARKSUB_HEADER__ -//#include -//#endif +#ifndef __ANIM_SHARKSUB_HEADER__ +#include +#endif CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] = @@ -793,8 +793,8 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] = }, { // NPC_SUB_SHARK - ACTORS_CLAM_SBK, - ANIM_CLAM_SIDESNAP, + ACTORS_SHARKSUB_SBK, + ANIM_SHARKSUB_SWIM, NPC_SENSOR_NONE, NPC_MOVEMENT_STATIC, NPC_CLOSE_NONE, diff --git a/source/enemy/nsshark.cpp b/source/enemy/nsshark.cpp index cd0c4165a..7cd03bb84 100644 --- a/source/enemy/nsshark.cpp +++ b/source/enemy/nsshark.cpp @@ -32,7 +32,7 @@ #endif #ifndef __ANIM_SHARKSUB_HEADER__ -#include +#include #endif @@ -40,6 +40,7 @@ void CNpcSubSharkEnemy::postInit() { m_state = SUB_SHARK_MINE_1; m_extendDir = EXTEND_RIGHT; + m_npcPath.setPathType( CNpcPath::PONG_PATH ); } void CNpcSubSharkEnemy::processMovement( int _frames ) @@ -49,13 +50,13 @@ void CNpcSubSharkEnemy::processMovement( int _frames ) if ( playerXDistSqr + playerYDistSqr < 100 && !m_salvoCount ) { m_animPlaying = true; - m_animNo = ANIM_CLAM_SIDESNAP; + m_animNo = ANIM_SHARKSUB_SWIPE; m_frame = 0; } else { m_animPlaying = true; - m_animNo = ANIM_CLAM_SIDESNAP; + m_animNo = ANIM_SHARKSUB_SWIM; m_frame = 0; } } @@ -82,7 +83,32 @@ void CNpcSubSharkEnemy::processMovement( int _frames ) m_movementTimer -= _frames; } - if ( m_extendDir == EXTEND_RIGHT ) + s32 moveX = 0, moveY = 0; + s32 moveVel = 0; + s32 moveDist = 0; + + processGenericFixedPathMove( _frames, &moveX, &moveY, &moveVel, &moveDist ); + + if ( moveX > 0 ) + { + m_extendDir = EXTEND_RIGHT; + } + else + { + m_extendDir = EXTEND_LEFT; + } + + Pos.vx += moveX; + Pos.vy += moveY; + + if ( m_movementTimer <= 0 ) + { + m_controlFunc = NPC_CONTROL_CLOSE; + } + + + + /*if ( m_extendDir == EXTEND_RIGHT ) { s32 xDist = 600 - Pos.vx; s32 xDistSqr = xDist * xDist; @@ -123,7 +149,7 @@ void CNpcSubSharkEnemy::processMovement( int _frames ) m_controlFunc = NPC_CONTROL_CLOSE; } } - } + }*/ } void CNpcSubSharkEnemy::processClose( int _frames ) @@ -145,6 +171,13 @@ void CNpcSubSharkEnemy::processClose( int _frames ) case SUB_SHARK_MINE_1: case SUB_SHARK_MINE_2: { + if ( !m_animPlaying ) + { + m_animPlaying = true; + m_animNo = ANIM_SHARKSUB_SWIM; + m_frame = 0; + } + processGenericGotoTarget( _frames, playerXDist, 0, m_data[m_type].speed ); if ( playerXDistSqr < 100 ) @@ -167,7 +200,7 @@ void CNpcSubSharkEnemy::processClose( int _frames ) if ( !m_animPlaying ) { m_animPlaying = true; - m_animNo = ANIM_CLAM_SIDESNAP; + m_animNo = ANIM_SHARKSUB_SPRINTOPEN; m_frame = 0; } @@ -176,7 +209,7 @@ void CNpcSubSharkEnemy::processClose( int _frames ) if ( playerXDistSqr < 10000 ) { m_animPlaying = true; - m_animNo = ANIM_CLAM_SIDESNAP; + m_animNo = ANIM_SHARKSUB_CHOMP; m_frame = 0; m_state = SUB_SHARK_SWALLOW; @@ -222,7 +255,7 @@ void CNpcSubSharkEnemy::processClose( int _frames ) if ( !m_animPlaying ) { m_animPlaying = true; - m_animNo = ANIM_CLAM_SIDESNAP; + m_animNo = ANIM_SHARKSUB_SWIM; m_frame = 0; m_controlFunc = NPC_CONTROL_MOVEMENT; m_movementTimer = GameState::getOneSecondInFrames() * 8; diff --git a/source/platform/platdata.cpp b/source/platform/platdata.cpp index 226e5063d..51e20750f 100644 --- a/source/platform/platdata.cpp +++ b/source/platform/platdata.cpp @@ -270,7 +270,7 @@ CNpcPlatform::NPC_PLATFORM_DATA CNpcPlatform::m_data[NPC_PLATFORM_TYPE_MAX] = 0, 4, NPC_PLATFORM_INFINITE_LIFE, - 4, + 2, NPC_PLATFORM_TIMER_NONE, }, @@ -284,7 +284,7 @@ CNpcPlatform::NPC_PLATFORM_DATA CNpcPlatform::m_data[NPC_PLATFORM_TYPE_MAX] = 0, 4, NPC_PLATFORM_INFINITE_LIFE, - 4, + 2, NPC_PLATFORM_TIMER_NONE, }, diff --git a/tools/MapEdit/actor.ini b/tools/MapEdit/actor.ini index 46bb2c20b..96955c1e4 100644 --- a/tools/MapEdit/actor.ini +++ b/tools/MapEdit/actor.ini @@ -117,14 +117,14 @@ AttackStrength=20 # [Largejellyfish] - This is a platform -#[Motherjellyfish] -#Gfx=..\..\graphics\characters\ -#WayPoints=16 -#Speed=3 -#TurnRate=256 -#Collision=0 -#Health=256 -#AttackStrength=1234 +[Motherjellyfish] +Gfx=..\..\graphics\characters\MotherJellyfish\render\psx\+motherjellyfish0000.bmp +WayPoints=16 +Speed=3 +TurnRate=256 +Collision=0 +Health=256 +AttackStrength=1234 [Anenome-Level1] Gfx=..\..\graphics\characters\Anenome\render\AnemneLvl1Icon.bmp @@ -298,14 +298,14 @@ Collision=0 Health=16 AttackStrength=20 -#[SharkSub] -#Gfx=..\..\graphics\characters\ -#WayPoints=16 -#Speed=3 -#TurnRate=2048 -#Collision=0 -#Health=256 -#AttackStrength=0 +[SharkSub] +Gfx=..\..\graphics\characters\SharkSub\render\psx\SharkSub_swim0000.bmp +WayPoints=16 +Speed=3 +TurnRate=2048 +Collision=0 +Health=256 +AttackStrength=0 [Skeletalfish] Gfx=..\..\graphics\characters\Skeletalfish\render\psx\skeletalfish_idle0000.bmp