/////////////////////////////////////////////////////////////////////////// // // US_DrawWindow() - Draws a frame and sets the current window parms // /////////////////////////////////////////////////////////////////////////// void US_DrawWindow(word x,word y,word w,word h) { word i, sx,sy,sw,sh; WindowX = x * 8; WindowY = y * 8; WindowW = w * 8; WindowH = h * 8; PrintX = WindowX; PrintY = WindowY; sx = (x - 1) * 8; sy = (y - 1) * 8; sw = (w + 1) * 8; sh = (h + 1) * 8; US_ClearWindow(); VWB_DrawTile8(sx,sy,0),VWB_DrawTile8(sx,sy + sh,5); for (i = sx + 8;i <= sx + sw - 8;i += 8) VWB_DrawTile8(i,sy,1),VWB_DrawTile8(i,sy + sh,6); VWB_DrawTile8(i,sy,2),VWB_DrawTile8(i,sy + sh,7); for (i = sy + 8;i <= sy + sh - 8;i += 8) VWB_DrawTile8(sx,i,3),VWB_DrawTile8(sx + sw,i,4); }
void WLUser::US_DrawWindow(quint16 x,quint16 y,quint16 w,quint16 h) { quint16 i, sx, sy, sw, sh; WindowX = x * 8; WindowY = y * 8; WindowW = w * 8; WindowH = h * 8; PrintX = WindowX; PrintY = WindowY; sx = (x - 1) * 8; sy = (y - 1) * 8; sw = (w + 1) * 8; sh = (h + 1) * 8; US_ClearWindow(); wlpaint->drawTile8(sx, sy, 0); wlpaint->drawTile8(sx, sy + sh, 5); for (i = sx + 8;i <= sx + sw - 8;i += 8) { wlpaint->drawTile8(i, sy, 1); wlpaint->drawTile8(i, sy + sh, 6); } wlpaint->drawTile8(i, sy, 2); wlpaint->drawTile8(i, sy + sh, 7); for (i = sy + 8;i <= sy + sh - 8;i += 8) { wlpaint->drawTile8(sx, i, 3); wlpaint->drawTile8(sx + sw, i, 4); } }
void US_DrawWindow(int x, int y, int w, int h) { us_windowX = x * 8; us_windowY = y * 8; us_windowW = w * 8; us_windowH = h * 8; int borderX = us_windowX - 8; int borderY = us_windowY - 8; int borderW = us_windowW + 8; int borderH = us_windowH + 8; us_printX = us_windowX; us_printY = us_windowY; US_ClearWindow(); VH_DrawTile8M(borderX, borderY, 0); //Top Left Corner VH_DrawTile8M(borderX, borderY + borderH, 6); //Bottom Left Corner VH_DrawTile8M(borderX + borderW, borderY, 2); //Top Right Corner VH_DrawTile8M(borderX + borderW, borderY + borderH, 8); //Bottom Right Corner // Draw Horizontal sides for (int i = borderX + 8; i <= borderX + borderW - 8; i += 8) { VH_DrawTile8M(i, borderY, 1); //Top row VH_DrawTile8M(i, borderY + borderH, 7); //Bottom Row } //Draw Vertical sides for (int i = borderY + 8; i <= borderY + borderH - 8; i += 8) { VH_DrawTile8M(borderX, i, 3); //Left col VH_DrawTile8M(borderX + borderW, i, 5); //Right col } }
int USL_HardError(word errval,int ax,int bp,int si) { #define IGNORE 0 #define RETRY 1 #define ABORT 2 extern void ShutdownId(void); static char buf[32]; static WindowRec wr; int di; char c,*s,*t; di = _DI; if (ax < 0) s = "DEVICE ERROR"; else { if ((di & 0x00ff) == 0) s = "DRIVE ~ IS WRITE PROTECTED"; else s = "ERROR ON DRIVE ~"; for (t = buf;*s;s++,t++) // Can't use sprintf() if ((*t = *s) == '~') *t = (ax & 0x00ff) + 'A'; *t = '\0'; s = buf; } c = peekb(0x40,0x49); // Get the current screen mode if ((c < 4) || (c == 7)) goto oh_kill_me; // DEBUG - handle screen cleanup fontnumber = 4; US_SaveWindow(&wr); US_CenterWindow(30,3); US_CPrint(s); US_CPrint("(R)ETRY or (A)BORT?"); VW_UpdateScreen(); IN_ClearKeysDown(); asm sti // Let the keyboard interrupts come through while (true) { switch (IN_WaitForASCII()) { case key_Escape: case 'a': case 'A': goto oh_kill_me; break; case key_Return: case key_Space: case 'r': case 'R': US_ClearWindow(); VW_UpdateScreen(); US_RestoreWindow(&wr); return(RETRY); break; } } oh_kill_me: abortprogram = s; ShutdownId(); fprintf(stderr,"TERMINAL ERROR: %s\n",s); return(ABORT); #undef IGNORE #undef RETRY #undef ABORT }
/* ================ = = ShapeTest = ================ */ void ShapeTest (void) { //TODO #if NOTYET extern word NumDigi; extern word *DigiList; extern int postx; extern int postwidth; extern byte *postsource; static char buf[10]; boolean done; ScanCode scan; int i,j,k,x; longword l; byte *addr; soundnames sound; // PageListStruct far *page; CenterWindow(20,16); VW_UpdateScreen(); for (i = 0,done = false; !done;) { US_ClearWindow(); sound = (soundnames) -1; // page = &PMPages[i]; US_Print(" Page #"); US_PrintUnsigned(i); if (i < PMSpriteStart) US_Print(" (Wall)"); else if (i < PMSoundStart) US_Print(" (Sprite)"); else if (i == ChunksInFile - 1) US_Print(" (Sound Info)"); else US_Print(" (Sound)"); /* US_Print("\n XMS: "); if (page->xmsPage != -1) US_PrintUnsigned(page->xmsPage); else US_Print("No"); US_Print("\n Main: "); if (page->mainPage != -1) US_PrintUnsigned(page->mainPage); else if (page->emsPage != -1) { US_Print("EMS "); US_PrintUnsigned(page->emsPage); } else US_Print("No"); US_Print("\n Last hit: "); US_PrintUnsigned(page->lastHit);*/ US_Print("\n Address: "); addr = (byte *) PM_GetPage(i); sprintf(buf,"0x%08X",(int32_t) addr); US_Print(buf); if (addr) { if (i < PMSpriteStart) { // // draw the wall // vbuf += 32*SCREENWIDTH; postx = 128; postwidth = 1; postsource = addr; for (x=0;x<64;x++,postx++,postsource+=64) { wallheight[postx] = 256; ScalePost (); } vbuf -= 32*SCREENWIDTH; } else if (i < PMSoundStart) { // // draw the sprite // vbuf += 32*SCREENWIDTH; SimpleScaleShape (160, i-PMSpriteStart, 64); vbuf -= 32*SCREENWIDTH; } else if (i == ChunksInFile - 1) { US_Print("\n\n Number of sounds: "); US_PrintUnsigned(NumDigi); for (l = j = k = 0;j < NumDigi;j++) { l += DigiList[(j * 2) + 1]; k += (DigiList[(j * 2) + 1] + (PMPageSize - 1)) / PMPageSize; } US_Print("\n Total bytes: "); US_PrintUnsigned(l); US_Print("\n Total pages: "); US_PrintUnsigned(k); } else { byte *dp = addr; for (j = 0;j < NumDigi;j++) { k = (DigiList[(j * 2) + 1] + (PMPageSize - 1)) / PMPageSize; if ((i >= PMSoundStart + DigiList[j * 2]) && (i < PMSoundStart + DigiList[j * 2] + k)) break; } if (j < NumDigi) { sound = (soundnames) j; US_Print("\n Sound #"); US_PrintUnsigned(j); US_Print("\n Segment #"); US_PrintUnsigned(i - PMSoundStart - DigiList[j * 2]); } for (j = 0;j < PageLengths[i];j += 32) { byte v = dp[j]; int v2 = (unsigned)v; v2 -= 128; v2 /= 4; if (v2 < 0) VWB_Vlin(WindowY + WindowH - 32 + v2, WindowY + WindowH - 32, WindowX + 8 + (j / 32),BLACK); else VWB_Vlin(WindowY + WindowH - 32, WindowY + WindowH - 32 + v2, WindowX + 8 + (j / 32),BLACK); } } } VW_UpdateScreen(); IN_Ack(); scan = LastScan; IN_ClearKey(scan); switch (scan) { case sc_LeftArrow: if (i) i--; break; case sc_RightArrow: if (++i >= ChunksInFile) i--; break; case sc_W: // Walls i = 0; break; case sc_S: // Sprites i = PMSpriteStart; break; case sc_D: // Digitized i = PMSoundStart; break; case sc_I: // Digitized info i = ChunksInFile - 1; break; /* case sc_L: // Load all pages for (j = 0;j < ChunksInFile;j++) PM_GetPage(j); break;*/ case sc_P: if (sound != -1) SD_PlayDigitized(sound,8,8); break; case sc_Escape: done = true; break; /* case sc_Enter: PM_GetPage(i); break;*/ } } SD_StopDigitized(); #endif }
int USL_HardError(word errval,int ax,int bp,int si) { #define IGNORE 0 #define RETRY 1 #define ABORT 2 extern void ShutdownId(void); static char buf[32]; static WindowRec wr; int di; char c,*s,*t; di = _DI; if (ax < 0) s = "Device Error"; else { if ((di & 0x00ff) == 0) s = "Drive ~ is Write Protected"; else s = "Error on Drive ~"; for (t = buf;*s;s++,t++) // Can't use sprintf() if ((*t = *s) == '~') *t = (ax & 0x00ff) + 'A'; *t = '\0'; s = buf; } c = peekb(0x40,0x49); // Get the current screen mode if ((c < 4) || (c == 7)) goto oh_kill_me; // DEBUG - handle screen cleanup US_SaveWindow(&wr); US_CenterWindow(30,3); US_CPrint(s); US_CPrint("(R)etry or (A)bort?"); VW_UpdateScreen(); IN_ClearKeysDown(); asm sti // Let the keyboard interrupts come through while (true) { switch (IN_WaitForASCII()) { case key_Escape: case 'a': case 'A': goto oh_kill_me; break; case key_Return: case key_Space: case 'r': case 'R': US_ClearWindow(); VW_UpdateScreen(); US_RestoreWindow(&wr); return(RETRY); break; } } oh_kill_me: abortprogram = s; ShutdownId(); fprintf(stderr,"Terminal Error: %s\n",s); if (tedlevel) fprintf(stderr,"You launched from TED. I suggest that you reboot...\n"); return(ABORT); #undef IGNORE #undef RETRY #undef ABORT }