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 /* FIXME: Wrong minterm is used.
139 * Need to implement mintern '0xe0'.
141 BltBitMapRastPort(CurVSprite
->IntVSprite
->ImageData
,
147 CurVSprite
->Width
<< 4,
149 0x0c0 /* should be 0xe0! */);
151 * I will need to know the vsprite's coordinates
152 * that it has now the next time as well for clearing
155 CurVSprite
->OldX
= CurVSprite
->X
;
156 CurVSprite
->OldY
= CurVSprite
->Y
;
158 if (CurVSprite
->VSBob
) {
160 * it's a bob! mark it as drawn.
162 CurVSprite
->VSBob
->Flags
|= BDRAWN
;
163 CurVSprite
->VSBob
->Flags
&= ~BOBNIX
;
169 * Am I supposed to follow the drawpath.
170 * If yes then follow it to its end.
173 if (followdrawpath
) {
174 if (NULL
!= PrevVSprite
)
175 PrevVSprite
->ClearPath
= CurVSprite
;
176 PrevVSprite
= CurVSprite
;
178 CurVSprite
= CurVSprite
->IntVSprite
->DrawPath
;
179 if (NULL
== CurVSprite
) {
180 followdrawpath
= FALSE
;
182 CurVSprite
= AfterPathVSprite
;
185 if (NULL
!= PrevVSprite
)
186 PrevVSprite
->ClearPath
= CurVSprite
;
187 PrevVSprite
= CurVSprite
;
188 CurVSprite
= CurVSprite
->NextVSprite
;
190 * Does a DrawPath start here?
191 * If yes, then I will follow the DrawPath
192 * after I am done with this VSprite.
194 if (NULL
!= CurVSprite
->IntVSprite
->DrawPath
) {
195 followdrawpath
= TRUE
;
196 AfterPathVSprite
= CurVSprite
->NextVSprite
;
199 } /* while not all bobs/vsprites are drawn */