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