movement: generalize; use vectors #16

Merged
NotAShelf merged 6 commits from SquirrelModeler/rogged:generalize-movement into main 2026-04-09 14:11:47 +00:00
2 changed files with 1 additions and 16 deletions
Showing only changes of commit 5e2f752c7e - Show all commits

fix: typo, remove old method

Squirrel Modeller 2026-04-09 15:14:36 +02:00
No known key found for this signature in database
GPG key ID: C9FBA7B8C387BF70

View file

@ -47,21 +47,6 @@ Enemy *player_find_enemy_at(Enemy *enemies, int count, int x, int y) {
return NULL;
}
int player_move(Player *p, Vec2 direction, Map *map, Enemy *enemies, int enemy_count) {
MoveResult result = try_move_entity(&p->position, direction, map, p, enemies, enemy_count, true);
if (result != MOVE_RESULT_MOVED)
return 0;
p->step_count += 1;
if (p->step_count % REGEN_STEP_INTERVAL == 0 && p->hp < p->max_hp &&
!combat_has_effect(p->effects, p->effect_count, EFFECT_POISON) &&
!combat_has_effect(p->effects, p->effect_count, EFFECT_BLEED) &&
!combat_has_effect(p->effects, p->effect_count, EFFECT_BURN)) {
p->hp += 1;
}
return 1;
}
void player_on_move(Player *p) {
p->step_count += 1;
if (p->step_count % REGEN_STEP_INTERVAL == 0 && p->hp < p->max_hp &&

View file

@ -6,7 +6,7 @@
// Initialize player at position
void player_init(Player *p, int x, int y);
// Apply status effect, healing ect
// Apply status effects, healing, etc
SquirrelModeler marked this conversation as resolved Outdated

Typo, should be "healing, etc."

Typo, should be "healing, etc."
void player_on_move(Player *p);
// Find a living enemy at tile (x, y); returns NULL if none