From 0ca98a2d114615596a7e709a65548642fb9c1fb1 Mon Sep 17 00:00:00 2001
From: Anonymus Raccoon
Date: Thu, 16 Apr 2020 18:58:38 +0200
Subject: [PATCH] Adding dialogs inside the combat scene
---
lib/gamacon | 2 +-
prefabs/combat.gcmap | 14 ++++++++++++
prefabs/combat.gcprefab | 36 +++++++++++++++++++++++++++++++
prefabs/game.gcprefab | 1 +
src/systems/dialog_methods.c | 11 +++++-----
src/systems/map_movement_system.c | 2 +-
6 files changed, 59 insertions(+), 7 deletions(-)
create mode 100644 prefabs/combat.gcmap
create mode 100644 prefabs/combat.gcprefab
diff --git a/lib/gamacon b/lib/gamacon
index c7deb5a..077ce25 160000
--- a/lib/gamacon
+++ b/lib/gamacon
@@ -1 +1 @@
-Subproject commit c7deb5a95713d2c5da6efa07685322d908a86823
+Subproject commit 077ce25971e4fd7101f24bd5d5fe535bff2c43b1
diff --git a/prefabs/combat.gcmap b/prefabs/combat.gcmap
new file mode 100644
index 0000000..219fc38
--- /dev/null
+++ b/prefabs/combat.gcmap
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/prefabs/combat.gcprefab b/prefabs/combat.gcprefab
new file mode 100644
index 0000000..81e5dfe
--- /dev/null
+++ b/prefabs/combat.gcprefab
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ?? line="Hello dirt block,\nI am the mighty cobble block.">
+
+
+
+
+ ???>
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/prefabs/game.gcprefab b/prefabs/game.gcprefab
index 5ac8b16..49deb72 100644
--- a/prefabs/game.gcprefab
+++ b/prefabs/game.gcprefab
@@ -80,6 +80,7 @@
+
diff --git a/src/systems/dialog_methods.c b/src/systems/dialog_methods.c
index 8fd8033..f75b575 100644
--- a/src/systems/dialog_methods.c
+++ b/src/systems/dialog_methods.c
@@ -59,9 +59,10 @@ gc_entity *name)
rend = GETCMP(text, renderer);
if (!rend || rend->type != GC_TXTREND || !rend->data)
return (true);
- if (this->current_text)
- ((gc_text *)rend->data)->text = this->current_text->text;
- else
+ if (this->current_text) {
+ ((gc_text *) rend->data)->text = this->current_text->text;
+ this->current_input = &this->current_text->inputs[0];
+ } else
((gc_text *)rend->data)->text = NULL;
this->current_line++;
return (!this->current_text);
@@ -93,10 +94,10 @@ static bool handle_input(gc_engine *engine, struct dialog_manager *this)
void run_input_func(struct dialog_manager *this, gc_engine *engine)
{
- prefab_destroy(engine->scene, this->input_id);
- this->input_id = -1;
if (this->current_input->callback)
this->current_input->callback(engine, NULL, (gc_vector2){0, 0}, 0);
+ prefab_destroy(engine->scene, this->input_id);
+ this->input_id = -1;
}
void dialog_next(gc_engine *engine)
diff --git a/src/systems/map_movement_system.c b/src/systems/map_movement_system.c
index d4c85db..647e6aa 100644
--- a/src/systems/map_movement_system.c
+++ b/src/systems/map_movement_system.c
@@ -72,6 +72,7 @@ float dtime)
return;
map = GETCMP(maps->data, vertex_component);
new_tile = get_tile_at(map, map_pos);
+ set_animation(entity, ctl);
if (new_tile && !new_tile->solid && ctl->move_callback <= 0 \
&& new_tile != link->tile) {
link->tile->entity = NULL;
@@ -79,7 +80,6 @@ float dtime)
engine->trigger_event(engine, "entity_moved", entity, link->tile);
ctl->move_callback = .2f;
}
- set_animation(entity, ctl);
ctl->move_callback -= dtime;
}