diff --git a/makefile.gaz b/makefile.gaz index 13a9b26c5..8512e1e63 100644 --- a/makefile.gaz +++ b/makefile.gaz @@ -270,6 +270,7 @@ player_src := demoplay \ pmfly \ pmjelly \ pmnet \ + pmcart \ psbutt \ pslook \ psduck \ @@ -279,7 +280,8 @@ player_src := demoplay \ psjmpbck \ psjump \ psrun \ - psspring + psspring \ + pscart script_src := script \ function diff --git a/source/player/player.cpp b/source/player/player.cpp index b8adc2353..a9058c21e 100644 --- a/source/player/player.cpp +++ b/source/player/player.cpp @@ -65,6 +65,10 @@ #include "player\pmjelly.h" #endif +#ifndef __PLAYER_PMCART_H__ +#include "player\pmcart.h" +#endif + #ifndef __GFX_FONT_H__ #include "gfx\font.h" #endif @@ -212,6 +216,7 @@ static const char *s_modeText[NUM_PLAYERMODES]= "JELLY LAUNCHER", "DEAD", "FLY", + "CART", }; #endif @@ -232,6 +237,7 @@ CPlayerModeCoralBlower PLAYERMODECORALBLOWER; CPlayerModeJellyLauncher PLAYERMODEJELLYLAUNCHER; CPlayerModeDead PLAYERMODEDEAD; CPlayerModeFly PLAYERMODEFLY; +CPlayerModeCart PLAYERMODECART; CPlayerMode *CPlayer::s_playerModes[NUM_PLAYERMODES]= { @@ -244,6 +250,7 @@ CPlayerMode *CPlayer::s_playerModes[NUM_PLAYERMODES]= &PLAYERMODEJELLYLAUNCHER, // PLAYER_MODE_JELLY_LAUNCHER &PLAYERMODEDEAD, // PLAYER_MODE_DEAD &PLAYERMODEFLY, // PLAYER_MODE_FLY + &PLAYERMODECART, // PLAYER_MODE_CART }; @@ -307,6 +314,7 @@ PLAYER_ADDONS s_addonNumbers[NUM_PLAYERMODES]= PLAYER_ADDON_JELLYLAUNCHER, // PLAYER_MODE_JELLY_LAUNCHER NO_ADDON, // PLAYER_MODE_DEAD NO_ADDON, // PLAYER_MODE_FLY + NO_ADDON, // PLAYER_MODE_CART }; static s8 s_animMapNet[NUM_PLAYER_ADDONS][NUM_ANIM_SPONGEBOB]= @@ -730,11 +738,10 @@ if(newmode!=-1) { if ( ( (CNpcPlatform *) platform )->isCart() ) { - Pos.vx = platform->getPos().vx; - Pos.vy = platform->getPos().vy; - - int platformOffset = ( ( CNpcPlatform* ) platform )->getHeightFromPlatformAtPosition( Pos.vx, Pos.vy ); - Pos.vy += platformOffset; + if ( m_currentMode != PLAYER_MODE_CART ) + { + setMode( PLAYER_MODE_CART ); + } } else { @@ -811,6 +818,7 @@ if(PadGetDown(0)&PAD_TRIANGLE) PICKUP__JELLY_LAUNCHER, // PLAYER_MODE_JELLY_LAUNCHER, -1, // PLAYER_MODE_DEAD, -1, // PLAYER_MODE_FLY, + -1, // PLAYER_MODE_CART, }; int pickupToDrop; diff --git a/source/player/player.h b/source/player/player.h index c5500dffa..37b1dcf40 100644 --- a/source/player/player.h +++ b/source/player/player.h @@ -59,6 +59,8 @@ typedef enum PLAYER_MODE_FLY, + PLAYER_MODE_CART, + NUM_PLAYERMODES, }PLAYER_MODE; @@ -82,6 +84,7 @@ typedef enum STATE_LOOKDOWN, STATE_LOOKDOWNRELAX, STATE_JUMPBACK, + STATE_CART, NUM_STATES, }PLAYER_STATE; diff --git a/source/player/pmodes.cpp b/source/player/pmodes.cpp index 5c0d25f61..0b83c2680 100644 --- a/source/player/pmodes.cpp +++ b/source/player/pmodes.cpp @@ -70,6 +70,10 @@ #include "player\psspring.h" #endif +#ifndef __PLAYER_PSCART_H__ +#include "player\pscart.h" +#endif + #ifndef __PLATFORM_PLATFORM_H__ #include "platform\platform.h" #endif @@ -122,6 +126,7 @@ static CPlayerState *s_stateTable[]= &s_stateLookDown, // STATE_LOOKDOWN &s_stateLookDownRelax, // STATE_LOOKDOWNRELAX &s_stateJumpBack, // STATE_JUMPBACK + &s_stateCart, // STATE_CART }; static PlayerMetrics s_playerMetrics= @@ -199,19 +204,7 @@ void CPlayerModeBase::think() { getStateTable()[m_currentState]->think(this); thinkVerticalMovement(); - - if ( m_player->isOnPlatform() ) - { - CNpcPlatform *platform = (CNpcPlatform *) m_player->isOnPlatform(); - if ( !platform->isCart() ) - { - thinkHorizontalMovement(); - } - } - else - { - thinkHorizontalMovement(); - } + thinkHorizontalMovement(); // Teeter if on an edge if(canTeeter()&&isOnEdge()) @@ -634,18 +627,6 @@ int CPlayerModeBase::slowdown() } void CPlayerModeBase::jump() { - CNpcPlatform *platform; - platform = (CNpcPlatform *) m_player->isOnPlatform(); - if(platform) - { - if ( platform->isCart() ) - { - platform->jump(); - - return; - } - } - DVECTOR moveVel; moveVel=*m_player->getMoveVelocity(); moveVel.vy=-getPlayerMetrics()->m_metric[PM__JUMP_VELOCITY]<getIsInWater();} int getIsHealthFullSoICanStopSoakingUp() {return m_player->getIsHealthFullSoICanStopSoakingUp();} diff --git a/source/player/pscart.cpp b/source/player/pscart.cpp index 2e5a82f0c..4047e9ee7 100644 --- a/source/player/pscart.cpp +++ b/source/player/pscart.cpp @@ -85,6 +85,10 @@ void CPlayerStateCart::think(CPlayerModeBase *_playerMode) { int controlDown; + if ( _playerMode->advanceAnimFrameAndCheckForEndOfAnim() ) + { + _playerMode->setAnimNo( ANIM_SPONGEBOB_IDLEBREATH ); + } controlDown=_playerMode->getPadInputDown(); if(controlDown&PI_JUMP) diff --git a/users/paul/spongebob project/spongebob project.dsp b/users/paul/spongebob project/spongebob project.dsp index 001f2fdc9..1e83e78d4 100644 --- a/users/paul/spongebob project/spongebob project.dsp +++ b/users/paul/spongebob project/spongebob project.dsp @@ -1703,6 +1703,14 @@ SOURCE=..\..\..\source\player\psbutt.h # End Source File # Begin Source File +SOURCE=..\..\..\source\player\pscart.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\source\player\pscart.h +# End Source File +# Begin Source File + SOURCE=..\..\..\source\player\psduck.cpp # End Source File # Begin Source File @@ -1796,6 +1804,14 @@ SOURCE=..\..\..\source\player\pmbubble.h # End Source File # Begin Source File +SOURCE=..\..\..\source\player\pmcart.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\source\player\pmcart.h +# End Source File +# Begin Source File + SOURCE=..\..\..\source\player\pmchop.cpp # End Source File # Begin Source File