1 /*    SCCS Id: @(#)windefs.h    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 <exec/types.h>
6 #include <exec/memory.h>
7 #include <exec/io.h>
8 #if !defined(_DCC) && !defined(__GNUC__)
9 #include <dos.h>
10 #endif
11 #include <exec/alerts.h>
12 #include <exec/devices.h>
13 #include <exec/execbase.h>
14 #include <devices/console.h>
15 #include <devices/conunit.h>
16 #include <graphics/gfxbase.h>
17 #include <intuition/intuition.h>
18 #include <intuition/intuitionbase.h>
19 #include <libraries/gadtools.h>
20 #include <libraries/dosextens.h>
21 #include <libraries/asl.h>
22 /* stddef.h is included in the precompiled version of hack.h .  If we include
23  * it here normally (through string.h) we'll get an "illegal typedef" later
24  * on.  This is the easiest way I can think of to fix it without messing
25  * around with the rest of the #includes.  --AMC
26  */
27 #if defined(_DCC) && !defined(HACK_H)
28 # define ptrdiff_t	ptrdiff_t_
29 # define size_t		size_t_
30 # define wchar_t	wchar_t_
31 #endif
32 #include <ctype.h>
33 #undef  strcmpi
34 #include <string.h>
35 #include <errno.h>
36 #if defined(_DCC) && !defined(HACK_H)
37 # undef ptrdiff_t
38 # undef size_t
39 # undef wchar_T
40 #endif
41 
42 #ifdef  IDCMP_CLOSEWINDOW
43 # ifndef	INTUI_NEW_LOOK
44 #  define	INTUI_NEW_LOOK
45 # endif
46 #endif
47 
48 #ifndef HACK_H
49 #include "hack.h"
50 #endif
51 #include "wintype.h"
52 #include "winami.h"
53 #include "func_tab.h"
54 
55 #ifndef	CLIPPING
56 CLIPPING must be defined for the AMIGA version
57 #endif
58 
59 #undef	LI
60 #undef	CO
61 
62 /*#define   TOPL_GETLINE	/* Don't use a window for getlin() */
63 /*#define   WINDOW_YN		/* Use a window for y/n questions */
64 
65 #ifdef AZTEC_C
66 #include <functions.h>
67 #else
68 #ifdef _DCC
69 #include <clib/dos_protos.h>
70 #include <clib/exec_protos.h>
71 #include <clib/console_protos.h>
72 #include <clib/layers_protos.h>
73 #include <clib/diskfont_protos.h>
74 #include <clib/gadtools_protos.h>
75 #else
76 #include <proto/dos.h>
77 #include <proto/exec.h>
78 #include <proto/console.h>
79 #include <proto/layers.h>
80 #include <proto/diskfont.h>
81 #include <proto/gadtools.h>
82 #include <proto/asl.h>
83 #endif
84 
85 /* kludge - see amirip for why */
86 # undef red
87 # undef green
88 # undef blue
89 #ifdef _DCC
90 # include <clib/graphics_protos.h>
91 #else
92 # include <proto/graphics.h>
93 #endif
94 
95 #ifdef _DCC
96 # define __asm		/* DICE doesn't like __asm */
97 #endif
98 
99 #ifndef __SASC_60
100 #undef index
101 # define index strchr
102 #endif
103 
104 #ifdef _DCC
105 #include <clib/intuition_protos.h>
106 #else
107 #include <proto/intuition.h>
108 #endif
109 #endif
110 
111 #ifdef	SHAREDLIB
112 #include "NH:sys/amiga/lib/libmacs.h"
113 #endif
114 
115 #ifdef	INTUI_NEW_LOOK
116 #include <utility/tagitem.h>
117 #endif
118 
119 #define	WINVERS_AMII	(strcmp("amii",windowprocs.name)==0)
120 #define	WINVERS_AMIV	(strcmp("amitile",windowprocs.name)==0)
121 #define	WINVERS_AMIT	(strcmp("amitty",windowprocs.name)==0)
122 
123 /* cw->data[x] contains 2 characters worth of special information.  These
124  * characters are stored at the offsets as described here.
125  */
126 #define VATTR	  0	/* Video attribute is in this slot */
127 #define SEL_ITEM  1	/* If this is a select item, slot is 1 else 0 */
128 #define SOFF	  2	/* The string starts here.  */
129 
130 #undef NULL
131 #define NULL 0L
132 
133 /*
134  * Versions we need of various libraries.  We can't use LIBRARY_VERSION
135  * as defined in <exec/types.h> because some of the libraries we need
136  * don't have that version number in the 1.2 ROM.
137  */
138 
139 #define LIBRARY_FONT_VERSION	34L
140 #define LIBRARY_TILE_VERSION	37L
141 
142 /* These values are just sorta suggestions in use, but are minimum requirements
143  * in reality...
144  */
145 #define WINDOWHEIGHT	192
146 #define SCREENHEIGHT	200
147 #define WIDTH		640
148 
149 /* This character is a solid block (cursor) in Hack.font */
150 #define CURSOR_CHAR	0x90
151 
152 #define FONTHEIGHT	8
153 #define FONTWIDTH	8
154 #define FONTBASELINE	8
155 
156 #define MAPFTWIDTH	8
157 #define MAPFTHEIGHT	8
158 #define MAPFTBASELN	6
159 
160 /* If Compiling with the "New Look", redefine these now */
161 #ifdef  INTUI_NEW_LOOK
162 #define NewWindow ExtNewWindow
163 #define NewScreen ExtNewScreen
164 #endif
165 
166 #define         SIZEOF_DISKNAME 8
167 
168 #define CSI     '\x9b'
169 #define NO_CHAR     -1
170 #define RAWHELP     0x5F    /* Rawkey code of the HELP key */
171 
172 
173 #define C_BLACK		0
174 #define C_WHITE		1
175 #define C_BROWN		(WINVERS_AMIV ? 11 : 2)
176 #define C_CYAN		(WINVERS_AMIV ? 2  : 3)
177 #define C_GREEN		(WINVERS_AMIV ? 5  : 4)
178 #define C_MAGENTA	(WINVERS_AMIV ? 10 : 5)
179 #define C_BLUE		(WINVERS_AMIV ? 4  : 6)
180 #define C_RED		7
181 #define C_ORANGE	3
182 #define C_GREY		6
183 #define C_LTGREEN	8
184 #define C_YELLOW	9
185 #define C_GREYBLUE	12
186 #define C_LTBROWN	13
187 #define C_LTGREY	14
188 #define C_PEACH		15
189 
190 /* Structure describing tile files */
191 struct PDAT
192 {
193     long nplanes;		/* Depth of images */
194     long pbytes;		/* Bytes in a plane of data */
195     long across;		/* Number of tiles across */
196     long down;			/* Number of tiles down */
197     long npics;			/* Number of pictures in this file */
198     long xsize;			/* X-size of a tile */
199     long ysize;			/* Y-size of a-tile */
200 };
201 
202 #undef	MAXCOLORS
203 #define	MAXCOLORS	256
204