2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
5 Desc: Draw the list of gels
8 #include <aros/debug.h>
9 #include <proto/graphics.h>
10 #include "graphics_intern.h"
11 #include "gels_internal.h"
13 /*****************************************************************************
16 #include <clib/graphics_protos.h>
18 AROS_LH2(void, DrawGList
,
21 AROS_LHA(struct RastPort
*, rp
, A1
),
22 AROS_LHA(struct ViewPort
*, vp
, A0
),
25 struct GfxBase
*, GfxBase
, 19, Graphics
)
28 Process the gel list, draw VSprites and Bobs.
31 rp - RastPort where Bobs will be drawn
32 vp - ViewPort for VSprites
48 *****************************************************************************/
52 struct VSprite
* CurVSprite
= rp
->GelsInfo
->gelHead
;
53 struct VSprite
* AfterPathVSprite
= NULL
;
55 struct VSprite
* PrevVSprite
= NULL
;
58 * CurVSprite is not a valid VSprite but the "boundary vsprite"
59 * Should I follow the DrawPath?
61 if (NULL
!= CurVSprite
->IntVSprite
&&
62 NULL
!= CurVSprite
->IntVSprite
->DrawPath
) {
63 followdrawpath
= TRUE
;
64 AfterPathVSprite
= CurVSprite
->NextVSprite
;
65 CurVSprite
= CurVSprite
->IntVSprite
->DrawPath
;
67 followdrawpath
= FALSE
;
68 CurVSprite
= CurVSprite
->NextVSprite
;
72 * As long as I don't step on the last boundary vsprite
74 while (NULL
!= CurVSprite
->NextVSprite
) {
76 * Check a few flags that must not be set.
77 * The Bob should not be out of the rastport or already be drawn
79 if ( 0 == (CurVSprite
->Flags
& (GELGONE
)) ||
80 (NULL
!= (CurVSprite
->VSBob
) && 0 == (CurVSprite
->VSBob
->Flags
& BDRAWN
))) {
82 * If this VSprite was overlapping with other VSprites
83 * the follow the ClearPath first and clear all the
84 * VSprites on that path. That routine will also reset
85 * the ClearPath variable on all encountered VSprites.
86 * If it was not overlapping with other VSprites but
87 * was visible before it will either clear or back up
88 * the previous background.
91 if (NULL
!= CurVSprite
->VSBob
)
92 _ClearBobAndFollowClearPath(CurVSprite
,rp
,GfxBase
);
95 * If I am supposed to back up the background then
96 * I have to do it now!!
97 * This unfortunatley has also to be done if the
98 * VSprite/Bob did not move since it could have
99 * changed its appearance.
101 if (0 != (CurVSprite
->Flags
& SAVEBACK
) &&
102 NULL
!= CurVSprite
->VSBob
) {
104 BltRastPortBitMap(rp
,
107 CurVSprite
->IntVSprite
->SaveBuffer
,
110 CurVSprite
->Width
<< 4,
114 CurVSprite
->Flags
|= BACKSAVED
;
116 else kprintf("NOT SAVING BACKGROUND!\n");
118 if (0 == (CurVSprite
->Flags
& VSPRITE
) &&
119 BOBSAWAY
== (CurVSprite
->VSBob
->Flags
& BOBSAWAY
)) {
121 * This Bob is to be removed...
123 CurVSprite
->PrevVSprite
->NextVSprite
= CurVSprite
->NextVSprite
;
124 CurVSprite
->NextVSprite
->PrevVSprite
= CurVSprite
->PrevVSprite
;
126 * This does not damage the drawpath and clearpath since
127 * the structure is not freed.
131 * Now draw the VSprite/Bob at its current location.
133 _ValidateIntVSprite(CurVSprite
->IntVSprite
,
138 BltBitMapRastPort(CurVSprite
->IntVSprite
->ImageData
,
144 CurVSprite
->Width
<< 4,
146 0x0c0 /* should be 0xe0! */);
147 #warning Wrong minterm is used. Need to implement mintern '0xe0'.
149 * I will need to know the vsprite's coordinates
150 * that it has now the next time as well
for clearing
153 CurVSprite
->OldX
= CurVSprite
->X
;
154 CurVSprite
->OldY
= CurVSprite
->Y
;
156 if (CurVSprite
->VSBob
) {
158 * it's a bob! mark it as drawn.
160 CurVSprite
->VSBob
->Flags
|= BDRAWN
;
161 CurVSprite
->VSBob
->Flags
&= ~BOBNIX
;
167 * Am I supposed to follow the drawpath.
168 * If yes then follow it to its end.
171 if (followdrawpath
) {
172 if (NULL
!= PrevVSprite
)
173 PrevVSprite
->ClearPath
= CurVSprite
;
174 PrevVSprite
= CurVSprite
;
176 CurVSprite
= CurVSprite
->IntVSprite
->DrawPath
;
177 if (NULL
== CurVSprite
) {
178 followdrawpath
= FALSE
;
180 CurVSprite
= AfterPathVSprite
;
183 if (NULL
!= PrevVSprite
)
184 PrevVSprite
->ClearPath
= CurVSprite
;
185 PrevVSprite
= CurVSprite
;
186 CurVSprite
= CurVSprite
->NextVSprite
;
188 * Does a DrawPath start here?
189 * If yes, then I will follow the DrawPath
190 * after I am done with this VSprite.
192 if (NULL
!= CurVSprite
->IntVSprite
->DrawPath
) {
193 followdrawpath
= TRUE
;
194 AfterPathVSprite
= CurVSprite
->NextVSprite
;
197 } /* while not all bobs/vsprites are drawn */