/* * Cleanup -- restore palette and sane VT52 state. */ vt_cleanup() { /* * Restore desktop resolution (if we switched). */ if (drez != Getrez()) Setscreen(-1L, -1L, drez); if (drez != 2) { /* * Restore desktop palette. */ Setpalette(dpalette); Cconws("\033b"); Cconout(3 + VTC); Cconws("\033c"); Cconout(0 + VTC); } /* * Bring the mouse back */ graf_mouse(M_ON, NULL); /* * Make the cursor visible */ curs_show(); }
int InitTank() { int ii; /* initialiser cookie */ InitCookie(); /* sauvegarder palette des couleurs */ for ( ii = 0; ii < 16; ii++ ) SavPalette[ii] = Setcolor(ii,-1); /* aller en basse resolution */ SavRez = Getrez(); if ( SavRez > 1 ) return (1); /* mise en place des ecrans de travail */ _SavLogScreen = (char *)Logbase(); _SavPhyScreen = (char *)Physbase(); _Screens[0] = (char *)malloc(32256L); _Screens[1] = (char *)malloc(32256L); if ( _Screens[0] == 0 || _Screens[1] == 0L ) return (2); _Screens[0] = _ShowScreen = (char *)((long)(_Screens[0] + 255) & 0xFFFFFF00L); _Screens[1] = _HideScreen = (char *)((long)(_Screens[1] + 255) & 0xFFFFFF00L); MemClear(_Screens[0],32000L); MemClear(_Screens[1],32000L); Setpalette(BlackPalette); if ( ShipSetUp(0) == 0 ) return (2); if ( MiscSetUp() == 0 ) return (2); if ( StarSetUp() == 0 ) return (2); if ( AstSetUp() == 0 ) return (2); if ( ExplSetUp() == 0 ) return (2); Setscreen(_Screens[0],_Screens[0],0); TTSpl = ((Cookies.snd & 2) != 0); SplOn._proc = _SplOnProc[ TTSpl ]; SplOff._proc = _SplOffProc[ TTSpl ]; NStars = (Cookies.cpu > 10) ? 32 : 16; return (0); }
/* * Set up screen for VT52. * This is called by os_askfile to restore the screen to the normal * state, so it shouldn't allocate data structures. */ vt_setup() { int i; /* * Get rid of the mouse */ graf_mouse(M_OFF, NULL); /* * Get desktop resolution. If monochrome, note the fact so that * we can make sure our color choices get set correctly later on. * If low resolution, change to medium resolution automagically. * * If any other resolution, don't do anything different, and hope * things work out OK. */ drez = Getrez(); if (drez == 0) Setscreen(-1L, -1L, 1); if (drez != 2) { /* * Get desktop palette. */ for (i = 0; i < 16; i++) dpalette[i] = Setcolor(i, -1); /* * Set our palette. */ Setpalette(palette); /* * Tell the rest of the system what good colors * are for various things. */ sdesc_color = colbyte(osWHITE, osBLUE); ldesc_color = colbyte(osBLACK, osWHITE); debug_color = colbyte(osBRIGHTWHITE, osBLACK); text_color = colbyte(osWHITE, osBLACK); text_bold_color = colbyte(osBRIGHTWHITE, osBLACK); text_normal_color = text_color; } else { /* * Monochrome -- note different color name constants */ sdesc_color = colbyte(osmREVERSE, osmREVERSE); ldesc_color = colbyte(osmREVERSE, osmREVERSE); debug_color = colbyte(osmNORMAL, osmNORMAL); text_color = colbyte(osmNORMAL, osmNORMAL); text_bold_color = colbyte(osmREVERSE, osmREVERSE); text_normal_color = text_color; } /* * Set default text color */ vt_color(text_color); /* * Clear the screen, set to no-wrap mode, and enable cursor. * Also, set drawing colors to normal. */ Cconws("\033E\033w\033e"); X = 0; Y = 0; /* * Make the cursor not blink. */ Cursconf(2, 0); }