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'.
143 BltBitMapRastPort(CurVSprite
->IntVSprite
->ImageData
,
149 CurVSprite
->Width
<< 4,
151 0x0c0 /* should be 0xe0! */);
153 * I will need to know the vsprite's coordinates
154 * that it has now the next time as well for clearing
157 CurVSprite
->OldX
= CurVSprite
->X
;
158 CurVSprite
->OldY
= CurVSprite
->Y
;
160 if (CurVSprite
->VSBob
) {
162 * it's a bob! mark it as drawn.
164 CurVSprite
->VSBob
->Flags
|= BDRAWN
;
165 CurVSprite
->VSBob
->Flags
&= ~BOBNIX
;
171 * Am I supposed to follow the drawpath.
172 * If yes then follow it to its end.
175 if (followdrawpath
) {
176 if (NULL
!= PrevVSprite
)
177 PrevVSprite
->ClearPath
= CurVSprite
;
178 PrevVSprite
= CurVSprite
;
180 CurVSprite
= CurVSprite
->IntVSprite
->DrawPath
;
181 if (NULL
== CurVSprite
) {
182 followdrawpath
= FALSE
;
184 CurVSprite
= AfterPathVSprite
;
187 if (NULL
!= PrevVSprite
)
188 PrevVSprite
->ClearPath
= CurVSprite
;
189 PrevVSprite
= CurVSprite
;
190 CurVSprite
= CurVSprite
->NextVSprite
;
192 * Does a DrawPath start here?
193 * If yes, then I will follow the DrawPath
194 * after I am done with this VSprite.
196 if (NULL
!= CurVSprite
->IntVSprite
->DrawPath
) {
197 followdrawpath
= TRUE
;
198 AfterPathVSprite
= CurVSprite
->NextVSprite
;
201 } /* while not all bobs/vsprites are drawn */