This commit is contained in:
Paul 2001-02-09 21:41:55 +00:00
parent 73ebe07cc2
commit 469fa455ee
9 changed files with 173 additions and 60 deletions

View File

@ -47,6 +47,10 @@
#include "gfx\animtex.h"
#endif
#ifndef __GAME_PAUSE_H__
#include "game\pause.h"
#endif
int GX=248;
int GY=129;
@ -88,6 +92,9 @@ void CGameScene::init()
m_player->init();
m_player->setLayerCollision(Level.getCollisionLayer());
m_pauseMenu=new ("Pause Menu") CPauseMenu();
m_pauseMenu->init();
CFader::setFadingIn();
SetGeomOffset( GX, GY );
@ -108,6 +115,8 @@ void CGameScene::createPlayer()
void CGameScene::shutdown()
{
m_pauseMenu->shutdown();
m_player->shutdown(); delete m_player;
CThing::shutdownAndDeleteAllThings();
@ -121,6 +130,7 @@ void CGameScene::render()
{
CamMtx.t[2]=ZPos; // Temp
m_pauseMenu->render();
CConversation::render();
CThing::renderAllThings();
Level.render();
@ -136,8 +146,15 @@ void CGameScene::think(int _frames)
// }
//#endif
if(PadGetDown(0)&PAD_START)
{
m_pauseMenu->select();
}
CConversation::think(_frames);
if(!CConversation::isActive())
m_pauseMenu->think(_frames);
if(!CConversation::isActive()&&
!m_pauseMenu->isActive())
{
DVECTOR camPos;
CThing::thinkAllThings(_frames);

View File

@ -40,8 +40,9 @@ virtual void createPlayer();
protected:
CLevel Level;
class CPlayer *m_player;
CLevel Level;
class CPauseMenu *m_pauseMenu;
class CPlayer *m_player;
static FontBank *s_genericFont;
static MATRIX CamMtx;
//static class SpriteBank *s_sprites; <-- Was causing compile error, sorry

View File

@ -22,12 +22,12 @@
#include "gui\gframe.h"
#endif
#ifndef __GUI_GSPRITE_H__
#include "gui\gsprite.h"
#ifndef __GUI_GFACTORY_H__
#include "gui\gfactory.h"
#endif
#ifndef __GUI_GTEXTBOX_H__
#include "gui\gtextbox.h"
#ifndef __MEMORY_HEADER__
#include "mem\memory.h"
#endif
@ -68,27 +68,45 @@
Params:
Returns:
---------------------------------------------------------------------- */
void CConversation::init()
#define FRAME_WIDTH 400
#define FRAME_HEIGHT 180
#define TEXT_BOX_WIDTH 300
#define TEXT_BOX_HEIGHT 20
#define OT_POS 5
int m_exitFlag;
extern int newmode;
void CPauseMenu::init()
{
/*
s_guiFrame=new ("Conversation GUI") CGUIGroupFrame();
s_guiFrame->init(0);
s_guiFrame->setObjectXYWH((512-FRAME_WIDTH)/2,256-FRAME_BOTTOM_OFFSET-FRAME_HEIGHT,FRAME_WIDTH,FRAME_HEIGHT);
s_guiFrame->setOt(OT_POS);
s_guiFrame->setFlags(CGUIObject::FLAG_DRAWBORDER);
m_guiFrame=new ("Conversation GUI") CGUIControlFrame();
m_guiFrame->init(0);
m_guiFrame->setObjectXYWH((512-FRAME_WIDTH)/2,(256-FRAME_HEIGHT)/2,FRAME_WIDTH,FRAME_HEIGHT);
m_guiFrame->setOt(OT_POS);
m_guiFrame->setFlags(CGUIObject::FLAG_DRAWBORDER);
s_guiIcon=new("Conversation Icon") CGUISprite();
s_guiIcon->init(s_guiFrame);
s_guiIcon->setObjectXYWH(0,0,FRAME_HEIGHT,FRAME_HEIGHT);
s_guiIcon->setOt(OT_POS);
s_guiIcon->setSpriteBank(UI_UIGFX_SPR);
s_guiIcon->setFrame(0);
s_guiText=new("Conversation Text") CGUITextBox();
s_guiText->init(s_guiFrame);
s_guiText->setObjectXYWH(FRAME_HEIGHT,TEXT_BORDER,FRAME_WIDTH-FRAME_HEIGHT-TEXT_BORDER,FRAME_HEIGHT-(TEXT_BORDER*2));
s_guiText->setOt(OT_POS);
*/
CGUIFactory::createValueButtonFrame(m_guiFrame,
(FRAME_WIDTH-TEXT_BOX_WIDTH)/2,10,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT,
STR__PAUSE_MENU__CONTINUE,
&m_exitFlag,true);
CGUIFactory::createValueButtonFrame(m_guiFrame,
(FRAME_WIDTH-TEXT_BOX_WIDTH)/2,40,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT,
STR__DEBUG__BASICUNARMED_MODE,
&newmode,0);
CGUIFactory::createValueButtonFrame(m_guiFrame,
(FRAME_WIDTH-TEXT_BOX_WIDTH)/2,60,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT,
STR__DEBUG__FULLUNARMED_MODE,
&newmode,1);
CGUIFactory::createValueButtonFrame(m_guiFrame,
(FRAME_WIDTH-TEXT_BOX_WIDTH)/2,80,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT,
STR__DEBUG__SQUEAKYBOOTS_MODE,
&newmode,2);
CGUIFactory::createValueButtonFrame(m_guiFrame,
(FRAME_WIDTH-TEXT_BOX_WIDTH)/2,100,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT,
STR__DEBUG__NET_MODE,
&newmode,3);
CGUIFactory::createValueButtonFrame(m_guiFrame,
(FRAME_WIDTH-TEXT_BOX_WIDTH)/2,120,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT,
STR__DEBUG__CORALBLOWER_MODE,
&newmode,4);
m_active=false;
}
@ -100,9 +118,9 @@ void CConversation::init()
Params:
Returns:
---------------------------------------------------------------------- */
void CConversation::shutdown()
void CPauseMenu::shutdown()
{
// s_guiFrame->shutdown();
m_guiFrame->shutdown();
}
@ -112,9 +130,11 @@ void CConversation::shutdown()
Params:
Returns:
---------------------------------------------------------------------- */
void CConversation::select()
void CPauseMenu::select()
{
m_active=true;
m_exitFlag=false;
m_guiFrame->select();
}
@ -124,29 +144,30 @@ void CConversation::select()
Params:
Returns:
---------------------------------------------------------------------- */
void CConversation::think(int _frames)
void CPauseMenu::unselect()
{
ASSERT(m_active);
// if(isActive())
// {
// s_guiFrame->think(_frames);
// }
m_active=false;
m_exitFlag=false;
m_guiFrame->unselect();
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CConversation::render()
#include "game\game.h"
#include "player\player.h"
void CPauseMenu::think(int _frames)
{
ASSERT(m_active);
// if(s_currentState==STATE_ACTIVE)
// {
// s_guiFrame->render();
// }
if(m_active)
{
m_guiFrame->think(_frames);
if(m_exitFlag||newmode!=-1)
{
unselect();
}
}
}
@ -156,7 +177,22 @@ void CConversation::render()
Params:
Returns:
---------------------------------------------------------------------- */
int CConversation::isActive()
void CPauseMenu::render()
{
if(m_active)
{
m_guiFrame->render();
}
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
int CPauseMenu::isActive()
{
return m_active;
}

View File

@ -36,6 +36,7 @@ public:
void shutdown();
void select();
void unselect();
void think(int _frames);
void render();
@ -43,7 +44,9 @@ public:
private:
int m_active;
int m_active;
class CGUIControlFrame *m_guiFrame;
};
@ -58,7 +61,7 @@ private:
/*---------------------------------------------------------------------- */
#endif /* __GAME_CONVO_H__ */
#endif /* __GAME_PAUSE_H__ */
/*===========================================================================
end */

View File

@ -57,6 +57,9 @@
------------------- */
//#define _RECORD_DEMO_MODE_
#ifdef __USER_paul__
#define _STATE_DEBUG_
#endif
/*----------------------------------------------------------------------
@ -102,6 +105,38 @@ static void writeDemoControls()
#endif
#ifdef _STATE_DEBUG_
static const char *s_stateText[NUM_STATES]=
{
"IDLE",
"IDLETEETER",
"JUMP",
"RUN",
"FALL",
"FALLFAR",
"BUTTBOUNCE",
"BUTTFALL",
"BUTTLAND",
"ATTACK",
"RUNATTACK",
"AIRATTACK",
"DUCK",
"SOAKUP",
"GETUP",
"DEAD",
};
static const char *s_modeText[NUM_PLAYERMODES]=
{
"BASICUNARMED",
"FULLUNARMED",
"SQUEAKYBOOTS",
"NET",
"CORALBLOWER",
};
#include "gfx\font.h"
FontBank s_debugFont;
#endif
int s_health;
int s_screenPos;
@ -179,6 +214,11 @@ m_animFrame=0;
m_skel.setAng(512);
//m_skel.setAngInc(678);
#ifdef _STATE_DEBUG_
s_debugFont.initialise(&standardFont);
s_debugFont.setJustification(FontBank::JUST_LEFT);
#endif
}
/*----------------------------------------------------------------------
@ -189,6 +229,9 @@ m_skel.setAng(512);
---------------------------------------------------------------------- */
void CPlayer::shutdown()
{
#ifdef _STATE_DEBUG_
s_debugFont.dump();
#endif
CThing::shutdown();
}
@ -198,9 +241,7 @@ void CPlayer::shutdown()
Params:
Returns:
---------------------------------------------------------------------- */
#ifdef __USER_paul__
int newmode=-1;
#endif
void CPlayer::think(int _frames)
{
@ -216,12 +257,12 @@ if(PadGetHeld(0)&PAD_L1&&PadGetHeld(0)&PAD_L2)
Pos.vx=23*16;
Pos.vy=10*16;
}
#endif
if(newmode!=-1)
{
setMode((PLAYER_MODE)newmode);
newmode=-1;
}
#endif
#ifndef __USER_paul__
int padInput=PadGetHeld(0);
@ -351,7 +392,7 @@ Pos.vy=((Pos.vy-16)&0xfffffff0)+colHeight;
// Look around
int pad=getPadInputHeld();
if(getPadInputDown()&PAD_CIRCLE)
if(PadGetDown(0)&PAD_CIRCLE)
{
m_skel.blink();
}
@ -502,6 +543,15 @@ if(eyes!=-1)
m_skel.Animate(this);
m_skel.Render(this);
}
#ifdef _STATE_DEBUG_
char buf[128];
sprintf(buf,"STATE: %s",s_stateText[m_currentState]);
s_debugFont.print(40,200,buf);
sprintf(buf,"MODE: %s",s_modeText[m_currentMode]);
s_debugFont.print(40,210,buf);
#endif
}

View File

@ -77,11 +77,12 @@ void CPlayerStateFall::enter(CPlayer *_player)
void CPlayerStateFall::think(CPlayer *_player)
{
const PlayerMetrics *metrics;
int controlHeld;
int controlHeld,controlDown;
DVECTOR move;
metrics=getPlayerMetrics(_player);
controlHeld=getPadInputHeld(_player);
controlDown=getPadInputDown(_player);
if(controlHeld&PI_LEFT)
{
@ -98,16 +99,20 @@ void CPlayerStateFall::think(CPlayer *_player)
fall(_player);
if(controlHeld&PI_ACTION)
if(controlDown&PI_ACTION)
{
setState(_player,STATE_AIRATTACK);
}
else if(controlHeld&PI_DOWN)
{
move.vx=0;
move.vy=0;
setMoveVelocity(_player,&move);
setState(_player,STATE_BUTTBOUNCE);
if(setState(_player,STATE_BUTTBOUNCE))
{
// Only do this if this mode allows us to go into butt bounce, otherwise
// SB just floats in the air :)
move.vx=0;
move.vy=0;
setMoveVelocity(_player,&move);
}
}
advanceAnimFrameAndCheckForEndOfAnim(_player);
}

View File

@ -85,7 +85,7 @@ void CPlayerStateBaseIdle::thinkControl(CPlayer *_player)
if(canMoveRight(_player))
setState(_player,STATE_RUN);
}
else if(controlHeld&PI_ACTION)
else if(controlDown&PI_ACTION)
{
setState(_player,STATE_ATTACK);
}

View File

@ -90,10 +90,11 @@ void CPlayerStateJump::enter(CPlayer *_player)
void CPlayerStateJump::think(CPlayer *_player)
{
const PlayerMetrics *metrics;
int controlHeld;
int controlHeld,controlDown;
metrics=getPlayerMetrics(_player);
controlHeld=getPadInputHeld(_player);
controlDown=getPadInputDown(_player);
if(m_jumpFrames<=metrics->m_metric[PM__MAX_JUMP_FRAMES]&&PI_JUMP)
{
@ -104,7 +105,7 @@ void CPlayerStateJump::think(CPlayer *_player)
setState(_player,STATE_FALL);
}
if(controlHeld&PI_ACTION)
if(controlDown&PI_ACTION)
{
setState(_player,STATE_AIRATTACK);
}

View File

@ -111,7 +111,7 @@ void CPlayerStateRun::think(CPlayer *_player)
{
setState(_player,STATE_DUCK);
}
if(controlHeld&PI_ACTION)
if(controlDown&PI_ACTION)
{
setState(_player,STATE_RUNATTACK);
}