[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/ASSound.cpp server/Actio...
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog server/ASSound.cpp server/Actio... |
Date: |
Wed, 28 Jun 2006 23:27:45 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 06/06/28 23:27:45
Modified files:
. : ChangeLog
server : ASSound.cpp ActionExec.cpp Function.cpp
Global.cpp MovieClipLoader.cpp action.cpp
as_environment.cpp as_environment.h
as_value.cpp as_value.h button.cpp button.h
character.cpp character.h character_def.cpp
character_def.h edit_text_character.cpp
edit_text_character.h
edit_text_character_def.cpp
edit_text_character_def.h generic_character.h
impl.cpp morph2.cpp movie.h movie_def_impl.cpp
movie_interface.h movie_root.cpp movie_root.h
shape_character_def.cpp sprite_definition.cpp
sprite_definition.h sprite_instance.cpp
sprite_instance.h timers.cpp xmlsocket.cpp
server/swf : ASHandlers.cpp
Log message:
Big cleanup aimed at reducing model complexity. Use of the 'movie' has
been drastically reduced, the aim is completely drop it. Every sprite is a
sprite_instance, including the _root movie. We still have a movie_root class
(with a sprite_instance pointer being the _root movie) representing the actual
movie being played.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.437&r2=1.438
http://cvs.savannah.gnu.org/viewcvs/gnash/server/ASSound.cpp?cvsroot=gnash&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/gnash/server/ActionExec.cpp?cvsroot=gnash&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/gnash/server/Function.cpp?cvsroot=gnash&r1=1.21&r2=1.22
http://cvs.savannah.gnu.org/viewcvs/gnash/server/Global.cpp?cvsroot=gnash&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/gnash/server/MovieClipLoader.cpp?cvsroot=gnash&r1=1.23&r2=1.24
http://cvs.savannah.gnu.org/viewcvs/gnash/server/action.cpp?cvsroot=gnash&r1=1.89&r2=1.90
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_environment.cpp?cvsroot=gnash&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_environment.h?cvsroot=gnash&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_value.cpp?cvsroot=gnash&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_value.h?cvsroot=gnash&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/gnash/server/button.cpp?cvsroot=gnash&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/gnash/server/button.h?cvsroot=gnash&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/gnash/server/character.cpp?cvsroot=gnash&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/gnash/server/character.h?cvsroot=gnash&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/gnash/server/character_def.cpp?cvsroot=gnash&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/gnash/server/character_def.h?cvsroot=gnash&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/gnash/server/edit_text_character.cpp?cvsroot=gnash&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/gnash/server/edit_text_character.h?cvsroot=gnash&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/gnash/server/edit_text_character_def.cpp?cvsroot=gnash&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/gnash/server/edit_text_character_def.h?cvsroot=gnash&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/gnash/server/generic_character.h?cvsroot=gnash&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/gnash/server/impl.cpp?cvsroot=gnash&r1=1.44&r2=1.45
http://cvs.savannah.gnu.org/viewcvs/gnash/server/morph2.cpp?cvsroot=gnash&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/gnash/server/movie.h?cvsroot=gnash&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/gnash/server/movie_def_impl.cpp?cvsroot=gnash&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/gnash/server/movie_interface.h?cvsroot=gnash&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/gnash/server/movie_root.cpp?cvsroot=gnash&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/gnash/server/movie_root.h?cvsroot=gnash&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/gnash/server/shape_character_def.cpp?cvsroot=gnash&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_definition.cpp?cvsroot=gnash&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_definition.h?cvsroot=gnash&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.h?cvsroot=gnash&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/gnash/server/timers.cpp?cvsroot=gnash&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/gnash/server/xmlsocket.cpp?cvsroot=gnash&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf/ASHandlers.cpp?cvsroot=gnash&r1=1.16&r2=1.17
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.437
retrieving revision 1.438
diff -u -b -r1.437 -r1.438
--- ChangeLog 28 Jun 2006 17:33:37 -0000 1.437
+++ ChangeLog 28 Jun 2006 23:27:44 -0000 1.438
@@ -1,3 +1,28 @@
+2006-06-29 Sandro Santilli <address@hidden>
+
+ * server/ASSound.cpp, server/ActionExec.cpp, server/Function.cpp,
+ server/Global.cpp, server/MovieClipLoader.cpp, server/action.cpp,
+ server/as_environment.cpp, server/as_environment.h,
+ server/as_value.cpp, server/as_value.h, server/button.cpp,
+ server/button.h, server/character.cpp, server/character.h,
+ server/character_def.cpp, server/character_def.h,
+ server/edit_text_character.cpp, server/edit_text_character.h,
+ server/edit_text_character_def.cpp, server/edit_text_character_def.h,
+ server/generic_character.h, server/impl.cpp, server/morph2.cpp,
+ server/movie.h, server/movie_def_impl.cpp, server/movie_interface.h,
+ server/movie_root.cpp, server/movie_root.h,
+ server/shape_character_def.cpp, server/sprite_definition.cpp,
+ server/sprite_definition.h, server/sprite_instance.cpp,
+ server/sprite_instance.h, server/timers.cpp, server/xmlsocket.cpp,
+ server/swf/ASHandlers.cpp:
+ Big cleanup aimed at reducing model complexity.
+ Use of the 'movie' has been drastically reduced, the aim
+ is completely drop it.
+ Every sprite is a sprite_instance, including the
+ _root movie. We still have a movie_root class
+ (with a sprite_instance pointer being the _root movie)
+ representing the actual movie being played.
+
2006-06-28 Sandro Santilli <address@hidden>
* server/swf/ASHandlers.cpp, server/Function.cpp: updated to work
Index: server/ASSound.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/ASSound.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- server/ASSound.cpp 24 Jun 2006 16:04:06 -0000 1.7
+++ server/ASSound.cpp 28 Jun 2006 23:27:44 -0000 1.8
@@ -23,6 +23,7 @@
#include "log.h"
#include "ASSound.h"
#include "movie_definition.h"
+#include "sprite_instance.h"
#include "fn_call.h"
namespace gnash {
Index: server/ActionExec.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/ActionExec.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- server/ActionExec.cpp 27 Jun 2006 18:45:26 -0000 1.4
+++ server/ActionExec.cpp 28 Jun 2006 23:27:44 -0000 1.5
@@ -115,8 +115,8 @@
}
#endif
- movie* original_target = env.get_target();
- UNUSED(original_target); // Avoid warnings.
+ sprite_instance* original_target = env.get_target();
+ //UNUSED(original_target); // Avoid warnings.
while (pc<stop_pc)
{
Index: server/Function.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/Function.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- server/Function.cpp 28 Jun 2006 17:33:38 -0000 1.21
+++ server/Function.cpp 28 Jun 2006 23:27:44 -0000 1.22
@@ -40,13 +40,14 @@
#include "config.h"
#endif
-#include <typeinfo>
-#include "log.h"
-#include "Function.h"
-#include "array.h"
-#include "gnash.h"
-#include "fn_call.h"
+#include <log.h>
+#include <Function.h>
+#include <array.h>
+#include <gnash.h>
+#include <fn_call.h>
+#include <sprite_instance.cpp>
+#include <typeinfo>
#include <iostream>
using namespace std;
Index: server/Global.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/Global.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- server/Global.cpp 7 Jun 2006 03:03:21 -0000 1.11
+++ server/Global.cpp 28 Jun 2006 23:27:44 -0000 1.12
@@ -50,7 +50,9 @@
#include "textformat.h"
#include "TextSnapshot.h"
#include "Video.h"
-#include "fn_call.h"
+
+#include <fn_call.h>
+#include <sprite_instance.h>
#ifdef HAVE_LIBXML
#include "xml.h"
Index: server/MovieClipLoader.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/MovieClipLoader.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- server/MovieClipLoader.cpp 21 Jun 2006 23:06:41 -0000 1.23
+++ server/MovieClipLoader.cpp 28 Jun 2006 23:27:44 -0000 1.24
@@ -92,14 +92,14 @@
}
void
-MovieClipLoader::load(const tu_string& filespec)
+MovieClipLoader::load(const tu_string& /*filespec*/)
{
log_msg("%s: \n", __FUNCTION__);
}
// progress of the downloaded file(s).
struct mcl *
-MovieClipLoader::getProgress(as_object *ao)
+MovieClipLoader::getProgress(as_object* /*ao*/)
{
//log_msg("%s: \n", __FUNCTION__);
@@ -108,7 +108,7 @@
bool
-MovieClipLoader::loadClip(const tu_string& str, void *)
+MovieClipLoader::loadClip(const tu_string&, void *)
{
log_msg("%s: \n", __FUNCTION__);
@@ -245,7 +245,7 @@
tu_url.c_str(), (void*)target);
// Get a pointer to target's sprite parent (for URL resolution)
- movie* parent = target->get_parent();
+ sprite_instance* parent = target->get_parent();
assert(parent);
//
@@ -436,7 +436,7 @@
}
void
-moviecliploader_onload_init(const fn_call& fn)
+moviecliploader_onload_init(const fn_call& /*fn*/)
{
log_msg("%s: FIXME: Default event handler, you shouldn't be here!\n",
__FUNCTION__);
}
@@ -444,7 +444,7 @@
// Invoked when a call to MovieClipLoader.loadClip() has successfully
// begun to download a file.
void
-moviecliploader_onload_start(const fn_call& fn)
+moviecliploader_onload_start(const fn_call& /*fn*/)
{
log_msg("%s: FIXME: Default event handler, you shouldn't be here!\n",
__FUNCTION__);
}
@@ -551,7 +551,7 @@
// This is the default event handler. To wind up here is an error.
void
-moviecliploader_default(const fn_call& fn)
+moviecliploader_default(const fn_call& /*fn*/)
{
log_msg("%s: FIXME: Default event handler, you shouldn't be here!\n",
__FUNCTION__);
}
Index: server/action.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/action.cpp,v
retrieving revision 1.89
retrieving revision 1.90
diff -u -b -r1.89 -r1.90
--- server/action.cpp 24 Jun 2006 17:56:35 -0000 1.89
+++ server/action.cpp 28 Jun 2006 23:27:44 -0000 1.90
@@ -62,6 +62,7 @@
#include "sound.h"
#include "array.h"
#include "types.h"
+#include "sprite_instance.h"
#ifdef HAVE_LIBXML
#include "xml.h"
@@ -170,7 +171,10 @@
#define EXTERN_MOVIE
#ifdef EXTERN_MOVIE
-void attach_extern_movie(const char* c_url, const movie* target, const movie*
root_movie)
+void
+attach_extern_movie(const char* c_url,
+ const sprite_instance* target,
+ const movie* root_movie)
{
URL url(c_url);
@@ -217,15 +221,17 @@
float ratio = tar->get_ratio();
uint16_t clip_depth = tar->get_clip_depth();
- movie* parent = tar->get_parent();
+ sprite_instance* parent = tar->get_parent();
movie* new_movie = extern_movie->get_root_movie();
assert(parent != NULL);
- ((character*)new_movie)->set_parent(parent);
+ assert(dynamic_cast<sprite_instance*>(new_movie));
+ sprite_instance* newsprite =
static_cast<sprite_instance*>(new_movie);
+ newsprite->set_parent(parent);
parent->replace_display_object(
- (character*) new_movie,
+ newsprite,
name,
depth,
use_cxform,
Index: server/as_environment.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/as_environment.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- server/as_environment.cpp 28 Jun 2006 11:57:37 -0000 1.5
+++ server/as_environment.cpp 28 Jun 2006 23:27:44 -0000 1.6
@@ -39,7 +39,7 @@
#endif
#include "as_environment.h"
-#include "movie.h"
+#include "sprite_instance.h"
#include "as_value.h"
#include "log.h"
#include "with_stack_entry.h"
@@ -54,7 +54,7 @@
as_environment::get_variable(const tu_string& varname, const
std::vector<with_stack_entry>& with_stack) const
{
// Path lookup rigamarole.
- movie* target = m_target;
+ sprite_instance* target = m_target;
tu_string path;
tu_string var;
if (parse_path(varname, &path, &var)) {
@@ -113,7 +113,7 @@
return val;
}
- // Check movie members.
+ // Check sprite_instance members.
if (m_target->get_member(varname, &val)) {
return val;
}
@@ -155,7 +155,7 @@
varname.c_str(), val.to_string());
// Path lookup rigamarole.
- movie* target = m_target;
+ sprite_instance* target = m_target;
tu_string path;
tu_string var;
if (parse_path(varname, &path, &var)) {
@@ -389,13 +389,15 @@
// Find the sprite/movie represented by the given value. The
// value might be a reference to the object itself, or a
// string giving a relative path name to the object.
-movie*
+sprite_instance*
as_environment::find_target(const as_value& val) const
{
if (val.get_type() == as_value::OBJECT)
{
- assert (val.to_object() != NULL);
- return val.to_object()->to_movie();
+ as_object* obj = val.to_object();
+ assert (obj);
+ sprite_instance* s=dynamic_cast<sprite_instance*>(obj);
+ return s; // might be NULL
}
else if (val.get_type() == as_value::STRING)
{
@@ -426,16 +428,17 @@
}
// Find the sprite/movie referenced by the given path.
-movie*
+sprite_instance*
as_environment::find_target(const tu_string& path) const
{
if (path.length() <= 0) {
return m_target;
}
- assert(path.length() > 0);
+ // we'd have returned m_target in this case
+ //assert(path.length() > 0);
- movie* env = m_target;
+ sprite_instance* env = m_target;
assert(env);
const char* p = path.c_str();
@@ -443,7 +446,8 @@
if (*p == '/') {
// Absolute path. Start at the root.
- env = env->get_relative_target("_level0");
+ env = env->get_root_movie();
+ //env = env->get_relative_target("_level0");
p++;
}
@@ -451,7 +455,7 @@
return env;
}
- for (;;) {
+ while (env) {
const char* next_slash = next_slash_or_dot(p);
subpart = p;
if (next_slash == p) {
Index: server/as_environment.h
===================================================================
RCS file: /sources/gnash/gnash/server/as_environment.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- server/as_environment.h 28 Jun 2006 17:33:38 -0000 1.5
+++ server/as_environment.h 28 Jun 2006 23:27:44 -0000 1.6
@@ -58,7 +58,7 @@
namespace gnash {
// Forward declarations
-struct movie;
+struct sprite_instance;
struct with_stack_entry;
/// ActionScript "environment", essentially VM state?
@@ -95,8 +95,8 @@
{
}
- movie* get_target() { return m_target; }
- void set_target(movie* target) { m_target = target; }
+ sprite_instance* get_target() { return m_target; }
+ void set_target(sprite_instance* target) { m_target = target; }
// stack access/manipulation
// @@ TODO do more checking on these
@@ -206,11 +206,8 @@
}
as_value* local_register_ptr(int reg);
- // Internal.
- int find_local(const tu_string& varname) const;
- bool parse_path(const tu_string& var_path, tu_string* path,
tu_string* var) const;
- movie* find_target(const tu_string& path) const;
- movie* find_target(const as_value& val) const;
+ sprite_instance* find_target(const tu_string& path) const;
+ sprite_instance* find_target(const as_value& val) const;
/// Dump content of the stack using the log_msg function
void dump_stack(std::ostream& out=std::cerr)
@@ -225,7 +222,12 @@
private:
/// Movie target. (change to sprite_instance)
- movie* m_target;
+ sprite_instance* m_target;
+
+ int find_local(const tu_string& varname) const;
+
+ bool parse_path(const tu_string& var_path, tu_string* path,
+ tu_string* var) const;
/// Given a variable name, set its value (no support for path)
void set_variable_raw(const tu_string& path, const as_value& val,
Index: server/as_value.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/as_value.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- server/as_value.cpp 20 May 2006 19:39:43 -0000 1.2
+++ server/as_value.cpp 28 Jun 2006 23:27:44 -0000 1.3
@@ -84,7 +84,6 @@
return to_tu_string().c_str();
}
-
const tu_stringi
&as_value::to_tu_stringi() const
{
@@ -92,25 +91,49 @@
}
// Conversion to const tu_string&.
-const tu_string
-&as_value::to_tu_string() const
+const tu_string&
+as_value::to_tu_string() const
{
- if (m_type == STRING) {
+ char buffer[50];
+ const char* val = NULL;
+
+ switch (m_type)
+ {
+
+ case STRING:
/* don't need to do anything */
- } else if (m_type == NUMBER) {
- // @@ Moock says if value is a NAN, then result is "NaN"
+ break;
+
+ case NUMBER:
+ // @@ Moock says if value is a NAN,
+ // then result is "NaN"
// INF goes to "Infinity"
// -INF goes to "-Infinity"
- if (isnan(m_number_value)) m_string_value = "NaN";
- else if (isinf(m_number_value)) {
- if (m_number_value > 0.0) m_string_value = "+Infinity";
- else m_string_value = "-Infinity";
- } else {
+ if (isnan(m_number_value))
+ {
+ m_string_value = "NaN";
+ }
+ else if (isinf(m_number_value))
+ {
+ if (m_number_value > 0.0)
+ {
+ m_string_value = "+Infinity";
+ }
+ else
+ {
+ m_string_value = "-Infinity";
+ }
+ }
+ else
+ {
char buffer[50];
snprintf(buffer, 50, "%.14g", m_number_value);
m_string_value = buffer;
}
- } else if (m_type == UNDEFINED) {
+ break;
+
+ case UNDEFINED:
+
// Behavior depends on file version. In
// version 7+, it's "undefined", in versions
// 6-, it's "".
@@ -119,11 +142,18 @@
// and conditionalize via _versioned()
// functions.
m_string_value = "undefined";
- } else if (m_type == NULLTYPE) {
+
+ break;
+
+ case NULLTYPE:
m_string_value = "null";
- } else if (m_type == BOOLEAN) {
+ break;
+
+ case BOOLEAN:
m_string_value = this->m_boolean_value ? "true" : "false";
- } else if (m_type == OBJECT) {
+ break;
+
+ case OBJECT:
// @@ Moock says, "the value that results from
// calling toString() on the object".
//
@@ -131,34 +161,43 @@
// Object]" but may be customized.
//
// A Movieclip returns the absolute path of the object.
-
- const char* val = NULL;
- if (m_object_value) {
+ //
+ if (m_object_value)
+ {
val = m_object_value->get_text_value();
}
-
- if (val) {
+ if (val)
+ {
m_string_value = val;
- } else {
+ }
+ else
+ {
// Do we have a "toString" method?
//
- // TODO: we need an environment in order to call toString()!
+ // TODO: we need an environment in order to
+ // call toString()!
// This is the default.
//m_string_value = "[object Object]";
- char buffer[50];
- snprintf(buffer, 50, "<as_object %p>", (void *) m_object_value);
+ snprintf(buffer, 50, "<as_object %p>",
+ (void *) m_object_value);
m_string_value = buffer;
}
- } else if (m_type == C_FUNCTION) {
- char buffer[50];
- snprintf(buffer, 50, "<c_function %p>", (void *) m_c_function_value);
+ break;
+
+ case C_FUNCTION:
+ snprintf(buffer, 50, "<c_function %p>",
+ (void *) m_c_function_value);
m_string_value = buffer;
- } else if (m_type == AS_FUNCTION) {
- char buffer[50];
- snprintf(buffer, 50, "<as_function %p>", (void *) m_as_function_value);
+ break;
+
+ case AS_FUNCTION:
+ snprintf(buffer, 50, "<as_function %p>",
+ (void *) m_as_function_value);
m_string_value = buffer;
- } else {
+ break;
+
+ default:
m_string_value = "<bad type> "+m_type;
assert(0);
}
Index: server/as_value.h
===================================================================
RCS file: /sources/gnash/gnash/server/as_value.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- server/as_value.h 25 May 2006 11:39:49 -0000 1.4
+++ server/as_value.h 28 Jun 2006 23:27:44 -0000 1.5
@@ -65,17 +65,35 @@
{
enum type
{
+ /// Undefined value
UNDEFINED,
+
+ /// NULL value
NULLTYPE,
+
+ /// Boolean value
BOOLEAN,
+
+ /// String value
STRING,
+
+ /// Number value
NUMBER,
+
+ /// Object reference
OBJECT,
+
+ /// Internal function pointer
C_FUNCTION,
- AS_FUNCTION // ActionScript function.
+
+ /// ActionScript function reference
+ AS_FUNCTION
};
+
type m_type;
+
mutable tu_string m_string_value;
+
union
{
bool m_boolean_value;
@@ -196,7 +214,6 @@
m_type(C_FUNCTION),
m_c_function_value(func)
{
- m_c_function_value = func;
}
/// Construct an AS_FUNCTION value
@@ -250,7 +267,6 @@
/// or NULL if this is not possible.
as_object* to_object() const;
-
/// \brief
/// Return value as a C function ptr
/// or NULL if it is not a C function.
@@ -296,7 +312,9 @@
drop_refs(); m_type = C_FUNCTION; m_c_function_value = func;
}
void set_function_as_object(function_as_object* func);
+
void set_undefined() { drop_refs(); m_type = UNDEFINED; }
+
void set_null() { drop_refs(); m_type = NULLTYPE; }
void operator=(const as_value& v)
Index: server/button.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/button.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- server/button.cpp 24 Jun 2006 17:56:36 -0000 1.15
+++ server/button.cpp 28 Jun 2006 23:27:44 -0000 1.16
@@ -13,6 +13,7 @@
#include "sound.h"
#include "stream.h"
#include "movie_definition.h"
+#include "sprite_instance.h"
/** \page buttons Buttons and mouse behaviour
@@ -144,8 +145,9 @@
namespace gnash {
- void generate_mouse_button_events(mouse_button_state* ms)
- {
+
+void generate_mouse_button_events(mouse_button_state* ms)
+{
smart_ptr<movie> active_entity = ms->m_active_entity;
smart_ptr<movie> topmost_entity = ms->m_topmost_entity;
@@ -261,11 +263,11 @@
// into the state struct.
ms->m_active_entity = active_entity;
ms->m_topmost_entity = topmost_entity;
- }
+}
- struct button_character_instance : public character
- {
+struct button_character_instance : public character
+{
button_character_definition* m_def;
std::vector< smart_ptr<character> > m_record_character;
@@ -289,7 +291,8 @@
};
e_mouse_state m_mouse_state;
- button_character_instance(button_character_definition* def,
movie* parent, int id)
+ button_character_instance(button_character_definition* def,
+ sprite_instance* parent, int id)
:
character(parent, id),
m_def(def),
@@ -318,7 +321,8 @@
const matrix& mat =
m_def->m_button_records[r].m_button_matrix;
const cxform& cx =
m_def->m_button_records[r].m_button_cxform;
- smart_ptr<character> ch =
bdef->m_character_def->create_character_instance(this, id);
+ //smart_ptr<character> ch =
bdef->m_character_def->create_character_instance(this, id);
+ smart_ptr<character> ch =
bdef->m_character_def->create_character_instance(parent, id);
m_record_character[r] = ch;
ch->set_matrix(mat);
ch->set_cxform(cx);
@@ -331,7 +335,6 @@
}
movie_root* get_root() { return get_parent()->get_root(); }
- movie* get_root_movie() { return
get_parent()->get_root_movie(); }
void restart()
{
@@ -772,7 +775,7 @@
// not sure if we need to override this one.
//virtual const char* get_text_value() const { return NULL; }
// edit_text_character overrides this
- };
+};
//
@@ -990,12 +993,14 @@
}
- character*
button_character_definition::create_character_instance(movie* parent, int id)
- // Create a mutable instance of our definition.
- {
+character*
+button_character_definition::create_character_instance(
+ sprite_instance* parent, int id)
+{
character* ch = new button_character_instance(this,
parent, id);
return ch;
- }
+}
+
};
Index: server/button.h
===================================================================
RCS file: /sources/gnash/gnash/server/button.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- server/button.h 8 May 2006 21:12:24 -0000 1.6
+++ server/button.h 28 Jun 2006 23:27:44 -0000 1.7
@@ -10,17 +10,23 @@
#define GNASH_BUTTON_H
-#include "impl.h"
+#include "impl.h" // should get rid of this
#include "character_def.h"
#include "sound.h"
+// Forward declarations
namespace gnash {
- //
- // Helper to generate mouse events, given mouse state & history.
- //
+ class sprite_instance;
+}
- struct mouse_button_state
- {
+namespace gnash {
+
+//
+// Helper to generate mouse events, given mouse state & history.
+//
+
+struct mouse_button_state
+{
weak_ptr<movie> m_active_entity; // entity that
currently owns the mouse pointer
weak_ptr<movie> m_topmost_entity; // what's underneath
the mouse right now
@@ -36,23 +42,23 @@
m_mouse_inside_entity_last(false)
{
}
- };
+};
- void generate_mouse_button_events(mouse_button_state* ms);
+void generate_mouse_button_events(mouse_button_state* ms);
- //
- // button characters
- //
- enum mouse_state
- {
+//
+// button characters
+//
+enum mouse_state
+{
MOUSE_UP,
MOUSE_DOWN,
MOUSE_OVER
- };
+};
- struct button_record
- {
+struct button_record
+{
bool m_hit_test;
bool m_down;
bool m_over;
@@ -64,11 +70,11 @@
cxform m_button_cxform;
bool read(stream* in, int tag_type, movie_definition* m);
- };
+};
- struct button_action
- {
+struct button_action
+{
enum condition
{
IDLE_TO_OVER_UP = 1 << 0,
@@ -86,11 +92,11 @@
~button_action();
void read(stream* in, int tag_type);
- };
+};
- struct button_character_definition : public character_def
- {
+struct button_character_definition : public character_def
+{
struct sound_envelope
{
uint32_t m_mark44;
@@ -136,9 +142,11 @@
button_character_definition();
virtual ~button_character_definition();
- character* create_character_instance(movie* parent, int
id);
+ /// Create a mutable instance of our definition.
+ character* create_character_instance(sprite_instance* parent, int id);
+
void read(stream* in, int tag_type, movie_definition* m);
- };
+};
}; // end namespace gnash
Index: server/character.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/character.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- server/character.cpp 8 May 2006 13:59:07 -0000 1.1
+++ server/character.cpp 28 Jun 2006 23:27:44 -0000 1.2
@@ -41,6 +41,7 @@
#endif
#include <character.h>
+#include <sprite_instance.h>
namespace gnash
{
@@ -95,8 +96,53 @@
}
}
+matrix
+character::get_world_matrix() const
+{
+ matrix m;
+ if (m_parent)
+ {
+ m = m_parent->get_world_matrix();
+ }
+ m.concatenate(get_matrix());
+
+ return m;
+}
+
+cxform
+character::get_world_cxform() const
+{
+ cxform m;
+ if (m_parent)
+ {
+ m = m_parent->get_world_cxform();
+ }
+ m.concatenate(get_cxform());
+
+ return m;
}
+void
+character::get_drag_state(drag_state* st)
+{
+ assert(m_parent);
+ m_parent->get_drag_state(st);
+}
+
+sprite_instance*
+character::get_root_movie()
+{
+ return m_parent->get_root_movie();
+}
+
+void
+character::get_mouse_state(int* x, int* y, int* buttons)
+{
+ get_parent()->get_mouse_state(x, y, buttons);
+}
+
+} // namespace gnash
+
// Local Variables:
// mode: C++
// indent-tabs-mode: t
Index: server/character.h
===================================================================
RCS file: /sources/gnash/gnash/server/character.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- server/character.h 24 Jun 2006 17:56:36 -0000 1.4
+++ server/character.h 28 Jun 2006 23:27:44 -0000 1.5
@@ -49,11 +49,16 @@
#include "log.h"
#include "container.h"
#include "utility.h"
-#include "movie.h" // for inheritance
+#include "movie.h" // for inheritance (must drop)
#include <cstdarg>
#include <cassert>
+// Forward declarations
+namespace gnash {
+ class sprite_instance;
+}
+
namespace gnash {
/// Character is a live, stateful instance of a character_def.
@@ -80,14 +85,14 @@
bool m_visible;
- movie* m_parent;
+ sprite_instance* m_parent;
/// Implement mouse-dragging for this movie.
void do_mouse_drag();
public:
- character(movie* parent, int id)
+ character(sprite_instance* parent, int id)
:
m_id(id),
m_depth(-1),
@@ -106,8 +111,9 @@
// Accessors for basic display info.
int get_id() const { return m_id; }
- movie* get_parent() const { return m_parent; }
- void set_parent(movie* parent) { m_parent = parent; } // for extern
movie
+ sprite_instance* get_parent() const { return m_parent; }
+ // for extern movie
+ void set_parent(sprite_instance* parent) { m_parent = parent; }
int get_depth() const { return m_depth; }
void set_depth(int d) { m_depth = d; }
const matrix& get_matrix() const { return m_matrix; }
@@ -134,33 +140,20 @@
virtual const char* get_text_name() const { return ""; }
virtual void set_text_value(const char* /*new_text*/) { assert(0); }
- virtual matrix get_world_matrix() const
- // Get our concatenated matrix (all our ancestor transforms, times our
matrix). Maps
- // from our local space into "world" space (i.e. root movie space).
- {
- matrix m;
- if (m_parent)
- {
- m = m_parent->get_world_matrix();
- }
- m.concatenate(get_matrix());
-
- return m;
- }
-
- virtual cxform get_world_cxform() const
- // Get our concatenated color transform (all our ancestor transforms,
- // times our cxform). Maps from our local space into normal color
space.
- {
- cxform m;
- if (m_parent)
- {
- m = m_parent->get_world_cxform();
- }
- m.concatenate(get_cxform());
-
- return m;
- }
+ /// \brief
+ /// Get our concatenated matrix (all our ancestor transforms,
+ /// times our matrix).
+ ///
+ /// Maps from our local space into "world" space
+ /// (i.e. root movie space).
+ virtual matrix get_world_matrix() const;
+
+ /// \brief
+ /// Get our concatenated color transform (all our ancestor transforms,
+ /// times our cxform).
+ ///
+ /// Maps from our local space into normal color space.
+ virtual cxform get_world_cxform() const;
// Event handler accessors.
bool get_event_handler(event_id id, as_value* result)
@@ -184,7 +177,7 @@
virtual float get_height() { return 0; }
virtual float get_width() { return 0; }
- virtual movie* get_root_movie() { return m_parent->get_root_movie(); }
+ virtual sprite_instance* get_root_movie();
virtual int get_current_frame() const { assert(0); return 0; }
virtual bool has_looped() const { assert(0); return false; }
virtual void restart() { /*assert(0);*/ }
@@ -198,11 +191,7 @@
virtual bool get_accept_anim_moves() const { return true; }
- virtual void get_drag_state(drag_state* st)
- {
- assert(m_parent);
- m_parent->get_drag_state(st);
- }
+ virtual void get_drag_state(drag_state* st);
virtual void set_visible(bool visible) { m_visible = visible; }
virtual bool get_visible() const { return m_visible; }
@@ -223,7 +212,7 @@
}
}
- virtual void get_mouse_state(int* x, int* y, int* buttons) {
get_parent()->get_mouse_state(x, y, buttons); }
+ virtual void get_mouse_state(int* x, int* y, int* buttons);
};
Index: server/character_def.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/character_def.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- server/character_def.cpp 28 Jun 2006 01:00:04 -0000 1.1
+++ server/character_def.cpp 28 Jun 2006 23:27:44 -0000 1.2
@@ -47,7 +47,7 @@
{
character*
-character_def::create_character_instance(movie* parent, int id)
+character_def::create_character_instance(sprite_instance* parent, int id)
{
return new generic_character(this, parent, id);
}
Index: server/character_def.h
===================================================================
RCS file: /sources/gnash/gnash/server/character_def.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- server/character_def.h 28 Jun 2006 01:00:04 -0000 1.4
+++ server/character_def.h 28 Jun 2006 23:27:44 -0000 1.5
@@ -49,6 +49,7 @@
namespace gnash {
class character;
class cache_options;
+ class sprite_instance;
};
namespace gnash {
@@ -96,7 +97,8 @@
//
/// default is to make a generic_character
///
- virtual character* create_character_instance(movie* parent, int id);
+ virtual character* create_character_instance(sprite_instance* parent,
+ int id);
// From resource interface.
virtual character_def* cast_to_character_def()
Index: server/edit_text_character.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/edit_text_character.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- server/edit_text_character.cpp 15 Jun 2006 21:38:51 -0000 1.3
+++ server/edit_text_character.cpp 28 Jun 2006 23:27:44 -0000 1.4
@@ -7,6 +7,7 @@
#include "log.h"
#include "render.h"
#include "movie_definition.h" // to extract version info
+#include "sprite_instance.h"
#include "edit_text_character.h"
@@ -14,7 +15,7 @@
namespace gnash {
-edit_text_character::edit_text_character(movie* parent,
+edit_text_character::edit_text_character(sprite_instance* parent,
edit_text_character_def* def, int id)
:
character(parent, id),
Index: server/edit_text_character.h
===================================================================
RCS file: /sources/gnash/gnash/server/edit_text_character.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- server/edit_text_character.h 15 Jun 2006 21:38:51 -0000 1.3
+++ server/edit_text_character.h 28 Jun 2006 23:27:44 -0000 1.4
@@ -45,11 +45,15 @@
#include "styles.h" // for fill_style and line_style
#include "text.h" // for text_glyph_record
-namespace gnash {
// Forward declarations
-struct text_character_def;
-struct text_glyph_record;
+namespace gnash {
+ struct text_character_def;
+ struct text_glyph_record;
+ class sprite_instance;
+}
+
+namespace gnash {
/// An instance of an edit_text_character_def
struct edit_text_character : public character
@@ -57,7 +61,9 @@
public:
- edit_text_character(movie* parent, edit_text_character_def* def,
+ edit_text_character(
+ sprite_instance* parent,
+ edit_text_character_def* def,
int id);
~edit_text_character()
Index: server/edit_text_character_def.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/edit_text_character_def.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- server/edit_text_character_def.cpp 7 Jun 2006 03:03:21 -0000 1.5
+++ server/edit_text_character_def.cpp 28 Jun 2006 23:27:44 -0000 1.6
@@ -112,7 +112,8 @@
}
character*
-edit_text_character_def::create_character_instance(movie* parent, int id)
+edit_text_character_def::create_character_instance(sprite_instance* parent,
+ int id)
{
// Resolve the font, if possible
get_font();
Index: server/edit_text_character_def.h
===================================================================
RCS file: /sources/gnash/gnash/server/edit_text_character_def.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- server/edit_text_character_def.h 15 Jun 2006 23:43:18 -0000 1.5
+++ server/edit_text_character_def.h 28 Jun 2006 23:27:44 -0000 1.6
@@ -113,7 +113,7 @@
float height() const { return m_rect.height(); }
/// Create an instance of this character
- character* create_character_instance(movie* parent, int id);
+ character* create_character_instance(sprite_instance* parent, int id);
/// Initialize from SWF input stream (tag 37)
void read(stream* in, int tag_type, movie_definition* m);
Index: server/generic_character.h
===================================================================
RCS file: /sources/gnash/gnash/server/generic_character.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- server/generic_character.h 25 May 2006 11:49:57 -0000 1.3
+++ server/generic_character.h 28 Jun 2006 23:27:44 -0000 1.4
@@ -62,7 +62,7 @@
public:
- generic_character(character_def* def, movie* parent, int id)
+ generic_character(character_def* def, sprite_instance* parent, int id)
:
character(parent, id),
m_def(def)
Index: server/impl.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/impl.cpp,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -b -r1.44 -r1.45
--- server/impl.cpp 28 Jun 2006 01:00:04 -0000 1.44
+++ server/impl.cpp 28 Jun 2006 23:27:44 -0000 1.45
@@ -77,6 +77,7 @@
#include "generic_character.h"
#include "URL.h"
#include "StreamProvider.h"
+#include "sprite_instance.h"
#include <string>
#include <map>
@@ -612,7 +613,7 @@
for (unsigned int i = 0; i < s_extern_sprites.size(); i++)
{
movie_interface* root_m = s_extern_sprites[i];
- movie* m = root_m->get_root_movie();
+ sprite_instance* m = root_m->get_root_movie();
if (m->get_ref_count() < 2)
{
Index: server/morph2.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/morph2.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- server/morph2.cpp 7 Jun 2006 03:03:21 -0000 1.12
+++ server/morph2.cpp 28 Jun 2006 23:27:44 -0000 1.13
@@ -10,6 +10,7 @@
#include "stream.h"
#include "movie_definition.h"
#include "bitmap_character_def.h"
+#include "sprite_instance.h"
namespace gnash {
Index: server/movie.h
===================================================================
RCS file: /sources/gnash/gnash/server/movie.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- server/movie.h 24 Jun 2006 17:56:36 -0000 1.10
+++ server/movie.h 28 Jun 2006 23:27:44 -0000 1.11
@@ -61,7 +61,8 @@
class movie_root;
struct swf_event;
-/// @@@ another one ???
+/// \brief
+/// @@@ To be obsoleted. This class is only confusing.
struct movie : public movie_interface
{
virtual void set_extern_movie(movie_interface* /* m */)
@@ -88,7 +89,7 @@
return NULL;
}
- virtual movie *get_root_movie()
+ virtual sprite_instance *get_root_movie()
{
return NULL;
}
@@ -340,11 +341,13 @@
//
+#if 0
virtual movie* get_relative_target(const tu_string& /* name */)
{
assert(0);
return NULL;
}
+#endif
/// ActionScript event handler. Returns true if a handler was called.
//
@@ -388,6 +391,7 @@
// on_event(event_id::LOAD);
// }
+#if 0
// as_object_interface stuff
virtual void set_member(
const tu_stringi& /* name */,
@@ -403,6 +407,7 @@
assert(0);
return false;
}
+#endif
virtual void call_frame_actions(const as_value& /* frame_spec */)
Index: server/movie_def_impl.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/movie_def_impl.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- server/movie_def_impl.cpp 24 Jun 2006 15:27:33 -0000 1.11
+++ server/movie_def_impl.cpp 28 Jun 2006 23:27:44 -0000 1.12
@@ -57,6 +57,7 @@
#include "smart_ptr.h"
#include "swf/TagLoadersTable.h"
#include "execute_tag.h"
+#include "movie_root.h"
using namespace std;
Index: server/movie_interface.h
===================================================================
RCS file: /sources/gnash/gnash/server/movie_interface.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- server/movie_interface.h 8 May 2006 11:43:58 -0000 1.2
+++ server/movie_interface.h 28 Jun 2006 23:27:44 -0000 1.3
@@ -58,6 +58,8 @@
namespace gnash {
+class sprite_instance;
+
/// An independent stateful live movie. (should be movie_instance?)
//
/// This is the client program's interface to an instance of a
@@ -185,7 +187,7 @@
virtual void clear_interval_timer(int x) = 0;
/// for external movies
- virtual movie* get_root_movie() = 0;
+ virtual sprite_instance* get_root_movie() = 0;
};
} // namespace gnash
Index: server/movie_root.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/movie_root.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- server/movie_root.cpp 15 Jun 2006 11:21:29 -0000 1.5
+++ server/movie_root.cpp 28 Jun 2006 23:27:44 -0000 1.6
@@ -92,7 +92,7 @@
void
-movie_root::set_root_movie(movie* root_movie)
+movie_root::set_root_movie(sprite_instance* root_movie)
{
m_movie = root_movie;
assert(m_movie != NULL);
Index: server/movie_root.h
===================================================================
RCS file: /sources/gnash/gnash/server/movie_root.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- server/movie_root.h 24 Jun 2006 17:56:36 -0000 1.4
+++ server/movie_root.h 28 Jun 2006 23:27:44 -0000 1.5
@@ -46,6 +46,7 @@
#include "jpeg.h"
#include "tu_file.h"
#include "movie_def_impl.h"
+#include "sprite_instance.h" // for inlines
namespace gnash
{
@@ -58,7 +59,7 @@
/// Global, shared root state for a movie and all its characters.
-class movie_root : public movie_interface
+class movie_root : public movie_interface // inheritance should be dropped
{
smart_ptr<movie_def_impl> m_def;
int m_viewport_x0, m_viewport_y0;
@@ -81,7 +82,7 @@
public:
// XXXbastiaan: make these two variables private
- smart_ptr<movie> m_movie;
+ smart_ptr<sprite_instance> m_movie;
/// @@ fold this into m_mouse_button_state?
movie::drag_state m_drag_state;
@@ -105,7 +106,7 @@
/// @@ should this return m_movie.get_ptr()?
virtual movie* to_movie() { assert(0); return 0; }
- void set_root_movie(movie* root_movie);
+ void set_root_movie(sprite_instance* root_movie);
void set_display_viewport(int x0, int y0, int w, int h);
@@ -117,7 +118,7 @@
/// notify_mouse_state(). Coordinates are in PIXELS, NOT TWIPS.
virtual void get_mouse_state(int* x, int* y, int* buttons);
- movie* get_root_movie() { return m_movie.get_ptr(); }
+ sprite_instance* get_root_movie() { return m_movie.get_ptr(); }
void stop_drag() { m_drag_state.m_character = NULL; }
Index: server/shape_character_def.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/shape_character_def.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- server/shape_character_def.cpp 7 Jun 2006 03:03:21 -0000 1.2
+++ server/shape_character_def.cpp 28 Jun 2006 23:27:44 -0000 1.3
@@ -16,6 +16,7 @@
#include "tesselate.h"
#include "movie_definition.h" // TODO: check if really needed
//#include "bitmap_character_def.h"
+#include "sprite_instance.h"
#include "tu_file.h"
Index: server/sprite_definition.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_definition.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- server/sprite_definition.cpp 7 Jun 2006 03:03:21 -0000 1.6
+++ server/sprite_definition.cpp 28 Jun 2006 23:27:44 -0000 1.7
@@ -59,7 +59,7 @@
namespace gnash {
character*
-sprite_definition::create_character_instance(movie* parent,
+sprite_definition::create_character_instance(sprite_instance* parent,
int id)
{
sprite_instance* si = new sprite_instance(this,
Index: server/sprite_definition.h
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_definition.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- server/sprite_definition.h 24 Jun 2006 17:56:36 -0000 1.8
+++ server/sprite_definition.h 28 Jun 2006 23:27:44 -0000 1.9
@@ -239,7 +239,7 @@
//
// overloads from character_def
virtual character* create_character_instance(
- movie* parent, int id);
+ sprite_instance* parent, int id);
virtual void add_execute_tag(execute_tag* c)
Index: server/sprite_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- server/sprite_instance.cpp 21 Jun 2006 23:06:41 -0000 1.12
+++ server/sprite_instance.cpp 28 Jun 2006 23:27:44 -0000 1.13
@@ -63,6 +63,7 @@
#include "fn_call.h"
#include "tu_random.h"
#include "Key.h"
+#include "movie_root.h"
using namespace std;
@@ -86,10 +87,11 @@
static void sprite_play(const fn_call& fn)
{
- sprite_instance* sprite = (sprite_instance*) fn.this_ptr;
+ assert(dynamic_cast<sprite_instance*>(fn.this_ptr));
+ sprite_instance* sprite = static_cast<sprite_instance*>(fn.this_ptr);
if (sprite == NULL)
{
- sprite = (sprite_instance*) fn.env->get_target();
+ sprite = fn.env->get_target();
}
assert(sprite);
sprite->set_play_state(movie_interface::PLAY);
@@ -97,10 +99,11 @@
static void sprite_stop(const fn_call& fn)
{
- sprite_instance* sprite = (sprite_instance*) fn.this_ptr;
+ assert(dynamic_cast<sprite_instance*>(fn.this_ptr));
+ sprite_instance* sprite = static_cast<sprite_instance*>(fn.this_ptr);
if (sprite == NULL)
{
- sprite = (sprite_instance*) fn.env->get_target();
+ sprite = fn.env->get_target();
}
assert(sprite);
sprite->set_play_state(movie_interface::STOP);
@@ -108,10 +111,11 @@
static void sprite_goto_and_play(const fn_call& fn)
{
- sprite_instance* sprite = (sprite_instance*) fn.this_ptr;
+ assert(dynamic_cast<sprite_instance*>(fn.this_ptr));
+ sprite_instance* sprite = static_cast<sprite_instance*>(fn.this_ptr);
if (sprite == NULL)
{
- sprite = (sprite_instance*) fn.env->get_target();
+ sprite = fn.env->get_target();
}
assert(sprite);
@@ -121,7 +125,8 @@
return;
}
- int target_frame = int(fn.arg(0).to_number() - 1); // Convert to
0-based
+ // Convert to 0-based
+ int target_frame = int(fn.arg(0).to_number() - 1);
sprite->goto_frame(target_frame);
sprite->set_play_state(movie_interface::PLAY);
@@ -129,10 +134,11 @@
static void sprite_goto_and_stop(const fn_call& fn)
{
- sprite_instance* sprite = (sprite_instance*) fn.this_ptr;
+ assert(dynamic_cast<sprite_instance*>(fn.this_ptr));
+ sprite_instance* sprite = static_cast<sprite_instance*>(fn.this_ptr);
if (sprite == NULL)
{
- sprite = (sprite_instance*) fn.env->get_target();
+ sprite = fn.env->get_target();
}
assert(sprite);
@@ -142,7 +148,8 @@
return;
}
- int target_frame = int(fn.arg(0).to_number() - 1); // Convert to
0-based
+ // Convert to 0-based
+ int target_frame = int(fn.arg(0).to_number() - 1);
sprite->goto_frame(target_frame);
sprite->set_play_state(movie_interface::STOP);
@@ -150,10 +157,11 @@
static void sprite_next_frame(const fn_call& fn)
{
- sprite_instance* sprite = (sprite_instance*) fn.this_ptr;
+ assert(dynamic_cast<sprite_instance*>(fn.this_ptr));
+ sprite_instance* sprite = static_cast<sprite_instance*>(fn.this_ptr);
if (sprite == NULL)
{
- sprite = (sprite_instance*) fn.env->get_target();
+ sprite = fn.env->get_target();
}
assert(sprite);
@@ -168,10 +176,11 @@
static void sprite_prev_frame(const fn_call& fn)
{
- sprite_instance* sprite = (sprite_instance*) fn.this_ptr;
+ assert(dynamic_cast<sprite_instance*>(fn.this_ptr));
+ sprite_instance* sprite = static_cast<sprite_instance*>(fn.this_ptr);
if (sprite == NULL)
{
- sprite = (sprite_instance*) fn.env->get_target();
+ sprite = fn.env->get_target();
}
assert(sprite);
@@ -185,10 +194,11 @@
static void sprite_get_bytes_loaded(const fn_call& fn)
{
- sprite_instance* sprite = (sprite_instance*) fn.this_ptr;
+ assert(dynamic_cast<sprite_instance*>(fn.this_ptr));
+ sprite_instance* sprite = static_cast<sprite_instance*>(fn.this_ptr);
if (sprite == NULL)
{
- sprite = (sprite_instance*) fn.env->get_target();
+ sprite = fn.env->get_target();
}
assert(sprite);
@@ -197,10 +207,11 @@
static void sprite_get_bytes_total(const fn_call& fn)
{
- sprite_instance* sprite = (sprite_instance*) fn.this_ptr;
+ assert(dynamic_cast<sprite_instance*>(fn.this_ptr));
+ sprite_instance* sprite = static_cast<sprite_instance*>(fn.this_ptr);
if (sprite == NULL)
{
- sprite = (sprite_instance*) fn.env->get_target();
+ sprite = fn.env->get_target();
}
assert(sprite);
@@ -229,7 +240,6 @@
(void*)fn.this_ptr, (void*)fn.env->get_target());
}
- //sprite_instance* sprite = (sprite_instance*)target;
sprite_instance* sprite = dynamic_cast<sprite_instance*>(target);
assert(sprite);
@@ -354,7 +364,7 @@
sprite_instance::sprite_instance(
movie_definition* def, movie_root* r,
- movie* parent, int id)
+ sprite_instance* parent, int id)
:
character(parent, id),
m_mouse_state(UP),
@@ -790,7 +800,7 @@
}
}
-#if 0
+#if 1
void sprite_instance::remove_display_object(const tu_string& name)
{
// GNASH_REPORT_FUNCTION;
@@ -845,7 +855,8 @@
return called;
}
-movie* sprite_instance::get_relative_target(const tu_string& name)
+sprite_instance*
+sprite_instance::get_relative_target(const tu_string& name)
{
if (name == "." || name == "this")
{
@@ -858,11 +869,18 @@
else if (name == "_level0"
|| name == "_root")
{
- return m_root->m_movie.get_ptr();
+ log_error("Must complete refactoring of movie classes");
+ //we must return the _root movie as a sprite_instance
+ return get_root_movie();
+ //return m_root->m_movie.get_ptr();
}
// See if we have a match on the display list.
- return m_display_list.get_character_by_name(name);
+ character* ch = m_display_list.get_character_by_name(name);
+ if ( ch )
+ {
+ return dynamic_cast<sprite_instance*>(ch);
+ }
}
void sprite_instance::set_member(const tu_stringi& name,
@@ -1833,4 +1851,71 @@
return NULL;
}
+float
+sprite_instance::get_timer() const
+{
+ return m_root->get_timer();
+}
+
+void
+sprite_instance::clear_interval_timer(int x)
+{
+ m_root->clear_interval_timer(x);
+}
+
+int
+sprite_instance::add_interval_timer(void *timer)
+{
+ return m_root->add_interval_timer(timer);
+}
+
+sprite_instance*
+sprite_instance::get_root_movie()
+{
+ return m_root->get_root_movie();
+}
+
+float
+sprite_instance::get_pixel_scale() const
+{
+ return m_root->get_pixel_scale();
+}
+
+void
+sprite_instance::get_mouse_state(int* x, int* y, int* buttons)
+{
+ m_root->get_mouse_state(x, y, buttons);
+}
+
+void
+sprite_instance::get_drag_state(drag_state* st)
+{
+ *st = m_root->m_drag_state;
+}
+
+void
+sprite_instance::stop_drag()
+{
+ assert(m_parent == NULL); // we must be the root movie!!!
+ m_root->stop_drag();
+}
+
+void
+sprite_instance::set_drag_state(const drag_state& st)
+{
+ m_root->m_drag_state = st;
+}
+
+float
+sprite_instance::get_background_alpha() const
+{
+ // @@ this doesn't seem right...
+ return m_root->get_background_alpha();
+}
+
+void
+sprite_instance::set_background_color(const rgba& color)
+{
+ m_root->set_background_color(color);
+}
} // namespace gnash
Index: server/sprite_instance.h
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- server/sprite_instance.h 21 Jun 2006 23:06:41 -0000 1.8
+++ server/sprite_instance.h 28 Jun 2006 23:27:44 -0000 1.9
@@ -48,17 +48,18 @@
#include <vector>
#include "movie_definition.h"
-#include "movie_root.h"
#include "dlist.h" // DisplayList
#include "stream.h"
#include "log.h"
#include "as_environment.h" // for composition
+// Forward declarations
+namespace gnash {
+ class movie_root;
+}
+
namespace gnash
{
- // Forward declarations
- //struct sprite_instance;
- //struct sprite_definition;
/// Stateful Sprite object. Also known as a MovieClip.
class sprite_instance : public character
@@ -67,7 +68,7 @@
public:
sprite_instance(movie_definition* def,
- movie_root* r, movie* parent, int id);
+ movie_root* r, sprite_instance* parent, int id);
virtual ~sprite_instance();
@@ -82,31 +83,28 @@
virtual void has_keypress_event();
// sprite instance of add_interval_handler()
- virtual int add_interval_timer(void *timer)
- {
- return m_root->add_interval_timer(timer);
- }
+ // delegates to m_root
+ virtual int add_interval_timer(void *timer);
- virtual void clear_interval_timer(int x)
- {
- m_root->clear_interval_timer(x);
- }
+ // delegates to m_root
+ virtual void clear_interval_timer(int x);
/// Interval timer timeout executor
virtual void do_something(void *timer);
+#if 0
movie_interface* get_root_interface() {
return m_root;
}
+#endif
movie_root* get_root() {
return m_root;
}
- movie* get_root_movie() {
- return m_root->get_root_movie();
- }
+ /// Get a pointer to the root sprite
+ sprite_instance* get_root_movie();
movie_definition* get_movie_definition() {
return m_def.get_ptr();
@@ -137,28 +135,18 @@
character* get_character(int character_id);
- float get_background_alpha() const
- {
- // @@ this doesn't seem right...
- return m_root->get_background_alpha();
- }
+ float get_background_alpha() const;
- float get_pixel_scale() const
- {
- return m_root->get_pixel_scale();
- }
+ // delegates to m_root
+ float get_pixel_scale() const;
- virtual void get_mouse_state(int* x, int* y, int* buttons)
- {
- m_root->get_mouse_state(x, y, buttons);
- }
+ // delegates to m_root
+ virtual void get_mouse_state(int* x, int* y, int* buttons);
- void set_background_color(const rgba& color)
- {
- m_root->set_background_color(color);
- }
+ // delegatest to m_root
+ void set_background_color(const rgba& color);
- float get_timer() const { return m_root->get_timer(); }
+ float get_timer() const;
void restart();
@@ -369,7 +357,7 @@
///
/// In ActionScript 1.0, everything seems to be CASE
/// INSENSITIVE.
- virtual movie* get_relative_target(const tu_string& name);
+ virtual sprite_instance* get_relative_target(const tu_string& name);
/// Execute the actions for the specified frame.
@@ -378,22 +366,13 @@
///
virtual void call_frame_actions(const as_value& frame_spec);
+ // delegatest to m_root
+ virtual void set_drag_state(const drag_state& st);
- virtual void set_drag_state(const drag_state& st) {
- m_root->m_drag_state = st;
- }
-
- virtual void stop_drag() {
- assert(m_parent == NULL); // we must be the root movie!!!
-
- m_root->stop_drag();
- }
+ virtual void stop_drag();
- /* sprite_instance */
- virtual void get_drag_state(drag_state* st)
- {
- *st = m_root->m_drag_state;
- }
+ // delegates to m_root
+ virtual void get_drag_state(drag_state* st);
/// Duplicate the object with the specified name
@@ -405,7 +384,7 @@
//
/// @@ what happens if the we have multiple objects
/// with the same name ?
- //void remove_display_object(const tu_string& name);
+ void remove_display_object(const tu_string& name);
/// Dispatch event handler(s), if any.
virtual bool on_event(event_id id);
Index: server/timers.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/timers.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- server/timers.cpp 21 Jun 2006 23:06:41 -0000 1.9
+++ server/timers.cpp 28 Jun 2006 23:27:44 -0000 1.10
@@ -42,6 +42,7 @@
//#include "impl.h"
#include "log.h"
#include "smart_ptr.h"
+#include "sprite_instance.h"
#include "fn_call.h"
Index: server/xmlsocket.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/xmlsocket.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- server/xmlsocket.cpp 21 Jun 2006 23:06:41 -0000 1.16
+++ server/xmlsocket.cpp 28 Jun 2006 23:27:44 -0000 1.17
@@ -47,6 +47,7 @@
#include "timers.h"
#include "Function.h"
#include "fn_call.h"
+#include "sprite_instance.h"
#ifdef HAVE_LIBXML
Index: server/swf/ASHandlers.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/swf/ASHandlers.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- server/swf/ASHandlers.cpp 28 Jun 2006 17:33:38 -0000 1.16
+++ server/swf/ASHandlers.cpp 28 Jun 2006 23:27:45 -0000 1.17
@@ -47,6 +47,8 @@
#include "tu_random.h"
#include "fn_call.h"
#include "ActionExec.h"
+#include "sprite_instance.h"
+#include "as_environment.h"
#include <string>
#include <map>
@@ -562,7 +564,7 @@
command += url;
command += ")\"";
dbglogfile << "Launching URL... " << command << endl;
-// movie *target = env.get_target();
+// sprite_instance *target = env.get_target();
// target->get_url(url);
system(command.c_str());
// }
@@ -584,11 +586,14 @@
// log_error("get url: target=%s, url=%s\n", target, url);
tu_string tu_target = target;
- movie* target_movie = env.find_target(tu_target);
- if (target_movie != NULL) {
- movie *root_movie = env.get_target()->get_root_movie();
+ sprite_instance* target_movie = env.find_target(tu_target);
+ if (target_movie != NULL)
+ {
+ sprite_instance* root_movie =
env.get_target()->get_root_movie();
attach_extern_movie(url, target_movie, root_movie);
- } else {
+ }
+ else
+ {
log_error("get url: target %s not found\n", target);
}
#endif // EXTERN_MOVIE
@@ -626,7 +631,7 @@
// Change the movie we're working on.
const char* target_name = code.read_string(pc+3);
- movie *new_target;
+ sprite_instance *new_target;
// if the string is blank, we set target to the root movie
// TODO - double check this is correct?
@@ -659,7 +664,7 @@
const action_buffer& code = thread.code;
const char* frame_label = code.read_string(thread.pc+3);
- movie *target = env.get_target();
+ sprite_instance *target = env.get_target();
target->goto_labeled_frame(frame_label);
}
@@ -836,7 +841,12 @@
SWFHandlers::ActionSetVariable(ActionExec& thread)
{
// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
+
+ // stack must be contain at least two items
+ assert ( env.stack_size() > 1 );
+
env.set_variable(env.top(1).to_tu_string(), env.top(0));
log_action("\n-- set var: %s", env.top(1).to_string());
@@ -847,24 +857,33 @@
SWFHandlers::ActionSetTargetExpression(ActionExec& thread)
{
// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
+
const char * target_name = env.top(0).to_string();
env.drop(1); // pop the target name off the stack
- movie *new_target;
+ sprite_instance *new_target;
// if the string is blank, we set target to the root movie
// TODO - double check this is correct?
- if (target_name[0] == '\0') {
+ if (target_name[0] == '\0')
+ {
new_target = env.find_target((tu_string)"/");
- } else {
+ }
+ else
+ {
new_target = env.find_target((tu_string)target_name);
}
- if (new_target == NULL) {
- log_action("ERROR: Couldn't find movie \"%s\" to set target to!"
+ if (new_target == NULL)
+ {
+ log_action("ERROR: "
+ " Couldn't find movie \"%s\" to set target to!"
" Not setting target at all...",
- (const char *)target_name);
- } else {
+ target_name);
+ }
+ else
+ {
env.set_target(new_target);
}
}
@@ -885,17 +904,25 @@
{
// GNASH_REPORT_FUNCTION;
as_environment& env = thread.env;
- movie *target = env.find_target(env.top(1));
- int prop_number = (int)env.top(0).to_number();
- if (target) {
- if ((prop_number >= 0) && (prop_number < (int)_property_names.size())
){
+ sprite_instance *target = env.find_target(env.top(1));
+ unsigned int prop_number = (unsigned int)env.top(0).to_number();
+ if (target)
+ {
+ if ( prop_number < _property_names.size() )
+ {
as_value val;
- target->get_member(_property_names[prop_number].c_str(), &val);
+ target->get_member(_property_names[prop_number].c_str(),
+ &val);
env.top(1) = val;
- } else {
- log_error("invalid property query, property number %d\n",
prop_number);
}
- } else {
+ else
+ {
+ log_error("invalid property query, property "
+ "number %d\n", prop_number);
+ }
+ }
+ else
+ {
env.top(1) = as_value();
}
env.drop(1);
@@ -907,15 +934,18 @@
// GNASH_REPORT_FUNCTION;
as_environment& env = thread.env;
- movie *target = env.find_target(env.top(2));
- int prop_number = (int)env.top(1).to_number();
+ sprite_instance *target = env.find_target(env.top(2));
+ unsigned int prop_number = (unsigned int)env.top(1).to_number();
as_value prop_val = env.top(0);
if (target) {
-// set_property(target, (int) env.top(1).to_number(), env.top(0));
- if ((prop_number >= 0) && prop_number < (int)_property_names.size()) {
+// set_property(target, prop_number, env.top(0));
+ if ( prop_number < _property_names.size() )
+ {
target->set_member(_property_names[prop_number].c_str(), prop_val);
- } else {
+ }
+ else
+ {
log_error("invalid set_property, property number %d\n",
prop_number);
}
@@ -940,6 +970,7 @@
{
// GNASH_REPORT_FUNCTION;
as_environment& env = thread.env;
+
env.get_target()->remove_display_object(env.top(0).to_tu_string());
env.drop(1);
}
@@ -978,7 +1009,7 @@
}
env.drop(3);
- movie *root_movie = env.get_target()->get_root_movie();
+ sprite_instance *root_movie = env.get_target()->get_root_movie();
assert(root_movie);
if (root_movie && st.m_character) {
@@ -992,7 +1023,7 @@
{
// GNASH_REPORT_FUNCTION;
as_environment& env = thread.env;
- movie *root_movie = env.get_target()->get_root_movie();
+ sprite_instance *root_movie = env.get_target()->get_root_movie();
assert(root_movie);
root_movie->stop_drag();
}
@@ -1266,7 +1297,7 @@
as_environment& env = thread.env;
const action_buffer& code = thread.code;
- assert( code[thread.pc] == SWF::ACTION_GETURL );
+ assert( code[thread.pc] == SWF::ACTION_GETURL2 );
// int method = code[pc + 3];
@@ -1288,10 +1319,10 @@
#ifdef EXTERN_MOVIE
// log_error("get url2: target=%s, url=%s\n", target, url);
- movie* target_movie = env.find_target(env.top(0));
+ sprite_instance* target_movie = env.find_target(env.top(0));
if (target_movie != NULL)
{
- movie* root_movie = env.get_target()->get_root_movie();
+ sprite_instance* root_movie =
env.get_target()->get_root_movie();
attach_extern_movie(url, target_movie, root_movie);
}
else
@@ -1373,7 +1404,7 @@
unsigned char play_flag = code[pc + 3];
movie::play_state state = play_flag ? movie::PLAY : movie::STOP;
- movie* target = env.get_target();
+ sprite_instance* target = env.get_target();
bool success = false;
if (env.top(0).get_type() == as_value::UNDEFINED)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash ChangeLog server/ASSound.cpp server/Actio...,
Sandro Santilli <=