At last our entry (Na Than+Phobeous)
This comes out of a full-screen fire. You can see it now inside a small box just for speed issues. It is, of course, out of contest 'cause it has 11 lines. We couldn't shrink it any more. Anyways, the *real* effect takes 8 lines, but 3 are needed to set up the palette.
Code:
' Convolution Fire by WOPR2k
' In fact this effects takes 8 lines, but the palette rutines took 3 lines
' (It looks like crap without the custom palette).
' NOTE: ** DON'T ** use copy and paste to QB in a DOS box, 'cause there
' are split lines. Copy to notepad and save it as a .BAS file.
1 IF c& = 0 THEN SCREEN 13 ELSE IF c& = 1 THEN PAINT (0, 0), 255 ELSE IF c& = 2 THEN DIM Sc%(2049) ELSE IF c& = 3 THEN LINE (128, 136)-(191, 199), 0, BF ELSE IF c& = 4 THEN s% = VARPTR(Sc%(0)) ELSE IF c& = 5 THEN DEF SEG = VARSEG(Sc%(0)) ELSE GET ( _
128, 136)-(191, 199), Sc%(0)
IF c& < 63 THEN b% = b% + 1 ELSE IF c& < 126 THEN g% = g% + 1 ELSE IF c& < 189 THEN r% = r% + 1
IF c& < 256 THEN PALETTE c&, 63 - r% + (63 - g%) * 256! + (63 - b%) * 65536!
c& = c& + 1
2 IF c& > 4 THEN POKE VARPTR(Sc%(0)) + 4 + 62 * 64 + INT(RND * 64), 255
3 FOR i% = 1 TO 62
4 FOR j% = 1 TO 62
5 p% = (PEEK(s% + 4 + 64 * i% + j%) + PEEK(s% + 4 + 64 * (i% - 1) + j%) + PEEK(s% + 5 + 64 * (i% - 1) + j%) + PEEK(s% + 5 + 64 * i% + j%) + PEEK(s% + 4 + 64 * (i% + 1) + j% + 1) + PEEK(s% + 4 + 64 * (i% + 1) + j%) + PEEK(s% + 3 + 64 * (i% + 1) + j%) _
+ PEEK(s% + 3 + 64 * i% + j%) + PEEK(s% + 3 + 64 * (i% - 1) + j%)) \ 8
6 IF p% < 256 THEN PSET (128 + j%, i% + 135), p% ELSE PSET (128 + j%, i% + 135), 255
7 NEXT j%, i%
8 IF INKEY$ = "" THEN GOTO 1
' Unreadable code.
Enjoy
. The 'c' version that I posted a couple of days ago really looks like fire, mainly because it goes faster
. We coded that version 2 years ago.
The effect is based upon a per-pixel convolution and a feedback. The convolution matrix is:
Code:
(1 1 1)
1/8*(1 1 1)
(1 1 1)
Once the convolution matrix is applied, the resulting image is output to screen and then copied over the original, but shifting it one pixel up, and so on.