'===========================================================================
' Subject: TEXT HILIGHTING CODE               Date: 10-10-97 (20:02)       
'  Author: Ryan Shaw                          Code: QB, QBasic, PDS        
'  Origin: kathleen@iafrica.com.na          Packet: TEXT.ABC
'===========================================================================
' BOUNCE (.BAS...?!!!)
' Atr.:  Ryan Shaw
' Mail.:  kathleen@iafrica.com.na (no I don't have a problem figuring out who
'                                     I am...)
'
' Descript:
' Displays a, er, thing running from left to right, but unfortunately it
' doesn't pull the brakes in time and smacks into the right hand side of the
' screen, bounces left, tries to avoid collosion for the second time,
' doesn't, and gets hit again...  This seems to go on for a long time
' depending on how evil you plan to be...
'
' Text hilight thing like in XREAD (except that it has *3* hi-intens. spots
' while the one in XREAD has *4*).  Comes with THREE fades for you too test.
' If you can...
'
' Disclaimer:
' If anything appears on your screen, it's your problem...
' If nothing happens, it's still your problem...
' If a strange looking thing gets hurt on your screen and sues you, it's
' a bug somewhere in the program, squash it.  And don't return it to me.
'
' Use it if you want, and give credit to me (read as you) if you want to
' congratulate yourself on finding such a useless/ful program, I don't
' really care what you do with it since I spent ten seconds longer
' commenting it than writing it...
'
DECLARE SUB HiLightText (Focus%)
DIM SHARED FadeTable(10) AS INTEGER

CLS
DelayPause& = 35000               ' Need a long because it's too quick
                                  ' to read otherwise....

FOR LoadFade% = 0 TO 8
  READ FadeTable(LoadFade%)       ' Load our fade table
NEXT

COLOR 3
PRINT "É"; STRING$(78, "Í"); "»"
PRINT "º"; SPC(78); "º"
PRINT "È"; STRING$(78, "Í"); "¼"
COLOR 0                           ' Hide the text
LOCATE 2, 2                       ' And print it...
PRINT STRING$(39, ">"); STRING$(39, "<")
COLOR 12

Killer% = 1
DO
  SELECT CASE Bounce%             ' So that the text bounces around
    CASE IS = 0                   ' Bounce right
      Focus% = Focus% + 1         '
      IF Focus% = 79 THEN
        Bounce% = 1               ' Bounce left at end of line
        LOCATE 4, 1
        PRINT SPC(72); "Dooof!!!"
        Killer% = Killer% + 1
      END IF
    CASE IS = 1                   ' Bounce left
      Focus% = Focus% - 1         '
      IF Focus% = 1 THEN
        Bounce% = 0               ' Bounce right at start of line
        LOCATE 4, 1
        PRINT "Arrrg!!!"; SPC(72);
        Killer% = Killer% + 1
      END IF
    END SELECT
  HiLightText Focus%              ' HiLight text
  'FOR Delay& = 0 TO DelayPause&   ' Pause too read... (remove for TOO MUCH
  'NEXT Delay&                     ' SPEED!!! - looks like a high speed wave
                                  ' on my comp...)
                                  ' Couple weeks later:  actually it looks
                                  ' pretty cool... try it...
LOOP WHILE INKEY$ = ""

COLOR 15
PRINT "You have beaten up thing"; Killer%; "times.  Was that fun or something?"

' The first/last pieces of data should be 0 (to leave the text hidden),
' or whatever your background colour is.
' The next number describes the colour used for low brightness, then
' the next for medium brightness, and the third for high intensity.
' Fade from black to bright white...
DATA 0, 8, 7, 15, 15, 15, 7, 8, 0
' Ice fade...
DATA 0, 3, 11, 15, 15, 15, 11, 3, 0
' Red spot light...
DATA 0, 4, 12, 4, 4, 4, 12, 4, 0

SUB HiLightText (Focus%)
DEF SEG = &HB800                          ' Text memory
  FOR ChngChar% = Focus% - 4 TO Focus% + 4    ' 4 chars that way and 5 there
    SELECT CASE ChngChar%
      CASE IS = 79
        EXIT FOR
      CASE IS > 0
        POKE (160 + (ChngChar% * 2) + 1), FadeTable(CurChar%)   ' Write their clr
        CurChar% = CurChar% + 1   ' Change table position
      CASE ELSE
        CurChar% = CurChar% + 1
    END SELECT
  NEXT
DEF SEG
END SUB
