1 /*    SCCS Id: @(#)winkey.c    3.1    93/04/02 */
2 /* Copyright (c) Gregg Wonderly, Naperville, Illinois,  1991,1992,1993. */
3 /* NetHack may be freely redistributed.  See license for details. */
4 
5 #include "NH:sys/amiga/windefs.h"
6 #include "NH:sys/amiga/winext.h"
7 #include "NH:sys/amiga/winproto.h"
8 
amii_nh_poskey(x,y,mod)9 amii_nh_poskey(x, y, mod)
10     int*x, *y, *mod;
11 {
12     struct amii_WinDesc *cw;
13     WETYPE type;
14     struct RastPort *rp;
15     struct Window *w;
16 
17     if( cw = amii_wins[WIN_MESSAGE] )
18     {
19 	cw->wflags &= ~FLMAP_SKIP;
20 	if( scrollmsg )
21 	    cw->wflags |= FLMSG_FIRST;
22 	cw->disprows = 0;
23     }
24 
25     if( WIN_MAP != WIN_ERR && (cw = amii_wins[ WIN_MAP ]) && ( w = cw->win ) )
26     {
27 	cursor_on( WIN_MAP );
28     }
29     else
30 	panic( "no MAP window opened for nh_poskey\n" );
31 
32     rp = w->RPort;
33 
34     while( 1 )
35     {
36 	type = WindowGetevent( );
37 	if( type == WEMOUSE )
38 	{
39 	    *mod = CLICK_1;
40 	    if( lastevent.un.mouse.qual )
41 		*mod = 0;
42 
43 	    /* X coordinates are 1 based, Y are 1 based. */
44 	    *x = ( (lastevent.un.mouse.x - w->BorderLeft) / mxsize ) + 1;
45 	    *y = ( ( lastevent.un.mouse.y - w->BorderTop - MAPFTBASELN ) /
46 			mysize ) + 1;
47 #ifdef	CLIPPING
48 	    if( clipping )
49 	    {
50 		*x += clipx;
51 		*y += clipy;
52 	    }
53 #endif
54 	    return( 0 );
55 	}
56 	else if( type == WEKEY )
57 	{
58 	    lastevent.type = WEUNK;
59 	    return( lastevent.un.key );
60 	}
61     }
62 }
63 
64 int
amii_nhgetch()65 amii_nhgetch()
66 {
67     int ch;
68     struct amii_WinDesc *cw=amii_wins[WIN_MESSAGE];
69 
70     if( WIN_MAP != WIN_ERR && amii_wins[ WIN_MAP ] )
71     {
72 	cursor_on( WIN_MAP );
73     }
74     if(cw)
75 	cw->wflags &= ~FLMAP_SKIP;
76 
77     ch = WindowGetchar();
78     return( ch );
79 }
80 
81 void
amii_get_nh_event()82 amii_get_nh_event()
83 {
84     /* nothing now - later I have no idea.  Is this just a Mac hook? */
85 }
86 
87 void
amii_getret()88 amii_getret()
89 {
90     register int c;
91 
92     raw_print( "" );
93     raw_print( "Press Return..." );
94 
95     c = 0;
96 
97     while( c != '\n' && c != '\r' )
98     {
99 	if( HackPort )
100 	    c = WindowGetchar();
101 	else
102 	    c = getchar();
103     }
104     return;
105 }
106 
107