2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
5 Desc: Graphics function InitMasks()
8 #include <graphics/gels.h>
9 #include <graphics/rastport.h>
10 #include "graphics_intern.h"
12 /*****************************************************************************
15 #include <proto/graphics.h>
17 AROS_LH1(void, InitMasks
,
20 AROS_LHA(struct VSprite
*, vs
, A0
),
23 struct GfxBase
*, GfxBase
, 21, Graphics
)
26 Creates the standard BorderLine and CollMask masks of the VSprite.
27 VSprites and Bobs are treated accordingly.
30 vs = pointer to VSprite structure
41 InitGels() InitGMasks() graphics/gels.h
47 *****************************************************************************/
50 AROS_LIBBASE_EXT_DECL(struct GfxBase
*,GfxBase
)
52 long depth
, WordsPerPlane
, WordsPerLine
, count
;
53 /* is this a Bob or a VSprite? */
54 if (0 != (vs
-> Flags
& VSPRITE
))
56 /* assumption: vs -> Widtht = 16 (or 32 on a better chipset??)*/
57 WordsPerLine
= vs
-> Width
>> 4; /* Width:16 */
58 depth
= 2; /* standard */
62 WordsPerLine
= vs
-> Width
;
65 WordsPerPlane
= (vs
-> Height
) * WordsPerLine
;
68 /* create the standard collision mask by or'ing all bitplanes */
69 for (count
= 0; count
< WordsPerPlane
; count
++)
71 WORD
* PlaneData
= vs
-> ImageData
;
72 WORD Data
= PlaneData
[count
];
74 for (z
= 1; z
< depth
; z
++)
75 Data
|= PlaneData
[count
+ z
*WordsPerPlane
];
76 (vs
-> CollMask
)[count
] = Data
;
79 /* create the standard BorderLine from the collision mask by or'ing all
81 for (count
= 0 ; count
< WordsPerLine
; count
++)
83 WORD
* CollMask
= vs
-> CollMask
;
84 WORD Data
= CollMask
[count
];
86 for (z
= 1; z
< vs
-> Height
; z
++)
87 Data
|= CollMask
[count
+ z
*WordsPerLine
];
88 (vs
-> BorderLine
)[count
] = Data
;