'=========================================================================== ' Subject: ANIMATED BUMP MAP Date: 08-28-97 (13:59) ' Author: Danny Beardsley Code: QB, QBasic, PDS ' Origin: beards@dnai.com Packet: GRAPHICS.ABC '=========================================================================== DECLARE SUB init () ' $DYNAMIC SCREEN 13 DIM x AS INTEGER DIM y AS INTEGER DIM D AS INTEGER DIM SHARED pic(32200) AS INTEGER DIM SHARED mp(15751) AS INTEGER DIM vsp AS INTEGER DIM vsp2 AS INTEGER vsp = VARSEG(pic(0)) vsp2 = vsp + 2000 PRINT "hold on" init FOR i% = 1 TO 127 OUT &H3C8, i% OUT &H3C9, 0 OUT &H3C9, 0 OUT &H3C9, i% \ 2 OUT &H3C8, i% + 127 OUT &H3C9, i% \ 2 OUT &H3C9, i% \ 2 OUT &H3C9, 63 NEXT i% DEF SEG = (&HA000) FOR y = 1 TO 100 FOR x = 0 TO 319 POKE (y * 320 + x), RND * 250 NEXT x NEXT y DEF SEG = (&HA000 + &H7D0) FOR y = 1 TO 99 FOR x = 0 TO 319 POKE (y * 320 + x), RND * 250 NEXT x NEXT y FOR w% = 1 TO 9 CIRCLE (160, 100), w% + 35, 250 LINE (160 - w%, 100 - w%)-(120 + w%, 180 + w%), 250, B NEXT w% tim = TIMER FOR D = 1 TO 3 DEF SEG = (&HA000) FOR y = 1 TO 100 FOR x = 0 TO 319 s% = PEEK(y * 320 + x) + PEEK(y * 320 + x + 1) + PEEK(y * 320 + x - 1) + PEEK(y * 320 + 320 + x) + PEEK(y * 320 - 320 + x) '+ PEEK(y * 320 - 320 + x - 1) + PEEK(y * 320 - 320 + x + 1) + PEEK(y * 320 + 320 + x - 1) + PEEK(y * 320 + 320 + x + 1) s% = s% \ 5 POKE (y * 320 + x), s% NEXT x NEXT y DEF SEG = (&HA000 + &H7D0) FOR y = 1 TO 99 FOR x = 0 TO 319 s% = PEEK(y * 320 + x) + PEEK(y * 320 + x + 1) + PEEK(y * 320 + x - 1) + PEEK(y * 320 + 320 + x) + PEEK(y * 320 - 320 + x) '+ PEEK(y * 320 - 320 + x - 1) + PEEK(y * 320 - 320 + x + 1) + PEEK(y * 320 + 320 + x - 1) + PEEK(y * 320 + 320 + x + 1) s% = s% \ 5 POKE (y * 320 + x), s% NEXT x NEXT y NEXT D DEF SEG = (&HA000) FOR yy! = 1 TO 100 FOR xx! = 0 TO 319 STEP 2 e = (PEEK(yy! * 320 + xx! + 1) + 128) MOD 256 e1 = PEEK(yy! * 320 + xx!) - 1 pic((xx! + yy! * 320) \ 2) = e * 256 + e1 - 32767 NEXT xx! NEXT yy! DEF SEG = (&HA7D0) FOR yy! = 1 TO 99 FOR xx! = 0 TO 319 STEP 2 e = (PEEK(yy! * 320 + xx! + 1) + 128) MOD 256 e1 = PEEK(yy! * 320 + xx!) - 1 pic((xx! + (yy! + 100) * 320) \ 2) = e * 256 + e1 - 32767 NEXT xx! NEXT yy! CLS tim = TIMER FOR l% = 1 TO 180 STEP 3 lpy% = l% * 1 lpx% = l% * 1 DEF SEG = (&HA000) FOR y = 1 TO 100 ym% = y * 320 ly% = y - lpy% FOR x = 1 TO 319 lx% = x - lpx% yd% = ym% + x DEF SEG = vsp c% = PEEK(yd%) - 125 ny% = PEEK(yd% + 320) - c% - ly% nx% = PEEK(yd% + 1) - c% - lx% IF ny% < 1 OR ny% > 249 THEN ny% = 1 IF nx% < 0 OR nx% > 250 THEN nx% = 0 nx% = 125 - ABS(125 - nx%) ny% = 125 - ABS(125 - ny%) DEF SEG = &HA000 POKE (yd%), mp(nx% * 125 + ny%) NEXT x NEXT y DEF SEG = &HA7D0 FOR y = 1 TO 99 ym% = y * 320 ty% = y + 100 ly% = ty% - lpy% FOR x = 1 TO 319 lx% = x - lpx% yd% = ym% + x DEF SEG = vsp2 c% = PEEK(yd%) - 125 ny% = PEEK(yd% + 320) - c% - ly% nx% = PEEK(yd% + 1) - c% - lx% IF ny% < 1 OR ny% > 249 THEN ny% = 1 IF nx% < 1 OR nx% > 250 THEN nx% = 1 nx% = 125 - ABS(125 - nx%) ny% = 125 - ABS(125 - ny%) DEF SEG = &HA7D0 POKE (yd%), mp(nx% * 125 + ny%) NEXT x NEXT y IF INKEY$ <> "" THEN GOTO 12 NEXT l% 'GOTO 23 12 q = 60 / (TIMER - tim) DEF SEG CLS FOR i% = 1 TO 255 OUT &H3C8, i% OUT &H3C9, 63 OUT &H3C9, 63 OUT &H3C9, 63 NEXT i% SCREEN 12 PRINT q DO LOOP UNTIL INKEY$ = "" PRINT "ANIMATED BUMP MAP BY DANNY BEARDSLEY (made in QB4.5)" PRINT "COMPILE ME! 5 TIMES FASTER" PRINT "COMPILE ME! 5 TIMES FASTER" PRINT "COMPILE ME! 5 TIMES FASTER" PRINT "_______________________________________________________" PRINT " This is a VERY! fast animated bump routine" PRINT " If you COMPILE it will be !!!5 times faster!!!!" PRINT " it is very delicate dont mess up the source" PRINT " If you want more code for other amazing feats then" PRINT "-------------------------------------------------------" PRINT "Email: dsb@cyberdude.com" PRINT "Homepage: www.dnai.com/~beards" PRINT "FREEWARE (just put my name in somewhere if you use it {:-)" SLEEP END REM $STATIC SUB init SCREEN 13 FOR y% = 0 TO 125 LOCATE 1, 9 PRINT CINT(y% / 1.25); "%" FOR x% = 1 TO 125 nx = (x% - 125) / 125 ny = (y% - 125) / 125 nz = 1 - SQR(nx ^ 2 + ny ^ 2) IF nz < 0 THEN nz = 0 mp(x% * 125 + y%) = CINT(nz * 250) NEXT x% NEXT y% END SUB