SCREEN 7, , 0, 1
_FULLSCREEN _STRETCH
_MOUSEHIDE



mh& = _SNDOPEN("song.mp3", "") 'only use the capabilities of that file type
IF mh& = 0 THEN BEEP ELSE _SNDPLAY mh& 'check for valid handle before using!

tstate% = 0
tlennow% = 0

DIM tekstit$(8)
tekstit$(1) = "VORTEX      2016 PRODU"
tekstit$(2) = "FROM NEW  BASIC GROUP"
tekstit$(3) = "A ??????  KILOBYTE IBM PC INTRO"
tekstit$(4) = "QB64 = S  T  R  A  N  G  E"
tekstit$(5) = "FUCKINGS  TO EPIC"
tekstit$(6) = "spaaaaaaaaaaace"
tekstit$(7) = "amigaaaaaaaaah"
tekstit$(8) = "guaget vittuun!!"
teksti$ = ""
curtn% = 1

cureffu% = 0


numposses% = 1

DIM posses(100)

DO
    paska% = kusi
    musapos = _SNDGETPOS(mh&)
    biitti = musapos / 0.568
    'biitti = musapos / 0.5760
    'biitti = musapos / (60/104)
    CLS
    'locate 1,1
    'print musapos, biitti

    inbiitti = biitti - INT(biitti)

    'for i = 2 to numposses%
    'locate i+1,1
    'print posses(i)-posses(i-1)
    'next i

    ''  if inkey$ = chr$(13) then
    ''      posses(numposses%) = musapos
    ''
    ''      numposses% = numposses% + 1
    ''  end if

    IF INKEY$ = CHR$(32) THEN
        END
    END IF


    mummu% = INT(biitti) MOD 16

    'print mummu%

    IF mummu% < 9 THEN
        GOSUB effu1
    ELSEIF mummu% >= 9 THEN
        GOSUB effu2
    END IF

    PCOPY 0, 1
    _DELAY 0.01

LOOP


effu1:
'line (0,0)-(319,50),9,bf
'line (0,51)-(319,179),1,bf
'line (0,180)-(319,199),0,bf

LINE (50, 0)-(55, 199), 1, BF

LINE (260, 0)-(265, 199), 8, BF

'line (80,0)-(80,199),8

'line (176,0)-(176,199),8
'line (240,0)-(240,199),8


tlen% = LEN(teksti$)

IF (tstate% = 0) THEN
    teksti$ = tekstit$(curtn%)
    curtn% = curtn% + 1
    IF (curtn% > 8) THEN curtn% = 1
    cursor$ = ""
    tc% = 40
    tstate% = 1
ELSEIF (tstate% = 1 AND tc% <= 0) THEN
    tstate% = 2
    cursor$ = CHR$(219)
ELSEIF (tstate% = 2 AND tc% <= 0) THEN
    tc% = 5
    tlennow% = tlennow% + 1
    IF (tlennow% > tlen%) THEN tstate% = 3
ELSEIF (tstate% = 3) THEN
    tc% = 240
    tstate% = 4
    cursor$ = CHR$(219)
ELSEIF (tstate% = 4 AND tc% <= 0) THEN
    tstate% = 5
ELSEIF (tstate% = 5 AND tc% <= 0) THEN
    cursor$ = CHR$(219)
    tc% = 5
    tlennow% = tlennow% - 1
    '    IF (tlennow% <= 0) THEN tstate% = 6
    IF (tlennow% <= 0) THEN tlennow% = 0
ELSEIF (tstate% = 6) THEN
    tlennow% = 0
    tstate% = 0
    ' ca_add = 0.07
END IF

tc% = tc% - 1

IF inbiitti < 0.1 THEN ca_add = 0.02


IF (musapos < 0.0001) THEN ca_add = -0.01



rota = rota + 0.0098745
ca = ca + 0.0004341
ca = ca + ca_add
ca_add = ca_add * 0.9

offsiy = offsiy + 0.002

FOR asd = 0 TO 72.9 STEP 0.1953

    posx1 = SIN(ca + asd * 0.4121)
    posy1 = (SIN(ca + asd * 0.1621) * 1.0 + offsiy + 1.0) / 2.0
    posy1 = (posy1 - INT(posy1)) * -6.0 + 3.0
    posz1 = SIN(ca + asd * 0.5321)

    posx = SIN(rota) * posx1 + COS(rota) * posz1
    posz = SIN(rota) * posz1 - COS(rota) * posx1
    posy = posy1

    'koko = abs(posy1) / 2.0 + 0.2
    koko = 1.0

    poszd = 1.0 / (posz * 2.0 + 3.0)

    posx = posx * 200 * poszd + 160
    posy = posy * 200 * poszd + 100

    poszv = posz + RND(1) * 0.2 - 0.1

    v = 15
    IF (poszv > 1.1) THEN
        v = 0
    ELSEIF (poszv > 0.7) THEN
        v = 8
    ELSEIF (poszv > 0.4) THEN
        v = 7
    ELSEIF (poszv > 0.0) THEN
        v = 2
    ELSEIF (poszv > -0.5) THEN
        v = 10
    ELSEIF (poszv > -0.8) THEN
        v = 14
    END IF

    poszr = 30.0 / (posz * 2.0 + 3.0) * koko

    CIRCLE (posx, posy), poszr, v

NEXT asd

LOCATE 21, 4
PRINT MID$(teksti$, 1, tlennow%) + cursor$

'line (200,0)-(210,199),7,bf

LINE (90, 0)-(100, 199), 8, BF


RETURN


effu2:

posi = 100 + SIN(a * 2.0) * 30

LINE (0, posi - 25)-(319, posi + 25), 2, BF

ax = 1.0 + SIN(a * 3.2123) * 0.6

IF (mummu% < 13) THEN
    lenni = lenni + 0.01
    ekalenni% = 0
    csiz = 0
    csizmul = 1.0
ELSEIF (mummu% > 10) THEN
    IF ekalenni% = 0 THEN
        ekalenni% = 1
        lenni = 0
        csiz = 0
        csizmul = 0.0

        ' myös tekstin vaihto
        tstate% = 6
    END IF

    lenni = lenni - 0.01
    csiz = csiz + 1
    IF csiz > 10 THEN csiz = 10

    csizmul = csizmul + 0.01
    IF csizmul > 1.0 THEN csizmul = 1.0
END IF

lenni = lenni + 0.002


FOR asd = 0 TO 22.9 STEP 0.1453

    posx = COS(a * 1.321312 + asd * 0.621213 + ax)
    posy = SIN(a * 1.41245 + asd * 0.112132 + ax)

    delx = posx - SIN(a * 1.2234 + asd)
    dely = posy - COS(a * 1.3912 + asd)

    lennid = SQR(delx * delx + dely * dely)
    posx = posx + lenni * delx / lennid
    posy = posy + lenni * dely / lennid

    posx = posx * 100 + 160
    posy = posy * 100 + 100

    CIRCLE (posx, posy), (7 + SIN(a * 2.312 * 1.3 + asd) * 5) * csizmul, csiz
NEXT asd

a = a + 0.003

RETURN
