home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Sauce 'n' Code 3
/
sauce-n-code-03.adf
/
Source_Code
/
Chex_Tunnel.asc
< prev
next >
Wrap
Text File
|
1996-01-21
|
6KB
|
202 lines
MAIN:
' This routine - believe it or not - runs at full 50 fps on my A1200
' (No Fast RAM either) before I've even compiled it! You'll have to
' edit it a little to get what you want, I've used four layers of
' chex to make it look better.
' Freak/NFA
_MAKESCREENS
_ENVIRONMENT
' ------------------------------------- get original plane pointers
Screen 1
P0=Leek(Screen Base+24)
P1=Leek(Screen Base+28)
P2=Leek(Screen Base+32)
P3=Leek(Screen Base+36)
' ------------------------------------- find where work data starts
Screen 0
SRC=Phybase(0) : MEM=(Screen Width/8)*Screen Height
' ------------------------------------- 66 frame (!) anim
Reserve As Chip Work 10,(MEM*66)
' ------------------------------------- this bit generates the chex at
' increasing sizes to give the
' impression of motion and then
' copies them into that big bank
OFF=0
For SCALE=50 To 700 Step 10
Cls 0
XM=(Screen Width/2)+(SCALE/4)
YM=(Screen Height/2)-(SCALE/4)
For Y=-2 To 2
For X=-4 To 3
Ink 1
Bar XM+(X*SCALE)+1,YM+(Y*SCALE)+1 To XM+(X*SCALE)+(SCALE/2),YM+(Y*SCALE)+(SCALE/2)
Bar XM+(X*SCALE)+(SCALE/2)+1,YM+(Y*SCALE)+(SCALE/2)+1 To XM+(X*SCALE)+SCALE,YM+(Y*SCALE)+SCALE
Next X
Next Y
Copy SRC,SRC+MEM To Start(10)+(OFF*MEM) : Inc OFF
Next SCALE
' you might notice that the anim doesn't look as good as the ones
' you'll have seen in the demos, this is because I didn't use proper
' distance scaling, I just increased each successive square size by
' 10 pixels each time, cos you have to use mathtrans.library to do
' it properly, and besides which I don't KNOW how to DO that bloody
' perspective scaling thingy!
Screen Close 0
SP=1 : Dec OFF
' --------------------------- Space the bitplane offsets out at
' equal intervals through the 66 frames
PLANE0=(OFF/4)*3
PLANE1=(OFF/4)*2
PLANE2=(OFF/4)*1
PLANE3=(OFF/4)*0
' --------------------------- Palette fading, you might want to do a
' bit of fiddling here to try and get a
' nice see-through effect.
K=$FFF
X0=$112 : X1=$55A : X2=$448 : X3=$336 : X4=$224
Fade 2,X0,X1,X2,X1,X3,X1,X2,X1,X4,X1,X2,X1,X3,X1,X2,X1,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K
' ----------------------------- The main loop (Deceptively EASY!)
Screen 1
Do
Exit If Mouse Key<>0
' -------------------------- Which was the LAST bitplane to loop
' back to frame 0?
' (M stores it until another change)
If PLANE0=0 Then M=0
If PLANE1=0 Then M=1
If PLANE2=0 Then M=2
If PLANE3=0 Then M=3
' -------------------------- Bitplanes have to be ordered so that
' they appear in accordance with the
' palette, not too difficult, I just
' wich there was a neater way to do it!
If M=0
L3=PLANE0
L0=PLANE1
L1=PLANE2
L2=PLANE3
Else If M=1
L2=PLANE0
L3=PLANE1
L0=PLANE2
L1=PLANE3
Else If M=2
L1=PLANE0
L2=PLANE1
L3=PLANE2
L0=PLANE3
Else If M=3
L0=PLANE0
L1=PLANE1
L2=PLANE2
L3=PLANE3
End If
' ------------------------------------- Eeek! It's them funny LOKE
' commands again!
Loke Screen Base+24,Start(10)+(L0*MEM)
Loke Screen Base+28,Start(10)+(L1*MEM)
Loke Screen Base+32,Start(10)+(L2*MEM)
Loke Screen Base+36,Start(10)+(L3*MEM)
' ------------------------------------- Update the frame pointers
Add PLANE0,1,0 To OFF
Add PLANE1,1,0 To OFF
Add PLANE2,1,0 To OFF
Add PLANE3,1,0 To OFF
' ------------------------------------- Show changes to Screen Base
Wait SP : View
Loop
_CLEANUP
Procedure _MAKESCREENS
SH=200
' ------------------------------------- Screen 0 - work screen
Screen Open 0,320,SH,2,Lowres
Curs Off : Flash Off : Cls 0
Screen Hide 0
' ------------------------------------- screen 1 - anim screen
Screen Open 1,320,SH,32,Lowres
Curs Off : Flash Off : Cls 0 : K=$112
Palette K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K
Hide : Screen Display 1,,70,,
Gr Writing 0
' ------------------------------------ Some screen text using plane 3
' What's interesting is that if
' you open your screen in E.H.B
' you can use pen 32 as a "shadow"
' colour for your text and it will
' do the colours for you!
' (I have not tried this!)
Pen 16 : Paper 0
For Y=18 To 23
Read T$
Locate 0,Y
Centre T$
Next Y
Data "Freak says HI to ßudda!"
Data "-=-=-=-=-=-=-=-=-=-=-=-"
Data "Here's the routine you wanted dude,"
Data "now that I've done it I'll put in"
Data "some REMs so you can see what I was"
Data "getting up to, see the letter too!"
End Proc
Procedure _ENVIRONMENT
' ----------------------------------> No stopping while we're messing
' about with the bitplanes matey!
Amos Lock
Break Off
Request Off
End Proc
Procedure _CLEANUP
Shared P0,P1,P2,P3
' ----------------------------> Restore Screen 1's Screen Base with
' the values we got at the start, so
' that AMOS won't throw a wobbler when
' it tries to close the screen and finds
' that the planes are not looking where
' they're supposed to be!
Screen 1
Loke Screen Base+24,P0
Loke Screen Base+28,P1
Loke Screen Base+32,P2
Loke Screen Base+36,P3
' ----------------------------> Free up the AMOS bits again.
Erase 10
Amos Unlock
Break On
End : Rem ----------------------> Fin!
End Proc