--- smc.old/smc/src/input/keyboard.cpp +++ smc/smc/src/input/keyboard.cpp @@ -223,7 +223,8 @@ } } // take a screenshot - else if( key == pPreferences->m_key_screenshot ) + else if ((key == pPreferences->m_key_screenshot) || + (key == SDLK_F5)) { pVideo->Save_Screenshot(); } --- smc.old/smc/src/level/level.cpp +++ smc/smc/src/level/level.cpp @@ -718,12 +718,16 @@ pLevel_Player->Action_Shoot(); } // Jump - else if( key == pPreferences->m_key_jump && !editor_enabled ) + else if (((key == pPreferences->m_key_jump) || + (key == SDLK_s)) && + !editor_enabled) { pLevel_Player->Action_Jump(); } // Action - else if( key == pPreferences->m_key_action && !editor_enabled ) + else if (((key == pPreferences->m_key_action) || + (key == SDLK_a)) && + !editor_enabled) { pLevel_Player->Action_Interact( INP_ACTION ); } @@ -813,7 +817,8 @@ { pLevel_Player->Action_Stop_Interact( INP_DOWN ); } - else if( key == pPreferences->m_key_jump ) + else if ((key == pPreferences->m_key_jump) || + (key == SDLK_s)) { pLevel_Player->Action_Stop_Interact( INP_JUMP ); } @@ -821,7 +826,8 @@ { pLevel_Player->Action_Stop_Interact( INP_SHOOT ); } - else if( key == pPreferences->m_key_action ) + else if ((key == pPreferences->m_key_action) || + (key == SDLK_a)) { pLevel_Player->Action_Stop_Interact( INP_ACTION ); } --- smc.old/smc/src/level/level_player.cpp +++ smc/smc/src/level/level_player.cpp @@ -40,6 +40,8 @@ #include "elements/CEGUICombobox.h" #include "elements/CEGUIListboxTextItem.h" +#define inkey input_event.key.keysym.sym + namespace SMC { @@ -273,11 +275,12 @@ { if( input_event.type == SDL_KEYDOWN ) { - if( input_event.key.keysym.sym == SDLK_ESCAPE ) + if( inkey == SDLK_ESCAPE ) { goto animation_end; } - else if( input_event.key.keysym.sym == pPreferences->m_key_screenshot ) + else if ((inkey == pPreferences->m_key_screenshot) || + (inkey == SDLK_F5)) { pVideo->Save_Screenshot(); } @@ -312,11 +315,12 @@ { if( input_event.type == SDL_KEYDOWN ) { - if( input_event.key.keysym.sym == SDLK_ESCAPE ) + if( inkey == SDLK_ESCAPE ) { goto animation_end; } - else if( input_event.key.keysym.sym == pPreferences->m_key_screenshot ) + else if ((inkey == pPreferences->m_key_screenshot) || + (inkey == SDLK_F5)) { pVideo->Save_Screenshot(); } @@ -390,7 +394,8 @@ { if( input_event.type == SDL_KEYDOWN ) { - if( input_event.key.keysym.sym == pPreferences->m_key_screenshot ) + if ((inkey == pPreferences->m_key_screenshot) || + (inkey == SDLK_F5)) { pVideo->Save_Screenshot(); } @@ -399,7 +404,10 @@ Uint8 *keys = SDL_GetKeyState( NULL ); // Escape stops - if( keys[SDLK_ESCAPE] || keys[SDLK_RETURN] || keys[SDLK_SPACE] || keys[pPreferences->m_key_action] ) + if (keys [SDLK_ESCAPE] || keys [SDLK_RETURN] || + keys [SDLK_SPACE ] || + keys [pPreferences->m_key_action] || + keys [SDLK_a]) { break; } @@ -1317,7 +1325,10 @@ bool jump_key = 0; // if jump key pressed - if( pKeyboard->m_keys[pPreferences->m_key_jump] || ( pPreferences->m_joy_analog_jump && pJoystick->m_up ) || pJoystick->Button( pPreferences->m_joy_button_jump ) ) + if ((pKeyboard->m_keys [pPreferences->m_key_jump] || + pKeyboard->m_keys [SDLK_s]) || + (pPreferences->m_joy_analog_jump && pJoystick->m_up) || + pJoystick->Button (pPreferences->m_joy_button_jump)) { jump_key = 1; } @@ -1411,7 +1422,10 @@ } // jumping physics - if( pKeyboard->m_keys[pPreferences->m_key_jump] || ( pPreferences->m_joy_analog_jump && pJoystick->m_up ) || pJoystick->Button( pPreferences->m_joy_button_jump ) ) + if ((pKeyboard->m_keys [pPreferences->m_key_jump] || + pKeyboard->m_keys [SDLK_s]) || + (pPreferences->m_joy_analog_jump && pJoystick->m_up) || + pJoystick->Button (pPreferences->m_joy_button_jump)) { Add_Velocity_Y( -( m_jump_accel_up + ( m_vely * m_jump_vel_deaccel ) / Get_Vel_Modifier() ) ); m_jump_power -= pFramerate->m_speed_factor; @@ -1511,7 +1525,9 @@ } // if control is pressed search for items in front of the player - if( pKeyboard->m_keys[pPreferences->m_key_action] || pJoystick->Button( pPreferences->m_joy_button_action ) ) + if (pKeyboard->m_keys [pPreferences->m_key_action] || + pKeyboard->m_keys [SDLK_a] || + pJoystick->Button (pPreferences->m_joy_button_action)) { // next position velocity with extra size float check_x = ( m_velx > 0.0f ) ? ( m_velx + 5.0f ) : ( m_velx - 5.0f ); @@ -3260,7 +3276,10 @@ float vel_mod = 1.0f; // if running key is pressed or always run - if( pPreferences->m_always_run || pKeyboard->m_keys[pPreferences->m_key_action] || pJoystick->Button( pPreferences->m_joy_button_action ) ) + if (pPreferences->m_always_run || + pKeyboard->m_keys [pPreferences->m_key_action] || + pKeyboard->m_keys [SDLK_a] || + pJoystick->Button (pPreferences->m_joy_button_action)) { vel_mod = 1.5f; } --- smc.old/smc/src/objects/text_box.cpp +++ smc/smc/src/objects/text_box.cpp @@ -28,6 +28,8 @@ #include "elements/CEGUIMultiLineEditbox.h" #include "elements/CEGUIScrollbar.h" +#define iekey input_event.key.keysym.sym + namespace SMC { @@ -147,30 +149,36 @@ { while( SDL_PollEvent( &input_event ) ) { - if( input_event.type == SDL_KEYDOWN ) + if (input_event.type == SDL_KEYDOWN) { - pKeyboard->m_keys[input_event.key.keysym.sym] = 1; + pKeyboard->m_keys [iekey] = 1; // exit keys - if( input_event.key.keysym.sym == pPreferences->m_key_action || input_event.key.keysym.sym == SDLK_ESCAPE || input_event.key.keysym.sym == SDLK_RETURN || input_event.key.keysym.sym == SDLK_SPACE ) + if (iekey == pPreferences->m_key_action || + iekey == SDLK_a || + iekey == SDLK_ESCAPE || + iekey == SDLK_RETURN || + iekey == SDLK_SPACE) { display = 0; break; } // handled keys - else if( input_event.key.keysym.sym == pPreferences->m_key_right || input_event.key.keysym.sym == pPreferences->m_key_left ) + else if (iekey == pPreferences->m_key_right || + iekey == pPreferences->m_key_left) { - pKeyboard->Key_Down( input_event.key.keysym.sym ); + pKeyboard->Key_Down (iekey); } } - else if( input_event.type == SDL_KEYUP ) + else if (input_event.type == SDL_KEYUP) { - pKeyboard->m_keys[input_event.key.keysym.sym] = 0; + pKeyboard->m_keys [iekey] = 0; // handled keys - if( input_event.key.keysym.sym == pPreferences->m_key_right || input_event.key.keysym.sym == pPreferences->m_key_left ) + if (iekey == pPreferences->m_key_right || + iekey == pPreferences->m_key_left) { - pKeyboard->Key_Up( input_event.key.keysym.sym ); + pKeyboard->Key_Up (iekey); } } else if( input_event.type == SDL_JOYBUTTONDOWN ) --- smc.old/smc/src/user/preferences.cpp +++ smc/smc/src/user/preferences.cpp @@ -69,10 +69,10 @@ const SDLKey cPreferences::m_key_down_default = SDLK_DOWN; const SDLKey cPreferences::m_key_left_default = SDLK_LEFT; const SDLKey cPreferences::m_key_right_default = SDLK_RIGHT; -const SDLKey cPreferences::m_key_jump_default = SDLK_s; +const SDLKey cPreferences::m_key_jump_default = SDLK_LCTRL; const SDLKey cPreferences::m_key_shoot_default = SDLK_SPACE; const SDLKey cPreferences::m_key_item_default = SDLK_RETURN; -const SDLKey cPreferences::m_key_action_default = SDLK_a; +const SDLKey cPreferences::m_key_action_default = SDLK_LALT; const SDLKey cPreferences::m_key_screenshot_default = SDLK_PRINT; const SDLKey cPreferences::m_key_editor_fast_copy_up_default = SDLK_KP8; const SDLKey cPreferences::m_key_editor_fast_copy_down_default = SDLK_KP2;