'=========================================================================== ' Subject: FIREPRO VERSION 4 Date: 07-21-98 (06:23) ' Author: Thomas Ludwig Code: QB, QBasic, PDS ' Origin: lycium@hotmail.com Packet: GRAPHICS.ABC '=========================================================================== '$DYNAMIC DEFINT A-Z CLS : RANDOMIZE TIMER COLOR 15 PRINT "FirePRO v4" PRINT "=-=-=-=-=-" COLOR 8 PRINT "Thomas Ludwig 21/7/98" PRINT COLOR 7 PRINT "Well, I'm back once again with the constantly-evolving FirePRO series," PRINT "this time with a MAJOR speed increase! I'm now using a fire buffer," PRINT "which essentially helps to eliminate reading from the graphics card." PRINT "Unfortunately the buffer's a RAM pig (32 KB), but it's well worth it!" PRINT "Because of these speed increases, I can get rid of the horrid 'limiting" PRINT "line' that appeared just above the fire. This line is where I stopped" PRINT "calculating the fire (for speed's sake). It's gone now..." PRINT PRINT "Press a key (if you like)." DO: LOOP UNTIL INKEY$ <> "" CLS PRINT "Resolution..." PRINT PRINT "1. 320x200 (default)" PRINT "2. 320x100" DO: res$ = INKEY$: LOOP UNTIL res$ <> "" CLS PRINT "Palette..." PRINT PRINT "1. RealPal" PRINT "2. RedBluePal" PRINT "3. IcePal!!! (default)" PRINT "4. PsychaPal" DO: pal$ = INKEY$: LOOP UNTIL pal$ <> "" CLS SCREEN 13 IF res$ <> "2" THEN GOTO NoResChange OUT &H3D4, 9 OUT &H3D5, 3 NoResChange: '=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- 'Precalc divide by 3 arrays 'Used ~31000 times every frame!!! '=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- num& = 255 * 3 DIM div3(num&) AS INTEGER FOR t% = 0 TO num& div3(t%) = CINT(t% / 3) NEXT '=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- 'Precalc divide by 4 arrays 'Used ~31000 times every frame!!! '=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- num& = 255 * 4 DIM div4(num&) AS INTEGER FOR t% = 0 TO num& div4(t%) = CINT(t% / 4) NEXT '=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- 'Precalc divide by 9 arrays 'Used ~31000 times every frame!!! '=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- num& = 255 * 9 DIM div9(num&) AS INTEGER FOR t% = 0 TO num& div9(t%) = CINT(t% / 9) NEXT '=-=-=-=-=-=-=-=- 'Precalc mem add. '=-=-=-=-=-=-=-=- DIM mem(319, 99) AS INTEGER FOR x% = 0 TO 319 FOR y% = 0 TO 99 mem(x%, y%) = y% * 320 + x% NEXT y% NEXT x% '=-=-=-=-=-=-= 'Double buffer '=-=-=-=-=-=-= DIM img(32320) AS INTEGER '=-=-=-=-=-=-=-= 'PsychaPal array '=-=-=-=-=-=-=-= DIM c(256, 3) AS INTEGER '=-=-=-=-=-=-=-=-= 'Set up palette... '=-=-=-=-=-=-=-=-= IF pal$ = "1" THEN GOTO Special IF pal$ = "2" THEN GOTO Normal IF pal$ = "4" THEN GOTO Psy ELSE GOTO Ice Normal: FOR t% = 0 TO 63 OUT &H3C8, t% OUT &H3C9, t% OUT &H3C9, 0 OUT &H3C9, 0 NEXT FOR t% = 64 TO 127 OUT &H3C8, t% OUT &H3C9, 63 - t% OUT &H3C9, 0 OUT &H3C9, 0 NEXT t% FOR t% = 128 TO 191 OUT &H3C8, t% OUT &H3C9, 0 OUT &H3C9, 0 OUT &H3C9, t% - 128 NEXT t% FOR t% = 192 TO 255 OUT &H3C8, t% OUT &H3C9, 0 OUT &H3C9, 0 OUT &H3C9, 191 - t% NEXT t% GOTO EndPal Psy: FOR t% = 0 TO 63 c(t%, 1) = 0 c(t%, 2) = t% c(t%, 3) = t% c(t% + 64, 1) = INT(t% / 2) c(t% + 64, 2) = 63 - t% c(t% + 64, 3) = 63 c(t% + 128, 1) = 31 + INT(t% / 2) c(t% + 128, 2) = t% c(t% + 128, 3) = 63 c(t% + 192, 1) = 63 - t% c(t% + 192, 2) = 63 - t% c(t% + 192, 3) = 63 - t% NEXT t% FOR t% = 1 TO 255 OUT &H3C8, t% OUT &H3C9, c(t%, 1) OUT &H3C9, c(t%, 2) OUT &H3C9, c(t%, 3) NEXT t% GOTO EndPal Ice: FOR t% = 1 TO 127 OUT &H3C8, t% OUT &H3C9, 0 OUT &H3C9, 0 OUT &H3C9, t% \ 2 OUT &H3C8, t% + 127 OUT &H3C9, t% \ 2 OUT &H3C9, t% \ 2 OUT &H3C9, 63 NEXT t% GOTO EndPal Special: FOR t% = 0 TO 63 OUT &H3C8, t% OUT &H3C9, t% OUT &H3C9, t% / 2 OUT &H3C9, 0 NEXT FOR t% = 64 TO 127 OUT &H3C8, t% OUT &H3C9, 63 OUT &H3C9, t% / 2 - 1 OUT &H3C9, 0 NEXT FOR t% = 128 TO 191 OUT &H3C8, t% OUT &H3C9, 63 OUT &H3C9, 63 OUT &H3C9, t% / 2 + 31 NEXT FOR t% = 192 TO 255 OUT &H3C8, t% OUT &H3C9, 63 OUT &H3C9, 63 OUT &H3C9, 63 NEXT EndPal: '=-=-=-=-=-=-=-= 'Display palette '=-=-=-=-=-=-=-= FOR t% = 30 TO 285 LINE (t%, 0)-(t%, 0), t% - 30 NEXT t% '=-=-=-=-=-=-=-=-=-= 'Half-screen mem add '=-=-=-=-=-=-=-=-=-= IF res$ = "2" THEN DEF SEG = &HA000 ELSE DEF SEG = &HA7D0 DO FOR b% = 0 TO 319 IF INT(RND * 2) = 1 THEN img(31680 + b%) = 255 ELSE img(31680 + b%) = 0 NEXT b% FOR x% = 0 TO 319 FOR y% = 40 TO 99 '40 ym% = mem(x%, y%) '-= Used 4 times, calculated once - 300% saving!!! =- ym2% = ym% - 320 '-= Used 3 times, calculated once - 200% saving!!! =- p% = img(ym%) IF p% = 0 THEN GOTO SkipFlame p% = div4(p% + img(ym2%) + img(ym% + 1) + img(ym% - 1)) IF p% < 3 THEN GOTO SkipFlame c% = p% - 3 '-= Used twice =- img(ym2%) = c% POKE (ym2%), c% SkipFlame: NEXT y% NEXT x% LOOP UNTIL INKEY$ <> "" DO FOR b% = 0 TO 319 IF INT(RND * 2) = 1 THEN img(31680 + b%) = 255 ELSE img(31680 + b%) = 0 NEXT b% FOR x% = 0 TO 319 FOR y% = 30 TO 99 '40 ym% = mem(x%, y%) '-= Precalc =- ym2% = ym% - 320 '-= Precalc... =- p% = div3(img(ym%) + img(ym% + 320) + img(ym% + 1)) IF p% < 4 THEN img(ym%) = 0: GOTO SkipTrue c% = p% - 3 '-= Also used twice =- img(ym2%) = c% POKE (ym2%), c% SkipTrue: NEXT NEXT LOOP UNTIL INKEY$ <> "" DO FOR b% = 0 TO 319 IF INT(RND * 2) = 1 THEN img(31680 + b%) = 255 ELSE img(31680 + b%) = 0 NEXT b% FOR x% = 0 TO 319 FOR y% = 30 TO 98 '40 ym% = mem(x%, y%) '-= Take a wild guess... =- IF x% > 0 AND x% < 319 THEN p% = div4(img(ym% + 319) + img(ym% + 320) + img(ym% + 321) + img(ym% + 642)) - 3 ELSEIF x% = 0 THEN p% = img(ym% + 1) ELSEIF x% = 319 THEN p% = img(ym% - 1) END IF IF p% < 0 THEN p% = 0 img(ym%) = p% POKE (ym%), p% NEXT y% NEXT x% LOOP UNTIL INKEY$ <> "" DO FOR b% = 0 TO 319 IF INT(RND * 2) = 1 THEN img(31680 + b%) = 255 ELSE img(31680 + b%) = 0 NEXT b% FOR x% = 0 TO 319 FOR y% = 35 TO 99 '40 ym% = mem(x%, y%) '-= Precalc =- ym2% = ym% - 320 '-= Not again! =- p% = div3(img(ym%) + img(ym% + 320) + img(ym2%)) IF p% < 4 THEN img(ym%) = 0: GOTO SkipFreeze c% = p% - 3 '-= Hmm, I wonder what this does? =- img(ym2%) = c% POKE (ym2%), c% SkipFreeze: NEXT NEXT LOOP UNTIL INKEY$ <> "" DO FOR b% = 0 TO 319 IF INT(RND * 2) = 1 THEN img(31680 + b%) = 255 ELSE img(31680 + b%) = 0 NEXT b% FOR x% = 0 TO 319 FOR y% = 30 TO 99 '30 ym% = mem(x%, y%) '-= Precalc =- ym2% = ym% - 320 '-= Precalc (yawn) =- p% = div3(img(ym% - 1) + img(ym2%) + img(ym% + 1)) IF p% < 2 THEN img(ym%) = 0: GOTO SkipInferno c% = p% - 2 '-= Precalc ahoy... =- img(ym2%) = c% POKE (ym2%), c% SkipInferno: NEXT NEXT LOOP UNTIL INKEY$ <> "" DO FOR b% = 0 TO 319 IF INT(RND * 2) = 1 THEN img(31680 + b%) = 255 ELSE img(31680 + b%) = 0 NEXT b% FOR x% = 0 TO 319 FOR y% = 35 TO 99 '47 ym% = mem(x%, y%) '-= Precalc =- ym2% = ym% - 320 '-= Precalc, yet again... you get the idea =- f% = img(ym%) IF f% < 1 THEN GOTO SkipOver p% = div9(f% + img(ym% + 1) + img(ym% - 1) + img(ym% + 320) + img(ym2%) + img(ym% + 321) + img(ym% - 321) + img(ym% + 319) + img(ym - 319)) IF p% < 3 THEN img(ym%) = 0: GOTO SkipOver c% = p% - 2 '-= EVEN MORE precalc!!! =- img(ym2%) = c% POKE (ym2%), c% SkipOver: NEXT NEXT LOOP UNTIL INKEY$ <> "" '=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- 'NO MORE PRECALC HERE!!! MWUHAHAHAHA! '=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- CLS : SCREEN 0 WIDTH 80 PALETTE COLOR 15 PRINT "FirePRO v4" PRINT COLOR 7 PRINT "Comments, questions, hate mail, etc." COLOR 9 PRINT "lycium@hotmail.com" COLOR 8 PRINT PRINT "Thomas Ludwig '98" DO: LOOP UNTIL INKEY$ <> "" SYSTEM