Fandom

Wikihack

Source:NetHack 3.3.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.3.0. To link to a particular line, write [[NetHack 3.3.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.3	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.   
42.   /* Window constants */
43.   #define kMapWindow 0
44.   #define kStatusWindow 1
45.   #define kMessageWindow 2
46.   #define kTextWindow 3
47.   #define kMenuWindow 4
48.   #define kLastWindowKind kMenuWindow
49.   
50.   /*
51.    * This determines the minimum logical line length in text windows
52.    * That is; even if physical width is less, this is where line breaks
53.    * go at the minimum. 350 is about right for score lines with a
54.    * geneva 10 pt font.
55.    */
56.   #define MIN_RIGHT 350
57.   
58.   typedef struct {
59.   	anything id;
60.   	char accelerator;
61.   	char groupAcc;
62.   	short line;
63.   } MacMHMenuItem;
64.   
65.   typedef struct NhWindow {
66.   	WindowPtr		its_window ;
67.   /*	short			kind ;*/
68.   
69.   	short			font_number ;
70.   	short			font_size ;
71.   	short			char_width ;
72.   	short			row_height ;
73.   	short			ascent_height ;
74.   	
75.   	short			x_size;
76.   	short			y_size;
77.   	short			x_curs;
78.   	short			y_curs;
79.   	
80.   	short		last_more_lin ; /* Used by message window */
81.   	short		save_lin ;		/* Used by message window */
82.   
83.   	short			miSize;		/* size of menu items arrays */
84.   	short			miLen;		/* number of menu items in array */
85.   	MacMHMenuItem	**menuInfo;		/* Used by menus (array handle) */
86.   	char		menuChar;		/* next menu accelerator to use */
87.   	short			**menuSelected;	/* list of selected elements from list */
88.   	short			miSelLen;	/* number of items selected */
89.   	short			how;		/* menu mode */
90.   
91.   	char			drawn ;
92.   	Handle			windowText ;
93.   	long			windowTextLen ;
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 80 /* We shouldn't use column 0 */
104.  #define QUEUE_LEN 24
105.  
106.  extern NhWindow * theWindows ;
107.  
108.  extern struct window_procs mac_procs ;
109.  
110.  #define NHW_BASE 0
111.  extern winid BASE_WINDOW , WIN_MAP , WIN_MESSAGE , WIN_INVEN , WIN_STATUS ;
112.  
113.  
114.  /*
115.   * External declarations for the window routines.
116.   */
117.  
118.  #define E extern
119.  
120.  /* ### dprintf.c ### */
121.  
122.  extern void dprintf ( char * , ... ) ;
123.  
124.  /* ### maccurs.c ### */
125.  
126.  extern Boolean RetrievePosition ( short , short * , short * ) ;
127.  extern Boolean RetrieveSize ( short , short , short , short * , short * ) ;
128.  extern void SaveWindowPos ( WindowPtr ) ;
129.  extern void SaveWindowSize ( WindowPtr ) ;
130.  extern Boolean FDECL(RetrieveWinPos, (WindowPtr,short *,short *));
131.  
132.  /* ### macerrs.c ### */
133.  
134.  extern void comment(char *,long);
135.  extern void showerror(char *,const char *);
136.  extern Boolean itworked( short );
137.  extern void mustwork( short );
138.  extern void attemptingto( char *  );
139.  extern void pushattemptingto( char *  );
140.  extern void popattempt( void );
141.  
142.  /* ### macfile.c ### */
143.  
144.  /* extern char *macgets(int fd, char *ptr, unsigned len); unused */
145.  extern void FDECL(C2P,(const char *c, unsigned char *p));
146.  extern void FDECL(P2C,(const unsigned char *p, char *c));
147.  
148.  /* ### macmenu.c ### */
149.  
150.  extern void DoMenuEvt ( long ) ;
151.  extern void InitMenuRes(void);
152.  extern void AdjustMenus(short);
153.  
154.  /* ### macmain.c ### */
155.  
156.  extern void FDECL ( process_openfile, (short src_vol, long src_dir, Str255 fName, OSType ftype));
157.  
158.  /* ### macwin.c ### */
159.  
160.  extern void AddToKeyQueue(int, Boolean);
161.  extern int GetFromKeyQueue ( void ) ;
162.  void trans_num_keys ( EventRecord * ) ;
163.  extern void NDECL ( InitMac ) ;
164.  int FDECL ( try_key_queue , ( char * ) ) ;
165.  void FDECL ( enter_topl_mode , ( char * ) ) ;
166.  void FDECL ( leave_topl_mode , ( char * ) ) ;
167.  void FDECL ( topl_set_resp , ( char * , char ) ) ;
168.  Boolean FDECL ( topl_key , ( unsigned char ) ) ;
169.  Boolean FDECL ( topl_ext_key , ( unsigned char ) ) ;
170.  extern void WindowGoAway(EventRecord *, WindowPtr);
171.  E void FDECL(HandleEvent, (EventRecord *));	/* used in mmodal.c */
172.  extern void NDECL(port_help);
173.  
174.  #define DimMenuBar() AdjustMenus(1)
175.  #define UndimMenuBar() AdjustMenus(0)
176.  
177.  extern Boolean small_screen ;
178.  
179.  /* ### mstring.c ### */
180.  
181.  #ifdef applec
182.  extern char *PtoCstr(unsigned char *);
183.  extern unsigned char *CtoPstr(char *);
184.  #endif
185.  
186.  E void FDECL(mac_init_nhwindows, (int *, char **));
187.  E void NDECL(mac_player_selection);
188.  E void NDECL(mac_askname);
189.  E void NDECL(mac_get_nh_event) ;
190.  E void FDECL(mac_exit_nhwindows, (const char *));
191.  E void FDECL(mac_suspend_nhwindows, (const char *));
192.  E void NDECL(mac_resume_nhwindows);
193.  E winid FDECL(mac_create_nhwindow, (int));
194.  E void FDECL(mac_clear_nhwindow, (winid));
195.  E void FDECL(mac_display_nhwindow, (winid, BOOLEAN_P));
196.  E void FDECL(mac_destroy_nhwindow, (winid));
197.  E void FDECL(mac_curs, (winid,int,int));
198.  E void FDECL(mac_putstr, (winid, int, const char *));
199.  E void FDECL(mac_display_file, (const char *, BOOLEAN_P));
200.  E void FDECL(mac_start_menu, (winid));
201.  E void FDECL(mac_add_menu, (winid,int,const anything *,
202.  		CHAR_P,CHAR_P,int,const char *, BOOLEAN_P));
203.  E void FDECL(mac_end_menu, (winid, const char *));
204.  E int FDECL(mac_select_menu, (winid, int, menu_item **));
205.  E void NDECL(mac_update_inventory);
206.  E void NDECL(mac_mark_synch);
207.  E void NDECL(mac_wait_synch);
208.  #ifdef CLIPPING
209.  E void FDECL(mac_cliparound, (int, int));
210.  #endif
211.  E void FDECL(mac_print_glyph, (winid,XCHAR_P,XCHAR_P,int));
212.  E void FDECL(mac_raw_print, (const char *));
213.  E void FDECL(mac_raw_print_bold, (const char *));
214.  E int NDECL(mac_nhgetch);
215.  E int FDECL(mac_nh_poskey, (int *, int *, int *));
216.  E void NDECL(mac_nhbell);
217.  E int NDECL(mac_doprev_message);
218.  E char FDECL(mac_yn_function, (const char *, const char *, CHAR_P));
219.  E void FDECL(mac_getlin, (const char *,char *));
220.  E int NDECL(mac_get_ext_cmd);
221.  E void FDECL(mac_number_pad, (int));
222.  E void NDECL(mac_delay_output);
223.  
224.  #undef E
225.  
226.  #endif /* ! MACWIN_H */

Also on Fandom

Random Wiki