Get NPCs showing up in-engine

This commit is contained in:
2024-02-28 19:42:03 -08:00
parent 567db0bd71
commit f5f5e2c20b
8 changed files with 202 additions and 16 deletions

View File

@ -11,7 +11,7 @@
"iid": "7db5fd20-b0a0-11ee-9688-af2c6adbc1d6",
"jsonVersion": "1.5.3",
"appBuildId": 473703,
"nextUid": 130,
"nextUid": 131,
"identifierStyle": "Lowercase",
"toc": [],
"worldLayout": "Free",
@ -3696,6 +3696,43 @@
"allowedRefsEntityUid": null,
"allowedRefTags": [],
"tilesetUid": null
},
{
"identifier": "face_left",
"doc": null,
"__type": "Bool",
"uid": 130,
"type": "F_Bool",
"isArray": false,
"canBeNull": false,
"arrayMinLength": null,
"arrayMaxLength": null,
"editorDisplayMode": "Hidden",
"editorDisplayScale": 1,
"editorDisplayPos": "Above",
"editorLinkStyle": "StraightArrow",
"editorDisplayColor": null,
"editorAlwaysShow": false,
"editorShowInWorld": true,
"editorCutLongValues": true,
"editorTextSuffix": null,
"editorTextPrefix": null,
"useForSmartColor": false,
"exportToToc": false,
"searchable": false,
"min": null,
"max": null,
"regex": null,
"acceptFileTypes": null,
"defaultOverride": null,
"textLanguageMode": null,
"symmetricalRef": false,
"autoChainRef": true,
"allowOutOfLevelRef": true,
"allowedRefs": "OnlySame",
"allowedRefsEntityUid": null,
"allowedRefTags": [],
"tilesetUid": null
}
]
}
@ -4216,7 +4253,11 @@
"id": "V_String",
"params": ["But you should go to the next screen."]
} ] },
{ "__identifier": "no_cake_dialogue", "__type": "String", "__value": null, "__tile": null, "defUid": 129, "realEditorValues": [] }
{ "__identifier": "no_cake_dialogue", "__type": "String", "__value": null, "__tile": null, "defUid": 129, "realEditorValues": [] },
{ "__identifier": "face_left", "__type": "Bool", "__value": true, "__tile": null, "defUid": 130, "realEditorValues": [{
"id": "V_Bool",
"params": [ true ]
}] }
],
"__worldX": 464,
"__worldY": 528

View File

@ -1,3 +1,4 @@
#include <assert.h>
#include "sys/sys.h"
#include "game/game.h"
#include "game_map.h"
@ -36,26 +37,44 @@ void map_game_map_collectible_money_small_create(sys_i32 x, sys_i32 y) {
);
}
game_npc* game_map_npc_in_progress = NULL;
void map_game_map_npc_create(sys_i32 x, sys_i32 y) {
// TODO
// 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) {
// TODO
}
void map_game_map_npc_set_inflict_id(sys_i32 id) {
// TODO
}
void map_game_map_npc_set_no_cake_dialogue(const char* dialogue) {
// TODO
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) {
// TODO
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) {
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) {
// TODO
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;
}