home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
363.lha
/
MCP
/
turboMCP.mod
< prev
next >
Wrap
Text File
|
1990-04-09
|
5KB
|
116 lines
(***************************************************************************
* Programme : turboMCP.mod (not "Master Control Programme" but *
* "Modula-2 Cycle Power) *
* Usage : turboMCP *
* Version : V1.57 *
* Date : 22.-26.03.1989, 09.04.1989 *
* Author : Jörg Sixt *
* Purpose : a TRON-like game for two players *
* Language : Modula-2,AMSoft PD-Version from Fish 113 *
* Bugs : Can't use devices with the demo-version *
***************************************************************************)
MODULE turboMCP;
FROM SYSTEM IMPORT ADR;
FROM Intuition IMPORT ScreenPtr,NewScreen,ScreenFlagSet,OpenScreen,CloseScreen;
FROM Graphics IMPORT RastPortPtr,ViewModeSet,SetRast,Move,Text,SetAPen,
ReadPixel,WritePixel,SetRGB4,ViewPortPtr ;
CONST WHAT = 200;
VAR Taste [12577793] : CHAR;
Help : ARRAY[0..25] OF CHAR ;
MyScrPtr : ScreenPtr ;
MyNewScr : NewScreen ;
Rast : RastPortPtr ;
Viewer : ViewPortPtr ;
x : ARRAY [1..2] OF INTEGER [-1..320] ;
y : ARRAY [1..2] OF INTEGER [-1..WHAT] ;
vx,vy : ARRAY [1..2] OF INTEGER [-1..1] ;
Level : INTEGER [1..10] ;
i : INTEGER [1..2] ;
ExtraWurst : LONGINT ;
crash : BOOLEAN ;
Color : INTEGER [-1..15] ;
Cycle : INTEGER [-1..15] ;
PROCEDURE SleepTight ;
BEGIN
Help[0] := Taste ;
REPEAT UNTIL (Help[0] # Taste) ;
END SleepTight ;
BEGIN
WITH MyNewScr DO (* My first Modula-Screen -> a historical moment !! *)
leftEdge := 0 ; topEdge := 0 ;
width := 320 ; height := WHAT ; depth := 2 ;
detailPen := 0 ; blockPen := 0 ;
viewModes := ViewModeSet {} ;
type := ScreenFlagSet {} ;
defaultTitle := NIL ; gadgets := NIL ; customBitMap := NIL ;
END ;
MyScrPtr := OpenScreen (MyNewScr) ;
IF (MyScrPtr = NIL) THEN HALT ; END ;
Rast := ADR(MyScrPtr^.rastPort) ;
Viewer := ADR(MyScrPtr^.viewPort) ;
SetRGB4 (Viewer,0, 0, 0, 0) ; SetRGB4 (Viewer,1,15,15,15) ;
SetRGB4 (Viewer,2,15, 0, 0) ; SetRGB4 (Viewer,3, 0,15, 0) ;
LOOP
SetAPen (Rast,1) ;
Move (Rast,68, 80) ; Text (Rast,ADR("Modula Cycle like Power"),25) ;
Move (Rast,72,110) ; Text (Rast,ADR("by sick amiga software") ,23) ;
x[1] := 39 ; y[1] := 100 ; vx[1] := 0 ; vy[1] :=-1 ;
x[2] := 279 ; y[2] := 100 ; vx[2] := 0 ; vy[2] :=-1 ;
crash := FALSE ; Level := 10 ; Color := 15 ; SleepTight ;
REPEAT
CASE Taste OF
(* ESC *) 165C : EXIT |
(* SPACE *) 177C : SleepTight |
(* CTRL *) 71C : SetRast (Rast,0) |
(* UP1 *) 333C : IF vy[1]=0 THEN vx[1]:= 0 ; vy[1]:=-1 ; END |
(* DOWN1 *) 233C : IF vy[1]=0 THEN vx[1]:= 0 ; vy[1]:= 1 ; END |
(* RIGHT1 *) 273C : IF vx[1]=0 THEN vx[1]:= 1 ; vy[1]:= 0 ; END |
(* LEFT1 *) 275C : IF vx[1]=0 THEN vx[1]:=-1 ; vy[1]:= 0 ; END |
(* UP2 *) 147C : IF vy[2]=0 THEN vx[2]:= 0 ; vy[2]:=-1 ; END |
(* DOWN2 *) 145C : IF vy[2]=0 THEN vx[2]:= 0 ; vy[2]:= 1 ; END |
(* RIGHT2 *) 143C : IF vx[2]=0 THEN vx[2]:= 1 ; vy[2]:= 0 ; END |
(* LEFT2 *) 141C : IF vx[2]=0 THEN vx[2]:=-1 ; vy[2]:= 0 ; END |
(* Funkey *) 115C..137C :
IF ODD(ORD(Taste)) THEN
Level := (ORD(Taste)-75) DIV 2;
END |
ELSE
(* otherwise the runtime system gets crazy *)
END;
FOR i := 1 TO 2 DO
x[i] := x[i]+vx[i] ; y[i] := y[i]+vy[i] ;
IF x[i] = -1 THEN x[i] := 319 ; END ;
IF x[i] = 320 THEN x[i] := 0 ; END ;
IF y[i] = -1 THEN y[i] := WHAT-1 ; END ;
IF y[i] = WHAT THEN y[i] := 0 ; END ;
IF ReadPixel(Rast,x[i],y[i]) # 0 THEN
SetAPen (Rast,1) ; SetRGB4 (Viewer,1,15,15,15) ;
crash := TRUE ; Help := "Crash ! Looser is " ;
Help[19] := CHR(i+48) ; Help[20] := "!" ;
Move (Rast,84,30) ; Text (Rast,ADR(Help[0]),21) ;
SleepTight ; SetRast (Rast,0) ;
ELSE
SetAPen(Rast,i+1) ;
ExtraWurst := WritePixel(Rast,x[i],y[i]) ;
END ;
END;
IF Color = 15 THEN Cycle := -1 ; END ;
IF Color = 0 THEN Cycle := 1 ; END ;
Color := Color + Cycle ;
SetRGB4 (Viewer,1,Color,Color,Color) ;
FOR ExtraWurst := 0 TO Level*300 DO (* nothing *) END ;
UNTIL crash ;
END ;
CloseScreen (MyScrPtr) ;
END turboMCP.