[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash/server sprite_instance.cpp sprite_instance.h
From: |
Zou Lunkai |
Subject: |
[Gnash-commit] gnash/server sprite_instance.cpp sprite_instance.h |
Date: |
Mon, 29 Jan 2007 07:33:14 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Zou Lunkai <zoulunkai> 07/01/29 07:33:14
Modified files:
server : sprite_instance.cpp sprite_instance.h
Log message:
fixed goto_frame_test(bug #18845). the next step is to make testcase
more complicated
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&r1=1.139&r2=1.140
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.h?cvsroot=gnash&r1=1.58&r2=1.59
Patches:
Index: sprite_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.cpp,v
retrieving revision 1.139
retrieving revision 1.140
diff -u -b -r1.139 -r1.140
--- sprite_instance.cpp 26 Jan 2007 13:12:43 -0000 1.139
+++ sprite_instance.cpp 29 Jan 2007 07:33:14 -0000 1.140
@@ -1769,6 +1769,7 @@
m_goto_frame_action_list(),
m_play_state(PLAY),
m_current_frame(0),
+ m_executing_frame(0),
m_update_frame(true),
m_has_looped(false),
m_init_actions_executed(),
@@ -2764,16 +2765,47 @@
// Advance everything in the display list.
m_display_list.advance(delta_time);
- if ( ! m_goto_frame_action_list.empty() )
+ //
+ // executing all target frames actions
+ //
+ while( m_executing_frame != m_current_frame )
{
- IF_VERBOSE_ACTION(
- log_action(" Executing %u actions in "
- "goto_frame_action_list",
- m_goto_frame_action_list.size());
- );
+ //
+ // Construct the DisplayList of the target frame
+ //
+ if ( m_current_frame < m_executing_frame)
+ // go backward to a previous frame
+ {
+ for (size_t f = m_executing_frame; f>m_current_frame;
--f)
+ {
+ execute_frame_tags_reverse(f);
+ }
+ }
+ else if (m_current_frame > m_executing_frame)
+ // go forward to a later frame
+ {
+ for (size_t f = m_executing_frame+1; f<m_current_frame;
++f)
+ {
+ execute_frame_tags(f, true);
+ }
+ }
+ m_action_list.clear();
+
+ // extract the target frame actions
+ execute_frame_tags(m_current_frame, false);
+ // store the target frame actions to m_goto_frame_action_list
+ m_goto_frame_action_list = m_action_list;
+ m_action_list.clear();
+
+ // set the current executing frame to the target frame
+ m_executing_frame = m_current_frame;
+
+ // execute the target frame actions. while executing, the target
+ // frame could be changed again.
execute_actions(m_goto_frame_action_list);
assert(m_goto_frame_action_list.empty());
- }
+ } ;
+
}
// child movieclip advance
@@ -3005,7 +3037,13 @@
m_def->ensure_frame_loaded(target_frame_number);
}
+ m_current_frame = target_frame_number;
+ // ActionGotoFrame tells the movieClip to go to the target frame
+ // and stops at that frame.
+ set_play_state(STOP);
+
+ /*
//
// Construct the DisplayList of the target frame
//
@@ -3069,7 +3107,7 @@
// unfortunately the actions in the current frame have already been
ruined
// by above code.(Zou)
m_action_list.clear();
-
+ */
}
bool sprite_instance::goto_labeled_frame(const char* label)
@@ -3306,11 +3344,15 @@
{
//GNASH_REPORT_FUNCTION;
+ m_executing_frame++;
+ m_current_frame = m_executing_frame;
+
size_t frame_count = m_def->get_frame_count();
- if ( ++m_current_frame >= frame_count )
+ if ( m_current_frame >= frame_count )
{
// Loop.
m_current_frame = 0;
+ m_executing_frame = 0;
m_has_looped = true;
if (frame_count > 1)
{
Index: sprite_instance.h
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.h,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -b -r1.58 -r1.59
--- sprite_instance.h 24 Jan 2007 13:23:18 -0000 1.58
+++ sprite_instance.h 29 Jan 2007 07:33:14 -0000 1.59
@@ -17,7 +17,7 @@
//
//
-/* $Id: sprite_instance.h,v 1.58 2007/01/24 13:23:18 strk Exp $ */
+/* $Id: sprite_instance.h,v 1.59 2007/01/29 07:33:14 zoulunkai Exp $ */
// Stateful live Sprite instance
@@ -628,7 +628,10 @@
ActionList m_goto_frame_action_list;
play_state m_play_state;
+ // the _currentframe property
size_t m_current_frame;
+ // the frame which contains the current executing actions
+ size_t m_executing_frame;
bool m_update_frame;
bool m_has_looped;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash/server sprite_instance.cpp sprite_instance.h,
Zou Lunkai <=