[egoboo] Add patch the might fix bug with arrow keys
Bruno Wolff III
bruno at fedoraproject.org
Tue Mar 13 02:52:53 UTC 2012
commit 17c7df78d2f160f44c6b7752fa86540a7631bfd3
Author: Bruno Wolff III <bruno at wolff.to>
Date: Sun Mar 11 18:38:14 2012 -0500
Add patch the might fix bug with arrow keys
egoboo-1490.patch | 787 +++++++++++++++++++++++++++++++++++++++++++++++++++++
egoboo.spec | 3 +
2 files changed, 790 insertions(+), 0 deletions(-)
---
diff --git a/egoboo-1490.patch b/egoboo-1490.patch
new file mode 100644
index 0000000..756a828
--- /dev/null
+++ b/egoboo-1490.patch
@@ -0,0 +1,787 @@
+Index: game/menu.c
+===================================================================
+--- src/game/menu.c (revision 1489)
++++ src/game/menu.c (revision 1490)
+@@ -183,8 +183,8 @@
+ static bool_t SelectedPlayer_list_check_loadplayer( SelectedPlayer_list_t * sp_lst, int loadplayer_idx );
+ static bool_t SelectedPlayer_list_add( SelectedPlayer_list_t * sp_lst, int loadplayer_idx );
+ static bool_t SelectedPlayer_list_remove( SelectedPlayer_list_t * sp_lst, int loadplayer_idx );
+-static bool_t SelectedPlayer_list_add_input( SelectedPlayer_list_t * sp_lst, int loadplayer_idx, Uint32 input_bits );
+-static bool_t SelectedPlayer_list_remove_input( SelectedPlayer_list_t * sp_lst, int loadplayer_idx, Uint32 input_bits );
++//static bool_t SelectedPlayer_list_add_input( SelectedPlayer_list_t * sp_lst, int loadplayer_idx, Uint32 input_bits );
++//static bool_t SelectedPlayer_list_remove_input( SelectedPlayer_list_t * sp_lst, int loadplayer_idx, Uint32 input_bits );
+ static int SelectedPlayer_list_index_from_loadplayer( SelectedPlayer_list_t * sp_lst, int loadplayer_idx );
+
+ //--------------------------------------------------------------------------------------------
+@@ -1539,6 +1539,10 @@
+
+ // fix class name capitalization
+ pcap->classname[0] = toupper( pcap->classname[0] );
++
++ //Character level and class
++ GL_DEBUG( glColor4f )( 1, 1, 1, 1 );
++ ui_drawTextBox( NULL, loadplayer_ptr->name , x1, y1, 0, 0, 20 ); y1 += 25;
+
+ //Character level and class
+ GL_DEBUG( glColor4f )( 1, 1, 1, 1 );
+@@ -1735,9 +1739,12 @@
+ }
+
+ // Continue
+- if ( SDLKEYDOWN( SDLK_RETURN ) || BUTTON_UP == ui_doButton( 100, button_text[0], NULL, buttonLeft, buttonTop, 200, 30 ) )
++ if( mnu_SelectedList.count > 0 )
+ {
+- menuState = MM_Leaving;
++ if ( SDLKEYDOWN( SDLK_RETURN ) || BUTTON_UP == ui_doButton( 100, button_text[0], NULL, buttonLeft, buttonTop, 200, 30 ) )
++ {
++ menuState = MM_Leaving;
++ }
+ }
+
+ // Back
+@@ -1753,14 +1760,6 @@
+ break;
+
+ case MM_Leaving:
+-
+- //Figure out which players have been selected
+-/* for( i = 0; i < MAX_LOCAL_PLAYERS; i++ )
+- {
+- if( selectedPlayers[i] == -1 ) continue;
+- SelectedPlayer_list_add( &mnu_SelectedList, i );
+- }*/
+-
+ //fall through
+
+ case MM_Finish:
+@@ -1827,6 +1826,7 @@
+ case MM_Begin:
+ TxTexture_free_one(( TX_REF )TX_BARS );
+ last_player = selectedPlayers[currentSelectingPlayer];
++ new_player = btrue;
+
+ ego_texture_load_vfs( &background, "mp_data/menu/menu_selectplayers", TRANSCOLOR );
+
+@@ -1982,17 +1982,17 @@
+ {
+ // load and display the new lplayer data
+ new_player = bfalse;
+- doChoosePlayer_show_stats( loadplayer_ptr, 0, GFX_WIDTH - 400, 10, 350, GFX_HEIGHT - 60 );
++ doChoosePlayer_show_stats( loadplayer_ptr, 0, GFX_WIDTH - 400, 5, 350, GFX_HEIGHT - 50 );
+ }
+ else
+ {
+ // just display the new lplayer data
+- doChoosePlayer_show_stats( loadplayer_ptr, 2, GFX_WIDTH - 400, 10, 350, GFX_HEIGHT - 60 );
++ doChoosePlayer_show_stats( loadplayer_ptr, 2, GFX_WIDTH - 400, 5, 350, GFX_HEIGHT - 50 );
+ }
+ }
+ else
+ {
+- doChoosePlayer_show_stats( NULL, 1, GFX_WIDTH - 100, 10, 100, GFX_HEIGHT - 60 );
++ doChoosePlayer_show_stats( NULL, 1, GFX_WIDTH - 100, 5, 100, GFX_HEIGHT - 50 );
+ }
+
+ // tool-tip text
+@@ -2163,6 +2163,8 @@
+ static int menuState = MM_Begin;
+ static int menuChoice = 0;
+ static int waitingforinput = -1;
++ static bool_t device_found = btrue;
++ static bool_t update_input_type;
+
+ static STRING inputOptionsButtons[CONTROL_COMMAND_COUNT + 3];
+
+@@ -2188,6 +2190,7 @@
+
+ waitingforinput = -1;
+ player = 0;
++ update_input_type = btrue;
+
+ //Clip to valid value
+ if( controls[player].device_type == INPUT_DEVICE_NONE ) controls[player].device_type = INPUT_DEVICE_BEGIN;
+@@ -2220,6 +2223,30 @@
+ // Background
+ GL_DEBUG( glColor4f )( 1, 1, 1, 1 );
+
++ //Detect if input is availible and update the input type button accordingly
++ if( update_input_type )
++ {
++ update_input_type = bfalse;
++ switch( pdevice->device_type )
++ {
++ default:
++ case INPUT_DEVICE_KEYBOARD:
++ device_found = keyb.on;
++ break;
++ case INPUT_DEVICE_MOUSE:
++ device_found = mous.on;
++ break;
++ case INPUT_DEVICE_JOY_A:
++ device_found = joy[0].on;
++ break;
++ case INPUT_DEVICE_JOY_B:
++ device_found = joy[1].on;
++ break;
++ }
++
++ snprintf( inputOptionsButtons[CONTROL_COMMAND_COUNT+0], sizeof( STRING ), "%s", translate_input_type_to_string( pdevice->device_type ) );
++ }
++
+ // Someone pressed abort
+ if ( SDLKEYDOWN( SDLK_ESCAPE ) ) waitingforinput = -1;
+
+@@ -2508,10 +2535,11 @@
+ case INPUT_DEVICE_JOY_A: pdevice->device_type = INPUT_DEVICE_JOY_B; break;
+ case INPUT_DEVICE_JOY_B: pdevice->device_type = INPUT_DEVICE_KEYBOARD; break;
+ }
+-
+- snprintf( inputOptionsButtons[CONTROL_COMMAND_COUNT+0], sizeof( STRING ), "%s", translate_input_type_to_string( pdevice->device_type ) );
++ update_input_type = btrue;
+ }
+
++ //Display warning if input device was not found
++ if( !device_found) ui_drawTextBox( menuFont, "WARNING: Input device not found!", buttonLeft + 300, 95, 0, 0, 20 );
+
+ // The select player button
+ ui_drawTextBox( menuFont, "SELECT PLAYER:", buttonLeft, 55, 0, 0, 20 );
+@@ -2521,6 +2549,7 @@
+ player %= MAX_LOCAL_PLAYERS;
+
+ snprintf( inputOptionsButtons[CONTROL_COMMAND_COUNT+1], sizeof( STRING ), "Player %i", player + 1 );
++ update_input_type = btrue;
+ }
+
+ // Save settings button
+@@ -5562,7 +5591,7 @@
+ //--------------------------------------------------------------------------------------------
+ egoboo_rv mnu_set_local_import_list( Import_list_t * imp_lst, SelectedPlayer_list_t * sp_lst )
+ {
+- int import_idx;
++ int import_idx, i;
+ Import_element_t * import_ptr = NULL;
+
+ int loadplayer_idx = -1;
+@@ -5594,8 +5623,13 @@
+ import_ptr = imp_lst->lst + imp_lst->count;
+ imp_lst->count++;
+
++ //TODO: this could be done a lot better... figure out which player we are (1, 2, 3 or 4)
++ for( i = 0; i < MAX_LOCAL_PLAYERS; i++ )
++ {
++ if( selectedplayer_ptr->player == selectedPlayers[i] ) import_ptr->local_player_num = i;
++ }
++
+ // set the import info
+- //import_ptr->input_device = selectedplayer_ptr->input_device;
+ import_ptr->slot = selectedplayer_idx * MAXIMPORTPERPLAYER;
+ import_ptr->player = selectedplayer_idx;
+
+@@ -5728,7 +5762,7 @@
+ }
+
+ //--------------------------------------------------------------------------------------------
+-bool_t SelectedPlayer_list_add_input( SelectedPlayer_list_t * sp_lst, int loadplayer_idx, BIT_FIELD input_bits )
++/*bool_t SelectedPlayer_list_add_input( SelectedPlayer_list_t * sp_lst, int loadplayer_idx, BIT_FIELD input_bits )
+ {
+ int i;
+ bool_t done, retval = bfalse;
+@@ -5788,10 +5822,10 @@
+ }
+
+ return retval;
+-}
++}*/
+
+ //--------------------------------------------------------------------------------------------
+-bool_t SelectedPlayer_list_remove_input( SelectedPlayer_list_t * sp_lst, int loadplayer_idx, Uint32 input_bits )
++/*bool_t SelectedPlayer_list_remove_input( SelectedPlayer_list_t * sp_lst, int loadplayer_idx, Uint32 input_bits )
+ {
+ int i;
+ bool_t retval = bfalse;
+@@ -5800,7 +5834,7 @@
+ {
+ if ( sp_lst->lst[i].player == loadplayer_idx )
+ {
+- //UNSET_BIT( sp_lst->lst[i].input, input_bits );
++ UNSET_BIT( sp_lst->lst[i].input, input_bits );
+
+ // This part is not so tricky as in SelectedPlayer_list_add_input.
+ // Even though we are modding the loop control variable, it is never
+@@ -5819,4 +5853,4 @@
+ }
+
+ return retval;
+-}
++}*/
+Index: game/camera.c
+===================================================================
+--- src/game/camera.c (revision 1489)
++++ src/game/camera.c (revision 1490)
+@@ -41,6 +41,8 @@
+
+ camera_t gCamera;
+
++void camera_read_input( camera_t *pcam, input_device_t *pdevice );
++
+ //--------------------------------------------------------------------------------------------
+ //--------------------------------------------------------------------------------------------
+ // Camera control stuff
+@@ -223,7 +225,8 @@
+ void camera_move( camera_t * pcam, ego_mpd_t * pmesh )
+ {
+ /// @details ZZ@> This function moves the camera
+-
++
++ PLA_REF ipla;
+ Uint16 cnt;
+ float x, y, z, level, newx, newy, movex, movey;
+ Uint16 turnsin;
+@@ -318,7 +321,6 @@
+ // a camera mode for focusing in on the players that are actually doing something.
+ // "Show me the drama!"
+
+- PLA_REF ipla;
+ chr_t * local_chr_ptrs[MAX_PLAYER];
+ int local_chr_count = 0;
+
+@@ -423,84 +425,19 @@
+ pcam->zadd = 0.9f * pcam->zadd + 0.1f * pcam->zaddgoto;
+ pcam->pos.z = 0.9f * pcam->pos.z + 0.1f * pcam->zgoto;
+
+- // Camera controls TODO: doesnt work at the moment
+- /*
+- if ( CAM_TURN_GOOD == pcam->turn_mode && 1 == local_numlpla )
++ // Camera controls
++ for( ipla = 0; ipla < MAX_PLAYER; ipla++ )
+ {
+- if ( mous.on )
+- {
+- if ( !control_is_pressed( INPUT_DEVICE_MOUSE, CONTROL_CAMERA ) )
+- {
+- pcam->turnadd -= ( mous.x * 0.5f );
+- }
+- }
++ player_t *ppla;
+
+- if ( keyb.on )
+- {
+- pcam->turnadd += ( control_is_pressed( INPUT_DEVICE_KEYBOARD, CONTROL_LEFT ) - control_is_pressed( INPUT_DEVICE_KEYBOARD, CONTROL_RIGHT ) ) * CAM_TURN_KEY;
+- }
++ //Don't do invalid players
++ if( INVALID_PLA(ipla) ) continue;
++ ppla = PlaStack.lst + ipla;
+
+- if ( joy[0].on )
+- {
+- if ( !control_is_pressed( INPUT_DEVICE_JOY_A, CONTROL_CAMERA ) )
+- {
+- pcam->turnadd -= joy[0].x * CAM_TURN_JOY;
+- }
+- }
+-
+- if ( joy[1].on )
+- {
+- if ( !control_is_pressed( INPUT_DEVICE_JOY_B, CONTROL_CAMERA ) )
+- {
+- pcam->turnadd -= joy[1].x * CAM_TURN_JOY;
+- }
+- }
++ //Handle camera control from this player
++ camera_read_input( pcam, ppla->pdevice );
+ }
+- else
+- {
+- if ( mous.on )
+- {
+- if ( control_is_pressed( INPUT_DEVICE_MOUSE, CONTROL_CAMERA ) )
+- {
+- pcam->turnadd += ( mous.x / 3.0f );
+- pcam->zaddgoto += ( float ) mous.y / 3.0f;
+- if ( pcam->zaddgoto < CAM_ZADD_MIN ) pcam->zaddgoto = CAM_ZADD_MIN;
+- if ( pcam->zaddgoto > CAM_ZADD_MAX ) pcam->zaddgoto = CAM_ZADD_MAX;
+
+- pcam->turn_time = CAM_TURN_TIME; // Sticky turn...
+- }
+- }
+-
+- // JoyA camera controls
+- if ( joy[0].on )
+- {
+- if ( control_is_pressed( INPUT_DEVICE_JOY_A, CONTROL_CAMERA ) )
+- {
+- pcam->turnadd += joy[0].x * CAM_TURN_JOY;
+- pcam->zaddgoto += joy[0].y * CAM_TURN_JOY;
+- if ( pcam->zaddgoto < CAM_ZADD_MIN ) pcam->zaddgoto = CAM_ZADD_MIN;
+- if ( pcam->zaddgoto > CAM_ZADD_MAX ) pcam->zaddgoto = CAM_ZADD_MAX;
+-
+- pcam->turn_time = CAM_TURN_TIME; // Sticky turn...
+- }
+- }
+-
+- // JoyB camera controls
+- if ( joy[1].on )
+- {
+- if ( control_is_pressed( INPUT_DEVICE_JOY_B, CONTROL_CAMERA ) )
+- {
+- pcam->turnadd += joy[1].x * CAM_TURN_JOY;
+- pcam->zaddgoto += joy[1].y * CAM_TURN_JOY;
+- if ( pcam->zaddgoto < CAM_ZADD_MIN ) pcam->zaddgoto = CAM_ZADD_MIN;
+- if ( pcam->zaddgoto > CAM_ZADD_MAX ) pcam->zaddgoto = CAM_ZADD_MAX;
+-
+- pcam->turn_time = CAM_TURN_TIME; // Sticky turn...
+- }
+- }
+- }
+- */
+-
+ pcam->pos.x -= ( float )( pcam->mView.CNV( 0, 0 ) ) * pcam->turnadd; // xgg
+ pcam->pos.y += ( float )( pcam->mView.CNV( 1, 0 ) ) * -pcam->turnadd;
+
+@@ -575,6 +512,117 @@
+ pcam->ori.facing_z = CLIP_TO_16BITS( FLOAT_TO_FP16( pcam->turn_z_one ) );
+ }
+
++void camera_read_input( camera_t *pcam, input_device_t *pdevice )
++{
++ // @details ZF@> Read camera control input for one specific player controller
++ INPUT_DEVICE type;
++ bool_t autoturn_camera;
++
++ //Don't do network players
++ if( pdevice == NULL ) return;
++ type = pdevice->device_type;
++
++ //Autoturn camera only works in single player and when it is enabled
++ autoturn_camera = CAM_TURN_GOOD == pcam->turn_mode && 1 == local_numlpla;
++
++ //No auto camera
++ switch ( type )
++ {
++ //Mouse control
++ case INPUT_DEVICE_MOUSE:
++ {
++ //If the device isn't enabled there is no point in continuing
++ if ( !mous.on ) break;
++
++ //Auto camera
++ if( autoturn_camera )
++ {
++ if( !control_is_pressed( pdevice, CONTROL_CAMERA ) )
++ {
++ pcam->turnadd -= ( mous.x * 0.5f );
++ }
++ }
++
++ //Normal camera
++ else if( control_is_pressed( pdevice, CONTROL_CAMERA ) )
++ {
++ pcam->turnadd += ( mous.x / 3.0f );
++ pcam->zaddgoto += ( float ) mous.y / 3.0f;
++ if ( pcam->zaddgoto < CAM_ZADD_MIN ) pcam->zaddgoto = CAM_ZADD_MIN;
++ if ( pcam->zaddgoto > CAM_ZADD_MAX ) pcam->zaddgoto = CAM_ZADD_MAX;
++
++ pcam->turn_time = CAM_TURN_TIME; // Sticky turn...
++ }
++ break;
++ }
++
++ // Joystick camera controls
++ case INPUT_DEVICE_JOY_A:
++ case INPUT_DEVICE_JOY_B:
++ {
++ //figure out which joystick this is
++ device_joystick_t *joystick = joy + (type - MAXJOYSTICK);
++
++ //If the device isn't enabled there is no point in continuing
++ if( !joy->on ) break;
++
++ //Autocamera
++ if( autoturn_camera )
++ {
++ if ( !control_is_pressed( pdevice, CONTROL_CAMERA ) )
++ {
++ pcam->turnadd -= joy[1].x * CAM_TURN_JOY;
++ }
++ }
++
++ //Normal camera
++ else if( control_is_pressed( pdevice, CONTROL_CAMERA ) )
++ {
++ pcam->turnadd += joystick->x * CAM_TURN_JOY;
++ pcam->zaddgoto += joystick->y * CAM_TURN_JOY;
++ if ( pcam->zaddgoto < CAM_ZADD_MIN ) pcam->zaddgoto = CAM_ZADD_MIN;
++ if ( pcam->zaddgoto > CAM_ZADD_MAX ) pcam->zaddgoto = CAM_ZADD_MAX;
++
++ pcam->turn_time = CAM_TURN_TIME; // Sticky turn...
++ }
++ break;
++ }
++
++ // Keyboard camera controls
++ case INPUT_DEVICE_KEYBOARD:
++ {
++ //If the device isn't enabled there is no point in continuing
++ if( !keyb.on ) break;
++
++ //Auto camera
++ if(autoturn_camera)
++ {
++ pcam->turnadd += ( control_is_pressed( pdevice, CONTROL_LEFT ) - control_is_pressed( pdevice, CONTROL_RIGHT ) ) * CAM_TURN_KEY;
++ }
++
++ //Normal camera
++ else
++ {
++ //rotation
++ if ( control_is_pressed( pdevice, CONTROL_CAMERA_LEFT ) || control_is_pressed( pdevice, CONTROL_CAMERA_RIGHT ) )
++ {
++ pcam->turnadd += ( control_is_pressed( pdevice, CONTROL_CAMERA_LEFT ) - control_is_pressed( pdevice, CONTROL_CAMERA_RIGHT ) ) * CAM_TURN_KEY;
++ pcam->turn_time = CAM_TURN_TIME; // Sticky turn...
++ }
++
++ //zoom
++ if ( control_is_pressed( pdevice, CONTROL_CAMERA_IN ) || control_is_pressed( pdevice, CONTROL_CAMERA_OUT ) )
++ {
++ pcam->zaddgoto += ( control_is_pressed( pdevice, CONTROL_CAMERA_OUT ) - control_is_pressed( pdevice, CONTROL_CAMERA_IN ) ) * CAM_TURN_KEY;
++ if ( pcam->zaddgoto < CAM_ZADD_MIN ) pcam->zaddgoto = CAM_ZADD_MIN;
++ if ( pcam->zaddgoto > CAM_ZADD_MAX ) pcam->zaddgoto = CAM_ZADD_MAX;
++ }
++ }
++ break;
++ }
++ }
++}
++
+ //--------------------------------------------------------------------------------------------
+ void camera_reset( camera_t * pcam, ego_mpd_t * pmesh )
+ {
+Index: game/egoboo_typedef.c
+===================================================================
+--- src/game/egoboo_typedef.c (revision 1489)
++++ src/game/egoboo_typedef.c (revision 1490)
+@@ -96,7 +96,7 @@
+
+ platch->x = 0.0f;
+ platch->y = 0.0f;
+- platch->b = 0;
++ platch->b = EMPTY_BIT_FIELD;
+ }
+
+ //--------------------------------------------------------------------------------------------
+Index: game/camera.h
+===================================================================
+--- src/game/camera.h (revision 1489)
++++ src/game/camera.h (revision 1490)
+@@ -67,7 +67,7 @@
+ # define CAM_ZOOM_MIN 800 ///< Camera distance
+ # define CAM_ZOOM_MAX 700
+ # define CAM_ZADD_MIN 800 ///< Camera height
+-# define CAM_ZADD_MAX 2500
++# define CAM_ZADD_MAX 2750
+ # define CAM_UPDOWN_MIN (0.24f*PI) ///< Camera updown angle
+ # define CAM_UPDOWN_MAX (0.10f*PI)
+ #else
+Index: game/egoboo_typedef.h
+===================================================================
+--- src/game/egoboo_typedef.h (revision 1489)
++++ src/game/egoboo_typedef.h (revision 1490)
+@@ -233,10 +233,10 @@
+
+ /// the "base class" of Egoboo profiles
+ #define EGO_PROFILE_STUFF \
+- bool_t loaded; /** Was the data read in? */ \
+- STRING name; /** Usually the source filename */ \
+- int request_count; /** the number of attempted spawnx */ \
+- int create_count; /** the number of successful spawns */
++ bool_t loaded; /** Was the data read in? */ \
++ STRING name; /** Usually the source filename */ \
++ int request_count; /** the number of attempted spawnx */ \
++ int create_count; /** the number of successful spawns */
+
+ //--------------------------------------------------------------------------------------------
+ //--------------------------------------------------------------------------------------------
+Index: game/game.c
+===================================================================
+--- src/game/game.c (revision 1489)
++++ src/game/game.c (revision 1490)
+@@ -1861,7 +1861,7 @@
+
+
+ //--------------------------------------------------------------------------------------------
+-void set_one_player_latch( const PLA_REF player )
++void set_one_player_latch( const PLA_REF ipla )
+ {
+ /// @details ZZ@> This function converts input readings to latch settings, so players can
+ /// move around
+@@ -1871,19 +1871,16 @@
+ float fsin, fcos;
+ latch_t sum;
+ bool_t fast_camera_turn;
++ fvec2_t joy_pos, joy_new;
+
+- chr_t * pchr;
+ player_t * ppla;
+ input_device_t * pdevice;
+
+- if ( INVALID_PLA( player ) ) return;
+- ppla = PlaStack.lst + player;
+-
++ // skip invalid players
++ if ( INVALID_PLA( ipla ) ) return;
++ ppla = PlaStack.lst + ipla;
+ pdevice = ppla->pdevice;
+
+- if ( !INGAME_CHR( ppla->index ) ) return;
+- pchr = ChrList.lst + ppla->index;
+-
+ // is the device a local device or an internet device?
+ if ( pdevice == NULL) return;
+
+@@ -1892,129 +1889,109 @@
+
+ // Clear the player's latch buffers
+ latch_init( &( sum ) );
++ fvec2_self_clear( joy_new.v );
+
+ // generate the transforms relative to the camera
+ turnsin = TO_TURN( PCamera->ori.facing_z );
+ fsin = turntosin[ turnsin ];
+ fcos = turntocos[ turnsin ];
+
+- // Mouse routines
+- if ( pdevice->device_type == INPUT_DEVICE_MOUSE && mous.on )
++ switch( pdevice->device_type )
+ {
+- fvec2_t joy_pos, joy_new;
+
+- fvec2_self_clear( joy_new.v );
++ // Mouse routines
++ case INPUT_DEVICE_MOUSE:
++ {
++ //No need to continue if device is not enabled
++ if( !mous.on ) break;
+
+- if ( fast_camera_turn || !control_is_pressed( pdevice, CONTROL_CAMERA ) ) // Don't allow movement in camera control mode
+- {
+- dist = SQRT( mous.x * mous.x + mous.y * mous.y );
+- if ( dist > 0 )
++ if ( fast_camera_turn || !control_is_pressed( pdevice, CONTROL_CAMERA ) ) // Don't allow movement in camera control mode
+ {
+- scale = mous.sense / dist;
+- if ( dist < mous.sense )
++ dist = SQRT( mous.x * mous.x + mous.y * mous.y );
++ if ( dist > 0 )
+ {
+- scale = dist / mous.sense;
+- }
++ scale = mous.sense / dist;
++ if ( dist < mous.sense )
++ {
++ scale = dist / mous.sense;
++ }
+
+- scale = scale / mous.sense;
+- joy_pos.x = mous.x * scale;
+- joy_pos.y = mous.y * scale;
++ scale = scale / mous.sense;
++ scale = 1;
++ joy_pos.x = mous.x * scale;
++ joy_pos.y = mous.y * scale;
+
+- if ( fast_camera_turn && 0 == control_is_pressed( pdevice, CONTROL_CAMERA ) ) joy_pos.x = 0;
++ //if ( fast_camera_turn && 0 == control_is_pressed( pdevice, CONTROL_CAMERA ) ) joy_pos.x = 0;
+
+- joy_new.x = ( joy_pos.x * fcos + joy_pos.y * fsin );
+- joy_new.y = ( -joy_pos.x * fsin + joy_pos.y * fcos );
++ joy_new.x = ( joy_pos.x * fcos + joy_pos.y * fsin );
++ joy_new.y = ( -joy_pos.x * fsin + joy_pos.y * fcos );
++ }
+ }
++
++ break;
+ }
+
+- sum.x += joy_new.x;
+- sum.y += joy_new.y;
+- }
++ // Joystick routines
++ case INPUT_DEVICE_JOY_A:
++ case INPUT_DEVICE_JOY_B:
++ {
++ //Figure out which joystick we are using
++ device_joystick_t *joystick;
++ joystick = joy + (pdevice->device_type - MAXJOYSTICK);
+
+- // Joystick A routines
+- else if ( pdevice->device_type == INPUT_DEVICE_JOY_A && joy[0].on )
+- {
+- fvec2_t joy_pos, joy_new;
++ //No need to continue if device is not enabled
++ if( !joystick->on ) break;
+
+- fvec2_self_clear( joy_new.v );
++ if ( fast_camera_turn || !control_is_pressed( pdevice, CONTROL_CAMERA ) )
++ {
++ joy_pos.x = joystick->x;
++ joy_pos.y = joystick->y;
+
+- if ( fast_camera_turn || !control_is_pressed( pdevice, CONTROL_CAMERA ) )
+- {
+- joy_pos.x = joy[0].x;
+- joy_pos.y = joy[0].y;
++ dist = joy_pos.x * joy_pos.x + joy_pos.y * joy_pos.y;
++ if ( dist > 1.0f )
++ {
++ scale = 1.0f / SQRT( dist );
++ joy_pos.x *= scale;
++ joy_pos.y *= scale;
++ }
+
+- dist = joy_pos.x * joy_pos.x + joy_pos.y * joy_pos.y;
+- if ( dist > 1.0f )
+- {
+- scale = 1.0f / SQRT( dist );
+- joy_pos.x *= scale;
+- joy_pos.y *= scale;
++ if ( fast_camera_turn && !control_is_pressed( pdevice, CONTROL_CAMERA ) ) joy_pos.x = 0;
++
++ joy_new.x = ( joy_pos.x * fcos + joy_pos.y * fsin );
++ joy_new.y = ( -joy_pos.x * fsin + joy_pos.y * fcos );
+ }
+
+- if ( fast_camera_turn && !control_is_pressed( pdevice, CONTROL_CAMERA ) ) joy_pos.x = 0;
+-
+- joy_new.x = ( joy_pos.x * fcos + joy_pos.y * fsin );
+- joy_new.y = ( -joy_pos.x * fsin + joy_pos.y * fcos );
++ break;
+ }
+
+- sum.x += joy_new.x;
+- sum.y += joy_new.y;
+- }
++ // Keyboard routines
++ case INPUT_DEVICE_KEYBOARD:
++ {
++ //No need to continue if device is not enabled
++ if( !keyb.on ) break;
+
+- // Joystick B routines
+- else if ( pdevice->device_type == INPUT_DEVICE_JOY_B && joy[1].on )
+- {
+- fvec2_t joy_pos, joy_new;
++ fvec2_self_clear( joy_pos.v );
+
+- fvec2_self_clear( joy_new.v );
++ if ( fast_camera_turn || !control_is_pressed(pdevice, CONTROL_CAMERA ) )
++ {
++ joy_pos.x = ( control_is_pressed( pdevice, CONTROL_RIGHT ) - control_is_pressed( pdevice, CONTROL_LEFT ) );
++ joy_pos.y = ( control_is_pressed( pdevice, CONTROL_DOWN ) - control_is_pressed( pdevice, CONTROL_UP ) );
+
+- if ( fast_camera_turn || !control_is_pressed( pdevice, CONTROL_CAMERA ) )
+- {
+- joy_pos.x = joy[1].x;
+- joy_pos.y = joy[1].y;
++ if ( fast_camera_turn ) joy_pos.x = 0;
+
+- dist = joy_pos.x * joy_pos.x + joy_pos.y * joy_pos.y;
+- if ( dist > 1.0f )
+- {
+- scale = 1.0f / SQRT( dist );
+- joy_pos.x *= scale;
+- joy_pos.y *= scale;
++ joy_new.x = ( joy_pos.x * fcos + joy_pos.y * fsin );
++ joy_new.y = ( -joy_pos.x * fsin + joy_pos.y * fcos );
+ }
+
+- if ( fast_camera_turn && !control_is_pressed( pdevice, CONTROL_CAMERA ) ) joy_pos.x = 0;
+-
+- joy_new.x = ( joy_pos.x * fcos + joy_pos.y * fsin );
+- joy_new.y = ( -joy_pos.x * fsin + joy_pos.y * fcos );
++ break;
+ }
+-
+- sum.x += joy_new.x;
+- sum.y += joy_new.y;
+ }
+
+- // Keyboard routines
+- else if ( pdevice->device_type == INPUT_DEVICE_KEYBOARD && keyb.on )
+- {
+- fvec2_t joy_pos, joy_new;
++ // Update movement (if any)
++ sum.x += joy_new.x;
++ sum.y += joy_new.y;
+
+- fvec2_self_clear( joy_new.v );
+- fvec2_self_clear( joy_pos.v );
+-
+- if ( fast_camera_turn || !control_is_pressed(pdevice, CONTROL_CAMERA ) )
+- {
+- joy_pos.x = ( control_is_pressed( pdevice, CONTROL_RIGHT ) - control_is_pressed( pdevice, CONTROL_LEFT ) );
+- joy_pos.y = ( control_is_pressed( pdevice, CONTROL_DOWN ) - control_is_pressed( pdevice, CONTROL_UP ) );
+-
+- if ( fast_camera_turn ) joy_pos.x = 0;
+-
+- joy_new.x = ( joy_pos.x * fcos + joy_pos.y * fsin );
+- joy_new.y = ( -joy_pos.x * fsin + joy_pos.y * fcos );
+- }
+-
+- sum.x += joy_new.x;
+- sum.y += joy_new.y;
+- }
+-
+- // Read buttons
++ // Read control buttons
+ if ( control_is_pressed( pdevice, CONTROL_JUMP ) )
+ SET_BIT( sum.b, LATCHBUTTON_JUMP );
+ if ( control_is_pressed( pdevice, CONTROL_LEFT_USE ) )
+@@ -2783,12 +2760,12 @@
+ if ( -1 != local_index )
+ {
+ // It's a local PlaStack.count
+- player_added = add_player( new_object, ( PLA_REF )PlaStack.count, controls + local_numlpla );
++ player_added = add_player( new_object, ( PLA_REF )PlaStack.count, controls + ImportList.lst[local_index].local_player_num);
+ }
+ else
+ {
+ // It's a remote PlaStack.count
+- player_added = add_player( new_object, ( PLA_REF )PlaStack.count, controls + local_numlpla ); //ZF> todo: BAD! dont allow local to control multiplayer
++ player_added = add_player( new_object, ( PLA_REF )PlaStack.count, NULL );
+ }
+ }
+
+@@ -5709,7 +5686,7 @@
+
+ // blank out the ImportList list
+ Import_list_init( &ImportList );
+-
++
+ // generate the ImportList list from the player info
+ for ( player_idx = 0, player = 0; player_idx < MAX_PLAYER; player_idx++ )
+ {
+@@ -5727,7 +5704,6 @@
+ imp_lst->count++;
+
+ import_ptr->player = player_idx;
+- import_ptr->input_device = is_local ? player_ptr->pdevice->device_type : INPUT_DEVICE_NONE;
+ import_ptr->slot = REF_TO_INT( player ) * MAXIMPORTPERPLAYER;
+ import_ptr->srcDir[0] = CSTR_END;
+ import_ptr->dstDir[0] = CSTR_END;
+Index: game/game.h
+===================================================================
+--- src/game/game.h (revision 1489)
++++ src/game/game.h (revision 1490)
+@@ -295,9 +295,9 @@
+ STRING dstDir;
+ STRING name;
+
+- size_t player; ///< Which player is this?
+- INPUT_DEVICE input_device; ///< Input device for this player
+- int slot; ///< which slot it it to be loaded into
++ size_t local_player_num; ///< Local player number (player 1, 2, 3 or 4)
++ size_t player; ///< Which player is this?
++ int slot; ///< which slot it it to be loaded into
+ };
+ typedef struct s_Import_element Import_element_t;
+
diff --git a/egoboo.spec b/egoboo.spec
index 81bb387..6709467 100644
--- a/egoboo.spec
+++ b/egoboo.spec
@@ -12,6 +12,8 @@ Patch1: egoboo-noenet.patch
Patch2: egoboo-enet13.patch
Patch3: egoboo-badprint.patch
Patch4: egoboo-paths.patch
+# This is based on upstream svn commit rev 1490
+Patch5: egoboo-1490.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: SDL_mixer-devel SDL_ttf-devel SDL_image-devel enet-devel
BuildRequires: desktop-file-utils
@@ -34,6 +36,7 @@ dimension.
%patch2 -b .enet13
%patch3 -b .badprint
%patch4 -b .paths
+%patch5 -b .1490
%build
make -C src
More information about the scm-commits
mailing list