/* :ts=8 bk=0 * * viacom.c: Another display hack based on common real-life experience * with Viacom cable service. Viacom is a registered tradmark * of Viacom Cablevision (probably). * * Leo L. Schwab 8706.4 (415)-456-6565 * * (-: Some people accuse me of being sick. :-) * (-: This should convince any doubters. :-) */ #include #include #include #define MINTERM ((int) (NABC | ANBC | NABNC | ANBNC)) #define PLUSX 100 #define PLUSY 50 extern void *OpenLibrary(), *OpenScreen(), *OpenWindow(), *GetMsg(), *AllocRaster(), *CreatePort(), *FindPort(); extern long VBeamPos(); extern int rnd(); struct NewWindow windef = { 0, 15, 200, 10, -1, -1, CLOSEWINDOW, WINDOWCLOSE | WINDOWDEPTH | WINDOWDRAG | ACTIVATE, NULL, NULL, (UBYTE *) "Patching in...", NULL, NULL, 0, 0, 0, 0, WBENCHSCREEN }; struct Screen *scr; struct Window *win; struct BitMap noisemap, phonymap; struct RastPort nrp; struct MsgPort *flagport; long nwide, nhigh; int wide, high; void *IntuitionBase, *GfxBase; char *PORTNAME = "Viacom Public Port"; main () { register struct Screen *wbs; register struct BitMap *wbbm; register int i; int deep, xoff, yoff; int ox[8], oy[8]; void *msg; openstuff (); rnd ((short) -VBeamPos()); /* Glean important information from system structures */ wbs = win -> WScreen; wide = wbs -> Width; high = wbs -> Height; wbbm = wbs -> ViewPort.RasInfo -> BitMap; deep = wbbm -> Depth; /* Make the bitplane with the noise in it. */ nwide = wide + PLUSX; nhigh = high + PLUSY; InitBitMap (&noisemap, 1L, nwide, nhigh); if (!(noisemap.Planes[0] = AllocRaster (nwide, nhigh))) die ("Noise bitmap allocation failed."); InitRastPort (&nrp); nrp.BitMap = &noisemap; mknoise (nwide, nhigh); /* Replace the workbench you see with my phony one. */ makephony (wide, high, deep); wbs -> ViewPort.RasInfo -> BitMap = &phonymap; MakeScreen (wbs); RethinkDisplay (); SetWindowTitles (win, "\273> Viacom <\253", "Viacom Cablevision"); while (1) { if (msg = GetMsg (win -> UserPort)) { ReplyMsg (msg); break; } OwnBlitter (); for (i=0; i Planes[i], phonymap.Planes[i], wide, high, noisemap.Planes[0], (int) nwide, (int) nhigh, xoff, yoff, MINTERM); ox[i] = xoff; oy[i] = yoff; } DisownBlitter (); WaitTOF (); } /* Return to normal */ wbs -> ViewPort.RasInfo -> BitMap = wbbm; MakeScreen (wbs); RethinkDisplay (); closestuff (); } mknoise (wide, high) long wide, high; { register unsigned int x, i; SetRast (&nrp, 0L); SetDrMd (&nrp, COMPLEMENT); for (x=0; x