diff --git a/include/components/attack_component.h b/include/components/attack_component.h
index 6e78aed..674477d 100644
--- a/include/components/attack_component.h
+++ b/include/components/attack_component.h
@@ -2,7 +2,7 @@
** EPITECH PROJECT, 2020
** my_rpg
** File description:
-** attack_component.h
+** attack_component.hMdr
*/
@@ -13,9 +13,14 @@
typedef void (*attack)(gc_entity *from, gc_entity *enemy);
+typedef struct attack_holder {
+ char *name;
+ attack run;
+} attack_holder;
+
struct attack_component {
gc_component base;
- gc_data *attacks;
+ attack_holder *attacks;
};
extern const struct attack_component attack_component;
diff --git a/lib/gamacon b/lib/gamacon
index ae7daff..845620b 160000
--- a/lib/gamacon
+++ b/lib/gamacon
@@ -1 +1 @@
-Subproject commit ae7dafffe705faa2fc737d59f042e43fa92201cd
+Subproject commit 845620bd43a8ef25d7bb9fd19df7e162d83853f2
diff --git a/prefabs/combat.gcprefab b/prefabs/combat.gcprefab
index 7be98e3..f5ac3f7 100644
--- a/prefabs/combat.gcprefab
+++ b/prefabs/combat.gcprefab
@@ -30,6 +30,10 @@
+
+
+
+
diff --git a/prefabs/input.gcprefab b/prefabs/input.gcprefab
index 886f051..149acb5 100644
--- a/prefabs/input.gcprefab
+++ b/prefabs/input.gcprefab
@@ -1,6 +1,6 @@
-
-
-
-
+
+
+
+
\ No newline at end of file
diff --git a/src/components/attack_component.c b/src/components/attack_component.c
index 1346c25..75cba7f 100644
--- a/src/components/attack_component.c
+++ b/src/components/attack_component.c
@@ -7,19 +7,31 @@
#include "engine.h"
#include "components/attack_component.h"
+#include
static void ctr(void *component, va_list args)
{
struct attack_component *cmp = (struct attack_component *)component;
- cmp->attacks = va_arg(args, gc_data *);
+ cmp->attacks = va_arg(args, attack_holder *);
}
static void fdctr(gc_entity *entity, gc_scene *scene, void *component, node *n)
{
struct attack_component *cmp = (struct attack_component *)component;
+ int i = 0;
+ char *name;
- // SET ATTACKS FROM the xml.
+ cmp->attacks = malloc(sizeof(attack_holder) * xml_getchildcount(n));
+ if (!cmp->attacks)
+ return;
+ for (n = n->child; n; n = n->next) {
+ name = xml_getproperty(n, "name");
+ cmp->attacks[i].name = name;
+ cmp->attacks[i].run = scene->get_data(scene, "attack", name);
+ i++;
+ }
+ cmp->attacks[i].name = NULL;
}
static void dtr(void *component)
diff --git a/src/systems/dialog_methods.c b/src/systems/dialog_methods.c
index b40794c..d5b68ec 100644
--- a/src/systems/dialog_methods.c
+++ b/src/systems/dialog_methods.c
@@ -88,6 +88,7 @@ static bool handle_input(gc_engine *engine, struct dialog_manager *this)
((gc_text *)rend->data)->text = this->current_text->inputs[i].text;
rend->destroy = &text_safe_destroy;
}
+ this->input_index = 0;
return (true);
}