diff --git a/source/player/player.cpp b/source/player/player.cpp index 4a5b2ddee..2e1ab65d8 100644 --- a/source/player/player.cpp +++ b/source/player/player.cpp @@ -417,13 +417,13 @@ m_fontBank->print(40,40,posBuf); // Render if(m_invincibleFrameCount==0||m_invincibleFrameCount&2) { - DVECTOR Pos= + DVECTOR sbPos= { SCREEN_GEOM_CENTRE_X+m_playerScreenGeomPos.vx, SCREEN_GEOM_CENTRE_Y+m_playerScreenGeomPos.vy }; - m_actorGfx->Render(Pos,m_animNo,m_animFrame>>sbanimspeed,m_facing==FACING_RIGHT?0:1); - m_currentPlayerModeClass->render(); + renderSb(&sbPos,m_animNo,m_animFrame>>sbanimspeed); + m_currentPlayerModeClass->render(&sbPos); } @@ -680,6 +680,19 @@ void CPlayer::respawn() clearPlatform(); } + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +void CPlayer::renderSb(DVECTOR *_pos,int _animNo,int _animFrame) +{ + m_actorGfx->Render(*_pos,_animNo,_animFrame,m_facing==FACING_RIGHT?0:1); +} + + /*---------------------------------------------------------------------- Function: Purpose: diff --git a/source/player/player.h b/source/player/player.h index 1f2cade41..d691e9fc6 100644 --- a/source/player/player.h +++ b/source/player/player.h @@ -180,6 +180,7 @@ public: int m_frame; CSoundMediator::SFXID m_sfxId; } AnimFrameSfx; + void renderSb(DVECTOR *_pos,int _animNo,int _animFrame); private: typedef struct { diff --git a/source/player/pmbloon.cpp b/source/player/pmbloon.cpp index d3c22c840..844b24aae 100644 --- a/source/player/pmbloon.cpp +++ b/source/player/pmbloon.cpp @@ -67,31 +67,6 @@ static PlayerMetrics s_playerMetrics= } }; -/*---------------------------------------------------------------------- - Function: - Purpose: - Params: - Returns: - ---------------------------------------------------------------------- */ -void CPlayerModeBalloon::initialise(class CPlayer *_player) -{ - CPlayerModeBase::initialise(_player); - m_sprites=new ("BalloonSprite") SpriteBank(); - m_sprites->load(INGAMEFX_INGAMEFX_SPR); -} - -/*---------------------------------------------------------------------- - Function: - Purpose: - Params: - Returns: - ---------------------------------------------------------------------- */ -void CPlayerModeBalloon::shutdown() -{ - m_sprites->dump(); delete m_sprites; - CPlayerModeBase::shutdown(); -} - /*---------------------------------------------------------------------- Function: Purpose: @@ -102,7 +77,6 @@ void CPlayerModeBalloon::enter() { CPlayerModeBase::enter(); CSoundMediator::playSfx(CSoundMediator::SFX_BALLOON_INFLATE); - m_balloonTimer=BALLOON_TIME; } /*---------------------------------------------------------------------- @@ -114,12 +88,6 @@ void CPlayerModeBalloon::enter() void CPlayerModeBalloon::think() { CPlayerModeBase::think(); - if(--m_balloonTimer==0||getPadInputDown()&PI_ACTION) - { - PAUL_DBGMSG("*pop*"); - CSoundMediator::playSfx(CSoundMediator::SFX_BALLOON_POP); - m_player->setMode(PLAYER_MODE_FULLUNARMED); - } } /*---------------------------------------------------------------------- @@ -129,21 +97,17 @@ void CPlayerModeBalloon::think() Returns: ---------------------------------------------------------------------- */ int balloonx=-14; -int balloony=-90; -void CPlayerModeBalloon::render() +int balloony=-120; +int balloonsize=350; +void CPlayerModeBalloon::render(DVECTOR *_pos) { - DVECTOR ofs,pos; + DVECTOR pos; + CPlayerModeBase::render(); - if(m_balloonTimer>BALLOON_FLASH_TIME|| - m_balloonTimer&2) - { - ofs=CLevel::getCameraPos(); - pos=m_player->getPlayerPos(); - pos.vx+=balloonx-ofs.vx; - pos.vy+=balloony-ofs.vy; - m_sprites->printFT4(FRM__BALLOON,pos.vx,pos.vy,0,0,0); - } + pos.vx=_pos->vx+balloonx; + pos.vy=_pos->vy+balloony; + m_player->getSpriteBank()->printFT4Scaled(FRM__BALLOON,pos.vx,pos.vy,0,0,5,balloonsize); } /*---------------------------------------------------------------------- diff --git a/source/player/pmbloon.h b/source/player/pmbloon.h index 1ed798fb2..7686bc394 100644 --- a/source/player/pmbloon.h +++ b/source/player/pmbloon.h @@ -37,24 +37,12 @@ class CPlayerModeBalloon : public CPlayerModeBase { public: - virtual void initialise(class CPlayer *_player); - virtual void shutdown(); virtual void enter(); virtual void think(); - virtual void render(); + virtual void render(DVECTOR *_pos); virtual int canFallForever() {return true;} virtual const struct PlayerMetrics *getPlayerMetrics(); - -private: - enum - { - BALLOON_TIME=10*60, - BALLOON_FLASH_TIME=2*60, - }; - int m_balloonTimer; - - class SpriteBank *m_sprites; }; diff --git a/source/player/pmdead.cpp b/source/player/pmdead.cpp index 078b33b42..b0478f2db 100644 --- a/source/player/pmdead.cpp +++ b/source/player/pmdead.cpp @@ -24,6 +24,11 @@ /* Data ---- */ +#ifndef __ANIM_SPONGEBOB_HEADER__ +#include +#endif + + /*---------------------------------------------------------------------- Tyepdefs && Defines ------------------- */ @@ -67,5 +72,24 @@ void CPlayerModeDead::think() } } +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +/* +void CPlayerModeDead::render(DVECTOR *_pos) +{ + DVECTOR deadSbPos; + + deadSbPos=*_pos; + deadSbPos.vy-=m_deadTime; + + m_player->renderSb(&deadSbPos,ANIM_SPONGEBOB_DEATHANGLE,0); +} +*/ + + /*=========================================================================== end */ diff --git a/source/player/pmdead.h b/source/player/pmdead.h index 047c533d9..3916d5cb0 100644 --- a/source/player/pmdead.h +++ b/source/player/pmdead.h @@ -39,6 +39,7 @@ class CPlayerModeDead : public CPlayerMode public: virtual void enter(); virtual void think(); +// virtual void render(DVECTOR *_pos); private: // Player can press ACTION to respawn after death diff --git a/source/player/pmodes.h b/source/player/pmodes.h index f06ca8906..dcec4caf3 100644 --- a/source/player/pmodes.h +++ b/source/player/pmodes.h @@ -80,7 +80,7 @@ public: virtual void shutdown() {;} virtual void enter() {;} virtual void think() {;} - virtual void render() {;} + virtual void render(DVECTOR *_pos) {;} virtual void renderModeUi() {;} // Ui specific to this mode (eg: ammo) int getPadInputHeld();