diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1a35d22..9201ff8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -298,7 +298,7 @@ add_executable(my_rpg
include/components/attack_component.h
src/systems/combat_methods.c
src/combat/attacks.c
- src/player_utilities.c include/player_utilities.h src/systems/inventory.c include/systems/inventory.h src/systems/game_over.c include/systems/game_over.h src/npc/mia.c lib/gamacon/src/scene/scene_constructor.c)
+ src/player_utilities.c include/player_utilities.h src/systems/inventory.c include/systems/inventory.h src/systems/game_over.c include/systems/game_over.h src/npc/mia.c lib/gamacon/src/scene/scene_constructor.c src/npc/fisherman.c)
add_compile_options(-W -Wall -Wextra -Wshadow)
diff --git a/Makefile b/Makefile
index 650767b..d032ad6 100644
--- a/Makefile
+++ b/Makefile
@@ -42,7 +42,8 @@ SRC = src/main.c \
src/player_utilities.c \
src/systems/inventory.c \
src/systems/game_over.c \
- src/npc/mia.c
+ src/npc/mia.c \
+ src/npc/fisherman.c
OBJ = $(SRC:%.c=%.o)
diff --git a/assets/sprites/npc/fisherman.png b/assets/sprites/npc/fisherman.png
new file mode 100644
index 0000000..ea05b1e
Binary files /dev/null and b/assets/sprites/npc/fisherman.png differ
diff --git a/include/components/dialog_holder.h b/include/components/dialog_holder.h
index dfc9e9d..bf050ae 100644
--- a/include/components/dialog_holder.h
+++ b/include/components/dialog_holder.h
@@ -50,5 +50,6 @@ void dialog_next(gc_engine *engine);
struct dialog_line *dialog_add_line(struct dialog_holder *this, char *name, \
char *text, struct dialog_input *inputs);
void show_dialog_if_hidden(gc_engine *engine);
+struct dialog_holder *dialog_get_current(gc_engine *engine);
#endif //MY_RPG_DIALOG_HOLDER_H
diff --git a/include/setup.h b/include/setup.h
index 5c1800e..7dc1f4e 100644
--- a/include/setup.h
+++ b/include/setup.h
@@ -72,5 +72,9 @@ gc_vector2 pos, enum gc_mousekeys key);
bool mia_fish(gc_engine *engine, gc_entity *entity, \
gc_vector2 pos, enum gc_mousekeys key);
+void fisherman_setup(gc_engine *engine);
+bool fisherman_next(gc_engine *engine, gc_entity *entity, \
+gc_vector2 pos, enum gc_mousekeys key);
+
void load_data(gc_scene *scene, const gc_data *datas);
extern const struct gc_data game_data[];
\ No newline at end of file
diff --git a/prefabs/game.gcprefab b/prefabs/game.gcprefab
index 1248951..6a990a2 100644
--- a/prefabs/game.gcprefab
+++ b/prefabs/game.gcprefab
@@ -145,6 +145,7 @@
+
@@ -236,6 +237,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/components/dialog_holder.c b/src/components/dialog_holder.c
index 48ec71c..4b95d71 100644
--- a/src/components/dialog_holder.c
+++ b/src/components/dialog_holder.c
@@ -79,17 +79,20 @@ bool dialog_parse_inputs(struct dialog_line *txt, gc_scene *scene, node *n)
struct dialog_line *dialog_parse_text(gc_scene *scene, node *n)
{
struct dialog_line *txt = malloc(sizeof(struct dialog_line));
- char *callback;
+ char *clb;
if (!txt)
return (NULL);
txt->name = my_strdup(n->name);
txt->text = xml_getproperty(n, "line");
txt->input_count = xml_getchildcount_filtered(n, "input");
- callback = xml_gettempprop(n, "callback");
- txt->callback = scene->get_data(scene, "dialog_callback", callback);
- if (callback && !txt->callback)
- my_printf("Couldn't find an callback with the name: %s.\n", callback);
+ clb = xml_gettempprop(n, "clb");
+ if (clb) {
+ txt->callback = scene->get_data(scene, "dialog_callback", clb);
+ if (!txt->callback)
+ my_printf("Couldn't find an clb with the name: %s.\n", clb);
+ } else
+ txt->callback = NULL;
txt->inputs = NULL;
if (txt->input_count == 0)
return (txt);
diff --git a/src/components/dialog_methods.c b/src/components/dialog_methods.c
index a870c0c..6eeb4df 100644
--- a/src/components/dialog_methods.c
+++ b/src/components/dialog_methods.c
@@ -32,4 +32,11 @@ struct dialog_input *inputs)
this->text[count] = line;
this->text[count + 1] = NULL;
return (line);
+}
+
+struct dialog_holder *dialog_get_current(gc_engine *engine)
+{
+ struct dialog_manager *manager = GETSYS(engine, dialog_manager);
+
+ return (manager->current_dialog);
}
\ No newline at end of file
diff --git a/src/game_loader.c b/src/game_loader.c
index 46a866f..90c4536 100644
--- a/src/game_loader.c
+++ b/src/game_loader.c
@@ -58,6 +58,8 @@ const struct gc_data game_data[] = {
{"input", "mia_save", &mia_save, NULL},
{"input", "mia_fish", &mia_fish, NULL},
{"dialog_callback", "mia_setup", &mia_setup, NULL},
+ {"dialog_callback", "fisherman_setup", &fisherman_setup, NULL},
+ {"input", "fisherman_next", &fisherman_next, NULL},
{NULL, NULL, NULL, NULL}
};
diff --git a/src/npc/fisherman.c b/src/npc/fisherman.c
new file mode 100644
index 0000000..eb84729
--- /dev/null
+++ b/src/npc/fisherman.c
@@ -0,0 +1,39 @@
+/*
+** EPITECH PROJECT, 2020
+** my_rpg
+** File description:
+** fisherman.c
+*/
+
+#include "components/dialog_holder.h"
+#include "systems/game_manager_system.h"
+#include "engine.h"
+
+
+void fisherman_setup(gc_engine *engine)
+{
+ struct dialog_holder *holder = dialog_get_current(engine);
+
+ holder->text[2] = NULL;
+}
+
+bool fisherman_next(gc_engine *engine, gc_entity *entity, \
+gc_vector2 pos, enum gc_mousekeys key)
+{
+ struct dialog_holder *dialog = dialog_get_current(engine);
+
+ if (!dialog)
+ return (false);
+ dialog_add_line(dialog, "Fisherman", "Sometimes I catch \
+fishes with\na strange ability:", NULL);
+ dialog_add_line(dialog, "Fisherman", "they can throw a powerful Water\n\
+Jet at their enemies.", NULL);
+ dialog_add_line(dialog, "Fisherman", "This kind of fish seems \
+to come from the\nsource of the river, something must be there.", NULL);
+ dialog_add_line(dialog, "Fisherman", "You should check it out!", NULL);
+ dialog_add_line(dialog, "Fisherman", "If you pass nearby Mia, tell her\n\
+that I will show up at...", NULL);
+ dialog_add_line(dialog, "Fisherman", "her house for dinner tonight.", NULL);
+ GETSYS(engine, game_manager_system)->has_message = true;
+ return (true);
+}
\ No newline at end of file
diff --git a/src/npc/mia.c b/src/npc/mia.c
index d8b2233..a0e8110 100644
--- a/src/npc/mia.c
+++ b/src/npc/mia.c
@@ -10,12 +10,6 @@
#include
#include "engine.h"
-struct dialog_holder *dialog_get_current(gc_engine *engine)
-{
- struct dialog_manager *manager = GETSYS(engine, dialog_manager);
-
- return (manager->current_dialog);
-}
void mia_setup(gc_engine *engine)
{