2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
5 Desc: Draw the list of gels
9 #include <aros/debug.h>
10 #include <proto/graphics.h>
12 #include "graphics_intern.h"
13 #include "gfxfuncsupport.h"
14 #include "gels_internal.h"
16 /*****************************************************************************
19 #include <clib/graphics_protos.h>
21 AROS_LH2(void, DrawGList
,
24 AROS_LHA(struct RastPort
*, rp
, A1
),
25 AROS_LHA(struct ViewPort
*, vp
, A0
),
28 struct GfxBase
*, GfxBase
, 19, Graphics
)
31 Process the gel list, draw VSprites and Bobs.
34 rp - RastPort where Bobs will be drawn
35 vp - ViewPort for VSprites
51 *****************************************************************************/
55 struct VSprite
* CurVSprite
= rp
->GelsInfo
->gelHead
;
56 struct VSprite
* AfterPathVSprite
= NULL
;
58 struct VSprite
* PrevVSprite
= NULL
;
61 * CurVSprite is not a valid VSprite but the "boundary vsprite"
62 * Should I follow the DrawPath?
64 if (NULL
!= CurVSprite
->IntVSprite
&&
65 NULL
!= CurVSprite
->IntVSprite
->DrawPath
) {
66 followdrawpath
= TRUE
;
67 AfterPathVSprite
= CurVSprite
->NextVSprite
;
68 CurVSprite
= CurVSprite
->IntVSprite
->DrawPath
;
70 followdrawpath
= FALSE
;
71 CurVSprite
= CurVSprite
->NextVSprite
;
75 * As long as I don't step on the last boundary vsprite
77 while (NULL
!= CurVSprite
->NextVSprite
) {
79 * Check a few flags that must not be set.
80 * The Bob should not be out of the rastport or already be drawn
82 if ( 0 == (CurVSprite
->Flags
& (GELGONE
)) ||
83 (NULL
!= (CurVSprite
->VSBob
) && 0 == (CurVSprite
->VSBob
->Flags
& BDRAWN
))) {
85 * If this VSprite was overlapping with other VSprites
86 * the follow the ClearPath first and clear all the
87 * VSprites on that path. That routine will also reset
88 * the ClearPath variable on all encountered VSprites.
89 * If it was not overlapping with other VSprites but
90 * was visible before it will either clear or back up
91 * the previous background.
94 if (NULL
!= CurVSprite
->VSBob
)
95 _ClearBobAndFollowClearPath(CurVSprite
,rp
,GfxBase
);
98 * If I am supposed to back up the background then
99 * I have to do it now!!
100 * This unfortunatley has also to be done if the
101 * VSprite/Bob did not move since it could have
102 * changed its appearance.
104 if (0 != (CurVSprite
->Flags
& SAVEBACK
) && NULL
!= CurVSprite
->VSBob
)
106 BltRastPortBitMap(rp
,
109 CurVSprite
->IntVSprite
->SaveBuffer
,
112 CurVSprite
->Width
<< 4,
116 CurVSprite
->Flags
|= BACKSAVED
;
118 else kprintf("NOT SAVING BACKGROUND!\n");
120 if (0 == (CurVSprite
->Flags
& VSPRITE
) &&
121 BOBSAWAY
== (CurVSprite
->VSBob
->Flags
& BOBSAWAY
)) {
123 * This Bob is to be removed...
125 CurVSprite
->PrevVSprite
->NextVSprite
= CurVSprite
->NextVSprite
;
126 CurVSprite
->NextVSprite
->PrevVSprite
= CurVSprite
->PrevVSprite
;
128 * This does not damage the drawpath and clearpath since
129 * the structure is not freed.
133 * Now draw the VSprite/Bob at its current location.
135 _ValidateIntVSprite(CurVSprite
->IntVSprite
,
140 /* FIXME: Wrong minterm is used.
141 * Need to implement mintern '0xe0'.
145 #define VS_MINTERM 0x0e0
147 /* should be 0xe0! */
148 #define VS_MINTERM 0x0c0
150 if ((CurVSprite
->VSBob
) && (CurVSprite
->VSBob
->ImageShadow
))
151 BltMaskBitMapRastPort(CurVSprite
->IntVSprite
->ImageData
,
157 CurVSprite
->Width
<< 4,
160 (PLANEPTR
)CurVSprite
->VSBob
->ImageShadow
);
162 BltBitMapRastPort(CurVSprite
->IntVSprite
->ImageData
,
168 CurVSprite
->Width
<< 4,
174 * I will need to know the vsprite's coordinates
175 * that it has now the next time as well for clearing
178 CurVSprite
->OldX
= CurVSprite
->X
;
179 CurVSprite
->OldY
= CurVSprite
->Y
;
181 if (CurVSprite
->VSBob
) {
183 * it's a bob! mark it as drawn.
185 CurVSprite
->VSBob
->Flags
|= BDRAWN
;
186 CurVSprite
->VSBob
->Flags
&= ~BOBNIX
;
192 * Am I supposed to follow the drawpath.
193 * If yes then follow it to its end.
196 if (followdrawpath
) {
197 if (NULL
!= PrevVSprite
)
198 PrevVSprite
->ClearPath
= CurVSprite
;
199 PrevVSprite
= CurVSprite
;
201 CurVSprite
= CurVSprite
->IntVSprite
->DrawPath
;
202 if (NULL
== CurVSprite
) {
203 followdrawpath
= FALSE
;
205 CurVSprite
= AfterPathVSprite
;
208 if (NULL
!= PrevVSprite
)
209 PrevVSprite
->ClearPath
= CurVSprite
;
210 PrevVSprite
= CurVSprite
;
211 CurVSprite
= CurVSprite
->NextVSprite
;
213 * Does a DrawPath start here?
214 * If yes, then I will follow the DrawPath
215 * after I am done with this VSprite.
217 if (NULL
!= CurVSprite
->IntVSprite
->DrawPath
) {
218 followdrawpath
= TRUE
;
219 AfterPathVSprite
= CurVSprite
->NextVSprite
;
222 } /* while not all bobs/vsprites are drawn */