見出し画像

Kazuhito's chatermaker

REM ***************************************************************
REM 
REM         Kazuki's キャラクターメーカー           
REM             vre 0.97  2021.08.22
REM            キャラクター番号選択  ok
REM            サイズ選択・既存      32*32   
REM              ペイント完成 反転取り組む
REM              ペイントアンドー機能追加
REM               ローテイトサブ追加
REM                itiouno bug tori
REM         ノートにアップできるまでの試みだー
REM             dmode [on][off]
REM  **************************************************************
REM 

!' meno_sab

FUNCTION title2(a)
  PRINT "**************************"
  PRINT " kazuhito char makere     "
  PRINT "   32*32ver 100seat       "
  PRINT "  copy right 2021.8.20    "
  PRINT "        ver 9.03          "  
  PRINT "**************************"
END FUNCTION 

FUNCTION title(void)
  PRINT " z char    "
  PRINT " x color   "
  PRINT " 0 dot     "
  PRINT " d draw    "
  PRINT " → r  右  "
  PRINT " ← l  左  "
  PRINT "    t  tool (option)     "
  PRINT "    sc 左右コピー:sh 左右反転"
  PRINT "    jc 上下コピー:jh 上下反転"
  PRINT " -  copylight"   
END FUNCTION

OPTION BASE 0

DIM ban(100,128,128)

DIM ban_0(80,40)
DIM ban_1(80,40)
DIM ban_2(80,40)
DIM ban_3(80,40)
DIM ban_4(80,40)
DIM ban_5(80,40)
DIM ban_6(80,40)
DIM ban_7(80,40)

DIM l_1(2,2)
DIM l_2(2,2)
DIM memo(3)
DIM memo_text$(10)
LET memo_text$(0)="sex"
DIM color_d(2,2)

SET ECHO "off"

LET draw_mode=0

REM 初期設定
INPUT  PROMPT "新規 y:":s$
IF s$="y" THEN 
  CALL sinki_shori(ban,mi,hx,hy,file_name$)
  GOTO 2000
END IF

REM kizon

ASK DIRECTORY s$
FILE GETNAME s2$
PRINT s2$
LET file_name$=s2$
OPEN #1: NAME s2$

INPUT #1:mi
INPUT #1:hx
INPUT #1:hy
PRINT mi;hx;hy

FOR k=0 TO mi-1 
  FOR y=0 TO hy-1
     FOR x=0 TO hx-1
        INPUT #1:a
        LET ban(k,y,x)=a
        PRINT ".";
         
         
     NEXT x
     PRINT 
  NEXT y
NEXT k
CLOSE #1

LET void=title2(void) 
LET void=title (void) 


2000
     
     
    LET a=100
    LET b=128
    LET c=128
     
     
     
1021
     
    LET wx=hx
    LET wy=hy
    LET whh=100
    !   IF  hy>hx  THEN  
    !     LET whh=wy+5
     
    !   ELSE
    !     LET whh=wx+5
     
    !  END IF 
     
    SET WINDOW 0,whh,whh,0
     
    FUNCTION prno(void)
       SET TEXT HEIGHT 2.7
       PLOT TEXT ,AT 5,3:"chrno-"&STR$(cr_no)&" color no-"&STR$(ban(cr_no,y,x) )
    END FUNCTION 
     
    LET a=prno(o)         !***********
    LET chaba=2
    LET cr_no=0
     
    LET x=0
    LET y=0
    LET tx=7
    LET ty=20
     
    LET lx=3
    LET ly=3
    LET memo(0)=lx+chaba*hx+1
    LET memo(1)=ly+8
     
     
    LET color_d(1,1)=lx+hx*chaba+2
    LET color_d(1,2)=lx+hx*chaba+5
    LET color_d(2,1)=ly-.2
    LET color_d(2,2)=ly+3
    LET c=chaba
    LET h=hx
    LET h2=hy
    LET x1=2
    LET x2=lx+(x*h*c)+.3
    LET y1=ly
    LET y2=ly+(y*h*c)+.3
    SET COLOR 8
     
    LET rsidex=x2+0.5
    LET rsidey=y1
    LET botom_=y2+1
    LET rsx=7
     
    LET l_1(1,1)=lx-.2
    LET l_1(1,2)=lx+hx*chaba+.2
    LET l_1(2,1)=ly-.2
    LET l_1(2,2)=ly+hy*chaba+.2
    CALL line_s(l_1(1,1),l_1(1,2),l_1(2,1),l_1(2,2))
    LET x1=lx+hx/2*chaba
    LET y1=ly-.4
    LET y2=ly+hy*chaba+.4
    CALL line_s(x1,x1,y1,y2) 
    LET y1=ly+hy/2*chaba
    LET x1=lx-.4
    LET x2=lx+hx*chaba+0.4
    CALL line_s(x1,x2,y1,y1)
     
    LET l_2(1,1)=l_1(1,1)
    LET l_2(1,2)=l_2(1,1)+hx
    LET l_2(2,1)=l_1(2,2)+1
    LET l_2(2,2)=l_2(2,1)+hy 
    !'   MAT PLOT CELLS,IN l_2(1,1),l_2(2,1);l_2(1,2),l_2(2,2) :ban_0
     
     
     
    LET x=0
    LET y=0
     
     
     
    LET void=memo_sub(void)
    LET void=oosikaku(void)
     
    FUNCTION oosikaku(a)   
       FOR iy=0 TO hy-1
          FOR ix=0 TO hx-1 
             CALL shosai_box(lx,ly,ix,iy,chaba,ban(cr_no,iy,ix))
              
          NEXT ix
       NEXT iy
    END   FUNCTION
     
    FUNCTION memo_sub(void) !'******
       SET COLOR 1
       SET TEXT HEIGHT 3   ! ********いけたか
       CALL box_s(memo(0),memo(0)+10,memo(1)-3,memo(1)+10,0)
       SET COLOR 15
       PLOT TEXT ,AT memo(0),memo(1)   :"color "& STR$(cl) 
       PLOT TEXT ,AT memo(0),memo(1)+5 :"cr_no "& STR$(cr_no)
       PLOT TEXT ,AT memo(0),memo(1)+10:"[-]copylight "
       PLOT TEXT ,AT memo(0),memo(1)+15:"[+]comand    "
       SET COLOR 0
       PLOT TEXT ,AT memo(0),memo(1)+20:"0"
       PLOT TEXT ,AT memo(0),memo(1)+20:"1"
        
       SET COLOR 4
       PLOT TEXT ,AT memo(0),memo(1)+20:"draw mode "&str$(draw_mode)       
        
    END FUNCTION 
     
     
    LET cl=1
    !'  LET void=memo_sub(void)    *****
    CALL dotcolor_sub(color_d,cl)
    LET xhogo=x
    LET yhogo=y      
    LET void=main(void)
    FUNCTION main(void)
    !' LET cl=ban(1,1)
    !'CALL nawcolor(cl)
       MOUSE POLL mx,my,left,right
       DO 
          CALL juji_m(lx,ly,x,y,chaba,cl)
          LET s$=""
          DO WHILE s$=""
           
             CALL juji_m(lx,ly,x,y,chaba,cl)
             LET s$=inkey_s$(void)
              
             LET no=key_c(s$)      !' key select 
             IF s$="+" THEN LET void=title(void)  !' menu
             IF s$="-" THEN LET void=title2(void)  !' menu sakusha
              
             IF s$="t" THEN                  !'t    ツールズ
                CALL tool(lx,ly,x,y,chaba,ban,cl,hx,hy,cr_no,draw_mode,mi)
                LET void=oosikaku(void)
                LET void=memo_sub(void) 
             END IF 
             IF s$="T" THEN
                LET a=title(void)
             END IF
             IF s$="r" OR s$="l" THEN       !'  r  or  l    ローテト
                CALL rotait_sub(ban,hx,hy,cr_no,s$)
                LET void=oosikaku(void)
             END IF    
             IF s$="e" THEN                 !'end
                CALL endshori(ban,mi,hx,hy,file_name$)
                STOP
             END if
             IF s$="d" THEN                !'ドローモード
                LET draw_mode=MOD(draw_mode+1,2)
                IF draw_mode=1 THEN
                   LET ban(cr_no,y,x)=cl
                   CALL shosai_box(lx,ly,x,y,chaba,cl) 
                   LET a=memo_sub(o)
                END IF 
             END IF
             IF s$="x" THEN                 !'color 表示
                call   color_dis(void)
                INPUT PROMPT "cloor ":cl
                CLEAR 
                SET WINDOW 0,whh,whh,0   ! ******
                CALL line_s(l_1(1,1),l_1(1,2),l_1(2,1),l_1(2,2))
                LET a=prno(void)    !*********** 
                LET void=memo_sub(void) !**********
                LET void=oosikaku(void)
                LET a=prno(a)
                 
             END if
             IF s$="z" THEN
                CLEAR 
                CALL chr_hyo(ban,hx,hy)
                INPUT PROMPT "cr_no":cr_no
                CLEAR 
                SET WINDOW 0,whh,whh,0   ! ******
                CALL line_s(l_1(1,1),l_1(1,2),l_1(2,1),l_1(2,2)) !  *****
                 
                LET void=memo_sub(void)
                LET void=oosikaku(void)
             END IF
             IF s$="s" THEN 
                LET cl=ban(cr_no,y,x)
                LET void=memo_sub(void)   
                 
             END IF  
             IF no=0 THEN LET s$=""
             GOTO 20  
             !'  IF s$="" AND no=0 THEN 
             MOUSE POLL x0,y0,left,right
             PRINT x0;y0;left;right
              
             IF x0<mx THEN 
                LET s$="4"
                LET x=x-1
             END IF 
             IF x0>mx THEN 
                LET x=x+1
                LET s$="6"
             END IF 
             IF y0<my THEN 
                LET s$="8"
                LET y=y-1
             END IF 
             IF y0>my THEN 
                LET s$="2"
                LET y=y+1
             END IF 
             LET mx=x0
             LET my=my
20           
            
        LOOP
         
         
         
        !'  PRINT x;y;left;right 
        !'
        CALL mode_key(x,y,no)
        IF 0>x THEN LET x=0
        IF hx-1<x THEN LET x=hx-1
        IF 0>y THEN LET y=0
        IF hy-1<y THEN LET y=hy-1
        !'   PRINT x;y    ***** 
         
        IF x<>xhogo or y<>yhogo  THEN 
           LET c=ban(cr_no,yhogo,xhogo)
            
           CALL shosai_box(lx,ly,xhogo,yhogo,chaba,c)
           !' CALL shosai_box(lx,ly,xhogo,yhogo,chaba,cl)
           LET xhogo=x
           LET yhogo=y
           IF draw_mode=1 THEN
              LET ban(cr_no,y,x)=cl
              CALL shosai_box(lx,ly,x,y,chaba,cl)
           END if
        END IF 
         
        IF  s$="0" THEN 
        !'  SET COLOR cl
           LET ban(cr_no,y,x)=cl
           CALL shosai_box(lx,ly,x,y,chaba,cl)
           LET void=memo_sub(void)
            
           !' SET POINT STYLE 7
           !'   PLOT POINTS :rsidex+(x-1)*.1 ,rsidey+5+(y-1)*.1
           call timer_s(500)
        end if 
        LET s$=""
     LOOP
  END FUNCTION
END 


EXTERNAL SUB clr_s(ban(,,))
  FOR y=1 TO 32
     FOR x=1 TO 32
        LET ban(cr_no,y,x)=0
     NEXT x
  NEXT y
END SUB 

EXTERNAL SUB tool(lx,ly,x,y,chaba,ban(,,),cl,hx,hy,cr_no,draw_mode,mi)
  INPUT  PROMPT "*cls:sc:jc:sh:jh:n:ch:p:t:tr:cd":t$
  IF t$="cls" THEN CALL cls_s(ban,hx,hy,cr_no)
  IF t$="jc" THEN CALL hanten2(ban,hx,hy,cr_no)
  !'   IF t$="n" THEN CALL cr_no_input(cr_no,mi)
  IF t$="ch" THEN CALL color_change(ban,hx,hy,cr_no)
  IF t$="sc" THEN CALL hanten(ban,hx,hy,cr_no) 
  IF t$="sh" THEN CALL sayu_hanten(ban,hx,hy,cr_no)
   
  IF t$="jh" THEN CALL jouge_hanten(ban,hx,hy,cr_no)
   
  IF t$="tr" OR t$="t" THEN 
     IF t$="tr" THEN 
        LET f=0
     ELSE
        LET f=1
     END IF 
      
     CALL trans(ban,hx,hy,mi,f)
  END IF 
   
   
  IF t$="p"  THEN 
   
     CALL paint_a(ban,cr_no,hx,hy,x,y,cl,lx,ly,chaba)
     LET void=oosikaku
      
  END IF
  LET t$="" 
END SUB 

EXTERNAL SUB cr_no_input(cr_no,mi)
  INPUT  PROMPT "cr_no をどうぞ":n
  IF 0<=n AND n<mi THEN 
   
     LET cr_no=n
      
  END IF 
   
END SUB 

EXTERNAL SUB color_change(ban(,,),hx,hy,cr_no)
!' *** カラー選択すること
  INPUT PROMPT "color no ?":c1 
  INPUT PROMPT "color no ?":c2
  FOR y=0 TO hy-1
     FOR x=0 TO hx-1
        IF ban(cr_no,y,x)=c1 THEN 
           LET ban(cr_no,y,x)=c2
        END IF 
     NEXT x
  NEXT y
END SUB 

EXTERNAL SUB rotait_sub(ban(,,),hx,hy,cr_no,s$)
!' ローテ右左 
  IF s$="r" THEN  
     FOR y=0 TO hy-1
        LET w1=ban(cr_no,y,hx-1)
        FOR x=hx-1 TO 1 STEP -1
           LET ban(cr_no,y,x)=ban(cr_no,y,x-1)
        NEXT x
        LET ban(cr_no,y,0)=w1
     NEXT y 
  END IF 
   
  IF s$="l" THEN
     FOR y=0 TO hy-1
        LET w1=ban(cr_no,y,0)
        FOR x=0 TO hx-2 STEP 1
           LET ban(cr_no,y,x)=ban(cr_no,y,x+1)
        NEXT x
        LET ban(cr_no,y,hx-1)=w1
     NEXT y 
  END IF 
   
END SUB 


EXTERNAL SUB trans(ban(,,),hx,hy,mi,f)
!'        ***
  INPUT PROMPT "c1":c1
  INPUT PROMPT "c1":c2
   
  LET f0=0
  FOR y=0 TO hy-1
     FOR x=0 TO hx-1
        IF ban(c2,y,x)<>0 THEN LET f0=1
     NEXT x
  NEXT y
   
  IF (f0=0 AND f=0) OR f=1 THEN
     FOR y=0 TO hy-1
        FOR x=0 TO hx-1
         
           LET w=ban(c2,y,x)
            
           LET ban(c2,y,x)=ban(c1,y,x)
           IF f=1 THEN 
              LET ban(c1,y,x)=w
           END IF  
            
        NEXT x
     NEXT y
  END IF 
   
END SUB 

EXTERNAL SUB hanten(ban(,,),hx,hy,cr_no)
  FOR y=0 TO hy-1
     FOR x=0 TO INT( hx/2)-1
        LET ban(cr_no,y,hx-1-x)=ban(cr_no,y,x)
         
     NEXT x
  NEXT y
END SUB

EXTERNAL SUB hanten2(ban(,,),hx,hy,cr_no)
!'上下複写?
!'cmd jc                   ***
  FOR x=0 TO hx-1
     FOR y=0 TO INT( hy/2)-1
        LET ban(cr_no,hy-1-y,x)=ban(cr_no,y,x)
         
     NEXT y
  NEXT x
END SUB

EXTERNAL SUB jouge_hanten(ban(,,),hx,hy,cr_no)
!' 上下反転
!' cmd jh 
  FOR x=0 TO hx-1
     FOR y=0 TO hy/2-1
        LET w=ban(cr_no,hy-1-y,x)
        LET ban(cr_no,hy-y-1,x)=ban(cr_no,y,x) 
        LET ban(cr_no,y,x)=w
     NEXT y
  NEXT x
END SUB 

EXTERNAL SUB sayu_hanten(ban(,,),hx,hy,cr_no)
!' 左右反転
!' cmd sh 
  FOR y=0 TO hy-1
     FOR x=0 TO hx/2-1
        LET w=ban(cr_no,y,hx-1-x)
        LET ban(cr_no,y,hx-1-x)=ban(cr_no,y,x) 
        LET ban(cr_no,y,x)=w
     NEXT x
  NEXT y
END SUB 

EXTERNAL SUB mode_key(x,y,no)
  select CASE no
  CASE 4
     LET x=x-1
  case 6
     LET x=x+1
  case 2
     LET y=y+1
  case 8
     LET y=y-1
  case 1
     LET x=x-1
     LET y=y+1
  case 3
     LET x=x+1
     LET y=y+1
  case 7
     LET x=x-1
     LET y=y-1
  case 1
     LET x=x-1
     LET y=y+1
  CASE 9
     LET y=y-1
     LET x=x+1
  case else
  END SELECT
end sub

EXTERNAL SUB endshori(ban(,,),mi,hx,hy,file_name$)
  ASK DIRECTORY s$
  OPEN #1: NAME file_name$
  ERASE #1
  PRINT #1:mi 
  PRINT #1:hx
  PRINT #1:hy
  FOR k=0 TO mi-1
     FOR y=0 TO hy-1
        LET s$=STR$(ban(k,y,1))
        FOR x=0 TO hx-1
           PRINT #1: ban(k,y,x)
           PRINT USING " ##": ban(k,y,x);
        NEXT x
        PRINT
         
     NEXT y
  NEXT k
  PRINT #1:0
  CLOSE #1
   
END SUB 

EXTERNAL  SUB cls_s(ban(,,),hx,hy,cr_no)
!' クリアルーチン
!'cmd cls
  FOR  y=0 TO hy-1
     FOR x=0 TO hx-1
        LET ban(cr_no,y,x)=0
     NEXT x
  NEXT y
END SUB 

EXTERNAL SUB sinki_shori(ban(,,),mi,hx,hy,file_name$)
!'shiki file 32*32
  LET hx=32
  LET hy=32
  PRINT "hx=";hx;":hy=";hy
   
  LET mi=100
  PRINT "枚数:";mi
   
  INPUT prompt "ファイルネーム":f_name$
  ASK DIRECTORY s$
   
  LET file_name$=s$&"\"&f_name$&".txt"
  PRINT s$&"\"&f_name$&".txt"
   
  OPEN #1: NAME  file_name$
  ERASE #1
   
  PRINT #1:mi
  PRINT #1:hx
  PRINT #1:hy
  FOR k=1 TO mi-1
     FOR y=1 TO hy-1
        FOR x=1 TO hx-1
           PRINT #1: ban(k,y,x)
           PRINT USING " ##": ban(k,y,x);
        NEXT x
        PRINT
     NEXT y
  NEXT k
  PRINT #1:0
  CLOSE #1
END SUB 

EXTERNAL FUNCTION inkey_s$(void)
  CHARACTER INPUT nowait:s$
  LET inkey_s$=s$
END FUNCTION

EXTERNAL FUNCTION key_c(s$)
!'1-9:1-9
!'0:10
!'e:11
  LET no=POS("1234567890e.ctd 0:クリア",s$)
  LET key_c=no
END FUNCTION 

EXTERNAL SUB timer_s(回数)
  FOR i0=1 TO 回数
     LET a=a^a^a^a^a^a
  NEXT i0
END SUB 

EXTERNAL SUB box_s(x1,x2,y1,y2,cl)
  SET COLOR cl
  GRAPH AREA :x1,y1;x2,y1;x2,y2;x1,y2;x1,y1
END SUB

EXTERNAL SUB dotcolor_sub(color_d(,),cl)
  LET x1=color_d(1,1)
  LET x2=color_d(1,2)
  LET y1=color_d(2,1)
  LET y2=color_d(2,2)
  CALL box_s(x1,x2,y1,y2,cl)
END SUB 

EXTERNAL SUB juji_m(lx,ly,x,y,chaba,cl)
  CALL juji(lx,ly,x,y,chaba,0)  !'25=color
  CALL timer_s(20)
  CALL juji(lx,ly,x,y,chaba,1)
  CALL timer_s(20)
END SUB 


EXTERNAL SUB juji(lx,ly,x,y,chaba,c)
  SET COLOR c
  LET h2=chaba/2
  LET x1=lx+((x)*chaba )
  LET x2=lx+((x)*chaba+chaba )
  LET y1=ly+((y)*chaba )
  LET y2=ly+((y)*chaba+chaba )
   
  PLOT LINES :x1+h2,y1;x1+h2,y2
  PLOT LINES :x1,y1+h2;x2,y1+h2
END SUB 

EXTERNAL SUB shosai_box(lx,ly,x,y,chaba,cl)
  SET COLOR cl
  LET x1=lx+(x*chaba )
  LET x2=lx+(x*chaba+chaba )
  LET y1=ly+(y*chaba )
  LET y2=ly+(y*chaba+chaba )
  CALL box_s(x1,x2,y1,y2,cl)
END SUB 


EXTERNAL SUB line_s(x1,x2,y1,y2)
  PLOT LINES :x1,y1;x2,y1;x2,y2;x1,y2;x1,y1
END SUB 

EXTERNAL  SUB color_dis(void)
!'
!'   color  表示  0-255
!'
  CLEAR 
  LET sw_=120
  SET  WINDOW 0,sw_,sw_,0
  OPTION BASE 0
   
  DIM lxy(2)
  LET lxy(1)=5
  LET lxy(2)=5
   
  DIM xy(2)
  LET xy(1)=7
  LET xy(2)=7
  DIM iti(2)
  LET iti(1)=3
  LET iti(2)=3
  DIM step_(2)
  LET step_(1)=7
  LET step_(2)=7
  LET c=0
  LET yc=0
   
   
   
  FOR y=0 TO 15
   
     FOR x=0 TO 15
        LET y1=y*xy(1)
        LET y2=y*xy(1)+xy(1)-1
        LET x1=x*xy(2)
        LET x2=x*xy(2)+xy(2)-1
        CALL xyh(lxy,x1,x2,y1,y2) 
         
        CALL boxx(x1,x2,y1,y2,c)
        LET c=c+1
     NEXT x
     !' LET y1=y1+2
      
  NEXT y
   
  LET c=0
  FOR y=0 TO 15
   
     FOR x=0 TO 15
        LET y1=y*xy(1)
        LET y2=y*xy(1)+xy(1)-1
        LET x1=x*xy(2)
        LET x2=x*xy(2)+xy(2)-1
        CALL xyh(lxy,x1,x2,y1,y2) 
         
        CALL moji(x1,y1,c)
        LET c=c+1
     NEXT x 
      
  NEXT y
END SUB 

EXTERNAL SUB xyh(lxy(),x1,x2,y1,y2)
  LET x1=x1+lxy(2)
  LET x2=x2+lxy(2)
  LET y1=y1+lxy(1)
  LET y2=y2+lxy(1)
END SUB 

EXTERNAL SUB boxx(x1,x2,y1,y2,c)
  SET COLOR c
  PLOT AREA :x1,y1;x2,y1;x2,y2;x1,y2;x1,y1
END SUB 

EXTERNAL SUB moji(x1,y1,cno)
  SET TEXT HEIGHT 2.5
  SET COLOR 1
  LET s$= right$("  "&STR$(cno),3)
  PLOT TEXT ,AT x1,y1+3.0:s$
END SUB

EXTERNAL SUB paint_a(ban(,,),cr_no,hx,hy,x,y,cl,lx,ly,chaba)
  OPTION BASE 0
  DIM pw(hy,hx)
  DIM pw2(hy,hx)
  LET x1=x
  LET y1=y
  LET w1=x
  LET w2=y
  CALL ban_copy(pw,pw2,ban,cr_no,3,hx,hy)
  LET c0=cl
   
  CALL paint_(pw,hx,hy,x1,y1,c0,lx,ly,chaba)
  LET s$=""
  DO WHILE s$<>"y" AND s$<>"n"
     INPUT PROMPT "よろしいですか":s$
  LOOP
   
  IF s$="y" THEN CALL ban_copy(pw,pw2,ban,cr_no,4,hx,hy)
  IF s$="n" THEN CALL ban_copy(pw,pw2,ban,cr_no,8,hx,hy)
   
  !'データ戻し
  LET x=w1
  LET y=w2
   
END SUB 

EXTERNAL SUB ban_copy(pw(,),pw2(,),ban(,,),cr_no,f,hx,hy)
  FOR y=0 TO hy-1
     FOR x=0 TO hx-1         
        IF MOD(f,2)=1  THEN LET pw(y,x)       =ban(cr_no,y,x)
        IF INT(f/2)=1  THEN LET pw2(y,x)      =ban(cr_no,y,x)
        IF INT(f/4)=1  THEN LET ban(cr_no,y,x)=pw(y,x)
        IF INT(f/8)=1  THEN LET ban(cr_no,y,x)=pw2(y,x)
     NEXT x
  NEXT y
END SUB 


EXTERNAL SUB paint_(pw(,),hx,hy,x1,y1,c0,lx,ly,chaba)

  OPTION BASE 0
  DIM xy(320000,2)
  LET ss=1     !'xy counter
   
   
   
  LET c1=pw(y1,x1)
   
   
  PRINT x1;y1;c0,c1
   
  CALL paint_sub_nuru(pw,xy,x1,y1,c0,c1,ss,hx,hy,lx,ly,chaba)
  LET c=1
  DO WHILE c<>ss
     LET x1=xy(c,0)
     LET y1=xy(c,1)
     CALL paint_sub_nuru(pw,xy,x1,y1,c0,c1,ss,hx,hy,lx,ly,chaba)
     LET c=c+1
  LOOP 
   
END SUB 

EXTERNAL SUB paint_sub_nuru(pw(,),xy(,),x1,y1,c0,c1,ss,hx,hy,lx,ly,chaba)
  LET hogox=x1
  FOR s=-1 TO 1 STEP 2
     DO WHILE pw(y1,x1)=c1 AND x1=>0 AND x1<hx
        CALL jouge(pw,xy,x1,y1,ss,c1,hy)
        LET pw(y1,x1)=c0
        LET x=x1
        LET y=y1
        CALL shosai_box(lx,ly,x,y,chaba,c0)
        !'   CALL timer_s(2500) 
        IF x1+s<>-1 AND x1+s<hx THEN LET x1=x1+s    
     LOOP
     LET x1=hogox+1
  NEXT s
   
END SUB 


EXTERNAL SUB jouge(pw(,),xy(,),x1,y1,ss,c1,hy)

  FOR s=-1 TO 1 STEP 2
     IF y1+s=>0 AND y1+s<hy THEN
        IF pw(y1+s,x1)=c1 THEN 
           LET xy(ss,0)=x1
           LET xy(ss,1)=y1+s
           LET ss=ss+1
           PRINT x1;y1+s
        END IF
     END IF 
  NEXT s 
   
END SUB


EXTERNAL SUB chr_hyo(ban(,,),hx,hy)
  SET WINDOW 0,hx*11,hx*11,0
  LET no=0
  IF hx=256 THEN 
     LET mx=4
  ELSE 
     LET mx=9
  END IF
   
  FOR y=0 TO mx
     FOR x=0 TO mx
        LET x1=x*hx
        LET y1=y*hy
        SET COLOR 3
        SET TEXT HEIGHT hy/2
         
        CALL chr_dis(ban,hx,hy,no,x1,y1)
        PLOT TEXT ,AT x1,y1+hy:STR$(no) 
        LET no=no+1
     NEXT x
      
  NEXT y  
   
END SUB 

EXTERNAL SUB chr_dis(ban(,,),hx,hy,no,x1,y1)
  OPTION BASE 0
  DIM chr_(hx,hy)
  FOR y=0 TO hy-1
     FOR x=0 TO hx-1
        LET chr_(x,y)=ban(no,y,x)
     NEXT x
  NEXT y
   
  MAT PLOT CELLS,IN x1,y1;x1+hx-1,y1+hy-1:chr_
  !'  PRINT hx;hy
  !' stop    
END SUB 

いいなと思ったら応援しよう!