MCPcopy Create free account
hub / github.com/NetHack/NetHack / _mt_init_stuff

Function _mt_init_stuff

outdated/sys/mac/mttymain.c:192–299  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

190extern short win_fonts[NHW_TEXT + 1];
191
192static void
193_mt_init_stuff(void)
194{
195 long resp, flag;
196 short num_cols, num_rows, win_width, win_height, font_num, font_size;
197 short char_width, row_height;
198 short hor, vert;
199
200 LI = MT_HEIGHT;
201 CO = MT_WIDTH;
202
203 if (!strcmp(windowprocs.name, "mac")) {
204 dprintf("Mac Windows");
205 LI -= 1;
206 } else {
207 dprintf("TTY Windows");
208 }
209
210 /*
211 * If there is at least one screen CAPABLE of color, and if
212 * 32-bit QD is there, we use color. 32-bit QD is needed for the
213 * offscreen GWorld
214 */
215 if (!Gestalt(gestaltQuickdrawVersion, &resp) && resp > 0x1ff) {
216 GDHandle gdh = GetDeviceList();
217 while (gdh) {
218 if (TestDeviceAttribute(gdh, screenDevice)) {
219 if (HasDepth(gdh, 4, 1, 1) || HasDepth(gdh, 8, 1, 1)
220 || HasDepth(gdh, 16, 1, 1) || HasDepth(gdh, 32, 1, 1)) {
221 _mt_in_color = 1;
222 break;
223 }
224 }
225 gdh = GetNextDevice(gdh);
226 }
227 }
228
229 if (create_tty(&_mt_window, WIN_BASE_KIND + NHW_MAP, _mt_in_color)
230 != noErr)
231 error("_mt_init_stuff: Couldn't create tty.");
232 SetWindowKind(_mt_window, WIN_BASE_KIND + NHW_MAP);
233 SelectWindow(_mt_window);
234 SetPortWindowPort(_mt_window);
235 SetOrigin(-1, -1);
236
237 font_size = iflags.wc_fontsiz_map
238 ? iflags.wc_fontsiz_map
239 : (iflags.large_font && !small_screen) ? 12 : 9;
240 if (init_tty_number(_mt_window, win_fonts[NHW_MAP], font_size, CO, LI)
241 != noErr)
242 error("_mt_init_stuff: Couldn't init tty.");
243
244 if (get_tty_metrics(_mt_window, &num_cols, &num_rows, &win_width,
245 &win_height, &font_num, &font_size, &char_width,
246 &row_height))
247 error("_mt_init_stuff: Couldn't get tty metrics.");
248
249 SizeWindow(_mt_window, win_width + 2, win_height + 2, 1);

Callers 1

term_startupFunction · 0.85

Calls 9

dprintfFunction · 0.85
init_tty_numberFunction · 0.85
get_tty_metricsFunction · 0.85
RetrievePositionFunction · 0.85
get_tty_attribFunction · 0.85
set_tty_attribFunction · 0.85
clear_ttyFunction · 0.85
InitMenuResFunction · 0.85
errorFunction · 0.70

Tested by

no test coverage detected