some fixes to accented characters
[tangerine.git] / rom / graphics / drawglist.c
blob0525dcfd82071c2db1e4085c1fa79a84331398c8
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 BltBitMapRastPort(CurVSprite->IntVSprite->ImageData,
142 CurVSprite->X,
143 CurVSprite->Y,
144 CurVSprite->Width << 4,
145 CurVSprite->Height,
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
151 * purposes.
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;
179 PrevVSprite = NULL;
180 CurVSprite = AfterPathVSprite;
182 } else {
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 */
199 AROS_LIBFUNC_EXIT
201 } /* DrawGList */