Commit 4c4bde3d authored by Gerhard Stein's avatar Gerhard Stein

Moved some input options to the control section. Those options are per player now.

parent 7c41db3f
......@@ -652,23 +652,23 @@ void CPlayer::ProcessInput()
if(g_pInput->getHoldedCommand(m_index, IC_LEFT))
{
const int newval = g_pInput->isJoystickAssgmnt(m_index, IC_LEFT) && mp_option[OPT_ANALOGJOYSTICK].value ? -g_pInput->getJoyValue(m_index, IC_LEFT) : 100;
const int newval = g_pInput->isJoystickAssgmnt(m_index, IC_LEFT) && g_pInput->isAnalog(m_index) ? -g_pInput->getJoyValue(m_index, IC_LEFT) : 100;
playcontrol[PA_X] -= newval;
}
else if(g_pInput->getHoldedCommand(m_index, IC_RIGHT))
{
const int newval = g_pInput->isJoystickAssgmnt(m_index, IC_RIGHT) && mp_option[OPT_ANALOGJOYSTICK].value ? g_pInput->getJoyValue(m_index, IC_RIGHT) : 100;
const int newval = g_pInput->isJoystickAssgmnt(m_index, IC_RIGHT) && g_pInput->isAnalog(m_index) ? g_pInput->getJoyValue(m_index, IC_RIGHT) : 100;
playcontrol[PA_X] += newval;
}
if(g_pInput->getHoldedCommand(m_index, IC_DOWN))
{
const int newval = g_pInput->isJoystickAssgmnt(m_index, IC_DOWN) && mp_option[OPT_ANALOGJOYSTICK].value ? g_pInput->getJoyValue(m_index, IC_DOWN) : 100;
const int newval = g_pInput->isJoystickAssgmnt(m_index, IC_DOWN) && g_pInput->isAnalog(m_index) ? g_pInput->getJoyValue(m_index, IC_DOWN) : 100;
playcontrol[PA_Y] += newval;
}
else if(g_pInput->getHoldedCommand(m_index, IC_UP))
{
const int newval = g_pInput->isJoystickAssgmnt(m_index, IC_UP) && mp_option[OPT_ANALOGJOYSTICK].value ? -g_pInput->getJoyValue(m_index, IC_UP) : 100;
const int newval = g_pInput->isJoystickAssgmnt(m_index, IC_UP) && g_pInput->isAnalog(m_index) ? -g_pInput->getJoyValue(m_index, IC_UP) : 100;
playcontrol[PA_Y] -= newval;
}
......
......@@ -417,9 +417,9 @@ void CPlayer::JumpAndPogo()
// jump high if JUMP key down, else bounce low
if (playcontrol[PA_JUMP])
{
if (!mp_option[OPT_SUPERPOGO].value)
if( !g_pInput->SuperPogo(m_index) )
{ // normal high pogo jump
if(playcontrol[PA_JUMP] > 12 || !mp_option[OPT_IMPPOGO].value)
if( playcontrol[PA_JUMP] > 12 || !g_pInput->ImpossiblePogo(m_index) )
{
if(!pogofirsttime)
{
......@@ -733,7 +733,7 @@ void CPlayer::raygun()
ppogostick = false; // put away pogo stick if out
// limit how quickly shots can be fired
if ( !plastfire || mp_option[OPT_FULLYAUTOMATIC].value )
if ( !plastfire || g_pInput->AutoGun(m_index) )
{
if (pfireframetimer < PFIRE_LIMIT_SHOT_FREQ_FA) canRefire = true;
else canRefire = false;
......@@ -894,7 +894,7 @@ void CPlayer::checkSolidDoors()
int my2 = getYDownPos();
std::vector<CTileProperties> &TileProperty = g_pBehaviorEngine->getTileProperties();
for( size_t my=my1 ; my<my2 ; my+=(1<<STC) )
for( int my=my1 ; my<my2 ; my+=(1<<STC) )
{
if( (TileProperty[mp_Map->at(mx1>>CSF, my>>CSF)].behaviour>1 &&
TileProperty[mp_Map->at(mx1>>CSF, my>>CSF)].behaviour<6 ) )
......@@ -903,7 +903,7 @@ void CPlayer::checkSolidDoors()
}
}
for( size_t my=my1 ; my<my2 ; my+=(1<<STC) )
for( int my=my1 ; my<my2 ; my+=(1<<STC) )
{
if( (TileProperty[mp_Map->at(mx2>>CSF, my>>CSF)].behaviour>1 &&
TileProperty[mp_Map->at(mx2>>CSF, my>>CSF)].behaviour<6 ) )
......@@ -912,7 +912,7 @@ void CPlayer::checkSolidDoors()
}
}
for( size_t mx=mx1 ; mx<mx2 ; mx+=(1<<STC) )
for( int mx=mx1 ; mx<mx2 ; mx+=(1<<STC) )
{
if( (TileProperty[mp_Map->at(mx>>CSF, my1>>CSF)].behaviour>1 &&
TileProperty[mp_Map->at(mx>>CSF, my1>>CSF)].behaviour<6 ) )
......@@ -921,7 +921,7 @@ void CPlayer::checkSolidDoors()
}
}
for( size_t mx=mx1 ; mx<mx2 ; mx+=(1<<STC) )
for( int mx=mx1 ; mx<mx2 ; mx+=(1<<STC) )
{
if( (TileProperty[mp_Map->at(mx>>CSF, my2>>CSF)].behaviour>1 &&
TileProperty[mp_Map->at(mx>>CSF, my2>>CSF)].behaviour<6 ) )
......
......@@ -190,15 +190,11 @@ void CSettings::setOption( e_OptionKeyword opt, const std::string &menuname, con
*/
void CSettings::loadDefaultGameCfg()
{
setOption( OPT_FULLYAUTOMATIC, "Machine Gun ", "autogun", 0 );
setOption( OPT_SUPERPOGO, "Super Pogo Stick ", "superpogo", 0 );
setOption( OPT_ALLOWPKING, "Friendly Fire ", "pking", 1 );
setOption( OPT_KEYSTACK, "Keystacking ", "keystack", 0 );
setOption( OPT_ANALOGJOYSTICK, "Analog Joystick ", "analog_joystick", 1 );
setOption( OPT_LVLREPLAYABILITY, "Replay Levels ", "level_replayability", 0 );
setOption( OPT_RISEBONUS, "Rising Bonus ", "rise_bonus", 1 );
setOption( OPT_SWITCHSCORES, "Score Fix (EP3) ", "switch_scores", 0 );
setOption( OPT_IMPPOGO, "Impossible Pogo ", "impossible_pogo", 0 );
setOption( OPT_HUD, "HUD Display ", "hud", 1 );
setOption( OPT_FLASHEFFECT, "Flash Effects ", "flashfx", 1 );
setOption( OPT_FIXLEVELERRORS, "Fix Level Errors ", "fix_level", 1 );
......
......@@ -73,7 +73,7 @@ public:
CControlsettings::CControlsettings( const int selectedPlayer ) :
CBaseMenu( CRect<float>(0.1f, 0.24f, 0.8f, 0.4f) ),
CBaseMenu( CRect<float>(0.1f, 0.25f, 0.8f, 0.5f) ),
mSelectedPlayer(selectedPlayer)
{
CGUIButton *button;
......@@ -87,7 +87,23 @@ mSelectedPlayer(selectedPlayer)
mpTwoButtonSwitch = new CGUISwitch( "Two Button Fire" );
mpTwoButtonSwitch->enable(g_pInput->getTwoButtonFiring(mSelectedPlayer-1));
mpAnalogSwitch = new CGUISwitch( "Analog Movement" );
mpAnalogSwitch->enable(g_pInput->isAnalog(mSelectedPlayer-1));
mpSuperPogoSwitch = new CGUISwitch( "Super Pogo" );
mpSuperPogoSwitch->enable(g_pInput->SuperPogo(mSelectedPlayer-1));
mpImpPogoSwitch = new CGUISwitch( "Impossible Pogo" );
mpImpPogoSwitch->enable(g_pInput->ImpossiblePogo(mSelectedPlayer-1));
mpAutoGunSwitch = new CGUISwitch( "Auto Gun" );
mpAutoGunSwitch->enable(g_pInput->AutoGun(mSelectedPlayer-1));
mpMenuDialog->addControl( mpTwoButtonSwitch );
mpMenuDialog->addControl( mpAnalogSwitch );
mpMenuDialog->addControl( mpSuperPogoSwitch );
mpMenuDialog->addControl( mpImpPogoSwitch );
mpMenuDialog->addControl( mpAutoGunSwitch );
mpMenuDialog->addControl( new CGUIButton( "Reset Controls",
new ResetInputEvent(mSelectedPlayer-1) ) );
......@@ -101,6 +117,10 @@ void CControlsettings::init()
void CControlsettings::release()
{
g_pInput->setTwoButtonFiring(mSelectedPlayer-1, mpTwoButtonSwitch->isEnabled() );
g_pInput->enableAnalog(mSelectedPlayer-1, mpAnalogSwitch->isEnabled() );
g_pInput->setSuperPogo(mSelectedPlayer-1, mpSuperPogoSwitch->isEnabled() );
g_pInput->setImpossiblePogo(mSelectedPlayer-1, mpImpPogoSwitch->isEnabled() );
g_pInput->setAutoGun(mSelectedPlayer-1, mpAutoGunSwitch->isEnabled() );
g_pInput->saveControlconfig();
}
......
......@@ -33,6 +33,10 @@ private:
int mSelectedPlayer;
CGUISwitch *mpTwoButtonSwitch;
CGUISwitch *mpAnalogSwitch;
CGUISwitch *mpSuperPogoSwitch;
CGUISwitch *mpImpPogoSwitch;
CGUISwitch *mpAutoGunSwitch;
};
......
......@@ -103,15 +103,35 @@ void CMenuController::process()
new CControlsettings(players) ) );
}
}
// Process Menu if open
if( !mMenuStack.empty() )
{
mpMenu->process();
}
// If you click, then open the menu
if(!g_pInput->m_EventList.empty())
{
if( MouseMoveEvent *mouseevent = g_pInput->m_EventList.occurredEvent<MouseMoveEvent>() )
{
// Here we check if the mouse-cursor/Touch entry clicked on our Button
if(mouseevent->Type == MOUSEEVENT_BUTTONUP && mMenuStack.empty())
{
EventContainer.add( new OpenMenuEvent( new CMainMenu(mOpenedGamePlay) ) );
g_pBehaviorEngine->setPause(true);
g_pMusicPlayer->pause();
}
g_pInput->m_EventList.pop_Event();
}
}
}
void CMenuController::popBackMenu()
......
......@@ -12,7 +12,7 @@
COptions::COptions() :
CBaseMenu( CRect<float>(0.1f, 0.24f, 0.8f, NUM_OPTIONS*0.05f) ),
CBaseMenu( CRect<float>(0.1f, 0.14f, 0.8f, NUM_OPTIONS*0.07f) ),
mpOption(g_pBehaviorEngine->m_option)
{
......
......@@ -34,13 +34,10 @@ public:
CameraBounds.down = 130;
CameraBounds.speed = 5;
g_pTimer->setFPS(30);
p_option[OPT_SUPERPOGO].value = 0;
p_option[OPT_ALLOWPKING].value = 0;
p_option[OPT_KEYSTACK].value = 0;
p_option[OPT_ANALOGJOYSTICK].value = 0;
p_option[OPT_LVLREPLAYABILITY].value = 0;
p_option[OPT_RISEBONUS].value = 0;
p_option[OPT_IMPPOGO].value = 0;
p_option[OPT_HUD].value = 0;
g_pSettings->saveDrvCfg();
}
......@@ -66,9 +63,7 @@ public:
CameraBounds.speed = 20;
g_pTimer->setFPS(60);
p_option[OPT_KEYSTACK].value = 1;
p_option[OPT_ANALOGJOYSTICK].value = 1;
p_option[OPT_RISEBONUS].value = 1;
p_option[OPT_IMPPOGO].value = 1;
p_option[OPT_HUD].value = 1;
g_pSettings->saveDrvCfg();
}
......
......@@ -11,11 +11,10 @@
#include <string>
enum e_OptionKeyword
{ OPT_FULLYAUTOMATIC, OPT_SUPERPOGO,
{
OPT_ALLOWPKING, OPT_KEYSTACK,
OPT_ANALOGJOYSTICK,
OPT_LVLREPLAYABILITY, OPT_RISEBONUS,
OPT_SWITCHSCORES, OPT_IMPPOGO,
OPT_SWITCHSCORES,
OPT_HUD, OPT_FLASHEFFECT,
OPT_FIXLEVELERRORS,
NUM_OPTIONS
......
......@@ -235,7 +235,9 @@ void CInput::loadControlconfig(void)
setupInputCommand( InputCommand[i], IC_HELP, value );
Configuration.ReadString( section, "Back", value, "Key 27 (escape)");
setupInputCommand( InputCommand[i], IC_BACK, value );
Configuration.ReadKeyword( section, "TwoButtonFiring", &TwoButtonFiring[i], false);
Configuration.ReadKeyword( section, "Analog", &mAnalogAxesMovement[i], false);
}
}
else
......@@ -274,6 +276,7 @@ void CInput::saveControlconfig()
Configuration.WriteString(section, "Help", getEventName(IC_HELP, i));
Configuration.WriteString(section, "Back", getEventName(IC_BACK, i));
Configuration.SetKeyword(section, "TwoButtonFiring", TwoButtonFiring[i]);
Configuration.SetKeyword(section, "Analog", mAnalogAxesMovement[i]);
}
Configuration.saveCfgFile();
}
......@@ -435,11 +438,13 @@ bool CInput::readNewEvent(Uint8 device, int command)
}
bool CInput::getExitEvent(void) { return m_exit; }
void CInput::cancelExitEvent(void) { m_exit=false; }
bool CInput::getTwoButtonFiring(int player) { return TwoButtonFiring[player]; }
void CInput::setTwoButtonFiring(int player, bool value) { TwoButtonFiring[player]=value; }
bool CInput::isAnalog(const int player) { return mAnalogAxesMovement[player]; }
void CInput::enableAnalog(const int player, const bool value) { mAnalogAxesMovement[player]=value; }
/**
* \brief Called every logic cycle. This triggers the events that occur and process them trough various functions
*/
......@@ -1306,7 +1311,8 @@ static void drawButton(TouchButton& button, bool down) {
#endif
void CInput::renderOverlay() {
void CInput::renderOverlay()
{
#ifdef USE_OPENGL // only ogl supported yet (and probably worth)
#if defined(MOUSEWRAPPER)
static bool showControls = true;
......
......@@ -178,7 +178,19 @@ public:
bool getTwoButtonFiring(int player);
void setTwoButtonFiring(int player, bool value);
void cancelExitEvent(void);
bool isAnalog(const int player);
void enableAnalog(const int player, const bool value);
bool SuperPogo(const int player) { return mSuperPogo[player]; }
void setSuperPogo(const int player, const bool value) { mSuperPogo[player] = value; }
bool ImpossiblePogo(const int player) { return mImpPogo[player]; }
void setImpossiblePogo(const int player, const bool value) { mImpPogo[player] = value; }
bool AutoGun(const int player) { return mFullyAutomatic[player]; }
void setAutoGun(const int player, const bool value) { mFullyAutomatic[player] = value; }
std::string getEventName(int position, unsigned char input);
bool readNewEvent(Uint8 device, int position);
......@@ -210,6 +222,10 @@ private:
stInputCommand InputCommand[NUM_INPUTS][MAX_COMMANDS];
bool TwoButtonFiring[NUM_INPUTS];
bool mAnalogAxesMovement[NUM_INPUTS];
bool mSuperPogo[NUM_INPUTS];
bool mImpPogo[NUM_INPUTS];
bool mFullyAutomatic[NUM_INPUTS];
bool m_exit;
int m_cmdpulse;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment