diff options
author | Vasily_Makarov <danilka.pro@gmail.com> | 2011-06-13 14:04:21 +0400 |
---|---|---|
committer | Vasily_Makarov <danilka.pro@gmail.com> | 2011-06-13 14:04:21 +0400 |
commit | 496c8cbf8874fc20b5b17969cc64d132c737176c (patch) | |
tree | 4b178b3a371691855e1f708ea136d865dfc976cc /saedit | |
parent | bd4920984dedcbc3ead9d8052cc396149c425902 (diff) | |
download | evol-tools-496c8cbf8874fc20b5b17969cc64d132c737176c.tar.gz evol-tools-496c8cbf8874fc20b5b17969cc64d132c737176c.tar.bz2 evol-tools-496c8cbf8874fc20b5b17969cc64d132c737176c.tar.xz evol-tools-496c8cbf8874fc20b5b17969cc64d132c737176c.zip |
saedit: Add recursive player protect
Diffstat (limited to 'saedit')
-rw-r--r-- | saedit/interface.h | 12 | ||||
-rw-r--r-- | saedit/main.c | 27 | ||||
-rw-r--r-- | saedit/main.h | 2 | ||||
-rwxr-xr-x | saedit/saedit | bin | 456130 -> 455946 bytes |
4 files changed, 22 insertions, 19 deletions
diff --git a/saedit/interface.h b/saedit/interface.h index dce0786..76aca08 100644 --- a/saedit/interface.h +++ b/saedit/interface.h @@ -1,3 +1,14 @@ +/*=======================================*\ +| ____ ____ | +| / \ /\ | | +| \____ / \ |____ | +| \ /____\ | | +| \____/prite / \nimation |____ditor | +| | +| Copyleft Vasily_Makarov 2011 | +| | +\*=======================================*/ + void set_up_interface() { GtkWidget *button = NULL; GtkWidget *hbox = NULL; @@ -106,7 +117,6 @@ void set_up_interface() { gtk_label_set_markup(GTK_LABEL(label), markup_bold(_("XML source file"))); gtk_box_pack_start(GTK_BOX(vbbox), label, TRUE, TRUE, 0); - //xml_file_chooser_button = gtk_file_chooser_button_new(_("XML source file"), 0); xml_file_chooser_button = gtk_file_chooser_button_new_with_dialog(fcdialog); gtk_box_pack_start(GTK_BOX(vbbox), xml_file_chooser_button, TRUE, TRUE, 0); g_signal_connect(xml_file_chooser_button, "file-set", G_CALLBACK(open_xml_file), source_buffer); diff --git a/saedit/main.c b/saedit/main.c index c692dbe..eef2939 100644 --- a/saedit/main.c +++ b/saedit/main.c @@ -396,11 +396,16 @@ void animations_combo_box_changed_handler(GtkComboBox *widget, gpointer user_dat show_animation(gen_sae_info); } -void set_up_imageset_by_node(XMLNode *node, SAEInfo *sae_info) { +void set_up_imageset_by_name(const gchar *name, SAEInfo *sae_info) { free_imageset(sae_info); free_actions(sae_info); free_animations(sae_info); + GList *list = g_list_find_custom(sae_info->imagesets, name, xml_node_compare_with_name_attr); + XMLNode *node = list->data; + if (node == NULL) + return; + sae_info->imageset->node = node; sae_info->imageset->offsetX = 0; sae_info->imageset->offsetY = 0; @@ -438,7 +443,7 @@ void set_up_imageset_by_node(XMLNode *node, SAEInfo *sae_info) { gchar *height = xml_node_get_attr_value(sae_info->imageset->node, "height"); sscanf(height, "%d", &sae_info->imageset->height); - GList *list = g_list_find_custom(sae_info->root->sub_nodes, "sae", xml_node_compare_with_name); + list = g_list_find_custom(sae_info->root->sub_nodes, "sae", xml_node_compare_with_name); if (list != NULL) { gchar *ground_attr = xml_node_get_attr_value((XMLNode *)list->data, "ground"); if (ground_attr != NULL) { @@ -448,7 +453,7 @@ void set_up_imageset_by_node(XMLNode *node, SAEInfo *sae_info) { sae_info->ground = pbuf; } gchar *player_attr = xml_node_get_attr_value((XMLNode *)list->data, "player"); - if (player_attr != NULL) { + if (player_attr != NULL && player == NULL) { gchar *text; gchar *sprites_path = paths->sprites; gchar *player_file = g_strjoin(NULL, sprites_path, DIR_PLAYERS, player_attr, ".xml", NULL); @@ -456,10 +461,7 @@ void set_up_imageset_by_node(XMLNode *node, SAEInfo *sae_info) { if (g_file_get_contents(player_file, &text, NULL, NULL)) { player = sae_info_new(); parse_xml_text(text, player); - GList *list = g_list_find_custom(player->imagesets, "base", xml_node_compare_with_name_attr); - XMLNode *node = list->data; - printf("\n%s\n", node->name); - set_up_imageset_by_node(list->data, player); + set_up_imageset_by_name("base", player); } } } @@ -468,10 +470,7 @@ void set_up_imageset_by_node(XMLNode *node, SAEInfo *sae_info) { } void imagesets_combo_box_changed_handler(GtkComboBox *widget, gpointer user_data) { - GList *list = g_list_find_custom(gen_sae_info->imagesets, gtk_combo_box_get_active_text(widget), xml_node_compare_with_name_attr); - if (list == NULL) - return; - set_up_imageset_by_node(list->data, gen_sae_info); + set_up_imageset_by_name(gtk_combo_box_get_active_text(widget), gen_sae_info); } void load_options() { @@ -527,12 +526,6 @@ void parse_xml_text(gchar *text, SAEInfo *sae_info) { sae_info->offsetX = 0; sae_info->offsetY = 0; - /*gchar *name_attr = xml_node_get_attr_value(_root_node, "name"); - gchar *action_attr = xml_node_get_attr_value(_root_node, "action"); - if (name_attr != NULL && action_attr != NULL) - if (g_strcmp0(name_attr, "player") == 0 && - g_strcmp0(action_attr, "stand") == 0) - sae_info->offsetY = -16;*/ if (!set_up_imagesets(sae_info)) { show_wrong_source_buffer_dialog(); diff --git a/saedit/main.h b/saedit/main.h index d946f53..7303eb0 100644 --- a/saedit/main.h +++ b/saedit/main.h @@ -201,7 +201,7 @@ static gboolean show_general_animation(SAEInfo *sae_info); static gboolean set_up_action_by_name(const gchar *name, SAEInfo *sae_info); static void actions_combo_box_changed_handler(GtkComboBox *widget, gpointer user_data); static void animations_combo_box_changed_handler(GtkComboBox *widget, gpointer user_data); -static void set_up_imageset_by_node(XMLNode *node, SAEInfo *sae_info); +static void set_up_imageset_by_name(const gchar* name, SAEInfo *sae_info); static void imagesets_combo_box_changed_handler(GtkComboBox *widget, gpointer user_data); static void parse_xml_buffer(GtkWidget *button, GtkSourceBuffer *buffer); static void set_up_interface(); diff --git a/saedit/saedit b/saedit/saedit Binary files differindex 188e1a2..922138f 100755 --- a/saedit/saedit +++ b/saedit/saedit |