home *** CD-ROM | disk | FTP | other *** search
- ' ****************************************
- ' * SIMON by Greg Bennett *
- ' * A.K.A. The Original 'Friendly User' *
- ' * written in GFA 3.0 *
- ' * (C)1991 Friendly User Software *
- ' * version 1.1 *
- ' * 9/10/91 *
- ' ****************************************
- '
- GOSUB initialize
- '
- GOTO make_menu
- '
- PROCEDURE simon_start
- DEFMOUSE 4
- last%=0
- begin:
- IF last%>0
- PAUSE 35
- ENDIF
- INC last%
- GOSUB get_random
- sim%(last%)=num%
- FOR x%=1 TO last%
- ON sim%(x%) GOSUB show_color_one,show_color_two,show_color_three,show_color_four
- SHOWM
- IF (last% MOD 5)=0
- DEC pause_time%
- ENDIF
- PAUSE pause_time%
- NEXT x%
- x%=0
- DO
- IF x%<last%
- INC x%
- ENDIF
- SHOWM
- GOSUB get_reply
- IF sim%(x%)<>reply%
- GOTO error
- ENDIF
- EXIT IF x%=last%
- LOOP
- GOTO begin
- '
- error:
- VSYNC
- PUT 54,24,all1$
- SOUND 1,15,5,1
- SOUND 2,15,6,1
- SOUND 3,15,8,1,buzz_period#*2
- VSYNC
- PUT 54,24,all$
- SOUND 1,0,5,1
- SOUND 2,0,6,1
- SOUND 3,0,8,1
- IF longest%<last%
- GOSUB make_longest
- ENDIF
- GOSUB check_scores
- RETURN
- '
- PROCEDURE get_reply
- reply%=0
- t%=TIMER
- REPEAT
- MOUSE x#,y#,k#
- IF k#=1
- IF POINT(x#,y#)=3
- IF MOUSEK=1
- GOSUB show_color_one
- ENDIF
- ENDIF
- IF POINT(x#,y#)=6
- IF MOUSEK=1
- GOSUB show_color_two
- ENDIF
- ENDIF
- IF y#<97 AND x#<266 AND POINT(x#,y#)=2
- IF MOUSEK=1
- GOSUB show_color_three
- ENDIF
- ENDIF
- IF y#>97 AND POINT(x#,y#)=4
- IF MOUSEK=1
- GOSUB show_color_four
- ENDIF
- ENDIF
- SHOWM
- ENDIF
- IF (TIMER-t%)>600
- reply%=5
- ENDIF
- UNTIL reply%<>0
- RETURN
- '
- PROCEDURE get_random
- num%=(INT(RND*1000) MOD 4)+1
- RETURN
- '
- PROCEDURE show_color_one
- VSYNC
- PUT 54,24,a1$
- SOUND 1,15,10,4,period#
- VSYNC
- PUT 54,24,a$
- SOUND 1,0,10,4
- reply%=1
- RETURN
- '
- PROCEDURE show_color_two
- VSYNC
- PUT 54,100,c1$
- SOUND 1,15,12,4,period#
- VSYNC
- PUT 54,100,c$
- SOUND 1,0,12,4,period#
- reply%=2
- RETURN
- '
- PROCEDURE show_color_three
- VSYNC
- PUT 159,24,b1$
- SOUND 1,15,1,4,period#
- VSYNC
- PUT 159,24,b$
- SOUND 1,0,1,4,period#
- reply%=3
- RETURN
- '
- PROCEDURE show_color_four
- VSYNC
- PUT 160,100,d1$
- SOUND 1,15,3,4,period#
- VSYNC
- PUT 160,100,d$
- SOUND 1,0,3,4,period#
- reply%=4
- RETURN
- '
- PROCEDURE play_last
- FOR x%=1 TO last%
- ON sim%(x%) GOSUB show_color_one,show_color_two,show_color_three,show_color_four
- PAUSE ptime%
- NEXT x%
- RETURN
- '
- PROCEDURE make_longest
- IF last%>1
- FOR x%=1 TO last%-1
- simlongest%(x%)=sim%(x%)
- longest%=last%
- NEXT x%
- ENDIF
- RETURN
- '
- PROCEDURE play_longest
- FOR x%=1 TO longest%
- ON simlongest%(x%) GOSUB show_color_one,show_color_two,show_color_three,show_color_four
- PAUSE ptime%
- NEXT x%
- RETURN
- '
- PROCEDURE check_rez
- rez#=XBIOS(4)
- IF rez#<>0
- alrt$="SIMON only works in|Low Resolution."
- ALERT 3,alrt$,1,"Crap!",b#
- SYSTEM
- ENDIF
- RETURN
- PROCEDURE load_colour
- OPEN "I",#1,filename$
- temp$=INPUT$(38,#1)
- colour$=MID$(temp$,5,32)
- CLOSE #1
- palnum#=0
- count#=0
- REPEAT
- hibyte#=ASC(MID$(colour$,count#,1))
- INC count#
- lobyte#=ASC(MID$(colour$,count#,1))
- INC count#
- pal2#(palnum#)=(hibyte#*256)+lobyte#
- INC palnum#
- UNTIL palnum#=15
- RETURN
- '
- PROCEDURE install_colour
- VOID XBIOS(6,L:VARPTR(colour$))
- RETURN
- '
- PROCEDURE show_pic
- physbase%=XBIOS(2)
- BLOAD filename$,physbase%-128
- RETURN
- '
- PROCEDURE save_palette
- FOR ctr%=0 TO 15
- palette#(ctr%)=XBIOS(7,W:ctr%,W:-1)
- NEXT ctr%
- RETURN
- '
- PROCEDURE restore_palette
- FOR ctr%=0 TO 15
- SETCOLOR ctr%,palette#(ctr%)
- NEXT ctr%
- RETURN
- '
- '
- make_menu:
- DEFMOUSE 0
- FOR ctr%=0 TO 50
- READ menu_strip$(ctr%)
- EXIT IF menu_strip$(ctr%)="***"
- NEXT ctr%
- menu_strip$(ctr%)=""
- menu_strip$(ctr%+1)=""
- DATA Desk," About SIMON "
- DATA --------------------,3,4,5,6,""
- DATA Options, Start Game, ------------, Play Last," Play Longest "
- DATA ------------, High Scores, ------------, Quit,""
- DATA ***
- MENU menu_strip$()
- FOR ctr%=2 TO 6
- MENU ctr%,2
- NEXT ctr%
- MENU 10,2
- MENU 13,2
- MENU 15,2
- ON MENU GOSUB menu_routine
- DO
- ON MENU
- LOOP
- '
- PROCEDURE menu_routine
- DEFMOUSE 0
- string$=menu_strip$(MENU(0))
- IF string$=" Quit"
- GOSUB save_high_scores
- CLOSE
- restore_palette
- SYSTEM
- END
- ENDIF
- IF string$=" About SIMON "
- GOSUB about_simon
- ENDIF
- IF string$=" Play Longest "
- HIDEM
- GOSUB play_longest
- ENDIF
- IF string$=" Play Last"
- HIDEM
- GOSUB play_last
- ENDIF
- IF string$=" High Scores"
- HIDEM
- GOSUB show_high_scores
- ENDIF
- IF string$=" Start Game"
- MENU OFF
- GOSUB simon_start
- ENDIF
- MENU OFF
- SHOWM
- DEFMOUSE 0
- RETURN
- '
- PROCEDURE about_simon
- alrt$=" Atari SIMON |By Greg Bennett in GFA 3.0 | Friendly User Software | (C)1991 Version 1.1 "
- ALERT 0,alrt$,1," OK ",b#
- RETURN
- '
- PROCEDURE initialize
- period#=7
- ptime#=5
- pause_time%=15
- counter#=1000
- last%=0
- longest%=0
- buzz_period#=25
- DIM sim%(1000),simlongest%(1000)
- DIM palette#(15),pal2#(15)
- DIM menu_strip$(25)
- DIM high_name$(10)
- DIM high_score%(10)
- DEFMOUSE 2
- GOSUB save_palette
- main:
- OPEN "I",#2,"SIMON.SCR"
- FOR score_counter%=1 TO 10
- INPUT #2,high_name$(score_counter%),high_score%(score_counter%)
- NEXT score_counter%
- CLOSE #2
- number_ten%=high_score%(10)
- GOSUB check_rez
- filename$="SIMON33.NEO"
- GOSUB load_colour
- GOSUB install_colour
- GOSUB show_pic
- GET 54,24,160,100,a1$
- GET 159,24,266,97,b1$
- GET 54,100,160,176,c1$
- GET 160,100,266,176,d1$
- '
- GET 54,24,266,176,all1$
- '
- DEFFILL 2,1
- FILL 212,66
- DEFFILL 6,1
- FILL 108,134
- DEFFILL 4,1
- FILL 212,135
- DEFFILL 3,1
- FILL 109,62
- '
- GET 54,24,160,100,a$
- GET 159,24,266,97,b$
- GET 54,100,160,176,c$
- GET 160,100,266,176,d$
- '
- GET 54,24,266,176,all$
- RETURN
- '
- PROCEDURE show_high_scores
- HIDEM
- DEFFILL 0,1
- GET 50,40,270,189,screen$
- PRBOX 50,40,270,189
- RBOX 51,41,269,188
- DEFTEXT 2,4,0,32
- TEXT 55,70," High Scores"
- DEFTEXT 1,0,0,6
- person_counter%=0
- FOR q%=85 TO 175 STEP 10
- INC person_counter%
- temp%=LEN(high_name$(person_counter%))+LEN(STR$(high_score%(person_counter%)))
- out$=high_name$(person_counter%)+STRING$(26-temp%,".")+STR$(high_score%(person_counter%))
- TEXT 57,q%,out$
- NEXT q%
- DEFTEXT 2,0,0,4
- TEXT 59,183," - Click any button -"
- DO
- EXIT IF MOUSEK=1 OR MOUSEK=2
- LOOP
- VSYNC
- PUT 50,40,screen$
- SHOWM
- RETURN
- '
- PROCEDURE check_scores
- IF (last%-1)>=number_ten%
- GOSUB get_name
- number_ten%=high_score%(10)
- ENDIF
- RETURN
- '
- PROCEDURE get_name
- HIDEM
- GET 60,70,260,139,screen$
- DEFFILL 0,1
- PBOX 60,70,260,139
- BOX 61,71,259,138
- DEFTEXT 2,17,0,13
- TEXT 65,89," CONGRATULATIONS"
- PRINT AT(9,13);" You have ranked in the "
- PRINT AT(9,14);" TOP TEN with a score "
- PRINT AT(9,15);" of ";(last%-1);"."
- PRINT AT(9,16);" Name >_______________"
- PRINT AT(16,16);
- FORM INPUT 15,name$
- GOSUB shift_scores
- VSYNC
- PUT 60,70,screen$
- SHOWM
- GOSUB show_high_scores
- RETURN
- '
- PROCEDURE shift_scores
- top%=1
- temp%=last%-1
- WHILE high_score%(top%)>temp%
- INC top%
- WEND
- FOR shift%=10 TO (top%+1) STEP -1
- high_score%(shift%)=high_score%(shift%-1)
- high_name$(shift%)=high_name$(shift%-1)
- NEXT shift%
- high_score%(top%)=temp%
- high_name$(top%)=name$
- RETURN
- '
- PROCEDURE save_high_scores
- OPEN "O",#2,"SIMON.SCR"
- FOR score_counter%=1 TO 10
- WRITE #2,high_name$(score_counter%),high_score%(score_counter%)
- NEXT score_counter%
- CLOSE #2
- RETURN
-