home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Source Code 1994 March
/
Source_Code_CD-ROM_Walnut_Creek_March_1994.iso
/
compsrcs
/
games
/
vmsnet
/
tetris
/
part01
< prev
next >
Wrap
Internet Message Format
|
1992-07-01
|
30KB
Path: uunet!caen!kuhub.cc.ukans.edu!nrlvx1.nrl.navy.mil!koffley
Newsgroups: vmsnet.sources.games
Subject: TETRIS_VMS.01_OF_05
Message-ID: <1992Jul2.123807.742@nrlvx1.nrl.navy.mil>
From: koffley@nrlvx1.nrl.navy.mil
Date: 2 Jul 92 12:38:07 -0400
Organization: NRL SPACE SYSTEMS DIVISION
Lines: 919
$! ------------------ CUT HERE -----------------------
$ v='f$verify(f$trnlnm("SHARE_VERIFY"))'
$!
$! This archive created by VMS_SHARE Version 7.2-007 22-FEB-1990
$! On 2-JUL-1992 12:35:38.39 By user KOFFLEY
$!
$! This VMS_SHARE Written by:
$! Andy Harper, Kings College London UK
$!
$! Acknowledgements to:
$! James Gray - Original VMS_SHARE
$! Michael Bednarek - Original Concept and implementation
$!
$!+ THIS PACKAGE DISTRIBUTED IN 5 PARTS, TO KEEP EACH PART
$! BELOW 60 BLOCKS
$!
$! TO UNPACK THIS SHARE FILE, CONCATENATE ALL PARTS IN ORDER
$! AND EXECUTE AS A COMMAND PROCEDURE ( @name )
$!
$! THE FOLLOWING FILE(S) WILL BE CREATED AFTER UNPACKING:
$! 1. COMPILE.COM;2
$! 2. TETRIS_BUILD.COM;1
$! 3. SHAPES.PAS;2
$! 4. INCLUDES.C;1
$! 5. RAND.FOR;1
$! 6. README.TXT;1
$! 7. HTABLE.DAT;1
$!
$set="set"
$set symbol/scope=(nolocal,noglobal)
$f=f$parse("SHARE_TEMP","SYS$SCRATCH:.TMP_"+f$getjpi("","PID"))
$e="write sys$error ""%UNPACK"", "
$w="write sys$output ""%UNPACK"", "
$ if f$trnlnm("SHARE_LOG") then $ w = "!"
$ ve=f$getsyi("version")
$ if ve-f$extract(0,1,ve) .ges. "4.4" then $ goto START
$ e "-E-OLDVER, Must run at least VMS 4.4"
$ v=f$verify(v)
$ exit 44
$UNPACK: SUBROUTINE ! P1=filename, P2=checksum
$ if f$search(P1) .eqs. "" then $ goto file_absent
$ e "-W-EXISTS, File ''P1' exists. Skipped."
$ delete 'f'*
$ exit
$file_absent:
$ if f$parse(P1) .nes. "" then $ goto dirok
$ dn=f$parse(P1,,,"DIRECTORY")
$ w "-I-CREDIR, Creating directory ''dn'."
$ create/dir 'dn'
$ if $status then $ goto dirok
$ e "-E-CREDIRFAIL, Unable to create ''dn'. File skipped."
$ delete 'f'*
$ exit
$dirok:
$ w "-I-PROCESS, Processing file ''P1'."
$ if .not. f$verify() then $ define/user sys$output nl:
$ EDIT/TPU/NOSEC/NODIS/COM=SYS$INPUT 'f'/OUT='P1'
PROCEDURE Unpacker ON_ERROR ENDON_ERROR;SET(FACILITY_NAME,"UNPACK");SET(
SUCCESS,OFF);SET(INFORMATIONAL,OFF);f:=GET_INFO(COMMAND_LINE,"file_name");b:=
CREATE_BUFFER(f,f);p:=SPAN(" ")@r&LINE_END;POSITION(BEGINNING_OF(b));
LOOP EXITIF SEARCH(p,FORWARD)=0;POSITION(r);ERASE(r);ENDLOOP;POSITION(
BEGINNING_OF(b));g:=0;LOOP EXITIF MARK(NONE)=END_OF(b);x:=ERASE_CHARACTER(1);
IF g=0 THEN IF x="X" THEN MOVE_VERTICAL(1);ENDIF;IF x="V" THEN APPEND_LINE;
MOVE_HORIZONTAL(-CURRENT_OFFSET);MOVE_VERTICAL(1);ENDIF;IF x="+" THEN g:=1;
ERASE_LINE;ENDIF;ELSE IF x="-" THEN IF INDEX(CURRENT_LINE,"+-+-+-+-+-+-+-+")=
1 THEN g:=0;ENDIF;ENDIF;ERASE_LINE;ENDIF;ENDLOOP;t:="0123456789ABCDEF";
POSITION(BEGINNING_OF(b));LOOP r:=SEARCH("`",FORWARD);EXITIF r=0;POSITION(r);
ERASE(r);x1:=INDEX(t,ERASE_CHARACTER(1))-1;x2:=INDEX(t,ERASE_CHARACTER(1))-1;
COPY_TEXT(ASCII(16*x1+x2));ENDLOOP;WRITE_FILE(b,GET_INFO(COMMAND_LINE,
"output_file"));ENDPROCEDURE;Unpacker;QUIT;
$ delete/nolog 'f'*
$ CHECKSUM 'P1'
$ IF CHECKSUM$CHECKSUM .eqs. P2 THEN $ EXIT
$ e "-E-CHKSMFAIL, Checksum of ''P1' failed."
$ ENDSUBROUTINE
$START:
$ create 'f'
X!This command procedure will compile and link the source files for the
X!game Shapes, written and copyrighted by Colin Cowie, Glasgow, Scotland,
X!with certain procedures written and copyrighted by Stephen Macdonald,
X!Glasgow, Scotland.
X!
X!It also defines the symbol "shapes" to run the program.
X!Edit the symbol definition of shapes to point to the location of shapes.exe
X
X$write sys$output "Compiling Shapes.."
X$pascal shapes
X$write sys$output "Compiling Includes.."
X$cc includes
X$write sys$output "Compiling Rand.."
X$fortran rand
X$write sys$output "Linking Shapes,Includes,Rand"
X$link shapes,includes,rand
X$write sys$output "Finished!!"
X
X!The following Line should be entered in your login.com, suitably modified
X$shapes:=="$my$root:`5Brcd.tetris`5Dshapes"
$ CALL UNPACK COMPILE.COM;2 1662649190
$ create 'f'
X$!...................... Cut on the dotted line and save ...................
V...
X$! VAX/VMS archive file created by VMS_SHAR V-5.04 04-Feb-1988
X$! which was written by Michael Bednarek (U3369429@ucsvc.dn.mu.oz.au)
X$! To unpack, simply save and execute (@) this file.
X$!
X$! This archive was created by CADP02
X$! on Friday 7-SEP-1990 16:33:46.07
X$!
X$! ATTENTION: To keep each article below 15872 bytes, this program
X$! has been transmitted in 2 parts.
X$! You should concatenate ALL parts to ONE file and execute (@) that file.
X$!
X$! It contains the following 5 files:
X$! COMPILE.COM INCLUDES.C RAND.FOR README.TXT SHAPES.PAS
X$!==========================================================================
V===
X$Set Symbol/Scope=(NoLocal,NoGlobal)
X$Version=F$GetSYI("VERSION")
X$If Version.ges."V4.4" then goto Version_OK
X$Write SYS$Output "Sorry, you are running VMS ",Version, -
X", but this procedure requires V4.4 or higher."
X$Exit 44
X$Version_OK:CR`5B0,8`5D=13
X$Pass_or_Failed="failed!,passed."
X$Goto Start
X$Convert_File:
X$Read/Time_Out=0/Error=No_Error1/Prompt="creating ''File_is'" SYS$Command dd
Vd
X$No_Error1:Define/User_Mode SYS$Output NL:
X$Edit/TPU/NoSection/NoDisplay/Command=SYS$Input/Output='File_is' -
XVMS_SHAR_DUMMY.DUMMY
Xf:=Get_Info(Command_Line,"File_Name");b:=Create_Buffer("",f);
Xo:=Get_Info(Command_Line,"Output_File");Set(Output_File,b,o);
XPosition(Beginning_of(b));Loop x:=Erase_Character(1);Loop ExitIf x<>"V";
XMove_Vertical(1);x:=Erase_Character(1);Append_Line;
XMove_Horizontal(-Current_Offset);EndLoop;Move_Vertical(1);
XExitIf Mark(None)=End_of(b) EndLoop;Position(Beginning_of(b));Loop
Xx:=Search("`60",Forward,Exact);ExitIf x=0;Position(x);Erase_Character(1);
XIf Current_Character='`60' then Move_Horizontal(1);else
XCopy_Text(ASCII(INT(Erase_Character(3))));EndIf;EndLoop;Exit;
X$Delete VMS_SHAR_DUMMY.DUMMY;*
X$Checksum 'File_is
X$Success=F$Element(Check_Sum_is.eq.CHECKSUM$CHECKSUM,",",Pass_or_Failed)+CR
X$Read/Time_Out=0/Error=No_Error2/Prompt=" CHECKSUM ''Success'" SYS$Command d
Vdd
X$No_Error2:Return
X$Start:
X$File_is="COMPILE.COM"
X$Check_Sum_is=523446877
X$Copy SYS$Input VMS_SHAR_DUMMY.DUMMY
XX!This command procedure will compile and link the source files for the
XX!game Shapes, written and copyrighted by Colin Cowie, Glasgow, Scotland,
XX!with certain procedures written and copyrighted by Stephen Macdonald,
XX!Glasgow, Scotland.
XX!
XX!It also defines the symbol "shapes" to run the program.
XX!Edit the symbol definition of shapes to point to the location of shapes.ex
Ve
XX
XX$write sys$output "Compiling Shapes.."
XX$pascal shapes
XX$write sys$output "Compiling Includes.."
XX$cc includes
XX$write sys$output "Compiling Rand.."
XX$fortran rand
XX$write sys$output "Linking Shapes,Includes,Rand"
XX$link shapes,includes,rand
XX$write sys$output "Finished!!"
XX
XX!The following Line should be entered in your login.com, suitably modified
XX$shapes:=="$disk18:`5Bcadp02.pascal.shapes`5Dshapes"
X$GoSub Convert_File
X$File_is="INCLUDES.C"
X$Check_Sum_is=1613696431
X$Copy SYS$Input VMS_SHAR_DUMMY.DUMMY
XV/**************************************************************************
V***
XX**
XXCopyright 1989,1990 by Colin Cowie, Glasgow, Scotland.
XX
XX All Rights Reserved
XX
XXPermission to use, copy, modify, and distribute this software and its`20
XXdocumentation for any purpose and without fee is hereby granted,`20
XXprovided that the above copyright notice appear in all copies and that
XXboth that copyright notice and this permission notice appear in
XXsupporting documentation.
XV***************************************************************************
V***
XX*/
XX
XX#include <string.h>
XX#include <jpidef.h>
XX#include <iodef.h> `20
XX#include <descrip.h>
XX
XXtypedef struct
XX`7B
XX`60009unsigned short`60009length ;
XX`60009char`60009`60009dtype ;
XX`60009char`60009`60009class ;
XX`60009char`60009`60009*pntr ;
XX`7DDESCR ;
XX
XX#define stdescr(name,string) name.length = strlen(string);\
XX name.dtype = DSC$K_DTYPE_T; name.class = DSC$K_CLASS_S;\
XX name.pntr = string ;
XX
XX
XXvoid makechan(chan)
XXint *chan;
XX`7B
XX DESCR term;
XX int status;
XX stdescr(term,"TT");
XX status = sys$assign (&term,chan,0,0);
XX if (status != 1) lib$STOP(status);
XX`7D
XX
XXvoid readkey(key,chan)
XXint *chan;
XXint *key;
XX
XX`7B
XX char inkey; `20
XX int status; `20
XX int func;
XX inkey = (char) 0;
XX func = IO$_READVBLK `7C IO$M_NOECHO `7C IO$M_TIMED;
XX status = sys$qiow(0,*chan,func,0,0,0,&inkey,1,0,0,0,0);
XX if (status != 1) lib$STOP(status);
XX *key = (int) inkey;
XX`7D
XX
XXvoid waitkey(key,chan)
XXint *chan;
XXint *key;
XX
XX`7B
XX char inkey; `20
XX int status; `20
XX int func;
XX inkey = (char) 0;
XX func = IO$_READVBLK `7C IO$M_NOECHO `7C IO$M_PURGE;
XX status=sys$qiow(0,*chan,func,0,0,0,&inkey,1,0,0,0,0);
XX if (status != 1) lib$STOP(status);
XX *key = (int) inkey;
XX`7D
XX
XXvoid spawn()
XX`7B
XX DESCR userid;
XX stdescr(userid,"Shapes_Refugee");
XX LIB$SPAWN(0,0,0,0,&userid,0,0,0,0,0,0,0);
XX`7D
XX
XXparam(word)
XXchar word`5B5`5D;
XX`7B
XX DESCR inp;
XX int length;
XX stdescr(inp," ");
XX LIB$GET_FOREIGN(&inp,0,&length,0); `20
XX strcpy(word,inp.pntr);
XX`7D
XX
XXvoid usernum(userid)
XXchar userid`5B8`5D;
XX`7B
XX DESCR u_name;
XX int status;
XX stdescr(u_name," ");
XX lib$getjpi(&(JPI$_USERNAME),0,0,0,&u_name,0);
XX strcpy(userid,u_name.pntr);
XX`7D
XX
XXvoid waitx(tim)
XXfloat *tim;
XX`7B
XX lib$wait(tim);
XX`7D
X$GoSub Convert_File
X$File_is="RAND.FOR"
X$Check_Sum_is=325473741
X$Copy SYS$Input VMS_SHAR_DUMMY.DUMMY
XXC---------------------------------------------------------------------
XXC RND Function - Designed, Written and Programmed by Stephen Macdonald
XXC Code is copyright 1988 Stephen Macdonald CHBS08 Software Consultants
XXC---------------------------------------------------------------------
XX`60009SUBROUTINE Randomise
XX`60009INTEGER seed
XX`60009COMMON /seed/seed
XX`60009CHARACTER date*30
XX`60009CALL LIB$DATE_TIME(%DESCR(date))
XX`60009seed=(10000*(ICHAR(date(16:16))-ICHAR('0'))
XX + +1000*(ICHAR(date(17:17))-ICHAR('0'))
XX + + 100*(ICHAR(date(19:19))-ICHAR('0'))
XX + + 10*(ICHAR(date(20:20))-ICHAR('0'))
XX + + (ICHAR(date(22:22))-ICHAR('0')))
XX`60009END
XX
XX
XX`60009INTEGER FUNCTION Random(min,max)
XX`60009INTEGER min,max,seed
XX`60009REAL rnd,realseed
XX`60009COMMON /seed/seed
XX`60009seed=(((seed+1)*75)-1).AND.65535
XX`60009realseed=seed
XX`60009rnd=(realseed/65536)*(max-min)+min
XX`60009random=rnd
XX`60009END `20
XXC---------------------------------------------------------------------
XXC RND Function - Designed, Written and Programmed by Stephen Macdonald
XXC Code is copyright 1988 Stephen Macdonald CHBS08 Software Consultants
XXC---------------------------------------------------------------------
X$GoSub Convert_File
X$File_is="README.TXT"
X$Check_Sum_is=307909798
X$Copy SYS$Input VMS_SHAR_DUMMY.DUMMY
XVThe game Shapes is based on the arcade game tetris, and follows roughly the
V sa
XXme
XXrules, Full instructions are given in the game itself.
XX
XVThe game requires a VT100 compatible terminal, and a VAX running VMS versio
Vn 4
XX`20
XXor later (at any rate, 4 was the earliest version it was compiled under).
XX
XXThe source code consists of:-
XX
XX Shapes.pas - The main source code for the game
XX
XX Includes.c - Certain system calls, which were easier to write in '
VC'
XX
XX Rand.for - Random number generator, written by a friend, Stephen
XX Macdonald, and borrowed by me, cos I couldnt be bothe
Vred
XX
XX
XXSetting up the game:-
XX
XXThe game shapes uses 2 data files, one for the high score table, and one fo
Vr
XXany saved games which might exist. The destinations of these files should b
Ve
XXchanged in the source code "Shapes.pas" to point to wherever you want the
XXfiles.
XX
XXThe actual lines to change are:
XX
XX Htablefile='disk18:`5Bcadp02.pascal.shapes`5DHtable.dat';
XX Savefile='disk18:`5Bcadp02.pascal.shapes`5Dsave.dat';
XX
XX
XXTo compile this code, execute the command procedure "compile.com" which is
XXsupplied with this archive (e.g @compile )
XX
XXAfter compiling the code you need to create 2 empty data files, one for
XXthe saved games, and one for the high score table.
XX
XXThis is done from within the game itself, by entering the "Cheat" mode.
XXTo do this, run the game, and when the menu comes up, type in the string
XX"cadp8". This activates the cheat mode.
XX
XXYou are then asked for a level number. This would be what level you would
XXlike to start at, if you were going to play the game. At the moment we
XXare not interested in that, so type 1 and press return.
XX
XXYou are now prompted if you would like to reset the saved games file.
XXPress y and return.
XX
XXDo the same for the highscore table file.
XX
XXBoth files should be on world read and write access if other people are to
XXbe able to play the game.
XX
XX
XXThe game is now ready to play.
XX
XX
XXNotes on the cheat mode:-
XX
XXBy entering the cheat mode as above, you can reset either , both or none of
XXthe data files for the game, and choose which level to start on. Also,
XVfrom within the game you can choose which shape you would like next by pres
Vsin
XXg
XXthe keys 1 to 7 to choose. The appropriate shape will appear in the next sh
Vape
XXposition.
XX
XX
XXThats it!! Enjoy!!
XX
XX
XXYou are free to modify the code in any way whatsoever.
XXThere are probably major improvements that can be made in the game as it is
V,
XXso if you make any, or have any comments, mail them to me at:-
XX
XX "CADP02@uk.ac.strath.vaxe"
XX
X$GoSub Convert_File
X$Goto Part4
XRelay-Version: VMS News - V5.9C 19/12/89 VAX/VMS V5.3; site cerritos.edu
XPath: cerritos.edu!usc!wuarchive!zaphod.mps.ohio-state.edu!uakari.primate.wi
Vsc.edu!aplcen!uunet!mcsun!ukc!strath-cs!str-va!cadp02
XNewsgroups: alt.sources,vmsnet.sources.games
XSubject: shapes 2 of 2
XMessage-ID: <247.26e7cf1c@vaxa.strath.ac.uk>
XFrom: cadp02@vaxa.strath.ac.uk
XDate: 7 Sep 90 16:47:24 GMT
XOrganization: Strathclyde University VAX Cluster
XLines: 1722
X
XThis is part two of a two part poting of tetris for VAX's
X
XDelete everything above the line showing "$Part4:", concatenate part 2 onto
Xthe end of part one and then "@shapes.shar1" to unarchive it
X
X
X!---------------------------------------------------------------------------
V--
X$Part4:
X$File_is="SHAPES.PAS"
X$Check_Sum_is=573653758
X$Copy SYS$Input VMS_SHAR_DUMMY.DUMMY
XXprogram Shapes(input,output,Htable,Save);
XX
XX
XV`7B************************************************************************
V*****
XX**
XX Copyright 1989,1990 by Colin Cowie, Glasgow, Scotland.
XX
XX All Rights Reserved
XX
XX Permission to use, copy, modify, and distribute this software and its`20
XX documentation for any purpose and without fee is hereby granted,`20
XX provided that the above copyright notice appear in all copies and that
XX both that copyright notice and this permission notice appear in`20
XX supporting documentation.
XV***************************************************************************
V***
XX*`7D
XX
XX
XX
XXconst
XX Htablefile='disk18:`5Bcadp02.pascal.shapes`5DHtable.dat';
XX Savefile='disk18:`5Bcadp02.pascal.shapes`5Dsave.dat';
XX
XXtype
XX string = packed array`5B1..8`5D of char;
XX scorerec = record
XX num:integer;
XX name:packed array`5B1..40`5D of char;
XX level:integer;
XX id:string;
XX end;
XX recfile = file of scorerec;
XX scorearray = array`5B1..10`5D of scorerec;
XX screenarray = array`5B1..22,1..10`5D of integer;
XX timearray = packed array`5B1..11`5D of char;
XX datestr = packed array `5B1..11`5D of char;
XX saverec = record
XX num:integer;
XX level:integer;
XX outp:screenarray;
XX x:integer;
XX y:integer;
XX shape:integer;
XX position:integer;
XX lines:integer;
XX user:string;
XX current:datestr;
XX end;
XX saverecfile = file of saverec;
XX savearray = array`5B1..100`5D of saverec;
XX
XXvar
XX restored:boolean;
XX blank:saverec;
XX peeps:savearray;
XX HP:boolean;
XX factor:real;
XX curr:timearray;
XX flag,
XX flag2:boolean;
XX answer:char;
XX del:boolean;
XX userid:string;
XX flagA,
XX flagB,
XX flagC,
XX flagD:boolean;
XX chan:integer;
XX key:integer;
XX xchrhigh,
XX xchrlow,
XX ychrhigh,
XX ychrlow:char;
XX score,
XX shape,
XX position:integer;
XX cheat:boolean;
XX currd:datestr;
XX I,J,A:integer;
XX x,y:integer;
XX scores:scorearray;
XX OTT:boolean;
XX Htable:recfile;
XX Save,
XX Saver:saverecfile;
XX level:integer;
XX levelmin:integer;
XX screen:screenarray;
XX left,
XX right,
XX rotleft,
XX rotright,
XX speed,
XX redraw,
XX quitkey:char;
XX lines:integer;
XX
XX`7B*****************************************************************`7D
XXprocedure CLS;
XXbegin `7BCLS`7D
XXwrite(chr(27),'`5BH');
XXwriteln(chr(27),'`5B2J');
XXend; `7BCLS`7D
XX`7B*****************************************************************`7D
XX
XX`7B*****************************************************************`7D
XV`7B************************************************************************
V*****
XX`7D
XXprocedure makechan(%REF chan:integer);external;
XX
XXprocedure readkey(%REF key,chan:integer);external;
XX
XXprocedure waitkey(%REF key,chan:integer);external;
XX
XXprocedure waitx(%REF factor:real);external;
XX
XXprocedure spawn;external;
XX
XXprocedure RANDOMISE;fortran;
XX
XXfunction RANDOM(min,max:integer):integer;fortran;
XX
XXprocedure USERNUM(%stdescr userid:string);fortran;
XX`7B*****************************************************************`7D
XX
XX
XX`7B******************************************************************`7D
XXprocedure highscores(score:integer; bit:integer; var Htable:recfile;
XX var scores:scorearray; var gotin:boolean);
XX
XX
XXvar
XX I,J:integer;
XX newscore:scorerec;
XX A:integer;
XX two:boolean;
XX
XXbegin
XX gotin:=false;
XX cls;
XX writeln('You scored: ',score,' points!!');
XX I:=1;
XX open (Htable, Htablefile,
XX history:=readonly);
XX reset(Htable);
XX while (not eof(Htable)) and (I <=10) do
XX begin
XX read(Htable,scores`5BI`5D);
XX I:=I+1;
XX end;
XX close(Htable);
XX for A:= I to 10 do
XX begin
XX scores`5BA`5D.num:=0;
XX scores`5BA`5D.name:=' ';
XX scores`5BA`5D.level:=1;
XX scores`5BA`5D.id:=' ';
XX end;
XX if score > scores`5B10`5D.num then
XX begin
XX two := true;
XX usernum(userid);
XX if (userid='CADP03 ') or
XX (userid='CADP02 ') or
XX (userid='CRAA30 ') or
XX (userid='CRAA38 ') then
XX begin
XX writeln('Enter usernum, maximum 8 chars (RETURN for default):');
XX write(':');
XX userid:=' ';
XX readln(userid);
XX if userid`5B1`5D=' ' then usernum(userid);
XX end;
XX
XX for I := 10 downto 1 do
XX begin
XX if userid = scores`5BI`5D.id then
XX begin`20
XX if score > scores`5BI`5D.num then
XX begin
XX for J := I to 9 do
XX scores`5BJ`5D := scores`5BJ+1`5D;
XX if I = 9 then
XX scores`5B9`5D := scores`5B10`5D;
XX scores`5B10`5D.num:=0;
XX scores`5B10`5D.name:=' ';
XX scores`5B10`5D.level:=1;
XX scores`5B10`5D.id:=' ';
XX end
XX else
XX begin
XX two := false;
XX end;
XX end;
XX end;
XX if two = true then
XX begin
XX gotin:=true;
XX writeln('Well done, yu have made it into the top ten!!');
XX for A:=1 to 20 do
XX newscore.name`5BA`5D:=' ';
XX Writeln('Enter name, maximum 40 chars:');
XX write(':');
XX readln(newscore.name);
XX usernum(userid);
XX if (userid='CADP03 ') or`20
XX (userid='CADP02 ') or`20
XX (userid='CRAA30 ') or
XX (userid='CHBS08 ') then
XX begin
XX writeln('Enter usernum, maximum 8 chars (RETURN for default):');
XX write(':');
XX userid:=' ';
XX readln(userid);
XX if userid`5B1`5D=' ' then usernum(userid);
XX end;
XX newscore.num:=score;
XX newscore.level:=bit;
XX newscore.id:=userid;
XX I:=1;
XX while newscore.num < scores`5BI`5D.num do
XX I:=I+1;
XX for A:=10 downto I+1 do
XX scores`5BA`5D:=scores`5BA-1`5D; `20
XX scores`5BI`5D:=newscore;
XX open (Htable , Htablefile ,
XX `60009history := old);
XX rewrite(Htable);
XX for I:=1 to 10 do
XX write(Htable,scores`5BI`5D);
XX close (Htable);
XX writeln('Press any key to view high-score table');
XX end
XX else
XX begin
XX writeln('One entry only per usernum in the high score table!!');
XX writeln('Press any key to return to main menu');
XX end;
XX end
XX else
XX begin
XX writeln('Sorry, yu didnt make the high score table!!!!!!');
XX writeln('Press any key to return to main menu');
XX end;
XX waitkey(key,chan);
XXend;
XX`7B*************************************************************`7D
XX
XX
XX`7B*************************************************************`7D
XXprocedure viewscores(var Htable:recfile; scores:scorearray; key,chan:intege
Vr);
XX
XXvar
XX score:scorerec;
XX I,
XX A:integer;
XX
XXbegin
XX cls;
XX open (Htable, Htablefile,
XX history:=readonly);
XX reset(Htable);
XX I:=1;
XX while (not eof(Htable)) and (I <=10) do`20
XX begin
XX read(Htable,score);
XX scores`5BI`5D:=score;
XX I:=I+1;
XX end;
XX close (Htable);
XX for A:= I to 10 do
XX begin
XX scores`5BI`5D.num:=0;
XX scores`5BI`5D.name:=' ';
XX scores`5BI`5D.level:=1;
XX scores`5BI`5D.id:=' ';
XX end;
XX Writeln(' Shapes HIGH SCORE TABLE');
XX writeln;writeln;
XV writeln(' score name leve
Vl `20
XXuserid');
XX for I:=1 to 10 do
XX begin
XX writeln(I:2,'. ',scores`5BI`5D.num,' ',scores`5BI`5D.name,' ',
XX scores`5BI`5D.level:2,' ',scores`5BI`5D.id);
XX end;
XXwriteln;writeln;
XXwriteln(' Press any key to return to main menu');
XXwaitkey(key,chan);
XXend;
XX
XX`7B***********************************************************`7D
XX
XX
XX`7B************************************************************`7D
XXprocedure INTOCHAR(var xchrhigh,xchrlow,
XX ychrhigh,ychrlow:char; x,y:integer);
XX
XXbegin `7BINTOCHAR`7D
XX xchrhigh`60009:= chr(ord('0') + x div 10) ;
XX xchrlow`60009:= chr(ord('0') + x mod 10) ;
XX
XX ychrhigh`60009:= chr(ord('0') + y div 10) ;
XX ychrlow`60009:= chr(ord('0') + y mod 10) ;
XX
XXend; `7BINTOCHAR`7D
XX`7B*********************************************************************`7D
XX
XX
XX`7B*****************************************************************`7D
XXprocedure MENUPRINT;
XX
XXbegin
XX CLS;
XX writeln(chr(27),'#3 Shapes');
XX writeln(chr(27),'#4 Shapes');
XX writeln(chr(27),'`5B22;25HCopyright 1989,1990 LokiSoft Ltd.');
XX writeln(chr(27),'`5B09;31H1. Play Shapes');
XX writeln(chr(27),'`5B10;31H2. Redefine Keys');
XX writeln(chr(27),'`5B11;31H3. View Score Board');
XX writeln(chr(27),'`5B12;31H4. Instructions');
XX write(chr(27),'`5B13;31H5. Print Next Shape');
XX if flag then writeln(' (YES)') else writeln(' (NO) ');
XX write(chr(27),'`5B14;31H6. Slow Down Game');
XX if flag2 then writeln(' (YES)') else writeln(' (NO) ');
XX writeln(chr(27),'`5B15;31H7. Restore Saved Game');
XX writeln(chr(27),'`5B17;31H0. Exit from game');
XX writeln(chr(27),'`5B19;31HEnter choice from options above');
XX writeln;
XXend;
XX`7B**********************************************************************`7
VD
XX`7B*****************************`7D
XXprocedure Instructions;
XXbegin
XXcls;
XXwriteln('Hi Guys, here''s another offering from the LokiSoft label,');
XXwriteln('except this one''s good!!!!');
XXwriteln;
XXwriteln('This game is based on a certain arcade game which you may have ');
XXwriteln('played at sometime or other, but I aint mentioning which one cos')
V;
XXwriteln('this is a blatant rip-off of it so its really dead obvious!!');
XXwriteln;
XXwriteln('Anyway, its like this: there are these seven different shapes:-');
XXwriteln;
XXwriteln('@@ @ @ @ @ @ @');
XXwriteln('@@ @ @ @@ @@ @@ @');
XXwriteln(' @@ @@ @ @ @ @');
XXwriteln(' @');
XXwriteln('And these shapes fall from the top of the screen to the bottom,');
XXwriteln('piling on top of one another.');
XXwriteln('You can rotate each shape, and move it left or right, the ');
XXwriteln('object being to get complete unbroken lines of "@@@@@@@@@@" at ');
XXwriteln('the bottom of the screen.');
XXwriteln('when this happens, that line is deleted, and the pile drops down')
V;
XXwriteln('and you are given points depending on which level you are on');
XXwriteln;
XXwriteln(' Press any key for next page');
XXwaitkey(key,chan);
XXcls;
XXwriteln;
XXwriteln('If you are fortunate enough to get more than one completed line at
V');
XVwriteln('a time, you receive a bonus dependent on the level you are on and
V the
XX');
XXwriteln('number of lines completed.');
XXwriteln('After completing 5 lines, you move on to level 2 where you have to
V');
XXwriteln('complete 10 lines,..15 for level 3, and so on.');
XXwriteln('There is a bonus at the end of each level depending on which level
V');
XVwriteln('you are on, and how low the pile of bricks is,..the lower the pile
V,')
XX;
XXwriteln('the higher the bonus');
XVwriteln('For each level, the number of points per completed line, and poten
Vtia
XXl');
XXwriteln('bonus per level is increased, and there are an infinite number');
XXwriteln('of levels in the game.');
XXwriteln;
XXwriteln('The default keys are: z - left, x - right,');
XXwriteln(' o - rotate left, p - rotate right,');
XXwriteln(' `5B - move shape to bottom, r - redraw screen, q - quit');
XXwriteln(' ! - to spawn to dcl, @ - to save game');
XXwriteln;
XXwriteln(' Press any key for next page');
XXwaitkey(key,chan);
XXcls;
XXwriteln('Note on Saving game:-');
XXwriteln;
XXwriteln('It is only possible for any user to have one saved game at a time,
V');
XVwriteln('and if you attempt to save a game when you already have one stored
V,')
XX;
XXwriteln('the stored game will be written over!!!');
XXwriteln('Stored games will automatically be deleted when restored.');
XXwriteln;
XVwriteln('There is total space on the save-file for 100 games, and when it i
Vs')
XX;
XVwriteln('full, whenever anyone attempts to save their game, the oldest prev
Viou
XXs');
XXwriteln('saved game is written over!');
XXwriteln;
XXwriteln('Note on Slowing down game option:-');
XXwriteln;
XVwriteln('This option is intended only for people using workstations or simi
Vlar
XX');
XXwriteln('which vastly speed up the screen printing, thereby making the game
V');
XXwriteln('unplayable. The slow down option negates this problem.');
XXwriteln;
XXwriteln('Now I''ll take this opportunity to wish you happy playing and good
V');
XXwriteln('luck, you''ll need it!!!!');
XXwriteln(chr(27),'`5B22;30HPress any key for main menu');
XXwaitkey(key,chan);
XXend;
XX`7B*****************************`7D
XX
XX
XX
XX`7B*******************************************************************`7D `
V20
XVprocedure KEYDEFINE(var left,right,rotleft,rotright,speed,quitkey,redraw:ch
Var)
XX;
XX
XXvar
XX
XX redrawint,
XX null,
XX leftint,
XX rightint,
XX rotleftint,
XX rotrightint,
XX speedint,
XX stopint:integer;
XX quitint:integer;
XX
XXbegin `7BKEYDEFINE`7D
XX CLS;
XX writeln(' Defining Keys For SHAPES ');
XX writeln;
XX writeln;
XX writeln;
XX writeln;
XX writeln('Press key for movement LEFT: ');
XX waitkey(leftint,chan);
XX left:=chr(leftint);
XX writeln(left);
XX writeln('press key for movement RIGHT: ');
XX waitkey(rightint,chan);
XX while (rightint=leftint) do
XX waitkey(rightint,chan);
XX right:=chr(rightint);
XX writeln(right);
XX writeln('Press key for rotation ANTICLOCKWISE: ');
XX waitkey(rotleftint,chan);
XX while (rotleftint=leftint) or
XX (rotleftint=rightint) do
XX waitkey(rotleftint,chan);
XX rotleft:=chr(rotleftint);
XX writeln(rotleft);
XX writeln('press key for rotation CLOCKWISE: ');
XX waitkey(rotrightint,chan);
XX while (rotrightint=rightint) or
XX (rotrightint=rotleftint) or
XX (rotrightint=leftint) do
XX waitkey(rotrightint,chan);
+-+-+-+-+-+-+-+- END OF PART 1 +-+-+-+-+-+-+-+-
--
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
< Joe Koffley KOFFLEY@NRLVAX.NRL.NAVY.MIL >
< Naval Research Laboratory KOFFLEY@SMOVAX.NRL.NAVY.MIL >
< Space Systems Division AT&T : 202-767-0894 >
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/