~vesto/uxn-shenanigans

16b1aa47510b4fc6dcde819c867126b18187ead1 — Steve Gattuso 1 year, 6 months ago b133c6e
wip trying to get an offset working on the hex grid
1 files changed, 26 insertions(+), 17 deletions(-)

M hex-grid.tal
M hex-grid.tal => hex-grid.tal +26 -17
@@ 16,29 16,38 @@
  #01c0 .System/g DEO2
  #2ce5 .System/b DEO2

  #0000 #0000
  ( ws: xpos ypos / rs: )
  #0000 #0000 #0000
  ( ws: off xpos ypos / rs: )
  &loop-y
    DEBUG
    &loop-x
      STH2 STH2                       ( ws: / rs: ypos xpos )
      STH2rk SWP2r STH2rk SWP2r       ( ws: xpos ypos / rs: ypos xpos )
      #c5 ;draw-hex JSR2              ( ws: / rs: ypos xpos )
      .Screen/width DEI2              ( ws: width / rs: ypos xpos )
      STH2r               ( ws: width xpos / rs: ypos )
      #000c ADD2          ( ws: width new-xpos / rs: ypos )
      STH2k               ( ws: width new-xpos / rs: ypos new-xpos )
      GTH2 #00            ( ws: cond / rs: ypos new-xpos )
      STH2r STH2r         ( ws: cond new-xpos ypos / rs: )
      STH2 STH2                       ( ws: off / rs: ypos xpos )
      STH2rk SWP2r STH2rk SWP2r       ( ws: off xpos ypos / rs: ypos xpos )
      SWP2 ROT2 STH2rk                ( ws: ypos xpos off / rs: off )
      DEBUG
      ,&end-offset JCN
        ADD2 #0008
      &end-offset
      ( ws: ypos xpos / rs: off )
      STH2r  ( ws: ypos xpos off / rs: )
      ROT2   ( ws: xpos off ypos / rs: )
      ROT2   ( ws: off ypos xpos / rs: )
      SWP2   ( ws: off xpos ypos / rs: )
      #c5 ;draw-hex JSR2              ( ws: off / rs: ypos xpos )
      .Screen/width DEI2              ( ws: off width / rs: ypos xpos )
      STH2r               ( ws: off width xpos / rs: ypos )
      #000c ADD2          ( ws: off width new-xpos / rs: ypos )
      STH2k               ( ws: off width new-xpos / rs: ypos new-xpos )
      GTH2 #00            ( ws: off cond / rs: ypos new-xpos )
      STH2r STH2r         ( ws: off cond new-xpos ypos / rs: )
      ROT2 POP
    ,&loop-x JCN

    ( ws: xpos ypos / rs: )
    NIP2 #0000 SWP2 ( 0000 ypos / rs: )
    #000c ADD2 DUP2 ( ws: xpos new-ypos new-ypos / rs: )
    .Screen/height DEI2 ( ws: xpos new-ypos new-ypos height / rs: )
    SWP2 ( ws: xpos new-ypos height new-ypos / rs: )
    GTH2 ( ws: xpos new-ypos cond / rs: )
    NIP2 #0000 SWP2 ( ws: off 0000 ypos / rs: )
    #000c ADD2 DUP2 ( ws: off xpos new-ypos new-ypos / rs: )
    .Screen/height DEI2 ( ws: off xpos new-ypos new-ypos height / rs: )
    SWP2 ( ws: off xpos new-ypos height new-ypos / rs: )
    GTH2 ( ws: off xpos new-ypos cond / rs: )
    ,&loop-y JCN
BRK