Removing a bug that stuck the player

This commit is contained in:
Anonymus Raccoon
2020-04-29 12:42:48 +02:00
parent e83e69eebd
commit 29497d4a41
4 changed files with 11 additions and 7 deletions
+1 -1
View File
@@ -92,7 +92,7 @@ void enemy_attack(gc_engine *engine, gc_entity *from, gc_entity *enemy)
struct combat_manager *this = GETSYS(engine, combat_manager);
struct health_component *enemy_health = GETCMP(enemy, health_component);
struct renderer *rend = GETCMP(from, renderer);
int max = 20 - this->last_enemy_damage;
int max = 10 - this->last_enemy_damage;
this->last_enemy_damage = MAX(MIN(random() % max, 10), 0);
if (this->last_attack && !my_strcmp(this->last_attack, "shield"))
+3
View File
@@ -83,6 +83,9 @@ static void ctr(void *system, va_list list)
this->game_scene = NULL;
this->state = ATTACK;
this->last_enemy_damage = 0;
this->last_damage = 0;
this->last_attack = NULL;
engine->add_event_listener(engine, "entity_moved", &entity_moved);
}
+6 -5
View File
@@ -16,7 +16,7 @@
#include "engine.h"
#include "tile.h"
void load_dialog(struct dialog_manager *this, gc_engine *engine, \
bool load_dialog(struct dialog_manager *this, gc_engine *engine, \
gc_entity *player)
{
struct map_linker *link = GETCMP(player, map_linker);
@@ -26,7 +26,7 @@ gc_entity *player)
if (!link || !link->tile || !link->tile->type || \
my_strcmp(link->tile->type, "dialog"))
return;
return (false);
this->dialog_id = prefab_load(engine, "prefabs/dialog.gcprefab");
if (this->dialog_id < 0)
my_printf("Couldn't load the dialog prefab.\n");
@@ -36,9 +36,10 @@ my_strcmp(link->tile->type, "dialog"))
this->current_dialog = dialog;
}
if (!this->current_dialog)
return;
return (false);
this->current_text = this->current_dialog->text[0];
this->current_line = 0;
return (true);
}
bool update_dialog(struct dialog_manager *this, gc_entity *text, \
@@ -109,8 +110,8 @@ void dialog_next(gc_engine *engine)
if (!entity)
return;
if (this->dialog_id == -1)
load_dialog(this, engine, entity);
if (this->dialog_id == -1 && !load_dialog(this, engine, entity))
return;
if (this->input_id >= 0)
run_input_func(this, engine);
controllable_set_can_move(scene, false);