Home » Archimedes archive » Acorn User » AU 1998-06 A.adf » Regulars » StarInfo/Hampton/!NetReact/!RunImage

StarInfo/Hampton/!NetReact/!RunImage

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Acorn User » AU 1998-06 A.adf » Regulars
Filename: StarInfo/Hampton/!NetReact/!RunImage
Read OK:
File size: 42CD bytes
Load address: 0000
Exec address: 0000
File contents
    1REM ><NetReact$Dir>.!RunImage
    2REM NetReaction
    3REM By Robert Hampton / FABsoft
    4REM NetGame is (C) Justin Fletcher
    5REM This version has better redraw!
    6testing%=FALSE
    7LIBRARY "<BasicLibrary$File>":PROCinitlibrary
    8LIBRARY "<HeapLibrary$File>":PROCinitheap
    9LIBRARY "<NetGameLibrary$File>"
   10ON ERROR PROCclosemessages:PROCeerror:IF testing%=TRUE THEN OSCLI("Spool"):END ELSE END
   11IF testing%=TRUE THEN*Spool Spooled
   12IF testing%=TRUE THEN TRACE ON
   13REM Appname$ is used for task manager & Appname$Dir
   14REM shortname$ is used for iconbar name and should usually be null
   15REM longname$ is used for info window
   16REM AppURL$ is used to for clicks on the version icon
   17Appname$="NetReact":version$="0.52 (27 Feb 1998)"
   18shortname$="":longname$="Reaction"
   19Appdir$=FNsystemvar(Appname$+"$Dir")
   20AppURL$="http://come.to/fabland/fabsoft/netreact.html"
   21PROCinitwimp:PROCinitprog
   22quit%=FALSE:init%=FALSE
   23ON ERROR PROCerror
   24IF NOT init% THEN
   25 go$=FNGetEnv:init%=TRUE
   26 IF go$<>"" THEN PROCloadfile(go$,FNfiletype(go$))
   27ENDIF
   28WHILE quit%=FALSE
   29 PROCPoll
   30ENDWHILE
   31SYS "Wimp_CloseDown"
   32PROCclosemessages
   33PROCnetgame_final
   34IF testing%=TRUE THEN*SPOOL
   35END
   36REM quit%=-1 for user quit, -2 for taskmanager quit
   37:
   38DEF PROCPoll
   39SYS "OS_ReadMonotonicTime" TO t%
   40SYS "Wimp_Poll",0,b%TO reason%
   41CASE reason% OF
   42 WHEN 0:REM Null poll
   43  PROCnetgame_poll:REM Check if there is something to do
   44    IF checking%=TRUE THEN PROCcheck_board
   45 WHEN 1:PROCredrawwindow(b%):REM 1 = Redraw window
   46 WHEN 2:SYS "Wimp_OpenWindow",,b%
   47 WHEN 3:SYS "Wimp_CloseWindow",,b%
   48 WHEN 6:PROCmouseclick(b%!0,b%!4,b%!8,b%!12,b%!16)
   49 REM 7 = Drag box dropped on another task
   50 WHEN 8:PROCprocesskey(b%!0,b%!4,b%!24)
   51 WHEN 9:PROCmenuchoice
   52 WHEN 17,18:PROCreceive(b%!16)
   53 WHEN 19:PROCreceiveack(b%!16)
   54ENDCASE
   55ENDPROC
   56:
   57DEF PROCredrawwindow(b%)
   58LOCAL x0%,y0%,x1%,y1%,scx%,scy%,bx%,by%,lx%,ly%,c%,sprite$
   59
   60IF b%!0=boardwin% THEN
   61 SYS "Wimp_RedrawWindow",,b% TO more%
   62   PROCdraw_board(b%,more%)
   63ENDIF
   64ENDPROC
   65:
   66REM The whole redraw routine is sort of fixed.
   67DEF PROCdraw_board(b%,m%)
   68LOCAL lx%,ly%
   69WHILE m%
   70  PROCvars(b%)
   71  PROCcoord_realtowin(boardwin%,redraw_minx%,redraw_miny%)
   72  PROCcoord_realtowin(boardwin%,redraw_maxx%,redraw_maxy%)
   73  FOR lx%=0 TO 7
   74   IF (lx%/2)=INT(lx%/2) THEN c%=1 ELSE c%=2
   75   FOR ly%=0 TO 7
   76    c%+=1:IF c%>2 THEN c%=1
   77    IF FNcoord_rec_overlap(lx%*100-4,-ly%*100-4,lx%*100+104,-ly%*100-104,redraw_minx%,redraw_miny%,redraw_maxx%,redraw_maxy%) THEN
   78     PROCsprite_plot("c"+STR$(c%)+"back",bx%+boardleft%+(lx%)*100,by%+boardtop%-(ly%+1)*100)
   79     IF boardcounter%(lx%,ly%)>0 AND boardcounter%(lx%,ly%)<5 THEN
   80       PROCsprite_plot("c"+STR$(boardcounter%(lx%,ly%))+col$(boardcolour%(lx%,ly%)),bx%+boardleft%+(lx%)*100,by%+boardtop%-(ly%+1)*100)
   81     ENDIF
   82     IF bangx%=lx% AND bangy%=ly% THEN
   83       PROCsprite_plot("explosion",bx%+boardleft%+(bangx%)*100,by%+boardtop%-(bangy%+1)*100)
   84     ENDIF
   85    ENDIF
   86   NEXT ly%
   87  NEXT lx%
   88  SYS "Wimp_GetRectangle",,b% TO m%
   89ENDWHILE
   90
   91ENDPROC
   92:
   93DEF PROCsprite_plot(sprite$,x%,y%)
   94IF (x%>x0%-100 AND x%<x1%+100) AND (y%>y0%-100 AND y%<y1%+100) THEN
   95  SYS "Wimp_ReadPixTrans",&100,sprites%,sprite$,,,,sscale%,strans%
   96  SYS "OS_SpriteOp",308,sprites%,sprite$,x%,y%,8,sscale%,strans%
   97ENDIF
   98ENDPROC
   99:
  100DEF PROCboardclick(xpos%,ypos%)
  101LOCAL sx%,sy%
  102IF checking%=FALSE THEN
  103  PROCscreentowin(boardwin%,xpos%,ypos%)
  104  sx%=xpos% DIV 100
  105  IF sx%>7 THEN sx%=7
  106  IF sx%<0 THEN sx%=0
  107  sy%=-ypos% DIV 100
  108  IF sy%>7 THEN sy%=7
  109  IF sy%<0 THEN sy%=0
  110  PROCplacecounter(sx%,sy%)
  111ENDIF
  112ENDPROC
  113:
  114DEF PROCplacecounter(sx%,sy%)
  115IF boardcolour%(sx%,sy%)=player% OR boardcolour%(sx%,sy%)=-1 THEN
  116  boardcolour%(sx%,sy%)=player%
  117  boardcounter%(sx%,sy%)+=1
  118  PROCupdatesquare(sx%,sy%)
  119  SOUND 3,-15,&7000,0
  120  checking%=TRUE:turns%+=1
  121  IF player%=us% THEN
  122    PROCnetgame_send("G"+STR$(sx%)+STR$(sy%))
  123  ENDIF
  124ENDIF
  125ENDPROC
  126:
  127DEF PROCcheck_board
  128LOCAL lx%,ly%
  129checking%=FALSE
  130FOR lx%=0 TO 7:FOR ly%=0 TO 7
  131  IF boardcounter%(lx%,ly%)>boardmaxno%(lx%,ly%) THEN
  132    boardcounter%(lx%,ly%)=0:boardcolour%(lx%,ly%)=-1
  133    PROCbang(lx%,ly%)
  134    PROCupdatesquare(lx%,ly%)
  135    IF lx%>0 THEN
  136      boardcounter%(lx%-1,ly%)+=1
  137      boardcolour%(lx%-1,ly%)=player%
  138      PROCupdatesquare(lx%-1,ly%)
  139      checking%=TRUE
  140    ENDIF
  141    IF lx%<7 THEN
  142       boardcounter%(lx%+1,ly%)+=1
  143      boardcolour%(lx%+1,ly%)=player%
  144      PROCupdatesquare(lx%+1,ly%)
  145      checking%=TRUE
  146    ENDIF
  147    IF ly%>0 THEN
  148      boardcounter%(lx%,ly%-1)+=1
  149      boardcolour%(lx%,ly%-1)=player%
  150      PROCupdatesquare(lx%,ly%-1)
  151      checking%=TRUE
  152    ENDIF
  153    IF ly%<7 THEN
  154      boardcounter%(lx%,ly%+1)+=1
  155      boardcolour%(lx%,ly%+1)=player%
  156      PROCupdatesquare(lx%,ly%+1)
  157      checking%=TRUE
  158    ENDIF
  159  ENDIF
  160IF checking%=TRUE THEN ly%=7:lx%=7:REM very bad form!
  161NEXT ly%:NEXT lx%
  162IF checking%=FALSE THEN
  163  IF player%=pblue% THEN player%=pgreen% ELSE player%=pblue%
  164  PROCbangclear:PROCcount
  165  PROCupdatetitle
  166ENDIF
  167ENDPROC
  168:
  169DEF PROCcount
  170LOCAL lx%,ly%
  171pbluesc%=0:pgreensc%=0
  172FOR lx%=0 TO 7:FOR ly%=0 TO 7
  173  IF boardcolour%(lx%,ly%)=pblue% THEN pbluesc%+=boardcounter%(lx%,ly%)
  174  IF boardcolour%(lx%,ly%)=pgreen% THEN pgreensc%+=boardcounter%(lx%,ly%)
  175NEXT ly%:NEXT lx%
  176IF pbluesc%=0 AND turns%>1 THEN pwon%=pgreen%
  177IF pgreensc%=0 AND turns%>1 THEN pwon%=pblue%
  178PROCseticontext(boardwin%,5,STR$(pbluesc%))
  179PROCseticontext(boardwin%,7,STR$(pgreensc%))
  180IF pwon%<>-1 THEN PROCgameover
  181ENDPROC
  182:
  183DEF PROCgameover
  184LOCAL dummy%
  185IF pwon%=us% THEN
  186  dummy%=FNerrorbox(">Message",">WinUs",%10001)
  187ELSE
  188  dummy%=FNerrorbox(">Message",">WinThem",%10001)
  189ENDIF
  190ENDPROC
  191
  192ENDPROC
  193:
  194DEF PROCbang(sx%,sy%)
  195PROCbangclear
  196bangx%=sx%:bangy%=sy%
  197PROCupdatesquare(bangx%,bangy%)
  198SOUND 2,-15,&3500,0
  199ENDPROC
  200:
  201DEF PROCbangclear
  202LOCAL tempx%,tempy%
  203tempx%=bangx%:tempy%=bangy%
  204bangx%=-1:bangy%=-1
  205PROCupdatesquare(tempx%,tempy%)
  206ENDPROC
  207:
  208DEF PROCboard_clear(notify%)
  209LOCAL sx%,sy%
  210FOR sx%=0 TO 7
  211  FOR sy%=0 TO 7
  212    boardcounter%(sx%,sy%)=0:boardcolour%(sx%,sy%)=-1
  213    PROCredrawicon(boardwin%,3)
  214  NEXT sy%
  215NEXT sx%
  216turns%=0:pbluesc%=0:pgreensc%=0:player%=pblue%:pwon%=-1
  217PROCseticontext(boardwin%,5,STR$(pbluesc%))
  218PROCseticontext(boardwin%,7,STR$(pgreensc%))
  219PROCupdatetitle
  220IF notify%=TRUE THEN
  221  PROCnetgame_send("C")
  222ENDIF
  223ENDPROC
  224:
  225DEF PROCupdatetitle
  226IF pwon%=-1 THEN
  227  IF player%=us% THEN
  228    PROCwindowtitle(boardwin%,">Us:"+col$(player%))
  229  ELSE
  230    PROCwindowtitle(boardwin%,">Them:"+col$(player%))
  231  ENDIF
  232ELSE
  233  IF pwon%=us% THEN
  234    PROCwindowtitle(boardwin%,">WinUs")
  235  ELSE
  236    PROCwindowtitle(boardwin%,">WinThem")
  237  ENDIF
  238ENDIF
  239ENDPROC
  240:
  241DEF PROCupdatesquare(sx%,sy%)
  242LOCAL left%,top%,right%,bottom%,more%
  243left%=boardleft%+sx%*100
  244top%=boardtop%-sy%*100
  245right%=left%+100
  246bottom%=top%-100
  247b%!0=boardwin%
  248b%!4=left%:b%!8=bottom%
  249b%!12=right%:b%!16=top%
  250SYS "Wimp_UpdateWindow",,b% TO more%
  251PROCdraw_board(b%,more%)
  252ENDPROC
  253:
  254DEF PROCvars(B%)
  255x0%=B%!4:y0%=B%!8:x1%=B%!12:y1%=B%!16:scx%=B%!20:scy%=B%!24
  256bx%=x0%-scx%:by%=y1%-scy%
  257redraw_minx%=B%!28
  258redraw_miny%=B%!32
  259redraw_maxx%=B%!36
  260redraw_maxy%=B%!40
  261ENDPROC
  262:
  263REM Buttons : 1 = Adjust, 2 = Menu, 4 = Select
  264DEF PROCmouseclick(x,y,but,win,icon)
  265CASE win OF
  266 WHEN -2
  267  CASE but OF
  268  WHEN 2:PROCibmenu
  269   WHEN 1,4:REM Select or adjust
  270    IF FNnetgame_connected THEN
  271      PROCopenwin(boardwin%)
  272    ELSE
  273      PROCopenconnect:REM Open the connect window
  274    ENDIF
  275  ENDCASE
  276 WHEN boardwin%
  277  CASE icon OF
  278   WHEN -1:IF but=2 THEN PROCmenu(boardmenu%,-1,0)
  279   WHEN 0:PROCboard_clear(TRUE)
  280   WHEN 1:IF but=1 OR but=4 THEN PROCopenwin(sendwin%)
  281   WHEN 2:IF but=1 OR but=4 THEN PROCdisconnect
  282   WHEN 3:IF but=2 THEN PROCmenu(boardmenu%,-1,0)
  283          IF but=4 AND FNnetgame_connected THEN
  284            IF pwon%=-1 AND player%=us% THEN PROCboardclick(x,y)
  285          ENDIF
  286  ENDCASE
  287 WHEN infobox%
  288  CASE icon OF
  289   WHEN 1:IF testing%=TRUE THEN PROCshowfree
  290   WHEN 3:PROCFetchPage("http://come.to/fabland/fabsoft/")
  291   WHEN 4:PROCFetchPage(AppURL$)
  292  ENDCASE
  293 WHEN connectwin%
  294  CASE icon OF
  295   WHEN 5:PROCmenu(FNnetgame_sitesmenu,-1,-1):REM Sites list
  296   WHEN 4:PROCtryconnect
  297  ENDCASE
  298 WHEN sendwin%
  299  CASE icon OF
  300   WHEN 2:REM Cancel - clear text and close
  301    PROCseticontext(sendwin%,0,"")
  302    PROCclosewin(sendwin%)
  303   WHEN 1:REM Send
  304    PROCsendmessage
  305  ENDCASE
  306 WHEN msgwin%
  307  CASE icon OF
  308   WHEN 2:REM Reply
  309    PROCopenreply
  310   WHEN 1:REM Ok
  311    PROCclosewin(win)
  312  ENDCASE
  313 WHEN boardwin%
  314  CASE icon OF
  315   WHEN 1:REM Message
  316    PROCopenwin(sendwin%)
  317    PROCsetcaretend(sendwin%,0)
  318   ENDCASE
  319ENDCASE
  320ENDPROC
  321:
  322DEF PROCgreyouticons_cos_disconnected
  323PROCiconshade(boardwin%,0,1)
  324PROCiconshade(boardwin%,1,1)
  325REM and menus too!
  326PROCmenushade(boardmenu%,1,1)
  327PROCmenushade(boardmenu%,2,1)
  328ENDPROC
  329:
  330DEF PROCungreyouticons_cos_connected
  331PROCiconshade(boardwin%,0,0)
  332PROCiconshade(boardwin%,1,0)
  333REM and menus too!
  334PROCmenushade(boardmenu%,1,0)
  335PROCmenushade(boardmenu%,2,0)
  336ENDPROC
  337:
  338DEF PROCprocesskey(win,icon,key)
  339LOCAL keydone:keydone=FALSE
  340CASE win OF
  341 WHEN connectwin%
  342  CASE key OF
  343   WHEN 27:REM Escape - close window
  344    PROCclosewin(connectwin%)
  345   WHEN 13:REM Return
  346    PROCtryconnect:keydone=TRUE
  347  ENDCASE
  348 WHEN sendwin%
  349  CASE key OF
  350   WHEN 27:REM Escape - close window
  351    PROCclosewin(sendwin%):keydone=TRUE
  352   WHEN 13:REM Return
  353    PROCsendmessage:keydone=TRUE
  354  ENDCASE
  355ENDCASE
  356IF NOT keydone THEN SYS "Wimp_ProcessKey",key
  357ENDPROC
  358:
  359DEF PROCmenuchoice
  360SYS"Wimp_GetPointerInfo",,message_buffer%:mbut%=message_buffer%!8
  361CASE curmenu% OF
  362 WHEN FNnetgame_sitesmenu:REM The sites menu, so select it
  363  PROCnetgame_selectsite(!b%,connectwin%,1,3,-1)
  364  curmenu%=FNnetgame_sitesmenu:REM In case it's been re-created
  365 WHEN ibmenu%
  366  CASE !b% OF
  367   WHEN 2:quit%=TRUE
  368   WHEN 1:PROCnetgame_editsites(bestport%):REM Editing time
  369  ENDCASE
  370 WHEN boardmenu%
  371  CASE !b% OF
  372   WHEN 2:PROCdisconnect
  373   WHEN 1:PROCboard_clear(TRUE):REM tell them
  374  ENDCASE
  375ENDCASE
  376IF (mbut%AND1)=1 THEN PROCrecreatemenu ELSE curmenu%=-1
  377ENDPROC
  378:
  379DEF PROCdisconnect
  380PROCgreyouticons_cos_disconnected
  381PROCnetgame_disconnect
  382PROCupdatetitle
  383ENDPROC
  384:
  385DEF PROCreceive(mess)
  386CASE mess OF
  387 REM &400C1 = mode change
  388 REM &400C2 = task start up
  389 REM &400C3 = task shut down
  390 WHEN &90281:REM Sites file has been updated
  391  PROCnetgame_readsites
  392 WHEN 0:quit%=TRUE*2
  393 WHEN &502:PROCHelp(b%!32,b%!36,b%!4)
  394 WHEN 10:PROCdesktopsave(b%!20)
  395ENDCASE
  396ENDPROC
  397:
  398DEF PROCreceiveack(mess)
  399CASE mess OF
  400ENDCASE
  401ENDPROC
  402:
  403DEF PROCdesktopsave(file%)
  404LOCAL ERROR
  405ON ERROR LOCAL b%!12=b%!8:SYS "Wimp_SendMessage",19,b%,b%!4:RESTORE ERROR:ENDPROC
  406REM The above line acknowledges the message if an error occurs
  407REM aborting the desktop save.
  408BPUT#file%,"Run "+Appdir$
  409ENDPROC
  410:
  411DEF PROCloadfile(file$,type)
  412CASE type OF
  413ENDCASE
  414ENDPROC
  415:
  416REM Any messages to be received MUST be noted
  417DEF PROCinitwimp
  418DIM messagelist% 256:messptr%=0
  419PROCnotemessage(&502):PROCnotemessage(10):PROCnotemessage(&90281)
  420PROCnotemessage(0)
  421SYS "Wimp_Initialise",310,&4B534154,Appname$,messagelist% TO wimpversion,taskhandle
  422indl%=1024:menul%=1024:DIM b% 2048,ind% indl%,menu% menul%,wspc% &800
  423curmenu%=-1
  424PROCopenmessages
  425sprites%=FNloadsprites(Appdir$+".Sprites")
  426infobox%=FNloadtemplate("Info",1)
  427connectwin%=FNloadtemplate("connect",1)
  428sendwin%=FNloadtemplate("send",1)
  429msgwin%=FNloadtemplate("message",1)
  430boardwin%=FNloadtemplate("Board",1)
  431b%!0=boardwin%:b%!4=3
  432SYS "Wimp_GetIconState",,b%
  433boardleft%=(b%!8)+4:boardtop%=(b%!20)-4
  434PROCseticontext(infobox%,1,Appname$)
  435PROCseticontext(infobox%,2,longname$+" (port xxxx)")
  436PROCseticontext(infobox%,4,version$)
  437ibhandle=FNCreateIconBarIcon("!"+Appname$,shortname$,1)
  438ibmenu%=FNcreatemenu(Appname$+"|Info]>infobox%|Sites...|Quit")
  439boardmenu%=FNcreatemenu(Appname$+"|Info]>infobox%|Clear Board|Disconnect")
  440iboptions%=options%
  441ENDPROC
  442:
  443DEF PROCinitprog
  444LOCAL x%,y%
  445REM Initialise the network game library
  446REM bestport% is the port we listen on by default
  447bestport%=4000
  448port=FNnetgame_init(bestport%):REM Port number
  449REM Ensure that everything went ok
  450IF port=-1 THEN
  451 reply=FNerrorbox(">Message",">CouldntInit",%10001)
  452 SYS "Wimp_CloseDown"
  453 PROCclosemessages
  454 END
  455ELSE
  456 PROCseticontext(infobox%,2,">Info:"+STR$ port)
  457ENDIF
  458REM Mark the correct site in the connect window
  459PROCseticontext(connectwin%,3,STR$ port)
  460REM Read the sites from the file
  461PROCnetgame_readsites
  462DIM sscale% 16:DIM strans% 16:REM for Wimp_ReadPixTrans call
  463DIM wins%(1),boardcounter%(7,7),boardcolour%(7,7),col$(1)
  464boardcolour%()=-1:checking%=FALSE
  465DIM boardmaxno%(7,7)
  466FOR x%=0 TO 7
  467  FOR y%=0 TO 7
  468    boardmaxno%(x%,y%)=3
  469    IF x%*y%=0 THEN boardmaxno%(x%,y%)=2
  470    IF x%=7 THEN boardmaxno%(x%,y%)=2
  471    IF y%=7 THEN boardmaxno%(x%,y%)=2
  472    IF x%=0 AND y%=0 THEN boardmaxno%(x%,y%)=1
  473    IF x%=0 AND y%=7 THEN boardmaxno%(x%,y%)=1
  474    IF x%=7 AND y%=0 THEN boardmaxno%(x%,y%)=1
  475    IF x%=7 AND y%=7 THEN boardmaxno%(x%,y%)=1
  476  NEXT
  477NEXT
  478pblue%=0:pgreen%=1:col$()="blue","green":player%=pblue%
  479bangx%=-1:bangy%=-1:pbluesc%=0:pgreensc%=0:pwon%=-1:turns%=0
  480REM load sound samples
  481VOICES 4
  482*ChannelVoice 2 ReactBang
  483*ChannelVoice 3 ReactPlip
  484ENDPROC
  485:
  486DEF PROCHelp(win,icon,to)
  487RESTORE +1:PROCreadhelp(win,icon,to)
  488ENDPROC
  489REM Windows
  490DATA infobox%,">HInfobox"
  491DATA 3,">HInfobox3"
  492DATA 4,">HInfobox4"
  493DATA sendwin%,">HSendwin"
  494DATA 2,">HSCancel"
  495DATA 3,">HSSend"
  496DATA msgwin%,">HMsgwin"
  497DATA 2,">HReply"
  498DATA 1,">HOk"
  499DATA connectwin%,">HConnectwin"
  500DATA 4,">HCOk"
  501DATA boardwin%,">HBoardwin"
  502DATA 0,">HBWDisconnect"
  503DATA 1,">HBWMessage"
  504DATA 3,">HBWBoard"
  505DATA 5,">HBWBlue"
  506DATA 7,">HBWGreen"
  507DATA -2,">HIconbar"
  508DATA -1,-1
  509REM Menus
  510DATA ibmenu%,-1,-1,-1
  511DATA 0,-1,-1,">HMInfo"
  512DATA 1,-1,-1,">HMSites"
  513DATA 2,-1,-1,">HMQuit"
  514DATA boardmenu%,-1,-1,-1
  515DATA 0,-1,-1,">HMInfo"
  516DATA 1,-1,-1,">HMClear"
  517DATA 2,-1,-1,">HMDisconnect"
  518DATA -2,-2,-2,-2
  519:
  520DEF PROCFetchPage(f$)
  521REM XURI_Dispatch - this protocol is still being decided !
  522SYS &6E381,%000,f$+CHR$0
  523ENDPROC
  524:
  525REM ******************** NetGame routines ******************
  526:
  527REM They've gone, so we'd better tell them
  528DEF PROCdisconnected(type)
  529LOCAL reply
  530CASE type OF
  531 WHEN ngs_dead:REM Bad little boy, dropped connection
  532  reply=FNerrorbox(">Message",">Closed",%10001)
  533 WHEN ngs_going:REM Mr Flibble says 'Game Over', boys
  534  reply=FNerrorbox(">Message",">GameOver",%10001)
  535 WHEN ngs_failed:REM Couldn't get a connection
  536  reply=FNerrorbox(">Message",">NoConnect",%10001)
  537  PROCopenconnect
  538ENDCASE
  539theirhost$=""
  540PROCgreyouticons_cos_disconnected
  541ENDPROC
  542:
  543REM We've got a connection
  544REM type = ngs_originate if we connected to them
  545REM ngs_answer if they connected to us
  546DEF PROCconnected(host$,type)
  547theirhost$=host$
  548IF type=ngs_originate THEN
  549  us%=pblue%:them%=pgreen%:REM we initiated connection, we go 1st
  550ELSE
  551  us%=pgreen%:them%=pblue%:REM they initiated connection, them 1st
  552ENDIF
  553player%=pblue%:REM blue always goes first
  554PROCboard_clear(FALSE):REM don't tell them
  555PROCclosewin(connectwin%):REM Close the connect window
  556REM We should open a window or something
  557PROCungreyouticons_cos_connected
  558PROCopenwin(boardwin%)
  559ENDPROC
  560:
  561REM Message has arrived from them - try not to create a loop
  562REM 'cos that is kinda silly...
  563DEF PROCincoming(msg$)
  564REM If it's a user message we should put it in the message window
  565REM with PROCgotmessage(msg$), otherwise it's a 'go' so we need
  566REM to process it
  567IF LEFT$(msg$,1)="M" THEN
  568  PROCgotmessage(MID$(msg$,2))
  569ENDIF
  570IF LEFT$(msg$,1)="G" THEN
  571  REM G = Go - Player has placed a counter
  572  REM If we get a message and it's our go then they're cheating!
  573  IF player%=us% AND checking%=FALSE THEN
  574    PROCdisconnect
  575    theirhost$=""
  576  ENDIF
  577  REM If we're still checking then finish PDQ!
  578  WHILE checking%=TRUE:PROCcheck_board:ENDWHILE
  579  x%=VAL(MID$(msg$,2,1)):y%=VAL(MID$(msg$,3,1))
  580  PROCplacecounter(x%,y%)
  581ENDIF
  582IF LEFT$(msg$,1)="C" THEN
  583  PROCboard_clear(FALSE):REM don't tell them: They already know!
  584ENDIF
  585ENDPROC
  586:
  587REM ********************** Other routines **********************
  588:
  589REM Attempt a connection using the 'connect' window as host
  590DEF PROCtryconnect
  591LOCAL host$,port
  592host$=FNgeticontext(connectwin%,1):REM Read the host
  593IF host$="" THEN ENDPROC
  594REM Read the service number
  595port=FNinet_getservbyname(FNgeticontext(connectwin%,3),"tcp")
  596REM Now do the connection
  597ok=FNnetgame_connect(host$,port)
  598IF NOT ok THEN
  599 REM We couldn't connect so tell them
  600 reply=FNerrorbox(">Message",">NoConnect",%10001)
  601ELSE
  602 PROCclosewin(connectwin%)
  603ENDIF
  604ENDPROC
  605:
  606REM We've got a message from them so lets stick it on the screen
  607DEF PROCgotmessage(msg$)
  608PROCseticontext(msgwin%,0,LEFT$(msg$,39)):REM Fit it to the icon
  609PROCopenwin(msgwin%):REM Open the window
  610ENDPROC
  611:
  612REM Send the message in the 'send' window
  613DEF PROCsendmessage
  614LOCAL a$:a$=FNgeticontext(sendwin%,0)
  615REM Send the message
  616REM You need to put some code here :
  617REM like PROCnetgame_send(a$)
  618REM Clear the text and close the window
  619PROCnetgame_send("M"+a$)
  620PROCseticontext(sendwin%,0,"")
  621PROCclosewin(sendwin%)
  622ENDPROC
  623:
  624REM Open the 'connect' window
  625DEF PROCopenconnect
  626PROCopenwincentre(connectwin%)
  627PROCsetcaretend(connectwin%,1)
  628ENDPROC
  629:
  630REM Open the 'reply' window
  631DEF PROCopenreply
  632PROCclosewin(msgwin%)
  633PROCopenwin(sendwin%)
  634PROCsetcaretend(sendwin%,0)
  635ENDPROC
  636
  637DEF PROCscreentowin(window%,RETURN x%,RETURN y%)
  638!b%=window%:SYS &400CB,,b%
  639x%=x%+b%!20-b%!4:y%=y%+b%!24-b%!16
  640ENDPROC
  641
  642REM ---- BLIbII ----
  643DEF FNcoord_rec_overlap(x%,y%,X%,Y%,a%,b%,A%,B%)
  644IF x%<a% AND X%<a% THEN =FALSE
  645IF x%>A% AND X%>A% THEN =FALSE
  646IF y%<b% AND Y%<b% THEN =FALSE
  647IF y%>B% AND Y%>B% THEN =FALSE
  648=TRUE
  649
  650DEF PROCcoord_realtowin(W%,RETURN X%,RETURN Y%)
  651LOCAL B%:B%=b%
  652!B%=W%:SYS &400CB,,B%
  653X%=X%+B%!20-B%!4:Y%=Y%+B%!24-B%!16
  654ENDPROC
  655
  656DEF PROCcoord_wintoreal(W%,RETURN X%,RETURN Y%)
  657LOCAL B%:B%=b%
  658!B%=W%:SYS &400CB,,B%
  659X%=X%-B%!20+B%!4:Y%=B%!16-B%!24+Y%
  660ENDPROC
  661
� ><NetReact$Dir>.!RunImage
� NetReaction
!� By Robert Hampton / FABsoft
$� NetGame is (C) Justin Fletcher
%� This version has better redraw!
testing%=�
)ț "<BasicLibrary$File>":�initlibrary
%ț "<HeapLibrary$File>":�initheap
	ț "<NetGameLibrary$File>"

>� � �closemessages:�eerror:� testing%=� � �("Spool"):� � �
 � testing%=� �*Spool Spooled
� testing%=� � � �

5� Appname$ is used for task manager & Appname$Dir
D� shortname$ is used for iconbar name and should usually be null
'� longname$ is used for info window
7� AppURL$ is used to for clicks on the version icon
5Appname$="NetReact":version$="0.52 (27 Feb 1998)"
&shortname$="":longname$="Reaction"
'Appdir$=�systemvar(Appname$+"$Dir")
:AppURL$="http://come.to/fabland/fabsoft/netreact.html"
�initwimp:�initprog
quit%=�:init%=�
� � �error
� � init% �
 go$=�GetEnv:init%=�
. � go$<>"" � �loadfile(go$,�filetype(go$))
�
ȕ quit%=�

 �Poll
�
ș "Wimp_CloseDown"
 �closemessages
!�netgame_final
"� testing%=� �*SPOOL
#�
$5� quit%=-1 for user quit, -2 for taskmanager quit
%:
&� �Poll
'"ș "OS_ReadMonotonicTime" � t%
( ș "Wimp_Poll",0,b%� reason%
)Ȏ reason% �
* � 0:� Null poll
+7  �netgame_poll:� Check if there is something to do
,$    � checking%=� � �check_board
-. � 1:�redrawwindow(b%):� 1 = Redraw window
.! � 2:ș "Wimp_OpenWindow",,b%
/" � 3:ș "Wimp_CloseWindow",,b%
00 � 6:�mouseclick(b%!0,b%!4,b%!8,b%!12,b%!16)
1+ � 7 = Drag box dropped on another task
2% � 8:�processkey(b%!0,b%!4,b%!24)
3 � 9:�menuchoice
4 � 17,18:�receive(b%!16)
5 � 19:�receiveack(b%!16)
6�
7�
8:
9� �redrawwindow(b%)
::� x0%,y0%,x1%,y1%,scx%,scy%,bx%,by%,lx%,ly%,c%,sprite$
;
<� b%!0=boardwin% �
=' ș "Wimp_RedrawWindow",,b% � more%
>   �draw_board(b%,more%)
?�
@�
A:
B0� The whole redraw routine is sort of fixed.
C� �draw_board(b%,m%)
D
� lx%,ly%
E	ȕ m%
F  �vars(b%)
G;  �coord_realtowin(boardwin%,redraw_minx%,redraw_miny%)
H;  �coord_realtowin(boardwin%,redraw_maxx%,redraw_maxy%)
I  � lx%=0 � 7
J'   � (lx%/2)=�(lx%/2) � c%=1 � c%=2
K   � ly%=0 � 7
L    c%+=1:� c%>2 � c%=1
M�    � �coord_rec_overlap(lx%*100-4,-ly%*100-4,lx%*100+104,-ly%*100-104,redraw_minx%,redraw_miny%,redraw_maxx%,redraw_maxy%) �
NZ     �sprite_plot("c"+�(c%)+"back",bx%+boardleft%+(lx%)*100,by%+boardtop%-(ly%+1)*100)
O@     � boardcounter%(lx%,ly%)>0 � boardcounter%(lx%,ly%)<5 �
P�       �sprite_plot("c"+�(boardcounter%(lx%,ly%))+col$(boardcolour%(lx%,ly%)),bx%+boardleft%+(lx%)*100,by%+boardtop%-(ly%+1)*100)
Q
     �
R$     � bangx%=lx% � bangy%=ly% �
S]       �sprite_plot("explosion",bx%+boardleft%+(bangx%)*100,by%+boardtop%-(bangy%+1)*100)
T
     �
U	    �
V   � ly%
W  � lx%
X%  ș "Wimp_GetRectangle",,b% � m%
Y�
Z
[�
\:
]!� �sprite_plot(sprite$,x%,y%)
^=� (x%>x0%-100 � x%<x1%+100) � (y%>y0%-100 � y%<y1%+100) �
_E  ș "Wimp_ReadPixTrans",&100,sprites%,sprite$,,,,sscale%,strans%
`C  ș "OS_SpriteOp",308,sprites%,sprite$,x%,y%,8,sscale%,strans%
a�
b�
c:
d� �boardclick(xpos%,ypos%)
e
� sx%,sy%
f� checking%=� �
g)  �screentowin(boardwin%,xpos%,ypos%)
h  sx%=xpos% � 100
i  � sx%>7 � sx%=7
j  � sx%<0 � sx%=0
k  sy%=-ypos% � 100
l  � sy%>7 � sy%=7
m  � sy%<0 � sy%=0
n  �placecounter(sx%,sy%)
o�
p�
q:
r� �placecounter(sx%,sy%)
s@� boardcolour%(sx%,sy%)=player% � boardcolour%(sx%,sy%)=-1 �
t#  boardcolour%(sx%,sy%)=player%
u  boardcounter%(sx%,sy%)+=1
v  �updatesquare(sx%,sy%)
w  � 3,-15,&7000,0
x  checking%=�:turns%+=1
y  � player%=us% �
z(    �netgame_send("G"+�(sx%)+�(sy%))
{  �
|�
}�
~:
� �check_board
�
� lx%,ly%
�checking%=�
�� lx%=0 � 7:� ly%=0 � 7
�5  � boardcounter%(lx%,ly%)>boardmaxno%(lx%,ly%) �
�9    boardcounter%(lx%,ly%)=0:boardcolour%(lx%,ly%)=-1
�    �bang(lx%,ly%)
�    �updatesquare(lx%,ly%)
�    � lx%>0 �
�%      boardcounter%(lx%-1,ly%)+=1
�)      boardcolour%(lx%-1,ly%)=player%
�"      �updatesquare(lx%-1,ly%)
�      checking%=�
�	    �
�    � lx%<7 �
�&       boardcounter%(lx%+1,ly%)+=1
�)      boardcolour%(lx%+1,ly%)=player%
�"      �updatesquare(lx%+1,ly%)
�      checking%=�
�	    �
�    � ly%>0 �
�%      boardcounter%(lx%,ly%-1)+=1
�)      boardcolour%(lx%,ly%-1)=player%
�"      �updatesquare(lx%,ly%-1)
�      checking%=�
�	    �
�    � ly%<7 �
�%      boardcounter%(lx%,ly%+1)+=1
�)      boardcolour%(lx%,ly%+1)=player%
�"      �updatesquare(lx%,ly%+1)
�      checking%=�
�	    �
�  �
�0� checking%=� � ly%=7:lx%=7:� very bad form!
�� ly%:� lx%
�� checking%=� �
�9  � player%=pblue% � player%=pgreen% � player%=pblue%
�  �bangclear:�count
�  �updatetitle
��
��
�:
�� �count
�
� lx%,ly%
�pbluesc%=0:pgreensc%=0
�� lx%=0 � 7:� ly%=0 � 7
�G  � boardcolour%(lx%,ly%)=pblue% � pbluesc%+=boardcounter%(lx%,ly%)
�I  � boardcolour%(lx%,ly%)=pgreen% � pgreensc%+=boardcounter%(lx%,ly%)
�� ly%:� lx%
�+� pbluesc%=0 � turns%>1 � pwon%=pgreen%
�+� pgreensc%=0 � turns%>1 � pwon%=pblue%
�)�seticontext(boardwin%,5,�(pbluesc%))
�*�seticontext(boardwin%,7,�(pgreensc%))
�� pwon%<>-1 � �gameover
��
�:
�� �gameover
�� dummy%
�� pwon%=us% �
�2  dummy%=�errorbox(">Message",">WinUs",%10001)
��
�4  dummy%=�errorbox(">Message",">WinThem",%10001)
��
��
�
��
�:
�� �bang(sx%,sy%)
��bangclear
�bangx%=sx%:bangy%=sy%
� �updatesquare(bangx%,bangy%)
�� 2,-15,&3500,0
��
�:
�� �bangclear
�� tempx%,tempy%
�tempx%=bangx%:tempy%=bangy%
�bangx%=-1:bangy%=-1
� �updatesquare(tempx%,tempy%)
��
�:
�� �board_clear(notify%)
�
� sx%,sy%
�� sx%=0 � 7
�  � sy%=0 � 7
�9    boardcounter%(sx%,sy%)=0:boardcolour%(sx%,sy%)=-1
�     �redrawicon(boardwin%,3)
�  � sy%
�	� sx%
�;turns%=0:pbluesc%=0:pgreensc%=0:player%=pblue%:pwon%=-1
�)�seticontext(boardwin%,5,�(pbluesc%))
�*�seticontext(boardwin%,7,�(pgreensc%))
��updatetitle
�� notify%=� �
�  �netgame_send("C")
��
��
�:
�� �updatetitle
�� pwon%=-1 �
�  � player%=us% �
�4    �windowtitle(boardwin%,">Us:"+col$(player%))
�  �
�6    �windowtitle(boardwin%,">Them:"+col$(player%))
�  �
��
�  � pwon%=us% �
�(    �windowtitle(boardwin%,">WinUs")
�  �
�*    �windowtitle(boardwin%,">WinThem")
�  �
��
��
�:
�� �updatesquare(sx%,sy%)
�%� left%,top%,right%,bottom%,more%
�left%=boardleft%+sx%*100
�top%=boardtop%-sy%*100
�right%=left%+100
�bottom%=top%-100
�b%!0=boardwin%
�b%!4=left%:b%!8=bottom%
�b%!12=right%:b%!16=top%
�&ș "Wimp_UpdateWindow",,b% � more%
��draw_board(b%,more%)
��
�:
�� �vars(B%)
�?x0%=B%!4:y0%=B%!8:x1%=B%!12:y1%=B%!16:scx%=B%!20:scy%=B%!24
bx%=x0%-scx%:by%=y1%-scy%
redraw_minx%=B%!28
redraw_miny%=B%!32
redraw_maxx%=B%!36
redraw_maxy%=B%!40
�
:
0� Buttons : 1 = Adjust, 2 = Menu, 4 = Select
#� �mouseclick(x,y,but,win,icon)
	Ȏ win �

	 � -2
  Ȏ but �
  � 2:�ibmenu

   � 1,4:� Select or adjust
    � �netgame_connected �
      �openwin(boardwin%)
	    �
0      �openconnect:� Open the connect window
	    �
  �
 � boardwin%
  Ȏ icon �
,   � -1:� but=2 � �menu(boardmenu%,-1,0)
   � 0:�board_clear(�)
/   � 1:� but=1 � but=4 � �openwin(sendwin%)
(   � 2:� but=1 � but=4 � �disconnect
+   � 3:� but=2 � �menu(boardmenu%,-1,0)
,          � but=4 � �netgame_connected �
;            � pwon%=-1 � player%=us% � �boardclick(x,y)
          �
  �
 � infobox%
   Ȏ icon �
!#   � 1:� testing%=� � �showfree
"8   � 3:�FetchPage("http://come.to/fabland/fabsoft/")
#   � 4:�FetchPage(AppURL$)
$  �
% � connectwin%
&  Ȏ icon �
'7   � 5:�menu(�netgame_sitesmenu,-1,-1):� Sites list
(   � 4:�tryconnect
)  �
* � sendwin%
+  Ȏ icon �
,*   � 2:� Cancel - clear text and close
-#    �seticontext(sendwin%,0,"")
.    �closewin(sendwin%)
/   � 1:� Send
0    �sendmessage
1  �
2 � msgwin%
3  Ȏ icon �
4   � 2:� Reply
5    �openreply
6   � 1:� Ok
7    �closewin(win)
8  �
9 � boardwin%
:  Ȏ icon �
;   � 1:� Message
<    �openwin(sendwin%)
=     �setcaretend(sendwin%,0)
>   �
?�
@�
A:
B$� �greyouticons_cos_disconnected
C�iconshade(boardwin%,0,1)
D�iconshade(boardwin%,1,1)
E� and menus too!
F�menushade(boardmenu%,1,1)
G�menushade(boardmenu%,2,1)
H�
I:
J#� �ungreyouticons_cos_connected
K�iconshade(boardwin%,0,0)
L�iconshade(boardwin%,1,0)
M� and menus too!
N�menushade(boardmenu%,1,0)
O�menushade(boardmenu%,2,0)
P�
Q:
R� �processkey(win,icon,key)
S� keydone:keydone=�
TȎ win �
U � connectwin%
V  Ȏ key �
W#   � 27:� Escape - close window
X    �closewin(connectwin%)
Y   � 13:� Return
Z    �tryconnect:keydone=�
[  �
\ � sendwin%
]  Ȏ key �
^#   � 27:� Escape - close window
_%    �closewin(sendwin%):keydone=�
`   � 13:� Return
a    �sendmessage:keydone=�
b  �
c�
d*� � keydone � ș "Wimp_ProcessKey",key
e�
f:
g� �menuchoice
hDș"Wimp_GetPointerInfo",,message_buffer%:mbut%=message_buffer%!8
iȎ curmenu% �
j8 � �netgame_sitesmenu:� The sites menu, so select it
k1  �netgame_selectsite(!b%,connectwin%,1,3,-1)
l@  curmenu%=�netgame_sitesmenu:� In case it's been re-created
m � ibmenu%
n  Ȏ !b% �
o   � 2:quit%=�
p7   � 1:�netgame_editsites(bestport%):� Editing time
q  �
r � boardmenu%
s  Ȏ !b% �
t   � 2:�disconnect
u&   � 1:�board_clear(�):� tell them
v  �
w�
x/� (mbut%�1)=1 � �recreatemenu � curmenu%=-1
y�
z:
{� �disconnect
|"�greyouticons_cos_disconnected
}�netgame_disconnect
~�updatetitle
�
�:
�� �receive(mess)
�
Ȏ mess �
� � &400C1 = mode change
� � &400C2 = task start up
� � &400C3 = task shut down
�+ � &90281:� Sites file has been updated
�  �netgame_readsites
� � 0:quit%=�*2
�# � &502:�Help(b%!32,b%!36,b%!4)
� � 10:�desktopsave(b%!20)
��
��
�:
�� �receiveack(mess)
�
Ȏ mess �
��
��
�:
�� �desktopsave(file%)
�� �
�;� � � b%!12=b%!8:ș "Wimp_SendMessage",19,b%,b%!4:� �:�
�@� The above line acknowledges the message if an error occurs
� � aborting the desktop save.
��#file%,"Run "+Appdir$
��
�:
�� �loadfile(file$,type)
�
Ȏ type �
��
��
�:
�/� Any messages to be received MUST be noted
�� �initwimp
�!� messagelist% 256:messptr%=0
�<�notemessage(&502):�notemessage(10):�notemessage(&90281)
��notemessage(0)
�Uș "Wimp_Initialise",310,&4B534154,Appname$,messagelist% � wimpversion,taskhandle
�Gindl%=1024:menul%=1024:� b% 2048,ind% indl%,menu% menul%,wspc% &800
�curmenu%=-1
��openmessages
�-sprites%=�loadsprites(Appdir$+".Sprites")
�$infobox%=�loadtemplate("Info",1)
�*connectwin%=�loadtemplate("connect",1)
�$sendwin%=�loadtemplate("send",1)
�&msgwin%=�loadtemplate("message",1)
�&boardwin%=�loadtemplate("Board",1)
�b%!0=boardwin%:b%!4=3
�ș "Wimp_GetIconState",,b%
�+boardleft%=(b%!8)+4:boardtop%=(b%!20)-4
�%�seticontext(infobox%,1,Appname$)
�5�seticontext(infobox%,2,longname$+" (port xxxx)")
�%�seticontext(infobox%,4,version$)
�:ibhandle=�CreateIconBarIcon("!"+Appname$,shortname$,1)
�Aibmenu%=�createmenu(Appname$+"|Info]>infobox%|Sites...|Quit")
�Mboardmenu%=�createmenu(Appname$+"|Info]>infobox%|Clear Board|Disconnect")
�iboptions%=options%
��
�:
�� �initprog
�� x%,y%
�)� Initialise the network game library
�3� bestport% is the port we listen on by default
�bestport%=4000
�/port=�netgame_init(bestport%):� Port number
�$� Ensure that everything went ok
�� port=-1 �
�6 reply=�errorbox(">Message",">CouldntInit",%10001)
� ș "Wimp_CloseDown"
� �closemessages
� �
��
�- �seticontext(infobox%,2,">Info:"+� port)
��
�1� Mark the correct site in the connect window
�&�seticontext(connectwin%,3,� port)
�"� Read the sites from the file
��netgame_readsites
�:� sscale% 16:� strans% 16:� for Wimp_ReadPixTrans call
�;� wins%(1),boardcounter%(7,7),boardcolour%(7,7),col$(1)
�!boardcolour%()=-1:checking%=�
�� boardmaxno%(7,7)
�� x%=0 � 7
�  � y%=0 � 7
�    boardmaxno%(x%,y%)=3
�(    � x%*y%=0 � boardmaxno%(x%,y%)=2
�%    � x%=7 � boardmaxno%(x%,y%)=2
�%    � y%=7 � boardmaxno%(x%,y%)=2
�,    � x%=0 � y%=0 � boardmaxno%(x%,y%)=1
�,    � x%=0 � y%=7 � boardmaxno%(x%,y%)=1
�,    � x%=7 � y%=0 � boardmaxno%(x%,y%)=1
�,    � x%=7 � y%=7 � boardmaxno%(x%,y%)=1
�  �
��
�;pblue%=0:pgreen%=1:col$()="blue","green":player%=pblue%
�@bangx%=-1:bangy%=-1:pbluesc%=0:pgreensc%=0:pwon%=-1:turns%=0
�� load sound samples
�Ƞ 4
�*ChannelVoice 2 ReactBang
�*ChannelVoice 3 ReactPlip
��
�:
�� �Help(win,icon,to)
�� +1:�readhelp(win,icon,to)
��
�
� Windows
�� infobox%,">HInfobox"
�� 3,">HInfobox3"
�� 4,">HInfobox4"
�� sendwin%,">HSendwin"
�� 2,">HSCancel"
�� 3,">HSSend"
�� msgwin%,">HMsgwin"
�� 2,">HReply"
�� 1,">HOk"
� � connectwin%,">HConnectwin"
�� 4,">HCOk"
�� boardwin%,">HBoardwin"
�� 0,">HBWDisconnect"
�� 1,">HBWMessage"
�� 3,">HBWBoard"
�� 5,">HBWBlue"
�� 7,">HBWGreen"
�� -2,">HIconbar"
�� -1,-1
�� Menus
�� ibmenu%,-1,-1,-1
�� 0,-1,-1,">HMInfo"
� 1,-1,-1,">HMSites"
� 2,-1,-1,">HMQuit"
� boardmenu%,-1,-1,-1
� 0,-1,-1,">HMInfo"
� 1,-1,-1,">HMClear"
� 2,-1,-1,">HMDisconnect"
� -2,-2,-2,-2
:
� �FetchPage(f$)
	<� XURI_Dispatch - this protocol is still being decided !

ș &6E381,%000,f$+�0
�
:

>� ******************** NetGame routines ******************
:
,� They've gone, so we'd better tell them
� �disconnected(type)
� reply

Ȏ type �
4 � ngs_dead:� Bad little boy, dropped connection
2  reply=�errorbox(">Message",">Closed",%10001)
4 � ngs_going:� Mr Flibble says 'Game Over', boys
4  reply=�errorbox(">Message",">GameOver",%10001)
- � ngs_failed:� Couldn't get a connection
5  reply=�errorbox(">Message",">NoConnect",%10001)
  �openconnect
�
theirhost$=""
"�greyouticons_cos_disconnected
�
:
� We've got a connection
 2� type = ngs_originate if we connected to them
!(� ngs_answer if they connected to us
"� �connected(host$,type)
#theirhost$=host$
$� type=ngs_originate �
%C  us%=pblue%:them%=pgreen%:� we initiated connection, we go 1st
&�
'D  us%=pgreen%:them%=pblue%:� they initiated connection, them 1st
(�
)+player%=pblue%:� blue always goes first
*%�board_clear(�):� don't tell them
+5�closewin(connectwin%):� Close the connect window
,*� We should open a window or something
-!�ungreyouticons_cos_connected
.�openwin(boardwin%)
/�
0:
1>� Message has arrived from them - try not to create a loop
2!� 'cos that is kinda silly...
3� �incoming(msg$)
4C� If it's a user message we should put it in the message window
5A� with PROCgotmessage(msg$), otherwise it's a 'go' so we need
6� to process it
7� �msg$,1)="M" �
8  �gotmessage(�msg$,2))
9�
:� �msg$,1)="G" �
;,  � G = Go - Player has placed a counter
<B  � If we get a message and it's our go then they're cheating!
=#  � player%=us% � checking%=� �
>    �disconnect
?    theirhost$=""
@  �
A0  � If we're still checking then finish PDQ!
B#  ȕ checking%=�:�check_board:�
C'  x%=�(�msg$,2,1)):y%=�(�msg$,3,1))
D  �placecounter(x%,y%)
E�
F� �msg$,1)="C" �
G;  �board_clear(�):� don't tell them: They already know!
H�
I�
J:
KB� ********************** Other routines **********************
L:
M=� Attempt a connection using the 'connect' window as host
N� �tryconnect
O� host$,port
P5host$=�geticontext(connectwin%,1):� Read the host
Q� host$="" � �
R� Read the service number
S?port=�inet_getservbyname(�geticontext(connectwin%,3),"tcp")
T� Now do the connection
U#ok=�netgame_connect(host$,port)
V� � ok �
W' � We couldn't connect so tell them
X4 reply=�errorbox(">Message",">NoConnect",%10001)
Y�
Z �closewin(connectwin%)
[�
\�
]:
^B� We've got a message from them so lets stick it on the screen
_� �gotmessage(msg$)
`:�seticontext(msgwin%,0,�msg$,39)):� Fit it to the icon
a'�openwin(msgwin%):� Open the window
b�
c:
d+� Send the message in the 'send' window
e� �sendmessage
f$� a$:a$=�geticontext(sendwin%,0)
g� Send the message
h&� You need to put some code here :
i� like PROCnetgame_send(a$)
j)� Clear the text and close the window
k�netgame_send("M"+a$)
l�seticontext(sendwin%,0,"")
m�closewin(sendwin%)
n�
o:
p� Open the 'connect' window
q� �openconnect
r�openwincentre(connectwin%)
s�setcaretend(connectwin%,1)
t�
u:
v� Open the 'reply' window
w� �openreply
x�closewin(msgwin%)
y�openwin(sendwin%)
z�setcaretend(sendwin%,0)
{�
|
}%� �screentowin(window%,� x%,� y%)
~!b%=window%:ș &400CB,,b%
&x%=x%+b%!20-b%!4:y%=y%+b%!24-b%!16
��
�
�� ---- BLIbII ----
�1� �coord_rec_overlap(x%,y%,X%,Y%,a%,b%,A%,B%)
�� x%<a% � X%<a% � =�
�� x%>A% � X%>A% � =�
�� y%<b% � Y%<b% � =�
�� y%>B% � Y%>B% � =�
�=�
�
�$� �coord_realtowin(W%,� X%,� Y%)
�� B%:B%=b%
�!B%=W%:ș &400CB,,B%
�&X%=X%+B%!20-B%!4:Y%=Y%+B%!24-B%!16
��
�
�$� �coord_wintoreal(W%,� X%,� Y%)
�� B%:B%=b%
�!B%=W%:ș &400CB,,B%
�&X%=X%-B%!20+B%!4:Y%=B%!16-B%!24+Y%
��
�
�
00000000  0d 00 01 1f f4 20 3e 3c  4e 65 74 52 65 61 63 74  |..... ><NetReact|
00000010  24 44 69 72 3e 2e 21 52  75 6e 49 6d 61 67 65 0d  |$Dir>.!RunImage.|
00000020  00 02 11 f4 20 4e 65 74  52 65 61 63 74 69 6f 6e  |.... NetReaction|
00000030  0d 00 03 21 f4 20 42 79  20 52 6f 62 65 72 74 20  |...!. By Robert |
00000040  48 61 6d 70 74 6f 6e 20  2f 20 46 41 42 73 6f 66  |Hampton / FABsof|
00000050  74 0d 00 04 24 f4 20 4e  65 74 47 61 6d 65 20 69  |t...$. NetGame i|
00000060  73 20 28 43 29 20 4a 75  73 74 69 6e 20 46 6c 65  |s (C) Justin Fle|
00000070  74 63 68 65 72 0d 00 05  25 f4 20 54 68 69 73 20  |tcher...%. This |
00000080  76 65 72 73 69 6f 6e 20  68 61 73 20 62 65 74 74  |version has bett|
00000090  65 72 20 72 65 64 72 61  77 21 0d 00 06 0e 74 65  |er redraw!....te|
000000a0  73 74 69 6e 67 25 3d a3  0d 00 07 29 c8 9b 20 22  |sting%=....).. "|
000000b0  3c 42 61 73 69 63 4c 69  62 72 61 72 79 24 46 69  |<BasicLibrary$Fi|
000000c0  6c 65 3e 22 3a f2 69 6e  69 74 6c 69 62 72 61 72  |le>":.initlibrar|
000000d0  79 0d 00 08 25 c8 9b 20  22 3c 48 65 61 70 4c 69  |y...%.. "<HeapLi|
000000e0  62 72 61 72 79 24 46 69  6c 65 3e 22 3a f2 69 6e  |brary$File>":.in|
000000f0  69 74 68 65 61 70 0d 00  09 1e c8 9b 20 22 3c 4e  |itheap...... "<N|
00000100  65 74 47 61 6d 65 4c 69  62 72 61 72 79 24 46 69  |etGameLibrary$Fi|
00000110  6c 65 3e 22 0d 00 0a 3e  ee 20 85 20 f2 63 6c 6f  |le>"...>. . .clo|
00000120  73 65 6d 65 73 73 61 67  65 73 3a f2 65 65 72 72  |semessages:.eerr|
00000130  6f 72 3a e7 20 74 65 73  74 69 6e 67 25 3d b9 20  |or:. testing%=. |
00000140  8c 20 ff 28 22 53 70 6f  6f 6c 22 29 3a e0 20 8b  |. .("Spool"):. .|
00000150  20 e0 0d 00 0b 20 e7 20  74 65 73 74 69 6e 67 25  | .... . testing%|
00000160  3d b9 20 8c 2a 53 70 6f  6f 6c 20 53 70 6f 6f 6c  |=. .*Spool Spool|
00000170  65 64 0d 00 0c 16 e7 20  74 65 73 74 69 6e 67 25  |ed..... testing%|
00000180  3d b9 20 8c 20 fc 20 ee  0d 00 0d 35 f4 20 41 70  |=. . . ....5. Ap|
00000190  70 6e 61 6d 65 24 20 69  73 20 75 73 65 64 20 66  |pname$ is used f|
000001a0  6f 72 20 74 61 73 6b 20  6d 61 6e 61 67 65 72 20  |or task manager |
000001b0  26 20 41 70 70 6e 61 6d  65 24 44 69 72 0d 00 0e  |& Appname$Dir...|
000001c0  44 f4 20 73 68 6f 72 74  6e 61 6d 65 24 20 69 73  |D. shortname$ is|
000001d0  20 75 73 65 64 20 66 6f  72 20 69 63 6f 6e 62 61  | used for iconba|
000001e0  72 20 6e 61 6d 65 20 61  6e 64 20 73 68 6f 75 6c  |r name and shoul|
000001f0  64 20 75 73 75 61 6c 6c  79 20 62 65 20 6e 75 6c  |d usually be nul|
00000200  6c 0d 00 0f 27 f4 20 6c  6f 6e 67 6e 61 6d 65 24  |l...'. longname$|
00000210  20 69 73 20 75 73 65 64  20 66 6f 72 20 69 6e 66  | is used for inf|
00000220  6f 20 77 69 6e 64 6f 77  0d 00 10 37 f4 20 41 70  |o window...7. Ap|
00000230  70 55 52 4c 24 20 69 73  20 75 73 65 64 20 74 6f  |pURL$ is used to|
00000240  20 66 6f 72 20 63 6c 69  63 6b 73 20 6f 6e 20 74  | for clicks on t|
00000250  68 65 20 76 65 72 73 69  6f 6e 20 69 63 6f 6e 0d  |he version icon.|
00000260  00 11 35 41 70 70 6e 61  6d 65 24 3d 22 4e 65 74  |..5Appname$="Net|
00000270  52 65 61 63 74 22 3a 76  65 72 73 69 6f 6e 24 3d  |React":version$=|
00000280  22 30 2e 35 32 20 28 32  37 20 46 65 62 20 31 39  |"0.52 (27 Feb 19|
00000290  39 38 29 22 0d 00 12 26  73 68 6f 72 74 6e 61 6d  |98)"...&shortnam|
000002a0  65 24 3d 22 22 3a 6c 6f  6e 67 6e 61 6d 65 24 3d  |e$="":longname$=|
000002b0  22 52 65 61 63 74 69 6f  6e 22 0d 00 13 27 41 70  |"Reaction"...'Ap|
000002c0  70 64 69 72 24 3d a4 73  79 73 74 65 6d 76 61 72  |pdir$=.systemvar|
000002d0  28 41 70 70 6e 61 6d 65  24 2b 22 24 44 69 72 22  |(Appname$+"$Dir"|
000002e0  29 0d 00 14 3a 41 70 70  55 52 4c 24 3d 22 68 74  |)...:AppURL$="ht|
000002f0  74 70 3a 2f 2f 63 6f 6d  65 2e 74 6f 2f 66 61 62  |tp://come.to/fab|
00000300  6c 61 6e 64 2f 66 61 62  73 6f 66 74 2f 6e 65 74  |land/fabsoft/net|
00000310  72 65 61 63 74 2e 68 74  6d 6c 22 0d 00 15 17 f2  |react.html".....|
00000320  69 6e 69 74 77 69 6d 70  3a f2 69 6e 69 74 70 72  |initwimp:.initpr|
00000330  6f 67 0d 00 16 13 71 75  69 74 25 3d a3 3a 69 6e  |og....quit%=.:in|
00000340  69 74 25 3d a3 0d 00 17  0e ee 20 85 20 f2 65 72  |it%=...... . .er|
00000350  72 6f 72 0d 00 18 0f e7  20 ac 20 69 6e 69 74 25  |ror..... . init%|
00000360  20 8c 0d 00 19 18 20 67  6f 24 3d a4 47 65 74 45  | ..... go$=.GetE|
00000370  6e 76 3a 69 6e 69 74 25  3d b9 0d 00 1a 2e 20 e7  |nv:init%=..... .|
00000380  20 67 6f 24 3c 3e 22 22  20 8c 20 f2 6c 6f 61 64  | go$<>"" . .load|
00000390  66 69 6c 65 28 67 6f 24  2c a4 66 69 6c 65 74 79  |file(go$,.filety|
000003a0  70 65 28 67 6f 24 29 29  0d 00 1b 05 cd 0d 00 1c  |pe(go$))........|
000003b0  0e c8 95 20 71 75 69 74  25 3d a3 0d 00 1d 0a 20  |... quit%=..... |
000003c0  f2 50 6f 6c 6c 0d 00 1e  05 ce 0d 00 1f 17 c8 99  |.Poll...........|
000003d0  20 22 57 69 6d 70 5f 43  6c 6f 73 65 44 6f 77 6e  | "Wimp_CloseDown|
000003e0  22 0d 00 20 12 f2 63 6c  6f 73 65 6d 65 73 73 61  |".. ..closemessa|
000003f0  67 65 73 0d 00 21 12 f2  6e 65 74 67 61 6d 65 5f  |ges..!..netgame_|
00000400  66 69 6e 61 6c 0d 00 22  18 e7 20 74 65 73 74 69  |final..".. testi|
00000410  6e 67 25 3d b9 20 8c 2a  53 50 4f 4f 4c 0d 00 23  |ng%=. .*SPOOL..#|
00000420  05 e0 0d 00 24 35 f4 20  71 75 69 74 25 3d 2d 31  |....$5. quit%=-1|
00000430  20 66 6f 72 20 75 73 65  72 20 71 75 69 74 2c 20  | for user quit, |
00000440  2d 32 20 66 6f 72 20 74  61 73 6b 6d 61 6e 61 67  |-2 for taskmanag|
00000450  65 72 20 71 75 69 74 0d  00 25 05 3a 0d 00 26 0b  |er quit..%.:..&.|
00000460  dd 20 f2 50 6f 6c 6c 0d  00 27 22 c8 99 20 22 4f  |. .Poll..'".. "O|
00000470  53 5f 52 65 61 64 4d 6f  6e 6f 74 6f 6e 69 63 54  |S_ReadMonotonicT|
00000480  69 6d 65 22 20 b8 20 74  25 0d 00 28 20 c8 99 20  |ime" . t%..( .. |
00000490  22 57 69 6d 70 5f 50 6f  6c 6c 22 2c 30 2c 62 25  |"Wimp_Poll",0,b%|
000004a0  b8 20 72 65 61 73 6f 6e  25 0d 00 29 10 c8 8e 20  |. reason%..)... |
000004b0  72 65 61 73 6f 6e 25 20  ca 0d 00 2a 14 20 c9 20  |reason% ...*. . |
000004c0  30 3a f4 20 4e 75 6c 6c  20 70 6f 6c 6c 0d 00 2b  |0:. Null poll..+|
000004d0  37 20 20 f2 6e 65 74 67  61 6d 65 5f 70 6f 6c 6c  |7  .netgame_poll|
000004e0  3a f4 20 43 68 65 63 6b  20 69 66 20 74 68 65 72  |:. Check if ther|
000004f0  65 20 69 73 20 73 6f 6d  65 74 68 69 6e 67 20 74  |e is something t|
00000500  6f 20 64 6f 0d 00 2c 24  20 20 20 20 e7 20 63 68  |o do..,$    . ch|
00000510  65 63 6b 69 6e 67 25 3d  b9 20 8c 20 f2 63 68 65  |ecking%=. . .che|
00000520  63 6b 5f 62 6f 61 72 64  0d 00 2d 2e 20 c9 20 31  |ck_board..-. . 1|
00000530  3a f2 72 65 64 72 61 77  77 69 6e 64 6f 77 28 62  |:.redrawwindow(b|
00000540  25 29 3a f4 20 31 20 3d  20 52 65 64 72 61 77 20  |%):. 1 = Redraw |
00000550  77 69 6e 64 6f 77 0d 00  2e 21 20 c9 20 32 3a c8  |window...! . 2:.|
00000560  99 20 22 57 69 6d 70 5f  4f 70 65 6e 57 69 6e 64  |. "Wimp_OpenWind|
00000570  6f 77 22 2c 2c 62 25 0d  00 2f 22 20 c9 20 33 3a  |ow",,b%../" . 3:|
00000580  c8 99 20 22 57 69 6d 70  5f 43 6c 6f 73 65 57 69  |.. "Wimp_CloseWi|
00000590  6e 64 6f 77 22 2c 2c 62  25 0d 00 30 30 20 c9 20  |ndow",,b%..00 . |
000005a0  36 3a f2 6d 6f 75 73 65  63 6c 69 63 6b 28 62 25  |6:.mouseclick(b%|
000005b0  21 30 2c 62 25 21 34 2c  62 25 21 38 2c 62 25 21  |!0,b%!4,b%!8,b%!|
000005c0  31 32 2c 62 25 21 31 36  29 0d 00 31 2b 20 f4 20  |12,b%!16)..1+ . |
000005d0  37 20 3d 20 44 72 61 67  20 62 6f 78 20 64 72 6f  |7 = Drag box dro|
000005e0  70 70 65 64 20 6f 6e 20  61 6e 6f 74 68 65 72 20  |pped on another |
000005f0  74 61 73 6b 0d 00 32 25  20 c9 20 38 3a f2 70 72  |task..2% . 8:.pr|
00000600  6f 63 65 73 73 6b 65 79  28 62 25 21 30 2c 62 25  |ocesskey(b%!0,b%|
00000610  21 34 2c 62 25 21 32 34  29 0d 00 33 14 20 c9 20  |!4,b%!24)..3. . |
00000620  39 3a f2 6d 65 6e 75 63  68 6f 69 63 65 0d 00 34  |9:.menuchoice..4|
00000630  1c 20 c9 20 31 37 2c 31  38 3a f2 72 65 63 65 69  |. . 17,18:.recei|
00000640  76 65 28 62 25 21 31 36  29 0d 00 35 1c 20 c9 20  |ve(b%!16)..5. . |
00000650  31 39 3a f2 72 65 63 65  69 76 65 61 63 6b 28 62  |19:.receiveack(b|
00000660  25 21 31 36 29 0d 00 36  05 cb 0d 00 37 05 e1 0d  |%!16)..6....7...|
00000670  00 38 05 3a 0d 00 39 17  dd 20 f2 72 65 64 72 61  |.8.:..9.. .redra|
00000680  77 77 69 6e 64 6f 77 28  62 25 29 0d 00 3a 3a ea  |wwindow(b%)..::.|
00000690  20 78 30 25 2c 79 30 25  2c 78 31 25 2c 79 31 25  | x0%,y0%,x1%,y1%|
000006a0  2c 73 63 78 25 2c 73 63  79 25 2c 62 78 25 2c 62  |,scx%,scy%,bx%,b|
000006b0  79 25 2c 6c 78 25 2c 6c  79 25 2c 63 25 2c 73 70  |y%,lx%,ly%,c%,sp|
000006c0  72 69 74 65 24 0d 00 3b  04 0d 00 3c 16 e7 20 62  |rite$..;...<.. b|
000006d0  25 21 30 3d 62 6f 61 72  64 77 69 6e 25 20 8c 0d  |%!0=boardwin% ..|
000006e0  00 3d 27 20 c8 99 20 22  57 69 6d 70 5f 52 65 64  |.=' .. "Wimp_Red|
000006f0  72 61 77 57 69 6e 64 6f  77 22 2c 2c 62 25 20 b8  |rawWindow",,b% .|
00000700  20 6d 6f 72 65 25 0d 00  3e 1c 20 20 20 f2 64 72  | more%..>.   .dr|
00000710  61 77 5f 62 6f 61 72 64  28 62 25 2c 6d 6f 72 65  |aw_board(b%,more|
00000720  25 29 0d 00 3f 05 cd 0d  00 40 05 e1 0d 00 41 05  |%)..?....@....A.|
00000730  3a 0d 00 42 30 f4 20 54  68 65 20 77 68 6f 6c 65  |:..B0. The whole|
00000740  20 72 65 64 72 61 77 20  72 6f 75 74 69 6e 65 20  | redraw routine |
00000750  69 73 20 73 6f 72 74 20  6f 66 20 66 69 78 65 64  |is sort of fixed|
00000760  2e 0d 00 43 18 dd 20 f2  64 72 61 77 5f 62 6f 61  |...C.. .draw_boa|
00000770  72 64 28 62 25 2c 6d 25  29 0d 00 44 0d ea 20 6c  |rd(b%,m%)..D.. l|
00000780  78 25 2c 6c 79 25 0d 00  45 09 c8 95 20 6d 25 0d  |x%,ly%..E... m%.|
00000790  00 46 0f 20 20 f2 76 61  72 73 28 62 25 29 0d 00  |.F.  .vars(b%)..|
000007a0  47 3b 20 20 f2 63 6f 6f  72 64 5f 72 65 61 6c 74  |G;  .coord_realt|
000007b0  6f 77 69 6e 28 62 6f 61  72 64 77 69 6e 25 2c 72  |owin(boardwin%,r|
000007c0  65 64 72 61 77 5f 6d 69  6e 78 25 2c 72 65 64 72  |edraw_minx%,redr|
000007d0  61 77 5f 6d 69 6e 79 25  29 0d 00 48 3b 20 20 f2  |aw_miny%)..H;  .|
000007e0  63 6f 6f 72 64 5f 72 65  61 6c 74 6f 77 69 6e 28  |coord_realtowin(|
000007f0  62 6f 61 72 64 77 69 6e  25 2c 72 65 64 72 61 77  |boardwin%,redraw|
00000800  5f 6d 61 78 78 25 2c 72  65 64 72 61 77 5f 6d 61  |_maxx%,redraw_ma|
00000810  78 79 25 29 0d 00 49 11  20 20 e3 20 6c 78 25 3d  |xy%)..I.  . lx%=|
00000820  30 20 b8 20 37 0d 00 4a  27 20 20 20 e7 20 28 6c  |0 . 7..J'   . (l|
00000830  78 25 2f 32 29 3d a8 28  6c 78 25 2f 32 29 20 8c  |x%/2)=.(lx%/2) .|
00000840  20 63 25 3d 31 20 8b 20  63 25 3d 32 0d 00 4b 12  | c%=1 . c%=2..K.|
00000850  20 20 20 e3 20 6c 79 25  3d 30 20 b8 20 37 0d 00  |   . ly%=0 . 7..|
00000860  4c 1b 20 20 20 20 63 25  2b 3d 31 3a e7 20 63 25  |L.    c%+=1:. c%|
00000870  3e 32 20 8c 20 63 25 3d  31 0d 00 4d 81 20 20 20  |>2 . c%=1..M.   |
00000880  20 e7 20 a4 63 6f 6f 72  64 5f 72 65 63 5f 6f 76  | . .coord_rec_ov|
00000890  65 72 6c 61 70 28 6c 78  25 2a 31 30 30 2d 34 2c  |erlap(lx%*100-4,|
000008a0  2d 6c 79 25 2a 31 30 30  2d 34 2c 6c 78 25 2a 31  |-ly%*100-4,lx%*1|
000008b0  30 30 2b 31 30 34 2c 2d  6c 79 25 2a 31 30 30 2d  |00+104,-ly%*100-|
000008c0  31 30 34 2c 72 65 64 72  61 77 5f 6d 69 6e 78 25  |104,redraw_minx%|
000008d0  2c 72 65 64 72 61 77 5f  6d 69 6e 79 25 2c 72 65  |,redraw_miny%,re|
000008e0  64 72 61 77 5f 6d 61 78  78 25 2c 72 65 64 72 61  |draw_maxx%,redra|
000008f0  77 5f 6d 61 78 79 25 29  20 8c 0d 00 4e 5a 20 20  |w_maxy%) ...NZ  |
00000900  20 20 20 f2 73 70 72 69  74 65 5f 70 6c 6f 74 28  |   .sprite_plot(|
00000910  22 63 22 2b c3 28 63 25  29 2b 22 62 61 63 6b 22  |"c"+.(c%)+"back"|
00000920  2c 62 78 25 2b 62 6f 61  72 64 6c 65 66 74 25 2b  |,bx%+boardleft%+|
00000930  28 6c 78 25 29 2a 31 30  30 2c 62 79 25 2b 62 6f  |(lx%)*100,by%+bo|
00000940  61 72 64 74 6f 70 25 2d  28 6c 79 25 2b 31 29 2a  |ardtop%-(ly%+1)*|
00000950  31 30 30 29 0d 00 4f 40  20 20 20 20 20 e7 20 62  |100)..O@     . b|
00000960  6f 61 72 64 63 6f 75 6e  74 65 72 25 28 6c 78 25  |oardcounter%(lx%|
00000970  2c 6c 79 25 29 3e 30 20  80 20 62 6f 61 72 64 63  |,ly%)>0 . boardc|
00000980  6f 75 6e 74 65 72 25 28  6c 78 25 2c 6c 79 25 29  |ounter%(lx%,ly%)|
00000990  3c 35 20 8c 0d 00 50 85  20 20 20 20 20 20 20 f2  |<5 ...P.       .|
000009a0  73 70 72 69 74 65 5f 70  6c 6f 74 28 22 63 22 2b  |sprite_plot("c"+|
000009b0  c3 28 62 6f 61 72 64 63  6f 75 6e 74 65 72 25 28  |.(boardcounter%(|
000009c0  6c 78 25 2c 6c 79 25 29  29 2b 63 6f 6c 24 28 62  |lx%,ly%))+col$(b|
000009d0  6f 61 72 64 63 6f 6c 6f  75 72 25 28 6c 78 25 2c  |oardcolour%(lx%,|
000009e0  6c 79 25 29 29 2c 62 78  25 2b 62 6f 61 72 64 6c  |ly%)),bx%+boardl|
000009f0  65 66 74 25 2b 28 6c 78  25 29 2a 31 30 30 2c 62  |eft%+(lx%)*100,b|
00000a00  79 25 2b 62 6f 61 72 64  74 6f 70 25 2d 28 6c 79  |y%+boardtop%-(ly|
00000a10  25 2b 31 29 2a 31 30 30  29 0d 00 51 0a 20 20 20  |%+1)*100)..Q.   |
00000a20  20 20 cd 0d 00 52 24 20  20 20 20 20 e7 20 62 61  |  ...R$     . ba|
00000a30  6e 67 78 25 3d 6c 78 25  20 80 20 62 61 6e 67 79  |ngx%=lx% . bangy|
00000a40  25 3d 6c 79 25 20 8c 0d  00 53 5d 20 20 20 20 20  |%=ly% ...S]     |
00000a50  20 20 f2 73 70 72 69 74  65 5f 70 6c 6f 74 28 22  |  .sprite_plot("|
00000a60  65 78 70 6c 6f 73 69 6f  6e 22 2c 62 78 25 2b 62  |explosion",bx%+b|
00000a70  6f 61 72 64 6c 65 66 74  25 2b 28 62 61 6e 67 78  |oardleft%+(bangx|
00000a80  25 29 2a 31 30 30 2c 62  79 25 2b 62 6f 61 72 64  |%)*100,by%+board|
00000a90  74 6f 70 25 2d 28 62 61  6e 67 79 25 2b 31 29 2a  |top%-(bangy%+1)*|
00000aa0  31 30 30 29 0d 00 54 0a  20 20 20 20 20 cd 0d 00  |100)..T.     ...|
00000ab0  55 09 20 20 20 20 cd 0d  00 56 0c 20 20 20 ed 20  |U.    ...V.   . |
00000ac0  6c 79 25 0d 00 57 0b 20  20 ed 20 6c 78 25 0d 00  |ly%..W.  . lx%..|
00000ad0  58 25 20 20 c8 99 20 22  57 69 6d 70 5f 47 65 74  |X%  .. "Wimp_Get|
00000ae0  52 65 63 74 61 6e 67 6c  65 22 2c 2c 62 25 20 b8  |Rectangle",,b% .|
00000af0  20 6d 25 0d 00 59 05 ce  0d 00 5a 04 0d 00 5b 05  | m%..Y....Z...[.|
00000b00  e1 0d 00 5c 05 3a 0d 00  5d 21 dd 20 f2 73 70 72  |...\.:..]!. .spr|
00000b10  69 74 65 5f 70 6c 6f 74  28 73 70 72 69 74 65 24  |ite_plot(sprite$|
00000b20  2c 78 25 2c 79 25 29 0d  00 5e 3d e7 20 28 78 25  |,x%,y%)..^=. (x%|
00000b30  3e 78 30 25 2d 31 30 30  20 80 20 78 25 3c 78 31  |>x0%-100 . x%<x1|
00000b40  25 2b 31 30 30 29 20 80  20 28 79 25 3e 79 30 25  |%+100) . (y%>y0%|
00000b50  2d 31 30 30 20 80 20 79  25 3c 79 31 25 2b 31 30  |-100 . y%<y1%+10|
00000b60  30 29 20 8c 0d 00 5f 45  20 20 c8 99 20 22 57 69  |0) ..._E  .. "Wi|
00000b70  6d 70 5f 52 65 61 64 50  69 78 54 72 61 6e 73 22  |mp_ReadPixTrans"|
00000b80  2c 26 31 30 30 2c 73 70  72 69 74 65 73 25 2c 73  |,&100,sprites%,s|
00000b90  70 72 69 74 65 24 2c 2c  2c 2c 73 73 63 61 6c 65  |prite$,,,,sscale|
00000ba0  25 2c 73 74 72 61 6e 73  25 0d 00 60 43 20 20 c8  |%,strans%..`C  .|
00000bb0  99 20 22 4f 53 5f 53 70  72 69 74 65 4f 70 22 2c  |. "OS_SpriteOp",|
00000bc0  33 30 38 2c 73 70 72 69  74 65 73 25 2c 73 70 72  |308,sprites%,spr|
00000bd0  69 74 65 24 2c 78 25 2c  79 25 2c 38 2c 73 73 63  |ite$,x%,y%,8,ssc|
00000be0  61 6c 65 25 2c 73 74 72  61 6e 73 25 0d 00 61 05  |ale%,strans%..a.|
00000bf0  cd 0d 00 62 05 e1 0d 00  63 05 3a 0d 00 64 1e dd  |...b....c.:..d..|
00000c00  20 f2 62 6f 61 72 64 63  6c 69 63 6b 28 78 70 6f  | .boardclick(xpo|
00000c10  73 25 2c 79 70 6f 73 25  29 0d 00 65 0d ea 20 73  |s%,ypos%)..e.. s|
00000c20  78 25 2c 73 79 25 0d 00  66 13 e7 20 63 68 65 63  |x%,sy%..f.. chec|
00000c30  6b 69 6e 67 25 3d a3 20  8c 0d 00 67 29 20 20 f2  |king%=. ...g)  .|
00000c40  73 63 72 65 65 6e 74 6f  77 69 6e 28 62 6f 61 72  |screentowin(boar|
00000c50  64 77 69 6e 25 2c 78 70  6f 73 25 2c 79 70 6f 73  |dwin%,xpos%,ypos|
00000c60  25 29 0d 00 68 15 20 20  73 78 25 3d 78 70 6f 73  |%)..h.  sx%=xpos|
00000c70  25 20 81 20 31 30 30 0d  00 69 15 20 20 e7 20 73  |% . 100..i.  . s|
00000c80  78 25 3e 37 20 8c 20 73  78 25 3d 37 0d 00 6a 15  |x%>7 . sx%=7..j.|
00000c90  20 20 e7 20 73 78 25 3c  30 20 8c 20 73 78 25 3d  |  . sx%<0 . sx%=|
00000ca0  30 0d 00 6b 16 20 20 73  79 25 3d 2d 79 70 6f 73  |0..k.  sy%=-ypos|
00000cb0  25 20 81 20 31 30 30 0d  00 6c 15 20 20 e7 20 73  |% . 100..l.  . s|
00000cc0  79 25 3e 37 20 8c 20 73  79 25 3d 37 0d 00 6d 15  |y%>7 . sy%=7..m.|
00000cd0  20 20 e7 20 73 79 25 3c  30 20 8c 20 73 79 25 3d  |  . sy%<0 . sy%=|
00000ce0  30 0d 00 6e 1c 20 20 f2  70 6c 61 63 65 63 6f 75  |0..n.  .placecou|
00000cf0  6e 74 65 72 28 73 78 25  2c 73 79 25 29 0d 00 6f  |nter(sx%,sy%)..o|
00000d00  05 cd 0d 00 70 05 e1 0d  00 71 05 3a 0d 00 72 1c  |....p....q.:..r.|
00000d10  dd 20 f2 70 6c 61 63 65  63 6f 75 6e 74 65 72 28  |. .placecounter(|
00000d20  73 78 25 2c 73 79 25 29  0d 00 73 40 e7 20 62 6f  |sx%,sy%)..s@. bo|
00000d30  61 72 64 63 6f 6c 6f 75  72 25 28 73 78 25 2c 73  |ardcolour%(sx%,s|
00000d40  79 25 29 3d 70 6c 61 79  65 72 25 20 84 20 62 6f  |y%)=player% . bo|
00000d50  61 72 64 63 6f 6c 6f 75  72 25 28 73 78 25 2c 73  |ardcolour%(sx%,s|
00000d60  79 25 29 3d 2d 31 20 8c  0d 00 74 23 20 20 62 6f  |y%)=-1 ...t#  bo|
00000d70  61 72 64 63 6f 6c 6f 75  72 25 28 73 78 25 2c 73  |ardcolour%(sx%,s|
00000d80  79 25 29 3d 70 6c 61 79  65 72 25 0d 00 75 1f 20  |y%)=player%..u. |
00000d90  20 62 6f 61 72 64 63 6f  75 6e 74 65 72 25 28 73  | boardcounter%(s|
00000da0  78 25 2c 73 79 25 29 2b  3d 31 0d 00 76 1c 20 20  |x%,sy%)+=1..v.  |
00000db0  f2 75 70 64 61 74 65 73  71 75 61 72 65 28 73 78  |.updatesquare(sx|
00000dc0  25 2c 73 79 25 29 0d 00  77 15 20 20 d4 20 33 2c  |%,sy%)..w.  . 3,|
00000dd0  2d 31 35 2c 26 37 30 30  30 2c 30 0d 00 78 1b 20  |-15,&7000,0..x. |
00000de0  20 63 68 65 63 6b 69 6e  67 25 3d b9 3a 74 75 72  | checking%=.:tur|
00000df0  6e 73 25 2b 3d 31 0d 00  79 15 20 20 e7 20 70 6c  |ns%+=1..y.  . pl|
00000e00  61 79 65 72 25 3d 75 73  25 20 8c 0d 00 7a 28 20  |ayer%=us% ...z( |
00000e10  20 20 20 f2 6e 65 74 67  61 6d 65 5f 73 65 6e 64  |   .netgame_send|
00000e20  28 22 47 22 2b c3 28 73  78 25 29 2b c3 28 73 79  |("G"+.(sx%)+.(sy|
00000e30  25 29 29 0d 00 7b 07 20  20 cd 0d 00 7c 05 cd 0d  |%))..{.  ...|...|
00000e40  00 7d 05 e1 0d 00 7e 05  3a 0d 00 7f 12 dd 20 f2  |.}....~.:..... .|
00000e50  63 68 65 63 6b 5f 62 6f  61 72 64 0d 00 80 0d ea  |check_board.....|
00000e60  20 6c 78 25 2c 6c 79 25  0d 00 81 0f 63 68 65 63  | lx%,ly%....chec|
00000e70  6b 69 6e 67 25 3d a3 0d  00 82 1b e3 20 6c 78 25  |king%=...... lx%|
00000e80  3d 30 20 b8 20 37 3a e3  20 6c 79 25 3d 30 20 b8  |=0 . 7:. ly%=0 .|
00000e90  20 37 0d 00 83 35 20 20  e7 20 62 6f 61 72 64 63  | 7...5  . boardc|
00000ea0  6f 75 6e 74 65 72 25 28  6c 78 25 2c 6c 79 25 29  |ounter%(lx%,ly%)|
00000eb0  3e 62 6f 61 72 64 6d 61  78 6e 6f 25 28 6c 78 25  |>boardmaxno%(lx%|
00000ec0  2c 6c 79 25 29 20 8c 0d  00 84 39 20 20 20 20 62  |,ly%) ....9    b|
00000ed0  6f 61 72 64 63 6f 75 6e  74 65 72 25 28 6c 78 25  |oardcounter%(lx%|
00000ee0  2c 6c 79 25 29 3d 30 3a  62 6f 61 72 64 63 6f 6c  |,ly%)=0:boardcol|
00000ef0  6f 75 72 25 28 6c 78 25  2c 6c 79 25 29 3d 2d 31  |our%(lx%,ly%)=-1|
00000f00  0d 00 85 16 20 20 20 20  f2 62 61 6e 67 28 6c 78  |....    .bang(lx|
00000f10  25 2c 6c 79 25 29 0d 00  86 1e 20 20 20 20 f2 75  |%,ly%)....    .u|
00000f20  70 64 61 74 65 73 71 75  61 72 65 28 6c 78 25 2c  |pdatesquare(lx%,|
00000f30  6c 79 25 29 0d 00 87 11  20 20 20 20 e7 20 6c 78  |ly%)....    . lx|
00000f40  25 3e 30 20 8c 0d 00 88  25 20 20 20 20 20 20 62  |%>0 ....%      b|
00000f50  6f 61 72 64 63 6f 75 6e  74 65 72 25 28 6c 78 25  |oardcounter%(lx%|
00000f60  2d 31 2c 6c 79 25 29 2b  3d 31 0d 00 89 29 20 20  |-1,ly%)+=1...)  |
00000f70  20 20 20 20 62 6f 61 72  64 63 6f 6c 6f 75 72 25  |    boardcolour%|
00000f80  28 6c 78 25 2d 31 2c 6c  79 25 29 3d 70 6c 61 79  |(lx%-1,ly%)=play|
00000f90  65 72 25 0d 00 8a 22 20  20 20 20 20 20 f2 75 70  |er%..."      .up|
00000fa0  64 61 74 65 73 71 75 61  72 65 28 6c 78 25 2d 31  |datesquare(lx%-1|
00000fb0  2c 6c 79 25 29 0d 00 8b  15 20 20 20 20 20 20 63  |,ly%)....      c|
00000fc0  68 65 63 6b 69 6e 67 25  3d b9 0d 00 8c 09 20 20  |hecking%=.....  |
00000fd0  20 20 cd 0d 00 8d 11 20  20 20 20 e7 20 6c 78 25  |  .....    . lx%|
00000fe0  3c 37 20 8c 0d 00 8e 26  20 20 20 20 20 20 20 62  |<7 ....&       b|
00000ff0  6f 61 72 64 63 6f 75 6e  74 65 72 25 28 6c 78 25  |oardcounter%(lx%|
00001000  2b 31 2c 6c 79 25 29 2b  3d 31 0d 00 8f 29 20 20  |+1,ly%)+=1...)  |
00001010  20 20 20 20 62 6f 61 72  64 63 6f 6c 6f 75 72 25  |    boardcolour%|
00001020  28 6c 78 25 2b 31 2c 6c  79 25 29 3d 70 6c 61 79  |(lx%+1,ly%)=play|
00001030  65 72 25 0d 00 90 22 20  20 20 20 20 20 f2 75 70  |er%..."      .up|
00001040  64 61 74 65 73 71 75 61  72 65 28 6c 78 25 2b 31  |datesquare(lx%+1|
00001050  2c 6c 79 25 29 0d 00 91  15 20 20 20 20 20 20 63  |,ly%)....      c|
00001060  68 65 63 6b 69 6e 67 25  3d b9 0d 00 92 09 20 20  |hecking%=.....  |
00001070  20 20 cd 0d 00 93 11 20  20 20 20 e7 20 6c 79 25  |  .....    . ly%|
00001080  3e 30 20 8c 0d 00 94 25  20 20 20 20 20 20 62 6f  |>0 ....%      bo|
00001090  61 72 64 63 6f 75 6e 74  65 72 25 28 6c 78 25 2c  |ardcounter%(lx%,|
000010a0  6c 79 25 2d 31 29 2b 3d  31 0d 00 95 29 20 20 20  |ly%-1)+=1...)   |
000010b0  20 20 20 62 6f 61 72 64  63 6f 6c 6f 75 72 25 28  |   boardcolour%(|
000010c0  6c 78 25 2c 6c 79 25 2d  31 29 3d 70 6c 61 79 65  |lx%,ly%-1)=playe|
000010d0  72 25 0d 00 96 22 20 20  20 20 20 20 f2 75 70 64  |r%..."      .upd|
000010e0  61 74 65 73 71 75 61 72  65 28 6c 78 25 2c 6c 79  |atesquare(lx%,ly|
000010f0  25 2d 31 29 0d 00 97 15  20 20 20 20 20 20 63 68  |%-1)....      ch|
00001100  65 63 6b 69 6e 67 25 3d  b9 0d 00 98 09 20 20 20  |ecking%=.....   |
00001110  20 cd 0d 00 99 11 20 20  20 20 e7 20 6c 79 25 3c  | .....    . ly%<|
00001120  37 20 8c 0d 00 9a 25 20  20 20 20 20 20 62 6f 61  |7 ....%      boa|
00001130  72 64 63 6f 75 6e 74 65  72 25 28 6c 78 25 2c 6c  |rdcounter%(lx%,l|
00001140  79 25 2b 31 29 2b 3d 31  0d 00 9b 29 20 20 20 20  |y%+1)+=1...)    |
00001150  20 20 62 6f 61 72 64 63  6f 6c 6f 75 72 25 28 6c  |  boardcolour%(l|
00001160  78 25 2c 6c 79 25 2b 31  29 3d 70 6c 61 79 65 72  |x%,ly%+1)=player|
00001170  25 0d 00 9c 22 20 20 20  20 20 20 f2 75 70 64 61  |%..."      .upda|
00001180  74 65 73 71 75 61 72 65  28 6c 78 25 2c 6c 79 25  |tesquare(lx%,ly%|
00001190  2b 31 29 0d 00 9d 15 20  20 20 20 20 20 63 68 65  |+1)....      che|
000011a0  63 6b 69 6e 67 25 3d b9  0d 00 9e 09 20 20 20 20  |cking%=.....    |
000011b0  cd 0d 00 9f 07 20 20 cd  0d 00 a0 30 e7 20 63 68  |.....  ....0. ch|
000011c0  65 63 6b 69 6e 67 25 3d  b9 20 8c 20 6c 79 25 3d  |ecking%=. . ly%=|
000011d0  37 3a 6c 78 25 3d 37 3a  f4 20 76 65 72 79 20 62  |7:lx%=7:. very b|
000011e0  61 64 20 66 6f 72 6d 21  0d 00 a1 0f ed 20 6c 79  |ad form!..... ly|
000011f0  25 3a ed 20 6c 78 25 0d  00 a2 13 e7 20 63 68 65  |%:. lx%..... che|
00001200  63 6b 69 6e 67 25 3d a3  20 8c 0d 00 a3 39 20 20  |cking%=. ....9  |
00001210  e7 20 70 6c 61 79 65 72  25 3d 70 62 6c 75 65 25  |. player%=pblue%|
00001220  20 8c 20 70 6c 61 79 65  72 25 3d 70 67 72 65 65  | . player%=pgree|
00001230  6e 25 20 8b 20 70 6c 61  79 65 72 25 3d 70 62 6c  |n% . player%=pbl|
00001240  75 65 25 0d 00 a4 17 20  20 f2 62 61 6e 67 63 6c  |ue%....  .bangcl|
00001250  65 61 72 3a f2 63 6f 75  6e 74 0d 00 a5 12 20 20  |ear:.count....  |
00001260  f2 75 70 64 61 74 65 74  69 74 6c 65 0d 00 a6 05  |.updatetitle....|
00001270  cd 0d 00 a7 05 e1 0d 00  a8 05 3a 0d 00 a9 0c dd  |..........:.....|
00001280  20 f2 63 6f 75 6e 74 0d  00 aa 0d ea 20 6c 78 25  | .count..... lx%|
00001290  2c 6c 79 25 0d 00 ab 1a  70 62 6c 75 65 73 63 25  |,ly%....pbluesc%|
000012a0  3d 30 3a 70 67 72 65 65  6e 73 63 25 3d 30 0d 00  |=0:pgreensc%=0..|
000012b0  ac 1b e3 20 6c 78 25 3d  30 20 b8 20 37 3a e3 20  |... lx%=0 . 7:. |
000012c0  6c 79 25 3d 30 20 b8 20  37 0d 00 ad 47 20 20 e7  |ly%=0 . 7...G  .|
000012d0  20 62 6f 61 72 64 63 6f  6c 6f 75 72 25 28 6c 78  | boardcolour%(lx|
000012e0  25 2c 6c 79 25 29 3d 70  62 6c 75 65 25 20 8c 20  |%,ly%)=pblue% . |
000012f0  70 62 6c 75 65 73 63 25  2b 3d 62 6f 61 72 64 63  |pbluesc%+=boardc|
00001300  6f 75 6e 74 65 72 25 28  6c 78 25 2c 6c 79 25 29  |ounter%(lx%,ly%)|
00001310  0d 00 ae 49 20 20 e7 20  62 6f 61 72 64 63 6f 6c  |...I  . boardcol|
00001320  6f 75 72 25 28 6c 78 25  2c 6c 79 25 29 3d 70 67  |our%(lx%,ly%)=pg|
00001330  72 65 65 6e 25 20 8c 20  70 67 72 65 65 6e 73 63  |reen% . pgreensc|
00001340  25 2b 3d 62 6f 61 72 64  63 6f 75 6e 74 65 72 25  |%+=boardcounter%|
00001350  28 6c 78 25 2c 6c 79 25  29 0d 00 af 0f ed 20 6c  |(lx%,ly%)..... l|
00001360  79 25 3a ed 20 6c 78 25  0d 00 b0 2b e7 20 70 62  |y%:. lx%...+. pb|
00001370  6c 75 65 73 63 25 3d 30  20 80 20 74 75 72 6e 73  |luesc%=0 . turns|
00001380  25 3e 31 20 8c 20 70 77  6f 6e 25 3d 70 67 72 65  |%>1 . pwon%=pgre|
00001390  65 6e 25 0d 00 b1 2b e7  20 70 67 72 65 65 6e 73  |en%...+. pgreens|
000013a0  63 25 3d 30 20 80 20 74  75 72 6e 73 25 3e 31 20  |c%=0 . turns%>1 |
000013b0  8c 20 70 77 6f 6e 25 3d  70 62 6c 75 65 25 0d 00  |. pwon%=pblue%..|
000013c0  b2 29 f2 73 65 74 69 63  6f 6e 74 65 78 74 28 62  |.).seticontext(b|
000013d0  6f 61 72 64 77 69 6e 25  2c 35 2c c3 28 70 62 6c  |oardwin%,5,.(pbl|
000013e0  75 65 73 63 25 29 29 0d  00 b3 2a f2 73 65 74 69  |uesc%))...*.seti|
000013f0  63 6f 6e 74 65 78 74 28  62 6f 61 72 64 77 69 6e  |context(boardwin|
00001400  25 2c 37 2c c3 28 70 67  72 65 65 6e 73 63 25 29  |%,7,.(pgreensc%)|
00001410  29 0d 00 b4 1b e7 20 70  77 6f 6e 25 3c 3e 2d 31  |)..... pwon%<>-1|
00001420  20 8c 20 f2 67 61 6d 65  6f 76 65 72 0d 00 b5 05  | . .gameover....|
00001430  e1 0d 00 b6 05 3a 0d 00  b7 0f dd 20 f2 67 61 6d  |.....:..... .gam|
00001440  65 6f 76 65 72 0d 00 b8  0c ea 20 64 75 6d 6d 79  |eover..... dummy|
00001450  25 0d 00 b9 11 e7 20 70  77 6f 6e 25 3d 75 73 25  |%..... pwon%=us%|
00001460  20 8c 0d 00 ba 32 20 20  64 75 6d 6d 79 25 3d a4  | ....2  dummy%=.|
00001470  65 72 72 6f 72 62 6f 78  28 22 3e 4d 65 73 73 61  |errorbox(">Messa|
00001480  67 65 22 2c 22 3e 57 69  6e 55 73 22 2c 25 31 30  |ge",">WinUs",%10|
00001490  30 30 31 29 0d 00 bb 05  cc 0d 00 bc 34 20 20 64  |001)........4  d|
000014a0  75 6d 6d 79 25 3d a4 65  72 72 6f 72 62 6f 78 28  |ummy%=.errorbox(|
000014b0  22 3e 4d 65 73 73 61 67  65 22 2c 22 3e 57 69 6e  |">Message",">Win|
000014c0  54 68 65 6d 22 2c 25 31  30 30 30 31 29 0d 00 bd  |Them",%10001)...|
000014d0  05 cd 0d 00 be 05 e1 0d  00 bf 04 0d 00 c0 05 e1  |................|
000014e0  0d 00 c1 05 3a 0d 00 c2  14 dd 20 f2 62 61 6e 67  |....:..... .bang|
000014f0  28 73 78 25 2c 73 79 25  29 0d 00 c3 0e f2 62 61  |(sx%,sy%).....ba|
00001500  6e 67 63 6c 65 61 72 0d  00 c4 19 62 61 6e 67 78  |ngclear....bangx|
00001510  25 3d 73 78 25 3a 62 61  6e 67 79 25 3d 73 79 25  |%=sx%:bangy%=sy%|
00001520  0d 00 c5 20 f2 75 70 64  61 74 65 73 71 75 61 72  |... .updatesquar|
00001530  65 28 62 61 6e 67 78 25  2c 62 61 6e 67 79 25 29  |e(bangx%,bangy%)|
00001540  0d 00 c6 13 d4 20 32 2c  2d 31 35 2c 26 33 35 30  |..... 2,-15,&350|
00001550  30 2c 30 0d 00 c7 05 e1  0d 00 c8 05 3a 0d 00 c9  |0,0.........:...|
00001560  10 dd 20 f2 62 61 6e 67  63 6c 65 61 72 0d 00 ca  |.. .bangclear...|
00001570  13 ea 20 74 65 6d 70 78  25 2c 74 65 6d 70 79 25  |.. tempx%,tempy%|
00001580  0d 00 cb 1f 74 65 6d 70  78 25 3d 62 61 6e 67 78  |....tempx%=bangx|
00001590  25 3a 74 65 6d 70 79 25  3d 62 61 6e 67 79 25 0d  |%:tempy%=bangy%.|
000015a0  00 cc 17 62 61 6e 67 78  25 3d 2d 31 3a 62 61 6e  |...bangx%=-1:ban|
000015b0  67 79 25 3d 2d 31 0d 00  cd 20 f2 75 70 64 61 74  |gy%=-1... .updat|
000015c0  65 73 71 75 61 72 65 28  74 65 6d 70 78 25 2c 74  |esquare(tempx%,t|
000015d0  65 6d 70 79 25 29 0d 00  ce 05 e1 0d 00 cf 05 3a  |empy%).........:|
000015e0  0d 00 d0 1b dd 20 f2 62  6f 61 72 64 5f 63 6c 65  |..... .board_cle|
000015f0  61 72 28 6e 6f 74 69 66  79 25 29 0d 00 d1 0d ea  |ar(notify%).....|
00001600  20 73 78 25 2c 73 79 25  0d 00 d2 0f e3 20 73 78  | sx%,sy%..... sx|
00001610  25 3d 30 20 b8 20 37 0d  00 d3 11 20 20 e3 20 73  |%=0 . 7....  . s|
00001620  79 25 3d 30 20 b8 20 37  0d 00 d4 39 20 20 20 20  |y%=0 . 7...9    |
00001630  62 6f 61 72 64 63 6f 75  6e 74 65 72 25 28 73 78  |boardcounter%(sx|
00001640  25 2c 73 79 25 29 3d 30  3a 62 6f 61 72 64 63 6f  |%,sy%)=0:boardco|
00001650  6c 6f 75 72 25 28 73 78  25 2c 73 79 25 29 3d 2d  |lour%(sx%,sy%)=-|
00001660  31 0d 00 d5 20 20 20 20  20 f2 72 65 64 72 61 77  |1...     .redraw|
00001670  69 63 6f 6e 28 62 6f 61  72 64 77 69 6e 25 2c 33  |icon(boardwin%,3|
00001680  29 0d 00 d6 0b 20 20 ed  20 73 79 25 0d 00 d7 09  |)....  . sy%....|
00001690  ed 20 73 78 25 0d 00 d8  3b 74 75 72 6e 73 25 3d  |. sx%...;turns%=|
000016a0  30 3a 70 62 6c 75 65 73  63 25 3d 30 3a 70 67 72  |0:pbluesc%=0:pgr|
000016b0  65 65 6e 73 63 25 3d 30  3a 70 6c 61 79 65 72 25  |eensc%=0:player%|
000016c0  3d 70 62 6c 75 65 25 3a  70 77 6f 6e 25 3d 2d 31  |=pblue%:pwon%=-1|
000016d0  0d 00 d9 29 f2 73 65 74  69 63 6f 6e 74 65 78 74  |...).seticontext|
000016e0  28 62 6f 61 72 64 77 69  6e 25 2c 35 2c c3 28 70  |(boardwin%,5,.(p|
000016f0  62 6c 75 65 73 63 25 29  29 0d 00 da 2a f2 73 65  |bluesc%))...*.se|
00001700  74 69 63 6f 6e 74 65 78  74 28 62 6f 61 72 64 77  |ticontext(boardw|
00001710  69 6e 25 2c 37 2c c3 28  70 67 72 65 65 6e 73 63  |in%,7,.(pgreensc|
00001720  25 29 29 0d 00 db 10 f2  75 70 64 61 74 65 74 69  |%)).....updateti|
00001730  74 6c 65 0d 00 dc 11 e7  20 6e 6f 74 69 66 79 25  |tle..... notify%|
00001740  3d b9 20 8c 0d 00 dd 18  20 20 f2 6e 65 74 67 61  |=. .....  .netga|
00001750  6d 65 5f 73 65 6e 64 28  22 43 22 29 0d 00 de 05  |me_send("C")....|
00001760  cd 0d 00 df 05 e1 0d 00  e0 05 3a 0d 00 e1 12 dd  |..........:.....|
00001770  20 f2 75 70 64 61 74 65  74 69 74 6c 65 0d 00 e2  | .updatetitle...|
00001780  10 e7 20 70 77 6f 6e 25  3d 2d 31 20 8c 0d 00 e3  |.. pwon%=-1 ....|
00001790  15 20 20 e7 20 70 6c 61  79 65 72 25 3d 75 73 25  |.  . player%=us%|
000017a0  20 8c 0d 00 e4 34 20 20  20 20 f2 77 69 6e 64 6f  | ....4    .windo|
000017b0  77 74 69 74 6c 65 28 62  6f 61 72 64 77 69 6e 25  |wtitle(boardwin%|
000017c0  2c 22 3e 55 73 3a 22 2b  63 6f 6c 24 28 70 6c 61  |,">Us:"+col$(pla|
000017d0  79 65 72 25 29 29 0d 00  e5 07 20 20 cc 0d 00 e6  |yer%))....  ....|
000017e0  36 20 20 20 20 f2 77 69  6e 64 6f 77 74 69 74 6c  |6    .windowtitl|
000017f0  65 28 62 6f 61 72 64 77  69 6e 25 2c 22 3e 54 68  |e(boardwin%,">Th|
00001800  65 6d 3a 22 2b 63 6f 6c  24 28 70 6c 61 79 65 72  |em:"+col$(player|
00001810  25 29 29 0d 00 e7 07 20  20 cd 0d 00 e8 05 cc 0d  |%))....  .......|
00001820  00 e9 13 20 20 e7 20 70  77 6f 6e 25 3d 75 73 25  |...  . pwon%=us%|
00001830  20 8c 0d 00 ea 28 20 20  20 20 f2 77 69 6e 64 6f  | ....(    .windo|
00001840  77 74 69 74 6c 65 28 62  6f 61 72 64 77 69 6e 25  |wtitle(boardwin%|
00001850  2c 22 3e 57 69 6e 55 73  22 29 0d 00 eb 07 20 20  |,">WinUs")....  |
00001860  cc 0d 00 ec 2a 20 20 20  20 f2 77 69 6e 64 6f 77  |....*    .window|
00001870  74 69 74 6c 65 28 62 6f  61 72 64 77 69 6e 25 2c  |title(boardwin%,|
00001880  22 3e 57 69 6e 54 68 65  6d 22 29 0d 00 ed 07 20  |">WinThem").... |
00001890  20 cd 0d 00 ee 05 cd 0d  00 ef 05 e1 0d 00 f0 05  | ...............|
000018a0  3a 0d 00 f1 1c dd 20 f2  75 70 64 61 74 65 73 71  |:..... .updatesq|
000018b0  75 61 72 65 28 73 78 25  2c 73 79 25 29 0d 00 f2  |uare(sx%,sy%)...|
000018c0  25 ea 20 6c 65 66 74 25  2c 74 6f 70 25 2c 72 69  |%. left%,top%,ri|
000018d0  67 68 74 25 2c 62 6f 74  74 6f 6d 25 2c 6d 6f 72  |ght%,bottom%,mor|
000018e0  65 25 0d 00 f3 1c 6c 65  66 74 25 3d 62 6f 61 72  |e%....left%=boar|
000018f0  64 6c 65 66 74 25 2b 73  78 25 2a 31 30 30 0d 00  |dleft%+sx%*100..|
00001900  f4 1a 74 6f 70 25 3d 62  6f 61 72 64 74 6f 70 25  |..top%=boardtop%|
00001910  2d 73 79 25 2a 31 30 30  0d 00 f5 14 72 69 67 68  |-sy%*100....righ|
00001920  74 25 3d 6c 65 66 74 25  2b 31 30 30 0d 00 f6 14  |t%=left%+100....|
00001930  62 6f 74 74 6f 6d 25 3d  74 6f 70 25 2d 31 30 30  |bottom%=top%-100|
00001940  0d 00 f7 12 62 25 21 30  3d 62 6f 61 72 64 77 69  |....b%!0=boardwi|
00001950  6e 25 0d 00 f8 1b 62 25  21 34 3d 6c 65 66 74 25  |n%....b%!4=left%|
00001960  3a 62 25 21 38 3d 62 6f  74 74 6f 6d 25 0d 00 f9  |:b%!8=bottom%...|
00001970  1b 62 25 21 31 32 3d 72  69 67 68 74 25 3a 62 25  |.b%!12=right%:b%|
00001980  21 31 36 3d 74 6f 70 25  0d 00 fa 26 c8 99 20 22  |!16=top%...&.. "|
00001990  57 69 6d 70 5f 55 70 64  61 74 65 57 69 6e 64 6f  |Wimp_UpdateWindo|
000019a0  77 22 2c 2c 62 25 20 b8  20 6d 6f 72 65 25 0d 00  |w",,b% . more%..|
000019b0  fb 19 f2 64 72 61 77 5f  62 6f 61 72 64 28 62 25  |...draw_board(b%|
000019c0  2c 6d 6f 72 65 25 29 0d  00 fc 05 e1 0d 00 fd 05  |,more%).........|
000019d0  3a 0d 00 fe 0f dd 20 f2  76 61 72 73 28 42 25 29  |:..... .vars(B%)|
000019e0  0d 00 ff 3f 78 30 25 3d  42 25 21 34 3a 79 30 25  |...?x0%=B%!4:y0%|
000019f0  3d 42 25 21 38 3a 78 31  25 3d 42 25 21 31 32 3a  |=B%!8:x1%=B%!12:|
00001a00  79 31 25 3d 42 25 21 31  36 3a 73 63 78 25 3d 42  |y1%=B%!16:scx%=B|
00001a10  25 21 32 30 3a 73 63 79  25 3d 42 25 21 32 34 0d  |%!20:scy%=B%!24.|
00001a20  01 00 1d 62 78 25 3d 78  30 25 2d 73 63 78 25 3a  |...bx%=x0%-scx%:|
00001a30  62 79 25 3d 79 31 25 2d  73 63 79 25 0d 01 01 16  |by%=y1%-scy%....|
00001a40  72 65 64 72 61 77 5f 6d  69 6e 78 25 3d 42 25 21  |redraw_minx%=B%!|
00001a50  32 38 0d 01 02 16 72 65  64 72 61 77 5f 6d 69 6e  |28....redraw_min|
00001a60  79 25 3d 42 25 21 33 32  0d 01 03 16 72 65 64 72  |y%=B%!32....redr|
00001a70  61 77 5f 6d 61 78 78 25  3d 42 25 21 33 36 0d 01  |aw_maxx%=B%!36..|
00001a80  04 16 72 65 64 72 61 77  5f 6d 61 78 79 25 3d 42  |..redraw_maxy%=B|
00001a90  25 21 34 30 0d 01 05 05  e1 0d 01 06 05 3a 0d 01  |%!40.........:..|
00001aa0  07 30 f4 20 42 75 74 74  6f 6e 73 20 3a 20 31 20  |.0. Buttons : 1 |
00001ab0  3d 20 41 64 6a 75 73 74  2c 20 32 20 3d 20 4d 65  |= Adjust, 2 = Me|
00001ac0  6e 75 2c 20 34 20 3d 20  53 65 6c 65 63 74 0d 01  |nu, 4 = Select..|
00001ad0  08 23 dd 20 f2 6d 6f 75  73 65 63 6c 69 63 6b 28  |.#. .mouseclick(|
00001ae0  78 2c 79 2c 62 75 74 2c  77 69 6e 2c 69 63 6f 6e  |x,y,but,win,icon|
00001af0  29 0d 01 09 0c c8 8e 20  77 69 6e 20 ca 0d 01 0a  |)...... win ....|
00001b00  09 20 c9 20 2d 32 0d 01  0b 0e 20 20 c8 8e 20 62  |. . -2....  .. b|
00001b10  75 74 20 ca 0d 01 0c 11  20 20 c9 20 32 3a f2 69  |ut .....  . 2:.i|
00001b20  62 6d 65 6e 75 0d 01 0d  1f 20 20 20 c9 20 31 2c  |bmenu....   . 1,|
00001b30  34 3a f4 20 53 65 6c 65  63 74 20 6f 72 20 61 64  |4:. Select or ad|
00001b40  6a 75 73 74 0d 01 0e 1e  20 20 20 20 e7 20 a4 6e  |just....    . .n|
00001b50  65 74 67 61 6d 65 5f 63  6f 6e 6e 65 63 74 65 64  |etgame_connected|
00001b60  20 8c 0d 01 0f 1d 20 20  20 20 20 20 f2 6f 70 65  | .....      .ope|
00001b70  6e 77 69 6e 28 62 6f 61  72 64 77 69 6e 25 29 0d  |nwin(boardwin%).|
00001b80  01 10 09 20 20 20 20 cc  0d 01 11 30 20 20 20 20  |...    ....0    |
00001b90  20 20 f2 6f 70 65 6e 63  6f 6e 6e 65 63 74 3a f4  |  .openconnect:.|
00001ba0  20 4f 70 65 6e 20 74 68  65 20 63 6f 6e 6e 65 63  | Open the connec|
00001bb0  74 20 77 69 6e 64 6f 77  0d 01 12 09 20 20 20 20  |t window....    |
00001bc0  cd 0d 01 13 07 20 20 cb  0d 01 14 10 20 c9 20 62  |.....  ..... . b|
00001bd0  6f 61 72 64 77 69 6e 25  0d 01 15 0f 20 20 c8 8e  |oardwin%....  ..|
00001be0  20 69 63 6f 6e 20 ca 0d  01 16 2c 20 20 20 c9 20  | icon ....,   . |
00001bf0  2d 31 3a e7 20 62 75 74  3d 32 20 8c 20 f2 6d 65  |-1:. but=2 . .me|
00001c00  6e 75 28 62 6f 61 72 64  6d 65 6e 75 25 2c 2d 31  |nu(boardmenu%,-1|
00001c10  2c 30 29 0d 01 17 1a 20  20 20 c9 20 30 3a f2 62  |,0)....   . 0:.b|
00001c20  6f 61 72 64 5f 63 6c 65  61 72 28 b9 29 0d 01 18  |oard_clear(.)...|
00001c30  2f 20 20 20 c9 20 31 3a  e7 20 62 75 74 3d 31 20  |/   . 1:. but=1 |
00001c40  84 20 62 75 74 3d 34 20  8c 20 f2 6f 70 65 6e 77  |. but=4 . .openw|
00001c50  69 6e 28 73 65 6e 64 77  69 6e 25 29 0d 01 19 28  |in(sendwin%)...(|
00001c60  20 20 20 c9 20 32 3a e7  20 62 75 74 3d 31 20 84  |   . 2:. but=1 .|
00001c70  20 62 75 74 3d 34 20 8c  20 f2 64 69 73 63 6f 6e  | but=4 . .discon|
00001c80  6e 65 63 74 0d 01 1a 2b  20 20 20 c9 20 33 3a e7  |nect...+   . 3:.|
00001c90  20 62 75 74 3d 32 20 8c  20 f2 6d 65 6e 75 28 62  | but=2 . .menu(b|
00001ca0  6f 61 72 64 6d 65 6e 75  25 2c 2d 31 2c 30 29 0d  |oardmenu%,-1,0).|
00001cb0  01 1b 2c 20 20 20 20 20  20 20 20 20 20 e7 20 62  |..,          . b|
00001cc0  75 74 3d 34 20 80 20 a4  6e 65 74 67 61 6d 65 5f  |ut=4 . .netgame_|
00001cd0  63 6f 6e 6e 65 63 74 65  64 20 8c 0d 01 1c 3b 20  |connected ....; |
00001ce0  20 20 20 20 20 20 20 20  20 20 20 e7 20 70 77 6f  |           . pwo|
00001cf0  6e 25 3d 2d 31 20 80 20  70 6c 61 79 65 72 25 3d  |n%=-1 . player%=|
00001d00  75 73 25 20 8c 20 f2 62  6f 61 72 64 63 6c 69 63  |us% . .boardclic|
00001d10  6b 28 78 2c 79 29 0d 01  1d 0f 20 20 20 20 20 20  |k(x,y)....      |
00001d20  20 20 20 20 cd 0d 01 1e  07 20 20 cb 0d 01 1f 0f  |    .....  .....|
00001d30  20 c9 20 69 6e 66 6f 62  6f 78 25 0d 01 20 0f 20  | . infobox%.. . |
00001d40  20 c8 8e 20 69 63 6f 6e  20 ca 0d 01 21 23 20 20  | .. icon ...!#  |
00001d50  20 c9 20 31 3a e7 20 74  65 73 74 69 6e 67 25 3d  | . 1:. testing%=|
00001d60  b9 20 8c 20 f2 73 68 6f  77 66 72 65 65 0d 01 22  |. . .showfree.."|
00001d70  38 20 20 20 c9 20 33 3a  f2 46 65 74 63 68 50 61  |8   . 3:.FetchPa|
00001d80  67 65 28 22 68 74 74 70  3a 2f 2f 63 6f 6d 65 2e  |ge("http://come.|
00001d90  74 6f 2f 66 61 62 6c 61  6e 64 2f 66 61 62 73 6f  |to/fabland/fabso|
00001da0  66 74 2f 22 29 0d 01 23  1e 20 20 20 c9 20 34 3a  |ft/")..#.   . 4:|
00001db0  f2 46 65 74 63 68 50 61  67 65 28 41 70 70 55 52  |.FetchPage(AppUR|
00001dc0  4c 24 29 0d 01 24 07 20  20 cb 0d 01 25 12 20 c9  |L$)..$.  ...%. .|
00001dd0  20 63 6f 6e 6e 65 63 74  77 69 6e 25 0d 01 26 0f  | connectwin%..&.|
00001de0  20 20 c8 8e 20 69 63 6f  6e 20 ca 0d 01 27 37 20  |  .. icon ...'7 |
00001df0  20 20 c9 20 35 3a f2 6d  65 6e 75 28 a4 6e 65 74  |  . 5:.menu(.net|
00001e00  67 61 6d 65 5f 73 69 74  65 73 6d 65 6e 75 2c 2d  |game_sitesmenu,-|
00001e10  31 2c 2d 31 29 3a f4 20  53 69 74 65 73 20 6c 69  |1,-1):. Sites li|
00001e20  73 74 0d 01 28 16 20 20  20 c9 20 34 3a f2 74 72  |st..(.   . 4:.tr|
00001e30  79 63 6f 6e 6e 65 63 74  0d 01 29 07 20 20 cb 0d  |yconnect..).  ..|
00001e40  01 2a 0f 20 c9 20 73 65  6e 64 77 69 6e 25 0d 01  |.*. . sendwin%..|
00001e50  2b 0f 20 20 c8 8e 20 69  63 6f 6e 20 ca 0d 01 2c  |+.  .. icon ...,|
00001e60  2a 20 20 20 c9 20 32 3a  f4 20 43 61 6e 63 65 6c  |*   . 2:. Cancel|
00001e70  20 2d 20 63 6c 65 61 72  20 74 65 78 74 20 61 6e  | - clear text an|
00001e80  64 20 63 6c 6f 73 65 0d  01 2d 23 20 20 20 20 f2  |d close..-#    .|
00001e90  73 65 74 69 63 6f 6e 74  65 78 74 28 73 65 6e 64  |seticontext(send|
00001ea0  77 69 6e 25 2c 30 2c 22  22 29 0d 01 2e 1b 20 20  |win%,0,"")....  |
00001eb0  20 20 f2 63 6c 6f 73 65  77 69 6e 28 73 65 6e 64  |  .closewin(send|
00001ec0  77 69 6e 25 29 0d 01 2f  11 20 20 20 c9 20 31 3a  |win%)../.   . 1:|
00001ed0  f4 20 53 65 6e 64 0d 01  30 14 20 20 20 20 f2 73  |. Send..0.    .s|
00001ee0  65 6e 64 6d 65 73 73 61  67 65 0d 01 31 07 20 20  |endmessage..1.  |
00001ef0  cb 0d 01 32 0e 20 c9 20  6d 73 67 77 69 6e 25 0d  |...2. . msgwin%.|
00001f00  01 33 0f 20 20 c8 8e 20  69 63 6f 6e 20 ca 0d 01  |.3.  .. icon ...|
00001f10  34 12 20 20 20 c9 20 32  3a f4 20 52 65 70 6c 79  |4.   . 2:. Reply|
00001f20  0d 01 35 12 20 20 20 20  f2 6f 70 65 6e 72 65 70  |..5.    .openrep|
00001f30  6c 79 0d 01 36 0f 20 20  20 c9 20 31 3a f4 20 4f  |ly..6.   . 1:. O|
00001f40  6b 0d 01 37 16 20 20 20  20 f2 63 6c 6f 73 65 77  |k..7.    .closew|
00001f50  69 6e 28 77 69 6e 29 0d  01 38 07 20 20 cb 0d 01  |in(win)..8.  ...|
00001f60  39 10 20 c9 20 62 6f 61  72 64 77 69 6e 25 0d 01  |9. . boardwin%..|
00001f70  3a 0f 20 20 c8 8e 20 69  63 6f 6e 20 ca 0d 01 3b  |:.  .. icon ...;|
00001f80  14 20 20 20 c9 20 31 3a  f4 20 4d 65 73 73 61 67  |.   . 1:. Messag|
00001f90  65 0d 01 3c 1a 20 20 20  20 f2 6f 70 65 6e 77 69  |e..<.    .openwi|
00001fa0  6e 28 73 65 6e 64 77 69  6e 25 29 0d 01 3d 20 20  |n(sendwin%)..=  |
00001fb0  20 20 20 f2 73 65 74 63  61 72 65 74 65 6e 64 28  |   .setcaretend(|
00001fc0  73 65 6e 64 77 69 6e 25  2c 30 29 0d 01 3e 08 20  |sendwin%,0)..>. |
00001fd0  20 20 cb 0d 01 3f 05 cb  0d 01 40 05 e1 0d 01 41  |  ...?....@....A|
00001fe0  05 3a 0d 01 42 24 dd 20  f2 67 72 65 79 6f 75 74  |.:..B$. .greyout|
00001ff0  69 63 6f 6e 73 5f 63 6f  73 5f 64 69 73 63 6f 6e  |icons_cos_discon|
00002000  6e 65 63 74 65 64 0d 01  43 1d f2 69 63 6f 6e 73  |nected..C..icons|
00002010  68 61 64 65 28 62 6f 61  72 64 77 69 6e 25 2c 30  |hade(boardwin%,0|
00002020  2c 31 29 0d 01 44 1d f2  69 63 6f 6e 73 68 61 64  |,1)..D..iconshad|
00002030  65 28 62 6f 61 72 64 77  69 6e 25 2c 31 2c 31 29  |e(boardwin%,1,1)|
00002040  0d 01 45 14 f4 20 61 6e  64 20 6d 65 6e 75 73 20  |..E.. and menus |
00002050  74 6f 6f 21 0d 01 46 1e  f2 6d 65 6e 75 73 68 61  |too!..F..menusha|
00002060  64 65 28 62 6f 61 72 64  6d 65 6e 75 25 2c 31 2c  |de(boardmenu%,1,|
00002070  31 29 0d 01 47 1e f2 6d  65 6e 75 73 68 61 64 65  |1)..G..menushade|
00002080  28 62 6f 61 72 64 6d 65  6e 75 25 2c 32 2c 31 29  |(boardmenu%,2,1)|
00002090  0d 01 48 05 e1 0d 01 49  05 3a 0d 01 4a 23 dd 20  |..H....I.:..J#. |
000020a0  f2 75 6e 67 72 65 79 6f  75 74 69 63 6f 6e 73 5f  |.ungreyouticons_|
000020b0  63 6f 73 5f 63 6f 6e 6e  65 63 74 65 64 0d 01 4b  |cos_connected..K|
000020c0  1d f2 69 63 6f 6e 73 68  61 64 65 28 62 6f 61 72  |..iconshade(boar|
000020d0  64 77 69 6e 25 2c 30 2c  30 29 0d 01 4c 1d f2 69  |dwin%,0,0)..L..i|
000020e0  63 6f 6e 73 68 61 64 65  28 62 6f 61 72 64 77 69  |conshade(boardwi|
000020f0  6e 25 2c 31 2c 30 29 0d  01 4d 14 f4 20 61 6e 64  |n%,1,0)..M.. and|
00002100  20 6d 65 6e 75 73 20 74  6f 6f 21 0d 01 4e 1e f2  | menus too!..N..|
00002110  6d 65 6e 75 73 68 61 64  65 28 62 6f 61 72 64 6d  |menushade(boardm|
00002120  65 6e 75 25 2c 31 2c 30  29 0d 01 4f 1e f2 6d 65  |enu%,1,0)..O..me|
00002130  6e 75 73 68 61 64 65 28  62 6f 61 72 64 6d 65 6e  |nushade(boardmen|
00002140  75 25 2c 32 2c 30 29 0d  01 50 05 e1 0d 01 51 05  |u%,2,0)..P....Q.|
00002150  3a 0d 01 52 1f dd 20 f2  70 72 6f 63 65 73 73 6b  |:..R.. .processk|
00002160  65 79 28 77 69 6e 2c 69  63 6f 6e 2c 6b 65 79 29  |ey(win,icon,key)|
00002170  0d 01 53 17 ea 20 6b 65  79 64 6f 6e 65 3a 6b 65  |..S.. keydone:ke|
00002180  79 64 6f 6e 65 3d a3 0d  01 54 0c c8 8e 20 77 69  |ydone=...T... wi|
00002190  6e 20 ca 0d 01 55 12 20  c9 20 63 6f 6e 6e 65 63  |n ...U. . connec|
000021a0  74 77 69 6e 25 0d 01 56  0e 20 20 c8 8e 20 6b 65  |twin%..V.  .. ke|
000021b0  79 20 ca 0d 01 57 23 20  20 20 c9 20 32 37 3a f4  |y ...W#   . 27:.|
000021c0  20 45 73 63 61 70 65 20  2d 20 63 6c 6f 73 65 20  | Escape - close |
000021d0  77 69 6e 64 6f 77 0d 01  58 1e 20 20 20 20 f2 63  |window..X.    .c|
000021e0  6c 6f 73 65 77 69 6e 28  63 6f 6e 6e 65 63 74 77  |losewin(connectw|
000021f0  69 6e 25 29 0d 01 59 14  20 20 20 c9 20 31 33 3a  |in%)..Y.   . 13:|
00002200  f4 20 52 65 74 75 72 6e  0d 01 5a 1d 20 20 20 20  |. Return..Z.    |
00002210  f2 74 72 79 63 6f 6e 6e  65 63 74 3a 6b 65 79 64  |.tryconnect:keyd|
00002220  6f 6e 65 3d b9 0d 01 5b  07 20 20 cb 0d 01 5c 0f  |one=...[.  ...\.|
00002230  20 c9 20 73 65 6e 64 77  69 6e 25 0d 01 5d 0e 20  | . sendwin%..]. |
00002240  20 c8 8e 20 6b 65 79 20  ca 0d 01 5e 23 20 20 20  | .. key ...^#   |
00002250  c9 20 32 37 3a f4 20 45  73 63 61 70 65 20 2d 20  |. 27:. Escape - |
00002260  63 6c 6f 73 65 20 77 69  6e 64 6f 77 0d 01 5f 25  |close window.._%|
00002270  20 20 20 20 f2 63 6c 6f  73 65 77 69 6e 28 73 65  |    .closewin(se|
00002280  6e 64 77 69 6e 25 29 3a  6b 65 79 64 6f 6e 65 3d  |ndwin%):keydone=|
00002290  b9 0d 01 60 14 20 20 20  c9 20 31 33 3a f4 20 52  |...`.   . 13:. R|
000022a0  65 74 75 72 6e 0d 01 61  1e 20 20 20 20 f2 73 65  |eturn..a.    .se|
000022b0  6e 64 6d 65 73 73 61 67  65 3a 6b 65 79 64 6f 6e  |ndmessage:keydon|
000022c0  65 3d b9 0d 01 62 07 20  20 cb 0d 01 63 05 cb 0d  |e=...b.  ...c...|
000022d0  01 64 2a e7 20 ac 20 6b  65 79 64 6f 6e 65 20 8c  |.d*. . keydone .|
000022e0  20 c8 99 20 22 57 69 6d  70 5f 50 72 6f 63 65 73  | .. "Wimp_Proces|
000022f0  73 4b 65 79 22 2c 6b 65  79 0d 01 65 05 e1 0d 01  |sKey",key..e....|
00002300  66 05 3a 0d 01 67 11 dd  20 f2 6d 65 6e 75 63 68  |f.:..g.. .menuch|
00002310  6f 69 63 65 0d 01 68 44  c8 99 22 57 69 6d 70 5f  |oice..hD.."Wimp_|
00002320  47 65 74 50 6f 69 6e 74  65 72 49 6e 66 6f 22 2c  |GetPointerInfo",|
00002330  2c 6d 65 73 73 61 67 65  5f 62 75 66 66 65 72 25  |,message_buffer%|
00002340  3a 6d 62 75 74 25 3d 6d  65 73 73 61 67 65 5f 62  |:mbut%=message_b|
00002350  75 66 66 65 72 25 21 38  0d 01 69 11 c8 8e 20 63  |uffer%!8..i... c|
00002360  75 72 6d 65 6e 75 25 20  ca 0d 01 6a 38 20 c9 20  |urmenu% ...j8 . |
00002370  a4 6e 65 74 67 61 6d 65  5f 73 69 74 65 73 6d 65  |.netgame_sitesme|
00002380  6e 75 3a f4 20 54 68 65  20 73 69 74 65 73 20 6d  |nu:. The sites m|
00002390  65 6e 75 2c 20 73 6f 20  73 65 6c 65 63 74 20 69  |enu, so select i|
000023a0  74 0d 01 6b 31 20 20 f2  6e 65 74 67 61 6d 65 5f  |t..k1  .netgame_|
000023b0  73 65 6c 65 63 74 73 69  74 65 28 21 62 25 2c 63  |selectsite(!b%,c|
000023c0  6f 6e 6e 65 63 74 77 69  6e 25 2c 31 2c 33 2c 2d  |onnectwin%,1,3,-|
000023d0  31 29 0d 01 6c 40 20 20  63 75 72 6d 65 6e 75 25  |1)..l@  curmenu%|
000023e0  3d a4 6e 65 74 67 61 6d  65 5f 73 69 74 65 73 6d  |=.netgame_sitesm|
000023f0  65 6e 75 3a f4 20 49 6e  20 63 61 73 65 20 69 74  |enu:. In case it|
00002400  27 73 20 62 65 65 6e 20  72 65 2d 63 72 65 61 74  |'s been re-creat|
00002410  65 64 0d 01 6d 0e 20 c9  20 69 62 6d 65 6e 75 25  |ed..m. . ibmenu%|
00002420  0d 01 6e 0e 20 20 c8 8e  20 21 62 25 20 ca 0d 01  |..n.  .. !b% ...|
00002430  6f 12 20 20 20 c9 20 32  3a 71 75 69 74 25 3d b9  |o.   . 2:quit%=.|
00002440  0d 01 70 37 20 20 20 c9  20 31 3a f2 6e 65 74 67  |..p7   . 1:.netg|
00002450  61 6d 65 5f 65 64 69 74  73 69 74 65 73 28 62 65  |ame_editsites(be|
00002460  73 74 70 6f 72 74 25 29  3a f4 20 45 64 69 74 69  |stport%):. Editi|
00002470  6e 67 20 74 69 6d 65 0d  01 71 07 20 20 cb 0d 01  |ng time..q.  ...|
00002480  72 11 20 c9 20 62 6f 61  72 64 6d 65 6e 75 25 0d  |r. . boardmenu%.|
00002490  01 73 0e 20 20 c8 8e 20  21 62 25 20 ca 0d 01 74  |.s.  .. !b% ...t|
000024a0  16 20 20 20 c9 20 32 3a  f2 64 69 73 63 6f 6e 6e  |.   . 2:.disconn|
000024b0  65 63 74 0d 01 75 26 20  20 20 c9 20 31 3a f2 62  |ect..u&   . 1:.b|
000024c0  6f 61 72 64 5f 63 6c 65  61 72 28 b9 29 3a f4 20  |oard_clear(.):. |
000024d0  74 65 6c 6c 20 74 68 65  6d 0d 01 76 07 20 20 cb  |tell them..v.  .|
000024e0  0d 01 77 05 cb 0d 01 78  2f e7 20 28 6d 62 75 74  |..w....x/. (mbut|
000024f0  25 80 31 29 3d 31 20 8c  20 f2 72 65 63 72 65 61  |%.1)=1 . .recrea|
00002500  74 65 6d 65 6e 75 20 8b  20 63 75 72 6d 65 6e 75  |temenu . curmenu|
00002510  25 3d 2d 31 0d 01 79 05  e1 0d 01 7a 05 3a 0d 01  |%=-1..y....z.:..|
00002520  7b 11 dd 20 f2 64 69 73  63 6f 6e 6e 65 63 74 0d  |{.. .disconnect.|
00002530  01 7c 22 f2 67 72 65 79  6f 75 74 69 63 6f 6e 73  |.|".greyouticons|
00002540  5f 63 6f 73 5f 64 69 73  63 6f 6e 6e 65 63 74 65  |_cos_disconnecte|
00002550  64 0d 01 7d 17 f2 6e 65  74 67 61 6d 65 5f 64 69  |d..}..netgame_di|
00002560  73 63 6f 6e 6e 65 63 74  0d 01 7e 10 f2 75 70 64  |sconnect..~..upd|
00002570  61 74 65 74 69 74 6c 65  0d 01 7f 05 e1 0d 01 80  |atetitle........|
00002580  05 3a 0d 01 81 14 dd 20  f2 72 65 63 65 69 76 65  |.:..... .receive|
00002590  28 6d 65 73 73 29 0d 01  82 0d c8 8e 20 6d 65 73  |(mess)...... mes|
000025a0  73 20 ca 0d 01 83 1b 20  f4 20 26 34 30 30 43 31  |s ..... . &400C1|
000025b0  20 3d 20 6d 6f 64 65 20  63 68 61 6e 67 65 0d 01  | = mode change..|
000025c0  84 1d 20 f4 20 26 34 30  30 43 32 20 3d 20 74 61  |.. . &400C2 = ta|
000025d0  73 6b 20 73 74 61 72 74  20 75 70 0d 01 85 1e 20  |sk start up.... |
000025e0  f4 20 26 34 30 30 43 33  20 3d 20 74 61 73 6b 20  |. &400C3 = task |
000025f0  73 68 75 74 20 64 6f 77  6e 0d 01 86 2b 20 c9 20  |shut down...+ . |
00002600  26 39 30 32 38 31 3a f4  20 53 69 74 65 73 20 66  |&90281:. Sites f|
00002610  69 6c 65 20 68 61 73 20  62 65 65 6e 20 75 70 64  |ile has been upd|
00002620  61 74 65 64 0d 01 87 18  20 20 f2 6e 65 74 67 61  |ated....  .netga|
00002630  6d 65 5f 72 65 61 64 73  69 74 65 73 0d 01 88 12  |me_readsites....|
00002640  20 c9 20 30 3a 71 75 69  74 25 3d b9 2a 32 0d 01  | . 0:quit%=.*2..|
00002650  89 23 20 c9 20 26 35 30  32 3a f2 48 65 6c 70 28  |.# . &502:.Help(|
00002660  62 25 21 33 32 2c 62 25  21 33 36 2c 62 25 21 34  |b%!32,b%!36,b%!4|
00002670  29 0d 01 8a 1d 20 c9 20  31 30 3a f2 64 65 73 6b  |).... . 10:.desk|
00002680  74 6f 70 73 61 76 65 28  62 25 21 32 30 29 0d 01  |topsave(b%!20)..|
00002690  8b 05 cb 0d 01 8c 05 e1  0d 01 8d 05 3a 0d 01 8e  |............:...|
000026a0  17 dd 20 f2 72 65 63 65  69 76 65 61 63 6b 28 6d  |.. .receiveack(m|
000026b0  65 73 73 29 0d 01 8f 0d  c8 8e 20 6d 65 73 73 20  |ess)...... mess |
000026c0  ca 0d 01 90 05 cb 0d 01  91 05 e1 0d 01 92 05 3a  |...............:|
000026d0  0d 01 93 19 dd 20 f2 64  65 73 6b 74 6f 70 73 61  |..... .desktopsa|
000026e0  76 65 28 66 69 6c 65 25  29 0d 01 94 07 ea 20 85  |ve(file%)..... .|
000026f0  0d 01 95 3b ee 20 85 20  ea 20 62 25 21 31 32 3d  |...;. . . b%!12=|
00002700  62 25 21 38 3a c8 99 20  22 57 69 6d 70 5f 53 65  |b%!8:.. "Wimp_Se|
00002710  6e 64 4d 65 73 73 61 67  65 22 2c 31 39 2c 62 25  |ndMessage",19,b%|
00002720  2c 62 25 21 34 3a f7 20  85 3a e1 0d 01 96 40 f4  |,b%!4:. .:....@.|
00002730  20 54 68 65 20 61 62 6f  76 65 20 6c 69 6e 65 20  | The above line |
00002740  61 63 6b 6e 6f 77 6c 65  64 67 65 73 20 74 68 65  |acknowledges the|
00002750  20 6d 65 73 73 61 67 65  20 69 66 20 61 6e 20 65  | message if an e|
00002760  72 72 6f 72 20 6f 63 63  75 72 73 0d 01 97 20 f4  |rror occurs... .|
00002770  20 61 62 6f 72 74 69 6e  67 20 74 68 65 20 64 65  | aborting the de|
00002780  73 6b 74 6f 70 20 73 61  76 65 2e 0d 01 98 1a d5  |sktop save......|
00002790  23 66 69 6c 65 25 2c 22  52 75 6e 20 22 2b 41 70  |#file%,"Run "+Ap|
000027a0  70 64 69 72 24 0d 01 99  05 e1 0d 01 9a 05 3a 0d  |pdir$.........:.|
000027b0  01 9b 1b dd 20 f2 6c 6f  61 64 66 69 6c 65 28 66  |.... .loadfile(f|
000027c0  69 6c 65 24 2c 74 79 70  65 29 0d 01 9c 0d c8 8e  |ile$,type)......|
000027d0  20 74 79 70 65 20 ca 0d  01 9d 05 cb 0d 01 9e 05  | type ..........|
000027e0  e1 0d 01 9f 05 3a 0d 01  a0 2f f4 20 41 6e 79 20  |.....:.../. Any |
000027f0  6d 65 73 73 61 67 65 73  20 74 6f 20 62 65 20 72  |messages to be r|
00002800  65 63 65 69 76 65 64 20  4d 55 53 54 20 62 65 20  |eceived MUST be |
00002810  6e 6f 74 65 64 0d 01 a1  0f dd 20 f2 69 6e 69 74  |noted..... .init|
00002820  77 69 6d 70 0d 01 a2 21  de 20 6d 65 73 73 61 67  |wimp...!. messag|
00002830  65 6c 69 73 74 25 20 32  35 36 3a 6d 65 73 73 70  |elist% 256:messp|
00002840  74 72 25 3d 30 0d 01 a3  3c f2 6e 6f 74 65 6d 65  |tr%=0...<.noteme|
00002850  73 73 61 67 65 28 26 35  30 32 29 3a f2 6e 6f 74  |ssage(&502):.not|
00002860  65 6d 65 73 73 61 67 65  28 31 30 29 3a f2 6e 6f  |emessage(10):.no|
00002870  74 65 6d 65 73 73 61 67  65 28 26 39 30 32 38 31  |temessage(&90281|
00002880  29 0d 01 a4 13 f2 6e 6f  74 65 6d 65 73 73 61 67  |).....notemessag|
00002890  65 28 30 29 0d 01 a5 55  c8 99 20 22 57 69 6d 70  |e(0)...U.. "Wimp|
000028a0  5f 49 6e 69 74 69 61 6c  69 73 65 22 2c 33 31 30  |_Initialise",310|
000028b0  2c 26 34 42 35 33 34 31  35 34 2c 41 70 70 6e 61  |,&4B534154,Appna|
000028c0  6d 65 24 2c 6d 65 73 73  61 67 65 6c 69 73 74 25  |me$,messagelist%|
000028d0  20 b8 20 77 69 6d 70 76  65 72 73 69 6f 6e 2c 74  | . wimpversion,t|
000028e0  61 73 6b 68 61 6e 64 6c  65 0d 01 a6 47 69 6e 64  |askhandle...Gind|
000028f0  6c 25 3d 31 30 32 34 3a  6d 65 6e 75 6c 25 3d 31  |l%=1024:menul%=1|
00002900  30 32 34 3a de 20 62 25  20 32 30 34 38 2c 69 6e  |024:. b% 2048,in|
00002910  64 25 20 69 6e 64 6c 25  2c 6d 65 6e 75 25 20 6d  |d% indl%,menu% m|
00002920  65 6e 75 6c 25 2c 77 73  70 63 25 20 26 38 30 30  |enul%,wspc% &800|
00002930  0d 01 a7 0f 63 75 72 6d  65 6e 75 25 3d 2d 31 0d  |....curmenu%=-1.|
00002940  01 a8 11 f2 6f 70 65 6e  6d 65 73 73 61 67 65 73  |....openmessages|
00002950  0d 01 a9 2d 73 70 72 69  74 65 73 25 3d a4 6c 6f  |...-sprites%=.lo|
00002960  61 64 73 70 72 69 74 65  73 28 41 70 70 64 69 72  |adsprites(Appdir|
00002970  24 2b 22 2e 53 70 72 69  74 65 73 22 29 0d 01 aa  |$+".Sprites")...|
00002980  24 69 6e 66 6f 62 6f 78  25 3d a4 6c 6f 61 64 74  |$infobox%=.loadt|
00002990  65 6d 70 6c 61 74 65 28  22 49 6e 66 6f 22 2c 31  |emplate("Info",1|
000029a0  29 0d 01 ab 2a 63 6f 6e  6e 65 63 74 77 69 6e 25  |)...*connectwin%|
000029b0  3d a4 6c 6f 61 64 74 65  6d 70 6c 61 74 65 28 22  |=.loadtemplate("|
000029c0  63 6f 6e 6e 65 63 74 22  2c 31 29 0d 01 ac 24 73  |connect",1)...$s|
000029d0  65 6e 64 77 69 6e 25 3d  a4 6c 6f 61 64 74 65 6d  |endwin%=.loadtem|
000029e0  70 6c 61 74 65 28 22 73  65 6e 64 22 2c 31 29 0d  |plate("send",1).|
000029f0  01 ad 26 6d 73 67 77 69  6e 25 3d a4 6c 6f 61 64  |..&msgwin%=.load|
00002a00  74 65 6d 70 6c 61 74 65  28 22 6d 65 73 73 61 67  |template("messag|
00002a10  65 22 2c 31 29 0d 01 ae  26 62 6f 61 72 64 77 69  |e",1)...&boardwi|
00002a20  6e 25 3d a4 6c 6f 61 64  74 65 6d 70 6c 61 74 65  |n%=.loadtemplate|
00002a30  28 22 42 6f 61 72 64 22  2c 31 29 0d 01 af 19 62  |("Board",1)....b|
00002a40  25 21 30 3d 62 6f 61 72  64 77 69 6e 25 3a 62 25  |%!0=boardwin%:b%|
00002a50  21 34 3d 33 0d 01 b0 1e  c8 99 20 22 57 69 6d 70  |!4=3...... "Wimp|
00002a60  5f 47 65 74 49 63 6f 6e  53 74 61 74 65 22 2c 2c  |_GetIconState",,|
00002a70  62 25 0d 01 b1 2b 62 6f  61 72 64 6c 65 66 74 25  |b%...+boardleft%|
00002a80  3d 28 62 25 21 38 29 2b  34 3a 62 6f 61 72 64 74  |=(b%!8)+4:boardt|
00002a90  6f 70 25 3d 28 62 25 21  32 30 29 2d 34 0d 01 b2  |op%=(b%!20)-4...|
00002aa0  25 f2 73 65 74 69 63 6f  6e 74 65 78 74 28 69 6e  |%.seticontext(in|
00002ab0  66 6f 62 6f 78 25 2c 31  2c 41 70 70 6e 61 6d 65  |fobox%,1,Appname|
00002ac0  24 29 0d 01 b3 35 f2 73  65 74 69 63 6f 6e 74 65  |$)...5.seticonte|
00002ad0  78 74 28 69 6e 66 6f 62  6f 78 25 2c 32 2c 6c 6f  |xt(infobox%,2,lo|
00002ae0  6e 67 6e 61 6d 65 24 2b  22 20 28 70 6f 72 74 20  |ngname$+" (port |
00002af0  78 78 78 78 29 22 29 0d  01 b4 25 f2 73 65 74 69  |xxxx)")...%.seti|
00002b00  63 6f 6e 74 65 78 74 28  69 6e 66 6f 62 6f 78 25  |context(infobox%|
00002b10  2c 34 2c 76 65 72 73 69  6f 6e 24 29 0d 01 b5 3a  |,4,version$)...:|
00002b20  69 62 68 61 6e 64 6c 65  3d a4 43 72 65 61 74 65  |ibhandle=.Create|
00002b30  49 63 6f 6e 42 61 72 49  63 6f 6e 28 22 21 22 2b  |IconBarIcon("!"+|
00002b40  41 70 70 6e 61 6d 65 24  2c 73 68 6f 72 74 6e 61  |Appname$,shortna|
00002b50  6d 65 24 2c 31 29 0d 01  b6 41 69 62 6d 65 6e 75  |me$,1)...Aibmenu|
00002b60  25 3d a4 63 72 65 61 74  65 6d 65 6e 75 28 41 70  |%=.createmenu(Ap|
00002b70  70 6e 61 6d 65 24 2b 22  7c 49 6e 66 6f 5d 3e 69  |pname$+"|Info]>i|
00002b80  6e 66 6f 62 6f 78 25 7c  53 69 74 65 73 2e 2e 2e  |nfobox%|Sites...|
00002b90  7c 51 75 69 74 22 29 0d  01 b7 4d 62 6f 61 72 64  ||Quit")...Mboard|
00002ba0  6d 65 6e 75 25 3d a4 63  72 65 61 74 65 6d 65 6e  |menu%=.createmen|
00002bb0  75 28 41 70 70 6e 61 6d  65 24 2b 22 7c 49 6e 66  |u(Appname$+"|Inf|
00002bc0  6f 5d 3e 69 6e 66 6f 62  6f 78 25 7c 43 6c 65 61  |o]>infobox%|Clea|
00002bd0  72 20 42 6f 61 72 64 7c  44 69 73 63 6f 6e 6e 65  |r Board|Disconne|
00002be0  63 74 22 29 0d 01 b8 17  69 62 6f 70 74 69 6f 6e  |ct")....iboption|
00002bf0  73 25 3d 6f 70 74 69 6f  6e 73 25 0d 01 b9 05 e1  |s%=options%.....|
00002c00  0d 01 ba 05 3a 0d 01 bb  0f dd 20 f2 69 6e 69 74  |....:..... .init|
00002c10  70 72 6f 67 0d 01 bc 0b  ea 20 78 25 2c 79 25 0d  |prog..... x%,y%.|
00002c20  01 bd 29 f4 20 49 6e 69  74 69 61 6c 69 73 65 20  |..). Initialise |
00002c30  74 68 65 20 6e 65 74 77  6f 72 6b 20 67 61 6d 65  |the network game|
00002c40  20 6c 69 62 72 61 72 79  0d 01 be 33 f4 20 62 65  | library...3. be|
00002c50  73 74 70 6f 72 74 25 20  69 73 20 74 68 65 20 70  |stport% is the p|
00002c60  6f 72 74 20 77 65 20 6c  69 73 74 65 6e 20 6f 6e  |ort we listen on|
00002c70  20 62 79 20 64 65 66 61  75 6c 74 0d 01 bf 12 62  | by default....b|
00002c80  65 73 74 70 6f 72 74 25  3d 34 30 30 30 0d 01 c0  |estport%=4000...|
00002c90  2f 70 6f 72 74 3d a4 6e  65 74 67 61 6d 65 5f 69  |/port=.netgame_i|
00002ca0  6e 69 74 28 62 65 73 74  70 6f 72 74 25 29 3a f4  |nit(bestport%):.|
00002cb0  20 50 6f 72 74 20 6e 75  6d 62 65 72 0d 01 c1 24  | Port number...$|
00002cc0  f4 20 45 6e 73 75 72 65  20 74 68 61 74 20 65 76  |. Ensure that ev|
00002cd0  65 72 79 74 68 69 6e 67  20 77 65 6e 74 20 6f 6b  |erything went ok|
00002ce0  0d 01 c2 0f e7 20 70 6f  72 74 3d 2d 31 20 8c 0d  |..... port=-1 ..|
00002cf0  01 c3 36 20 72 65 70 6c  79 3d a4 65 72 72 6f 72  |..6 reply=.error|
00002d00  62 6f 78 28 22 3e 4d 65  73 73 61 67 65 22 2c 22  |box(">Message","|
00002d10  3e 43 6f 75 6c 64 6e 74  49 6e 69 74 22 2c 25 31  |>CouldntInit",%1|
00002d20  30 30 30 31 29 0d 01 c4  18 20 c8 99 20 22 57 69  |0001).... .. "Wi|
00002d30  6d 70 5f 43 6c 6f 73 65  44 6f 77 6e 22 0d 01 c5  |mp_CloseDown"...|
00002d40  13 20 f2 63 6c 6f 73 65  6d 65 73 73 61 67 65 73  |. .closemessages|
00002d50  0d 01 c6 06 20 e0 0d 01  c7 05 cc 0d 01 c8 2d 20  |.... .........- |
00002d60  f2 73 65 74 69 63 6f 6e  74 65 78 74 28 69 6e 66  |.seticontext(inf|
00002d70  6f 62 6f 78 25 2c 32 2c  22 3e 49 6e 66 6f 3a 22  |obox%,2,">Info:"|
00002d80  2b c3 20 70 6f 72 74 29  0d 01 c9 05 cd 0d 01 ca  |+. port)........|
00002d90  31 f4 20 4d 61 72 6b 20  74 68 65 20 63 6f 72 72  |1. Mark the corr|
00002da0  65 63 74 20 73 69 74 65  20 69 6e 20 74 68 65 20  |ect site in the |
00002db0  63 6f 6e 6e 65 63 74 20  77 69 6e 64 6f 77 0d 01  |connect window..|
00002dc0  cb 26 f2 73 65 74 69 63  6f 6e 74 65 78 74 28 63  |.&.seticontext(c|
00002dd0  6f 6e 6e 65 63 74 77 69  6e 25 2c 33 2c c3 20 70  |onnectwin%,3,. p|
00002de0  6f 72 74 29 0d 01 cc 22  f4 20 52 65 61 64 20 74  |ort)...". Read t|
00002df0  68 65 20 73 69 74 65 73  20 66 72 6f 6d 20 74 68  |he sites from th|
00002e00  65 20 66 69 6c 65 0d 01  cd 16 f2 6e 65 74 67 61  |e file.....netga|
00002e10  6d 65 5f 72 65 61 64 73  69 74 65 73 0d 01 ce 3a  |me_readsites...:|
00002e20  de 20 73 73 63 61 6c 65  25 20 31 36 3a de 20 73  |. sscale% 16:. s|
00002e30  74 72 61 6e 73 25 20 31  36 3a f4 20 66 6f 72 20  |trans% 16:. for |
00002e40  57 69 6d 70 5f 52 65 61  64 50 69 78 54 72 61 6e  |Wimp_ReadPixTran|
00002e50  73 20 63 61 6c 6c 0d 01  cf 3b de 20 77 69 6e 73  |s call...;. wins|
00002e60  25 28 31 29 2c 62 6f 61  72 64 63 6f 75 6e 74 65  |%(1),boardcounte|
00002e70  72 25 28 37 2c 37 29 2c  62 6f 61 72 64 63 6f 6c  |r%(7,7),boardcol|
00002e80  6f 75 72 25 28 37 2c 37  29 2c 63 6f 6c 24 28 31  |our%(7,7),col$(1|
00002e90  29 0d 01 d0 21 62 6f 61  72 64 63 6f 6c 6f 75 72  |)...!boardcolour|
00002ea0  25 28 29 3d 2d 31 3a 63  68 65 63 6b 69 6e 67 25  |%()=-1:checking%|
00002eb0  3d a3 0d 01 d1 16 de 20  62 6f 61 72 64 6d 61 78  |=...... boardmax|
00002ec0  6e 6f 25 28 37 2c 37 29  0d 01 d2 0e e3 20 78 25  |no%(7,7)..... x%|
00002ed0  3d 30 20 b8 20 37 0d 01  d3 10 20 20 e3 20 79 25  |=0 . 7....  . y%|
00002ee0  3d 30 20 b8 20 37 0d 01  d4 1c 20 20 20 20 62 6f  |=0 . 7....    bo|
00002ef0  61 72 64 6d 61 78 6e 6f  25 28 78 25 2c 79 25 29  |ardmaxno%(x%,y%)|
00002f00  3d 33 0d 01 d5 28 20 20  20 20 e7 20 78 25 2a 79  |=3...(    . x%*y|
00002f10  25 3d 30 20 8c 20 62 6f  61 72 64 6d 61 78 6e 6f  |%=0 . boardmaxno|
00002f20  25 28 78 25 2c 79 25 29  3d 32 0d 01 d6 25 20 20  |%(x%,y%)=2...%  |
00002f30  20 20 e7 20 78 25 3d 37  20 8c 20 62 6f 61 72 64  |  . x%=7 . board|
00002f40  6d 61 78 6e 6f 25 28 78  25 2c 79 25 29 3d 32 0d  |maxno%(x%,y%)=2.|
00002f50  01 d7 25 20 20 20 20 e7  20 79 25 3d 37 20 8c 20  |..%    . y%=7 . |
00002f60  62 6f 61 72 64 6d 61 78  6e 6f 25 28 78 25 2c 79  |boardmaxno%(x%,y|
00002f70  25 29 3d 32 0d 01 d8 2c  20 20 20 20 e7 20 78 25  |%)=2...,    . x%|
00002f80  3d 30 20 80 20 79 25 3d  30 20 8c 20 62 6f 61 72  |=0 . y%=0 . boar|
00002f90  64 6d 61 78 6e 6f 25 28  78 25 2c 79 25 29 3d 31  |dmaxno%(x%,y%)=1|
00002fa0  0d 01 d9 2c 20 20 20 20  e7 20 78 25 3d 30 20 80  |...,    . x%=0 .|
00002fb0  20 79 25 3d 37 20 8c 20  62 6f 61 72 64 6d 61 78  | y%=7 . boardmax|
00002fc0  6e 6f 25 28 78 25 2c 79  25 29 3d 31 0d 01 da 2c  |no%(x%,y%)=1...,|
00002fd0  20 20 20 20 e7 20 78 25  3d 37 20 80 20 79 25 3d  |    . x%=7 . y%=|
00002fe0  30 20 8c 20 62 6f 61 72  64 6d 61 78 6e 6f 25 28  |0 . boardmaxno%(|
00002ff0  78 25 2c 79 25 29 3d 31  0d 01 db 2c 20 20 20 20  |x%,y%)=1...,    |
00003000  e7 20 78 25 3d 37 20 80  20 79 25 3d 37 20 8c 20  |. x%=7 . y%=7 . |
00003010  62 6f 61 72 64 6d 61 78  6e 6f 25 28 78 25 2c 79  |boardmaxno%(x%,y|
00003020  25 29 3d 31 0d 01 dc 07  20 20 ed 0d 01 dd 05 ed  |%)=1....  ......|
00003030  0d 01 de 3b 70 62 6c 75  65 25 3d 30 3a 70 67 72  |...;pblue%=0:pgr|
00003040  65 65 6e 25 3d 31 3a 63  6f 6c 24 28 29 3d 22 62  |een%=1:col$()="b|
00003050  6c 75 65 22 2c 22 67 72  65 65 6e 22 3a 70 6c 61  |lue","green":pla|
00003060  79 65 72 25 3d 70 62 6c  75 65 25 0d 01 df 40 62  |yer%=pblue%...@b|
00003070  61 6e 67 78 25 3d 2d 31  3a 62 61 6e 67 79 25 3d  |angx%=-1:bangy%=|
00003080  2d 31 3a 70 62 6c 75 65  73 63 25 3d 30 3a 70 67  |-1:pbluesc%=0:pg|
00003090  72 65 65 6e 73 63 25 3d  30 3a 70 77 6f 6e 25 3d  |reensc%=0:pwon%=|
000030a0  2d 31 3a 74 75 72 6e 73  25 3d 30 0d 01 e0 18 f4  |-1:turns%=0.....|
000030b0  20 6c 6f 61 64 20 73 6f  75 6e 64 20 73 61 6d 70  | load sound samp|
000030c0  6c 65 73 0d 01 e1 08 c8  a0 20 34 0d 01 e2 1d 2a  |les...... 4....*|
000030d0  43 68 61 6e 6e 65 6c 56  6f 69 63 65 20 32 20 52  |ChannelVoice 2 R|
000030e0  65 61 63 74 42 61 6e 67  0d 01 e3 1d 2a 43 68 61  |eactBang....*Cha|
000030f0  6e 6e 65 6c 56 6f 69 63  65 20 33 20 52 65 61 63  |nnelVoice 3 Reac|
00003100  74 50 6c 69 70 0d 01 e4  05 e1 0d 01 e5 05 3a 0d  |tPlip.........:.|
00003110  01 e6 18 dd 20 f2 48 65  6c 70 28 77 69 6e 2c 69  |.... .Help(win,i|
00003120  63 6f 6e 2c 74 6f 29 0d  01 e7 1f f7 20 2b 31 3a  |con,to)..... +1:|
00003130  f2 72 65 61 64 68 65 6c  70 28 77 69 6e 2c 69 63  |.readhelp(win,ic|
00003140  6f 6e 2c 74 6f 29 0d 01  e8 05 e1 0d 01 e9 0d f4  |on,to)..........|
00003150  20 57 69 6e 64 6f 77 73  0d 01 ea 1a dc 20 69 6e  | Windows..... in|
00003160  66 6f 62 6f 78 25 2c 22  3e 48 49 6e 66 6f 62 6f  |fobox%,">HInfobo|
00003170  78 22 0d 01 eb 14 dc 20  33 2c 22 3e 48 49 6e 66  |x"..... 3,">HInf|
00003180  6f 62 6f 78 33 22 0d 01  ec 14 dc 20 34 2c 22 3e  |obox3"..... 4,">|
00003190  48 49 6e 66 6f 62 6f 78  34 22 0d 01 ed 1a dc 20  |HInfobox4"..... |
000031a0  73 65 6e 64 77 69 6e 25  2c 22 3e 48 53 65 6e 64  |sendwin%,">HSend|
000031b0  77 69 6e 22 0d 01 ee 13  dc 20 32 2c 22 3e 48 53  |win"..... 2,">HS|
000031c0  43 61 6e 63 65 6c 22 0d  01 ef 11 dc 20 33 2c 22  |Cancel"..... 3,"|
000031d0  3e 48 53 53 65 6e 64 22  0d 01 f0 18 dc 20 6d 73  |>HSSend"..... ms|
000031e0  67 77 69 6e 25 2c 22 3e  48 4d 73 67 77 69 6e 22  |gwin%,">HMsgwin"|
000031f0  0d 01 f1 11 dc 20 32 2c  22 3e 48 52 65 70 6c 79  |..... 2,">HReply|
00003200  22 0d 01 f2 0e dc 20 31  2c 22 3e 48 4f 6b 22 0d  |"..... 1,">HOk".|
00003210  01 f3 20 dc 20 63 6f 6e  6e 65 63 74 77 69 6e 25  |.. . connectwin%|
00003220  2c 22 3e 48 43 6f 6e 6e  65 63 74 77 69 6e 22 0d  |,">HConnectwin".|
00003230  01 f4 0f dc 20 34 2c 22  3e 48 43 4f 6b 22 0d 01  |.... 4,">HCOk"..|
00003240  f5 1c dc 20 62 6f 61 72  64 77 69 6e 25 2c 22 3e  |... boardwin%,">|
00003250  48 42 6f 61 72 64 77 69  6e 22 0d 01 f6 18 dc 20  |HBoardwin"..... |
00003260  30 2c 22 3e 48 42 57 44  69 73 63 6f 6e 6e 65 63  |0,">HBWDisconnec|
00003270  74 22 0d 01 f7 15 dc 20  31 2c 22 3e 48 42 57 4d  |t"..... 1,">HBWM|
00003280  65 73 73 61 67 65 22 0d  01 f8 13 dc 20 33 2c 22  |essage"..... 3,"|
00003290  3e 48 42 57 42 6f 61 72  64 22 0d 01 f9 12 dc 20  |>HBWBoard"..... |
000032a0  35 2c 22 3e 48 42 57 42  6c 75 65 22 0d 01 fa 13  |5,">HBWBlue"....|
000032b0  dc 20 37 2c 22 3e 48 42  57 47 72 65 65 6e 22 0d  |. 7,">HBWGreen".|
000032c0  01 fb 14 dc 20 2d 32 2c  22 3e 48 49 63 6f 6e 62  |.... -2,">HIconb|
000032d0  61 72 22 0d 01 fc 0b dc  20 2d 31 2c 2d 31 0d 01  |ar"..... -1,-1..|
000032e0  fd 0b f4 20 4d 65 6e 75  73 0d 01 fe 16 dc 20 69  |... Menus..... i|
000032f0  62 6d 65 6e 75 25 2c 2d  31 2c 2d 31 2c 2d 31 0d  |bmenu%,-1,-1,-1.|
00003300  01 ff 17 dc 20 30 2c 2d  31 2c 2d 31 2c 22 3e 48  |.... 0,-1,-1,">H|
00003310  4d 49 6e 66 6f 22 0d 02  00 18 dc 20 31 2c 2d 31  |MInfo"..... 1,-1|
00003320  2c 2d 31 2c 22 3e 48 4d  53 69 74 65 73 22 0d 02  |,-1,">HMSites"..|
00003330  01 17 dc 20 32 2c 2d 31  2c 2d 31 2c 22 3e 48 4d  |... 2,-1,-1,">HM|
00003340  51 75 69 74 22 0d 02 02  19 dc 20 62 6f 61 72 64  |Quit"..... board|
00003350  6d 65 6e 75 25 2c 2d 31  2c 2d 31 2c 2d 31 0d 02  |menu%,-1,-1,-1..|
00003360  03 17 dc 20 30 2c 2d 31  2c 2d 31 2c 22 3e 48 4d  |... 0,-1,-1,">HM|
00003370  49 6e 66 6f 22 0d 02 04  18 dc 20 31 2c 2d 31 2c  |Info"..... 1,-1,|
00003380  2d 31 2c 22 3e 48 4d 43  6c 65 61 72 22 0d 02 05  |-1,">HMClear"...|
00003390  1d dc 20 32 2c 2d 31 2c  2d 31 2c 22 3e 48 4d 44  |.. 2,-1,-1,">HMD|
000033a0  69 73 63 6f 6e 6e 65 63  74 22 0d 02 06 11 dc 20  |isconnect"..... |
000033b0  2d 32 2c 2d 32 2c 2d 32  2c 2d 32 0d 02 07 05 3a  |-2,-2,-2,-2....:|
000033c0  0d 02 08 14 dd 20 f2 46  65 74 63 68 50 61 67 65  |..... .FetchPage|
000033d0  28 66 24 29 0d 02 09 3c  f4 20 58 55 52 49 5f 44  |(f$)...<. XURI_D|
000033e0  69 73 70 61 74 63 68 20  2d 20 74 68 69 73 20 70  |ispatch - this p|
000033f0  72 6f 74 6f 63 6f 6c 20  69 73 20 73 74 69 6c 6c  |rotocol is still|
00003400  20 62 65 69 6e 67 20 64  65 63 69 64 65 64 20 21  | being decided !|
00003410  0d 02 0a 18 c8 99 20 26  36 45 33 38 31 2c 25 30  |...... &6E381,%0|
00003420  30 30 2c 66 24 2b bd 30  0d 02 0b 05 e1 0d 02 0c  |00,f$+.0........|
00003430  05 3a 0d 02 0d 3e f4 20  2a 2a 2a 2a 2a 2a 2a 2a  |.:...>. ********|
00003440  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 20 4e 65 74  |************ Net|
00003450  47 61 6d 65 20 72 6f 75  74 69 6e 65 73 20 2a 2a  |Game routines **|
00003460  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
00003470  0d 02 0e 05 3a 0d 02 0f  2c f4 20 54 68 65 79 27  |....:...,. They'|
00003480  76 65 20 67 6f 6e 65 2c  20 73 6f 20 77 65 27 64  |ve gone, so we'd|
00003490  20 62 65 74 74 65 72 20  74 65 6c 6c 20 74 68 65  | better tell the|
000034a0  6d 0d 02 10 19 dd 20 f2  64 69 73 63 6f 6e 6e 65  |m..... .disconne|
000034b0  63 74 65 64 28 74 79 70  65 29 0d 02 11 0b ea 20  |cted(type)..... |
000034c0  72 65 70 6c 79 0d 02 12  0d c8 8e 20 74 79 70 65  |reply...... type|
000034d0  20 ca 0d 02 13 34 20 c9  20 6e 67 73 5f 64 65 61  | ....4 . ngs_dea|
000034e0  64 3a f4 20 42 61 64 20  6c 69 74 74 6c 65 20 62  |d:. Bad little b|
000034f0  6f 79 2c 20 64 72 6f 70  70 65 64 20 63 6f 6e 6e  |oy, dropped conn|
00003500  65 63 74 69 6f 6e 0d 02  14 32 20 20 72 65 70 6c  |ection...2  repl|
00003510  79 3d a4 65 72 72 6f 72  62 6f 78 28 22 3e 4d 65  |y=.errorbox(">Me|
00003520  73 73 61 67 65 22 2c 22  3e 43 6c 6f 73 65 64 22  |ssage",">Closed"|
00003530  2c 25 31 30 30 30 31 29  0d 02 15 34 20 c9 20 6e  |,%10001)...4 . n|
00003540  67 73 5f 67 6f 69 6e 67  3a f4 20 4d 72 20 46 6c  |gs_going:. Mr Fl|
00003550  69 62 62 6c 65 20 73 61  79 73 20 27 47 61 6d 65  |ibble says 'Game|
00003560  20 4f 76 65 72 27 2c 20  62 6f 79 73 0d 02 16 34  | Over', boys...4|
00003570  20 20 72 65 70 6c 79 3d  a4 65 72 72 6f 72 62 6f  |  reply=.errorbo|
00003580  78 28 22 3e 4d 65 73 73  61 67 65 22 2c 22 3e 47  |x(">Message",">G|
00003590  61 6d 65 4f 76 65 72 22  2c 25 31 30 30 30 31 29  |ameOver",%10001)|
000035a0  0d 02 17 2d 20 c9 20 6e  67 73 5f 66 61 69 6c 65  |...- . ngs_faile|
000035b0  64 3a f4 20 43 6f 75 6c  64 6e 27 74 20 67 65 74  |d:. Couldn't get|
000035c0  20 61 20 63 6f 6e 6e 65  63 74 69 6f 6e 0d 02 18  | a connection...|
000035d0  35 20 20 72 65 70 6c 79  3d a4 65 72 72 6f 72 62  |5  reply=.errorb|
000035e0  6f 78 28 22 3e 4d 65 73  73 61 67 65 22 2c 22 3e  |ox(">Message",">|
000035f0  4e 6f 43 6f 6e 6e 65 63  74 22 2c 25 31 30 30 30  |NoConnect",%1000|
00003600  31 29 0d 02 19 12 20 20  f2 6f 70 65 6e 63 6f 6e  |1)....  .opencon|
00003610  6e 65 63 74 0d 02 1a 05  cb 0d 02 1b 11 74 68 65  |nect.........the|
00003620  69 72 68 6f 73 74 24 3d  22 22 0d 02 1c 22 f2 67  |irhost$=""...".g|
00003630  72 65 79 6f 75 74 69 63  6f 6e 73 5f 63 6f 73 5f  |reyouticons_cos_|
00003640  64 69 73 63 6f 6e 6e 65  63 74 65 64 0d 02 1d 05  |disconnected....|
00003650  e1 0d 02 1e 05 3a 0d 02  1f 1c f4 20 57 65 27 76  |.....:..... We'v|
00003660  65 20 67 6f 74 20 61 20  63 6f 6e 6e 65 63 74 69  |e got a connecti|
00003670  6f 6e 0d 02 20 32 f4 20  74 79 70 65 20 3d 20 6e  |on.. 2. type = n|
00003680  67 73 5f 6f 72 69 67 69  6e 61 74 65 20 69 66 20  |gs_originate if |
00003690  77 65 20 63 6f 6e 6e 65  63 74 65 64 20 74 6f 20  |we connected to |
000036a0  74 68 65 6d 0d 02 21 28  f4 20 6e 67 73 5f 61 6e  |them..!(. ngs_an|
000036b0  73 77 65 72 20 69 66 20  74 68 65 79 20 63 6f 6e  |swer if they con|
000036c0  6e 65 63 74 65 64 20 74  6f 20 75 73 0d 02 22 1c  |nected to us..".|
000036d0  dd 20 f2 63 6f 6e 6e 65  63 74 65 64 28 68 6f 73  |. .connected(hos|
000036e0  74 24 2c 74 79 70 65 29  0d 02 23 14 74 68 65 69  |t$,type)..#.thei|
000036f0  72 68 6f 73 74 24 3d 68  6f 73 74 24 0d 02 24 1a  |rhost$=host$..$.|
00003700  e7 20 74 79 70 65 3d 6e  67 73 5f 6f 72 69 67 69  |. type=ngs_origi|
00003710  6e 61 74 65 20 8c 0d 02  25 43 20 20 75 73 25 3d  |nate ...%C  us%=|
00003720  70 62 6c 75 65 25 3a 74  68 65 6d 25 3d 70 67 72  |pblue%:them%=pgr|
00003730  65 65 6e 25 3a f4 20 77  65 20 69 6e 69 74 69 61  |een%:. we initia|
00003740  74 65 64 20 63 6f 6e 6e  65 63 74 69 6f 6e 2c 20  |ted connection, |
00003750  77 65 20 67 6f 20 31 73  74 0d 02 26 05 cc 0d 02  |we go 1st..&....|
00003760  27 44 20 20 75 73 25 3d  70 67 72 65 65 6e 25 3a  |'D  us%=pgreen%:|
00003770  74 68 65 6d 25 3d 70 62  6c 75 65 25 3a f4 20 74  |them%=pblue%:. t|
00003780  68 65 79 20 69 6e 69 74  69 61 74 65 64 20 63 6f  |hey initiated co|
00003790  6e 6e 65 63 74 69 6f 6e  2c 20 74 68 65 6d 20 31  |nnection, them 1|
000037a0  73 74 0d 02 28 05 cd 0d  02 29 2b 70 6c 61 79 65  |st..(....)+playe|
000037b0  72 25 3d 70 62 6c 75 65  25 3a f4 20 62 6c 75 65  |r%=pblue%:. blue|
000037c0  20 61 6c 77 61 79 73 20  67 6f 65 73 20 66 69 72  | always goes fir|
000037d0  73 74 0d 02 2a 25 f2 62  6f 61 72 64 5f 63 6c 65  |st..*%.board_cle|
000037e0  61 72 28 a3 29 3a f4 20  64 6f 6e 27 74 20 74 65  |ar(.):. don't te|
000037f0  6c 6c 20 74 68 65 6d 0d  02 2b 35 f2 63 6c 6f 73  |ll them..+5.clos|
00003800  65 77 69 6e 28 63 6f 6e  6e 65 63 74 77 69 6e 25  |ewin(connectwin%|
00003810  29 3a f4 20 43 6c 6f 73  65 20 74 68 65 20 63 6f  |):. Close the co|
00003820  6e 6e 65 63 74 20 77 69  6e 64 6f 77 0d 02 2c 2a  |nnect window..,*|
00003830  f4 20 57 65 20 73 68 6f  75 6c 64 20 6f 70 65 6e  |. We should open|
00003840  20 61 20 77 69 6e 64 6f  77 20 6f 72 20 73 6f 6d  | a window or som|
00003850  65 74 68 69 6e 67 0d 02  2d 21 f2 75 6e 67 72 65  |ething..-!.ungre|
00003860  79 6f 75 74 69 63 6f 6e  73 5f 63 6f 73 5f 63 6f  |youticons_cos_co|
00003870  6e 6e 65 63 74 65 64 0d  02 2e 17 f2 6f 70 65 6e  |nnected.....open|
00003880  77 69 6e 28 62 6f 61 72  64 77 69 6e 25 29 0d 02  |win(boardwin%)..|
00003890  2f 05 e1 0d 02 30 05 3a  0d 02 31 3e f4 20 4d 65  |/....0.:..1>. Me|
000038a0  73 73 61 67 65 20 68 61  73 20 61 72 72 69 76 65  |ssage has arrive|
000038b0  64 20 66 72 6f 6d 20 74  68 65 6d 20 2d 20 74 72  |d from them - tr|
000038c0  79 20 6e 6f 74 20 74 6f  20 63 72 65 61 74 65 20  |y not to create |
000038d0  61 20 6c 6f 6f 70 0d 02  32 21 f4 20 27 63 6f 73  |a loop..2!. 'cos|
000038e0  20 74 68 61 74 20 69 73  20 6b 69 6e 64 61 20 73  | that is kinda s|
000038f0  69 6c 6c 79 2e 2e 2e 0d  02 33 15 dd 20 f2 69 6e  |illy.....3.. .in|
00003900  63 6f 6d 69 6e 67 28 6d  73 67 24 29 0d 02 34 43  |coming(msg$)..4C|
00003910  f4 20 49 66 20 69 74 27  73 20 61 20 75 73 65 72  |. If it's a user|
00003920  20 6d 65 73 73 61 67 65  20 77 65 20 73 68 6f 75  | message we shou|
00003930  6c 64 20 70 75 74 20 69  74 20 69 6e 20 74 68 65  |ld put it in the|
00003940  20 6d 65 73 73 61 67 65  20 77 69 6e 64 6f 77 0d  | message window.|
00003950  02 35 41 f4 20 77 69 74  68 20 50 52 4f 43 67 6f  |.5A. with PROCgo|
00003960  74 6d 65 73 73 61 67 65  28 6d 73 67 24 29 2c 20  |tmessage(msg$), |
00003970  6f 74 68 65 72 77 69 73  65 20 69 74 27 73 20 61  |otherwise it's a|
00003980  20 27 67 6f 27 20 73 6f  20 77 65 20 6e 65 65 64  | 'go' so we need|
00003990  0d 02 36 13 f4 20 74 6f  20 70 72 6f 63 65 73 73  |..6.. to process|
000039a0  20 69 74 0d 02 37 14 e7  20 c0 6d 73 67 24 2c 31  | it..7.. .msg$,1|
000039b0  29 3d 22 4d 22 20 8c 0d  02 38 1b 20 20 f2 67 6f  |)="M" ...8.  .go|
000039c0  74 6d 65 73 73 61 67 65  28 c1 6d 73 67 24 2c 32  |tmessage(.msg$,2|
000039d0  29 29 0d 02 39 05 cd 0d  02 3a 14 e7 20 c0 6d 73  |))..9....:.. .ms|
000039e0  67 24 2c 31 29 3d 22 47  22 20 8c 0d 02 3b 2c 20  |g$,1)="G" ...;, |
000039f0  20 f4 20 47 20 3d 20 47  6f 20 2d 20 50 6c 61 79  | . G = Go - Play|
00003a00  65 72 20 68 61 73 20 70  6c 61 63 65 64 20 61 20  |er has placed a |
00003a10  63 6f 75 6e 74 65 72 0d  02 3c 42 20 20 f4 20 49  |counter..<B  . I|
00003a20  66 20 77 65 20 67 65 74  20 61 20 6d 65 73 73 61  |f we get a messa|
00003a30  67 65 20 61 6e 64 20 69  74 27 73 20 6f 75 72 20  |ge and it's our |
00003a40  67 6f 20 74 68 65 6e 20  74 68 65 79 27 72 65 20  |go then they're |
00003a50  63 68 65 61 74 69 6e 67  21 0d 02 3d 23 20 20 e7  |cheating!..=#  .|
00003a60  20 70 6c 61 79 65 72 25  3d 75 73 25 20 80 20 63  | player%=us% . c|
00003a70  68 65 63 6b 69 6e 67 25  3d a3 20 8c 0d 02 3e 13  |hecking%=. ...>.|
00003a80  20 20 20 20 f2 64 69 73  63 6f 6e 6e 65 63 74 0d  |    .disconnect.|
00003a90  02 3f 15 20 20 20 20 74  68 65 69 72 68 6f 73 74  |.?.    theirhost|
00003aa0  24 3d 22 22 0d 02 40 07  20 20 cd 0d 02 41 30 20  |$=""..@.  ...A0 |
00003ab0  20 f4 20 49 66 20 77 65  27 72 65 20 73 74 69 6c  | . If we're stil|
00003ac0  6c 20 63 68 65 63 6b 69  6e 67 20 74 68 65 6e 20  |l checking then |
00003ad0  66 69 6e 69 73 68 20 50  44 51 21 0d 02 42 23 20  |finish PDQ!..B# |
00003ae0  20 c8 95 20 63 68 65 63  6b 69 6e 67 25 3d b9 3a  | .. checking%=.:|
00003af0  f2 63 68 65 63 6b 5f 62  6f 61 72 64 3a ce 0d 02  |.check_board:...|
00003b00  43 27 20 20 78 25 3d bb  28 c1 6d 73 67 24 2c 32  |C'  x%=.(.msg$,2|
00003b10  2c 31 29 29 3a 79 25 3d  bb 28 c1 6d 73 67 24 2c  |,1)):y%=.(.msg$,|
00003b20  33 2c 31 29 29 0d 02 44  1a 20 20 f2 70 6c 61 63  |3,1))..D.  .plac|
00003b30  65 63 6f 75 6e 74 65 72  28 78 25 2c 79 25 29 0d  |ecounter(x%,y%).|
00003b40  02 45 05 cd 0d 02 46 14  e7 20 c0 6d 73 67 24 2c  |.E....F.. .msg$,|
00003b50  31 29 3d 22 43 22 20 8c  0d 02 47 3b 20 20 f2 62  |1)="C" ...G;  .b|
00003b60  6f 61 72 64 5f 63 6c 65  61 72 28 a3 29 3a f4 20  |oard_clear(.):. |
00003b70  64 6f 6e 27 74 20 74 65  6c 6c 20 74 68 65 6d 3a  |don't tell them:|
00003b80  20 54 68 65 79 20 61 6c  72 65 61 64 79 20 6b 6e  | They already kn|
00003b90  6f 77 21 0d 02 48 05 cd  0d 02 49 05 e1 0d 02 4a  |ow!..H....I....J|
00003ba0  05 3a 0d 02 4b 42 f4 20  2a 2a 2a 2a 2a 2a 2a 2a  |.:..KB. ********|
00003bb0  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 20 4f  |************** O|
00003bc0  74 68 65 72 20 72 6f 75  74 69 6e 65 73 20 2a 2a  |ther routines **|
00003bd0  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
00003be0  2a 2a 2a 2a 0d 02 4c 05  3a 0d 02 4d 3d f4 20 41  |****..L.:..M=. A|
00003bf0  74 74 65 6d 70 74 20 61  20 63 6f 6e 6e 65 63 74  |ttempt a connect|
00003c00  69 6f 6e 20 75 73 69 6e  67 20 74 68 65 20 27 63  |ion using the 'c|
00003c10  6f 6e 6e 65 63 74 27 20  77 69 6e 64 6f 77 20 61  |onnect' window a|
00003c20  73 20 68 6f 73 74 0d 02  4e 11 dd 20 f2 74 72 79  |s host..N.. .try|
00003c30  63 6f 6e 6e 65 63 74 0d  02 4f 10 ea 20 68 6f 73  |connect..O.. hos|
00003c40  74 24 2c 70 6f 72 74 0d  02 50 35 68 6f 73 74 24  |t$,port..P5host$|
00003c50  3d a4 67 65 74 69 63 6f  6e 74 65 78 74 28 63 6f  |=.geticontext(co|
00003c60  6e 6e 65 63 74 77 69 6e  25 2c 31 29 3a f4 20 52  |nnectwin%,1):. R|
00003c70  65 61 64 20 74 68 65 20  68 6f 73 74 0d 02 51 12  |ead the host..Q.|
00003c80  e7 20 68 6f 73 74 24 3d  22 22 20 8c 20 e1 0d 02  |. host$="" . ...|
00003c90  52 1d f4 20 52 65 61 64  20 74 68 65 20 73 65 72  |R.. Read the ser|
00003ca0  76 69 63 65 20 6e 75 6d  62 65 72 0d 02 53 3f 70  |vice number..S?p|
00003cb0  6f 72 74 3d a4 69 6e 65  74 5f 67 65 74 73 65 72  |ort=.inet_getser|
00003cc0  76 62 79 6e 61 6d 65 28  a4 67 65 74 69 63 6f 6e  |vbyname(.geticon|
00003cd0  74 65 78 74 28 63 6f 6e  6e 65 63 74 77 69 6e 25  |text(connectwin%|
00003ce0  2c 33 29 2c 22 74 63 70  22 29 0d 02 54 1b f4 20  |,3),"tcp")..T.. |
00003cf0  4e 6f 77 20 64 6f 20 74  68 65 20 63 6f 6e 6e 65  |Now do the conne|
00003d00  63 74 69 6f 6e 0d 02 55  23 6f 6b 3d a4 6e 65 74  |ction..U#ok=.net|
00003d10  67 61 6d 65 5f 63 6f 6e  6e 65 63 74 28 68 6f 73  |game_connect(hos|
00003d20  74 24 2c 70 6f 72 74 29  0d 02 56 0c e7 20 ac 20  |t$,port)..V.. . |
00003d30  6f 6b 20 8c 0d 02 57 27  20 f4 20 57 65 20 63 6f  |ok ...W' . We co|
00003d40  75 6c 64 6e 27 74 20 63  6f 6e 6e 65 63 74 20 73  |uldn't connect s|
00003d50  6f 20 74 65 6c 6c 20 74  68 65 6d 0d 02 58 34 20  |o tell them..X4 |
00003d60  72 65 70 6c 79 3d a4 65  72 72 6f 72 62 6f 78 28  |reply=.errorbox(|
00003d70  22 3e 4d 65 73 73 61 67  65 22 2c 22 3e 4e 6f 43  |">Message",">NoC|
00003d80  6f 6e 6e 65 63 74 22 2c  25 31 30 30 30 31 29 0d  |onnect",%10001).|
00003d90  02 59 05 cc 0d 02 5a 1b  20 f2 63 6c 6f 73 65 77  |.Y....Z. .closew|
00003da0  69 6e 28 63 6f 6e 6e 65  63 74 77 69 6e 25 29 0d  |in(connectwin%).|
00003db0  02 5b 05 cd 0d 02 5c 05  e1 0d 02 5d 05 3a 0d 02  |.[....\....].:..|
00003dc0  5e 42 f4 20 57 65 27 76  65 20 67 6f 74 20 61 20  |^B. We've got a |
00003dd0  6d 65 73 73 61 67 65 20  66 72 6f 6d 20 74 68 65  |message from the|
00003de0  6d 20 73 6f 20 6c 65 74  73 20 73 74 69 63 6b 20  |m so lets stick |
00003df0  69 74 20 6f 6e 20 74 68  65 20 73 63 72 65 65 6e  |it on the screen|
00003e00  0d 02 5f 17 dd 20 f2 67  6f 74 6d 65 73 73 61 67  |.._.. .gotmessag|
00003e10  65 28 6d 73 67 24 29 0d  02 60 3a f2 73 65 74 69  |e(msg$)..`:.seti|
00003e20  63 6f 6e 74 65 78 74 28  6d 73 67 77 69 6e 25 2c  |context(msgwin%,|
00003e30  30 2c c0 6d 73 67 24 2c  33 39 29 29 3a f4 20 46  |0,.msg$,39)):. F|
00003e40  69 74 20 69 74 20 74 6f  20 74 68 65 20 69 63 6f  |it it to the ico|
00003e50  6e 0d 02 61 27 f2 6f 70  65 6e 77 69 6e 28 6d 73  |n..a'.openwin(ms|
00003e60  67 77 69 6e 25 29 3a f4  20 4f 70 65 6e 20 74 68  |gwin%):. Open th|
00003e70  65 20 77 69 6e 64 6f 77  0d 02 62 05 e1 0d 02 63  |e window..b....c|
00003e80  05 3a 0d 02 64 2b f4 20  53 65 6e 64 20 74 68 65  |.:..d+. Send the|
00003e90  20 6d 65 73 73 61 67 65  20 69 6e 20 74 68 65 20  | message in the |
00003ea0  27 73 65 6e 64 27 20 77  69 6e 64 6f 77 0d 02 65  |'send' window..e|
00003eb0  12 dd 20 f2 73 65 6e 64  6d 65 73 73 61 67 65 0d  |.. .sendmessage.|
00003ec0  02 66 24 ea 20 61 24 3a  61 24 3d a4 67 65 74 69  |.f$. a$:a$=.geti|
00003ed0  63 6f 6e 74 65 78 74 28  73 65 6e 64 77 69 6e 25  |context(sendwin%|
00003ee0  2c 30 29 0d 02 67 16 f4  20 53 65 6e 64 20 74 68  |,0)..g.. Send th|
00003ef0  65 20 6d 65 73 73 61 67  65 0d 02 68 26 f4 20 59  |e message..h&. Y|
00003f00  6f 75 20 6e 65 65 64 20  74 6f 20 70 75 74 20 73  |ou need to put s|
00003f10  6f 6d 65 20 63 6f 64 65  20 68 65 72 65 20 3a 0d  |ome code here :.|
00003f20  02 69 1f f4 20 6c 69 6b  65 20 50 52 4f 43 6e 65  |.i.. like PROCne|
00003f30  74 67 61 6d 65 5f 73 65  6e 64 28 61 24 29 0d 02  |tgame_send(a$)..|
00003f40  6a 29 f4 20 43 6c 65 61  72 20 74 68 65 20 74 65  |j). Clear the te|
00003f50  78 74 20 61 6e 64 20 63  6c 6f 73 65 20 74 68 65  |xt and close the|
00003f60  20 77 69 6e 64 6f 77 0d  02 6b 19 f2 6e 65 74 67  | window..k..netg|
00003f70  61 6d 65 5f 73 65 6e 64  28 22 4d 22 2b 61 24 29  |ame_send("M"+a$)|
00003f80  0d 02 6c 1f f2 73 65 74  69 63 6f 6e 74 65 78 74  |..l..seticontext|
00003f90  28 73 65 6e 64 77 69 6e  25 2c 30 2c 22 22 29 0d  |(sendwin%,0,"").|
00003fa0  02 6d 17 f2 63 6c 6f 73  65 77 69 6e 28 73 65 6e  |.m..closewin(sen|
00003fb0  64 77 69 6e 25 29 0d 02  6e 05 e1 0d 02 6f 05 3a  |dwin%)..n....o.:|
00003fc0  0d 02 70 1f f4 20 4f 70  65 6e 20 74 68 65 20 27  |..p.. Open the '|
00003fd0  63 6f 6e 6e 65 63 74 27  20 77 69 6e 64 6f 77 0d  |connect' window.|
00003fe0  02 71 12 dd 20 f2 6f 70  65 6e 63 6f 6e 6e 65 63  |.q.. .openconnec|
00003ff0  74 0d 02 72 1f f2 6f 70  65 6e 77 69 6e 63 65 6e  |t..r..openwincen|
00004000  74 72 65 28 63 6f 6e 6e  65 63 74 77 69 6e 25 29  |tre(connectwin%)|
00004010  0d 02 73 1f f2 73 65 74  63 61 72 65 74 65 6e 64  |..s..setcaretend|
00004020  28 63 6f 6e 6e 65 63 74  77 69 6e 25 2c 31 29 0d  |(connectwin%,1).|
00004030  02 74 05 e1 0d 02 75 05  3a 0d 02 76 1d f4 20 4f  |.t....u.:..v.. O|
00004040  70 65 6e 20 74 68 65 20  27 72 65 70 6c 79 27 20  |pen the 'reply' |
00004050  77 69 6e 64 6f 77 0d 02  77 10 dd 20 f2 6f 70 65  |window..w.. .ope|
00004060  6e 72 65 70 6c 79 0d 02  78 16 f2 63 6c 6f 73 65  |nreply..x..close|
00004070  77 69 6e 28 6d 73 67 77  69 6e 25 29 0d 02 79 16  |win(msgwin%)..y.|
00004080  f2 6f 70 65 6e 77 69 6e  28 73 65 6e 64 77 69 6e  |.openwin(sendwin|
00004090  25 29 0d 02 7a 1c f2 73  65 74 63 61 72 65 74 65  |%)..z..setcarete|
000040a0  6e 64 28 73 65 6e 64 77  69 6e 25 2c 30 29 0d 02  |nd(sendwin%,0)..|
000040b0  7b 05 e1 0d 02 7c 04 0d  02 7d 25 dd 20 f2 73 63  |{....|...}%. .sc|
000040c0  72 65 65 6e 74 6f 77 69  6e 28 77 69 6e 64 6f 77  |reentowin(window|
000040d0  25 2c f8 20 78 25 2c f8  20 79 25 29 0d 02 7e 1d  |%,. x%,. y%)..~.|
000040e0  21 62 25 3d 77 69 6e 64  6f 77 25 3a c8 99 20 26  |!b%=window%:.. &|
000040f0  34 30 30 43 42 2c 2c 62  25 0d 02 7f 26 78 25 3d  |400CB,,b%...&x%=|
00004100  78 25 2b 62 25 21 32 30  2d 62 25 21 34 3a 79 25  |x%+b%!20-b%!4:y%|
00004110  3d 79 25 2b 62 25 21 32  34 2d 62 25 21 31 36 0d  |=y%+b%!24-b%!16.|
00004120  02 80 05 e1 0d 02 81 04  0d 02 82 16 f4 20 2d 2d  |............. --|
00004130  2d 2d 20 42 4c 49 62 49  49 20 2d 2d 2d 2d 0d 02  |-- BLIbII ----..|
00004140  83 31 dd 20 a4 63 6f 6f  72 64 5f 72 65 63 5f 6f  |.1. .coord_rec_o|
00004150  76 65 72 6c 61 70 28 78  25 2c 79 25 2c 58 25 2c  |verlap(x%,y%,X%,|
00004160  59 25 2c 61 25 2c 62 25  2c 41 25 2c 42 25 29 0d  |Y%,a%,b%,A%,B%).|
00004170  02 84 18 e7 20 78 25 3c  61 25 20 80 20 58 25 3c  |.... x%<a% . X%<|
00004180  61 25 20 8c 20 3d a3 0d  02 85 18 e7 20 78 25 3e  |a% . =...... x%>|
00004190  41 25 20 80 20 58 25 3e  41 25 20 8c 20 3d a3 0d  |A% . X%>A% . =..|
000041a0  02 86 18 e7 20 79 25 3c  62 25 20 80 20 59 25 3c  |.... y%<b% . Y%<|
000041b0  62 25 20 8c 20 3d a3 0d  02 87 18 e7 20 79 25 3e  |b% . =...... y%>|
000041c0  42 25 20 80 20 59 25 3e  42 25 20 8c 20 3d a3 0d  |B% . Y%>B% . =..|
000041d0  02 88 06 3d b9 0d 02 89  04 0d 02 8a 24 dd 20 f2  |...=........$. .|
000041e0  63 6f 6f 72 64 5f 72 65  61 6c 74 6f 77 69 6e 28  |coord_realtowin(|
000041f0  57 25 2c f8 20 58 25 2c  f8 20 59 25 29 0d 02 8b  |W%,. X%,. Y%)...|
00004200  0e ea 20 42 25 3a 42 25  3d 62 25 0d 02 8c 18 21  |.. B%:B%=b%....!|
00004210  42 25 3d 57 25 3a c8 99  20 26 34 30 30 43 42 2c  |B%=W%:.. &400CB,|
00004220  2c 42 25 0d 02 8d 26 58  25 3d 58 25 2b 42 25 21  |,B%...&X%=X%+B%!|
00004230  32 30 2d 42 25 21 34 3a  59 25 3d 59 25 2b 42 25  |20-B%!4:Y%=Y%+B%|
00004240  21 32 34 2d 42 25 21 31  36 0d 02 8e 05 e1 0d 02  |!24-B%!16.......|
00004250  8f 04 0d 02 90 24 dd 20  f2 63 6f 6f 72 64 5f 77  |.....$. .coord_w|
00004260  69 6e 74 6f 72 65 61 6c  28 57 25 2c f8 20 58 25  |intoreal(W%,. X%|
00004270  2c f8 20 59 25 29 0d 02  91 0e ea 20 42 25 3a 42  |,. Y%)..... B%:B|
00004280  25 3d 62 25 0d 02 92 18  21 42 25 3d 57 25 3a c8  |%=b%....!B%=W%:.|
00004290  99 20 26 34 30 30 43 42  2c 2c 42 25 0d 02 93 26  |. &400CB,,B%...&|
000042a0  58 25 3d 58 25 2d 42 25  21 32 30 2b 42 25 21 34  |X%=X%-B%!20+B%!4|
000042b0  3a 59 25 3d 42 25 21 31  36 2d 42 25 21 32 34 2b  |:Y%=B%!16-B%!24+|
000042c0  59 25 0d 02 94 05 e1 0d  02 95 04 0d ff           |Y%...........|
000042cd