This commit is contained in:
Paul 2001-06-20 19:32:03 +00:00
parent 174c47da1a
commit 731ac49770
3 changed files with 60 additions and 36 deletions

View File

@ -385,9 +385,15 @@ void CGameScene::think(int _frames)
m_pauseMenu->select(); m_pauseMenu->select();
} }
// Conversation think ( with pad debounce stuff.. )
if(CConversation::isActive())m_player->ignoreNewlyPressedButtonsOnPadThisThink();
CConversation::think(_frames); CConversation::think(_frames);
// Pause menu think ( with pad debounce stuff.. )
if(m_pauseMenu->isActive())m_player->ignoreNewlyPressedButtonsOnPadThisThink();
m_pauseMenu->think(_frames); m_pauseMenu->think(_frames);
if(!CConversation::isActive()&& !m_pauseMenu->isActive())
if(!CConversation::isActive()&&!m_pauseMenu->isActive())
{ {
DVECTOR camPos; DVECTOR camPos;
CJellyfishGenerator::think( _frames, &Level ); CJellyfishGenerator::think( _frames, &Level );

View File

@ -1120,6 +1120,8 @@ if(PadGetDown(0)&PAD_TRIANGLE)
if(m_cameraPos.vy<m_cameraPosLimitBox.y1) m_cameraPos.vy=m_cameraPosLimitBox.y1; if(m_cameraPos.vy<m_cameraPosLimitBox.y1) m_cameraPos.vy=m_cameraPosLimitBox.y1;
else if(m_cameraPos.vy>m_cameraPosLimitBox.y2) m_cameraPos.vy=m_cameraPosLimitBox.y2; else if(m_cameraPos.vy>m_cameraPosLimitBox.y2) m_cameraPos.vy=m_cameraPosLimitBox.y2;
m_ignoreNewlyPressedButtonsOnPadThisThink=false;
CPlayerThing::think(_frames); CPlayerThing::think(_frames);
} }
@ -1701,6 +1703,8 @@ void CPlayer::respawn()
updateCollisionArea(); updateCollisionArea();
m_lives--; m_lives--;
m_ignoreNewlyPressedButtonsOnPadThisThink=true;
} }
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
@ -1826,6 +1830,17 @@ int CPlayer::canDoLookAround()
} }
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CPlayer::ignoreNewlyPressedButtonsOnPadThisThink()
{
m_ignoreNewlyPressedButtonsOnPadThisThink=true;
}
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
Function: Function:
Purpose: Purpose:
@ -2026,7 +2041,14 @@ void CPlayer::updatePadInput()
{ {
m_lastPadInput=m_padInput; m_lastPadInput=m_padInput;
m_padInput=readPadInput(); m_padInput=readPadInput();
m_padInputDown=(PLAYERINPUT)(m_padInput&(m_lastPadInput^-1)); if(!m_ignoreNewlyPressedButtonsOnPadThisThink)
{
m_padInputDown=(PLAYERINPUT)(m_padInput&(m_lastPadInput^-1));
}
else
{
m_padInputDown=PI_NONE;
}
} }
@ -2036,47 +2058,41 @@ void CPlayer::updatePadInput()
Params: Params:
Returns: Returns:
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
typedef struct
{
CPadConfig::PAD_CFG m_input;
PLAYERINPUT m_output;
} PAD_CONVERSION;
static const PAD_CONVERSION s_padConversionTable[]=
{
{ CPadConfig::PAD_CFG_UP, PI_UP },
{ CPadConfig::PAD_CFG_DOWN, PI_DOWN },
{ CPadConfig::PAD_CFG_LEFT, PI_LEFT },
{ CPadConfig::PAD_CFG_RIGHT, PI_RIGHT },
{ CPadConfig::PAD_CFG_JUMP, PI_JUMP },
{ CPadConfig::PAD_CFG_FIRE, PI_FIRE },
{ CPadConfig::PAD_CFG_CATCH, PI_CATCH },
{ CPadConfig::PAD_CFG_WEAPONCHANGE, PI_WEAPONCHANGE },
};
static const int s_padConversionTableSize=sizeof(s_padConversionTable)/sizeof(PAD_CONVERSION);
PLAYERINPUT CPlayer::readPadInput() PLAYERINPUT CPlayer::readPadInput()
{ {
PLAYERINPUT input; PLAYERINPUT input;
int pad; int pad;
const PAD_CONVERSION *table;
int i;
input=PI_NONE; input=PI_NONE;
pad=PadGetHeld(0); pad=PadGetHeld(0);
table=s_padConversionTable;
if(pad&CPadConfig::getButton(CPadConfig::PAD_CFG_UP)) for(i=0;i<s_padConversionTableSize;i++)
{ {
input=(PLAYERINPUT)(input|PI_UP); if(pad&CPadConfig::getButton(table->m_input))
{
input=(PLAYERINPUT)(input|table->m_output);
}
table++;
} }
if(pad&CPadConfig::getButton(CPadConfig::PAD_CFG_DOWN))
{
input=(PLAYERINPUT)(input|PI_DOWN);
}
if(pad&CPadConfig::getButton(CPadConfig::PAD_CFG_LEFT))
{
input=(PLAYERINPUT)(input|PI_LEFT);
}
if(pad&CPadConfig::getButton(CPadConfig::PAD_CFG_RIGHT))
{
input=(PLAYERINPUT)(input|PI_RIGHT);
}
if(pad&CPadConfig::getButton(CPadConfig::PAD_CFG_JUMP))
{
input=(PLAYERINPUT)(input|PI_JUMP);
}
if(pad&CPadConfig::getButton(CPadConfig::PAD_CFG_FIRE))
{
input=(PLAYERINPUT)(input|PI_FIRE);
}
if(pad&CPadConfig::getButton(CPadConfig::PAD_CFG_CATCH))
{
input=(PLAYERINPUT)(input|PI_CATCH);
}
if(pad&CPadConfig::getButton(CPadConfig::PAD_CFG_WEAPONCHANGE))
{
input=(PLAYERINPUT)(input|PI_WEAPONCHANGE);
}
#ifdef _RECORD_DEMO_MODE_ #ifdef _RECORD_DEMO_MODE_
CDemoPlayer::demoPlayerControl *crnt; CDemoPlayer::demoPlayerControl *crnt;

View File

@ -265,6 +265,7 @@ private:
public: public:
DVECTOR getPlayerPos() {return Pos;} DVECTOR getPlayerPos() {return Pos;}
void setPlayerPos(DVECTOR *_pos) {Pos=*_pos;} void setPlayerPos(DVECTOR *_pos) {Pos=*_pos;}
void ignoreNewlyPressedButtonsOnPadThisThink();
PLAYERINPUT getPadInputHeld() {return m_padInput;} PLAYERINPUT getPadInputHeld() {return m_padInput;}
PLAYERINPUT getPadInputDown() {return m_padInputDown;} PLAYERINPUT getPadInputDown() {return m_padInputDown;}
int tryingToManuallyPickupWeapon() {return m_tryingToManuallyPickupWeapon;} int tryingToManuallyPickupWeapon() {return m_tryingToManuallyPickupWeapon;}
@ -349,6 +350,7 @@ private:
PLAYERINPUT m_padInput; // Controls that are being held down PLAYERINPUT m_padInput; // Controls that are being held down
PLAYERINPUT m_lastPadInput; // Last frames controls PLAYERINPUT m_lastPadInput; // Last frames controls
PLAYERINPUT m_padInputDown; // Controls that were pressed this frame PLAYERINPUT m_padInputDown; // Controls that were pressed this frame
int m_ignoreNewlyPressedButtonsOnPadThisThink;
int m_tryingToManuallyPickupWeapon; int m_tryingToManuallyPickupWeapon;
int m_tryingToAutomaticallyPickupWeapon; int m_tryingToAutomaticallyPickupWeapon;