home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Exec 3 / CD_Magazyn_EXEC_nr_3.iso / Recent / game / wb / Klotz.lha / Klotz / src / GfxUtils.asm < prev    next >
Assembly Source File  |  1998-03-01  |  5KB  |  255 lines

  1. *
  2. *   $VER: GfxUtils.asm    0.5 (27.2.95) ( DrawBox3D )
  3. *            0.4 (28.8.93)
  4. *
  5.  
  6. OSzweinullBorder
  7. *
  8. *   Zeichnet nette Umrahmung
  9. *   ( man könnte auch DrawBevelBox ...)
  10. *
  11. *   =>    a1 : RastPort
  12. *    d0 : xmin
  13. *    d1 : ymin
  14. *    d2 : xmax
  15. *    d3 : ymax
  16. *    d4 : mode
  17. BOX_RECESSED = 0
  18. BOX_RAISED   = 1
  19. BOX_HILIGHT  = 2
  20. *BOX_NOBACK   = 8
  21.     push    d2-d7/a2
  22.     move.l  a1,a2
  23.     push    d0/d1
  24.     moveq   #0,d0
  25.     CGFX    SetAPen
  26.     pop     d0/d1
  27.     move.l  a2,a1
  28.     push    d0/d1
  29.     CALL    RectFill
  30.     pop     d0/d1
  31.     cmpi.b  #BOX_HILIGHT,d4
  32.     bne     .casenext
  33.     push    d0-d3
  34.     subq.w  #2,d0
  35.     subq.w  #1,d1
  36.     addq.w  #2,d2
  37.     addq.w  #1,d3
  38.     moveq   #BOX_RAISED,d4
  39.     move.l  a2,a1
  40.     bsr     OSzweinullBorder
  41.     pop     d0-d3
  42.     moveq   #BOX_RECESSED,d4
  43.     move.l  a2,a1
  44.     bsr     OSzweinullBorder
  45.     bra     .end
  46. .casenext
  47.     cmpi.b  #BOX_RAISED,d4
  48.     bne     .caseelse
  49.     moveq   #2,d6        Farben zuweisen
  50.     moveq   #1,d7        ( spätere Version mit Pens ? )
  51.     bra     .selectend
  52. .caseelse
  53.     cmpi.b  #BOX_RECESSED,d4
  54.     bne     .end
  55.     moveq   #1,d6
  56.     moveq   #2,d7
  57. .selectend
  58.     move.w  d0,d4
  59.     move.w  d1,d5
  60. *!!!                    !!!
  61. *!!!    Pixel unterer Rand links fehlt    !!! nicht mehr (aber in der Pascal-Version)
  62. *!!!                    !!!
  63.     move.l  d6,d0
  64.     move.l  a2,a1
  65.     CALL    SetAPen
  66.     move.w  d2,d0    xe+1
  67.     addq.w  #1,d0
  68.     move.w  d5,d1    y-1
  69.     subq.w  #1,d1
  70.     move.l  a2,a1
  71.     CALL    Move
  72.     move.w  d4,d0    x-2
  73.     subq.w  #2,d0
  74.     move.w  d5,d1
  75.     subq.w  #1,d1    y-1
  76.     move.l  a2,a1
  77.     CALL    Draw
  78.     move.w  d4,d0    x-2
  79.     subq.w  #2,d0
  80.     move.w  d3,d1    ye+1
  81.     addq.w  #1,d1
  82.     move.l  a2,a1
  83.     CALL    Draw
  84.     move.w  d4,d0    x-1
  85.     subq.w  #1,d0
  86.     move.w  d5,d1    y-1
  87.     subq.w  #1,d1
  88.     move.l  a2,a1
  89.     CALL    Move
  90.     move.w  d4,d0    x-1
  91.     subq.w  #1,d0
  92.     move.w  d3,d1    ye
  93.     move.l  a2,a1
  94.     CALL    Draw
  95.  
  96.     move.l  d7,d0
  97.     move.l  a2,a1
  98.     CALL    SetAPen
  99.     move.w  d2,d0    xe+2
  100.     addq.w  #2,d0
  101.     move.w  d5,d1    y-1
  102.     subq.w  #1,d1
  103.     move.l  a2,a1
  104.     CALL    Move
  105.     move.w  d2,d0    xe+2
  106.     addq.w  #2,d0
  107.     move.w  d3,d1    ye+1
  108.     addq.w  #1,d1
  109.     move.l  a2,a1
  110.     CALL    Draw
  111.     move.w  d4,d0    x-1
  112.     subq.w  #1,d0
  113.     move.w  d3,d1    ye+1
  114.     addq.w  #1,d1
  115.     move.l  a2,a1
  116.     CALL    Draw
  117.     move.w  d2,d0    xe+1
  118.     addq.w  #1,d0
  119.     move.w  d5,d1    y
  120.     move.l  a2,a1
  121.     CALL    Move
  122.     move.w  d2,d0    xe+1
  123.     addq.w  #1,d0
  124.     move.w  d3,d1    ye+1
  125.     addq.w  #1,d1
  126.     move.l  a2,a1
  127.     CALL    Draw
  128. .end
  129.     pop     d2-d7/a2
  130.     rts
  131. PunkteMuster
  132. *
  133. *   Zeichnet Punkte-Muster
  134. *   ( APen ist danach hin )
  135. *   =>    a1  :    RastPort
  136. *    d0,d1:    (xmin,ymin)
  137. *    d2,d3:    (xmax,ymax)
  138. *    d4  :    Farbe
  139.     push    a2/a6
  140.     move.l  a1,a2
  141.     lea     Pattern1(pc),a0
  142.     move.l  a0,rp_AreaPtrn(a1)
  143.     move.b  #Pat1Size,rp_AreaPtSz(a1)
  144.     push    d0/d1
  145.     move.w  d4,d0
  146.     CGFX    SetAPen
  147.     pop     d0/d1
  148.     move.l  a2,a1
  149.     CALL    RectFill
  150.     lea     Pattern2(pc),a0
  151.     move.l  a0,rp_AreaPtrn(a2)
  152.     move.b  #Pat2Size,rp_AreaPtSz(a2)
  153.     pop     a2/a6
  154.     rts
  155. *
  156. Pattern1    dc.l $aaaa5555
  157. Pat1Size    = 1
  158. Pattern2    dc.w $ffff
  159. Pat2Size    = 0
  160.     cnop    0,4
  161. InvertBox
  162. *   Invertiert Box
  163. *
  164. *   =>    a1  :    RastPort
  165. *    d0  :    xmin
  166. *    d1  :    ymin
  167. *    d2  :    xmax
  168. *    d3  :    ymax
  169. *  ALLE REGISTER BLEIBEN ERHALTEN
  170.     push    d0-d1/a0-a2/a6
  171.     move.l  a1,a2
  172.  
  173.     push    d0/d1
  174.     moveq   #RP_COMPLEMENT!RP_JAM2,d0
  175.     CGFX    SetDrMd
  176.     pop     d0/d1
  177.  
  178.     move.l  a2,a1
  179.     CALL    RectFill
  180.     moveq   #RP_JAM2,d0
  181.     move.l  a2,a1
  182.     CALL    SetDrMd
  183.     pop     d0-d1/a0-a2/a6
  184.     rts
  185. DrawBox3D
  186. *
  187. *  Zeichnet 3D Box mit Punktemuster
  188. *
  189. *  =>    a1: RastPort
  190. *    d0: x
  191. *    d1: y
  192. *    d2: width
  193. *    d3: height
  194. *    d4: colors ( high BPen low APen )
  195.     push    a2-a3/a6/d2-d6
  196.     move.l  a1,a2
  197.     move.l  d0,d5
  198.     move.l  d1,d6
  199.     subq.w  #1,d2
  200.     subq.w  #1,d3
  201.     move.l  d4,d0
  202.     swap    d0
  203.     CGFX    SetBPen
  204. * SetDrMd ist richtig auf A/BPEN (JAM2) gesetzt
  205.     move.l  d5,d0
  206.     addq.w  #1,d0    ; nur inneres
  207.     add.l   d5,d2
  208.     subq.w  #1,d2    ; zeichnen
  209.     move.l  d6,d1
  210.     addq.w  #1,d1
  211.     add.l   d6,d3
  212.     subq.w  #1,d3
  213.     move.l  a2,a1
  214.     bsr     PunkteMuster
  215.     addq.w  #1,d2
  216.     addq.w  #1,d3
  217.     moveq   #2,d0    ; weiß
  218.     move.l  a2,a1
  219.     CALL    SetAPen
  220.     move.l  d2,d0    ; oben rechts
  221.     move.l  d6,d1
  222.     move.l  a2,a1
  223.     CALL    Move
  224.     move.l  d5,d0
  225.     move.l  d6,d1
  226.     move.l  a2,a1
  227.     CALL    Draw
  228.     move.l  d5,d0
  229.     move.l  d3,d1
  230.     move.l  a2,a1
  231.     CALL    Draw
  232.     moveq   #1,d0    ; schwarz
  233.     move.l  a2,a1
  234.     CALL    SetAPen
  235.     move.l  d5,d0
  236.     addq.w  #1,d0
  237.     move.l  d3,d1
  238.     move.l  a2,a1    ; unten links
  239.     CALL    Move
  240.     move.l  d2,d0
  241.     move.l  d3,d1
  242.     move.l  a2,a1
  243.     CALL    Draw
  244.     move.l  d2,d0
  245.     move.l  d6,d1
  246.     addq.w  #1,d1
  247.     move.l  a2,a1
  248.     CALL    Draw
  249.     moveq   #0,d0   ; BPen auf Grau
  250.     move.l  a2,a1
  251.     CALL    SetBPen
  252.     pop     a2-a3/a6/d2-d6
  253.     rts
  254.  
  255.