revert between 56095 -> 55830 in arch
[AROS.git] / rom / graphics / remvsprite.c
blob6d4b1c3a769494ccd1d30f4b172e05bd70c79dc7
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 <proto/graphics.h>
9 #include <graphics/gels.h>
10 #include "gels_internal.h"
11 #include <graphics/rastport.h>
12 #include "graphics_intern.h"
13 #include <proto/exec.h>
15 /*****************************************************************************
17 NAME */
19 AROS_LH1(void, RemVSprite,
21 /* SYNOPSIS */
22 AROS_LHA(struct VSprite *, vs, A0),
24 /* LOCATION */
25 struct GfxBase *, GfxBase, 23, Graphics)
27 /* FUNCTION
28 The VSprite is unlinked from the gel list.
30 INPUTS
31 vs = pointer to VSprite to be removed from the gel list
33 RESULT
35 NOTES
37 EXAMPLE
39 BUGS
41 SEE ALSO
42 InitGels(), RemIBob(), graphics/gels.h
44 INTERNALS
45 I don't know whether it is correct to take the VSprite out of the
46 ClearPath and DrawPath, but it is implemented that way.
48 HISTORY
50 *****************************************************************************/
52 AROS_LIBFUNC_INIT
54 struct VSprite * Head;
55 struct VSprite * Current;
57 /* unlink this VSprite */
58 if (vs -> NextVSprite)
59 vs -> NextVSprite -> PrevVSprite = vs -> PrevVSprite;
60 vs -> PrevVSprite -> NextVSprite = vs -> NextVSprite;
62 /* look for the head of this list of gels */
63 Head = vs;
64 while (NULL != Head -> PrevVSprite )
65 Head = Head -> PrevVSprite;
67 /* take this VSprite out of the DrawPath and ClearPath */
68 Current = Head;
70 while (Current != NULL) {
71 if ((Current -> IntVSprite) && (Current -> IntVSprite -> DrawPath == vs)) {
72 Current -> IntVSprite -> DrawPath = vs -> IntVSprite -> DrawPath;
73 break;
74 } else
75 Current = Current -> NextVSprite;
78 Current = Head;
79 while (Current != NULL) {
80 if (Current -> ClearPath == vs) {
81 Current -> ClearPath = vs -> ClearPath;
82 break;
83 } else
84 Current = Current -> NextVSprite;
88 * Are only the head and the tail VSprite left?
90 if ((Head) && ((!Head->NextVSprite) || (NULL == Head->NextVSprite->NextVSprite))) {
91 _DeleteIntVSprite(Head,GfxBase);
92 if (Head->NextVSprite)
93 _DeleteIntVSprite(Head->NextVSprite,GfxBase);
96 AROS_LIBFUNC_EXIT
98 } /* RemVSprite */