Fandom

Wikihack

Source:NetHack 3.2.0/macwin.h

2,034pages on
this wiki
Add New Page
Talk0

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Below is the full text to macwin.h from the source code of NetHack 3.2.0. To link to a particular line, write [[NetHack 3.2.0/macwin.h#line123]], for example.

Warning! This is the source code from an old release. For the latest release, see Source code

The NetHack General Public License applies to screenshots, source code and other content from NetHack.
1.    /*	SCCS Id: @(#)macwin.h	3.2	96/01/15	*/
2.    /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3.    /* NetHack may be freely redistributed.  See license for details. */
4.    
5.    #ifndef MACWIN_H
6.    # define MACWIN_H
7.    
8.    /* more headers */
9.    #ifdef THINK_C
10.   #include <pascal.h>	/* for CtoPStr and PtoCStr */
11.   #endif
12.   
13.   /* resources */
14.   #define PLAYER_NAME_RES_ID	1001
15.   
16.   /* fake some things if we don't have universal headers.. */
17.   #ifndef NewUserItemProc
18.   typedef pascal void (*UserItemProcPtr)(WindowPtr theWindow, short itemNo);
19.   typedef UserItemProcPtr UserItemUPP;
20.   #define NewUserItemProc(p)	(UserItemUPP)(p)
21.   
22.   typedef pascal void (*ControlActionProcPtr)(ControlHandle theControl, short partCode);
23.   typedef ControlActionProcPtr ControlActionUPP;
24.   #define NewControlActionProc(p)	(ControlActionUPP)(p)
25.   
26.   typedef ModalFilterProcPtr ModalFilterUPP;
27.   #define DisposeRoutineDescriptor(p)
28.   #endif
29.   
30.   /* misc */
31.   #ifdef __MWERKS__
32.   # define ResumeProcPtr long		/* for call to InitDialogs */
33.   #endif
34.   
35.   
36.   /*
37.    * Mac windows
38.    */
39.   #define NUM_MACWINDOWS 15
40.   #define TEXT_BLOCK 512L
41.   #define WIN_BASE_RES 128
42.   #define WIN_BASE_KIND 128
43.   #define NUM_MENU_ITEMS 52			/* a-zA-z */
44.   #define CHAR_ENTER ((char)3)
45.   #define CHAR_BS ((char)8)
46.   #define CHAR_LF ((char)10)
47.   #define CHAR_CR ((char)13)
48.   #define CHAR_ESC ((char)27)
49.   #define CHAR_BLANK ((char)32)
50.   #define CHAR_DELETE ((char)127)
51.   
52.   /* Window constants */
53.   #define kMapWindow 0
54.   #define kStatusWindow 1
55.   #define kMessageWindow 2
56.   #define kTextWindow 3
57.   #define kMenuWindow 4
58.   #define kLastWindowKind kMenuWindow
59.   
60.   /*
61.    * This determines the minimum logical line length in text windows
62.    * That is; even if physical width is less, this is where line breaks
63.    * go at the minimum. 350 is about right for score lines with a
64.    * geneva 10 pt font.
65.    */
66.   #define MIN_RIGHT 350
67.   
68.   
69.   typedef struct NhWindow {
70.   	WindowPtr		theWindow ;
71.   	short			kind ;
72.   	void			( * keyFunc ) ( EventRecord * , WindowPtr ) ;
73.   	void			( * clickFunc ) ( EventRecord * , WindowPtr ) ;
74.   	void			( * updateFunc ) ( EventRecord * , WindowPtr ) ;
75.   	void			( * cursorFunc ) ( EventRecord * , WindowPtr , RgnHandle ) ;
76.   	Handle			windowText ;
77.   	long			windowTextLen ;
78.   	Point			cursor ;		/* In CHARS / LINES */
79.   	short			leading ;
80.   	short			charHeight ;
81.   	short			charWidth ;
82.   	short			fontNum ;
83.   	short			fontSize ;
84.   	short			last_more_lin ;	/* Used by message window */
85.   	short			save_lin ;		/* Used by message window */
86.   	short			lin ;			/* Used by menus */
87.   	short			wid ;			/* Used by menus */
88.   	char			itemChars [ NUM_MENU_ITEMS ] ;
89.   	Boolean			itemSelected [ NUM_MENU_ITEMS ] ;
90.   	anything		itemIdentifiers [ NUM_MENU_ITEMS ] ;
91.   	short			how;			/* menu mode */
92.   	char			menuChar;		/* next menu accelerator to use */
93.   	char			clear ;
94.   	short			scrollPos ;
95.   	ControlHandle	scrollBar ;
96.   } NhWindow ;
97.   
98.   extern NhWindow *GetNhWin(WindowPtr mac_win);
99.   
100.  
101.  #define NUM_STAT_ROWS 2
102.  #define NUM_ROWS 22
103.  #define NUM_COLS 81 /* We shouldn't use column 0 */
104.  
105.  typedef struct MapData {
106.  	char		map [ NUM_ROWS ] [ NUM_COLS ] ;
107.  } MapData ;
108.  
109.  typedef struct StatusData {
110.  	char		map [ NUM_STAT_ROWS ] [ NUM_COLS ] ;
111.  } StatusData ;
112.  
113.  extern NhWindow * theWindows ;
114.  
115.  extern struct window_procs mac_procs ;
116.  
117.  extern short text_wind_font;
118.  #define set_text_wind_font(fnt) (text_wind_font = fnt)
119.  #define mono_font()	set_text_wind_font(monaco)
120.  #define normal_font()	set_text_wind_font(geneva)
121.  
122.  
123.  #define NHW_BASE 0
124.  extern winid BASE_WINDOW , WIN_MAP , WIN_MESSAGE , WIN_INVEN , WIN_STATUS ;
125.  
126.  /* askname dialog defines (shared between macmain.c and macmenu.c) */
127.  enum
128.  {
129.  	dlog_start = 6000,
130.  	dlogAskName = dlog_start,
131.  	dlog_limit
132.  };
133.  
134.  /* askname dialog item list */
135.  enum
136.  {
137.  	bttnANPlay = 1,
138.  	bttnANQuit,
139.  	uitmANOutlineDefault,
140.  	uitmANRole,
141.  	uitmANSex,
142.  	uitmANMode,
143.  	stxtANRole,
144.  	stxtANSex,
145.  	stxtANMode,
146.  	stxtANWho,
147.  	etxtANWho
148.  };
149.  
150.  typedef struct asknameRec
151.  {
152.  	short		anMenu[3];
153.  	unsigned char	anWho[32];	/* player name Pascal string */
154.  } asknameRec, *asknamePtr;
155.  
156.  /* askname menus */
157.  enum
158.  {
159.  	anRole,
160.  	anSex,
161.  	anMode
162.  };
163.  
164.  enum
165.  {
166.  	/* role */
167.  	askn_role_start,	/* 0 */
168.  	asknArcheologist = askn_role_start,
169.  	asknBarbarian,
170.  	asknCaveman,		/* Cavewoman */
171.  	asknElf,
172.  	asknHealer,
173.  	asknKnight,
174.  	asknPriest,		/* Priestess */
175.  	asknRogue,
176.  	asknSamurai,
177.  	asknTourist,
178.  	asknValkyrie,		/* female only */
179.  	asknWizard,
180.  	askn_role_end,
181.  
182.  	/* sex */
183.  	asknMale = 0,
184.  	asknFemale,
185.  
186.  	/* mode */
187.  	asknRegular = 0,
188.  	asknExplore,
189.  	asknDebug,
190.  	asknQuit		/* special token */
191.  };
192.  
193.  
194.  /*
195.   * External declarations for the window routines.
196.   */
197.  
198.  #define E extern
199.  
200.  /* ### dprintf.c ### */
201.  
202.  extern void dprintf ( char * , ... ) ;
203.  
204.  /* ### maccurs.c ### */
205.  
206.  extern Boolean RetrievePosition ( short , short * , short * ) ;
207.  extern Boolean RetrieveSize ( short , short , short , short * , short * ) ;
208.  extern void SaveWindowPos ( WindowPtr ) ;
209.  extern void SaveWindowSize ( WindowPtr ) ;
210.  extern Boolean FDECL(RetrieveWinPos, (WindowPtr,short *,short *));
211.  
212.  /* ### macerrs.c ### */
213.  
214.  extern void comment(char *,long);
215.  extern void showerror(char *,const char *);
216.  extern Boolean itworked( short );
217.  extern void mustwork( short );
218.  extern void attemptingto( char *  );
219.  extern void pushattemptingto( char *  );
220.  extern void popattempt( void );
221.  
222.  /* ### macfile.c ### */
223.  
224.  #if 0
225.  /* these declarations are in extern.h because they are used by the main code. */
226.  extern int maccreat(const char *,long);
227.  extern int macopen(const char *,int,long);
228.  extern int macclose(int);
229.  extern int macread(int,void *,unsigned);
230.  extern int macwrite(int,void *,unsigned);
231.  extern long macseek(int,long,short);
232.  #endif /* 0 */
233.  /* extern char *macgets(int fd, char *ptr, unsigned len); unused */
234.  extern void FDECL(C2P,(const char *c, unsigned char *p));
235.  extern void FDECL(P2C,(const unsigned char *p, char *c));
236.  
237.  /* ### macmenu.c ### */
238.  
239.  extern void	DialogAskName(asknameRec *);
240.  extern void DoMenuEvt ( long ) ;
241.  extern void InitMenuRes(void);
242.  extern void AdjustMenus(short);
243.  
244.  /* ### macmain.c ### */
245.  
246.  #ifdef MAC68K
247.  /* extern void UnloadAllSegments( void );	declared in extern.h */
248.  extern void InitSegMgmt( void * );		/* called from macwin.c */
249.  #endif
250.  extern void NDECL ( finder_file_request ) ;
251.  
252.  /* ### mactty.c ### */
253.  
254.  extern pascal short tty_environment_changed(WindowPtr);
255.  
256.  /* ### macwin.c ### */
257.  
258.  extern void AddToKeyQueue(int, Boolean);
259.  extern void SetFrameItem ( DialogPtr , short , short ) ;
260.  extern void FlashButton ( DialogPtr , short ) ;
261.  void trans_num_keys ( EventRecord * ) ;
262.  extern void NDECL ( InitMac ) ;
263.  int FDECL ( try_key_queue , ( char * ) ) ;
264.  void FDECL ( enter_topl_mode , ( char * ) ) ;
265.  void FDECL ( leave_topl_mode , ( char * ) ) ;
266.  void FDECL ( topl_set_resp , ( char * , char ) ) ;
267.  Boolean FDECL ( topl_key , ( unsigned char ) ) ;
268.  Boolean FDECL ( topl_ext_key , ( unsigned char ) ) ;
269.  void NDECL(InitRes);
270.  extern void UpdateMenus ( void ) ;
271.  extern void DoMenu ( long ) ;
272.  extern int GetFromKeyQueue ( void ) ;
273.  E void NDECL(port_help);
274.  extern void WindowGoAway(EventRecord *, WindowPtr);
275.  extern void DimMenuBar ( void ) ;
276.  extern void UndimMenuBar ( void ) ;
277.  E void FDECL(HandleEvent, (EventRecord *));	/* used in mmodal.c */
278.  
279.  extern short frame_corner ;
280.  extern winid inSelect ;
281.  extern Boolean small_screen ;
282.  
283.  /* ### mmodal.c ### */
284.  
285.  E DialogPtr FDECL(mv_get_new_dialog, (short));
286.  E void		FDECL(mv_close_dialog, (DialogPtr));
287.  E void		FDECL(mv_modal_dialog, (ModalFilterProcPtr, short *));
288.  
289.  /* ### mstring.c ### */
290.  
291.  #ifdef applec
292.  extern char *PtoCstr(unsigned char *);
293.  extern unsigned char *CtoPstr(char *);
294.  #endif
295.  
296.  
297.  
298.  E void FDECL(mac_init_nhwindows, (int *, char **));
299.  E void NDECL(mac_player_selection);
300.  E void NDECL(mac_askname);
301.  E void NDECL(mac_get_nh_event) ;
302.  E void FDECL(mac_exit_nhwindows, (const char *));
303.  E void FDECL(mac_suspend_nhwindows, (const char *));
304.  E void NDECL(mac_resume_nhwindows);
305.  E winid FDECL(mac_create_nhwindow, (int));
306.  E void FDECL(mac_clear_nhwindow, (winid));
307.  E void FDECL(mac_display_nhwindow, (winid, BOOLEAN_P));
308.  E void FDECL(mac_destroy_nhwindow, (winid));
309.  E void FDECL(mac_curs, (winid,int,int));
310.  E void FDECL(mac_putstr, (winid, int, const char *));
311.  E void FDECL(mac_display_file, (const char *, BOOLEAN_P));
312.  E void FDECL(mac_start_menu, (winid));
313.  E void FDECL(mac_add_menu, (winid,int,const anything *,
314.  		CHAR_P,int,const char *, BOOLEAN_P));
315.  E void FDECL(mac_end_menu, (winid, const char *));
316.  E int FDECL(mac_select_menu, (winid, int, menu_item **));
317.  E void NDECL(mac_update_inventory);
318.  E void NDECL(mac_mark_synch);
319.  E void NDECL(mac_wait_synch);
320.  #ifdef CLIPPING
321.  E void FDECL(mac_cliparound, (int, int));
322.  #endif
323.  E void FDECL(mac_print_glyph, (winid,XCHAR_P,XCHAR_P,int));
324.  E void FDECL(mac_raw_print, (const char *));
325.  E void FDECL(mac_raw_print_bold, (const char *));
326.  E int NDECL(mac_nhgetch);
327.  E int FDECL(mac_nh_poskey, (int *, int *, int *));
328.  E void NDECL(mac_nhbell);
329.  E int NDECL(mac_doprev_message);
330.  E char FDECL(mac_yn_function, (const char *, const char *, CHAR_P));
331.  E void FDECL(mac_getlin, (const char *,char *));
332.  E int NDECL(mac_get_ext_cmd);
333.  E void FDECL(mac_number_pad, (int));
334.  E void NDECL(mac_delay_output);
335.  
336.  #undef E
337.  
338.  #endif /* ! MACWIN_H */

Also on Fandom

Random Wiki