enabled mouse control of menus
This commit is contained in:
parent
ccbc4613c0
commit
4bd070046b
|
@ -1,5 +1,8 @@
|
|||
2003-11-24 Bradley Bell <btb@icculus.org>
|
||||
|
||||
* arch/sdl/mouse.c, main/konfig.c, main/newmenu.c, main/newmenu.h:
|
||||
enabled mouse control of menus
|
||||
|
||||
* main/mission.h: oops, didn't mean to change this.
|
||||
|
||||
2003-11-21 Bradley Bell <btb@icculus.org>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: mouse.c,v 1.5 2003-01-15 02:42:41 btb Exp $ */
|
||||
/* $Id: mouse.c,v 1.6 2003-11-25 04:13:04 btb Exp $ */
|
||||
/*
|
||||
*
|
||||
* SDL mouse driver.
|
||||
|
@ -110,6 +110,7 @@ void mouse_flush() // clears all mice events...
|
|||
Mouse.x = 0;
|
||||
Mouse.y = 0;
|
||||
Mouse.z = 0;
|
||||
SDL_GetMouseState(&Mouse.x, &Mouse.y); // necessary because polling only gives us the delta.
|
||||
}
|
||||
|
||||
//========================================================================
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: kconfig.c,v 1.24 2003-10-08 19:18:46 btb Exp $ */
|
||||
/* $Id: kconfig.c,v 1.25 2003-11-25 04:13:05 btb Exp $ */
|
||||
/*
|
||||
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
|
||||
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
|
||||
|
@ -346,7 +346,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
|||
#endif
|
||||
|
||||
#ifdef RCS
|
||||
static char rcsid[] = "$Id: kconfig.c,v 1.24 2003-10-08 19:18:46 btb Exp $";
|
||||
static char rcsid[] = "$Id: kconfig.c,v 1.25 2003-11-25 04:13:05 btb Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef WINDOWS
|
||||
|
@ -1099,24 +1099,24 @@ int find_next_item_left( kc_item * items, int nitems, int citem )
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(MACINTOSH) || defined(WINDOWS)
|
||||
#ifdef NEWMENU_MOUSE
|
||||
int get_item_height(kc_item *item)
|
||||
{
|
||||
int w, h, aw;
|
||||
char btext[10];
|
||||
|
||||
if (item->value==255) {
|
||||
sprintf( btext, "" );
|
||||
strcpy(btext, "");
|
||||
} else {
|
||||
switch( item->type ) {
|
||||
case BT_KEY:
|
||||
strncpy( btext, key_text[item->value], 10 ); break;
|
||||
case BT_MOUSE_BUTTON:
|
||||
#ifdef WINDOWS
|
||||
#ifndef MACINTOSH
|
||||
strncpy( btext, Text_string[mousebutton_text[item->value]], 10); break;
|
||||
#else
|
||||
#else
|
||||
strncpy( btext, mousebutton_text[item->value], 10 ); break;
|
||||
#endif
|
||||
#endif
|
||||
case BT_MOUSE_AXIS:
|
||||
strncpy( btext, Text_string[mouseaxis_text[item->value]], 10 ); break;
|
||||
case BT_JOY_BUTTON:
|
||||
|
@ -1145,10 +1145,10 @@ WINDOS(
|
|||
);
|
||||
grs_font * save_font;
|
||||
int old_keyd_repeat;
|
||||
#if defined(MACINTOSH) || defined(WINDOWS)
|
||||
#ifdef NEWMENU_MOUSE
|
||||
int mouse_state, omouse_state, mx, my, x1, x2, y1, y2;
|
||||
int close_x, close_y, close_size;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
int i,k,ocitem,citem;
|
||||
int time_stopped = 0;
|
||||
|
@ -1217,13 +1217,13 @@ WIN(DDGRLOCK(dd_grd_curcanv));
|
|||
// gr_string( 0x8000, 8, "Mouse" );
|
||||
// }
|
||||
|
||||
#if defined(MACINTOSH) || defined(WINDOWS)
|
||||
close_x = close_y = 15;
|
||||
close_size = 10;
|
||||
#ifdef NEWMENU_MOUSE
|
||||
close_x = close_y = MenuHires?15:7;
|
||||
close_size = MenuHires?10:5;
|
||||
gr_setcolor( BM_XRGB(0, 0, 0) );
|
||||
gr_rect(close_x, close_y, close_x + close_size, close_y + close_size);
|
||||
gr_setcolor( BM_XRGB(21, 21, 21) );
|
||||
gr_rect( close_x + 2, close_y + 2, close_x + close_size - 2, close_y + close_size -2 );
|
||||
gr_rect(close_x + LHX(1), close_y + LHX(1), close_x + close_size - LHX(1), close_y + close_size - LHX(1));
|
||||
#endif
|
||||
|
||||
grd_curcanv->cv_font = GAME_FONT;
|
||||
|
@ -1303,11 +1303,10 @@ WIN(DDGRUNLOCK(dd_grd_curcanv));
|
|||
|
||||
citem = 0;
|
||||
kc_drawitem( &items[citem], 1 );
|
||||
|
||||
WIN(ShowCursorW());
|
||||
MAC(show_cursor();)
|
||||
|
||||
#if defined(MACINTOSH) || defined(WINDOWS)
|
||||
newmenu_show_cursor();
|
||||
|
||||
#ifdef NEWMENU_MOUSE
|
||||
mouse_state = omouse_state = 0;
|
||||
#endif
|
||||
|
||||
|
@ -1336,12 +1335,12 @@ WIN(DDGRUNLOCK(dd_grd_curcanv));
|
|||
songs_check_redbook_repeat();
|
||||
|
||||
k = key_inkey();
|
||||
|
||||
#if defined(MACINTOSH) || defined(WINDOWS)
|
||||
|
||||
#ifdef NEWMENU_MOUSE
|
||||
omouse_state = mouse_state;
|
||||
mouse_state = mouse_button_state(0);
|
||||
#endif
|
||||
|
||||
|
||||
if ( !time_stopped ) {
|
||||
#ifdef NETWORK
|
||||
if (multi_menu_poll() == -1)
|
||||
|
@ -1454,8 +1453,7 @@ WIN(DDGRUNLOCK(dd_grd_curcanv));
|
|||
);
|
||||
keyd_repeat = old_keyd_repeat;
|
||||
game_flush_inputs();
|
||||
WIN( HideCursorW());
|
||||
MAC( hide_cursor(); )
|
||||
newmenu_hide_cursor();
|
||||
if (time_stopped)
|
||||
start_time();
|
||||
return;
|
||||
|
@ -1532,7 +1530,7 @@ WIN(DDGRUNLOCK(dd_grd_curcanv));
|
|||
#endif
|
||||
}
|
||||
|
||||
#if defined (MACINTOSH) || defined(WINDOWS)
|
||||
#ifdef NEWMENU_MOUSE
|
||||
if ( (mouse_state && !omouse_state) || (mouse_state && omouse_state) ) {
|
||||
int item_height;
|
||||
|
||||
|
@ -1559,8 +1557,7 @@ WIN(DDGRUNLOCK(dd_grd_curcanv));
|
|||
y1 = grd_curcanv->cv_bitmap.bm_y + LHY(items[citem].y);
|
||||
y2 = y1 + LHY(item_height);
|
||||
if (((mx > x1) && (mx < x2)) && ((my > y1) && (my < y2))) {
|
||||
WIN(HideCursorW());
|
||||
MAC(hide_cursor();)
|
||||
newmenu_hide_cursor();
|
||||
switch( items[citem].type ) {
|
||||
case BT_KEY: kc_change_key( &items[citem] ); break;
|
||||
case BT_MOUSE_BUTTON: kc_change_mousebutton( &items[citem] ); break;
|
||||
|
@ -1569,21 +1566,19 @@ WIN(DDGRUNLOCK(dd_grd_curcanv));
|
|||
case BT_JOY_AXIS: kc_change_joyaxis( &items[citem] ); break;
|
||||
case BT_INVERT: kc_change_invert( &items[citem] ); break;
|
||||
}
|
||||
MAC(show_cursor();)
|
||||
WIN(ShowCursorW());
|
||||
newmenu_show_cursor();
|
||||
} else {
|
||||
x1 = grd_curcanv->cv_bitmap.bm_x + close_x + 2;
|
||||
x2 = x1 + close_size - 2;
|
||||
y1 = grd_curcanv->cv_bitmap.bm_y + close_y + 2;
|
||||
y2 = y1 + close_size - 2;
|
||||
x1 = grd_curcanv->cv_bitmap.bm_x + close_x + LHX(1);
|
||||
x2 = x1 + close_size - LHX(1);
|
||||
y1 = grd_curcanv->cv_bitmap.bm_y + close_y + LHX(1);
|
||||
y2 = y1 + close_size - LHX(1);
|
||||
if ( ((mx > x1) && (mx < x2)) && ((my > y1) && (my < y2)) ) {
|
||||
grd_curcanv->cv_font = save_font;
|
||||
WINDOS(dd_gr_set_current_canvas( save_canvas ),
|
||||
gr_set_current_canvas( save_canvas ));
|
||||
keyd_repeat = old_keyd_repeat;
|
||||
game_flush_inputs();
|
||||
WIN(HideCursorW());
|
||||
MAC(hide_cursor();)
|
||||
newmenu_hide_cursor();
|
||||
if (time_stopped)
|
||||
start_time();
|
||||
return;
|
||||
|
@ -1591,15 +1586,13 @@ WIN(DDGRUNLOCK(dd_grd_curcanv));
|
|||
}
|
||||
|
||||
}
|
||||
#endif // MACINTOSH WINDOWS
|
||||
|
||||
#endif // NEWMENU_MOUSE
|
||||
|
||||
if (ocitem!=citem) {
|
||||
MAC(hide_cursor();)
|
||||
WIN(HideCursorW());
|
||||
newmenu_hide_cursor();
|
||||
kc_drawitem( &items[ocitem], 0 );
|
||||
kc_drawitem( &items[citem], 1 );
|
||||
WIN(ShowCursorW());
|
||||
MAC(show_cursor();)
|
||||
newmenu_show_cursor();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
206
main/newmenu.c
206
main/newmenu.c
|
@ -1,4 +1,4 @@
|
|||
/* $Id: newmenu.c,v 1.22 2003-11-18 00:29:53 btb Exp $ */
|
||||
/* $Id: newmenu.c,v 1.23 2003-11-25 04:13:05 btb Exp $ */
|
||||
/*
|
||||
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
|
||||
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
|
||||
|
@ -1236,11 +1236,11 @@ int check_button_press()
|
|||
break;
|
||||
case CONTROL_MOUSE:
|
||||
case CONTROL_CYBERMAN:
|
||||
#ifndef MACINTOSH // don't allow mouse to continue from menu
|
||||
#ifndef NEWMENU_MOUSE // don't allow mouse to continue from menu
|
||||
for (i=0; i<3; i++ )
|
||||
if (mouse_button_down_count(i)>0) return 1;
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
case CONTROL_WINJOYSTICK:
|
||||
#ifdef WINDOWS
|
||||
for (i=0; i<4; i++ )
|
||||
|
@ -1263,15 +1263,19 @@ int check_button_press()
|
|||
extern int network_request_player_names(int);
|
||||
extern int RestoringMenu;
|
||||
|
||||
#if defined(WINDOWS) || defined(MACINTOSH)
|
||||
#ifdef NEWMENU_MOUSE
|
||||
ubyte Hack_DblClick_MenuMode=0;
|
||||
#endif
|
||||
|
||||
MAC(extern ubyte joydefs_calibrating;)
|
||||
#ifdef MACINTOSH
|
||||
extern ubyte joydefs_calibrating;
|
||||
#else
|
||||
# define joydefs_calibrating 0
|
||||
#endif
|
||||
|
||||
#define CLOSE_X 15
|
||||
#define CLOSE_Y 15
|
||||
#define CLOSE_SIZE 10
|
||||
#define CLOSE_X (MenuHires?15:7)
|
||||
#define CLOSE_Y (MenuHires?15:7)
|
||||
#define CLOSE_SIZE (MenuHires?10:5)
|
||||
|
||||
void draw_close_box(int x,int y)
|
||||
{
|
||||
|
@ -1279,7 +1283,7 @@ void draw_close_box(int x,int y)
|
|||
gr_setcolor( BM_XRGB(0, 0, 0) );
|
||||
gr_rect(x + CLOSE_X, y + CLOSE_Y, x + CLOSE_X + CLOSE_SIZE, y + CLOSE_Y + CLOSE_SIZE);
|
||||
gr_setcolor( BM_XRGB(21, 21, 21) );
|
||||
gr_rect( x + CLOSE_X + 2, y + CLOSE_Y + 2, x + CLOSE_X + CLOSE_SIZE - 2, y + CLOSE_Y + CLOSE_SIZE - 2 );
|
||||
gr_rect(x + CLOSE_X + LHX(1), y + CLOSE_Y + LHX(1), x + CLOSE_X + CLOSE_SIZE - LHX(1), y + CLOSE_Y + CLOSE_SIZE - LHX(1));
|
||||
WIN (DDGRUNLOCK(dd_grd_curcanv));
|
||||
}
|
||||
|
||||
|
@ -1299,7 +1303,7 @@ int newmenu_do4( char * title, char * subtitle, int nitems, newmenu_item * item,
|
|||
int dont_restore=0;
|
||||
int MaxOnMenu=MAXDISPLAYABLEITEMS;
|
||||
WINDOS(dd_grs_canvas *save_canvas, grs_canvas *save_canvas );
|
||||
#if defined(MACINTOSH) || defined(WINDOWS)
|
||||
#ifdef NEWMENU_MOUSE
|
||||
int mouse_state, omouse_state, dblclick_flag=0;
|
||||
int mx=0, my=0, x1, x2, y1, y2;
|
||||
int close_box=0;
|
||||
|
@ -1312,8 +1316,7 @@ int newmenu_do4( char * title, char * subtitle, int nitems, newmenu_item * item,
|
|||
PA_DFX (pa_set_front_to_read());
|
||||
|
||||
WIN(if (!_AppActive) return -1); // Don't draw message if minimized!
|
||||
WIN(HideCursorW());
|
||||
MAC(hide_cursor();)
|
||||
newmenu_hide_cursor();
|
||||
|
||||
if (nitems < 1 )
|
||||
{
|
||||
|
@ -1652,10 +1655,10 @@ RePaintNewmenu4:
|
|||
if (citem < 0 ) citem = 0;
|
||||
if (citem > nitems-1 ) citem = nitems-1;
|
||||
choice = citem;
|
||||
|
||||
#if defined(WINDOWS) || defined(MACINTOSH)
|
||||
|
||||
#ifdef NEWMENU_MOUSE
|
||||
dblclick_flag = 1;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
while ( item[choice].type==NM_TYPE_TEXT ) {
|
||||
choice++;
|
||||
|
@ -1676,26 +1679,22 @@ RePaintNewmenu4:
|
|||
// Clear mouse, joystick to clear button presses.
|
||||
game_flush_inputs();
|
||||
|
||||
#if defined(WINDOWS) || defined(MACINTOSH)
|
||||
#ifdef NEWMENU_MOUSE
|
||||
mouse_state = omouse_state = 0;
|
||||
if (filename == NULL && !MenuReordering) {
|
||||
draw_close_box(0,0);
|
||||
close_box = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef WINDOWS
|
||||
if (!MenuReordering) {
|
||||
ShowCursorW();
|
||||
SetCursor (LoadCursor(NULL,IDC_ARROW));
|
||||
if (!MenuReordering && !joydefs_calibrating)
|
||||
{
|
||||
newmenu_show_cursor();
|
||||
# ifdef WINDOWS
|
||||
SetCursor(LoadCursor(NULL,IDC_ARROW));
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MACINTOSH
|
||||
if (!joydefs_calibrating)
|
||||
show_cursor();
|
||||
#endif
|
||||
|
||||
mprintf ((0,"Set to true!\n"));
|
||||
|
||||
while(!done) {
|
||||
|
@ -1725,16 +1724,10 @@ RePaintNewmenu4:
|
|||
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef MACINTOSH
|
||||
omouse_state = mouse_state;
|
||||
mouse_state = mouse_button_state(0);
|
||||
#ifdef NEWMENU_MOUSE
|
||||
if (!joydefs_calibrating)
|
||||
show_cursor(); // possibly hidden
|
||||
#endif
|
||||
|
||||
#ifdef WINDOWS
|
||||
omouse_state = mouse_state;
|
||||
newmenu_show_cursor(); // possibly hidden
|
||||
omouse_state = mouse_state;
|
||||
if (!MenuReordering)
|
||||
mouse_state = mouse_button_state(0);
|
||||
//@@ mprintf ((0,"mouse state:%d\n",mouse_state));
|
||||
|
@ -1987,14 +1980,14 @@ RePaintNewmenu4:
|
|||
|
||||
MAC(case KEY_COMMAND+KEY_SHIFTED+KEY_3:)
|
||||
case KEY_PRINT_SCREEN:
|
||||
MAC(hide_cursor());
|
||||
MAC(newmenu_hide_cursor());
|
||||
save_screen_shot(0);
|
||||
PA_DFX (pa_set_frontbuffer_current());
|
||||
PA_DFX (pa_set_front_to_read());
|
||||
for (i=0;i<nitems;i++)
|
||||
item[i].redraw=1;
|
||||
|
||||
MAC(show_cursor());
|
||||
MAC(newmenu_show_cursor());
|
||||
MAC(key_flush());
|
||||
break;
|
||||
|
||||
|
@ -2021,7 +2014,7 @@ RePaintNewmenu4:
|
|||
|
||||
key_close(); // no processing of keys with keyboard handler.. jeez
|
||||
stop_time();
|
||||
hide_cursor();
|
||||
newmenu_hide_cursor();
|
||||
show_boxed_message ("Mounting CD\nESC to quit");
|
||||
RBAMountDisk(); // OS has totaly control of the CD.
|
||||
if (Function_mode == FMODE_MENU)
|
||||
|
@ -2029,7 +2022,7 @@ RePaintNewmenu4:
|
|||
else if (Function_mode == FMODE_GAME)
|
||||
songs_play_level_song( Current_level_num );
|
||||
clear_boxed_message();
|
||||
show_cursor();
|
||||
newmenu_show_cursor();
|
||||
key_init();
|
||||
key_flush();
|
||||
start_time();
|
||||
|
@ -2049,7 +2042,7 @@ RePaintNewmenu4:
|
|||
if ( !(Game_mode & GM_MULTI) )
|
||||
macintosh_quit();
|
||||
if (!joydefs_calibrating)
|
||||
show_cursor();
|
||||
newmenu_show_cursor();
|
||||
k = -1; // force key not to register
|
||||
break;
|
||||
}
|
||||
|
@ -2064,7 +2057,7 @@ RePaintNewmenu4:
|
|||
|
||||
}
|
||||
|
||||
#if defined(MACINTOSH) || defined(WINDOWS) // for mouse selection of menu's etc.
|
||||
#ifdef NEWMENU_MOUSE // for mouse selection of menu's etc.
|
||||
WIN(Sleep(100));
|
||||
if ( !done && mouse_state && !omouse_state && !all_text ) {
|
||||
mouse_get_pos(&mx, &my);
|
||||
|
@ -2277,7 +2270,7 @@ RePaintNewmenu4:
|
|||
|
||||
// HACK! Don't redraw loadgame preview
|
||||
if (RestoringMenu) item[0].redraw = 0;
|
||||
#endif // ifdef MACINTOSH
|
||||
#endif // NEWMENU_MOUSE
|
||||
|
||||
if ( choice > -1 ) {
|
||||
int ascii;
|
||||
|
@ -2382,12 +2375,13 @@ RePaintNewmenu4:
|
|||
if (item[i].redraw) // warning! ugly hack below
|
||||
{
|
||||
item[i].y-=((string_height+1)*ScrollOffset);
|
||||
MAC(hide_cursor());
|
||||
WIN(HideCursorW());
|
||||
newmenu_hide_cursor();
|
||||
draw_item( &bg, &item[i], (i==choice && !all_text),TinyMode );
|
||||
item[i].redraw=0;
|
||||
MAC(if (!joydefs_calibrating) show_cursor());
|
||||
WIN(if (!MenuReordering) ShowCursorW());
|
||||
#ifdef NEWMENU_MOUSE
|
||||
if (!MenuReordering && !joydefs_calibrating)
|
||||
newmenu_show_cursor();
|
||||
#endif
|
||||
item[i].y+=((string_height+1)*ScrollOffset);
|
||||
}
|
||||
if (i==choice && (item[i].type==NM_TYPE_INPUT || (item[i].type==NM_TYPE_INPUT_MENU && item[i].group)))
|
||||
|
@ -2429,10 +2423,9 @@ RePaintNewmenu4:
|
|||
gr_palette_fade_in( gr_palette, 32, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
MAC(hide_cursor());
|
||||
WIN(HideCursorW());
|
||||
|
||||
|
||||
newmenu_hide_cursor();
|
||||
|
||||
// Restore everything...
|
||||
|
||||
WINDOS ( dd_gr_set_current_canvas(bg.menu_canvas),
|
||||
|
@ -2604,12 +2597,14 @@ int newmenu_get_filename( char * title, char * filespec, char * filename, int al
|
|||
int w_x, w_y, w_w, w_h, title_height;
|
||||
int box_x, box_y, box_w, box_h;
|
||||
bkg bg; // background under listbox
|
||||
#if defined(MACINTOSH) || defined(WINDOWS)
|
||||
#ifdef NEWMENU_MOUSE
|
||||
int mx, my, x1, x2, y1, y2, mouse_state, omouse_state;
|
||||
int mouse2_state, omouse2_state;
|
||||
int dblclick_flag=0;
|
||||
int simukey=0;
|
||||
# ifdef WINDOWS
|
||||
int simukey=0;
|
||||
int show_up_arrow=0,show_down_arrow=0;
|
||||
# endif
|
||||
#endif
|
||||
WIN(int win_redraw=0);
|
||||
|
||||
|
@ -2809,23 +2804,19 @@ RePaintNewmenuFile:
|
|||
#endif
|
||||
for ( i=0; i<NumFiles; i++ ) {
|
||||
if (!stricmp(Players[Player_num].callsign, &filenames[i*14]) ) {
|
||||
#if defined(WINDOWS) || defined(MACINTOSH)
|
||||
#ifdef NEWMENU_MOUSE
|
||||
dblclick_flag = 1;
|
||||
#endif
|
||||
#endif
|
||||
citem = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(MACINTOSH) || defined(WINDOWS)
|
||||
|
||||
#ifdef NEWMENU_MOUSE
|
||||
mouse_state = omouse_state = 0;
|
||||
mouse2_state = omouse2_state = 0;
|
||||
draw_close_box(w_x,w_y);
|
||||
#ifdef MACINTOSH
|
||||
show_cursor();
|
||||
#else
|
||||
ShowCursorW();
|
||||
#endif
|
||||
newmenu_show_cursor();
|
||||
#endif
|
||||
|
||||
while(!done) {
|
||||
|
@ -2851,7 +2842,7 @@ RePaintNewmenuFile:
|
|||
ofirst_item = first_item;
|
||||
gr_update();
|
||||
|
||||
#if defined(MACINTOSH) || defined(WINDOWS)
|
||||
#ifdef NEWMENU_MOUSE
|
||||
omouse_state = mouse_state;
|
||||
omouse2_state = mouse2_state;
|
||||
mouse_state = mouse_button_state(0);
|
||||
|
@ -2880,12 +2871,12 @@ RePaintNewmenuFile:
|
|||
switch(key) {
|
||||
MAC(case KEY_COMMAND+KEY_SHIFTED+KEY_3:)
|
||||
case KEY_PRINT_SCREEN:
|
||||
MAC(hide_cursor());
|
||||
MAC(newmenu_hide_cursor());
|
||||
save_screen_shot(0);
|
||||
PA_DFX (pa_set_frontbuffer_current());
|
||||
PA_DFX (pa_set_front_to_read());
|
||||
|
||||
MAC(show_cursor());
|
||||
MAC(newmenu_show_cursor());
|
||||
MAC(key_flush());
|
||||
break;
|
||||
|
||||
|
@ -2896,20 +2887,18 @@ RePaintNewmenuFile:
|
|||
|
||||
if ( ((player_mode)&&(citem>0)) || ((demo_mode)&&(citem>=0)) ) {
|
||||
int x = 1;
|
||||
MAC(hide_cursor());
|
||||
#ifdef WINDOWS
|
||||
mouse_set_mode(1); //re-enable centering mode
|
||||
HideCursorW();
|
||||
#endif
|
||||
newmenu_hide_cursor();
|
||||
if (player_mode)
|
||||
x = nm_messagebox( NULL, 2, TXT_YES, TXT_NO, "%s %s?", TXT_DELETE_PILOT, &filenames[citem*14]+((player_mode && filenames[citem*14]=='$')?1:0) );
|
||||
else if (demo_mode)
|
||||
x = nm_messagebox( NULL, 2, TXT_YES, TXT_NO, "%s %s?", TXT_DELETE_DEMO, &filenames[citem*14]+((demo_mode && filenames[citem*14]=='$')?1:0) );
|
||||
MAC(show_cursor());
|
||||
#ifdef WINDOWS
|
||||
mouse_set_mode(0); //disenable centering mode
|
||||
ShowCursorW();
|
||||
#endif
|
||||
newmenu_show_cursor();
|
||||
if (x==0) {
|
||||
char * p;
|
||||
int ret;
|
||||
|
@ -2997,7 +2986,7 @@ RePaintNewmenuFile:
|
|||
|
||||
if ( !(Game_mode & GM_MULTI) )
|
||||
macintosh_quit();
|
||||
show_cursor();
|
||||
newmenu_show_cursor();
|
||||
key_flush();
|
||||
break;
|
||||
}
|
||||
|
@ -3065,7 +3054,7 @@ RePaintNewmenuFile:
|
|||
|
||||
if (first_item < 0 ) first_item = 0;
|
||||
|
||||
#if defined(MACINTOSH) || defined(WINDOWS)
|
||||
#ifdef NEWMENU_MOUSE
|
||||
WIN(Sleep(100));
|
||||
if (mouse_state || mouse2_state) {
|
||||
int w, h, aw;
|
||||
|
@ -3140,8 +3129,7 @@ RePaintNewmenuFile:
|
|||
#else
|
||||
if (ofirst_item != first_item) {
|
||||
#endif
|
||||
MAC(hide_cursor());
|
||||
WIN(HideCursorW());
|
||||
newmenu_hide_cursor();
|
||||
gr_setcolor( BM_XRGB( 0,0,0) );
|
||||
for (i=first_item; i<first_item+NumFiles_displayed; i++ ) {
|
||||
int w, h, aw, y;
|
||||
|
@ -3178,13 +3166,11 @@ RePaintNewmenuFile:
|
|||
gr_string( box_x + 5, y, (&filenames[i*14])+((player_mode && filenames[i*14]=='$')?1:0) );
|
||||
}
|
||||
}
|
||||
WIN(ShowCursorW());
|
||||
MAC(show_cursor());
|
||||
newmenu_show_cursor();
|
||||
} else if ( citem != ocitem ) {
|
||||
int w, h, aw, y;
|
||||
|
||||
MAC(hide_cursor());
|
||||
WIN(HideCursorW());
|
||||
newmenu_hide_cursor();
|
||||
i = ocitem;
|
||||
if ( (i>=0) && (i<NumFiles) ) {
|
||||
y = (i-first_item)*(grd_curfont->ft_h+2)+box_y;
|
||||
|
@ -3207,8 +3193,7 @@ RePaintNewmenuFile:
|
|||
gr_rect( box_x, y-1, box_x + box_x - 1, y + h + 1 );
|
||||
gr_string( box_x + 5, y, (&filenames[i*14])+((player_mode && filenames[i*14]=='$')?1:0) );
|
||||
}
|
||||
WIN(ShowCursorW());
|
||||
MAC(show_cursor());
|
||||
newmenu_show_cursor();
|
||||
}
|
||||
|
||||
#ifdef WINDOWS
|
||||
|
@ -3239,7 +3224,7 @@ RePaintNewmenuFile:
|
|||
}
|
||||
|
||||
ExitFileMenuEarly:
|
||||
MAC(hide_cursor());
|
||||
MAC(newmenu_hide_cursor());
|
||||
if ( citem > -1 ) {
|
||||
strncpy( filename, (&filenames[citem*14])+((player_mode && filenames[citem*14]=='$')?1:0), FILENAME_LEN );
|
||||
exit_value = 1;
|
||||
|
@ -3276,7 +3261,7 @@ ExitFileMenu:
|
|||
d_free(filenames);
|
||||
|
||||
WIN(mouse_set_mode(1)); //re-enable centering mode
|
||||
WIN(HideCursorW());
|
||||
WIN(newmenu_hide_cursor());
|
||||
|
||||
return exit_value;
|
||||
|
||||
|
@ -3319,10 +3304,12 @@ int newmenu_listbox1( char * title, int nitems, char * items[], int allow_abort_
|
|||
int width, height, wx, wy, title_height, border_size;
|
||||
int total_width,total_height;
|
||||
bkg bg;
|
||||
#if defined(MACINTOSH) || defined(WINDOWS)
|
||||
#ifdef NEWMENU_MOUSE
|
||||
int mx, my, x1, x2, y1, y2, mouse_state, omouse_state; //, dblclick_flag;
|
||||
int close_x,close_y;
|
||||
# ifdef WINDOWS
|
||||
int simukey=0,show_up_arrow=0,show_down_arrow=0;
|
||||
# endif
|
||||
#endif
|
||||
WIN(int win_redraw=0);
|
||||
|
||||
|
@ -3422,16 +3409,12 @@ RePaintNewmenuListbox:
|
|||
|
||||
first_item = -1;
|
||||
|
||||
#if defined(MACINTOSH) || defined(WINDOWS)
|
||||
#ifdef NEWMENU_MOUSE
|
||||
mouse_state = omouse_state = 0; //dblclick_flag = 0;
|
||||
close_x = wx-border_size;
|
||||
close_y = wy-title_height-border_size;
|
||||
draw_close_box(close_x,close_y);
|
||||
#ifdef MACINTOSH
|
||||
show_cursor();
|
||||
#else
|
||||
ShowCursorW();
|
||||
#endif
|
||||
newmenu_show_cursor();
|
||||
#endif
|
||||
|
||||
while(!done) {
|
||||
|
@ -3454,7 +3437,7 @@ RePaintNewmenuListbox:
|
|||
|
||||
ocitem = citem;
|
||||
ofirst_item = first_item;
|
||||
#if defined(MACINTOSH) || defined(WINDOWS)
|
||||
#ifdef NEWMENU_MOUSE
|
||||
omouse_state = mouse_state;
|
||||
mouse_state = mouse_button_state(0);
|
||||
#endif
|
||||
|
@ -3493,12 +3476,12 @@ RePaintNewmenuListbox:
|
|||
switch(key) {
|
||||
MAC(case KEY_COMMAND+KEY_SHIFTED+KEY_3:)
|
||||
case KEY_PRINT_SCREEN:
|
||||
MAC(hide_cursor());
|
||||
MAC(newmenu_hide_cursor());
|
||||
save_screen_shot(0);
|
||||
PA_DFX (pa_set_frontbuffer_current());
|
||||
PA_DFX (pa_set_front_to_read());
|
||||
|
||||
MAC(show_cursor());
|
||||
MAC(newmenu_show_cursor());
|
||||
MAC(key_flush());
|
||||
break;
|
||||
case KEY_HOME:
|
||||
|
@ -3542,7 +3525,7 @@ RePaintNewmenuListbox:
|
|||
|
||||
if ( !(Game_mode & GM_MULTI) )
|
||||
macintosh_quit();
|
||||
show_cursor();
|
||||
newmenu_show_cursor();
|
||||
key_flush();
|
||||
break;
|
||||
}
|
||||
|
@ -3603,7 +3586,7 @@ RePaintNewmenuListbox:
|
|||
#endif
|
||||
|
||||
|
||||
#if defined(MACINTOSH) || defined(WINDOWS)
|
||||
#ifdef NEWMENU_MOUSE
|
||||
WIN(Sleep(100));
|
||||
if (mouse_state) {
|
||||
int w, h, aw;
|
||||
|
@ -3674,8 +3657,7 @@ RePaintNewmenuListbox:
|
|||
#endif
|
||||
|
||||
if ( (ofirst_item != first_item) || redraw) {
|
||||
MAC(hide_cursor());
|
||||
WIN(HideCursorW());
|
||||
newmenu_hide_cursor();
|
||||
WIN(DDGRLOCK(dd_grd_curcanv));
|
||||
|
||||
gr_setcolor( BM_XRGB( 0,0,0) );
|
||||
|
@ -3722,14 +3704,12 @@ RePaintNewmenuListbox:
|
|||
|
||||
|
||||
WIN(DDGRUNLOCK(dd_grd_curcanv));
|
||||
WIN(ShowCursorW());
|
||||
MAC(show_cursor());
|
||||
newmenu_show_cursor();
|
||||
gr_update();
|
||||
} else if ( citem != ocitem ) {
|
||||
int w, h, aw, y;
|
||||
|
||||
MAC(hide_cursor());
|
||||
WIN(HideCursorW());
|
||||
newmenu_hide_cursor();
|
||||
|
||||
WIN(DDGRLOCK(dd_grd_curcanv));
|
||||
|
||||
|
@ -3758,13 +3738,11 @@ RePaintNewmenuListbox:
|
|||
}
|
||||
WIN(DDGRUNLOCK(dd_grd_curcanv));
|
||||
|
||||
WIN(ShowCursorW());
|
||||
MAC(show_cursor());
|
||||
newmenu_show_cursor();
|
||||
gr_update();
|
||||
}
|
||||
}
|
||||
MAC(hide_cursor());
|
||||
WIN(HideCursorW());
|
||||
newmenu_hide_cursor();
|
||||
|
||||
keyd_repeat = old_keyd_repeat;
|
||||
|
||||
|
@ -3912,8 +3890,28 @@ void nm_wrap_text(char *dbuf, char *sbuf, int line_length)
|
|||
|
||||
d_free(tbuf);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef NEWMENU_MOUSE
|
||||
void newmenu_show_cursor()
|
||||
{
|
||||
#if defined(MACINTOSH)
|
||||
show_cursor();
|
||||
#elif defined(WINDOWS)
|
||||
ShowCursorW();
|
||||
#elif defined(SDL_INPUT)
|
||||
SDL_ShowCursor(SDL_ENABLE);
|
||||
#endif
|
||||
}
|
||||
|
||||
void newmenu_hide_cursor()
|
||||
{
|
||||
#if defined(MACINTOSH)
|
||||
hide_cursor();
|
||||
#elif defined(WINDOWS)
|
||||
HideCursorW();
|
||||
#elif defined(SDL_INPUT)
|
||||
SDL_ShowCursor(SDL_DISABLE);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: newmenu.h,v 1.4 2003-10-10 09:36:35 btb Exp $ */
|
||||
/* $Id: newmenu.h,v 1.5 2003-11-25 04:13:05 btb Exp $ */
|
||||
/*
|
||||
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
|
||||
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
|
||||
|
@ -240,4 +240,11 @@ int nm_messagebox_fixedfont(char *title, int nchoices, ...);
|
|||
//should be called whenever the palette changes
|
||||
extern void nm_remap_background(void);
|
||||
|
||||
#if defined(MACINTOSH) || defined(WINDOWS) || defined(SDL_INPUT)
|
||||
# define NEWMENU_MOUSE
|
||||
void newmenu_show_cursor();
|
||||
void newmenu_hide_cursor();
|
||||
void draw_close_box(int x, int y);
|
||||
#endif
|
||||
|
||||
#endif /* _NEWMENU_H */
|
||||
|
|
Loading…
Reference in a new issue