diff --git a/makefile.gaz b/makefile.gaz index 4f814fb0e..70339f6ce 100644 --- a/makefile.gaz +++ b/makefile.gaz @@ -135,7 +135,8 @@ platform_src := platform \ psswitch \ plift \ plurve \ - psoil + psoil \ + pbubtube hazard_src := hazard \ hfalling \ diff --git a/source/enemy/nmjfish.cpp b/source/enemy/nmjfish.cpp index 61ffad17d..278162a3b 100644 --- a/source/enemy/nmjfish.cpp +++ b/source/enemy/nmjfish.cpp @@ -39,11 +39,6 @@ #include "player\player.h" #endif -#include "fx\fx.h" -#include "fx\fxjfish.h" -#include "fx\fxnrgbar.h" - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -58,7 +53,25 @@ void CNpcMotherJellyfishEnemy::postInit() m_health = CLevel::getBossHealth(); } - CFXJellyFishLegs *T=(CFXJellyFishLegs*)CFX::Create(CFX::FX_TYPE_JELLYFISH_LEGS,this); + legsPos[0].vx = 80; + legsPos[0].vy = -5; + + legsPos[1].vx = 40; + legsPos[1].vy = 0; + + legsPos[2].vx = -40; + legsPos[2].vy = -5; + + legsPos[3].vx = -80; + legsPos[3].vy = 0; + + for ( int i = 0 ; i < 4 ; i++ ) + { + legs[i] = (CFXJellyFishLegs*)CFX::Create(CFX::FX_TYPE_JELLYFISH_LEGS,this); + legs[i]->Setup( legsPos[i].vx, legsPos[i].vy, i > 1 ); + } + + /*CFXJellyFishLegs *T=(CFXJellyFishLegs*)CFX::Create(CFX::FX_TYPE_JELLYFISH_LEGS,this); T->Setup(80,-5,0); T=(CFXJellyFishLegs*)CFX::Create(CFX::FX_TYPE_JELLYFISH_LEGS,this); @@ -68,7 +81,7 @@ void CNpcMotherJellyfishEnemy::postInit() T->Setup(-40,-5,1); T=(CFXJellyFishLegs*)CFX::Create(CFX::FX_TYPE_JELLYFISH_LEGS,this); - T->Setup(-80,0,1); + T->Setup(-80,0,1);*/ } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -384,8 +397,11 @@ void CNpcMotherJellyfishEnemy::render() DVECTOR &renderPos=getRenderPos(); + s16 scale; + scale = 2048 + ( ( ( 8192 - 2048 ) * m_health ) / m_data[m_type].initHealth ); + SprFrame = m_actorGfx->Render(renderPos,m_animNo,( m_frame >> 8 ),false); - m_actorGfx->RotateScale( SprFrame, renderPos, 0, 8192, 8192 ); + m_actorGfx->RotateScale( SprFrame, renderPos, 0, scale, scale ); sBBox boundingBox = m_actorGfx->GetBBox(); setCollisionSize( ( boundingBox.XMax - boundingBox.XMin ), ( boundingBox.YMax - boundingBox.YMin ) ); @@ -396,6 +412,20 @@ void CNpcMotherJellyfishEnemy::render() //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void CNpcMotherJellyfishEnemy::processUserCollision( CThing *thisThing ) +/*void CNpcMotherJellyfishEnemy::processUserCollision( CThing *thisThing ) { +}*/ + +void CNpcMotherJellyfishEnemy::processShot( int _frames ) +{ + s16 scale; + scale = 2048 + ( ( ( 8192 - 2048 ) * m_health ) / m_data[m_type].initHealth ); + + for ( int i = 0 ; i < 4 ; i++ ) + { + legs[i]->Setup( ( legsPos[i].vx * scale ) >> 13, legsPos[i].vy, i > 1 ); + legs[i]->setScale( scale >> 1 ); + } + + CNpcEnemy::processShot( _frames ); } diff --git a/source/enemy/nmjfish.h b/source/enemy/nmjfish.h index 29d295da8..c57f9b987 100644 --- a/source/enemy/nmjfish.h +++ b/source/enemy/nmjfish.h @@ -14,6 +14,10 @@ #ifndef __ENEMY_NMJFISH_H__ #define __ENEMY_NMJFISH_H__ +#include "fx\fx.h" +#include "fx\fxjfish.h" +#include "fx\fxnrgbar.h" + class CNpcMotherJellyfishEnemy : public CNpcEnemy { public: @@ -24,8 +28,9 @@ public: protected: virtual void processClose( int _frames ); virtual void processMovement( int _frames ); + virtual void processShot( int _frames ); void spawnJellyfish( int _frames ); - virtual void processUserCollision( CThing *thisThing ); + //virtual void processUserCollision( CThing *thisThing ); enum NPC_MOTHER_JELLYFISH_STATE { @@ -45,6 +50,9 @@ protected: s32 m_cycleWidth; s32 m_halfCycleWidth; bool m_meterOn; + + CFXJellyFishLegs *legs[4]; + DVECTOR legsPos[4]; }; #endif \ No newline at end of file diff --git a/source/enemy/nshell.cpp b/source/enemy/nshell.cpp index 485bfad25..828f7858c 100644 --- a/source/enemy/nshell.cpp +++ b/source/enemy/nshell.cpp @@ -33,7 +33,7 @@ void CNpcShellEnemy::postInit() m_shellType = FRM_SHELL_STATIC0000 + ( getRnd() % ( FRM_SHELL_STATIC0002 - FRM_SHELL_STATIC0000 + 1 ) ); - Pos.vy -= 12; + Pos.vy -= 20; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/fx/fxjfish.cpp b/source/fx/fxjfish.cpp index ef9408703..632f23dff 100644 --- a/source/fx/fxjfish.cpp +++ b/source/fx/fxjfish.cpp @@ -29,6 +29,7 @@ void CFXJellyFishLegs::init(DVECTOR const &_Pos) Ofs.vx=0; Ofs.vy=0; Angle=getRnd(); AngleInc=LegAngleInc+getRndRange(3); + Scale = ONE; } /*****************************************************************************/ @@ -72,6 +73,8 @@ int WOfs=0; int H; int ThisAngle=Angle; int LegHeight=SprBank->getFrameHeight(FRM__LEG)-4; +int ScaleWInc=(Scale*LegWInc)>>12; +int ScaleHInc=(Scale*LegHInc)>>12; RenderPos.vx+=Ofs.vx; RenderPos.vy+=Ofs.vy; @@ -82,7 +85,18 @@ int LegHeight=SprBank->getFrameHeight(FRM__LEG)-4; ThisAngle&=CIRCLE_TAB_MASK; H=LegHeight+(CircleTable[ThisAngle]>>5); - POLY_FT4 *Ft4=SprBank->printFT4(FRM__LEG,RenderPos.vx,RenderPos.vy,XFlip,0,OtPos); + int spriteWidth = ( Scale * CGameScene::getSpriteBank()->getFrameWidth(FRM__LEG) ) >> 12; + + POLY_FT4 *Ft4; + + if ( XFlip ) + { + Ft4=SprBank->printFT4Scaled(FRM__LEG,RenderPos.vx + 6 + ( spriteWidth >> 1 ),RenderPos.vy,XFlip,0,OtPos,Scale>>4); + } + else + { + Ft4=SprBank->printFT4Scaled(FRM__LEG,RenderPos.vx - 6 - ( spriteWidth >> 1 ),RenderPos.vy,XFlip,0,OtPos,Scale>>4); + } if (!XFlip) { @@ -98,7 +112,10 @@ int LegHeight=SprBank->getFrameHeight(FRM__LEG)-4; Ft4->y2=Ft4->y0+H; Ft4->y3=Ft4->y1+H; - RenderPos.vy+=H+LegHInc; - WOfs+=LegWInc; +// RenderPos.vy+=H+LegHInc; +// WOfs+=LegWInc; + RenderPos.vy+=H+ScaleHInc; + WOfs+=ScaleWInc; + } } diff --git a/source/fx/fxjfish.h b/source/fx/fxjfish.h index 8899b8f26..cffbff9ec 100644 --- a/source/fx/fxjfish.h +++ b/source/fx/fxjfish.h @@ -18,12 +18,14 @@ virtual void think(int _frames); virtual void render(); void Setup(int XOfs,int YOfs,bool XFlip); + void setScale( s16 newScale ) {Scale = newScale;} protected: DVECTOR Ofs; int Angle,AngleInc; bool XFlip; + s16 Scale; }; diff --git a/source/platform/pcart.cpp b/source/platform/pcart.cpp index c7081f8f3..ad72d161f 100644 --- a/source/platform/pcart.cpp +++ b/source/platform/pcart.cpp @@ -36,6 +36,13 @@ void CNpcCartPlatform::postInit() m_npcPath.setPathType( CNpcPath::SINGLE_USE_PATH ); m_carSpeed = m_speed << 8; + m_isActivated = false; + + sBBox boundingBox = m_modelGfx->GetBBox(); + boundingBox.YMin = boundingBox.YMax - 32; + setCollisionSize( ( boundingBox.XMax - boundingBox.XMin ), ( boundingBox.YMax - boundingBox.YMin ) ); + setCollisionCentreOffset( ( boundingBox.XMax + boundingBox.XMin ) >> 1, ( boundingBox.YMax + boundingBox.YMin ) >> 1 ); + calculateNonRotatedCollisionData(); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -51,95 +58,120 @@ void CNpcCartPlatform::processMovement( int _frames ) bool pathComplete; - m_npcPath.thinkFlat( Pos, &pathComplete, &distX, &distY, &heading ); - - if ( !pathComplete ) + if ( m_isActivated ) { - moveX = ( m_carSpeed >> 8 ) * _frames; + m_npcPath.thinkFlat( Pos, &pathComplete, &distX, &distY, &heading ); - if ( heading == 2048 ) + if ( !pathComplete ) { - moveX = -moveX; + moveX = ( m_carSpeed >> 8 ) * _frames; + + if ( heading == 2048 ) + { + moveX = -moveX; + } } - } - // check for vertical movement + // check for vertical movement - s32 checkDist = yMovement + 50; + s32 checkDist = yMovement + 50; - groundHeight = CGameScene::getCollision()->getHeightFromGround( Pos.vx + moveX, Pos.vy, checkDist ); + groundHeight = CGameScene::getCollision()->getHeightFromGround( Pos.vx + moveX, Pos.vy, checkDist ); - if ( groundHeight < checkDist ) - { - // groundHeight <= yMovement indicates either just above ground or on or below ground + if ( groundHeight < checkDist ) + { + // groundHeight <= yMovement indicates either just above ground or on or below ground - moveY = groundHeight; + moveY = groundHeight; + } + else + { + // fall + + moveY = yMovement; + } + + if ( moveY < 0 ) + { + m_carSpeed -= 20; + + if ( m_carSpeed < ( 2 << 8 ) ) + { + m_carSpeed = ( 2 << 8 ); + } + } + else if ( moveY > 0 ) + { + m_carSpeed += 20; + + if ( m_carSpeed > ( 6 << 8 ) ) + { + m_carSpeed = ( 6 << 8 ); + } + } + + Pos.vx += moveX; + Pos.vy += moveY; + + // sort out draw rotation + + DVECTOR testPos1, testPos2; + + testPos1 = testPos2 = Pos; + testPos1.vx -= 10; + testPos2.vx += 10; + + u8 sensorDist = 16; + + s32 yDiff; + + yDiff = CGameScene::getCollision()->getHeightFromGround( testPos1.vx, testPos1.vy, sensorDist + 1 ); + + if ( yDiff <= sensorDist ) + { + // only use if there is ground present + + testPos1.vy += yDiff; + } + + yDiff = CGameScene::getCollision()->getHeightFromGround( testPos2.vx, testPos2.vy, sensorDist + 1 ); + + if ( yDiff <= sensorDist ) + { + // only use if there is ground present + + testPos2.vy += yDiff; + } + + s32 xDist = testPos2.vx - testPos1.vx; + s32 yDist = testPos2.vy - testPos1.vy; + + heading = ratan2( yDist, xDist ); + + setCollisionAngle( heading ); } else { - // fall + groundHeight = CGameScene::getCollision()->getHeightFromGround( Pos.vx, Pos.vy, yMovement + 16 ); - moveY = yMovement; - } - - if ( moveY < 0 ) - { - m_carSpeed -= 20; - - if ( m_carSpeed < ( 2 << 8 ) ) + if ( groundHeight <= yMovement ) { - m_carSpeed = ( 2 << 8 ); + moveY = groundHeight; + } + else + { + // fall + + moveY = yMovement; + } + + Pos.vy += moveY; + + if ( m_contact ) + { + m_isActivated = true; } } - else if ( moveY > 0 ) - { - m_carSpeed += 20; - - if ( m_carSpeed > ( 6 << 8 ) ) - { - m_carSpeed = ( 6 << 8 ); - } - } - - Pos.vx += moveX; - Pos.vy += moveY; - - // sort out draw rotation - - DVECTOR testPos1, testPos2; - - testPos1 = testPos2 = Pos; - testPos1.vx -= 10; - testPos2.vx += 10; - - u8 sensorDist = 16; - - s32 yDiff; - - yDiff = CGameScene::getCollision()->getHeightFromGround( testPos1.vx, testPos1.vy, sensorDist + 1 ); - - if ( yDiff <= sensorDist ) - { - // only use if there is ground present - - testPos1.vy += yDiff; - } - - yDiff = CGameScene::getCollision()->getHeightFromGround( testPos2.vx, testPos2.vy, sensorDist + 1 ); - - if ( yDiff <= sensorDist ) - { - // only use if there is ground present - - testPos2.vy += yDiff; - } - - s32 xDist = testPos2.vx - testPos1.vx; - s32 yDist = testPos2.vy - testPos1.vy; - - heading = ratan2( yDist, xDist ); - - setCollisionAngle( heading ); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/platform/pcart.h b/source/platform/pcart.h index 1fa453fb0..2300dd0e2 100644 --- a/source/platform/pcart.h +++ b/source/platform/pcart.h @@ -27,6 +27,7 @@ protected: virtual void processMovement( int _frames ); s32 m_carSpeed; + u8 m_isActivated; }; #endif \ No newline at end of file diff --git a/source/platform/platdata.cpp b/source/platform/platdata.cpp index d1a1e1318..b784b3716 100644 --- a/source/platform/platdata.cpp +++ b/source/platform/platdata.cpp @@ -526,6 +526,18 @@ CNpcPlatform::NPC_PLATFORM_DATA CNpcPlatform::m_data[NPC_PLATFORM_TYPE_MAX] = 0, NPC_PLATFORM_TIMER_NONE, }, + + { // NPC_BUBBLE_TUBE_PLATFORM + 2, + 128, + true, + DAMAGE__NONE, + 0, + 2, + NPC_PLATFORM_INFINITE_LIFE, + 0, + NPC_PLATFORM_TIMER_NONE, + }, }; CNpcPlatform::NPC_PLATFORM_UNIT_TYPE CNpcPlatform::mapEditConvertTable[NPC_PLATFORM_TYPE_MAX] = @@ -567,6 +579,7 @@ CNpcPlatform::NPC_PLATFORM_UNIT_TYPE CNpcPlatform::mapEditConvertTable[NPC_PLATF NPC_LIFT_PLATFORM, NPC_LOVE_BOAT_PLATFORM, NPC_STEERABLE_OILDRUM_PLATFORM, + NPC_BUBBLE_TUBE_PLATFORM, NPC_CONVEYOR_PLATFORM, NPC_PLAYER_BUBBLE_PLATFORM, NPC_CLAM_PLATFORM, diff --git a/source/platform/platform.cpp b/source/platform/platform.cpp index 827500518..440d371c5 100644 --- a/source/platform/platform.cpp +++ b/source/platform/platform.cpp @@ -191,6 +191,10 @@ #include "platform\psoil.h" #endif +#ifndef __PLATFORM_PBUBTUBE_H__ +#include "platform\pbubtube.h" +#endif + #include "fx\fx.h" #include "fx\fxjfish.h" @@ -441,6 +445,12 @@ CNpcPlatform *CNpcPlatform::Create(int Type) break; } + case NPC_BUBBLE_TUBE_PLATFORM: + { + platform = new ("bubble tube platform") CNpcBubbleTubePlatform; + break; + } + default: { ASSERT( 0 ); diff --git a/source/platform/platform.h b/source/platform/platform.h index 9070db7bf..70bc4f47c 100644 --- a/source/platform/platform.h +++ b/source/platform/platform.h @@ -94,6 +94,7 @@ public: NPC_LIFT_PLATFORM, NPC_LOVE_BOAT_PLATFORM, NPC_STEERABLE_OILDRUM_PLATFORM, + NPC_BUBBLE_TUBE_PLATFORM, NPC_PLATFORM_TYPE_MAX, }; enum diff --git a/tools/Data/bin/MkLevel.ini b/tools/Data/bin/MkLevel.ini index 85daced0e..383ef0932 100644 --- a/tools/Data/bin/MkLevel.ini +++ b/tools/Data/bin/MkLevel.ini @@ -124,6 +124,7 @@ OilRigPlatform=1 RockBridge=32 SteamSwitch=33 LiftPlatform=34 +BubbleTubePlatform=37 ################################################ # Triggers diff --git a/tools/MapEdit/platform.ini b/tools/MapEdit/platform.ini index 32752c861..b78e8b28c 100644 --- a/tools/MapEdit/platform.ini +++ b/tools/MapEdit/platform.ini @@ -144,3 +144,6 @@ Gfx=..\..\Graphics\platforms\steam_switch\steam_switch.gin [LiftPlatform] Gfx=..\..\Graphics\platforms\Industrial\Industrial.gin + +[BubbleTubePlatform] +Gfx=..\..\Graphics\platforms\Oilrig2\oilrigplatform2.gin diff --git a/users/paul/spongebob project/spongebob project.dsp b/users/paul/spongebob project/spongebob project.dsp index 592b5c03e..001f2fdc9 100644 --- a/users/paul/spongebob project/spongebob project.dsp +++ b/users/paul/spongebob project/spongebob project.dsp @@ -1425,6 +1425,14 @@ SOURCE=..\..\..\source\platform\pbubble.h # End Source File # Begin Source File +SOURCE=..\..\..\source\platform\pbubtube.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\source\platform\pbubtube.h +# End Source File +# Begin Source File + SOURCE=..\..\..\source\platform\pbwheel.cpp # End Source File # Begin Source File