81 lines
2.6 KiB
C
81 lines
2.6 KiB
C
#include <assert.h>
|
|
#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
|
|
);
|
|
}
|
|
|
|
game_npc* game_map_npc_in_progress = NULL;
|
|
|
|
void map_game_map_npc_create(sys_i32 x, sys_i32 y) {
|
|
// center NPC
|
|
game_map_npc_in_progress = game_npc_create(
|
|
(x + 1) * TILE_SZ_MICROPIXEL,
|
|
(y + 1) * TILE_SZ_MICROPIXEL
|
|
);
|
|
}
|
|
|
|
void map_game_map_npc_set_sprite_id(sys_i32 id) {
|
|
assert(game_map_npc_in_progress && "NPC has to be in progress");
|
|
game_map_npc_in_progress->sprite_id = id;
|
|
}
|
|
|
|
void map_game_map_npc_set_palette_id(sys_i32 id) {
|
|
assert(game_map_npc_in_progress && "NPC has to be in progress");
|
|
game_map_npc_in_progress->palette_id = id;
|
|
}
|
|
|
|
void map_game_map_npc_set_inflict_id(sys_i32 id) {
|
|
assert(game_map_npc_in_progress && "NPC has to be in progress");
|
|
game_map_npc_in_progress->inflict_id = id;
|
|
}
|
|
|
|
void map_game_map_npc_set_face_left(bool face_left) {
|
|
assert(game_map_npc_in_progress && "NPC has to be in progress");
|
|
game_map_npc_in_progress->face_left = face_left;
|
|
}
|
|
|
|
void map_game_map_npc_set_no_cake_dialogue(const char* dialogue) {
|
|
assert(game_map_npc_in_progress && "NPC has to be in progress");
|
|
game_map_npc_in_progress->no_cake_dialogue = dialogue;
|
|
}
|
|
|
|
void map_game_map_npc_add_dialogue(const char* dialogue) {
|
|
assert(game_map_npc_in_progress && "NPC has to be in progress");
|
|
assert(game_map_npc_in_progress->n_dialogues < GAME_NPC_MAX_N_DIALOGUES &&
|
|
"NPC can't have too many dialogues");
|
|
sys_i32 ix = game_map_npc_in_progress->n_dialogues++;
|
|
game_map_npc_in_progress->dialogues[ix] = dialogue;
|
|
} |