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

  1. *
  2. * $VER: Image.asm   0.15 (18.3.98) wieder images(layout)
  3. *            0.14 (24.7.95) mehr farben
  4. *            0.13 (27.2.95) Keine Images mehr
  5. *            0.12 (15.9.93)
  6. *
  7.  
  8. WeissBlauKLOTZ        equ 0
  9. SchwarzBlauKLOTZ    equ 1
  10. GrauBlauKLOTZ        equ 2
  11. GrauKLOTZ        equ 3
  12. BlauKLOTZ        equ 4
  13. SchwarzGrauKLOTZ    equ 5
  14. WeissGrauKLOTZ        equ 6
  15. * ImageFarben
  16. ImageFarben
  17.  dc.l $00020003
  18.  dc.l $00010003
  19.  dc.l $00000003
  20.  dc.l $00000000
  21.  dc.l $00030003
  22.  dc.l $00010000
  23.  dc.l $00020000
  24.  
  25. PutKlotz
  26. *  Setzt einen Klotz an die (hoffentlich) richtige Stelle
  27. *  ALLE REGISTER BLEIBEN ERHALTEN
  28. *   =>    a1  :    RastPort ( in a1, weil Standard für GfxLib )
  29. *    d0  :    Spalte( 1 links  10 rechts)
  30. *    d1  :    Zeile ( 18 oben  1 unten )
  31. *    d2  :    FarbFlag
  32.     push    d0-d4/a0-a1
  33.     bsr     GetCoords
  34.     ifne NEEDFORSPEED
  35. * Optimierung: Klotz in Bitmap zwischenspeichern
  36.     tst.b   IsImage(a4)
  37.     beq.s   EinsprungNX
  38.     push    d5/d6/a6
  39.     move.w  d0,d2
  40.     move.w  d1,d3
  41.     moveq   #0,d0
  42.     moveq   #0,d1
  43.     copy.l  CImage,a0
  44.     copy.l  CRastPort,a1
  45.     copy.w  SteinWidth,d4    ;  Weite
  46.     copy.w  SteinHeight,d5    ;  Höhe
  47.     move.b  #$C0,d6        ;  Minterm = Kopieren
  48.     CGFX    BltBitMapRastPort
  49.     pop     d5/d6/a6
  50.     bra.s   exitput
  51.     endc
  52. EinsprungNX
  53.     tst.b   IsColor(a4)
  54.     beq.s   .noColor
  55.     move.l  d2,d4
  56.     copy.w  SteinWidth,d2    ;  Weite
  57.     copy.w  SteinHeight,d3    ;  Höhe
  58.     bsr     ColorBox3D
  59.     bra.s   .exitput
  60. .noColor
  61.     lsl.l   #2,d2
  62.     move.l  ImageFarben(pc,d2),d4
  63.     copy.w  SteinWidth,d2    ;  Weite
  64.     copy.w  SteinHeight,d3    ;  Höhe
  65.     bsr     DrawBox3D
  66. .exitput
  67.     ifne NEEDFORSPEED
  68.     tst.b   IsImage(a4)
  69.     beq.s   exitput
  70.     copy.l  CRastPort,a0
  71.     move.l  rp_BitMap(a0),a0
  72.     push    d5-d7
  73.     move.w  d2,d4
  74.     move.w  d3,d5
  75.     moveq   #0,d2
  76.     moveq   #0,d3
  77.     move.b  #$c0,d6
  78.     st        d7
  79.     copy.l  CImage,a1
  80.     CGFX    BltBitMap
  81.     on.b    IsImage
  82.     pop     d5-d7/a6
  83.     endc
  84. exitput
  85.     pop     d0-d4/a0-a1
  86.     rts
  87.  
  88. PutNXKlotz
  89. *   Setzt Klotz ins Next-Feld
  90. *   ALLE REGISTER BLEIBEN ERHALTEN
  91. *   =>    a1  :    RastPort
  92. *    d0  :    Spalte    ( 0 .. 3 )
  93. *    d1  :    Zeile    ( 3 .. 0 )
  94.     push    d0-d4/a0-a1
  95.     move.l  a1,a0
  96.     push    d3
  97.     lsl.w   #4,d0
  98.     moveq   #90,d3
  99.     add.w   d3,d0
  100.     add.w   d3,d0
  101.     subq.b  #3,d1
  102.     neg.b   d1
  103.     tst.b   IsLace(a4)
  104.     beq.s   .nolace
  105.     lsl.w   #4,d1
  106.     bra.s   .endif
  107. .nolace
  108.     lsl.w   #3,d1
  109. .endif
  110.     moveq   #116,d3
  111.     add.w   d3,d1
  112.     pop     d3
  113.     GZZ
  114.     bra   EinsprungNX
  115.  
  116. GetCoords
  117. *   =>    d0  :    Zeile
  118. *    d1  :    Spalte
  119. *   <=    d0  :    x
  120. *    d1  :    y
  121.     subi.b  #18,d1
  122.     neg.b   d1
  123.     mulu.w  SteinHeight(a4),d1
  124.     addq.w  #4,d1           yy=(18-y)*8+4
  125.     subq.b  #1,d0
  126.     mulu.w  SteinWidth(a4),d0
  127.     addi.w  #10,d0        xx=(x-1)*16+10=x*16-6
  128.     GZZ
  129.     rts
  130.  
  131. DelKlotz
  132. *   löscht Kasten
  133. *   ALLE REGISTER BLEIBEN ERHALTEN
  134. *   =>    a1  :    RastPort
  135. *    d0  :    Spalte (s.o.)
  136. *    d1  :    Zeile  ( "  )
  137.     push    d0-d3/a0-a1/a6
  138.     bsr.s   GetCoords
  139.     move.w  d0,d2
  140.     move.w  d1,d3
  141.     add.w   SteinWidth(a4),d2       plus Weite -1
  142.     subq.w  #1,d2
  143.     add.w   SteinHeight(a4),d3      plus Höhe -1
  144.     subq.w  #1,d3
  145.     CGFX    EraseRect
  146.     pop     d0-d3/a0-a1/a6
  147.     rts
  148. HiLiteLines
  149. *
  150. *   Volle Zeilen hervorheben (mit Complement) > 2* aufrufen
  151. *   =>    d1  :    Bitset volle Zeilen, Bits 1..18
  152. *
  153.     push    d0-d5/a0-a1
  154.  
  155.     move.l  d1,d5
  156.     moveq   #18,d4
  157.     moveq   #0,d0   ; Oberes Wort löschen
  158.     moveq   #0,d1
  159. .loop
  160.     btst    d4,d5
  161.     beq.s   .weiter
  162.  
  163.     move.w  d4,d1   ; Zeilenende bestimmen
  164.     subq.w  #1,d1   ; Zeile -1
  165.     moveq   #11,d0  ; letzte Spalte +1 (=11)
  166.     bsr.s   GetCoords ; keine Koordinatenüberprüfung
  167.     subq.w  #1,d0   ; und wieder x-1,y-1
  168.     subq.w  #1,d1
  169.     move.l  d0,d2
  170.     move.l  d1,d3
  171.  
  172.     move.w  d4,d1   ; Zeilenanfang bestimmen
  173.     moveq   #1,d0
  174.     bsr.s   GetCoords
  175.  
  176.     copy.l  CRastPort,a1
  177.     bsr     InvertBox
  178. .weiter
  179.     subq.b  #1,d4
  180.     bgt.s   .loop
  181.     pop     d0-d5/a0-a1
  182.     rts
  183.  
  184.