// src/render/player_positioning.cpp
#include "player_positioning.h"
#include "../assets/background_frame.h"
#include "../assets/character_walk_frames.h"
#include "../assets/character_run_frames.h"
#include "../assets/character_crawl_frames.h"
#include <cstdio>

CharacterPosition get_aligned_frame_position(CharacterPosition base,
                                             MovementType movement,
                                             int /*frame_index*/) {
    int character_height = 0;

    switch (movement) {
    case MovementType::Walk:
        character_height = CHARACTER_WALK_FRAME_HEIGHT;
        break;
    case MovementType::Run:
        character_height = CHARACTER_RUN_FRAME_HEIGHT;
        break;
    case MovementType::Crawl1:
        character_height = CHARACTER_CRAWL1_FRAME_HEIGHT;
        break;
    case MovementType::Crawl2:
        character_height = CHARACTER_CRAWL2_FRAME_HEIGHT;
        break;
    }

    CharacterPosition draw_pos{};
    draw_pos.x = base.x;
    draw_pos.y = (VIEW_HEIGHT - base.y) - character_height;
    return draw_pos;
}
