compiler: Support autoopening of libraries in AROS_SHxx() style programs
[AROS.git] / rom / graphics / addvsprite.c
blob47e80db8e5893428e987e8a50077a8ebc3bce9f7
1 /*
2 Copyright © 1995-2007, 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
56 struct VSprite * CurVSprite;
57 /* the Y-coordinate is most significant! */
58 LONG Koord = JOIN_XY_COORDS(vs->X, vs->Y);
60 /* Reset the Flags for this VSprite and set OldX/Y */
61 vs -> Flags &= 0xFF;
62 vs -> OldY = vs -> Y;
63 vs -> OldX = vs -> X;
65 CurVSprite = rp->GelsInfo->gelHead;
67 /* look for the appropriate place to insert the VSprite into the
68 list of VSprites which is connected to the GelsInfo which was
69 previously found in the rastport */
71 while (JOIN_XY_COORDS(CurVSprite->NextVSprite->X, CurVSprite->NextVSprite->Y) < Koord)
72 CurVSprite = CurVSprite->NextVSprite;
74 /* insert the new VSprite *after* CurVSprite */
76 CurVSprite -> NextVSprite -> PrevVSprite = vs;
77 vs -> NextVSprite = CurVSprite -> NextVSprite;
78 vs -> PrevVSprite = CurVSprite;
79 CurVSprite -> NextVSprite = vs;
82 * Create he IntVSprite structure for improved handling of
83 * the VSprite ImageData.
85 vs -> IntVSprite = _CreateIntVSprite(vs, rp, GfxBase);
87 AROS_LIBFUNC_EXIT
89 } /* AddVSprite */