http://antares.cn/hsp/sample/index.html#tournament より。
http://antares.cn/hsp/sample/index.html#tournament より。
;#ifdef __hsp30__#define objselstr(%1,%2,%3) vvv=%3: sendmsg objinfo(%1,2),177,%2,varptr(vvv)#define getact(%1) %1=ginfo_act#else#define ginfo_dispx dispx#define ginfo_dispy dispy#define objselstr(%1,%2,%3) vvv=%3: objsend %1,177,%2,vvv,1#define getact(%1) ginfo 1: %1=prmx#endiffsize=8pos 4,8: mes "チーム数:"pos 88,4: input nteampos 4,32: button "表示", *l_dispobjsel 0: objselstr 0,0,-1*l_looprepeat: wait 10getact actif act==0 {stick key,,1if key==32:break}if act!=act2 {if act==0 {gsel 0objsel 0c=-1objselstr 0,0,-1}act2=act}loop*l_dispif nteam<2: dialog "チーム数は2以上にしてください。": goto *l_loopbeki=1nbeki=0repeatbeki=beki*2nbeki++if beki>=nteam: breakloopmarg=4w2=fsize+margwid=beki*w2if wid<128: wid=128 ;HSPのバグ回避heit=(nbeki+1)*16if wid>ginfo_dispx {screen 2,wid,heit,,0,(ginfo_dispy-heit)/2,ginfo_dispx-6,heit} else {screen 2,wid,heit,,(ginfo_dispx-wid)/2,(ginfo_dispy-heit)/2}fusen=beki-nteamfusen2=fusennw=bekibk=1iv=0y=0ww=nw*w2-margrepeat nbeki;縦線gosub *l_vertnw=nw/2ww=nw*w2-marg;横線gosub *l_horbk=bk*2iv++y+=16loop;縦線gosub *l_vert2goto *l_loop;縦線*l_vertx=ww/2repeat bkline x,y,x,y+15x+=nw*w2loopreturn;縦線2*l_vert2x=ww/2repeat bkif cnt\2 { ;奇数のときif fusen<1 {line x,y,x,y+15} else {c=fsize/2line x-c-2,y-1,x-c-2,y+15fusen--}} else { ;偶数のときif fusen<1 {line x,y,x,y+15}}x+=nw*w2loopreturn;横線*l_horx=ww/2-1repeat bkif nw>1 | (fusen2<1) {line x,y+16,nw*w2+x+1,y+16}if nw==1: if fusen2: fusen2--x+=nw*w2*2loopreturn