スレ立てついでにこれを捨てとく。
多分byでぶ大先生。0から順番に。
#packopt name "bargettingval"
#define locate( %1 , %2 ) pos (%1)<<4 , (%2)<<4
#module "PF_X"
#deffunc PF_X_STATUS_CLEAR
for i,0,40 : for o,0,30 : PF_X_STATUS( i , o ) = -1 : next : next : return
#defcfunc hex str OneByte
d="00"+OneByte:d=strmid(d,-1,2)
hh=peek(d,0)-'0':hh-=((hh>9)*7)+((hh>24)<<5):hh=hh*((hh>0)and(hh<16))
hl=peek(d,1)-'0':hl-=((hl>9)*7)+((hl>24)<<5):hl=hl*((hl>0)and(hl<16))
return ( hh << 4 ) + hl
#defcfunc VramAddress int x , int y
return ((PCGScreenHeight-1-y)*(((PCGScreenWidth*3)+3)&0xfffffffc))+(x*3)
#deffunc writeCHRLine int sID , int plane , int sLine , int sData
x = sID << 3 : y = sLine : s = sData
for o,0,8:dat = 0xff:if ( s and tbit( o ) ) = 0 :dat =0
poke VRAM , VramAddress( x + 7 - o , y ) + RGBPLANE( plane ) , dat:next
return
#deffunc RBYTE int sID , str sData
if PCGMax <= sID :return
PCGData = sData
for i,0,24:writeCHRline sID,i/8,i\8,hex(strmid(PCGData,i<<1,2)):next
return
#deffunc WBYTE int sx , int sy , int sID
if PCGMax <= sID :return
PF_X_STATUS( sx , sy ) = sID
pos sx << 4 , sy << 4 : gzoom 16 , 16 , PCGID , sID << 3 , 0 , 8 , 8
return
#defcfunc STATUS int sx , int sy
return PF_X_STATUS( sx , sy )
#deffunc init_PF_X int mId , int sMax , int RGBFLG
PCGID=mID:PCGMax=sMax:PCGScreenWidth=sMAX << 3:PCGScreenHeight=8
baseID = ginfo(2):buffer PCGID , PCGScreenWidth , PCGScreenHeight , 0
color : boxf : mref VRAM,66 :gsel baseID
if RGBFLG = 0 :{ RGBPLANE(0) = 0 : RGBPLANE(1) = 2 : RGBPLANE(2) = 1 }
else { RGBPLANE(0) = 2 : RGBPLANE(1) = 1 : RGBPLANE(2) = 0 }
dim PF_X_STATUS , 40 , 30 : PF_X_STATUS_CLEAR
tbit = 0x01 , 0x02 , 0x04 , 0x08 , 0x10 , 0x20 , 0x40 , 0x80
return
#global
screen 0 , 32 * 16 , 24 * 16 : color:boxf:color 255,255,255:randomize
init_PF_X 1 , 19 , 0:sdim v,17,19
v( 0)="0000000000000000":v( 1)="3844444444443800":v( 2)="1030101010103800"
v( 3)="3844440810207c00":v( 4)="3844041804443800":v( 5)="081828487c080800"
v( 6)="7c40407804047800":v( 7)="3844407844443800":v( 8)="7c44040808101000"
v( 9)="3844443844443800":v(10)="3844443c04443800":v(11)="1038541010101000"
v(12)="0e060a1020408000":v(13)="000804fe04080000":v(14)="804020100a060e00"
v(15)="1010101054381000":v(16)="02040810a0c0e000":v(17)="002040fe40200000"
v(18)="e0c0a01008040200":for i,0,19:RBYTE i, v(i)+v(i)+v(i):next
*start:c=0:px=16:py=12:pv=0
for i,0,32:for o,0,24:WBYTE i,o,0:next:next:for i,0,10
*haichi:x=rnd(32):y=rnd(24):if STATUS(x,y)!=0 :goto *haichi
WBYTE x,y,1+i:next:wait 50
*mainloop:WBYTE px,py,0:stick s,0x10
pv+=((s & 0x10)=0):pv*=(pv < 8)
px+=((pv>=1 and pv<=3)-(pv>=5 and pv<=7))*((s & 0x10)!=0)
py+=((pv>=3 and pv<=5)-(pv<=1 or pv>=7))*((s & 0x10)!=0)
if(px<0 or px>31 or py<0 or py>23):goto *go
t = STATUS( px,py ):WBYTE px,py,11+pv
if t!= 0 {
if t = c + 1 { c+=1:if c>9 {goto *cl } }
else { goto *go }
}
wait 10:goto *mainloop
*go:locate 12,11:print "G a m e O v e r":goto *lp
*cl:locate 13,11:print "C l e a r !"
*lp:stick s:if (s & 0x10)!=0 :goto *start
await 50 : goto *lp