Move generic usernames to sysconf
[aNetHack.git] / sys / amiga / winkey.c
blobc90e06fc80a6def6a457b2864f4fd8cfde442619
1 /* NetHack 3.6 winkey.c $NHDT-Date: 1432512794 2015/05/25 00:13:14 $ $NHDT-Branch: master $:$NHDT-Revision: 1.7 $ */
2 /* Copyright (c) Gregg Wonderly, Naperville, Illinois, 1991,1992,1993. */
3 /* NetHack may be freely redistributed. See license for details. */
5 #include "NH:sys/amiga/windefs.h"
6 #include "NH:sys/amiga/winext.h"
7 #include "NH:sys/amiga/winproto.h"
9 amii_nh_poskey(x, y, mod) int *x, *y, *mod;
11 struct amii_WinDesc *cw;
12 WETYPE type;
13 struct RastPort *rp;
14 struct Window *w;
16 if (cw = amii_wins[WIN_MESSAGE]) {
17 cw->wflags &= ~FLMAP_SKIP;
18 if (scrollmsg)
19 cw->wflags |= FLMSG_FIRST;
20 cw->disprows = 0;
23 if (WIN_MAP != WIN_ERR && (cw = amii_wins[WIN_MAP]) && (w = cw->win)) {
24 cursor_on(WIN_MAP);
25 } else
26 panic("no MAP window opened for nh_poskey\n");
28 rp = w->RPort;
30 while (1) {
31 type = WindowGetevent();
32 if (type == WEMOUSE) {
33 *mod = CLICK_1;
34 if (lastevent.un.mouse.qual)
35 *mod = 0;
37 /* X coordinates are 1 based, Y are 1 based. */
38 *x = ((lastevent.un.mouse.x - w->BorderLeft) / mxsize) + 1;
39 *y = ((lastevent.un.mouse.y - w->BorderTop - MAPFTBASELN)
40 / mysize) + 1;
41 #ifdef CLIPPING
42 if (clipping) {
43 *x += clipx;
44 *y += clipy;
46 #endif
47 return (0);
48 } else if (type == WEKEY) {
49 lastevent.type = WEUNK;
50 return (lastevent.un.key);
55 int
56 amii_nhgetch()
58 int ch;
59 struct amii_WinDesc *cw = amii_wins[WIN_MESSAGE];
61 if (WIN_MAP != WIN_ERR && amii_wins[WIN_MAP]) {
62 cursor_on(WIN_MAP);
64 if (cw)
65 cw->wflags &= ~FLMAP_SKIP;
67 ch = WindowGetchar();
68 return (ch);
71 void
72 amii_get_nh_event()
74 /* nothing now - later I have no idea. Is this just a Mac hook? */
77 void
78 amii_getret()
80 register int c;
82 raw_print("");
83 raw_print("Press Return...");
85 c = 0;
87 while (c != '\n' && c != '\r') {
88 if (HackPort)
89 c = WindowGetchar();
90 else
91 c = getchar();
93 return;