home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Merciful 3
/
Merciful_Release_3.bin
/
software
/
h
/
henrys_house
/
henryshouse1.dms
/
henryshouse1.adf
/
SourceCode
/
Title.Asc
< prev
Wrap
Text File
|
1993-06-20
|
17KB
|
525 lines
' Henry's House
'
' TITLE SCREEN SOURCE CODE
'
' by : Gurmita & Sucha Singh
'
'-----------------------------------------------------------------------------
' NOTE:This source code can not be Run through the AMOS editor as some files
' need to be copied into memory which is done in the startup-sequence of the
' Game(see Intro source code).
'
' The following source code loads the scores from Ram which were copied in the
' startup-sequence(see Intro source code),displays the main title screen if
' you hav'nt got onto the scoreboard then flicks between the main title and
' scoreboard screen until you press fire to start the game. It also checks to
' see if you have pressed the Spacebar to display the two information screens.
'
' Memory Banks used:
' 7 - Track Mod - Title track
' 10 - Pac Pic - Scrolly background picture
' 11 - Pac Pic - Main title picture
' 12 - Pac Pic - Scoreboard picture
' 13 - Pac Pic - Enter Your Name Picture
' 14 - Pac Pic - Information
' 15 - Pac Pic - More Infomation
'
' Variables Used:
' NOM$() - Holds 6 names.
' SCORE$() - Holds 6 scores.
' COUNT - The pause when either the main title and scoreboard pic are shown.
' SRN - SRN=0 when the main title is showing or SRN=1 when the scoreboard
' is showing.This is so the program can wipe to the picture where
' you had pressed the Spacebar to see the info screens.
'-----------------------------------------------------------------------------
'
' Closes the AMOS editor to save memory.
Close Editor
'
' Sets the arrays to hold six names and six scores.
Dim NOM$(5),SCORE(5)
'
' Makes the variables global so the whole program can access them.
Global NOM$(),SCORE(),COUNT,SRN
'
' Sets the variables.
COUNT=1 : SRN=0
'
'----------------------------------------------------------------------------
' Calls the SETUP procedure.
_SETUP
'
' Calls the MAINLOOP procedure.
_MAINLOOP
'----------------------------------------------------------------------------
'
' Mainloop which wipes between the main title screen and the scoreboard and
' checks to see if the Firebutton or Spacebar has been pressed.
Procedure _MAINLOOP
'
Do
' Checks to see if the Spacebar has been pressed,if it has,it goes to
' the INFO procedure.
If Key State(64)=True Then _INFO
'
' Checks to see if the Firebutton has been pressed,if it has,it goes to
' the START procedure.
If Fire(1)=-1 Then _START
'
' Increases the count variable.
Inc COUNT
'
' If the count variable>250 it is reset,then goes to the HISCORE_DISPLAY
' procedure which shows the Scoreboard.
If COUNT>250 Then COUNT=0 : HISCORE_DISPLAY
'
' Wait for a vertical blank
Wait Vbl
Loop
'
End Proc
'
' Opens up 6 screens to hold the pictures to be used in the title,loads music
' and hiscores then checks to see if your score is high enough to be entered.
Procedure _SETUP
'
' Hides away the mouse pointer.
Hide On
'
' Tells AMOS to grab the first 6 numbers in the command line as a string.
S$=Left$(Command Line$,6)
'
' This converts the string in 'S$' to a number variable,SCORE.
SCORE=Val(S$)
'
' Opens up 6 screens and hides them.Screen 0 and 1 are used as the dual
' playfield screens with 0 as the background and 1 which displays the
' various title pictures.
Screen Open 0,320,400,8,Lowres : Curs Off : Flash Off : Cls 0 : Screen Hide 0
Screen Open 1,320,200,8,Lowres : Curs Off : Flash Off : Cls 0 : Screen Hide 1
Screen Open 2,320,200,8,Lowres : Curs Off : Flash Off : Cls 0 : Screen Hide 2
Screen Open 3,320,200,8,Lowres : Curs Off : Flash Off : Cls 0 : Screen Hide 3
Screen Open 4,320,200,8,Lowres : Curs Off : Flash Off : Cls 0 : Screen Hide 4
Screen Open 5,320,200,8,Lowres : Curs Off : Flash Off : Cls 0 : Screen Hide 5
'
' Loads fonts from Disk2.
Get Disc Fonts
'
' Uses all the fonts to make sure they have all loaded then clears the screen.
Screen 1
For F=0 To 6
Set Font F : T$="Amos 12345:"+Str$(F)
Text 0,0,T$
Next F
Cls 0
'
' Loads the powerpacked Title track into bank 7.
'Ppload "Henry's_HouseD2:Sound/TitleTrack",7
'
' Turns on the filter
Led Off
'
' Unpacks the various IFFs to their screens.
Unpack 11 To 2 : Screen Hide 2
Unpack 12 To 3 : Screen Hide 3
Unpack 14 To 4 : Screen Hide 4
Unpack 15 To 5 : Screen Hide 5
'
' Sets an array to hold the colour values of a picture.
Dim C(16)
'
' Unpacks the background screen to screen 0 then sets the display so the
' picture is hidden and changes all the colours to black.
Unpack 10 To 0 : Screen Display 0,128,50,0,0 : For C=0 To 15 : C(C)=Colour(C) : Colour C,0 : Next
'
' Sets screen display back to normal size.
Screen Display 0,128,50,320,200
'
' Sets the Amal animation for the scrolling background.The picture is 2
' screens high so when the top half of the iff has scrolled up its quickly
' sent back down to its starting position then repeats the process.
Channel 1 To Screen Offset 0
A$="L:Let Y=Y+1;P;If Y>199 then J R else J L;"
A$=A$+"R:Let Y=0;J L"
Amal 1,A$
'
' Calls the HISCORE_LOAD procedure which loads the hiscores from memory.
HISCORE_LOAD["RAM:Hiscores.SCR"]
'
' Plays the tracker mod in bank 7 and makes it continualy loop.
Track Play 7 : Track Loop On
'
' If your score is higher than the lowest score in the table then it calls
' the HISCORE_ENTER procedure if its lower then it displays then Main title.
If SCORE>SCORE(5)
HISCORE_ENTER[SCORE]
Else
' Unpacks the main title iff,hides the screen then turns its colours to black.
Unpack 11 To 1 : Screen Hide 1 : For C=0 To 15 : C(C)=Colour(C) : Colour C,0 : Next
Screen 1
'
' Sets the dual playfield with screen 0 as the background and screen 1
' as the one which displays all the information.
Dual Playfield 1,0 : Wait Vbl
'
' Turns on the scrolly background,shows both the screens and fades them
' into view.
Amal On
Screen Show 0
Screen Show 1
Fade 1,$0,$FFF,$9EC,$B7,$FC0,$D91,$B72,$421,$0,$5A,$16B,$17B,$27C,$28D,$39D,$4AE
Wait 15
End If
'
End Proc
'
' Displays the scoreboard in the mainloop
Procedure HISCORE_DISPLAY
'
' Sets the SRN variable to 1 then wipes away the main title screen and
' changes the palette to that of the Scoreboard screen.
SRN=1
Screen 1
Proc _SCR_WIPE1[1,0,0,0,0,0,320,200,10,2,0,0,1]
Palette $0,$FFF,$FD0,$E90,$D40,$C00,$550,$FC,$0,$5A,$16B,$17B,$27C,$28D,$39D,$4AE
'
' Prints the names and scores in the Scoreboard screen which is hidden away.
Screen 3
Ink 1,0,0 : Set Font 4
For I=0 To 5
YP=79+I*20
SCORE$=Mid$(Str$(SCORE(I)),2)
LS=Text Length(SCORE$)
Text 85,YP,NOM$(I)
Text 256-LS,YP,SCORE$
Next I
'
' Displays screen 3,which has the Scoreboard in it,to screen 1.
Screen 1
Proc _SCR_WIPE1[3,1,0,0,0,0,320,200,10,1,0,0,1]
'
' For next loop which acts as a timer for how long the program stays on the
' Scoreboard. Also checks for the Spacebar and Firebutton.
For COUNT=0 To 250
If Key State(64)=True Then _INFO
If Fire(1)=-1 : COUNT=250 : _START : End If
Wait Vbl
Next COUNT
'
' Variable is reset for the next pause.
COUNT=0
'
' Wipes away the Scoreboard in screen 1.
Proc _SCR_WIPE1[1,0,0,0,0,0,320,200,10,2,0,0,1]
'
' Sets the new palette for the Main Title picture which is then wiped from
' screen 2 to screen 1. Also sets the SRN variable to normal.
Palette $0,$FFF,$9EC,$B7,$FC0,$D91,$B72,$421,$0,$5A,$16B,$17B,$27C,$28D,$39D,$4AE
Proc _SCR_WIPE1[2,1,0,0,0,0,320,200,10,1,0,0,1]
SRN=0
'
' Exit procedure
Pop Proc
'
End Proc
'
' Asks you to enter your name then saves the new Scoreboard to Ram.
Procedure HISCORE_ENTER[SCORE]
'
If SCORE>SCORE(5)
'
' Find the position of our new score in the table
POS=0
While SCORE<=SCORE(POS)
POS=POS+1
Wend
'
' Move the lower scores one place down
For I=5 To POS+1 Step -1
NOM$(I)=NOM$(I-1)
SCORE(I)=SCORE(I-1)
Next I
NOM$(POS)=""
SCORE(POS)=SCORE
'
' Set an array to hold the colours of a screen then unpacks the
' hiscore enter iff to screen 1 then changes its colours to black.
Dim C(16)
Unpack 13 To 1 : For C=0 To 15 : C(C)=Colour(C) : Colour C,0 : Next
Screen 1
'
' Sets the dual playfield screens and turns on the scrolling background
' then fades the two screens into view.
Dual Playfield 1,0
Amal On
Fade 1,$0,$FFF,$FD0,$E90,$D40,$C00,$550,$FC,$0,$5A,$16B,$17B,$27C,$28D,$39D,$4AE
Wait 15
'
' Set up Cursor
Flash 7,"(FFF,30)(666,20)"
XC=80 : YC=100
'
' Display Cursor
Gosub CURSEUR
'
' Set the font to number 5 and the style to bold.
Set Font 5 : Set Text 2
'
' Input the name using a REPEAT..UNTIL loop
Repeat
' Read keyboard
K$=Inkey$
K=Asc(K$)
L=Len(NOM$)
' Handle Backspace
If K=8 and L>0
DC=0
XC=XC-15
Text XC,YC," "
Gosub CURSEUR
NOM$=Left$(NOM$,L-1)
End If
' Handle cursor
If K>13 and L<10
DC=8
Ink 1,0 : Text XC,YC,K$
XC=XC+15
Gosub CURSEUR
NOM$=NOM$+K$
End If
'
' Repeat until a carriage return.
Until K=13
'
' Put the new name into the NOM$ array
NOM$(POS)=NOM$
SCORE(POS)=SCORE
'
' Turns the cursor Flash off and calls the HISCORE_SAVE procedure which
' saves the latest names and scores to Ram.
Flash Off
HISCORE_SAVE["RAM:Hiscores.SCR"]
'
' Wipes away the 'Enter Your Name' iff and changes the palette to that
' of the Scoreboard picture.
Proc _SCR_WIPE1[1,0,0,0,0,0,320,200,10,2,0,0,0]
Palette $0,$FFF,$FD0,$E90,$D40,$C00,$550,$FC,$0,$5A,$16B,$17B,$27C,$28D,$39D,$4AE
'
End If
'
' Prints the new names and scores on the Scoreboard picture which is hidden.
Screen 3
Ink 1,0,0 : Set Font 4
For I=0 To 5
YP=79+I*20
SCORE$=Mid$(Str$(SCORE(I)),2)
LS=Text Length(SCORE$)
Text 85,YP,NOM$(I)
Text 256-LS,YP,SCORE$
Next I
'
' Displays the updated Scoreboard picture,pauses then wipes it away.
Screen 1
Proc _SCR_WIPE1[3,1,0,0,0,0,320,200,10,1,0,0,0]
Wait 100
Proc _SCR_WIPE1[1,0,0,0,0,0,320,200,10,2,0,0,0]
'
' Changes palette to the main title picture then displays it on screen 1.
Palette $0,$FFF,$9EC,$B7,$FC0,$D91,$B72,$421,$0,$5A,$16B,$17B,$27C,$28D,$39D,$4AE
Proc _SCR_WIPE1[2,1,0,0,0,0,320,200,10,1,0,0,0]
'
' Exit procedure.
Pop Proc
'
' Simulate a 'fake' text cursor using the DRAW command
CURSEUR:
Ink 7 : Draw XC,YC+1 To XC+6,YC+1
Return
'
End Proc
'
' Load a list of scores from "Hiscores.SCR" which is stored in Ram.
Procedure HISCORE_LOAD[N$]
'
' Handle errors
On Error Goto ERREUR
'
' Open a simple sequential file in Ram.
Open In 1,"RAM:Hiscores.SCR"
' Read the names and scores from the disc
For I=0 To 5
Line Input #1,NOM$(I),SCORE$
SCORE(I)=Val(SCORE$)
Next I
' Close up the file
Close 1
'
SKIP:
Pop Proc
'
ERREUR:
Resume SKIP
'
End Proc
'
' Save the new table in Ram.
Procedure HISCORE_SAVE[N$]
'
' Handle errors
On Error Goto HELP
'
' Create a simple sequential file in Ram
Open Out 1,"RAM:Hiscores.SCR"
' Write the names and scores to the new file
For I=0 To 5
Print #1,NOM$(I)
Print #1,Str$(SCORE(I))
Next I
' Close the file (ESSENTIAL!)
Close 1
'
SKIP:
Pop Proc
'
HELP:
Resume SKIP
'
End Proc
'
' Shows the two information screens.
Procedure _INFO
'
' Resets the count variable to 0 and wipes away screen 1 while changing the
' palette to that of the info pictures.
COUNT=0
Screen 1
Proc _SCR_WIPE1[1,0,0,0,0,0,320,200,10,2,0,0,1]
Palette $0,$FFF,$FD0,$E90,$D40,$C00,$550,$FC,$0,$5A,$16B,$17B,$27C,$28D,$39D,$4AE
'
' Displays the first info iff by wiping it from screen 4 to screen 1.
Proc _SCR_WIPE1[4,1,0,0,0,0,320,200,10,1,0,0,1]
'
' A small loop checks for the Spacebar to be pressed then wipes the screen.
Repeat
Until Key State(64)=True
Proc _SCR_WIPE1[1,0,0,0,0,0,320,200,10,2,0,0,1]
'
' Displays the secound info iff by wiping it from screen 5 to screen 1 then
' a small loop checks for the Spacebar to be pressed then wipes the screen.
Proc _SCR_WIPE1[5,1,0,0,0,0,320,200,10,1,0,0,1]
Repeat
Until Key State(64)=True
Proc _SCR_WIPE1[1,0,0,0,0,0,320,200,10,2,0,0,1]
'
' If SRN=0 then it changes the palette and displays the Main Title picture.
If SRN=0
Palette $0,$FFF,$9EC,$B7,$FC0,$D91,$B72,$421,$0,$5A,$16B,$17B,$27C,$28D,$39D,$4AE
Proc _SCR_WIPE1[2,1,0,0,0,0,320,200,10,1,0,0,1]
End If
'
' If SRN=1 it displays the Scoreboard picture.
If SRN=1
Proc _SCR_WIPE1[3,1,0,0,0,0,320,200,10,1,0,0,1]
End If
'
' Exit procedure.
Pop Proc
'
End Proc
'
' Procedure to wipe one screen to another.
Procedure _SCR_WIPE1[SW_SOURCE,SW_DEST,SW_XSOURCE,SW_YSOURCE,SW_XDEST,SW_YDEST,SW_WIDTH,SW_HEIGHT,SW_ST,SW_TYPE,SW_BACK,SW_PAUSE,SW_W]
'
' Wipes the screen in a gradual horizontal wipe
' Author of wipe routine: Mike Stevens
'
' Inputs:
'
' SW_SOURCE - Screen number of the source screen
' SW_DEST - Screen number of the destination screen
' SW_XSOURCE - Top left X coord of area to be wiped, on source screen
' SW_YSOURCE - Top left Y coord of area to be wiped, on source screen
' SW_XDEST - Top left X coord of area to be wiped, on destination screen
' SW_YDEST - Top left Y coord of area to be wiped, on destination screen
' SW_WIDTH - Width of the area to be wiped (pixels)
' SW_HEIGHT - Height of the area to be wiped (pixels)
' SW_ST - Number of pixels between each wipe section (step)
' SW_TYPE - Type of wipe. 1 = Draw images, anything else = Draw colour
' SW_BACK - Colour to wipe to if type <> 1 (colour)
' SW_PAUSE - 50ths of a second to pause when wiping. 0 = no pause
' SW_W - Use a waitvbl. True = wait vbl, False = no wait vbl
'
' ************************************************************************
'
' Decrease width and height to give correct wipe dimensions.
Dec SW_HEIGHT : Dec SW_WIDTH
'
' This loop increases the difference between two adjoining wipe lines
' by one each time to give a smooth gradual effect.
For SW_Z=0 To SW_ST
'
' This loop creates the actual wipe effect by creating a step from
' the top of the wipe area to the bottom of the wipe area, offset by
' the gradual loop previous
For SW_Y=SW_YSOURCE+SW_Z To SW_YSOURCE+SW_Z+SW_HEIGHT Step SW_ST
'
' Draw graphics on the destination screen.
If SW_TYPE=1
' Picture wipe
Screen Copy SW_SOURCE,SW_XSOURCE,SW_Y,SW_XSOURCE+SW_WIDTH+1,Min(SW_Y+1,SW_YSOURCE+SW_HEIGHT+1) To SW_DEST,SW_XDEST,SW_Y-SW_YSOURCE+SW_YDEST
Else
' Colour wipe
Cls SW_BACK,SW_XDEST,SW_Y-SW_YSOURCE+SW_YDEST To SW_XDEST+SW_WIDTH+1,Min(SW_Y-SW_YSOURCE+SW_YDEST+1,SW_YDEST+SW_HEIGHT+1)
End If
'
' Create a pause and/or a wait vbl to allow user control of the
' speed of wipe.
If SW_PAUSE>0 : Wait SW_PAUSE : End If
If SW_W=True : Wait Vbl : End If
'
' End the verticle loop
Next SW_Y
'
' End the gradual loop
Next SW_Z
'
End Proc
'
' Sets main variables to be placed in the Command line$ then loads the
' Select Level program.
Procedure _START
'
' Set the 4 main variables used in the levels.
LIVES=3 : SC=0 : EXSC=0 : LEVEL=0
'
' Create 4 Main strings to hold the above 4 variables.
A$=" " : B$=" " : C$=" " : D$=" "
'
' Convert the 4 variables into strings.
L$=Str$(LIVES) : S$=Str$(SC) : E$=Str$(EXSC) : LEV$=Str$(LEVEL)
'
' Then place those strings into the above Main strings.
Right$(A$,3)=L$ : Left$(B$,6)=S$ : Right$(C$,5)=E$ : Right$(D$,2)=LEV$
'
' Lastly it places the final 4 strings into the Command Line$ to be passed
' through to the next program.
Command Line$=A$+B$+C$+D$
'
' Fades screen 1,stops the music,turns off the filter,turns off the
' animation then clears the Key buffer.
Screen 1 : Fade 1 : Wait 15
Track Stop : Led On
Amal Off : Clear Key
'
' Closes all the screens opened and erases all the banks to clear memory.
For S=0 To 5
Screen Close S
Next S
For B=0 To 15
Erase B
Next B
' Load the next program.
Run "HenryGame/SelectLevel"
'
End Proc