Monday, August 22, 2011

Sikakreisi by Naemok


Here's a blast from the past. I remember spending a night on the vector font, skipping school and going to the party. The demo itself is coded by my dear friend pahamoka. A full-fledged 3D rendering engine, all in QBasic, admirably ascetic and functional architecture, and none of those lowly cheats such as POKE and PEEK... and for all that, it's the scroller that's buggy.
It placed 8th at the Alternative Party 2004.

You clicked. You went beyond the page break. You want it. Here it is, it's yours:


REM SIKAKREISI by pahamoka / naemok
REM Qbasic 4 / QuickBasic 4.5
REM @ altparty 2004                :)G<
REM
DECLARE SUB xPRINT (text$, sizex!, sizey!, cap!, x!, y!, colour!)
DECLARE SUB xTXTSCHEDULER ()
DECLARE SUB xSLEEP (x!)
DECLARE SUB xINITIALIZEBRUSH ()
DECLARE SUB xUPDATESCREEN ()
DECLARE SUB xLINE (x1!, y1!, x2!, y2!, c!)
DECLARE SUB xLINER (x1!, y1!, z1!, x2!, y2!, z2!)
DECLARE SUB xMATRIX ()
DECLARE SUB xROTATE (x AS DOUBLE)
DECLARE SUB xMATRIX ()
DECLARE SUB xRENDER3D ()
DECLARE SUB xREMOVEOBJECT (n!)
DECLARE SUB xERROR (text$)
DECLARE FUNCTION xCREATEOBJECT (x AS INTEGER)
DECLARE SUB xVERTEXER (x!, y!, Z!)
DECLARE SUB xPSET (x!, y!, col!)
COMMON SHARED nextobject, baseobjcount, mainobjcount, mainobjmax, perspective, graphcolour, rendermode, mainobjdatamax, rotaxis, rotalpha
 perspective = 50
 graphcolour = 16
 rendermode = 1
 mainobjmax = 3
 mainobjdatamax = 400
 nextobject = 0
DIM SHARED matrix(3, 3) AS DOUBLE
DIM SHARED matvect(3) AS DOUBLE
DIM SHARED rotaxison(3) AS INTEGER
DIM SHARED rotalphaa(3) AS DOUBLE

CLS : RANDOMIZE 124912


TYPE scrtxtsprop
     sizex AS SINGLE
     sizey AS SINGLE
     cap AS SINGLE
     x AS DOUBLE
     y AS DOUBLE
     colour AS INTEGER
'----animation----
     xv AS DOUBLE
     yv AS DOUBLE
     fadefrom AS SINGLE
     fadeto AS SINGLE
     fadefromtime AS SINGLE
     fadetotime AS SINGLE
     spawntime AS SINGLE
     disappeartime AS SINGLE
END TYPE

TYPE letters
 chrvcount AS INTEGER
 chrlcount AS INTEGER
 chrvdloc AS INTEGER
 chrldloc AS INTEGER
 leading AS SINGLE
 spacing AS SINGLE
END TYPE

DIM SHARED merkisto(255) AS letters
REM $DYNAMIC
DIM SHARED chrvdata(200, 1) AS SINGLE
DIM SHARED chrldata(200, 1) AS SINGLE
REM $STATIC

TYPE origomodel
     x AS SINGLE
     y AS SINGLE
     Z AS SINGLE
END TYPE
 DIM SHARED origo AS origomodel
	    origo.x = 160
	    origo.y = 100
	    origo.Z = 50

TYPE baseobjframe
     vcount AS INTEGER
     lcount AS INTEGER
     varrloc AS INTEGER
     larrloc AS INTEGER
END TYPE

TYPE mainobjframe
     flagptr AS INTEGER
     angleptr AS INTEGER
     scaleptr AS INTEGER
     locationptr AS INTEGER
     ocountptr AS INTEGER
     otypeptr AS INTEGER
     oshowptr AS INTEGER
     oscaleptr AS INTEGER
     oangleptr AS INTEGER
     olocationptr AS INTEGER
END TYPE


RESTORE p3dbaseobjdata
READ baseobjcount
 DIM SHARED baseobject(baseobjcount) AS baseobjframe

FOR i = 1 TO baseobjcount
 READ baseobject(i).vcount, baseobject(i).lcount
 baseobject(i).varrloc = textamountv
 baseobject(i).larrloc = textamountl
 textamountv = textamountv + baseobject(i).vcount
 textamountl = textamountl + baseobject(i).lcount
NEXT
 DIM SHARED baseobjvdata(1 TO textamountv, 3) AS DOUBLE
 DIM SHARED baseobjldata(1 TO textamountl, 1) AS DOUBLE
FOR i = 1 TO textamountv
 READ baseobjvdata(i, 0), baseobjvdata(i, 1), baseobjvdata(i, 2), baseobjvdata(i, 3)
NEXT
FOR i = 1 TO textamountl
 READ baseobjldata(i, 0), baseobjldata(i, 1)
NEXT

DIM SHARED mainobject(1 TO mainobjmax) AS mainobjframe
DIM SHARED mainobjectdata(1 TO mainobjmax, mainobjdatamax) AS DOUBLE

RESTORE characters
READ textamount
FOR i = 0 TO textamount
 READ textamount
 READ merkisto(textamount).chrvcount, merkisto(textamount).chrlcount, merkisto(textamount).leading, merkisto(textamount).spacing
 merkisto(textamount).chrvdloc = textamountchrvdloc
 merkisto(textamount).chrldloc = textamountchrldloc
 FOR ii = 0 TO merkisto(textamount).chrvcount
  READ chrvdata(textamountchrvdloc + ii, 0), chrvdata(textamountchrvdloc + ii, 1)
 NEXT
 textamountchrvdloc = textamountchrvdloc + ii
 FOR ii = 0 TO merkisto(textamount).chrlcount
  READ chrldata(textamountchrldloc + ii, 0), chrldata(textamountchrldloc + ii, 1)
 NEXT
 textamountchrldloc = textamountchrldloc + ii
NEXT

SCREEN 13

xINITIALIZEBRUSH
xTXTSCHEDULER
RESTORE p3d1

GOSUB Efekti01
GOSUB Efekti02
GOSUB Efekti03
GOSUB Efekti04
GOSUB Efekti05
GOSUB Efekti06
GOSUB Efekti07
GOSUB EfektiEND






SYSTEM

p3dbaseobjdata:
'-=!object count!=-
DATA 1
'-=cube=-
'-vertices count, lines count-
DATA 8,12
'-vertices data-
DATA  1, -1,  1,  0
DATA -1, -1,  1,  0
DATA  1,  1,  1,  0
DATA -1,  1,  1,  0
DATA  1, -1, -1,  0
DATA -1, -1, -1,  0
DATA  1,  1, -1,  0
DATA -1,  1, -1,  0
'-lines data-
DATA  1,  2
DATA  3,  4
DATA  5,  6
DATA  7,  8
DATA  1,  3
DATA  2,  4
DATA  5,  7
DATA  6,  8
DATA  1,  5
DATA  2,  6
DATA  3,  7
DATA  4,  8



p3dmainobjdata:
p3d1:
'-main object data-
DATA 0,  0,  0
DATA 40, 40, 40
DATA -30, 0, 35,  0
'-sub-object data-
'-ocount, otype, oshow-
DATA 8
DATA 1,1,1,1,1,1,1,1
DATA 1,1,1,1,1,1,1,1
'-scale, angle & location-
DATA .25, .25, .25
DATA .25, .25, .25
DATA .25, .25, .25
DATA .25, .25, .25
DATA .25, .25, .25
DATA .25, .25, .25
DATA .25, .25, .25
DATA .25, .25, .25
DATA 0,  0,  0
DATA 0,  0,  0
DATA 0,  0,  0
DATA 0,  0,  0
DATA 0,  0,  0
DATA 0,  0,  0
DATA 0,  0,  0
DATA 0,  0,  0
DATA  .5, -.5,  .5,  0
DATA -.5, -.5,  .5,  0
DATA  .5,  .5,  .5,  0
DATA -.5,  .5,  .5,  0
DATA  .5, -.5, -.5,  0
DATA -.5, -.5, -.5,  0
DATA  .5,  .5, -.5,  0
DATA -.5,  .5, -.5,  0
p3d2:
DATA 0,  0,  0
DATA 40, 40, 40
DATA -35, 0, 30,  0
'-sub-object data-
'-ocount, otype, oshow-
DATA 2
DATA 1,1
DATA 1,1
'-scale, angle & location-
DATA 1, 1, 1
DATA 1, 1, 1
DATA 0, 0, 0
DATA 0, 0, 0
DATA 0, 2, 0, 0
DATA 0,-2, 0, 0
p3d3:
DATA 0,  0,  0
DATA 10, 10, 10
DATA 0, 0, 50,  0
'-sub-object data-
'-ocount, otype, oshow-
DATA 5
DATA 1,1,1,1,1
DATA 1,1,1,1,1
'-scale, angle & location-
DATA 1, 1, 1
DATA 1, 1, 1
DATA 1, 1, 1
DATA 1, 1, 1
DATA 1, 1, 1
DATA 0, 0, 0
DATA 0, 0, 0
DATA 0, 0, 0
DATA 0, 0, 0
DATA 0, 0, 0
DATA 1, 0, .5, 0
DATA 0, -1, 1, 0
DATA 1, 0, 1.5, 0
DATA 0, -1, 2, 0
DATA 0, 0, 2.5, 0
p3d4:
DATA 0,  0,  0
DATA 10, 10, 10
DATA 0, 0, 80,  0
'-sub-object data-
'-ocount, otype, oshow-
DATA 5
DATA 1,1,1,1,1
DATA 1,1,1,1,1
'-scale, angle & location-
DATA 1, 1, 1
DATA 1, 1, 1
DATA 1, 1, 1
DATA 1, 1, 1
DATA 1, 1, 1
DATA 0, 0, 0
DATA 0, 0, 0
DATA 0, 0, 0
DATA 0, 0, 0
DATA 0, 0, 0
DATA 0, 0, -1, 0
DATA 1, 0, 0, 0
DATA -1, 0, 0, 0
DATA .33, 0, 1, 0
DATA -.33, 0, 1, 0

p3d5:
DATA 0,  0,  0
DATA 10, 10, 10
DATA 0, 0, 40,  0
'-sub-object data-
'-ocount, otype, oshow-
DATA 3
DATA 1,1,1
DATA 1,1,1
'-scale, angle & location-
DATA 1, 1, 1
DATA 1, 1, 1
DATA 1, 1, 1
DATA 0, 0, 0
DATA 0, 0, 0
DATA 0, 0, 0
DATA -5, 0, 0, 0
DATA 0, -5, 0, 0
DATA 0, 0, -5, 0

p3d6:
DATA 0,  0,  0
DATA 10, 10, 10
DATA 0, 0, 40,  0
'-sub-object data-
'-ocount, otype, oshow-
DATA 3
DATA 1,1,1
DATA 1,1,1
'-scale, angle & location-
DATA 1, 1, 1
DATA 1, 1, 1
DATA 1, 1, 1
DATA 0, 0, 0
DATA 0, 0, 0
DATA 0, 0, 0
DATA 3, 0, 3, 0
DATA 0, 3, 0, 0
DATA 3, 0, 3, 0

p3d7:
DATA 0,  0,  0
DATA 10, 10, 10
DATA 0, 0, 40,  0
'-sub-object data-
'-ocount, otype, oshow-
DATA 3
DATA 1,1,1
DATA 1,1,1
'-scale, angle & location-
DATA 1, 1, 1
DATA 1, 1, 1
DATA 1, 1, 1
DATA 0, 0, 0
DATA 0, 0, 0
DATA 0, 0, 0
DATA 0, 0, -5, 0
DATA 0, -5, 0, 0
DATA -5, 0, 0, 0

characters:
'number of characters
DATA 42
'"A"
'ascii#, vertices, lines, character leading, character spacing
DATA 65,4,2,0,0
'vertices
DATA 0,1
DATA .25,.5
DATA .5,0
DATA .75,.5
DATA 1,1
'lines
DATA 0,2
DATA 2,4
DATA 1,3

'B
DATA 66,4,4,0,0
'vertices
DATA 0,0
DATA 0,1
DATA .75,.25
DATA .5,.5
DATA 1,.75
'lines
DATA 0,1
DATA 0,2
DATA 2,3
DATA 3,4
DATA 4,1

'C
DATA 67,5,4,0,0
'vertices
DATA 1,.25
DATA .5,0
DATA 0,.25
DATA 0,.75
DATA .5,1
DATA 1,.75
'lines
DATA 0,1
DATA 1,2
DATA 2,3
DATA 3,4
DATA 4,5

'D
DATA 68,2,2,0,0
'vertices
DATA 0,0
DATA 0,1
DATA .75,.5
'lines
DATA 0,1
DATA 1,2
DATA 2,0

'E
DATA 69,5,3,0,0
'vertices
DATA 0,0
DATA 1,0
DATA 0,1
DATA 1,1
DATA 0,.5
DATA 1,.5
'lines
DATA 0,1
DATA 2,3
DATA 4,5
DATA 0,2

'F
DATA 70,4,2,0,0
'vertices
DATA 0,0
DATA 1,0
DATA 0,1
DATA 0,.5
DATA 1,.5
'lines
DATA 0,1
DATA 0,2
DATA 3,4

'G
DATA 71,6,5,0,0
'vertices
DATA 1,.25
DATA .5,0
DATA 0,.25
DATA 0,.75
DATA .5,1
DATA 1,.75
DATA .5,.75
'lines
DATA 0,1
DATA 1,2
DATA 2,3
DATA 3,4
DATA 4,5
DATA 5,6

'H
DATA 72,5,2,0,0

DATA 0,0
DATA 0,1
DATA 0,.5
DATA 1,.5
DATA 1,0
DATA 1,1

DATA 0,1
DATA 2,3
DATA 4,5


'"I"
DATA 73,1,0,.4,.4

DATA .5,0
DATA .5,1

DATA 0,1

'J
DATA 74,3,2,0,0
'vertices
DATA 1,0
DATA 1,.75
DATA .5,1
DATA 0,.75
'lines
DATA 0,1
DATA 1,2
DATA 2,3

'K
DATA 75,4,2,0,0
'vertices
DATA 0,0
DATA 0,1
DATA 0,.5
DATA 1,0
DATA 1,1
'lines
DATA 0,1
DATA 2,3
DATA 2,4

'L
DATA 76,2,1,0,0
'vertices
DATA 0,0
DATA 0,1
DATA 1,1
'lines
DATA 0,1
DATA 1,2

'M
DATA 77,4,3,0,0
'vertices
DATA 0,1
DATA 0,0
DATA .5,.25
DATA 1,0
DATA 1,1
'lines
DATA 0,1
DATA 1,2
DATA 2,3
DATA 3,4

'N
DATA 78,3,2,0,0
'vertices
DATA 0,1
DATA 0,0
DATA 1,1
DATA 1,0
'lines
DATA 0,1
DATA 1,2
DATA 2,3

'O
DATA 79,5,5,0,0
'vertices
DATA 0,.25
DATA .5,0
DATA 1,.25
DATA 1,.75
DATA .5,1
DATA 0,.75
'lines
DATA 0,1
DATA 1,2
DATA 2,3
DATA 3,4
DATA 4,5
DATA 5,0

'P
DATA 80,3,2,0,.3
'vertices
DATA 0,1
DATA 0,0
DATA .5,.25
DATA 0,.5
'lines
DATA 0,1
DATA 1,2
DATA 2,3

'Q
DATA 81,6,6,0,0
'vertices
DATA 0,.25
DATA .5,0
DATA 1,.25
DATA 1,.75
DATA .5,1
DATA 0,.75
DATA 1,1
'lines
DATA 0,1
DATA 1,2
DATA 2,3
DATA 3,4
DATA 4,5
DATA 5,0
DATA 4,6

'R
DATA 82,4,3,0,.5
'vertices
DATA 0,1
DATA 0,0
DATA .5,.25
DATA 0,.5
DATA .5,1
'lines
DATA 0,1
DATA 1,2
DATA 2,3
DATA 3,4

'S
DATA 83,5,4,0,0
'vertices
DATA 1,.25
DATA .5,0
DATA 0,.25
DATA 1,.75
DATA .5,1
DATA 0,.75
'lines
DATA 0,1
DATA 1,2
DATA 2,3
DATA 3,4
DATA 4,5

'T
DATA 84,3,1,0,0
'vertices
DATA 0,0
DATA 1,0
DATA .5,0
DATA .5,1
'lines
DATA 0,1
DATA 2,3

'U
DATA 85,4,3,0,0
'vertices
DATA 0,0
DATA 0,.75
DATA .5,1
DATA 1,.75
DATA 1,0
'lines
DATA 0,1
DATA 1,2
DATA 2,3
DATA 3,4

'V
DATA 86,2,1,0,0
'vertices
DATA 0,0
DATA .5,1
DATA 1,0
'lines
DATA 0,1
DATA 1,2

'W
DATA 87,4,3,0,0
'vertices
DATA 0,0
DATA 0,1
DATA .5,.75
DATA 1,1
DATA 1,0
'lines
DATA 0,1
DATA 1,2
DATA 2,3
DATA 3,4

'X
DATA 88,3,1,0,0
'vertices
DATA 0,0
DATA 1,1
DATA 0,1
DATA 1,0
'lines
DATA 0,1
DATA 2,3

'Y
DATA 89,3,2,0,0
'vertices
DATA 0,0
DATA .5,.25
DATA .5,1
DATA 1,0
'lines
DATA 0,1
DATA 1,2
DATA 1,3

'Z
DATA 90,3,2,0,0
'vertices
DATA 0,0
DATA 1,0
DATA 0,1
DATA 1,1
'lines
DATA 0,1
DATA 1,2
DATA 2,3

'0
DATA 48,5,5,0,0
'vertices
DATA 0,.25
DATA .5,0
DATA 1,.25
DATA 1,.75
DATA .5,1
DATA 0,.75
'lines
DATA 0,1
DATA 1,2
DATA 2,3
DATA 3,4
DATA 4,5
DATA 5,0

'1
DATA 49,2,1,0,0
'vertices
DATA 0,.25
DATA .5,0
DATA .5,1
'lines
DATA 0,1
DATA 1,2

'2
DATA 50,4,3,0.3,0
'vertices
DATA 0,.25
DATA .5,0
DATA 1,.25
DATA 0,1
DATA 1,1
'lines
DATA 0,1
DATA 1,2
DATA 2,3
DATA 3,4

'3
DATA 51,6,5,0,0
'vertices
DATA 0,.25
DATA .5,0
DATA 1,.25
DATA .5,.5
DATA 1,.75
DATA .5,1
DATA 0,.75
'lines
DATA 0,1
DATA 1,2
DATA 2,3
DATA 3,4
DATA 4,5
DATA 5,6

'4
DATA 52,4,2,0,0.4
'vertices
DATA .25,0
DATA 0,.5
DATA .5,.5
DATA .5,0
DATA .5,1
'lines
DATA 0,1
DATA 1,2
DATA 3,4

'5
DATA 53,5,4,0,0
'vertices
DATA 1,0
DATA 0,0
DATA 0,.25
DATA 1,.75
DATA .5,1
DATA 0,.75
'lines
DATA 0,1
DATA 1,2
DATA 2,3
DATA 3,4
DATA 4,5

'6
DATA 54,6,6,0,0
'vertices
DATA 1,.25
DATA .5,0
DATA 0,.25
DATA 0,.75
DATA .5,1
DATA 1,.75
DATA .5,.5
'lines
DATA 0,1
DATA 1,2
DATA 2,3
DATA 3,4
DATA 4,5
DATA 5,6
DATA 6,3

'7
DATA 55,2,1,0,0
'vertices
DATA 0,0
DATA 1,0
DATA .5,1
'lines
DATA 0,1
DATA 1,2

'8
DATA 56,5,5,0,0
'vertices
DATA 1,.25
DATA .5,0
DATA 0,.25
DATA 1,.75
DATA .5,1
DATA 0,.75
'lines
DATA 0,1
DATA 1,2
DATA 2,3
DATA 3,4
DATA 4,5
DATA 5,0

'9
DATA 57,6,6,0,0
'vertices
DATA .5,.5
DATA 0,.25
DATA .5,0
DATA 1,.25
DATA 1,.75
DATA .5,1
DATA 0,.75
'lines
DATA 3,0
DATA 0,1
DATA 1,2
DATA 2,3
DATA 3,4
DATA 4,5
DATA 5,6

'-
DATA 45,1,0,0,0
'vertices
DATA 0,.5
DATA 1,.5
'lines
DATA 0,1

':
DATA 58,1,-1,0.3,0.3
'vertices
DATA .5,.25
DATA .5,.75
'lines

',
DATA 44,1,0,0.5,0.5
'vertices
DATA .5,1
DATA .6,.9
'lines
DATA 0,1

'"!"
DATA 33,3,1,.4,.4

DATA .5,0
DATA .5,.85
DATA .5,.95
DATA .5,1

DATA 0,1
DATA 2,3

'" "
DATA 32,-1,-1,.4,.4

'"'"
DATA 39,3,1,.4,.4

DATA .35,0
DATA .35,.3
DATA .65,0
DATA .65,.3

DATA 0,1
DATA 2,3

'"/"
DATA 47,1,0,.2,.2

DATA .3,1
DATA .6,0

DATA 0,1

'"*"
DATA 42,5,2,0,0

DATA .1,.5
DATA .9,.5
DATA .2,.8
DATA .8,.2
DATA .2,.2
DATA .8,.8

DATA 0,1
DATA 2,3
DATA 4,5

'"+"
DATA 43,3,1,.1,.1

DATA .2,.5
DATA .8,.5
DATA .5,.2
DATA .5,.8

DATA 0,1
DATA 2,3



scrolltext:
' --> text$, sizex, sizey, cap, x, y, colour, xv, yv, fadefrom, fadeto, fadefromtime, fadetotime, spawntime, disappeartime
DATA 12
DATA "SIKAKREISI",                   30, 80, 4,  5,   5,  31, 40, -7, 16, 16, 2, 8, 0, 14
DATA "A 'TRUE' 3D DEMO FOR QBASIC",    8,  8,  2, 50,  82, 27, 20, 0,  16, 16, 2, 4, 2, 10
DATA "BY PAHAMOKA/NAEMOK",            6,  6,  2, 20,  100,24, 10, 3,  16, 16, 2, 4, 3, 9
DATA "CODE BY",                        12, 12, 2, 180, 40, 27, 20, 5,  16, 16, 2, 4, 14,19
DATA "PAHAMOKA",                       10, 10, 2, 190, 55, 27, 10, 4,  16, 16, 2, 4, 15,20
DATA "'GFX' BY",                       12, 12, 2, 180, 80, 27, 22, 1,  16, 16, 2, 4, 17,22
DATA "PAHAMOKA",                       10, 10, 2, 190, 95, 27, 7,  0,  16, 16, 2, 4, 18,23
DATA "WITH GREAT HELP FROM",           6,  6,  2, 150, 110,24, 10, 7,  16, 16, 2, 4, 20,25
DATA "DEPRESSIO",                      10, 10, 2, 180, 120,27, 12, -2, 16, 16, 2, 4, 21,26
DATA "'MUSIC' BY",                     12, 12, 2, 170, 140,27, 18, 3,  16, 16, 2, 4, 23,28
DATA "RND 3K 37",                      10, 10, 2, 180, 155,27, 5,  -1, 16, 16, 2, 4, 24,29
DATA "LOOOOOOOOLOOOOOOOOOLOOOOOOOOOOLOOOOOOOOOO :D", 12,12,2,319,0,31,-800,0,30,16,2,5,88,130


Efekti01:

n = xCREATEOBJECT(1)

timeb = TIMER
rotaxison(1) = 1
rotaxison(0) = 1
rotalphaa(0) = 7
rotalphaa(1) = 1.75
fps = 10
timeplay = TIMER
DO
IF TIMER - timeplay > .2 THEN SOUND RND * 30000 + 37, .25
fpsc = fpsc + 1
IF fpsc > 2 THEN rotaxison(0) = 0
 xRENDER3D
 xTXTSCHEDULER
 xUPDATESCREEN
 IF (TIMER - timeb) > 11 AND graphcolour <= 30 THEN graphcolour = graphcolour + .5
FOR ii = 1 TO mainobjectdata(n, mainobject(n).ocountptr)
 FOR iii = 0 TO 3
  IF rotaxison(iii) = 1 THEN
   rotaxis = iii
   rotalpha = rotalphaa(iii) / fps
   FOR i = 0 TO 3
    xROTATE mainobjectdata(n, mainobject(n).olocationptr + i + ((ii - 1) * 4))
   NEXT
   FOR i = 0 TO 3
    mainobjectdata(n, mainobject(n).olocationptr + i + ((ii - 1) * 4)) = matvect(i)
   NEXT
  END IF
 NEXT
 IF (TIMER - timeb) <> 0 THEN fps = fpsc / (TIMER - timeb)
NEXT
LOOP UNTIL TIMER - timeb > 28
'PRINT fps




RETURN

Efekti02:

xREMOVEOBJECT n
CLS
n = xCREATEOBJECT(2)
'rendermode = 0

rotaxison(1) = 1
rotaxison(0) = 1
rotalphaa(0) = .5
rotalphaa(1) = 1.75
DO
IF TIMER - timeplay > .15 THEN SOUND RND * 30000 + 37, .25: timeplay = TIMER
 fpsc = fpsc + 1
 FOR ii = 1 TO mainobjectdata(n, mainobject(n).ocountptr)
  FOR iii = 0 TO 3
   IF rotaxison(iii) = 1 THEN
    rotaxis = iii
    rotalpha = rotalphaa(iii) / fps
    origo.x = origo.x + SIN(origo.x / fps)
    FOR i = 0 TO 3
     xROTATE mainobjectdata(n, mainobject(n).olocationptr + i + ((ii - 1) * 4))
    NEXT
    rotaxis = 2
    FOR i = 0 TO 3
     mainobjectdata(n, mainobject(n).olocationptr + i + ((ii - 1) * 4)) = matvect(i)
    NEXT
   END IF
  NEXT
 NEXT
 xRENDER3D
 xTXTSCHEDULER
 xUPDATESCREEN
 IF (TIMER - timeb) <> 0 THEN fps = fpsc / (TIMER - timeb)
LOOP UNTIL TIMER - timeb > 40
origo.x = 160
origo.y = 100



RETURN

Efekti03:

xREMOVEOBJECT n
CLS
n = xCREATEOBJECT(3)

rotaxison(1) = 1
timeri = TIMER
DO
IF TIMER - timeplay > .2 THEN SOUND RND * 30000 + 37, .25: timeplay = TIMER
 rotalphaa(1) = SIN((fpsc / 1.5) / fps)
 fpsc = fpsc + 1
 IF TIMER - timeri > .9 THEN
  timeri = TIMER
  FOR i = 1 TO 5
   FOR ii = 0 TO 3
    mainobjectdata(n, mainobject(n).olocationptr + (ii * 4) + i) = RND * 10 - 5
   NEXT
  NEXT
 END IF
 FOR ii = 1 TO mainobjectdata(n, mainobject(n).ocountptr)
  FOR iii = 0 TO 3
   IF rotaxison(iii) = 1 THEN
    rotaxis = iii
    rotalpha = rotalphaa(iii) / fps
    FOR i = 0 TO 3
     xROTATE mainobjectdata(n, mainobject(n).olocationptr + i + ((ii - 1) * 4))
    NEXT
    FOR i = 0 TO 3
     mainobjectdata(n, mainobject(n).olocationptr + i + ((ii - 1) * 4)) = matvect(i)
    NEXT
   END IF
  NEXT
 NEXT
 xRENDER3D
 xTXTSCHEDULER
 xUPDATESCREEN
 IF (TIMER - timeb) <> 0 THEN fps = fpsc / (TIMER - timeb)
LOOP UNTIL TIMER - timeb > 52
origo.x = 160
origo.y = 100



RETURN

Efekti04:

xREMOVEOBJECT n
CLS
n = xCREATEOBJECT(2)
'rendermode = 0

rotaxison(1) = 1
rotaxison(0) = 1
rotalphaa(0) = .5
rotalphaa(1) = 1.75
DO
IF TIMER - timeplay > .15 THEN SOUND RND * 30000 + 37, .25: timeplay = TIMER
 fpsc = fpsc + 1
 FOR ii = 1 TO mainobjectdata(n, mainobject(n).ocountptr)
  FOR iii = 0 TO 3
   IF rotaxison(iii) = 1 THEN
    rotaxis = iii
    rotalpha = rotalphaa(iii) / fps
    origo.x = origo.x + SIN(TIMER / fps)
    origo.y = origo.y + SIN(TIMER / fps)
    FOR i = 0 TO 3
     xROTATE mainobjectdata(n, mainobject(n).olocationptr + i + ((ii - 1) * 4))
    NEXT
    rotaxis = 2
    FOR i = 0 TO 3
     mainobjectdata(n, mainobject(n).olocationptr + i + ((ii - 1) * 4)) = matvect(i)
    NEXT
   END IF
  NEXT
 NEXT
 xRENDER3D
 xTXTSCHEDULER
 xUPDATESCREEN
 IF (TIMER - timeb) <> 0 THEN fps = fpsc / (TIMER - timeb)
LOOP UNTIL TIMER - timeb > 64
origo.x = 160
origo.y = 100

RETURN

Efekti05:

xREMOVEOBJECT n
CLS
n = xCREATEOBJECT(4)

rotaxison(2) = 1
timeri = TIMER
DO
IF TIMER - timeplay > .2 THEN SOUND 30000 + 37, .25: timeplay = TIMER
 rotalphaa(2) = SIN((fpsc / 1.5) / fps)
 fpsc = fpsc + 1
 IF TIMER - timeri > .9 THEN
  timeri = TIMER
  FOR i = 1 TO 5
   FOR ii = 0 TO 3
    mainobjectdata(n, mainobject(n).olocationptr + (ii * 4) + i) = RND * 10 - 5
   NEXT
  NEXT
 END IF
 FOR ii = 1 TO mainobjectdata(n, mainobject(n).ocountptr)
  FOR iii = 0 TO 3
   IF rotaxison(iii) = 1 THEN
    rotaxis = iii
    rotalpha = rotalphaa(iii) / fps
    FOR i = 0 TO 3
     xROTATE mainobjectdata(n, mainobject(n).olocationptr + i + ((ii - 1) * 4))
    NEXT
    FOR i = 0 TO 3
     mainobjectdata(n, mainobject(n).olocationptr + i + ((ii - 1) * 4)) = matvect(i)
    NEXT
   END IF
  NEXT
 NEXT
 xRENDER3D
 xTXTSCHEDULER
 xUPDATESCREEN
 IF (TIMER - timeb) <> .15 THEN fps = fpsc / (TIMER - timeb)
LOOP UNTIL TIMER - timeb > 76
origo.x = 160
origo.y = 100

RETURN

Efekti06:

xREMOVEOBJECT n
CLS
n = xCREATEOBJECT(3)

rotaxison(1) = 1
timeri = TIMER
'xstimer = TIMER
DO
'xSLEEP .075 * (TIMER - xstimer)
IF TIMER - timeplay > .2 THEN SOUND RND * 30000 + 37, .25: timeplay = TIMER
 rotalphaa(1) = SIN((fpsc / 1.5) / fps)
 fpsc = fpsc + 1
 IF TIMER - timeri > .9 THEN
  timeri = TIMER
  FOR i = 1 TO 5
   FOR ii = 0 TO 3
    mainobjectdata(n, mainobject(n).olocationptr + (ii * 4) + i) = RND * 10 - 5
   NEXT
  NEXT
 END IF
 FOR ii = 1 TO mainobjectdata(n, mainobject(n).ocountptr)
  FOR iii = 0 TO 3
   IF rotaxison(iii) = 1 THEN
    rotaxis = iii
    rotalpha = rotalphaa(iii) / fps
    FOR i = 0 TO 3
     xROTATE mainobjectdata(n, mainobject(n).olocationptr + i + ((ii - 1) * 4))
    NEXT
    FOR i = 0 TO 3
     mainobjectdata(n, mainobject(n).olocationptr + i + ((ii - 1) * 4)) = matvect(i)
    NEXT
   END IF
  NEXT
 NEXT
 xRENDER3D
 xTXTSCHEDULER
 xUPDATESCREEN
 IF (TIMER - timeb) <> 0 THEN fps = fpsc / (TIMER - timeb)
LOOP UNTIL TIMER - timeb > 88
origo.x = 160
origo.y = 100

RETURN

Efekti07:

DIM tila(20 * 20) AS INTEGER

DO
'xSLEEP RND * .2
origo.x = RND * 319
origo.y = RND * 199
SELECT CASE INT(RND * 4 + 2)
 CASE 2: GOSUB Efekti02
 CASE 3: GOSUB Efekti03
 CASE 4: GOSUB Efekti04
 CASE 5: GOSUB Efekti05
 CASE 6: GOSUB Efekti06
 END SELECT
LOOP UNTIL TIMER - timeb > 96

RETURN

EfektiEND:

xREMOVEOBJECT n
CLS
n1 = xCREATEOBJECT(5)
n2 = xCREATEOBJECT(6)
n3 = xCREATEOBJECT(7)

timeri = TIMER
rotaxis = 0
rotalpha = 6
DO
IF TIMER - timeplay > .15 THEN SOUND 30000, .25: timeplay = TIMER
 fpsc = fpsc + 1
 FOR i = 0 TO 3
  xROTATE mainobjectdata(RND * 2 + 1, mainobject(RND * 2 + 1).locationptr) + SIN(fpsc / fps)
 NEXT
 FOR i = 0 TO 3
  mainobjectdata(RND * 2 + 1, mainobject(RND * 2 + 1).olocationptr) = matvect(i)
 NEXT
  mainobjectdata(RND * 2 + 1, mainobject(RND * 2 + 1).locationptr) = mainobjectdata(RND * 2 + 1, mainobject(RND * 2 + 1).locationptr) + COS(fpsc / fps)
  mainobjectdata(n1, mainobject(n1).scaleptr) = RND * 80 - 40
  mainobjectdata(n2, mainobject(n2).scaleptr + 1) = RND * 80 - 40
  mainobjectdata(n3, mainobject(n3).scaleptr + 2) = RND * 80 - 40
  origo.x = origo.x + RND * (TIMER - timeri) - ((TIMER - timeri) / 2)
  origo.y = origo.y + RND * (TIMER - timeri) - ((TIMER - timeri) / 2)
  origo.Z = origo.Z + RND * (TIMER - timeri) - ((TIMER - timeri) / 2)
 graphcolour = graphcolour - (1.75 / fps)
 IF graphcolour < 16 THEN graphcolour = 16
 xRENDER3D
 xTXTSCHEDULER
 xUPDATESCREEN
 IF (TIMER - timeb) <> 0 THEN fps = fpsc / (TIMER - timeb)
LOOP UNTIL TIMER - timeb > 132


CLS
RETURN

FUNCTION xCREATEOBJECT (x AS INTEGER)

 SELECT CASE x
   CASE 1
  RESTORE p3d1
   CASE 2
  RESTORE p3d2
   CASE 3
  RESTORE p3d3
   CASE 4
  RESTORE p3d4
   CASE 5
  RESTORE p3d5
   CASE 6
  RESTORE p3d6
   CASE 7
  RESTORE p3d7
 END SELECT

 'FOR i = 1 TO mainobjmax
 ' IF mainobjectdata(i, mainobject(i).flagptr) = 0 THEN n = i
 'NEXT
  nextobject = nextobject + 1
  n = nextobject
  IF n > mainobjmax THEN xERROR "There's no room for more objects!"
  mainobject(n).flagptr = 0
  mainobjectdata(n, mainobject(n).flagptr) = 1
  mainobject(n).angleptr = 1
  mainobject(n).scaleptr = mainobject(n).angleptr + 3
  mainobject(n).locationptr = mainobject(n).scaleptr + 3
  mainobject(n).ocountptr = mainobject(n).locationptr + 4
  mainobject(n).otypeptr = mainobject(n).ocountptr + 1
  FOR i = 1 TO mainobject(n).ocountptr
   READ mainobjectdata(n, i)
   'PRINT mainobjectdata(n, i);
  NEXT
  mainobject(n).oshowptr = mainobject(n).otypeptr + mainobjectdata(n, mainobject(n).ocountptr)
  FOR i = mainobject(n).otypeptr TO mainobject(n).otypeptr + mainobjectdata(n, mainobject(n).ocountptr) - 1
   READ mainobjectdata(n, i)
   'PRINT mainobjectdata(n, i);
  NEXT
  mainobject(n).oscaleptr = mainobject(n).oshowptr + mainobjectdata(n, mainobject(n).ocountptr)
  FOR i = mainobject(n).oshowptr TO mainobject(n).oshowptr + mainobjectdata(n, mainobject(n).ocountptr) - 1
   READ mainobjectdata(n, i)
   'PRINT mainobjectdata(n, i);
  NEXT
  mainobject(n).oangleptr = mainobject(n).oscaleptr + (mainobjectdata(n, mainobject(n).ocountptr) * 3)
  FOR i = mainobject(n).oscaleptr TO mainobject(n).oscaleptr + (mainobjectdata(n, mainobject(n).ocountptr) * 3) - 1
   READ mainobjectdata(n, i)
   'PRINT mainobjectdata(n, i);
  NEXT
  mainobject(n).olocationptr = mainobject(n).oangleptr + (mainobjectdata(n, mainobject(n).ocountptr) * 3)
  FOR i = mainobject(n).oangleptr TO mainobject(n).oangleptr + (mainobjectdata(n, mainobject(n).ocountptr) * 3) - 1
   READ mainobjectdata(n, i)
   'PRINT mainobjectdata(n, i);
  NEXT
  FOR i = mainobject(n).olocationptr TO mainobject(n).olocationptr + (mainobjectdata(n, mainobject(n).ocountptr) * 4) - 1
   READ mainobjectdata(n, i)
   'PRINT mainobjectdata(n, i);
  NEXT

 xCREATEOBJECT = n
END FUNCTION

SUB xERROR (text$)

 SCREEN 0: CLS
 PRINT text$
 SYSTEM

END SUB

SUB xINITIALIZEBRUSH

 xPSET 0, 0, -1
 xLINE 0, 0, 0, 0, -1

END SUB

SUB xLINE (x1, y1, x2, y2, c) STATIC

 IF c = -1 THEN
  DIM lineholder(999, 2, 1) AS INTEGER
  DIM lineholderrmv(999, 1, 1) AS INTEGER
  EXIT SUB
 ELSEIF c = 256 THEN
  FOR i = 0 TO linecount
   LINE (lineholderrmv(i, 0, 0), lineholderrmv(i, 1, 0))-(lineholderrmv(i, 0, 1), lineholderrmv(i, 1, 1)), 0
   lineholderrmv(i, 0, 0) = lineholder(i, 0, 0)
   lineholderrmv(i, 1, 0) = lineholder(i, 1, 0)
   lineholderrmv(i, 0, 1) = lineholder(i, 0, 1)
   lineholderrmv(i, 1, 1) = lineholder(i, 1, 1)
   LINE (lineholder(i, 0, 0), lineholder(i, 1, 0))-(lineholder(i, 0, 1), lineholder(i, 1, 1)), lineholder(i, 2, 0)
  NEXT
  ERASE lineholder
  linecount = 0
  EXIT SUB
 END IF

 lineholder(linecount, 0, 0) = x1
 lineholder(linecount, 1, 0) = y1
 lineholder(linecount, 0, 1) = x2
 lineholder(linecount, 1, 1) = y2
 lineholder(linecount, 2, 0) = c

 linecount = linecount + 1

END SUB

SUB xLINER (x1, y1, z1, x2, y2, z2)

 FOR i = 0 TO 1
  xLINE origo.x + (x1 / perspective * (origo.Z + z1)), origo.y + (y1 / perspective * (origo.Z + z1)), origo.x + (x2 / perspective * (origo.Z + z2)), origo.y + (y2 / perspective * (origo.Z + z2)), graphcolour
 NEXT

END SUB

SUB xMATRIX

 DIM matvecttextamount(3)
     matvecttextamount(0) = matvect(0)
     matvecttextamount(1) = matvect(1)
     matvecttextamount(2) = matvect(2)
     matvecttextamount(3) = matvect(3)

 SELECT CASE rotaxis
  CASE 0
   matrix(0, 0) = 1: matrix(0, 1) = 0: matrix(0, 2) = 0: matrix(0, 3) = 0
   matrix(1, 0) = 0: matrix(1, 1) = COS(rotalpha): matrix(1, 2) = SIN(rotalpha): matrix(1, 3) = 0
   matrix(2, 0) = 0: matrix(2, 1) = -SIN(rotalpha): matrix(2, 2) = COS(rotalpha): matrix(2, 3) = 0
   matrix(3, 0) = 0: matrix(3, 1) = 0: matrix(3, 2) = 0: matrix(3, 3) = 1
  CASE 1
   matrix(0, 0) = COS(rotalpha): matrix(0, 1) = 0: matrix(0, 2) = -SIN(rotalpha): matrix(0, 3) = 0
   matrix(1, 0) = 0: matrix(1, 1) = 1: matrix(1, 2) = 0: matrix(1, 3) = 0
   matrix(2, 0) = SIN(rotalpha): matrix(2, 1) = 0: matrix(2, 2) = COS(rotalpha): matrix(2, 3) = 0
   matrix(3, 0) = 0: matrix(3, 1) = 0: matrix(3, 2) = 0: matrix(3, 3) = 1
  CASE 2
   matrix(0, 0) = COS(rotalpha): matrix(0, 1) = SIN(rotalpha): matrix(0, 2) = 0: matrix(0, 3) = 0
   matrix(1, 0) = -SIN(rotalpha): matrix(1, 1) = COS(rotalpha): matrix(1, 2) = 0: matrix(1, 3) = 0
   matrix(2, 0) = 0: matrix(2, 1) = 0: matrix(2, 2) = 1: matrix(2, 3) = 0
   matrix(3, 0) = 0: matrix(3, 1) = 0: matrix(3, 2) = 0: matrix(3, 3) = 1
 END SELECT

  FOR i = 0 TO 3
   matvect(i) = (matrix(i, 0) * matvecttextamount(0)) + (matrix(i, 1) * matvecttextamount(1)) + (matrix(i, 2) * matvecttextamount(2)) + (matrix(i, 3) * matvecttextamount(3))
  NEXT

END SUB

SUB xPRINT (texta$, sizex, sizey, cap, x, y, colour)

 text$ = texta$
 text$ = CHR$(0) + text$
 charoffset = x - (sizex + cap)
 FOR i = 2 TO LEN(text$)
  textamount = ASC(MID$(text$, i, 1))
  charoffset = charoffset + sizex + cap - ((merkisto(ASC(MID$(text$, i - 1, 1))).spacing + merkisto(textamount).leading) * sizex)
  FOR ii = 0 TO merkisto(textamount).chrvcount
   PSET (charoffset + (chrvdata(merkisto(textamount).chrvdloc + ii, 0) * sizex), y + (chrvdata(merkisto(textamount).chrvdloc + ii, 1) * sizey)), colour
  NEXT
  FOR ii = 0 TO merkisto(textamount).chrlcount
   xLINE charoffset + (chrvdata(merkisto(textamount).chrvdloc + chrldata(merkisto(textamount).chrldloc + ii, 0), 0) * sizex), y + (chrvdata(merkisto(textamount).chrvdloc + chrldata(merkisto(textamount).chrldloc + ii, 0), 1) * sizey), charoffset + (chrvdata(merkisto(textamount).chrvdloc + chrldata(merkisto(textamount).chrldloc + ii, 1), 0) * sizex), y + (chrvdata(merkisto(textamount).chrvdloc + chrldata(merkisto(textamount).chrldloc + ii, 1), 1) * sizey), colour
  NEXT
 NEXT

END SUB

SUB xPSET (x, y, c) STATIC

 IF c = -1 THEN
  DIM pixelholder(10, 2)  AS INTEGER
  EXIT SUB
 ELSEIF c = 256 THEN
  FOR i = 0 TO pixelcount
   PSET (pixelholder(i, 0), pixelholder(i, 1)), pixelholder(i, 2)
  NEXT
  ERASE pixelholder
  pixelcount = 0
  EXIT SUB
 END IF

 pixelholder(pixelcount, 0) = x
 pixelholder(pixelcount, 1) = y
 pixelholder(pixelcount, 2) = c

 pixelcount = pixelcount + 1

END SUB

SUB xREMOVEOBJECT (n)

 'mainobjectdata(n, mainobject(n).flagptr) = 0
 nextobject = nextobject - 1

END SUB

SUB xRENDER3D

 SELECT CASE rendermode
  CASE 0
   FOR i = 1 TO mainobjmax
    IF mainobjectdata(i, mainobject(i).flagptr) = 1 THEN
     FOR ii = 1 TO mainobjectdata(i, mainobject(i).ocountptr)
      IF mainobjectdata(i, mainobject(i).oshowptr + (ii - 1)) THEN
       FOR iii = 1 TO baseobject(mainobjectdata(i, mainobject(i).otypeptr + ii - 1)).vcount
	xVERTEXER mainobjectdata(i, mainobject(i).locationptr) + (mainobjectdata(i, mainobject(i).scaleptr)) * (mainobjectdata(i, mainobject(i).olocationptr + ((ii - 1) * 4)) + (mainobjectdata(i, mainobject(i).oscaleptr + ((ii - 1) * 3)) * baseobjvdata(iii, 0))), mainobjectdata(i, mainobject(i).locationptr + 1) + (mainobjectdata(i, mainobject(i).scaleptr + 1)) * (mainobjectdata(i, mainobject(i).olocationptr + ((ii - 1) * 4) + 1) + (mainobjectdata(i, mainobject(i).oscaleptr + ((ii - 1) * 3) + 1) * baseobjvdata(iii, 1))), mainobjectdata(i, mainobject(i).locationptr + 2) + (mainobjectdata(i, mainobject(i).scaleptr + 2)) * (mainobjectdata(i, mainobject(i).olocationptr + ((ii - 1) * 4) + 2) + (mainobjectdata(i, mainobject(i).oscaleptr + ((ii - 1) * 3) + 2) * baseobjvdata(iii, 2)))
       NEXT
      END IF
     NEXT
    END IF
   NEXT
  CASE 1
   FOR i = 1 TO mainobjmax
    IF mainobjectdata(i, mainobject(i).flagptr) = 1 THEN
     FOR ii = 1 TO mainobjectdata(i, mainobject(i).ocountptr)
      IF mainobjectdata(i, mainobject(i).oshowptr + (ii - 1)) THEN
       FOR iii = 1 TO baseobject(mainobjectdata(i, mainobject(i).otypeptr + ii - 1)).lcount
	xLINER mainobjectdata(i, mainobject(i).locationptr) + (mainobjectdata(i, mainobject(i).scaleptr)) * (mainobjectdata(i, mainobject(i).olocationptr + ((ii - 1) * 4)) + (mainobjectdata(i, mainobject(i).oscaleptr + ((ii - 1) * 3)) * baseobjvdata(baseobjldata(iii, 0), 0))), mainobjectdata(i, mainobject(i).locationptr + 1) + (mainobjectdata(i, mainobject(i).scaleptr + 1)) * (mainobjectdata(i, mainobject(i).olocationptr + ((ii - 1) * 4) + 1) + (mainobjectdata(i, mainobject(i).oscaleptr + ((ii - 1) * 3) + 1) * baseobjvdata(baseobjldata(iii, 0), 1))), mainobjectdata(i, mainobject(i).locationptr + 2) + (mainobjectdata(i, mainobject(i).scaleptr + 2)) * (mainobjectdata(i, mainobject(i).olocationptr + ((ii - 1) * 4) + 2) + (mainobjectdata(i, mainobject(i).oscaleptr + ((ii - 1) * 3) + 2) * baseobjvdata(baseobjldata(iii, 0), 2))), mainobjectdata(i, mainobject(i).locationptr) + (mainobjectdata(i, mainobject(i).scaleptr)) * (mainobjectdata(i, mainobject(i).olocationptr + ((ii - 1) * 4)) + (mainobjectdata(i, mainobject(i).oscaleptr + ((ii - 1) * 3)) * baseobjvdata(baseobjldata(iii, 1), 0))), mainobjectdata(i, mainobject(i).locationptr + 1) + (mainobjectdata(i, mainobject(i).scaleptr + 1)) * (mainobjectdata(i, mainobject(i).olocationptr + ((ii - 1) * 4) + 1) + (mainobjectdata(i, mainobject(i).oscaleptr + ((ii - 1) * 3) + 1) * baseobjvdata(baseobjldata(iii, 1), 1))), mainobjectdata(i, mainobject(i).locationptr + 2) + (mainobjectdata(i, mainobject(i).scaleptr + 2)) * (mainobjectdata(i, mainobject(i).olocationptr + ((ii - 1) * 4) + 2) + (mainobjectdata(i, mainobject(i).oscaleptr + ((ii - 1) * 3) + 2) * baseobjvdata(baseobjldata(iii, 1), 2)))
       NEXT
      END IF
     NEXT
    END IF
   NEXT
 END SELECT

END SUB

SUB xROTATE (x AS DOUBLE) STATIC

 IF i > 3 THEN i = 0: ERASE matvect

 matvect(i) = x
 i = i + 1

 IF i > 3 THEN xMATRIX

END SUB

SUB xSLEEP (x)

timexs = TIMER
DO: LOOP UNTIL TIMER - timexs >= x

END SUB

SUB xTXTSCHEDULER STATIC

 IF starttime = 0 THEN
  starttime = TIMER
  RESTORE scrolltext
  READ textamount
  DIM text$(textamount)
  DIM demotext(textamount) AS scrtxtsprop
  FOR i = 1 TO textamount
     READ text$(i), demotext(i).sizex, demotext(i).sizey, demotext(i).cap, demotext(i).x, demotext(i).y, demotext(i).colour, demotext(i).xv, demotext(i).yv, demotext(i).fadefrom, demotext(i).fadeto, demotext(i).fadefromtime, demotext(i).fadetotime, demotext(i).spawntime, demotext(i).disappeartime
  NEXT
 END IF

 curtime = TIMER - starttime

 FOR i = 1 TO textamount
  IF demotext(i).spawntime < curtime AND demotext(i).disappeartime > curtime THEN
   x = demotext(i).x + demotext(i).xv * ((curtime - demotext(i).spawntime) / (demotext(i).disappeartime - demotext(i).spawntime))
   y = demotext(i).y + demotext(i).yv * ((curtime - demotext(i).spawntime) / (demotext(i).disappeartime - demotext(i).spawntime))
   IF curtime < demotext(i).spawntime + demotext(i).fadefromtime THEN colour = ((curtime - demotext(i).spawntime) / demotext(i).fadefromtime) * ABS(demotext(i).colour - demotext(i).fadefrom) + demotext(i).fadefrom
   IF curtime > demotext(i).disappeartime - demotext(i).fadetotime THEN colour = ((demotext(i).disappeartime - curtime) / demotext(i).fadetotime) * ABS(demotext(i).fadeto - demotext(i).colour) + demotext(i).fadeto
   xPRINT text$(i), demotext(i).sizex, demotext(i).sizey, demotext(i).cap, x, y, colour
  END IF
 NEXT

END SUB

SUB xUPDATESCREEN

 xPSET 0, 0, 256
 xLINE 0, 0, 0, 0, 256

END SUB

SUB xVERTEXER (x, y, Z)

 FOR i = 0 TO 1
  xPSET origo.x + (x / perspective * (origo.Z + Z)), origo.y + (y / perspective * (origo.Z + Z)), graphcolour
  'PRINT x; y; z
 NEXT

END SUB


No comments:

Post a Comment