Author Topic: Yabasic AMIGA  (Read 2465 times)

0 Members and 1 Guest are viewing this topic.

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17412
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Yabasic AMIGA
« on: October 19, 2006 »
This demo was supposed to be very Amiga-ish, rasters, cube, sroll, bitplanes, the lot.

Code: [Select]
'Amiga Demo Coded By Shockwave (C) 2002.
'=======================================
'
'
'
gosub setup
repeat
setdrawbuf dw
dw=1-dw
setdispbuf dw
gosub clist

ryo=ryo+2
gyo=gyo+3
byo=byo+4
vyo=vyo+5

gl=320+320*sin(mm*14)
gr=320+320*sin(mm*13)

if ryo>720 ryo=ryo-720
if gyo>720 gyo=gyo-720
if byo>720 byo=byo-720
if vyo>720 vyo=vyo-720

for a=1 to 70 step 10
by=rs(a+ryo)
gosub reds
next a

for a=1 to 70 step 10
by=rs(a+byo)
gosub blues
next a

for a=1 to 90 step 10
by=rs(a+gyo)
gosub greens
next a
bx=100
by=0
m=0
for a=1 to 240 step 20
bx=rs(m+vyo)
m=m+10
gosub verts
next a
size=14+5*sin(mm*20)
gosub rotate
gosub construct
gosub logo1
gosub scroll
gosub logo2

until (1=2)

'---------------------------------------------------------

'                        Scroller;
'---------------------------------------------------------
label scroll
yp=100*sin(mm*10)
setrgb 1,255,255,255 : text scx,256+yp,mid$(s$,p,67)
setrgb 1,0,0,0 : text scx+1,257+yp,mid$(s$,p,67)
scx=scx-1
if scx<-10 then:rem               RESET POS ADD NEW LETTER
scx=scx+10 : p=p+1
if p>len(s$) p=0
fi
return

'---------------------------------------------------------
'                     Draw The Object;
'---------------------------------------------------------
label construct
for a=1 to faces
gosub draw
next a
return

'---------------------------------------------------------
'              Draw A Face Of The Object;
'---------------------------------------------------------

label draw
  vx1= tx(f1(a))-tx(f2(a))
  vy1= ty(f1(a))-ty(f2(a))
  vx2= tx(f3(a))-tx(f2(a))
  vy2= ty(f3(a))-ty(f2(a))
  n=  vx1*vy2-vx2*vy1
 if n<0 then
 n=-(n/3000)
 setrgb 1,r(a)+n,g(a)+n,b(a)+n
 setrgb 2,r(a)+n/4,g(a)+n/4,b(a)+n/4
 setrgb 3,r(a)+n/8,g(a)+n/8,b(a)+n/8

 gtriangle tx(f1(a)),ty(f1(a)) to tx(f2(a)),ty(f2(a)) to tx(f3(a)),ty(f3(a))
 gtriangle tx(f1(a)),ty(f1(a)) to tx(f4(a)),ty(f4(a)) to tx(f3(a)),ty(f3(a))
 if cls(a)=1 then
   setrgb 1,25,25,25
   line tx(f1(a)),ty(f1(a)) to tx(f2(a)),ty(f2(a))
   line tx(f2(a)),ty(f2(a)) to tx(f3(a)),ty(f3(a))
   line tx(f3(a)),ty(f3(a)) to tx(f4(a)),ty(f4(a))
   line tx(f4(a)),ty(f4(a)) to tx(f1(a)),ty(f1(a))
 fi
fi
return


label rotate
'###############################################
'## Rotate And Scale Each Point! Store Result ##
'###############################################
 for a=1 to points
  x1=x(a)
  y1=y(a)
  z1=z(a)
'######################
'## X,Y,Z rotations! ##
'######################
  xx=x1
  yy=y1*cs(xr)+z1*sn(xr)
  zz=z1*cs(xr)-y1*sn(xr)
  y1=yy
  x1=xx*cs(yr)-zz*sn(yr)
  z1=xx*sn(yr)+zz*cs(yr)
  zz=z1
  xx=x1*cs(zr)-y1*sn(zr)
  yy=x1*sn(zr)+y1*cs(zr)
'########################
'## Apply Perspective! ##
'########################
dv=(zz/40)+1
  xx=size*(xx/dv)+320
  yy=size*(yy/dv)+256
  tx(a)=xx
  ty(a)=yy
  tz(a)=zz
 next a
xr=xr+1
yr=yr+2
zr=zr+3
if xr>720 xr=xr-720
if yr>720 yr=yr-720
if zr>720 zr=zr-720
return

'                     Logo Back Letters;
'---------------------------------------------------------
label logo1
setrgb 1,80,80,155
's
   fill rect 10,210 to 70,220
   fill rect 10,290 to 70,280
   fill rect 10,245 to 70,255
   fill rect 10,210 to 20,255
   fill rect 70,255 to 60,290
   fill rect 70,245 to 50,290
'o
   fill rect 150,210 to 210,220
   fill rect 150,290 to 210,280
   fill rect 150,210 to 160,290
   fill rect 210,210 to 200,290
   fill rect 150,245 to 170,290
'k
   fill rect 290,210 to 300,290
   fill rect 290,245 to 350,255
   fill rect 350,245 to 330,290
   fill rect 320,210 to 330,245
'a
   fill rect 430,210 to 440,290
   fill rect 490,210 to 480,290
   fill rect 430,210 to 490,220
   fill rect 430,245 to 490,255
   fill rect 430,245 to 450,290
'e
   fill rect 570,210 to 580,290
   fill rect 570,210 to 630,220
   fill rect 570,280 to 630,290
   fill rect 570,245 to 610,255
   fill rect 570,245 to 590,290
return
'                    Logo Front Letters;
'---------------------------------------------------------
label logo2
setrgb 1,120,120,255
'h
   fill rect 80,210 to 90,290
   fill rect 140,210 to 130,290
   fill rect 140,245 to 80,255
   fill rect 80,245 to 100,290
'c
   fill rect 220,210 to 280,220
   fill rect 220,290 to 280,280
   fill rect 220,210 to 230,290
   fill rect 220,245 to 240,290
'w
   fill rect 360,210 to 370,290
   fill rect 360,245 to 380,290
   fill rect 360,290 to 420,280
   fill rect 420,290 to 410,210
   fill rect 390,290 to 400,245
'v
   fill rect 500,210 to 510,290
   fill rect 510,245 to 520,290
   fill rect 560,210 to 550,245
   fill rect 500,280 to 545,290
   fill triangle 545,290 to 540,280 to 550,245
   fill triangle 560,245 to 550,245 to 545,290
   rect 5,204 to 635,296
return


label verts
setrgb 1,0,0,0
setrgb 2,0,0,0
setrgb 3,a,a,255-a
gtriangle bx,by to bx,512 to bx+64,512
gtriangle bx+128,by to bx+128,512 to bx+64,512
setrgb 2,a,a,255-a
gtriangle bx,by to bx+64,by to bx+64,512
gtriangle bx+128,by to bx+64,by to bx+64,512

return

label greens
setrgb 1,0,0,0
setrgb 2,0,0,0
setrgb 3,0,255,a
gtriangle gl,by to gr,by to gr,by+64
gtriangle gl,by+128 to gr,by+128 to gr,by+64
setrgb 2,0,255,a
gtriangle gl,by to gr,by+64 to gl,by+64
gtriangle gl,by+128 to gr,by+64 to gl,by+64

setrgb 1,0,0,0
setrgb 2,0,0,0
setrgb 3,a,155,a
gtriangle gr,by to 640,by to 640,by+64
gtriangle gr,by+128 to 640,by+128 to 640,by+64
setrgb 2,a,155,a
gtriangle gr,by to 640,by+64 to gr,by+64
gtriangle gr,by+128 to 640,by+64 to gr,by+64

setrgb 1,0,0,0
setrgb 2,0,0,0
setrgb 3,a,155,155
gtriangle gl,by to 0,by to 0,by+64
gtriangle gl,by+128 to 0,by+128 to 0,by+64
setrgb 2,a,155,155
gtriangle gl,by to 0,by+64 to gl,by+64
gtriangle gl,by+128 to 0,by+64 to gl,by+64

return


label reds
setrgb 1,0,0,0
setrgb 2,0,0,0
setrgb 3,255,0,a
gtriangle 0,by to 640,by to 640,by+32
gtriangle 0,by+64 to 640,by+64 to 640,by+32
setrgb 2,255,0,a
gtriangle 0,by to 640,by+32 to 0,by+32
gtriangle 0,by+64 to 640,by+32 to 0,by+32
return

label blues
setrgb 1,0,0,0
setrgb 2,0,0,0
setrgb 3,0,a,255
gtriangle 0,by to 640,by to 640,by+32
gtriangle 0,by+64 to 640,by+64 to 640,by+32
setrgb 2,0,a,255
gtriangle 0,by to 640,by+32 to 0,by+32
gtriangle 0,by+64 to 640,by+32 to 0,by+32
return


label clist
mm=mm+.002
bp=0
bo=1000+999*sin(mm)
go=1000+999*sin(mm/2)
ro=1000+999*sin(mm/3)

for a=0 to 512 step res
 setrgb 1,br(bp+ro),bg(bp+go),bb(bp+bo)
 bp=bp+1
 fill rect 0,a to 640,a+res
next a
return

label setup
open window 640,512
res=12
dim rs(1440)

for a=1 to 1440
 rs(a)=226+400*sin((a/2)*pi/180)
next a

dim br(2880),bg(2880),bb(2880)
for a=1 to 2880
 br(a)=50+100*sin(a*pi/180)
 bg(a)=50+100*sin((a*2)*pi/180)
 bb(a)=50+100*sin((a*3)*pi/180)
next a
'---------------------------------------------------------
'            Define the necessary variables;
'---------------------------------------------------------
size=16: rem                       how big do you want it?
dw=1 : Rem                       Double buffering Variable
points=8 : Rem          The amount of points in the object
faces=6 : Rem            The Amount of faces in the object
dim x(points): Rem            Original X co-ordinate store
dim y(points): Rem            Original Y co-ordinate store
dim z(points): Rem            Original Z co-ordinate store
dim tx(points): Rem       Transformed  X co-ordinate store
dim ty(points): Rem        Transformed Y co-ordinate store
dim tz(points): Rem        Transformed Z co-ordinate store
dim f1(faces):rem                   Connections definition
dim f2(faces):rem                   Connections definition
dim f3(faces):rem                   Connections definition
dim f4(faces):rem                   Connections definition
dim r(faces):rem                             Red Component
dim g(faces):rem                           Green Component
dim b(faces):rem                            Blue Component
dim cls(faces):rem                        Cell Shade Face?
'---------------------------------------------------------
'   Define Sine Tables for faster matrix calculations;
'---------------------------------------------------------

 dim cs(720)
 dim sn(720)
 for ang=0 to 720
  cs(ang)=cos(ang*(pi/360))
  sn(ang)=sin(ang*(pi/360))
 next ang
'---------------------------------------------------------
'               Read in the object's points;
'---------------------------------------------------------
for a=1 to points
 read x(a),y(a),z(a)
next a
'---------------------------------------------------------
'         Read In Connections and face parameters;
'---------------------------------------------------------
for a=1 to faces
read f1(a)
read f2(a)
read f3(a)
read f4(a)
read r(a),g(a),b(a),cls(a)
next a
'^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'   The Object Description As Data!
'   The Data Below Describes A Cube.
'^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

'Points definition;
'~~~~~~~~~~~~~~~~~~
'Below are the points of the object defined as x,y,z;

data -10,10,10,10,10,10,10,-10,10,-10,-10,10
data -10,10,-10,10,10,-10,10,-10,-10,-10,-10,-10

'Connection definition;
'Below are the faces of the object defined as vertice
'numbers, specified in clockwise order. These are followed
'by r,g,b values for the face and finally cell shaded
'parameter (0)=off (1)=on.

data 1,2,3,4,30,0,0,1
data 5,8,7,6,30,0,0,1
data 6,2,1,5,0,30,0,1
data 8,4,3,7,0,30,0,1
data 2,6,7,3,0,0,30,1
data 8,5,1,4,0,0,30,1

'                   Scroller Definition;
'---------------------------------------------------------
s$="                                                      "
s$=s$+"THIS DEMO IS CALLED    *AMIGA*    AND IT COULD BE "
s$=s$+"AN AMIGA DEMO TOO!  THE FIRST AMIGA DEMOS BY CREWS"
s$=s$+" LIKE DRAGONS AND RAZOR 1911 CONSISTED MAINLY OF "
s$=s$+"THESE COLOUR BAR EFFECTS, THEY WERE CREATED WITH "
s$=s$+"THE COPPER CO-PROCESSOR AND WERE FAIRLY UNIQUE TO "
s$=s$+"THE AMIGA AT THE TIME..   FYI YOU ARE LOOKING AT: "
s$=s$+"1: AN RGB BACKGROUND. 2: RED COPPER BARS. 3: BLUE "
s$=s$+"COPPER BARS. 3: GREEN COPPER BARS WITH A SPLIT "
s$=s$+"EFFECT. 4: VERTICAL COPPER BARS.  5:THE CUBE.  "
s$=s$+"6: A LOGO.  7: THIS SCROLL.  THIS HAS TO BE THE "
s$=s$+"MOST EFFECTS EVER ON SCREEN AT ONCE AND AT 50FPS "
s$=s$+"IN PS2 YABASIC!    IN FACT THE ONLY THING THAT WE "
s$=s$+"NEED TO COMPLETE THE ILLUSION OF AN AMIGA DEMO IS "
s$=s$+"AN OLD SOUNDTRACKER SONG...  ANYWAY, SHOCKWAVE "
s$=s$+"WOULD LIKE TO SEND THESE MESSAGES OUT TO SOME "
s$=s$+"PEOPLE WHO DESERVE THEM:  "
s$=s$+"PARABELLUM: WELL FRANCK, NOW YOU CAN GET REALLY "
s$=s$+"NOSTALGIC AND WEEPY. I HOPE THAT THIS TAKES YOU "
s$=s$+"BACK TO THE GOOD OLD DAYS :o)    XALTHORN: THIS "
s$=s$+"IS A NICE HECTIC ONE EH?  I LIKED YOUR GOBLET "
s$=s$+"DEMO BY THE WAY.. LOVELY OBJECT THAT.    DOCTOR: "
s$=s$+"YOU ASKED WHAT OTHER GOODIES I HAD IN STORE. HERE "
s$=s$+"YOU ARE.. ENOUGH HAPPENING FOR YA?    JINX: THE "
s$=s$+"SMILEY FACE TEXTURE CUBE WAS REALLY COOL. WELL DON"
s$=s$+"E MATE!    JIM SHAW: DUNNO IF YOU ARE AN AMIGA "
s$=s$+"FAN BUT SEEING AS YOU'RE ABOUT THE SAME AGE AS ME "
s$=s$+"I RECKON YOU MIGHT BE ;o) THANKS FOR ALL YOUR HARD"
s$=s$+" WORK ON THE BOARD AND ON THE EMULATOR.   JOMORROW"
s$=s$+": NICE DEMO YOU SUBMITTED TO THE COMP. WELL DONE! "
s$=s$+"HOPE YOU LIKE THIS EFFECT.    DEMONEYE: WHEN WE "
s$=s$+"GOING TO SWAP MEM CARDS MATE?    SNAKEDOGG: GOOD "
s$=s$+"LUCK WITH THE GEOGRAPHY COURSEWORK :o)    ZING: "
s$=s$+"YOU SHOULD COME TO YAB MORE OFTEN MATEY. I LIKE "
s$=s$+"THE NEW GAMEVINE BTW.    PTM: NICE TO SEE YOU AT "
s$=s$+"YABASIC FORUMS :o)     KYATA: THIS IS WHAT COMES "
s$=s$+"OF BEING NOSTALGIC... SEE, IT'S GOOD :o)    FRYER:"
s$=s$+" ANY MORE PROGRESS WITH THE F1 GAME?  THAT WILL BE"
s$=s$+" HELLA COOL. IT'S AN AMBITIOUS PROJECT BUT I JUST "
s$=s$+"KNOW YOU ARE THE MAN FOR THE JOB :o)    LOOPY: "
s$=s$+"WHY DON'T YOU LEARN TO CODE?    DREW: I'LL FINISH "
s$=s$+"THE GRAVITATION PROJECT CODE SOON. SORRY FOR THE "
s$=s$+"DELAY.    AZ: WTF ARE YOU THESE DAYS?    TAPPI: "
s$=s$+"NICE PLANE GAME YOU DID! WELL DONE.    TRICKY"
s$=s$+"KEYBOARD: THOUGH I'D SAY HELLO TO YOU. KEEP UP THE"
s$=s$+" QUESTIONS!     BONGOTRUMMOR: HELLO M8 :o) "
s$=s$+"  IF I HAVE MISSED YOU I AM REALLY SORRY, THERE'S "
s$=s$+"TOO MANY OF YOU TO GREET YOU ALL NOWADAYS.   ANYWA"
s$=s$+"Y, TIME I WASN'T HERE SO UNTIL NEXT TIME..   BYE. "


scx=0:p=0

return

Shockwave ^ Codigos
Challenge Trophies Won: