From cb8f318494027cf1a710d437a1c988420ec13f7e Mon Sep 17 00:00:00 2001 From: Paul Date: Fri, 30 Mar 2001 17:47:00 +0000 Subject: [PATCH] --- data/translations/text.dat | 2 + makefile.gaz | 3 + makefile.gfx | 2 +- source/game/pause.cpp | 15 ++- source/pickups/pbubmix.cpp | 20 ++- source/pickups/pbubmix.h | 4 +- source/pickups/pickup.cpp | 8 ++ source/pickups/pickup.h | 1 + source/player/player.cpp | 31 +++-- source/player/player.h | 5 +- source/player/pmcoral.cpp | 124 +++++------------- source/player/pmcoral.h | 18 ++- .../spongebob project/spongebob project.dsp | 16 +++ 13 files changed, 128 insertions(+), 121 deletions(-) diff --git a/data/translations/text.dat b/data/translations/text.dat index 8dc2dedb9..e1370433a 100644 --- a/data/translations/text.dat +++ b/data/translations/text.dat @@ -159,6 +159,8 @@ eng=Set FULLUNARMED mode eng=Set SQUEAKYBOOTS mode [STR__DEBUG__BALLOON_MODE] eng=Set BALLOON mode +[STR__DEBUG__BUBBLEMIXTURE_MODE] +eng=Set BUBBLE MIXTURE mode [STR__DEBUG__NET_MODE] eng=Set NET mode [STR__DEBUG__CORALBLOWER_MODE] diff --git a/makefile.gaz b/makefile.gaz index 10d96ff0a..5ec1b97be 100644 --- a/makefile.gaz +++ b/makefile.gaz @@ -144,6 +144,7 @@ paul_src := paul \ pickups_src := pickup \ pballoon \ + pblower \ pbubmix \ pglasses \ phealth \ @@ -159,7 +160,9 @@ player_src := demoplay \ player \ pmodes \ pmbloon \ + pmbubble \ pmchop \ + pmcoral \ pmdead \ pmfly \ psbutt \ diff --git a/makefile.gfx b/makefile.gfx index 388477edc..36cfc3a73 100644 --- a/makefile.gfx +++ b/makefile.gfx @@ -301,7 +301,7 @@ INGAMEFX_GFX_NONTRANS_IN := $(foreach FILE,$(INGAMEFX_GFX_NONTRANS),$(INGAMEFX_N PICKUP_GFX_DIR := $(GRAF_DIR)/pickups PICKUP_GFX := +spatula +pants +health100 +health50 +health25 +glint1 +glint2 +glint3 +glint4 \ +jellyammo +bubblemixture +glasses +shoe +balloon +helmet \ - +teeth + +teeth +blower PICKUP_GFX_IN := $(foreach FILE,$(PICKUP_GFX),$(PICKUP_GFX_DIR)/$(FILE).bmp) INGAMEFX_GFX_TRANS := +bubble_1 +bubble_2 +bubble_3 diff --git a/source/game/pause.cpp b/source/game/pause.cpp index 961dfeeee..0ac23e92a 100644 --- a/source/game/pause.cpp +++ b/source/game/pause.cpp @@ -115,11 +115,16 @@ void CPauseMenu::init() STR__DEBUG__BALLOON_MODE, &newmode,PLAYER_MODE_BALLOON); xpos+=TEXT_SPACING; -// CGUIFactory::createValueButtonFrame(m_guiFrame, -// (FRAME_WIDTH-TEXT_BOX_WIDTH)/2,xpos,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT, -// STR__DEBUG__CORALBLOWER_MODE, -// &newmode,PLAYER_MODE_CORALBLOWER); -// xpos+=TEXT_SPACING; + CGUIFactory::createValueButtonFrame(m_guiFrame, + (FRAME_WIDTH-TEXT_BOX_WIDTH)/2,xpos,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT, + STR__DEBUG__BUBBLEMIXTURE_MODE, + &newmode,PLAYER_MODE_BUBBLE_MIXTURE); + xpos+=TEXT_SPACING; + CGUIFactory::createValueButtonFrame(m_guiFrame, + (FRAME_WIDTH-TEXT_BOX_WIDTH)/2,xpos,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT, + STR__DEBUG__CORALBLOWER_MODE, + &newmode,PLAYER_MODE_CORALBLOWER); + xpos+=TEXT_SPACING; CGUIFactory::createValueButtonFrame(m_guiFrame, (FRAME_WIDTH-TEXT_BOX_WIDTH)/2,xpos,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT, STR__DEBUG__DEAD_MODE, diff --git a/source/pickups/pbubmix.cpp b/source/pickups/pbubmix.cpp index 1a143b18a..dca5e9d15 100644 --- a/source/pickups/pbubmix.cpp +++ b/source/pickups/pbubmix.cpp @@ -25,6 +25,10 @@ #include "utils\mathtab.h" #endif +#ifndef __PLAYER_PLAYER_H__ +#include "player\player.h" +#endif + /* Std Lib ------- */ @@ -61,7 +65,7 @@ ---------------------------------------------------------------------- */ void CBubbleMixturePickup::init() { - CBasePickup::init(); + CBaseRespawningPickup::init(); m_sin=0; } @@ -73,7 +77,19 @@ void CBubbleMixturePickup::init() ---------------------------------------------------------------------- */ void CBubbleMixturePickup::collect(class CPlayer *_player) { - CBasePickup::collect(_player); + _player->setMode(PLAYER_MODE_BUBBLE_MIXTURE); + CBaseRespawningPickup::collect(_player); +} + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +int CBubbleMixturePickup::getRespawnTime() +{ + return 60*10; } /*---------------------------------------------------------------------- diff --git a/source/pickups/pbubmix.h b/source/pickups/pbubmix.h index 3a1e048ee..980eb9cdf 100644 --- a/source/pickups/pbubmix.h +++ b/source/pickups/pbubmix.h @@ -34,7 +34,7 @@ Structure defintions -------------------- */ -class CBubbleMixturePickup : public CBasePickup +class CBubbleMixturePickup : public CBaseRespawningPickup { public: virtual void init(); @@ -42,6 +42,8 @@ public: virtual void collect(class CPlayer *_player); protected: + virtual int getRespawnTime(); + virtual void thinkPickup(int _frames); virtual void renderPickup(DVECTOR *_pos); diff --git a/source/pickups/pickup.cpp b/source/pickups/pickup.cpp index fb157e065..2e08f58e4 100644 --- a/source/pickups/pickup.cpp +++ b/source/pickups/pickup.cpp @@ -47,6 +47,10 @@ #include "pickups\pbubmix.h" #endif +#ifndef __PICKUPS_PBLOWER_H__ +#include "pickups\pblower.h" +#endif + #ifndef __PICKUPS_PGLASSES_H__ #include "pickups\pglasses.h" #endif @@ -323,6 +327,10 @@ CBasePickup *createPickup(const PICKUP_TYPE _type,const DVECTOR *_pos) pickup=new ("HelmetPickup") CHelmetPickup(); break; + case PICKUP__CORAL_BLOWER: + pickup=new ("CoralBlowerPickup") CCoralBlowerPickup(); + break; + case PICKUP__QUEST_ITEM__TEST: pickup=new ("QuestItemPickup") CTestQuestItemPickup(); break; diff --git a/source/pickups/pickup.h b/source/pickups/pickup.h index 75109eafd..80ac14aa7 100644 --- a/source/pickups/pickup.h +++ b/source/pickups/pickup.h @@ -43,6 +43,7 @@ typedef enum PICKUP__SQUEAKY_SHOES, PICKUP__BALLOON, PICKUP__HELMET, + PICKUP__CORAL_BLOWER, PICKUP__QUEST_ITEM__TEST, // Needs to be one of these for each quest item ( I think ) } PICKUP_TYPE; diff --git a/source/player/player.cpp b/source/player/player.cpp index 1007f33ec..90a8d4c4a 100644 --- a/source/player/player.cpp +++ b/source/player/player.cpp @@ -33,12 +33,20 @@ #include "player\pmodes.h" #endif +#ifndef __PLAYER_PMBLOON_H__ +#include "player\pmbloon.h" +#endif + +#ifndef __PLAYER_PMBUBBLE_H__ +#include "player\pmbubble.h" +#endif + #ifndef __PLAYER_PMCHOP_H__ #include "player\pmchop.h" #endif -#ifndef __PLAYER_PMBLOON_H__ -#include "player\pmbloon.h" +#ifndef __PLAYER_PMCORAL_H__ +#include "player\pmcoral.h" #endif #ifndef __PLAYER_PMDEAD_H__ @@ -140,8 +148,9 @@ static const char *s_modeText[NUM_PLAYERMODES]= "BASICUNARMED", "FULLUNARMED", "BALLOON", -// "NET", -// "CORALBLOWER", + "BUBBLE MIXTURE", + "CORALBLOWER", + "DEAD", "FLY", }; #include "gfx\font.h" @@ -170,17 +179,21 @@ int CAMERA_SCROLLSPEED=60; // Speed of the scroll ( 60=1 tile scrolled every -CPlayerModeBase PLAYERMODE; -CPlayerModeChop PLAYERMODECHOP; -CPlayerModeBalloon PLAYERMODEBALLOON; -CPlayerModeDead PLAYERMODEDEAD; -CPlayerModeFly PLAYERMODEFLY; +CPlayerModeBase PLAYERMODE; +CPlayerModeChop PLAYERMODECHOP; +CPlayerModeBalloon PLAYERMODEBALLOON; +CPlayerModeBubbleMixture PLAYERMODEBUBBLEMIXTURE; +CPlayerModeCoralBlower PLAYERMODECORALBLOWER; +CPlayerModeDead PLAYERMODEDEAD; +CPlayerModeFly PLAYERMODEFLY; CPlayerMode *CPlayer::s_playerModes[NUM_PLAYERMODES]= { &PLAYERMODE, // PLAYER_MODE_BASICUNARMED &PLAYERMODECHOP, // PLAYER_MODE_FULLUNARMED &PLAYERMODEBALLOON, // PLAYER_MODE_BALLOON + &PLAYERMODEBUBBLEMIXTURE, // PLAYER_MODE_BUBBLE_MIXTURE + &PLAYERMODECORALBLOWER, // PLAYER_MODE_CORALBLOWER &PLAYERMODEDEAD, // PLAYER_MODE_DEAD &PLAYERMODEFLY, // PLAYER_MODE_FLY }; diff --git a/source/player/player.h b/source/player/player.h index 49500de9d..e3ba31f1d 100644 --- a/source/player/player.h +++ b/source/player/player.h @@ -51,10 +51,9 @@ typedef enum PLAYER_MODE_BASICUNARMED, PLAYER_MODE_FULLUNARMED, PLAYER_MODE_BALLOON, - //PLAYER_MODE_BUBBLE_MIXTURE, - //PLAYER_MODE_HELMET, + PLAYER_MODE_BUBBLE_MIXTURE, // PLAYER_MODE_NET, -// PLAYER_MODE_CORALBLOWER, + PLAYER_MODE_CORALBLOWER, //PLAYER_MODE_JELLY_LAUNCHER, PLAYER_MODE_DEAD, diff --git a/source/player/pmcoral.cpp b/source/player/pmcoral.cpp index 457efda65..bfde3012f 100644 --- a/source/player/pmcoral.cpp +++ b/source/player/pmcoral.cpp @@ -67,7 +67,8 @@ static PlayerMetrics s_playerMetrics= ---------------------------------------------------------------------- */ void CPlayerModeCoralBlower::enter() { - m_chopping=false; + m_blowerState=BLOWER_STATE__FULL;//BLOWER_STATE__EMPTY; + CSoundMediator::playSfx(CSoundMediator::SFX_ITEM__CORAL_BLOWER); } /*---------------------------------------------------------------------- @@ -76,39 +77,44 @@ void CPlayerModeCoralBlower::enter() Params: Returns: ---------------------------------------------------------------------- */ +int cbstate=0; void CPlayerModeCoralBlower::think() { - // If we're chopping then restore the 'real' anim number/frame before - // doing the think so that the rest of the code doesn't know what - // is going on ;) - if(m_chopping) - { - setAnimNo(m_savedAnimNo); - setAnimFrame(m_savedAnimFrame); - } CPlayerModeBase::think(); - // Start to chop? - if(!m_chopping&&getPadInputDown()&PI_ACTION&&canAttackFromThisState()) + switch(m_blowerState) { - m_chopFrame=0; - m_chopping=true; - } - - // Chopping? - if(m_chopping) - { - m_player->setAnimNo(ANIM_SPONGEBOB_KARATE); - m_player->setAnimFrame(m_chopFrame); - m_chopFrame++; - if(m_chopFrame>=m_player->getAnimFrameCount()) - { -PAUL_DBGMSG("restore %d,%d",m_savedAnimNo,m_savedAnimFrame); - m_player->setAnimNo(m_savedAnimNo); - m_player->setAnimFrame(m_savedAnimFrame); - m_chopping=false; - } + case BLOWER_STATE__EMPTY: + if(getPadInputDown()&PI_ACTION&&getState()==STATE_IDLE) + { + m_blowerState=BLOWER_STATE__SUCKING; + } + break; + case BLOWER_STATE__SUCKING: + if(!(getPadInputHeld()&PI_ACTION&&getState()==STATE_IDLE)) + { + m_blowerState=BLOWER_STATE__EMPTY; + } + break; + case BLOWER_STATE__FULL: + if(getPadInputDown()&PI_ACTION&&getState()==STATE_IDLE) + { + m_blowerState=BLOWER_STATE__AIMING; + } + break; + case BLOWER_STATE__AIMING: + if(getState()==STATE_IDLE) + { + m_blowerState=BLOWER_STATE__EMPTY; + } + if(!getPadInputHeld()&PI_ACTION) + { + // Fire! + m_blowerState=BLOWER_STATE__EMPTY; + } + break; } +cbstate=m_blowerState; } /*---------------------------------------------------------------------- @@ -122,67 +128,5 @@ const struct PlayerMetrics *CPlayerModeCoralBlower::getPlayerMetrics() return &s_playerMetrics; } -/*---------------------------------------------------------------------- - Function: - Purpose: - Params: - Returns: - ---------------------------------------------------------------------- */ -void CPlayerModeCoralBlower::setAnimNo(int _animNo) -{ - CPlayerModeBase::setAnimNo(_animNo); - m_savedAnimNo=_animNo; -} - -void CPlayerModeCoralBlower::setAnimFrame(int _animFrame) -{ - CPlayerModeBase::setAnimFrame(_animFrame); - m_savedAnimFrame=_animFrame; -} - -/*---------------------------------------------------------------------- - Function: - Purpose: - Params: - Returns: - ---------------------------------------------------------------------- */ -int CPlayerModeCoralBlower::isInAttackState() -{ - return m_chopping||CPlayerModeBase::isInAttackState(); -} - -/*---------------------------------------------------------------------- - Function: - Purpose: - Params: - Returns: - ---------------------------------------------------------------------- */ -int CPlayerModeCoralBlower::canAttackFromThisState() -{ - int ret=false; - - switch(getState()) - { - case STATE_IDLE: - case STATE_IDLETEETER: - case STATE_JUMP: - case STATE_RUN: - case STATE_FALL: - ret=true; - break; - - case STATE_FALLFAR: - case STATE_BUTTBOUNCE: - case STATE_BUTTFALL: - case STATE_BUTTLAND: - case STATE_DUCK: - case STATE_SOAKUP: - case STATE_GETUP: - break; - } - - return ret; -} - /*=========================================================================== end */ diff --git a/source/player/pmcoral.h b/source/player/pmcoral.h index 4f438de0a..0447d4954 100644 --- a/source/player/pmcoral.h +++ b/source/player/pmcoral.h @@ -42,18 +42,16 @@ public: virtual const struct PlayerMetrics *getPlayerMetrics(); - virtual void setAnimNo(int _animNo); - virtual void setAnimFrame(int _animFrame); - - virtual int isInAttackState(); - private: - int canAttackFromThisState(); - - int m_savedAnimNo,m_savedAnimFrame; - int m_chopFrame; - int m_chopping; + typedef enum + { + BLOWER_STATE__EMPTY, + BLOWER_STATE__SUCKING, + BLOWER_STATE__FULL, + BLOWER_STATE__AIMING, + } BlowerState; + BlowerState m_blowerState; }; diff --git a/users/paul/spongebob project/spongebob project.dsp b/users/paul/spongebob project/spongebob project.dsp index 4003b6aca..12a565057 100644 --- a/users/paul/spongebob project/spongebob project.dsp +++ b/users/paul/spongebob project/spongebob project.dsp @@ -832,6 +832,14 @@ SOURCE=..\..\..\source\player\pmbloon.h # End Source File # Begin Source File +SOURCE=..\..\..\source\player\pmbubble.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\source\player\pmbubble.h +# End Source File +# Begin Source File + SOURCE=..\..\..\source\player\pmchop.cpp # End Source File # Begin Source File @@ -840,6 +848,14 @@ SOURCE=..\..\..\source\player\pmchop.h # End Source File # Begin Source File +SOURCE=..\..\..\source\player\pmcoral.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\source\player\pmcoral.h +# End Source File +# Begin Source File + SOURCE=..\..\..\source\player\pmdead.cpp # End Source File # Begin Source File