This commit is contained in:
Paul 2001-03-31 18:22:38 +00:00
parent ae3e0482ea
commit 48a884f3f0
12 changed files with 174 additions and 27 deletions

View File

@ -83,7 +83,7 @@ void CPauseMenu::init()
m_guiFrame->setOt(OT_POS); m_guiFrame->setOt(OT_POS);
m_guiFrame->setFlags(CGUIObject::FLAG_DRAWBORDER); m_guiFrame->setFlags(CGUIObject::FLAG_DRAWBORDER);
int xpos=TEXT_SPACING; int xpos=TEXT_SPACING/2;
CGUIFactory::createValueButtonFrame(m_guiFrame, CGUIFactory::createValueButtonFrame(m_guiFrame,
(FRAME_WIDTH-TEXT_BOX_WIDTH)/2,xpos,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT, (FRAME_WIDTH-TEXT_BOX_WIDTH)/2,xpos,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT,
STR__PAUSE_MENU__CONTINUE, STR__PAUSE_MENU__CONTINUE,
@ -93,7 +93,9 @@ void CPauseMenu::init()
(FRAME_WIDTH-TEXT_BOX_WIDTH)/2,xpos,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT, (FRAME_WIDTH-TEXT_BOX_WIDTH)/2,xpos,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT,
STR__PAUSE_MENU__QUIT, STR__PAUSE_MENU__QUIT,
&m_quitGameFlag,true); &m_quitGameFlag,true);
xpos+=TEXT_SPACING*2;
xpos+=TEXT_SPACING+(TEXT_SPACING/2);
CGUIFactory::createValueButtonFrame(m_guiFrame, CGUIFactory::createValueButtonFrame(m_guiFrame,
(FRAME_WIDTH-TEXT_BOX_WIDTH)/2,xpos,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT, (FRAME_WIDTH-TEXT_BOX_WIDTH)/2,xpos,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT,
STR__DEBUG__BASICUNARMED_MODE, STR__DEBUG__BASICUNARMED_MODE,
@ -105,11 +107,6 @@ void CPauseMenu::init()
&newmode,PLAYER_MODE_FULLUNARMED); &newmode,PLAYER_MODE_FULLUNARMED);
xpos+=TEXT_SPACING; xpos+=TEXT_SPACING;
#if defined(__USER_paul__) || defined(__USER_charles__) #if defined(__USER_paul__) || defined(__USER_charles__)
// CGUIFactory::createValueButtonFrame(m_guiFrame,
// (FRAME_WIDTH-TEXT_BOX_WIDTH)/2,xpos,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT,
// STR__DEBUG__NET_MODE,
// &newmode,PLAYER_MODE_NET);
// xpos+=TEXT_SPACING;
CGUIFactory::createValueButtonFrame(m_guiFrame, CGUIFactory::createValueButtonFrame(m_guiFrame,
(FRAME_WIDTH-TEXT_BOX_WIDTH)/2,xpos,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT, (FRAME_WIDTH-TEXT_BOX_WIDTH)/2,xpos,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT,
STR__DEBUG__BALLOON_MODE, STR__DEBUG__BALLOON_MODE,
@ -120,6 +117,11 @@ void CPauseMenu::init()
STR__DEBUG__BUBBLEMIXTURE_MODE, STR__DEBUG__BUBBLEMIXTURE_MODE,
&newmode,PLAYER_MODE_BUBBLE_MIXTURE); &newmode,PLAYER_MODE_BUBBLE_MIXTURE);
xpos+=TEXT_SPACING; xpos+=TEXT_SPACING;
CGUIFactory::createValueButtonFrame(m_guiFrame,
(FRAME_WIDTH-TEXT_BOX_WIDTH)/2,xpos,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT,
STR__DEBUG__NET_MODE,
&newmode,PLAYER_MODE_NET);
xpos+=TEXT_SPACING;
CGUIFactory::createValueButtonFrame(m_guiFrame, CGUIFactory::createValueButtonFrame(m_guiFrame,
(FRAME_WIDTH-TEXT_BOX_WIDTH)/2,xpos,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT, (FRAME_WIDTH-TEXT_BOX_WIDTH)/2,xpos,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT,
STR__DEBUG__CORALBLOWER_MODE, STR__DEBUG__CORALBLOWER_MODE,
@ -135,7 +137,6 @@ void CPauseMenu::init()
(FRAME_WIDTH-TEXT_BOX_WIDTH)/2,xpos,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT, (FRAME_WIDTH-TEXT_BOX_WIDTH)/2,xpos,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT,
STR__DEBUG__FLY_MODE, STR__DEBUG__FLY_MODE,
&newmode,PLAYER_MODE_FLY); &newmode,PLAYER_MODE_FLY);
xpos+=TEXT_SPACING;
m_active=false; m_active=false;
} }

View File

@ -61,7 +61,7 @@
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CNetPickup::collect(class CPlayer *_player) void CNetPickup::collect(class CPlayer *_player)
{ {
// _player->setMode(PLAYER_MODE_NET); _player->setMode(PLAYER_MODE_NET);
CBasePickup::collect(_player); CBasePickup::collect(_player);
} }

View File

@ -41,6 +41,10 @@
#include "player\pmbubble.h" #include "player\pmbubble.h"
#endif #endif
#ifndef __PLAYER_PMNET_H__
#include "player\pmnet.h"
#endif
#ifndef __PLAYER_PMCHOP_H__ #ifndef __PLAYER_PMCHOP_H__
#include "player\pmchop.h" #include "player\pmchop.h"
#endif #endif
@ -57,6 +61,14 @@
#include "player\pmfly.h" #include "player\pmfly.h"
#endif #endif
#ifndef __GFX_FONT_H__
#include "gfx\font.h"
#endif
#ifndef __GFX_SPRBANK_H__
#include "gfx\sprbank.h"
#endif
// to be removed // to be removed
#include "gfx\tpage.h" #include "gfx\tpage.h"
@ -149,12 +161,11 @@ static const char *s_modeText[NUM_PLAYERMODES]=
"FULLUNARMED", "FULLUNARMED",
"BALLOON", "BALLOON",
"BUBBLE MIXTURE", "BUBBLE MIXTURE",
"NET",
"CORALBLOWER", "CORALBLOWER",
"DEAD", "DEAD",
"FLY", "FLY",
}; };
#include "gfx\font.h"
FontBank s_debugFont;
#endif #endif
@ -183,6 +194,7 @@ CPlayerModeBase PLAYERMODE;
CPlayerModeChop PLAYERMODECHOP; CPlayerModeChop PLAYERMODECHOP;
CPlayerModeBalloon PLAYERMODEBALLOON; CPlayerModeBalloon PLAYERMODEBALLOON;
CPlayerModeBubbleMixture PLAYERMODEBUBBLEMIXTURE; CPlayerModeBubbleMixture PLAYERMODEBUBBLEMIXTURE;
CPlayerModeNet PLAYERMODENET;
CPlayerModeCoralBlower PLAYERMODECORALBLOWER; CPlayerModeCoralBlower PLAYERMODECORALBLOWER;
CPlayerModeDead PLAYERMODEDEAD; CPlayerModeDead PLAYERMODEDEAD;
CPlayerModeFly PLAYERMODEFLY; CPlayerModeFly PLAYERMODEFLY;
@ -193,6 +205,7 @@ CPlayerMode *CPlayer::s_playerModes[NUM_PLAYERMODES]=
&PLAYERMODECHOP, // PLAYER_MODE_FULLUNARMED &PLAYERMODECHOP, // PLAYER_MODE_FULLUNARMED
&PLAYERMODEBALLOON, // PLAYER_MODE_BALLOON &PLAYERMODEBALLOON, // PLAYER_MODE_BALLOON
&PLAYERMODEBUBBLEMIXTURE, // PLAYER_MODE_BUBBLE_MIXTURE &PLAYERMODEBUBBLEMIXTURE, // PLAYER_MODE_BUBBLE_MIXTURE
&PLAYERMODENET, // PLAYER_MODE_NET
&PLAYERMODECORALBLOWER, // PLAYER_MODE_CORALBLOWER &PLAYERMODECORALBLOWER, // PLAYER_MODE_CORALBLOWER
&PLAYERMODEDEAD, // PLAYER_MODE_DEAD &PLAYERMODEDEAD, // PLAYER_MODE_DEAD
&PLAYERMODEFLY, // PLAYER_MODE_FLY &PLAYERMODEFLY, // PLAYER_MODE_FLY
@ -209,6 +222,13 @@ void CPlayer::init()
{ {
CPlayerThing::init(); CPlayerThing::init();
m_fontBank=new ("PlayerFont") FontBank();
m_fontBank->initialise(&standardFont);
m_fontBank->setOt(5);
m_spriteBank=new ("PlayerSprites") SpriteBank();
m_spriteBank->load(INGAMEFX_INGAMEFX_SPR);
m_layerCollision=NULL; m_layerCollision=NULL;
// m_onPlatform = false; // m_onPlatform = false;
@ -242,11 +262,6 @@ m_animFrame=0;
m_skel.setAng(512); m_skel.setAng(512);
//m_skel.setAngInc(678); //m_skel.setAngInc(678);
#ifdef _STATE_DEBUG_
s_debugFont.initialise(&standardFont);
s_debugFont.setJustification(FontBank::JUST_LEFT);
#endif
setCollisionSize(25,50); setCollisionSize(25,50);
setCollisionCentreOffset(0,-25); setCollisionCentreOffset(0,-25);
@ -266,9 +281,9 @@ void CPlayer::shutdown()
s_playerModes[i]->shutdown(); s_playerModes[i]->shutdown();
} }
#ifdef _STATE_DEBUG_ m_spriteBank->dump(); delete m_spriteBank;
s_debugFont.dump(); m_fontBank->dump(); delete m_fontBank;
#endif
CPlayerThing::shutdown(); CPlayerThing::shutdown();
} }
@ -433,7 +448,7 @@ void CPlayer::render()
#ifdef _STATE_DEBUG_ #ifdef _STATE_DEBUG_
sprintf(posBuf,"%03d (%02d) ,%03d (%02d) = dfg:%+02d",Pos.vx,Pos.vx&0x0f,Pos.vy,Pos.vy&0x0f,getHeightFromGround(Pos.vx,Pos.vy)); sprintf(posBuf,"%03d (%02d) ,%03d (%02d) = dfg:%+02d",Pos.vx,Pos.vx&0x0f,Pos.vy,Pos.vy&0x0f,getHeightFromGround(Pos.vx,Pos.vy));
s_debugFont.print(40,40,posBuf); m_fontBank->print(40,40,posBuf);
#endif #endif
// Render // Render
@ -466,14 +481,13 @@ if(eyes!=-1)
m_skel.Render(this); m_skel.Render(this);
m_currentPlayerModeClass->render(); m_currentPlayerModeClass->render();
SetGeomOffset(SCREEN_GEOM_CENTRE_X,SCREEN_GEOM_CENTRE_Y); SetGeomOffset(SCREEN_GEOM_CENTRE_X,SCREEN_GEOM_CENTRE_Y);
} }
#ifdef _STATE_DEBUG_ #ifdef _STATE_DEBUG_
char buf[128]; char buf[128];
sprintf(buf,"MODE: %s",s_modeText[m_currentMode]); sprintf(buf,"MODE: %s",s_modeText[m_currentMode]);
s_debugFont.print(40,210,buf); m_fontBank->print(40,210,buf);
#endif #endif
@ -507,8 +521,11 @@ if(eyes!=-1)
} }
char lifebuf[5]; char lifebuf[5];
sprintf(lifebuf,"x%d",m_lives); sprintf(lifebuf,"x%d",m_lives);
s_debugFont.print(livesx,livesy,lifebuf); m_fontBank->print(livesx,livesy,lifebuf);
#endif #endif
// Mode specific ui
m_currentPlayerModeClass->renderModeUi();
} }

View File

@ -52,7 +52,7 @@ typedef enum
PLAYER_MODE_FULLUNARMED, PLAYER_MODE_FULLUNARMED,
PLAYER_MODE_BALLOON, PLAYER_MODE_BALLOON,
PLAYER_MODE_BUBBLE_MIXTURE, PLAYER_MODE_BUBBLE_MIXTURE,
// PLAYER_MODE_NET, PLAYER_MODE_NET,
PLAYER_MODE_CORALBLOWER, PLAYER_MODE_CORALBLOWER,
//PLAYER_MODE_JELLY_LAUNCHER, //PLAYER_MODE_JELLY_LAUNCHER,
@ -247,7 +247,7 @@ public:
void giveInvinvibilityRing() {m_invinvibilityRingTimer=INVINCIBILITY_RING_TIME;} void giveInvinvibilityRing() {m_invinvibilityRingTimer=INVINCIBILITY_RING_TIME;}
void giveDivingHelmet() {m_divingHelmet=true;} void giveDivingHelmet() {m_divingHelmet=true;}
void giveBubbleAmmo() {m_bubbleAmmo+=10;} void giveBubbleAmmo() {m_bubbleAmmo+=10;if(m_bubbleAmmo>99)m_bubbleAmmo=99;}
void useOneBubble() {m_bubbleAmmo--;} void useOneBubble() {m_bubbleAmmo--;}
int getBubbleAmmo() {return m_bubbleAmmo;} int getBubbleAmmo() {return m_bubbleAmmo;}
private: private:
@ -275,6 +275,26 @@ private:
private: private:
bool m_hasPlatformCollided; bool m_hasPlatformCollided;
// Graphical resources
public:
class FontBank *getFontBank() {return m_fontBank;}
class SpriteBank *getSpriteBank() {return m_spriteBank;}
enum
{
POWERUPUI_ICONX=40,
POWERUPUI_ICONY=200,
POWERUPUI_TEXTX=60,
POWERUPUI_TEXTY=200,
POWERUPUI_OT=5,
};
private:
class FontBank *m_fontBank;
class SpriteBank *m_spriteBank;
}; };

View File

@ -16,7 +16,14 @@
-------- */ -------- */
#include "player\pmbubble.h" #include "player\pmbubble.h"
#ifndef __ENEMY_NPLATFRM_H__
#include "enemy\nplatfrm.h" #include "enemy\nplatfrm.h"
#endif
#ifndef __GFX_FONT_H__
#include "gfx\font.h"
#endif
/* Std Lib /* Std Lib
@ -29,6 +36,10 @@
#include <ACTOR_SPONGEBOB_ANIM.h> #include <ACTOR_SPONGEBOB_ANIM.h>
#endif #endif
#ifndef __SPR_INGAMEFX_H__
#include <ingamefx.h>
#endif
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
Tyepdefs && Defines Tyepdefs && Defines
@ -144,6 +155,28 @@ void CPlayerModeBubbleMixture::setAnimFrame(int _animFrame)
m_savedAnimFrame=_animFrame; m_savedAnimFrame=_animFrame;
} }
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CPlayerModeBubbleMixture::renderModeUi()
{
SpriteBank *sb;
sFrameHdr *fh;
char buf[4];
FontBank *fb;
sb=m_player->getSpriteBank();
fh=sb->getFrameHeader(FRM__BUBBLEWAND);
sb->printFT4(fh,CPlayer::POWERUPUI_ICONX-(fh->W/2),CPlayer::POWERUPUI_ICONY-(fh->H/2),0,0,CPlayer::POWERUPUI_OT);
fb=m_player->getFontBank();
sprintf(buf,"x%d",m_player->getBubbleAmmo());
fb->print(CPlayer::POWERUPUI_TEXTX,CPlayer::POWERUPUI_TEXTY-(fb->getCharHeight()/2),buf);
}
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
Function: Function:
Purpose: Purpose:

View File

@ -39,6 +39,7 @@ class CPlayerModeBubbleMixture : public CPlayerModeBase
public: public:
virtual void enter(); virtual void enter();
virtual void think(); virtual void think();
virtual void renderModeUi();
virtual void setAnimNo(int _animNo); virtual void setAnimNo(int _animNo);
virtual void setAnimFrame(int _animFrame); virtual void setAnimFrame(int _animFrame);

View File

@ -17,6 +17,10 @@
#include "player\pmcoral.h" #include "player\pmcoral.h"
#ifndef __GFX_SPRBANK_H__
#include "gfx\sprbank.h"
#endif
/* Std Lib /* Std Lib
------- */ ------- */
@ -28,6 +32,10 @@
#include <ACTOR_SPONGEBOB_ANIM.h> #include <ACTOR_SPONGEBOB_ANIM.h>
#endif #endif
#ifndef __SPR_INGAMEFX_H__
#include <ingamefx.h>
#endif
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
Tyepdefs && Defines Tyepdefs && Defines
@ -103,9 +111,9 @@ void CPlayerModeCoralBlower::think()
} }
break; break;
case BLOWER_STATE__AIMING: case BLOWER_STATE__AIMING:
if(getState()==STATE_IDLE) if(getState()!=STATE_IDLE)
{ {
m_blowerState=BLOWER_STATE__EMPTY; m_blowerState=BLOWER_STATE__FULL;
} }
if(!getPadInputHeld()&PI_ACTION) if(!getPadInputHeld()&PI_ACTION)
{ {
@ -117,6 +125,30 @@ void CPlayerModeCoralBlower::think()
cbstate=m_blowerState; cbstate=m_blowerState;
} }
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CPlayerModeCoralBlower::renderModeUi()
{
SpriteBank *sb;
sFrameHdr *fh;
sb=m_player->getSpriteBank();
fh=sb->getFrameHeader(FRM__BLOWER);
if(m_blowerState==BLOWER_STATE__FULL||m_blowerState==BLOWER_STATE__AIMING)
{
// Blower has a creature/object inside
sb->printFT4Scaled(FRM__BLOWER,CPlayer::POWERUPUI_ICONX-(fh->W/2),CPlayer::POWERUPUI_ICONY-(fh->H/2),0,0,CPlayer::POWERUPUI_OT,256+128);
}
else
{
sb->printFT4(fh,CPlayer::POWERUPUI_ICONX-(fh->W/2),CPlayer::POWERUPUI_ICONY-(fh->H/2),0,0,CPlayer::POWERUPUI_OT);
}
}
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
Function: Function:
Purpose: Purpose:

View File

@ -39,6 +39,7 @@ class CPlayerModeCoralBlower : public CPlayerModeBase
public: public:
virtual void enter(); virtual void enter();
virtual void think(); virtual void think();
virtual void renderModeUi();
virtual const struct PlayerMetrics *getPlayerMetrics(); virtual const struct PlayerMetrics *getPlayerMetrics();

View File

@ -17,6 +17,10 @@
#include "player\pmnet.h" #include "player\pmnet.h"
#ifndef __GFX_SPRBANK_H__
#include "gfx\sprbank.h"
#endif
/* Std Lib /* Std Lib
------- */ ------- */
@ -28,6 +32,10 @@
#include <ACTOR_SPONGEBOB_ANIM.h> #include <ACTOR_SPONGEBOB_ANIM.h>
#endif #endif
#ifndef __SPR_INGAMEFX_H__
#include <ingamefx.h>
#endif
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
Tyepdefs && Defines Tyepdefs && Defines
@ -108,6 +116,30 @@ void CPlayerModeNet::think()
netstate=m_netState; netstate=m_netState;
} }
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CPlayerModeNet::renderModeUi()
{
SpriteBank *sb;
sFrameHdr *fh;
sb=m_player->getSpriteBank();
fh=sb->getFrameHeader(FRM__NET);
if(m_netState==NET_STATE__FULL)
{
// Net has a jellyfish inside
sb->printFT4Scaled(fh,CPlayer::POWERUPUI_ICONX-(fh->W/2),CPlayer::POWERUPUI_ICONY-(fh->H/2),0,0,CPlayer::POWERUPUI_OT,256+128);
}
else
{
sb->printFT4(fh,CPlayer::POWERUPUI_ICONX-(fh->W/2),CPlayer::POWERUPUI_ICONY-(fh->H/2),0,0,CPlayer::POWERUPUI_OT);
}
}
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
Function: Function:
Purpose: Purpose:

View File

@ -39,6 +39,7 @@ class CPlayerModeNet : public CPlayerModeBase
public: public:
virtual void enter(); virtual void enter();
virtual void think(); virtual void think();
virtual void renderModeUi();
virtual void setAnimNo(int _animNo); virtual void setAnimNo(int _animNo);
virtual void setAnimFrame(int _animFrame); virtual void setAnimFrame(int _animFrame);

View File

@ -81,6 +81,7 @@ public:
virtual void enter() {;} virtual void enter() {;}
virtual void think() {;} virtual void think() {;}
virtual void render() {;} virtual void render() {;}
virtual void renderModeUi() {;} // Ui specific to this mode (eg: ammo)
int getPadInputHeld(); int getPadInputHeld();
int getPadInputDown(); int getPadInputDown();

View File

@ -888,6 +888,14 @@ SOURCE=..\..\..\source\player\pmfly.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\..\..\source\player\pmnet.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\source\player\pmnet.h
# End Source File
# Begin Source File
SOURCE=..\..\..\source\player\pmodes.cpp SOURCE=..\..\..\source\player\pmodes.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File