Added config field to map a Mouse Axis/Wheel to cycle Primary and Secondary weapons; lots of controls-related code cleaning

This commit is contained in:
zicodxx 2007-05-14 13:38:44 +00:00
parent 5bf5153f5b
commit f912c9efa6
16 changed files with 1731 additions and 2857 deletions

View file

@ -1,5 +1,9 @@
D1X-Rebirth Changelog
20070514
--------
SConstruct, arch/sdl/init.c, arch/sdl/joydefs.c, arch/sdl/mouse.c, arch/sdl/include/mouse.h, main/game.c, main/inferno.c, main/kconfig.c, main/kconfig.h, main/newmenu.c, main/newmenu.h, main/playsave.c, main/text.h: Added config field to map a Mouse Axis/Wheel to cycle Primary and Secondary weapons; lots of controls-related code cleaning
20070510
--------
main/inferno.c: read -pilot arg with and without filename extension

View file

@ -322,7 +322,7 @@ env.ParseConfig('sdl-config --cflags')
env.ParseConfig('sdl-config --libs')
env.Append(CPPFLAGS = ['-Wall', '-funsigned-char'])
env.Append(CPPDEFINES = [('D1XMAJOR', '\\"' + str(D1XMAJOR) + '\\"'), ('D1XMINOR', '\\"' + str(D1XMINOR) + '\\"')])
env.Append(CPPDEFINES = ['NMONO', 'NETWORK', 'HAVE_NETIPX_IPX_H', 'SUPPORTS_NET_IP', '__SDL__', 'SDL_INPUT', 'SDL_AUDIO', '_REENTRANT'])
env.Append(CPPDEFINES = ['NMONO', 'NETWORK', 'HAVE_NETIPX_IPX_H', 'SUPPORTS_NET_IP', '__SDL__', 'SDL_AUDIO', '_REENTRANT'])
env.Append(CPPPATH = ['include', 'main', 'arch/sdl/include'])
generic_libs = ['SDL']
sdlmixerlib = ['SDL_mixer']

View file

@ -11,55 +11,9 @@ AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
*/
/*
* $Source: /cvsroot/dxx-rebirth/d1x-rebirth/arch/sdl/mouse.h,v $
* $Revision: 1.1 $
* $Author: michaelstather $
* $Date: 2006/03/19 16:03:36 $
*
* Header for mouse functions
*
* $Log: mouse.h,v $
* Revision 1.1 2006/03/19 16:03:36 michaelstather
* *** empty log message ***
*
* Revision 1.1.1.1 2006/03/17 19:40:44 zicodxx
* initial import
*
* Revision 1.1.1.1 1999/06/14 22:02:02 donut
* Import of d1x 1.37 source.
*
* Revision 1.10 1995/02/02 10:22:29 john
* Added cyberman init parameter.
*
* Revision 1.9 1994/11/18 23:18:09 john
* Changed some shorts to ints.
*
* Revision 1.8 1994/09/13 12:33:49 john
* Added functions to get down count and state.
*
* Revision 1.7 1994/08/29 20:52:20 john
* Added better cyberman support; also, joystick calibration
* value return funcctiionn,
*
* Revision 1.6 1994/08/24 17:54:35 john
* *** empty log message ***
*
* Revision 1.5 1994/08/24 17:51:43 john
* Added transparent cyberman support
*
* Revision 1.4 1993/07/27 09:32:22 john
* *** empty log message ***
*
* Revision 1.3 1993/07/26 10:46:44 john
* added definition for mouse_set_pos
*
* Revision 1.2 1993/07/22 13:07:59 john
* added header for mousesetlimts
*
* Revision 1.1 1993/07/10 13:10:40 matt
* Initial revision
*
*
*/
#ifndef MOUSE_H
@ -97,12 +51,11 @@ extern int mouse_set_limits( int x1, int y1, int x2, int y2 );
extern void mouse_flush(); // clears all mice events...
//========================================================================
extern void mouse_get_pos( int *x, int *y);
extern void mouse_get_delta( int *dx, int *dy );
extern void mouse_get_delta_z( int *dx, int *dy, int *dz );
extern void mouse_get_pos( int *x, int *y, int *dz);
// extern void mouse_get_delta( int *dx, int *dy );
extern void mouse_get_delta( int *dx, int *dy, int *dz );
extern int mouse_get_btns();
extern void mouse_set_pos( int x, int y);
extern void mouse_get_cyberman_pos( int *x, int *y );
// Returns how long this button has been down since last call.
extern fix mouse_button_down_time(int button);
@ -119,11 +72,10 @@ extern int mouse_button_state(int button);
#define mouse_set_limits(a,b,c,d) -1
#define mouse_flush()
#define mouse_close()
#define mouse_get_pos(a,b)
#define mouse_get_delta(a,b)
#define mouse_get_pos(a,b,c)
#define mouse_get_delta(a,b,c)
#define mouse_get_btns() 0
#define mouse_set_pos(a,b)
#define mouse_get_cyberman_pos(a,b)
#define mouse_button_down_time(a) 0
#define mouse_button_down_count(a) 0
#define mouse_button_state(a) 0

View file

@ -28,9 +28,9 @@ void arch_sdl_init()
//end edit -MM
Error("SDL library initialisation failed: %s.",SDL_GetError());
}
#ifdef SDL_INPUT
if (!FindArg("-nomouse"))
d_mouse_init();
#endif
atexit(sdl_close);
}

View file

@ -1,9 +1,7 @@
/* $Id: joydefs.c,v 1.1.1.1 2006/03/17 19:53:43 zicodxx Exp $ */
/*
*
* SDL joystick support
*
*
*/
#ifdef HAVE_CONFIG_H
@ -20,21 +18,6 @@
extern int num_joysticks;
extern int joy_deadzone;
int joydefs_calibrate_flag = 0;
void joydefs_calibrate()
{
joydefs_calibrate_flag = 0;
if (!num_joysticks) {
nm_messagebox( NULL, 1, TXT_OK, TXT_NO_JOYSTICK );
return;
}
//Actual calibration if necessary
}
//this change was made in DESCENT.TEX, but since we're not including that
//file in the v1.1 update, we're making the change in the code here also
// #ifdef SHAREWARE
@ -57,22 +40,7 @@ void joydef_menuset_1(int nitems, newmenu_item * items, int *last_key, int citem
if (Config_control_type == 2) Config_control_type = CONTROL_MOUSE;
if (Config_control_type == 3) Config_control_type = CONTROL_JOYMOUSE;
if ( (oc_type != Config_control_type) && (Config_control_type == CONTROL_THRUSTMASTER_FCS ) ) {
nm_messagebox( TXT_IMPORTANT_NOTE, 1, TXT_OK, TXT_FCS );
}
if (oc_type != Config_control_type) {
switch (Config_control_type) {
// case CONTROL_NONE:
case CONTROL_JOYSTICK:
case CONTROL_FLIGHTSTICK_PRO:
case CONTROL_THRUSTMASTER_FCS:
case CONTROL_GRAVIS_GAMEPAD:
// case CONTROL_MOUSE:
// case CONTROL_CYBERMAN:
case CONTROL_JOYMOUSE:
joydefs_calibrate_flag = 1;
}
kc_set_controls();
}
}

View file

@ -98,23 +98,7 @@ void mouse_flush() // clears all mice events...
}
//========================================================================
void mouse_get_pos( int *x, int *y)
{
event_poll();
*x=Mouse.x;
*y=Mouse.y;
}
void mouse_get_delta( int *dx, int *dy )
{
event_poll();
*dx = Mouse.delta_x;
*dy = Mouse.delta_y;
Mouse.delta_x = 0;
Mouse.delta_y = 0;
}
void mouse_get_pos_z( int *x, int *y, int *z )
void mouse_get_pos( int *x, int *y, int *z )
{
event_poll();
*x=Mouse.x;
@ -122,7 +106,7 @@ void mouse_get_pos_z( int *x, int *y, int *z )
*z=Mouse.z;
}
void mouse_get_delta_z( int *dx, int *dy, int *dz )
void mouse_get_delta( int *dx, int *dy, int *dz )
{
event_poll();
*dx = Mouse.delta_x;
@ -150,12 +134,6 @@ int mouse_get_btns()
return status;
}
void mouse_get_cyberman_pos( int *x, int *y )
{
// Shrug...
event_poll();
}
// Returns how long this button has been down since last call.
fix mouse_button_down_time(int button)
{
@ -193,5 +171,3 @@ int mouse_button_state(int button)
event_poll();
return Mouse.buttons[button].pressed;
}

View file

@ -964,11 +964,11 @@ void start_time()
void game_flush_inputs()
{
int dx,dy;
int dx,dy,dz;
key_flush();
joy_flush();
mouse_flush();
mouse_get_delta( &dx, &dy ); // Read mouse
mouse_get_delta( &dx, &dy, &dz ); // Read mouse
memset(&Controls,0,sizeof(control_info));
}
@ -1790,7 +1790,7 @@ void show_help()
m[mc].type = NM_TYPE_TEXT; m[mc].text = TXT_HELP_ALT_F3; mc++;
m[mc].type = NM_TYPE_TEXT; m[mc].text = TXT_HELP_F2; mc++;
m[mc].type = NM_TYPE_TEXT; m[mc].text = TXT_HELP_F3; mc++;
m[mc].type = NM_TYPE_TEXT; m[mc].text = "SHIFT-F3\t TOGGLE RADAR"; mc++;
m[mc].type = NM_TYPE_TEXT; m[mc].text = "F4\t TOGGLE RADAR"; mc++;
m[mc].type = NM_TYPE_TEXT; m[mc].text = TXT_HELP_F5; mc++;
m[mc].type = NM_TYPE_TEXT; m[mc].text = "ALT-F7\t switch hud-mode"; mc++;
m[mc].type = NM_TYPE_TEXT; m[mc].text = "ALT-F9/F10\t change screen size"; mc++;
@ -2415,9 +2415,9 @@ void HandleGameKey(int key)
case KEY_F1: do_show_help(); break;
case KEY_F2: Config_menu_flag = 1; break;
case KEY_F3: toggle_cockpit(); break;
case KEY_F4:
case KEY_SHIFTED+KEY_F3: if(!(Game_mode & GM_MULTI)||Network_allow_radar||I_am_observer)
show_radar = !show_radar; break;
case KEY_F4: palette_save(); joydefs_calibrate(); palette_restore(); break;
case KEY_F5:
if ( Newdemo_state == ND_STATE_RECORDING )
newdemo_stop_recording();

View file

@ -538,11 +538,6 @@ int main(int argc,char **argv)
control_invul_time = 0;
#endif
i = FindArg( "-xcontrol" );
if ( i > 0 ) {
kconfig_init_external_controls( strtol(Args[i+1], NULL, 0), strtol(Args[i+2], NULL, 0) );
}
if (Inferno_verbose)
printf( "\n%s\n\n", TXT_INITIALIZING_GRAPHICS);
if ((t=gr_init( SM_ORIGINAL ))!=0)

File diff suppressed because it is too large Load diff

View file

@ -11,116 +11,9 @@ AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
*/
/*
* $Source: /cvsroot/dxx-rebirth/d1x-rebirth/main/kconfig.h,v $
* $Revision: 1.1.1.1 $
* $Author: zicodxx $
* $Date: 2006/03/17 19:44:27 $
*
* Prototypes for reading controls
*
* $Log: kconfig.h,v $
* Revision 1.1.1.1 2006/03/17 19:44:27 zicodxx
* initial import
*
* Revision 1.4 2000/04/19 21:27:57 sekmu
* movable death-cam from WraithX
*
* Revision 1.3 1999/10/15 05:22:15 donut
* typedef'd ssize_t on windows
*
* Revision 1.2 1999/10/14 04:48:20 donut
* alpha fixes, and gl_font args
*
* Revision 1.1.1.1 1999/06/14 22:12:31 donut
* Import of d1x 1.37 source.
*
* Revision 2.0 1995/02/27 11:29:38 john
* New version 2.0, which has no anonymous unions, builds with
* Watcom 10.0, and doesn't require parsing BITMAPS.TBL.
*
* Revision 1.23 1995/01/12 11:41:44 john
* Added external control reading.
*
* Revision 1.22 1994/12/07 16:15:30 john
* Added command to check to see if a joystick axes has been used.
*
* Revision 1.21 1994/11/29 03:46:29 john
* Added joystick sensitivity; Added sound channels to detail menu. Removed -maxchannels
* command line arg.
*
* Revision 1.20 1994/11/22 16:54:45 mike
* autorepeat on missiles.
*
* Revision 1.19 1994/11/07 14:01:27 john
* Changed the gamma correction sequencing.
*
* Revision 1.18 1994/11/01 16:40:02 john
* Added Gamma correction.
*
* Revision 1.17 1994/10/25 23:09:24 john
* Made the automap key configurable.
*
* Revision 1.16 1994/10/24 19:56:51 john
* Made the new user setup prompt for config options.
*
* Revision 1.15 1994/10/24 17:44:18 john
* Added stereo channel reversing.
*
* Revision 1.14 1994/10/22 13:19:33 john
* Took out toggle primary/secondary weapons. Fixed black
* background for 'axes' and 'buttons' text.
*
* Revision 1.13 1994/10/17 13:06:51 john
* Moved the descent.cfg info into the player config file.
*
* Revision 1.12 1994/10/14 12:14:47 john
* Changed code so that by doing DEL+F12 saves the current kconfig
* values as default. Added support for drop_bomb key. Took out
* unused slots for keyboard. Made keyboard use control_type of 0
* save slots.
*
* Revision 1.11 1994/10/13 19:21:33 john
* Added separate config saves for different devices.
* Made all the devices work together better, such as mice won't
* get read when you're playing with the joystick.
*
* Revision 1.10 1994/10/13 15:18:41 john
* Started ripping out old afterburner, show message, show automap
* keys in the keyboard config stuff.
*
* Revision 1.9 1994/10/13 11:35:27 john
* Made Thrustmaster FCS Hat work. Put a background behind the
* keyboard configure. Took out turn_sensitivity. Changed sound/config
* menu to new menu. Made F6 be calibrate joystick.
*
* Revision 1.8 1994/10/06 14:10:50 matt
* New function reset_cruise()
*
* Revision 1.7 1994/10/03 14:58:25 john
* Added rear_view_down_state so that the rear view can
* work like the automap.
*
* Revision 1.6 1994/09/30 12:37:25 john
* Added midi,digi volume to configuration.
*
* Revision 1.5 1994/09/19 18:49:59 john
* Added switch to disable joystick.
*
* Revision 1.4 1994/09/15 16:11:21 john
* Added support for VFX1 head tracking. Fixed bug with memory over-
* write when using stereo mode.
*
* Revision 1.3 1994/09/12 11:47:38 john
* Made stupid cruise work better. Make kconfig values get
* read/written to disk.
*
* Revision 1.2 1994/09/10 15:46:55 john
* First version of new keyboard configuration.
*
* Revision 1.1 1994/09/10 13:51:40 john
* Initial revision
*
*
*/
#include "types.h"
@ -129,100 +22,69 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#define _KCONFIG_H
typedef struct control_info {
fix pitch_time;
fix pitch_time;
fix vertical_thrust_time;
fix heading_time;
fix sideways_thrust_time;
fix bank_time;
fix forward_thrust_time;
ubyte rear_view_down_count;
ubyte rear_view_down_state;
ubyte fire_primary_down_count;
ubyte fire_primary_state;
ubyte fire_secondary_state;
ubyte fire_secondary_down_count;
ubyte fire_flare_down_count;
ubyte drop_bomb_down_count;
ubyte automap_down_count;
ubyte automap_state;
//added on 8/6/98 by Victor Rachels to add weapon cycle
ubyte cycle_primary_state;
ubyte cycle_primary_down_count;
ubyte cycle_secondary_state;
ubyte cycle_secondary_down_count;
//end this section edit - Victor Rachels
} control_info;
#define CONTROL_NONE 0
#define CONTROL_JOYSTICK 1
#define CONTROL_MOUSE 5
#define CONTROL_MAX_TYPES 7
#define CONTROL_JOYMOUSE 8
// old stuff - kept for compability reasons
#define CONTROL_FLIGHTSTICK_PRO 2
#define CONTROL_THRUSTMASTER_FCS 3
#define CONTROL_GRAVIS_GAMEPAD 4
#define CONTROL_CYBERMAN 6
#define NUM_D1X_CONTROLS 28
#define MAX_D1X_CONTROLS 40
#define NUM_KEY_CONTROLS 46
#define NUM_JOYSTICK_CONTROLS 44
#define NUM_MOUSE_CONTROLS 29
#define MAX_CONTROLS 62
#define MAX_NOND1X_CONTROLS 50
void kconfig_sense_init();
extern control_info Controls;
extern void controls_read_all();
extern void kconfig(int n, char * title );
extern ubyte Config_digi_volume;
extern ubyte Config_midi_volume;
extern ubyte Config_control_type;
extern ubyte Config_channels_reversed;
extern ubyte Config_joystick_sensitivity;
extern ubyte Config_mouse_sensitivity;
#define CONTROL_NONE 0
#define CONTROL_JOYSTICK 1
#define CONTROL_FLIGHTSTICK_PRO 2
#define CONTROL_THRUSTMASTER_FCS 3
#define CONTROL_GRAVIS_GAMEPAD 4
#define CONTROL_MOUSE 5
#define CONTROL_CYBERMAN 6
#define CONTROL_MAX_TYPES 7
#define CONTROL_JOYMOUSE 8
//added on 2/4/99 by Victor Rachels to add new keys menu
#define NUM_D1X_CONTROLS 28
#define MAX_D1X_CONTROLS 40
extern ubyte kconfig_d1x_settings[MAX_D1X_CONTROLS];
extern ubyte default_kconfig_d1x_settings[MAX_D1X_CONTROLS];
//end this section addition - VR
//added/edited on 2/5/99 by Victor Rachels to move to kconfig_d1x_settings
//added/edited on 8/6/98 by Victor Rachels to add weapon cycle
//changed back from 50,29 due to compatability problems.
#define NUM_KEY_CONTROLS 46
#define NUM_JOYSTICK_CONTROLS 44
#define NUM_MOUSE_CONTROLS 27
//end this section edit - Victor Rachels
#define MAX_CONTROLS 60
#define MAX_NOND1X_CONTROLS 50
extern ubyte kconfig_settings[CONTROL_MAX_TYPES][MAX_CONTROLS];
extern ubyte default_kconfig_settings[CONTROL_MAX_TYPES][MAX_CONTROLS];
extern char *control_text[CONTROL_MAX_TYPES];
extern void kc_set_controls();
// Tries to use vfx1 head tracking.
void kconfig_sense_init();
//set the cruise speed to zero
extern void reset_cruise(void);
extern int kconfig_is_axes_used(int axis);
extern void kconfig_init_external_controls(int intno, ssize_t address);
extern void HUD_init_message(char * format, ...);
//the following methods added by WraithX, 4/17/00
extern int isJoyRotationKey(int test_key); //tells if "test_key" is setup for rotation on the joy
extern int isMouseRotationKey(int test_key); //tells if "test_key" is setup for rotation on the mouse
extern int isKeyboardRotationKey(int test_key); //tells if "test_key" is setup for rotation on the keyboard
//end addition - WraithX
#endif

View file

@ -1095,7 +1095,7 @@ void Laser_do_weapon_sequence(object *obj)
if (Weapon_info[obj->id].render_type == WEAPON_RENDER_POLYMODEL)
turn_radius = 0x0014 * F1_0; // homing missiles, mega missiles
else
turn_radius = 0x0020 * F1_0; // smart missile blobs
turn_radius = 0x0030 * F1_0; // smart missile blobs
vm_vec_sub(&vector_to_object, &Objects[track_goal].pos, &obj->pos);
@ -1107,15 +1107,15 @@ void Laser_do_weapon_sequence(object *obj)
// homing missile speeds : insane - 0x005a
max_speed = Weapon_info[obj->id].speed[Difficulty_level];
if (speed + F1_0 < max_speed)
if (speed /*+ F1_0*/ < max_speed)
{
speed += fixmul(max_speed, FrameTime/2);
if (speed > max_speed)
speed = max_speed;
}
dot = vm_vec_dot(&temp_vec, &vector_to_object);
Laser_TurnSpeedLimit(&temp_vec, &vector_to_object, speed, turn_radius);
obj->mtype.phys_info.velocity = temp_vec;
// orient it directly by movement vector
@ -1154,7 +1154,7 @@ void Laser_do_weapon_sequence(object *obj)
if (speed > max_speed)
speed = max_speed;
}
dot = vm_vec_dot(&temp_vec, &vector_to_object);
vm_vec_add2(&temp_vec, &vector_to_object);

View file

@ -673,8 +673,7 @@ void do_new_game_menu()
return; //abort!
strcpy(config_last_mission, m[new_mission_num] );
if (!load_mission(new_mission_num) || (strcmp(get_level_file(new_mission_num),"")?!cfexist(get_level_file(new_mission_num)):0)) {
if (!load_mission(new_mission_num)) {
nm_messagebox( NULL, 1, TXT_OK, "Error loading Mission file");
return;
}

View file

@ -462,14 +462,10 @@ int check_button_press()
switch (Config_control_type) {
case CONTROL_JOYSTICK:
case CONTROL_FLIGHTSTICK_PRO:
case CONTROL_THRUSTMASTER_FCS:
case CONTROL_GRAVIS_GAMEPAD:
for (i=0; i<4; i++ )
if (joy_get_button_down_cnt(i)>0) return 1;
break;
case CONTROL_MOUSE:
case CONTROL_CYBERMAN:
case CONTROL_JOYMOUSE:
#ifndef NEWMENU_MOUSE // don't allow mouse to continue from menu
for (i=0; i<3; i++ )
@ -549,7 +545,7 @@ int newmenu_do3_real( char * title, char * subtitle, int nitems, newmenu_item *
int sound_stopped=0, time_stopped=0;
#ifdef NEWMENU_MOUSE
int mouse_state, omouse_state, dblclick_flag=0;
int mx=0, my=0, x1 = 0, x2, y1, y2;
int mx=0, my=0, mz=0, x1 = 0, x2, y1, y2;
int close_box=0;
#endif
@ -1092,7 +1088,7 @@ int newmenu_do3_real( char * title, char * subtitle, int nitems, newmenu_item *
#ifdef NEWMENU_MOUSE // for mouse selection of menu's etc.
if ( !done && mouse_state && !omouse_state && !all_text ) {
mouse_get_pos(&mx, &my);
mouse_get_pos(&mx, &my, &mz);
for (i=0; i<nitems; i++ ) {
x1 = grd_curcanv->cv_bitmap.bm_x + item[i].x - item[i].right_offset - 6;
x2 = x1 + item[i].w;
@ -1134,7 +1130,7 @@ int newmenu_do3_real( char * title, char * subtitle, int nitems, newmenu_item *
done = 1;
if ( !done && mouse_state && !all_text ) {
mouse_get_pos(&mx, &my);
mouse_get_pos(&mx, &my, &mz);
for (i=0; i<nitems; i++ ) {
x1 = grd_curcanv->cv_bitmap.bm_x + item[i].x - item[i].right_offset - 6;
@ -1204,7 +1200,7 @@ int newmenu_do3_real( char * title, char * subtitle, int nitems, newmenu_item *
}
if ( !done && !mouse_state && omouse_state && !all_text && (choice != -1) && (item[choice].type == NM_TYPE_MENU) ) {
mouse_get_pos(&mx, &my);
mouse_get_pos(&mx, &my, &mz);
x1 = grd_curcanv->cv_bitmap.bm_x + item[choice].x;
x2 = x1 + item[choice].w;
y1 = grd_curcanv->cv_bitmap.bm_y + item[choice].y;
@ -1230,7 +1226,7 @@ int newmenu_do3_real( char * title, char * subtitle, int nitems, newmenu_item *
}
if ( !done && !mouse_state && omouse_state && close_box ) {
mouse_get_pos(&mx, &my);
mouse_get_pos(&mx, &my, &mz);
x1 = grd_curcanv->cv_bitmap.bm_x + CLOSE_X;
x2 = x1 + CLOSE_SIZE;
y1 = grd_curcanv->cv_bitmap.bm_y + CLOSE_Y;
@ -1519,7 +1515,7 @@ int newmenu_get_filename( char * title, char * filespec, char * filename, int al
bkg bg; // background under listbox
#endif
#ifdef NEWMENU_MOUSE
int mx, my, x1, x2, y1, y2, mouse_state, omouse_state;
int mx, my, mz, x1, x2, y1, y2, mouse_state, omouse_state;
int mouse2_state, omouse2_state;
int dblclick_flag=0;
#endif
@ -1848,7 +1844,7 @@ ReadFileNames:
if (mouse_state || mouse2_state) {
int w, h, aw;
mouse_get_pos(&mx, &my);
mouse_get_pos(&mx, &my, &mz);
for (i=first_item; i<first_item+NumFiles_displayed; i++ ) {
gr_get_string_size(&filenames[i*14], &w, &h, &aw );
x1 = box_x;
@ -1870,7 +1866,7 @@ ReadFileNames:
int w, h, aw;
gr_get_string_size(&filenames[citem*14], &w, &h, &aw );
mouse_get_pos(&mx, &my);
mouse_get_pos(&mx, &my, &mz);
x1 = box_x;
x2 = box_x + box_w - 1;
y1 = (citem-first_item)*FONTSCALE_Y(grd_curcanv->cv_font->ft_h + 2) + box_y;
@ -1882,7 +1878,7 @@ ReadFileNames:
}
if ( !mouse_state && omouse_state ) {
mouse_get_pos(&mx, &my);
mouse_get_pos(&mx, &my, &mz);
x1 = w_x + CLOSE_X + 2;
x2 = x1 + CLOSE_SIZE - 2;
y1 = w_y + CLOSE_Y + 2;
@ -2033,7 +2029,7 @@ int newmenu_listbox1( char * title, int nitems, char * items[], int allow_abort_
keyd_repeat = 1;
bkg bg;
#ifdef NEWMENU_MOUSE
int mx, my, x1, x2, y1, y2, mouse_state, omouse_state; //, dblclick_flag;
int mx, my, mz, x1, x2, y1, y2, mouse_state, omouse_state; //, dblclick_flag;
int close_x,close_y;
#endif
@ -2217,7 +2213,7 @@ int newmenu_listbox1( char * title, int nitems, char * items[], int allow_abort_
if (mouse_state) {
int w, h, aw;
mouse_get_pos(&mx, &my);
mouse_get_pos(&mx, &my, &mz);
for (i=first_item; i<first_item+LB_ITEMS_ON_SCREEN; i++ ) {
if (i > nitems)
break;
@ -2236,7 +2232,7 @@ int newmenu_listbox1( char * title, int nitems, char * items[], int allow_abort_
//check for close box clicked
if ( !mouse_state && omouse_state ) {
mouse_get_pos(&mx, &my);
mouse_get_pos(&mx, &my, &mz);
x1 = close_x + CLOSE_X + 2;
x2 = x1 + CLOSE_SIZE - 2;
y1 = close_y + CLOSE_Y + 2;

View file

@ -153,19 +153,10 @@ int nm_messagebox_fixedfont( char *title, int nchoices, ... );
#define SLIDER_MIDDLE "…" // 133
#define SLIDER_MARKER "†" // 134
#if defined(__WINDOWS__) || defined(SDL_INPUT)
# define NEWMENU_MOUSE
#endif
#define NEWMENU_MOUSE
#ifdef NEWMENU_MOUSE
# if defined(SDL_INPUT)
# include <SDL/SDL.h>
# define newmenu_show_cursor() SDL_ShowCursor(SDL_ENABLE)
# define newmenu_hide_cursor() SDL_ShowCursor(SDL_DISABLE)
# else
# define newmenu_show_cursor()
# define newmenu_hide_cursor()
# endif
#endif

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff