'                                Henry's House 
'
'                          INTRO SEQUENCE SOURCE CODE  
'
'                          by : Gurmita & Sucha Singh
'
'----------------------------------------------------------------------------- 
' Firstly the Source code can not be played through an Amos editor or you  
' will get an error as the program needs some files copied into ram first. 
' This happens in the Startup-Sequence(see below). 
'
' The Game is divided into sections each one doing a particular task eg,   
' showing the title screen or running a level.This makes a game a bit easier 
' to program as you can make it in sections then finally join them together. 
'
' The starup-sequence below explains how the various files get copied into Ram.  
'
' Makedir RAM:T          } 
' Makedir RAM:ENV        } Makes the directorys for a Ram disk.
' Makedir RAM:CLIPBOARDS } 
'
' Makedir RAM:Fonts      } Makes the directorys in Ram so the
' Makedir RAM:c          } files can be copied into them.
'
' Copy >Nil :sys:c RAM:c           } Copys the 'C' commands into Ram.
' Copy >Nil :sys:Fonts RAM:Fonts   } Copys the Fonts into Ram. 
' Copy >Nil :sys:Hiscores.SCR RAM: } Copys the hiscores into Ram so the
'                                    Game can save them into memeory rather
'                                    than to disk when you enter your name.
'
' Assign Fonts: RAM:Fonts } Changes 'Font' Directory to the one in Ram so
'                           when the Game needs to use Disk2, it can 
'                           re-Assign fonts from memory to Disk2 without 
'                           having to do too many diskswaps. 
' Assign c: RAM:c         } Changes 'c' directory to the one in Ram. 
' Path RAM: add           } Tells the Amiga to search through the Ram:c
'                           directory when ever it wants to use the commands.
'
' Assign T: RAM:T              } 
' Assign ENV: RAM:ENV          } Assigns relevant directorys to ones in Ram. 
' Assign CLIPS: RAM:CLIPBOARDS } 
'
' Run >Nil :Henry's_House } Loads the Intro-sequence.
' Endcli                  } Closes the Cli window. 
'
' note: >Nil } This allows the command not to be printed in the cli window.
'
'----------------------------------------------------------------------------- 
'
' The following source code will display the 'State Of The Art' logo animation 
' and then the Henry's House logo animation. It will then ask you to 'Insert 
' Disc2 in any drive', then load the game. But if you have a 2nd drive and 
' have already inserted Disc2 the game will load automatically.
'
' The animations in this Game are all stored in chip memory which allows them
' to be saved and compiled with the Amos programs like Sprites or Packed 
' Pictures.The animations can only be played by Amos Professinal.To do this
' yourself first : 
'
' Step 1 - Load an animation into a bank.
'
' Step 2 - Save that bank using 'Bsave'. 
'
' Step 3 - Reserve some Chip Data in a bank.The amount you reserve has 
'          to be the same as the Bank length of your animation.
'
' Step 4 - Load the Bank you saved earlier into the new reserved one.
'          Now when you save an Amos program the animation gets saved
'          with it and can be played at any time.
'
' Memory Banks Used: 
' 10 - Chip Data - State Of The Art logo animation 
' 11 - Chip Data - Henry's House logo animation  
' 12 - Pac Pic - State logo shaded in  
' 13 - Pac Pic - Insert Disc2 picture  
'
' Variable Used: 
' N  - Total number of frames for an animation.
'
'----------------------------------------------------------------------------- 
'
' Closes the Amos editor to save memory. 
Close Editor 
'
'----------------------------------------------------------------------------- 
' Call the INTRODUCTION procedure. 
_INTRODUCTION
'
'----------------------------------------------------------------------------- 
'
' Plays the two animations from memory then calls the _CHANGE_DISK Procedure.
Procedure _INTRODUCTION
   '
   ' Opens up a new screen to play the animations in. 
   Screen Open 0,320,200,8,Lowres : Screen Hide 0
   Curs Off : Flash Off : Cls 0 : Hide On 
   Screen 0
   ' Sets directory to Disk1. 
   Dir$="Henry's_House:"
   '
   '----------------------------  Scene 1 ------------------------------------
   ' Sets the total number of frames in the first animation.
   N=57
   '
   ' Displays the Screen,sets where the animation is coming from ,Bank 10,
   ' its channel number(1) and screen number(0).
   Screen Show 0
   P=Frame Play(10,1,0)
   '
   ' Double Buffers the screen so the animation dos'nt flicker. 
   Double Buffer 
   '
   ' For next' loop is used to flick through each frame one at a time with 'N'
   ' holding the total number of Frames and 'X' holding the individual frame
   ' number which increases until it matches 'N' and finishes the loop. 
   For X=2 To N-2 : Rem N-2 this makes the animation stop at the last frame. 
      P=Frame Play(P,1)
      Screen Swap 
      Wait Vbl : Wait Vbl 
   Next X
   '
   ' Pauses on the logo then fades the screen to white. 
   Wait 30
   Fade 1,$FFF,$FFF,$FFF,$FFF,$FFF,$FFF,$FFF,$FFF,$FFF,$FFF,$FFF,$FFF,$FFF,$FFF,$FFF,$FFF : Wait 15
   '
   ' Unpacks the shaded logo from bank 12 then fades all the colours to white.
   Unpack 12 To 1 : Screen Hide 1 : Screen 1 : Fade 1,$FFF,$FFF,$FFF,$FFF,$FFF,$FFF,$FFF,$FFF,$FFF,$FFF,$FFF,$FFF,$FFF,$FFF,$FFF,$FFF,$FFF,$FFF,$FFF,$FFF,$FFF,$FFF,$FFF,$FFF,$FFF,$FFF,$FFF,$FFF,$FFF,$FFF,$FFF,$FFF : Wait 15
   Screen 1
   '
   ' It then shows screen 1 which is now white and fades back the colours to
   ' that of the shaded logo. Lastly it fades the final logo to black.
   Screen Show 1
   Fade 4,$0,$FFF,$BDE,$8BD,$6AB,$59A,$379,$268,$156,$46,$E52,$E82,$FA3,$FC4,$FE5,$0,$EE4,$BE2,$AD1,$4C0,$CEF,$ADF,$7CF,$4BF,$FCB,$FA9,$F98,$F76,$EEE,$BBB,$999,$666
   Wait 70
   Fade 4 : Wait 60
   '
   '----------------------------  Scene 2 ------------------------------------
   ' Sets the new total number of frames in the next animation. 
   N=45
   '
   ' Displays the Screen,sets where the animation is coming from ,Bank 11,
   ' its channel number(2) and screen number(0).
   Screen 0
   W=Frame Play(11,2,0)
   '
   ' Double Buffers the screen so the animation dos'nt flicker. 
   Double Buffer 
   '
   ' Uses the same method of animation as the first one.
   For X=2 To N-3 : Rem N-3 this makes the animation stop at the last frame. 
      W=Frame Play(W,1)
      Screen Swap 
      Wait Vbl : Wait Vbl 
   Next X
   '
   ' Pauses on the logo then fades the screen to black. 
   Wait 100
   Fade 2 : Wait 30
   '
   ' Calls the CHANGE_DISK procedure. 
   _CHANGE_DISC
   '
End Proc
'
' Asks for Disk2 then fades the screen,clears the memory and loads the game. 
Procedure _CHANGE_DISC
   '
   ' Unpacks bank 13 to screen 1 then hides screen 1 while fadeing picture to 
   ' black. 
   Unpack 13 To 1 : Screen 1 : Screen Hide 1 : Fade 1 : Wait 15
   '
   ' Checks for an error and goes to HELP: if one is detected.
   On Error Goto HELP
   '
   ' Creates an error. This stops the system message popping up.
   Error 86
   '
   ' Sets directory to Disk2,fades the screen then closes it. 
   Dir$="Henry's_HouseD2:"
   Screen 1 : Fade 1 : Wait 15
   Screen Close 1
   '
   ' Erases all banks to clear the memory for next program. 
   For B=1 To 15 : Erase B : Next B
   '
   ' Changes the font directory from Ram to Disk2 and also the libs from
   ' Disk1 to Disk2. Then runs the Title program on Disk2.
   Assign "fonts:" To "Henry's_HouseD2:fonts"
   Assign "libs:" To "Henry's_HouseD2:libs"
   Run "HenryGame/Title"
   '
   HELP:
   '
   ' Small Loop to check if Disk 2 has been inserted.The vaiable 'D' is used
   ' to store a true(-1) or false(0) value. 
   Do 
      ' If Disk2 has been inserted then the dirctory is set to Disk2, D=1 and
      ' exits out of loop. 
      If Exist("Henry's_HouseD2:")=-1 Then Dir$="Henry's_HouseD2:" : D=1 : Exit 
      '
      ' If Disk2 has not been inserted it fades screen 1 into view which asks
      ' you to 'insert Disc2', D=0 and exits out of loop.
      If Exist("Henry's_HouseD2:")=0
         Screen Show 1
         Fade 1,$0,$8BD,$BDE,$FFF,$6AB,$59A,$379,$268,$156,$46,$E52,$E82,$FA3,$FC4,$FE5,$0
         Wait 15
         D=0 : Exit 
      End If 
   Loop 
   '
   ' If D=1 then the program jumps to the line after Error86 and continues,if 
   ' D<>1 ie=0 then the program jumps to Error86 then back to the loop. 
   If D=1 Then Resume Next Else Resume 
   '
End Proc
