From d16d2ce244cea5f8f6abe13b318c00a1b6c91676 Mon Sep 17 00:00:00 2001 From: Charles Date: Tue, 3 Jul 2001 20:49:30 +0000 Subject: [PATCH] --- makefile.gaz | 4 +- source/enemy/nsshark.cpp | 58 ++++++++++++++++--- source/enemy/nsshark.h | 6 ++ source/player/player.cpp | 11 +++- source/player/player.h | 3 + source/player/pmbubble.cpp | 5 ++ source/player/pmjelly.cpp | 5 ++ source/player/pmodes.cpp | 5 ++ .../spongebob project/spongebob project.dsp | 16 +++++ 9 files changed, 104 insertions(+), 9 deletions(-) diff --git a/makefile.gaz b/makefile.gaz index f89e0584a..a5440cbc8 100644 --- a/makefile.gaz +++ b/makefile.gaz @@ -281,6 +281,7 @@ player_src := demoplay \ pmfly \ pmjelly \ pmnet \ + pmswal \ psbutt \ pscart \ psdance \ @@ -293,7 +294,8 @@ player_src := demoplay \ psjump \ pslook \ psrun \ - psspring + psspring \ + psswal save_src := save diff --git a/source/enemy/nsshark.cpp b/source/enemy/nsshark.cpp index e7076d7bd..3bb2b6a65 100644 --- a/source/enemy/nsshark.cpp +++ b/source/enemy/nsshark.cpp @@ -67,6 +67,7 @@ void CNpcSubSharkEnemy::postInit() m_timerTimer = 0; m_salvoCount = 5; + m_carryPlayer = false; m_movementTimer = GameState::getOneSecondInFrames() * ( 1 + ( ( 7 * m_health ) / m_data[m_type].initHealth ) ); CNpcBossEnemy::postInit(); @@ -240,7 +241,7 @@ void CNpcSubSharkEnemy::processMovement( int _frames ) if ( !m_animPlaying ) { m_animPlaying = true; - m_animNo = ANIM_SHARKSUB_SWIM; + m_animNo = ANIM_SHARKSUB_SPRINTOPEN; m_frame = 0; } @@ -276,11 +277,23 @@ void CNpcSubSharkEnemy::processMovement( int _frames ) case SUB_SHARK_CHARGE: { - if ( !m_animPlaying ) + if ( !m_carryPlayer && abs( playerXDist ) < 200 ) { - m_animPlaying = true; - m_animNo = ANIM_SHARKSUB_SWIM; - m_frame = 0; + if ( m_animNo != ANIM_SHARKSUB_CHOMP || !m_animPlaying ) + { + m_animPlaying = true; + m_animNo = ANIM_SHARKSUB_CHOMP; + m_frame = 0; + } + } + else + { + if ( !m_animPlaying ) + { + m_animPlaying = true; + m_animNo = ANIM_SHARKSUB_SPRINTOPEN; + m_frame = 0; + } } s32 distX, distY; @@ -332,10 +345,33 @@ void CNpcSubSharkEnemy::processMovement( int _frames ) processGenericGotoTarget( _frames, distX, distY, m_speed ); } + if ( m_carryPlayer ) + { + // spit out player + + CPlayer *player = GameScene.getPlayer(); + player->setMode( m_oldPlayerMode ); + m_carryPlayer = false; + + DVECTOR move; + move.vx = 16 * _frames; + move.vy = -16 * _frames; + + player->shove( move ); + player->setMoveVelocity( &move ); + } + break; } } + if ( m_carryPlayer ) + { + CPlayer *player = GameScene.getPlayer(); + + player->setPos( Pos ); + } + /*if ( !m_animPlaying ) { @@ -705,11 +741,19 @@ void CNpcSubSharkEnemy::collidedWith(CThing *_thisThing) if(playerState==ATTACK_STATE__NONE) { - if ( !player->isRecoveringFromHit() ) + CPlayer *player = GameScene.getPlayer(); + + if ( !player->isRecoveringFromHit() && !m_carryPlayer ) { - CPlayer *player = GameScene.getPlayer(); player->takeDamage( m_data[m_type].damageToUserType,REACT__GET_DIRECTION_FROM_THING,(CThing*)this ); } + + if ( m_state == SUB_SHARK_CHARGE && player->getMode() != PLAYER_MODE_SWALLOW ) + { + m_carryPlayer = true; + m_oldPlayerMode = player->getMode(); + player->setMode( PLAYER_MODE_SWALLOW ); + } } else if ( m_invulnerableTimer <= 0 ) { diff --git a/source/enemy/nsshark.h b/source/enemy/nsshark.h index c3dbcefc5..e3831bfa9 100644 --- a/source/enemy/nsshark.h +++ b/source/enemy/nsshark.h @@ -18,6 +18,10 @@ #include "enemy\nboss.h" #endif +#ifndef __PLAYER_PLAYER_H__ +#include "player\player.h" +#endif + class CNpcSubSharkEnemy : public CNpcBossEnemy { @@ -53,6 +57,8 @@ protected: u8 m_salvoCount; s32 m_invulnerableTimer; DVECTOR m_targetPos; + u8 m_carryPlayer; + PLAYER_MODE m_oldPlayerMode; }; #endif \ No newline at end of file diff --git a/source/player/player.cpp b/source/player/player.cpp index db53d1e3c..921d67e55 100644 --- a/source/player/player.cpp +++ b/source/player/player.cpp @@ -74,6 +74,10 @@ #include "player\pmcart.h" #endif +#ifndef __PLAYER_PMSWAL_H__ +#include "player\pmswal.h" +#endif + #ifndef __GFX_FONT_H__ #include "gfx\font.h" #endif @@ -205,6 +209,7 @@ static const char *s_modeText[NUM_PLAYERMODES]= "DEAD", "FLY", "CART", + "SWALLOW", }; #endif @@ -226,6 +231,7 @@ CPlayerModeJellyLauncher PLAYERMODEJELLYLAUNCHER; CPlayerModeDead PLAYERMODEDEAD; CPlayerModeFly PLAYERMODEFLY; CPlayerModeCart PLAYERMODECART; +CPlayerModeSwallow PLAYERMODESWALLOW; CPlayerMode *CPlayer::s_playerModes[NUM_PLAYERMODES]= { @@ -239,6 +245,7 @@ CPlayerMode *CPlayer::s_playerModes[NUM_PLAYERMODES]= &PLAYERMODEDEAD, // PLAYER_MODE_DEAD &PLAYERMODEFLY, // PLAYER_MODE_FLY &PLAYERMODECART, // PLAYER_MODE_CART + &PLAYERMODESWALLOW, // PLAYER_MODE_SWALLOW }; @@ -301,6 +308,7 @@ PLAYER_ADDONS s_addonNumbers[NUM_PLAYERMODES]= NO_ADDON, // PLAYER_MODE_DEAD NO_ADDON, // PLAYER_MODE_FLY NO_ADDON, // PLAYER_MODE_CART + NO_ADDON, // PLAYER_MODE_SWALLOW }; s8 s_animMapNet[NUM_PLAYER_ADDONS][NUM_ANIM_SPONGEBOB]= @@ -2008,7 +2016,8 @@ void CPlayer::takeDamage(DAMAGE_TYPE _damage,REACT_DIRECTION _reactDirection,CTh if(m_invincibleFrameCount==0&& // Don't take damage if still recovering from the last hit m_invincibilityRingTimer==0&& // Or if we have the invincibility ring on m_currentPlayerModeClass->getState()!=STATE_SOAKUP&& // Or soaking up - m_currentMode!=PLAYER_MODE_DEAD) // Or already dead! :) + m_currentMode!=PLAYER_MODE_DEAD && + m_currentMode!=PLAYER_MODE_SWALLOW) // Or already dead! :) { int ouchThatHurt=true; int ouchThatHurtSoMuchThatImJustGoingToDieNow=false; diff --git a/source/player/player.h b/source/player/player.h index bdfd1d96b..3593e4c05 100644 --- a/source/player/player.h +++ b/source/player/player.h @@ -60,6 +60,7 @@ typedef enum PLAYER_MODE_FLY, PLAYER_MODE_CART, + PLAYER_MODE_SWALLOW, NUM_PLAYERMODES, }PLAYER_MODE; @@ -88,6 +89,7 @@ typedef enum STATE_CART, STATE_FLOAT, STATE_CELEBRATE, + STATE_SWALLOW, NUM_STATES, }PLAYER_STATE; @@ -258,6 +260,7 @@ public: public: void setMode(PLAYER_MODE _mode); + PLAYER_MODE getMode() {return m_currentMode;} int getFacing(); void setFacing(int _facing); int getAnimFrame(); diff --git a/source/player/pmbubble.cpp b/source/player/pmbubble.cpp index 7eb2e158b..fa4109c82 100644 --- a/source/player/pmbubble.cpp +++ b/source/player/pmbubble.cpp @@ -82,6 +82,10 @@ #include "player\psdance.h" #endif +#ifndef __PLAYER_PSSWAL_H__ +#include "player\psswal.h" +#endif + /* Std Lib ------- */ @@ -138,6 +142,7 @@ static CPlayerState *s_stateTable[]= &s_stateCart, // STATE_CART &s_stateFloat, // STATE_FLOAT &s_stateDance, // STATE_CELEBRATE + &s_stateSwallow, // STATE_SWALLOW }; diff --git a/source/player/pmjelly.cpp b/source/player/pmjelly.cpp index 31e222dec..466701626 100644 --- a/source/player/pmjelly.cpp +++ b/source/player/pmjelly.cpp @@ -94,6 +94,10 @@ #include "player\psdance.h" #endif +#ifndef __PLAYER_PSSWAL_H__ +#include "player\psswal.h" +#endif + /* Std Lib ------- */ @@ -150,6 +154,7 @@ static CPlayerState *s_stateTable[]= &s_stateCart, // STATE_CART &s_stateFloat, // STATE_FLOAT &s_stateDance, // STATE_CELEBRATE + &s_stateSwallow, // STATE_SWALLOW }; diff --git a/source/player/pmodes.cpp b/source/player/pmodes.cpp index a84da2576..c482dd1ae 100644 --- a/source/player/pmodes.cpp +++ b/source/player/pmodes.cpp @@ -74,6 +74,10 @@ #include "player\pscart.h" #endif +#ifndef __PLAYER_PSSWAL_H__ +#include "player\psswal.h" +#endif + #ifndef __PLAYER_PSFLOAT_H__ #include "player\psfloat.h" #endif @@ -142,6 +146,7 @@ static CPlayerState *s_stateTable[]= &s_stateCart, // STATE_CART &s_stateFloat, // STATE_FLOAT &s_stateDance, // STATE_CELEBRATE + &s_stateSwallow, // STATE_SWALLOW }; static PlayerMetrics s_playerMetrics= diff --git a/users/paul/spongebob project/spongebob project.dsp b/users/paul/spongebob project/spongebob project.dsp index 658c3c462..121a5c35a 100644 --- a/users/paul/spongebob project/spongebob project.dsp +++ b/users/paul/spongebob project/spongebob project.dsp @@ -1858,6 +1858,14 @@ SOURCE=..\..\..\source\player\pmodes.cpp SOURCE=..\..\..\source\player\pmodes.h # End Source File +# Begin Source File + +SOURCE=..\..\..\source\player\pmswal.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\source\player\pmswal.h +# End Source File # End Group # Begin Group "states" @@ -1968,6 +1976,14 @@ SOURCE=..\..\..\source\player\psspring.h # End Source File # Begin Source File +SOURCE=..\..\..\source\player\psswal.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\source\player\psswal.h +# End Source File +# Begin Source File + SOURCE=..\..\..\source\player\pstates.h # End Source File # End Group