home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 3
/
PDCD_3.iso
/
pocketbk
/
games
/
pegout
/
pegout.opl
< prev
next >
Wrap
Text File
|
1994-08-31
|
4KB
|
220 lines
REM PegOut - The Game
REM Liam Relihan, 1994
REM relihanl@ul.ie
REM Freeware
REM Version 1.0
app PegOut
type 1
icon "\OPD\pegout.pic"
enda
proc main:
GLOBAL map$(11,11),bitid%,winid%,ckey%,cx%,cy%,pcnt%
LOCAL pset%
bitid%=gloadbit("\OPD\PEGS.PIC")
winid%=gcreate(0,0,239,79,1)
initg:
do
ckey% = kget%:
cursr:(cx%,cy%,1)
if ckey% = 258
if pset%=1 and atm:(cx%+1,cy%)=42 and atm:(cx%+2,cy%)=32
setm:(cx%,cy%,32)
setm:(cx%+1,cy%,32)
setm:(cx%+2,cy%,42)
cx%=cx%+2:
pcnt%=pcnt%-1
pset%=0
elseif pset%=0 and atm:(cx%+1,cy%) <> 45
cx%=cx%+1
else
beep 5,300
if pset%=1 : invert:(cx%,cy%) : pset%=0 : endif
endif
elseif ckey% = 259
if pset%=1 and atm:(cx%-1,cy%)=42 and atm:(cx%-2,cy%)=32
setm:(cx%,cy%,32)
setm:(cx%-1,cy%,32)
setm:(cx%-2,cy%,42)
cx%=cx%-2
pcnt%=pcnt%-1
pset%=0
elseif pset%=0 and atm:(cx%-1,cy%) <> 45
cx%=cx%-1
else
beep 5,300
if pset%=1 : invert:(cx%,cy%) : pset%=0 : endif
endif
elseif ckey% = 256
if pset%=1 and atm:(cx%,cy%-1)=42 and atm:(cx%,cy%-2)=32
setm:(cx%,cy%,32)
setm:(cx%,cy%-1,32)
setm:(cx%,cy%-2,42)
cy%=cy%-2
pcnt%=pcnt%-1
pset%=0
elseif pset%=0 and atm:(cx%,cy%-1) <> 45
cy%=cy%-1
else
beep 5,300
if pset%=1 : invert:(cx%,cy%) : pset%=0 : endif
endif
elseif ckey% = 257
if pset%=1 and atm:(cx%,cy%+1)=42 and atm:(cx%,cy%+2)=32
setm:(cx%,cy%,32)
setm:(cx%,cy%+1,32)
setm:(cx%,cy%+2,42)
cy%=cy%+2
pcnt%=pcnt%-1
pset%=0
elseif pset%=0 and atm:(cx%,cy%+1) <> 45
cy%=cy%+1
else
beep 5,300
if pset%=1 : invert:(cx%,cy%) : pset%=0 : endif
endif
elseif ckey%=13
if pset%=0 and atm:(cx%,cy%) <> 32
invert:(cx%,cy%)
pset%=1
elseif pset%=1
invert:(cx%,cy%)
pset%=0
else
beep 5,300
endif
endif
cursr:(cx%,cy%,0)
scr:
until 1 <> 1
endp
proc scr:
gstyle 1
gat 150,15
gprintb "Remaining: "+gen$(pcnt%,3),80,2,3,3
gstyle 0
endp
proc initg:
local i%,j%
map$(1)= "---*****---"
map$(2)= "---*****---"
map$(3)= "---*****---"
map$(4)= "***********"
map$(5)= "***********"
map$(6)= "***** *****"
map$(7)= "***********"
map$(8)= "***********"
map$(9)= "---*****---"
map$(10)="---*****---"
map$(11)="---*****---"
cx%=6:cy%=6:pcnt%=84
gupdate off
gat 6,0 : gbox 79,79
j%=1
while j%<12
i%=1
while i%<12
printm:(i%,j%)
i%=i%+1
endwh
j%=j%+1
endwh
cursr:(cx%,cy%,0)
scr:
gstyle 8
gat 145,35 : gprint "PegOut"
gstyle 32
gat 155,50 : gprint "by"
gat 130,65 : gprint "Liam Relihan"
gstyle 16
gat 115,75 : gprint "<relihanl@ul.ie>"
gstyle 0
gupdate on
endp
proc cursr:(i%,j%,mode%)
gat i%*7,(j%*7)-6
ggmode mode%
gbox 7,7
ggmode 0
endp
proc invert:(i%,j%)
gat i%*7,(j%*7)-6
ginvert 7,7
endp
proc atm:(i%,j%)
if i%<1 or i% > 11:return 45:endif
if j%<1 or j% > 11:return 45:endif
return peekb(addr(map$(j%))+i%)
endp
proc setm:(i%,j%,val%)
pokeb addr(map$(j%))+i%,val%
printm:(i%,j%)
endp
proc printm:(i%,j%)
local val%
gat i%*7,(j%*7)-6
val%=peekb(addr(map$(j%))+i%)
if val%=32
gcopy bitid%,0,0,7,7,3
elseif val%=42
gcopy bitid%,7,0,7,7,3
endif
endp
proc kget%:
local k%,h$(9),a$(5)
h$="NX"
while 1
k%=GET
if k%=$122
minit
mcard "Game","New",%N,"Exit",%X
k%=menu
if k% and intf(loc(h$,chr$(k%)))
a$="proc"+chr$(k%)
@(a$):
endif
elseif k% and $200
k%=(k%-$200) and $FFDF
k%=loc(h$,chr$(k%))
if k%
a$="proc"+mid$(h$,k%,1)
@(a$):
endif
else
return k%
endif
endwh
endp
proc procn:
local c%
dinit "Restart"
dchoice c%,"Are you sure?","Yes,No"
if dialog and (c%=1) : initg: : endif
endp
proc procx:
local c%
dinit "Exit"
dchoice c%,"Are you sure?","Yes,No"
if dialog and (c%=1) : stop : endif
endp