r4493@vps: verhaegs | 2007-04-19 14:44:00 -0400
[AROS.git] / rom / graphics / addvsprite.c
blob31a6844c07d1ba2618166518f65d055606ad8a34
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Graphics function AddVSprite()
6 Lang: english
7 */
8 #include <graphics/gels.h>
9 #include <graphics/rastport.h>
10 #include "graphics_intern.h"
11 #include "gels_internal.h"
12 #include <proto/exec.h>
14 /*****************************************************************************
16 NAME */
17 #include <proto/graphics.h>
19 AROS_LH2(void, AddVSprite,
21 /* SYNOPSIS */
22 AROS_LHA(struct VSprite *, vs, A0),
23 AROS_LHA(struct RastPort *, rp, A1),
25 /* LOCATION */
26 struct GfxBase *, GfxBase, 17, Graphics)
28 /* FUNCTION
29 The VSprite is linked into the current gel list using it's
30 y and x coordinates. The VSprite's flags are set up.
32 INPUTS
33 vs = pointer to VSprite to be linked into gel list
34 rp = pointer to RastPort that has an initialized GelsInfo linked
35 to it (see InitGels()).
37 RESULT
39 NOTES
41 EXAMPLE
43 BUGS
45 SEE ALSO
46 InitGels() graphics/gels.h graphics/rastport.h
48 INTERNALS
50 HISTORY
52 *****************************************************************************/
54 AROS_LIBFUNC_INIT
55 AROS_LIBBASE_EXT_DECL(struct GfxBase *,GfxBase)
57 struct VSprite * CurVSprite;
58 /* the Y-coordinate is most significant! */
59 LONG Koord = JOIN_XY_COORDS(vs->X, vs->Y);
61 /* Reset the Flags for this VSprite and set OldX/Y */
62 vs -> Flags &= 0xFF;
63 vs -> OldY = vs -> Y;
64 vs -> OldX = vs -> X;
66 CurVSprite = rp->GelsInfo->gelHead;
68 /* look for the appropriate place to insert the VSprite into the
69 list of VSprites which is connected to the GelsInfo which was
70 previously found in the rastport */
72 while (JOIN_XY_COORDS(CurVSprite->NextVSprite->X, CurVSprite->NextVSprite->Y) < Koord)
73 CurVSprite = CurVSprite->NextVSprite;
75 /* insert the new VSprite *after* CurVSprite */
77 CurVSprite -> NextVSprite -> PrevVSprite = vs;
78 vs -> NextVSprite = CurVSprite -> NextVSprite;
79 vs -> PrevVSprite = CurVSprite;
80 CurVSprite -> NextVSprite = vs;
83 * Create he IntVSprite structure for improved handling of
84 * the VSprite ImageData.
86 vs -> IntVSprite = _CreateIntVSprite(vs, rp, GfxBase);
88 AROS_LIBFUNC_EXIT
90 } /* AddVSprite */