|
|
@@ -7,7 +7,7 @@
|
|
|
static EntityContext *enemy_context_generic;
|
|
|
// Allocation function
|
|
|
static EntityContext *enemy_generic_alloc(
|
|
|
- const char *id,
|
|
|
+ SpriteID id,
|
|
|
int index,
|
|
|
Vector size,
|
|
|
Vector start_position,
|
|
|
@@ -29,7 +29,7 @@ static EntityContext *enemy_generic_alloc(
|
|
|
FURI_LOG_E("Game", "Failed to allocate EntityContext");
|
|
|
return NULL;
|
|
|
}
|
|
|
- snprintf(enemy_context_generic->id, sizeof(enemy_context_generic->id), "%s", id);
|
|
|
+ enemy_context_generic->id = id;
|
|
|
enemy_context_generic->index = index;
|
|
|
enemy_context_generic->size = size;
|
|
|
enemy_context_generic->start_position = start_position;
|
|
|
@@ -78,7 +78,7 @@ static void enemy_start(Entity *self, GameManager *manager, void *context)
|
|
|
|
|
|
EntityContext *enemy_context = (EntityContext *)context;
|
|
|
// Copy fields from generic context
|
|
|
- snprintf(enemy_context->id, sizeof(enemy_context->id), "%s", enemy_context_generic->id);
|
|
|
+ enemy_context->id = enemy_context_generic->id;
|
|
|
enemy_context->index = enemy_context_generic->index;
|
|
|
enemy_context->size = enemy_context_generic->size;
|
|
|
enemy_context->start_position = enemy_context_generic->start_position;
|
|
|
@@ -185,7 +185,7 @@ static void atk_notify(GameContext *game_context, EntityContext *enemy_context,
|
|
|
{
|
|
|
notification_message(notifications, &sequence_blink_blue_100);
|
|
|
}
|
|
|
- FURI_LOG_I("Game", "Player attacked enemy '%s'!", enemy_context->id);
|
|
|
+ FURI_LOG_I("Game", "Player attacked enemy '%d'!", enemy_context->id);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -207,7 +207,7 @@ static void atk_notify(GameContext *game_context, EntityContext *enemy_context,
|
|
|
notification_message(notifications, &sequence_blink_red_100);
|
|
|
}
|
|
|
|
|
|
- FURI_LOG_I("Game", "Enemy '%s' attacked the player!", enemy_context->id);
|
|
|
+ FURI_LOG_I("Game", "Enemy '%d' attacked the player!", enemy_context->id);
|
|
|
}
|
|
|
|
|
|
// close the notifications
|
|
|
@@ -267,7 +267,7 @@ static void enemy_collision(Entity *self, Entity *other, GameManager *manager, v
|
|
|
{
|
|
|
if (game_context->game_mode == GAME_MODE_STORY && game_context->tutorial_step == 4)
|
|
|
{
|
|
|
- // FURI_LOG_I("Game", "Player attacked enemy '%s'!", enemy_context->id);
|
|
|
+ // FURI_LOG_I("Game", "Player attacked enemy '%d'!", enemy_context->id);
|
|
|
game_context->tutorial_step++;
|
|
|
}
|
|
|
// Reset last button
|
|
|
@@ -334,7 +334,7 @@ static void enemy_collision(Entity *self, Entity *other, GameManager *manager, v
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- FURI_LOG_I("Game", "Player attack on enemy '%s' is on cooldown: %f seconds remaining", enemy_context->id, (double)(player_context->attack_timer - player_context->elapsed_attack_timer));
|
|
|
+ FURI_LOG_I("Game", "Player attack on enemy '%d' is on cooldown: %f seconds remaining", enemy_context->id, (double)(player_context->attack_timer - player_context->elapsed_attack_timer));
|
|
|
}
|
|
|
}
|
|
|
// Handle Enemy Attacking Player (enemy facing player)
|
|
|
@@ -377,7 +377,7 @@ static void enemy_collision(Entity *self, Entity *other, GameManager *manager, v
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- FURI_LOG_I("Game", "Player took %f damage from enemy '%s'", (double)enemy_context->strength, enemy_context->id);
|
|
|
+ FURI_LOG_I("Game", "Player took %f damage from enemy '%d'", (double)enemy_context->strength, enemy_context->id);
|
|
|
player_context->state = ENTITY_ATTACKED;
|
|
|
|
|
|
// Bounce the player back by X units opposite their last movement direction
|
|
|
@@ -732,7 +732,7 @@ const EntityDescription *enemy(
|
|
|
|
|
|
// Allocate a new EntityContext with provided parameters
|
|
|
enemy_context_generic = enemy_generic_alloc(
|
|
|
- id,
|
|
|
+ sprite_context->id,
|
|
|
index,
|
|
|
(Vector){sprite_context->width, sprite_context->height},
|
|
|
start_position,
|