Fix IO memory access .. SB128 driver makes noises in VMWare - CMI is untested (Curren...
[AROS.git] / rom / graphics / drawglist.c
bloba8bdd2da74ed53937ce276c9373e8a7996065d67
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Draw the list of gels
6 Lang: english
7 */
8 #include <aros/debug.h>
9 #include <proto/graphics.h>
10 #include "graphics_intern.h"
11 #include "gels_internal.h"
13 /*****************************************************************************
15 NAME */
16 #include <clib/graphics_protos.h>
18 AROS_LH2(void, DrawGList,
20 /* SYNOPSIS */
21 AROS_LHA(struct RastPort *, rp, A1),
22 AROS_LHA(struct ViewPort *, vp, A0),
24 /* LOCATION */
25 struct GfxBase *, GfxBase, 19, Graphics)
27 /* FUNCTION
28 Process the gel list, draw VSprites and Bobs.
30 INPUTS
31 rp - RastPort where Bobs will be drawn
32 vp - ViewPort for VSprites
34 RESULT
36 NOTES
38 EXAMPLE
40 BUGS
42 SEE ALSO
44 INTERNALS
46 HISTORY
48 *****************************************************************************/
50 AROS_LIBFUNC_INIT
52 struct VSprite * CurVSprite = rp->GelsInfo->gelHead;
53 struct VSprite * AfterPathVSprite = NULL;
54 int followdrawpath;
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;
66 } else {
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,
105 CurVSprite->X,
106 CurVSprite->Y,
107 CurVSprite->IntVSprite->SaveBuffer,
110 CurVSprite->Width << 4,
111 CurVSprite->Height,
112 0x0c0);
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.
129 } else {
131 * Now draw the VSprite/Bob at its current location.
133 _ValidateIntVSprite(CurVSprite->IntVSprite,
134 rp,
135 FALSE,
136 GfxBase);
138 /* FIXME: Wrong minterm is used.
139 * Need to implement mintern '0xe0'.
141 BltBitMapRastPort(CurVSprite->IntVSprite->ImageData,
145 CurVSprite->X,
146 CurVSprite->Y,
147 CurVSprite->Width << 4,
148 CurVSprite->Height,
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
153 * purposes.
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;
181 PrevVSprite = NULL;
182 CurVSprite = AfterPathVSprite;
184 } else {
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 */
201 AROS_LIBFUNC_EXIT
203 } /* DrawGList */