#include "sys/sys.h"
#include "game/game.h"
#include "game_map.h"

sys_i32 game_map_player_start_x;
sys_i32 game_map_player_start_y;

// called by map_game_map_create_entities
void map_game_map_player_spawn_create(sys_i32 x, sys_i32 y) {
    // center, because the entity has top-left positioning
    game_map_player_start_x = x * TILE_SZ_MICROPIXEL + PIXEL_SZ_MICROPIXEL * 8;
    game_map_player_start_y = y * TILE_SZ_MICROPIXEL + PIXEL_SZ_MICROPIXEL * 16;
}

void map_game_map_collectible_cake_create(sys_i32 x, sys_i32 y) {
    game_collectible_create(
        (x + 2) * TILE_SZ_MICROPIXEL,
        (y + 2) * TILE_SZ_MICROPIXEL,
        GAME_COLLECTIBLE_TYPE_CAKE
    );
}

void map_game_map_collectible_money_big_create(sys_i32 x, sys_i32 y) {
    game_collectible_create(
        (x + 1) * TILE_SZ_MICROPIXEL,
        (y + 1) * TILE_SZ_MICROPIXEL,
        GAME_COLLECTIBLE_TYPE_MONEY_BIG
    );
}

void map_game_map_collectible_money_small_create(sys_i32 x, sys_i32 y) {
    game_collectible_create(
        (x + 1) * TILE_SZ_MICROPIXEL,
        (y + 1) * TILE_SZ_MICROPIXEL,
        GAME_COLLECTIBLE_TYPE_MONEY_SMALL
    );
}