Mercurial > MadButterfly
annotate src/visibility.c @ 1160:1a699dc00fa3
Fix the issue of not removing node in old scene when switching scenes.
- When a timeline is playing and crossing two scenes (tween block),
nodes, for the old scene, in duplicate group must be removed. But,
it is not.
- It is fixed by checking if nodes, in the duplicate group, are also
in the key frame next to the new scene. All nodes that is not in
next key frame are remove.
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Tue, 28 Dec 2010 13:35:34 +0800 |
parents | 586e50f82c1f |
children |
rev | line source |
---|---|
822
586e50f82c1f
Unify coding style tag for emacs and vim.
Shih-Yuan Lee (FourDollars) <fourdollars@gmail.com>
parents:
186
diff
changeset
|
1 // -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- |
586e50f82c1f
Unify coding style tag for emacs and vim.
Shih-Yuan Lee (FourDollars) <fourdollars@gmail.com>
parents:
186
diff
changeset
|
2 // vim: sw=4:ts=8:sts=4 |
116
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
3 #include <stdio.h> |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
4 #include <stdlib.h> |
186
530bb7728546
Move header files to $(top_srcdir)/include/ and prefixed with 'mb_'.
Thinker K.F. Li <thinker@branda.to>
parents:
185
diff
changeset
|
5 #include "mb_animate.h" |
116
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
6 |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
7 typedef struct _mb_visibility mb_visibility_t; |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
8 |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
9 struct _mb_visibility { |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
10 mb_action_t action; |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
11 int visibility; |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
12 coord_t *coord; |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
13 }; |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
14 |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
15 static void mb_visibility_start(mb_action_t *act, |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
16 const mb_timeval_t *now, |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
17 const mb_timeval_t *playing_time, |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
18 redraw_man_t *rdman) { |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
19 mb_visibility_t *visibility = (mb_visibility_t *)act; |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
20 |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
21 switch(visibility->visibility) { |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
22 case VIS_VISIBLE: |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
23 coord_show(visibility->coord); |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
24 break; |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
25 case VIS_HIDDEN: |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
26 coord_hide(visibility->coord); |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
27 break; |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
28 } |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
29 rdman_coord_changed(rdman, visibility->coord); |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
30 } |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
31 |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
32 static void mb_visibility_step(mb_action_t *act, |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
33 const mb_timeval_t *now, |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
34 redraw_man_t *rdman) { |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
35 } |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
36 |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
37 static void mb_visibility_stop(mb_action_t *act, |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
38 const mb_timeval_t *now, |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
39 redraw_man_t *rdman) { |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
40 } |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
41 |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
42 static void mb_visibility_free(mb_action_t *act) { |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
43 free(act); |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
44 } |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
45 |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
46 mb_action_t *mb_visibility_new(int visib, coord_t *coord, |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
47 mb_word_t *word) { |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
48 mb_visibility_t *visibility; |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
49 |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
50 visibility = (mb_visibility_t *)malloc(sizeof(mb_visibility_t)); |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
51 if(visibility == NULL) |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
52 return NULL; |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
53 |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
54 visibility->visibility = visib; |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
55 visibility->coord = coord; |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
56 |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
57 visibility->action.start = mb_visibility_start; |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
58 visibility->action.step = mb_visibility_step; |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
59 visibility->action.stop = mb_visibility_stop; |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
60 visibility->action.free = mb_visibility_free; |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
61 |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
62 mb_word_add_action(word, (mb_action_t *)visibility); |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
63 |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
64 return (mb_action_t *)visibility; |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
65 } |
1d74eb3861b7
move animation actions from animate.c to files.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
66 |