usage of enums for frames

This commit is contained in:
Priec
2025-11-14 19:20:14 +01:00
parent 9170524d33
commit 8fa8bf392b
5 changed files with 52 additions and 39 deletions

View File

@@ -8,17 +8,17 @@ PlayerPosition get_aligned_frame_position(PlayerPosition base, int frame_index)
if (frame_index < 0 || frame_index >= PLAYER_FRAME_COUNT)
frame_index = 0;
int sprite_height = 0;
int character_height = 0;
if (frame_index == 0)
sprite_height = PLAYER_MASK_LINES_FRAME_1;
character_height = PLAYER_MASK_LINES_FRAME_1;
else if (frame_index == 1)
sprite_height = PLAYER_MASK_LINES_FRAME_2;
character_height = PLAYER_MASK_LINES_FRAME_2;
else
sprite_height = PLAYER_MASK_LINES_FRAME_3;
character_height = PLAYER_MASK_LINES_FRAME_3;
PlayerPosition draw_pos;
draw_pos.x = base.x;
draw_pos.y = (VIEW_HEIGHT - base.y) - sprite_height;
draw_pos.y = (VIEW_HEIGHT - base.y) - character_height;
return draw_pos;
}