NPCs talk to you when you push Z

This commit is contained in:
Pyrex 2024-02-28 21:07:17 -08:00
parent c7d9f16515
commit 60e1a4ed43
5 changed files with 440 additions and 387 deletions

View File

@ -32,13 +32,9 @@ void game_update() {
bool allow_input = true;
if (sys_btn(DEVICE_BUTTON_2)) {
game_dialogue_display("Hello, world!\nYou rock.");
}
game_collectibles_update();
game_npcs_update();
game_dialogue_update(&allow_input);
game_npcs_update(&allow_input);
game_player_update(&allow_input);
}

View File

@ -1,5 +1,6 @@
#include <assert.h>
#include "art/game_npcs.h"
#include "device/device.h"
#include "sys/sys.h"
#include "game.h"
@ -50,8 +51,52 @@ game_npc* game_npc_create(sys_i32 x, sys_i32 y) {
return &game_npcs[id];
}
void game_npcs_update() {
// TODO
void game_npc_trigger_dialogue(sys_i32 npc_id);
void game_npcs_update(bool* allow_input) {
if (!*allow_input) { return; }
// check collision with player
sys_i32 player_x, player_y;
game_player_get_center(&player_x, &player_y);
for (sys_i32 i = 0; i < game_npc_next; i++) {
game_npc* n = &game_npcs[i];
if (!n->present) { continue; }
sys_i32 r_distcheck = 21 * PIXEL_SZ_MICROPIXEL;
int64_t dx = player_x - n->x;
int64_t dy = player_y - n->y;
if (
sys_btnp(DEVICE_BUTTON_0, false) &&
dx * dx + dy * dy <= r_distcheck * r_distcheck
) {
n->face_left = dx < 0;
game_npc_trigger_dialogue(i);
*allow_input = false;
}
}
}
void game_npc_trigger_dialogue(sys_i32 npc_id) {
const char* dialogue;
// TODO: Make it possible for the player to have the cake
game_npc* npc = &game_npcs[npc_id];
if (npc->no_cake_dialogue != NULL) {
dialogue = npc->no_cake_dialogue;
} else if (npc->n_dialogues_seen < npc->n_dialogues) {
dialogue = npc->dialogues[npc->n_dialogues_seen++];
} else if (npc->n_dialogues > 0) {
dialogue = npc->dialogues[npc->n_dialogues - 1];
} else {
// nothing to do with this npc
return;
}
game_dialogue_display(dialogue);
}
void game_npcs_draw() {

View File

@ -1,6 +1,7 @@
#ifndef GAME_NPC_H
#define GAME_NPC_H
#include <stdbool.h>
#include "sys/sys.h"
#define GAME_NPC_MAX_N_DIALOGUES 16
@ -14,18 +15,18 @@ typedef struct {
uint8_t inflict_id;
bool face_left;
int n_dialogues;
uint8_t n_dialogues;
const char* no_cake_dialogue;
const char* dialogues[GAME_NPC_MAX_N_DIALOGUES];
bool present;
int n_dialogues_seen;
uint8_t n_dialogues_seen;
} game_npc;
// pointer goes to data section and will be valid forever
game_npc* game_npc_create(sys_i32 x, sys_i32 y);
void game_npcs_update();
void game_npcs_update(bool* allow_input);
void game_npcs_draw();
#endif // GAME_NPC_H

View File

@ -41,6 +41,41 @@
"customCommands": [],
"flags": [],
"defs": { "layers": [
{
"__type": "Entities",
"identifier": "entities",
"type": "Entities",
"uid": 109,
"doc": null,
"uiColor": null,
"gridSize": 8,
"guideGridWid": 0,
"guideGridHei": 0,
"displayOpacity": 1,
"inactiveOpacity": 0.6,
"hideInList": false,
"hideFieldsWhenInactive": true,
"canSelectWhenInactive": true,
"renderInWorldView": true,
"pxOffsetX": 0,
"pxOffsetY": 0,
"parallaxFactorX": 0,
"parallaxFactorY": 0,
"parallaxScaling": true,
"requiredTags": [],
"excludedTags": [],
"autoTilesKilledByOtherLayerUid": null,
"uiFilterTags": [],
"useAsyncRender": false,
"intGridValues": [],
"intGridValuesGroups": [],
"autoRuleGroups": [],
"autoSourceLayerDefUid": null,
"tilesetDefUid": null,
"tilePivotX": 0,
"tilePivotY": 0,
"biomeFieldUid": null
},
{
"__type": "IntGrid",
"identifier": "conceptual",
@ -3301,41 +3336,6 @@
"tilePivotX": 0,
"tilePivotY": 0,
"biomeFieldUid": null
},
{
"__type": "Entities",
"identifier": "entities",
"type": "Entities",
"uid": 109,
"doc": null,
"uiColor": null,
"gridSize": 8,
"guideGridWid": 0,
"guideGridHei": 0,
"displayOpacity": 1,
"inactiveOpacity": 0.6,
"hideInList": false,
"hideFieldsWhenInactive": true,
"canSelectWhenInactive": true,
"renderInWorldView": true,
"pxOffsetX": 0,
"pxOffsetY": 0,
"parallaxFactorX": 0,
"parallaxFactorY": 0,
"parallaxScaling": true,
"requiredTags": [],
"excludedTags": [],
"autoTilesKilledByOtherLayerUid": null,
"uiFilterTags": [],
"useAsyncRender": false,
"intGridValues": [],
"intGridValuesGroups": [],
"autoRuleGroups": [],
"autoSourceLayerDefUid": null,
"tilesetDefUid": null,
"tilePivotX": 0,
"tilePivotY": 0,
"biomeFieldUid": null
}
], "entities": [
{
@ -3848,6 +3848,87 @@
"externalRelPath": null,
"fieldInstances": [],
"layerInstances": [
{
"__identifier": "entities",
"__type": "Entities",
"__cWid": 32,
"__cHei": 18,
"__gridSize": 8,
"__opacity": 1,
"__pxTotalOffsetX": 0,
"__pxTotalOffsetY": 0,
"__tilesetDefUid": null,
"__tilesetRelPath": null,
"iid": "658f1a30-b0a0-11ee-9688-d595f6278eea",
"levelId": 0,
"layerDefUid": 109,
"pxOffsetX": 0,
"pxOffsetY": 0,
"visible": true,
"optionalRules": [],
"intGridCsv": [],
"autoLayerTiles": [],
"seed": 9915028,
"overrideTilesetUid": null,
"gridTiles": [],
"entityInstances": [
{
"__identifier": "player_spawn",
"__grid": [15,7],
"__pivot": [0,0],
"__tags": [],
"__tile": { "tilesetUid": 119, "x": 0, "y": 0, "w": 16, "h": 16 },
"__smartColor": "#BE4A2F",
"iid": "86fd73b0-b0a0-11ee-9688-65c9ba3d6485",
"width": 16,
"height": 16,
"defUid": 108,
"px": [120,56],
"fieldInstances": [],
"__worldX": 376,
"__worldY": 488
},
{
"__identifier": "npc",
"__grid": [26,12],
"__pivot": [0,0],
"__tags": [],
"__tile": { "tilesetUid": 123, "x": 0, "y": 0, "w": 16, "h": 16 },
"__smartColor": "#E4A672",
"iid": "013b9de0-b0a0-11ee-9688-2f8ccd9fe15d",
"width": 16,
"height": 16,
"defUid": 122,
"px": [208,96],
"fieldInstances": [
{ "__identifier": "sprite_id", "__type": "Int", "__value": 0, "__tile": null, "defUid": 125, "realEditorValues": [] },
{ "__identifier": "palette_id", "__type": "Int", "__value": 0, "__tile": null, "defUid": 126, "realEditorValues": [] },
{ "__identifier": "inflict_id", "__type": "Int", "__value": 0, "__tile": null, "defUid": 127, "realEditorValues": [] },
{ "__identifier": "dialogue", "__type": "Array<String>", "__value": [
"Croc! Happy birthday.",
"I love you! But you should go to the next screen.",
"Don't worry! We'll meet again."
], "__tile": null, "defUid": 124, "realEditorValues": [ {
"id": "V_String",
"params": ["Croc! Happy birthday."]
}, {
"id": "V_String",
"params": ["I love you! But you should go to the next screen."]
}, {
"id": "V_String",
"params": ["Don't worry! We'll meet again."]
} ] },
{ "__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
}
]
},
{
"__identifier": "conceptual",
"__type": "IntGrid",
@ -4189,80 +4270,6 @@
"overrideTilesetUid": null,
"gridTiles": [],
"entityInstances": []
},
{
"__identifier": "entities",
"__type": "Entities",
"__cWid": 32,
"__cHei": 18,
"__gridSize": 8,
"__opacity": 1,
"__pxTotalOffsetX": 0,
"__pxTotalOffsetY": 0,
"__tilesetDefUid": null,
"__tilesetRelPath": null,
"iid": "658f1a30-b0a0-11ee-9688-d595f6278eea",
"levelId": 0,
"layerDefUid": 109,
"pxOffsetX": 0,
"pxOffsetY": 0,
"visible": true,
"optionalRules": [],
"intGridCsv": [],
"autoLayerTiles": [],
"seed": 9915028,
"overrideTilesetUid": null,
"gridTiles": [],
"entityInstances": [
{
"__identifier": "player_spawn",
"__grid": [15,7],
"__pivot": [0,0],
"__tags": [],
"__tile": { "tilesetUid": 119, "x": 0, "y": 0, "w": 16, "h": 16 },
"__smartColor": "#BE4A2F",
"iid": "86fd73b0-b0a0-11ee-9688-65c9ba3d6485",
"width": 16,
"height": 16,
"defUid": 108,
"px": [120,56],
"fieldInstances": [],
"__worldX": 376,
"__worldY": 488
},
{
"__identifier": "npc",
"__grid": [26,12],
"__pivot": [0,0],
"__tags": [],
"__tile": { "tilesetUid": 123, "x": 0, "y": 0, "w": 16, "h": 16 },
"__smartColor": "#E4A672",
"iid": "013b9de0-b0a0-11ee-9688-2f8ccd9fe15d",
"width": 16,
"height": 16,
"defUid": 122,
"px": [208,96],
"fieldInstances": [
{ "__identifier": "sprite_id", "__type": "Int", "__value": 0, "__tile": null, "defUid": 125, "realEditorValues": [] },
{ "__identifier": "palette_id", "__type": "Int", "__value": 0, "__tile": null, "defUid": 126, "realEditorValues": [] },
{ "__identifier": "inflict_id", "__type": "Int", "__value": 0, "__tile": null, "defUid": 127, "realEditorValues": [] },
{ "__identifier": "dialogue", "__type": "Array<String>", "__value": [ "Croc! I love you.", "But you should go to the next screen." ], "__tile": null, "defUid": 124, "realEditorValues": [ {
"id": "V_String",
"params": ["Croc! I love you."]
}, {
"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": "face_left", "__type": "Bool", "__value": true, "__tile": null, "defUid": 130, "realEditorValues": [{
"id": "V_Bool",
"params": [ true ]
}] }
],
"__worldX": 464,
"__worldY": 528
}
]
}
],
"__neighbours": [ { "levelIid": "bf0dd810-b0a0-11ee-9688-3daed338bb0b", "dir": "e" }, { "levelIid": "462ad270-b0a0-11ee-9688-1965f9834bf0", "dir": "ne" }, { "levelIid": "7351a190-b0a0-11ee-9688-35875e5bee15", "dir": "n" } ]
@ -4288,6 +4295,31 @@
"externalRelPath": null,
"fieldInstances": [],
"layerInstances": [
{
"__identifier": "entities",
"__type": "Entities",
"__cWid": 32,
"__cHei": 18,
"__gridSize": 8,
"__opacity": 1,
"__pxTotalOffsetX": 0,
"__pxTotalOffsetY": 0,
"__tilesetDefUid": null,
"__tilesetRelPath": null,
"iid": "658f1a31-b0a0-11ee-9688-135042e10920",
"levelId": 107,
"layerDefUid": 109,
"pxOffsetX": 0,
"pxOffsetY": 0,
"visible": true,
"optionalRules": [],
"intGridCsv": [],
"autoLayerTiles": [],
"seed": 8688237,
"overrideTilesetUid": null,
"gridTiles": [],
"entityInstances": []
},
{
"__identifier": "conceptual",
"__type": "IntGrid",
@ -4500,31 +4532,6 @@
"overrideTilesetUid": null,
"gridTiles": [],
"entityInstances": []
},
{
"__identifier": "entities",
"__type": "Entities",
"__cWid": 32,
"__cHei": 18,
"__gridSize": 8,
"__opacity": 1,
"__pxTotalOffsetX": 0,
"__pxTotalOffsetY": 0,
"__tilesetDefUid": null,
"__tilesetRelPath": null,
"iid": "658f1a31-b0a0-11ee-9688-135042e10920",
"levelId": 107,
"layerDefUid": 109,
"pxOffsetX": 0,
"pxOffsetY": 0,
"visible": true,
"optionalRules": [],
"intGridCsv": [],
"autoLayerTiles": [],
"seed": 8688237,
"overrideTilesetUid": null,
"gridTiles": [],
"entityInstances": []
}
],
"__neighbours": [
@ -4556,6 +4563,48 @@
"externalRelPath": null,
"fieldInstances": [],
"layerInstances": [
{
"__identifier": "entities",
"__type": "Entities",
"__cWid": 32,
"__cHei": 18,
"__gridSize": 8,
"__opacity": 1,
"__pxTotalOffsetX": 0,
"__pxTotalOffsetY": 0,
"__tilesetDefUid": null,
"__tilesetRelPath": null,
"iid": "462ad272-b0a0-11ee-9688-39a73308a406",
"levelId": 110,
"layerDefUid": 109,
"pxOffsetX": 0,
"pxOffsetY": 0,
"visible": true,
"optionalRules": [],
"intGridCsv": [],
"autoLayerTiles": [],
"seed": 4615793,
"overrideTilesetUid": null,
"gridTiles": [],
"entityInstances": [
{
"__identifier": "collectible_cake",
"__grid": [7,6],
"__pivot": [0,0],
"__tags": [],
"__tile": { "tilesetUid": 118, "x": 0, "y": 0, "w": 32, "h": 32 },
"__smartColor": "#D77643",
"iid": "a8a4a060-b0a0-11ee-9688-4b69333d9492",
"width": 32,
"height": 32,
"defUid": 117,
"px": [56,48],
"fieldInstances": [],
"__worldX": 568,
"__worldY": 336
}
]
},
{
"__identifier": "conceptual",
"__type": "IntGrid",
@ -4646,48 +4695,6 @@
"overrideTilesetUid": null,
"gridTiles": [],
"entityInstances": []
},
{
"__identifier": "entities",
"__type": "Entities",
"__cWid": 32,
"__cHei": 18,
"__gridSize": 8,
"__opacity": 1,
"__pxTotalOffsetX": 0,
"__pxTotalOffsetY": 0,
"__tilesetDefUid": null,
"__tilesetRelPath": null,
"iid": "462ad272-b0a0-11ee-9688-39a73308a406",
"levelId": 110,
"layerDefUid": 109,
"pxOffsetX": 0,
"pxOffsetY": 0,
"visible": true,
"optionalRules": [],
"intGridCsv": [],
"autoLayerTiles": [],
"seed": 4615793,
"overrideTilesetUid": null,
"gridTiles": [],
"entityInstances": [
{
"__identifier": "collectible_cake",
"__grid": [7,6],
"__pivot": [0,0],
"__tags": [],
"__tile": { "tilesetUid": 118, "x": 0, "y": 0, "w": 32, "h": 32 },
"__smartColor": "#D77643",
"iid": "a8a4a060-b0a0-11ee-9688-4b69333d9492",
"width": 32,
"height": 32,
"defUid": 117,
"px": [56,48],
"fieldInstances": [],
"__worldX": 568,
"__worldY": 336
}
]
}
],
"__neighbours": [
@ -4720,6 +4727,48 @@
"externalRelPath": null,
"fieldInstances": [],
"layerInstances": [
{
"__identifier": "entities",
"__type": "Entities",
"__cWid": 32,
"__cHei": 18,
"__gridSize": 8,
"__opacity": 1,
"__pxTotalOffsetX": 0,
"__pxTotalOffsetY": 0,
"__tilesetDefUid": null,
"__tilesetRelPath": null,
"iid": "44be1122-b0a0-11ee-9688-0518eea277d2",
"levelId": 111,
"layerDefUid": 109,
"pxOffsetX": 0,
"pxOffsetY": 0,
"visible": true,
"optionalRules": [],
"intGridCsv": [],
"autoLayerTiles": [],
"seed": 4918460,
"overrideTilesetUid": null,
"gridTiles": [],
"entityInstances": [
{
"__identifier": "collectible_money_big",
"__grid": [8,9],
"__pivot": [0,0],
"__tags": [],
"__tile": { "tilesetUid": 118, "x": 32, "y": 0, "w": 16, "h": 16 },
"__smartColor": "#EAD4AA",
"iid": "f5bec920-b0a0-11ee-9688-1755a5df836c",
"width": 16,
"height": 16,
"defUid": 120,
"px": [64,72],
"fieldInstances": [],
"__worldX": 832,
"__worldY": 360
}
]
},
{
"__identifier": "conceptual",
"__type": "IntGrid",
@ -5100,48 +5149,6 @@
"overrideTilesetUid": null,
"gridTiles": [],
"entityInstances": []
},
{
"__identifier": "entities",
"__type": "Entities",
"__cWid": 32,
"__cHei": 18,
"__gridSize": 8,
"__opacity": 1,
"__pxTotalOffsetX": 0,
"__pxTotalOffsetY": 0,
"__tilesetDefUid": null,
"__tilesetRelPath": null,
"iid": "44be1122-b0a0-11ee-9688-0518eea277d2",
"levelId": 111,
"layerDefUid": 109,
"pxOffsetX": 0,
"pxOffsetY": 0,
"visible": true,
"optionalRules": [],
"intGridCsv": [],
"autoLayerTiles": [],
"seed": 4918460,
"overrideTilesetUid": null,
"gridTiles": [],
"entityInstances": [
{
"__identifier": "collectible_money_big",
"__grid": [8,9],
"__pivot": [0,0],
"__tags": [],
"__tile": { "tilesetUid": 118, "x": 32, "y": 0, "w": 16, "h": 16 },
"__smartColor": "#EAD4AA",
"iid": "f5bec920-b0a0-11ee-9688-1755a5df836c",
"width": 16,
"height": 16,
"defUid": 120,
"px": [64,72],
"fieldInstances": [],
"__worldX": 832,
"__worldY": 360
}
]
}
],
"__neighbours": [
@ -5173,6 +5180,64 @@
"externalRelPath": null,
"fieldInstances": [],
"layerInstances": [
{
"__identifier": "entities",
"__type": "Entities",
"__cWid": 32,
"__cHei": 18,
"__gridSize": 8,
"__opacity": 1,
"__pxTotalOffsetX": 0,
"__pxTotalOffsetY": 0,
"__tilesetDefUid": null,
"__tilesetRelPath": null,
"iid": "082b3612-b0a0-11ee-9688-678818ddf76b",
"levelId": 112,
"layerDefUid": 109,
"pxOffsetX": 0,
"pxOffsetY": 0,
"visible": true,
"optionalRules": [],
"intGridCsv": [],
"autoLayerTiles": [],
"seed": 9798814,
"overrideTilesetUid": null,
"gridTiles": [],
"entityInstances": [
{
"__identifier": "collectible_money_big",
"__grid": [8,13],
"__pivot": [0,0],
"__tags": [],
"__tile": { "tilesetUid": 118, "x": 32, "y": 0, "w": 16, "h": 16 },
"__smartColor": "#EAD4AA",
"iid": "f0d48bc0-b0a0-11ee-9688-35eef76742da",
"width": 16,
"height": 16,
"defUid": 120,
"px": [64,104],
"fieldInstances": [],
"__worldX": 832,
"__worldY": 536
},
{
"__identifier": "collectible_money_small",
"__grid": [4,5],
"__pivot": [0,0],
"__tags": [],
"__tile": { "tilesetUid": 118, "x": 32, "y": 16, "w": 16, "h": 16 },
"__smartColor": "#EAD4AA",
"iid": "16e6a3c0-b0a0-11ee-9688-4f12ef1b0405",
"width": 16,
"height": 16,
"defUid": 121,
"px": [32,40],
"fieldInstances": [],
"__worldX": 800,
"__worldY": 472
}
]
},
{
"__identifier": "conceptual",
"__type": "IntGrid",
@ -5659,64 +5724,6 @@
"overrideTilesetUid": null,
"gridTiles": [],
"entityInstances": []
},
{
"__identifier": "entities",
"__type": "Entities",
"__cWid": 32,
"__cHei": 18,
"__gridSize": 8,
"__opacity": 1,
"__pxTotalOffsetX": 0,
"__pxTotalOffsetY": 0,
"__tilesetDefUid": null,
"__tilesetRelPath": null,
"iid": "082b3612-b0a0-11ee-9688-678818ddf76b",
"levelId": 112,
"layerDefUid": 109,
"pxOffsetX": 0,
"pxOffsetY": 0,
"visible": true,
"optionalRules": [],
"intGridCsv": [],
"autoLayerTiles": [],
"seed": 9798814,
"overrideTilesetUid": null,
"gridTiles": [],
"entityInstances": [
{
"__identifier": "collectible_money_big",
"__grid": [8,13],
"__pivot": [0,0],
"__tags": [],
"__tile": { "tilesetUid": 118, "x": 32, "y": 0, "w": 16, "h": 16 },
"__smartColor": "#EAD4AA",
"iid": "f0d48bc0-b0a0-11ee-9688-35eef76742da",
"width": 16,
"height": 16,
"defUid": 120,
"px": [64,104],
"fieldInstances": [],
"__worldX": 832,
"__worldY": 536
},
{
"__identifier": "collectible_money_small",
"__grid": [4,5],
"__pivot": [0,0],
"__tags": [],
"__tile": { "tilesetUid": 118, "x": 32, "y": 16, "w": 16, "h": 16 },
"__smartColor": "#EAD4AA",
"iid": "16e6a3c0-b0a0-11ee-9688-4f12ef1b0405",
"width": 16,
"height": 16,
"defUid": 121,
"px": [32,40],
"fieldInstances": [],
"__worldX": 800,
"__worldY": 472
}
]
}
],
"__neighbours": [ { "levelIid": "bf0dd810-b0a0-11ee-9688-3daed338bb0b", "dir": "w" }, { "levelIid": "462ad270-b0a0-11ee-9688-1965f9834bf0", "dir": "nw" }, { "levelIid": "44be1120-b0a0-11ee-9688-9bb02c281059", "dir": "n" } ]
@ -5742,6 +5749,31 @@
"externalRelPath": null,
"fieldInstances": [],
"layerInstances": [
{
"__identifier": "entities",
"__type": "Entities",
"__cWid": 32,
"__cHei": 18,
"__gridSize": 8,
"__opacity": 1,
"__pxTotalOffsetX": 0,
"__pxTotalOffsetY": 0,
"__tilesetDefUid": null,
"__tilesetRelPath": null,
"iid": "7351a192-b0a0-11ee-9688-67ea4bb97728",
"levelId": 113,
"layerDefUid": 109,
"pxOffsetX": 0,
"pxOffsetY": 0,
"visible": true,
"optionalRules": [],
"intGridCsv": [],
"autoLayerTiles": [],
"seed": 8987456,
"overrideTilesetUid": null,
"gridTiles": [],
"entityInstances": []
},
{
"__identifier": "conceptual",
"__type": "IntGrid",
@ -5784,31 +5816,6 @@
"overrideTilesetUid": null,
"gridTiles": [],
"entityInstances": []
},
{
"__identifier": "entities",
"__type": "Entities",
"__cWid": 32,
"__cHei": 18,
"__gridSize": 8,
"__opacity": 1,
"__pxTotalOffsetX": 0,
"__pxTotalOffsetY": 0,
"__tilesetDefUid": null,
"__tilesetRelPath": null,
"iid": "7351a192-b0a0-11ee-9688-67ea4bb97728",
"levelId": 113,
"layerDefUid": 109,
"pxOffsetX": 0,
"pxOffsetY": 0,
"visible": true,
"optionalRules": [],
"intGridCsv": [],
"autoLayerTiles": [],
"seed": 8987456,
"overrideTilesetUid": null,
"gridTiles": [],
"entityInstances": []
}
],
"__neighbours": [ { "levelIid": "7db5fd22-b0a0-11ee-9688-e77df1dfa284", "dir": "s" }, { "levelIid": "bf0dd810-b0a0-11ee-9688-3daed338bb0b", "dir": "se" }, { "levelIid": "462ad270-b0a0-11ee-9688-1965f9834bf0", "dir": "e" } ]
@ -5834,6 +5841,31 @@
"externalRelPath": null,
"fieldInstances": [],
"layerInstances": [
{
"__identifier": "entities",
"__type": "Entities",
"__cWid": 32,
"__cHei": 18,
"__gridSize": 8,
"__opacity": 1,
"__pxTotalOffsetX": 0,
"__pxTotalOffsetY": 0,
"__tilesetDefUid": null,
"__tilesetRelPath": null,
"iid": "83bcbf42-b0a0-11ee-9688-bbe3c56b05f1",
"levelId": 114,
"layerDefUid": 109,
"pxOffsetX": 0,
"pxOffsetY": 0,
"visible": true,
"optionalRules": [],
"intGridCsv": [],
"autoLayerTiles": [],
"seed": 6163427,
"overrideTilesetUid": null,
"gridTiles": [],
"entityInstances": []
},
{
"__identifier": "conceptual",
"__type": "IntGrid",
@ -6081,31 +6113,6 @@
"overrideTilesetUid": null,
"gridTiles": [],
"entityInstances": []
},
{
"__identifier": "entities",
"__type": "Entities",
"__cWid": 32,
"__cHei": 18,
"__gridSize": 8,
"__opacity": 1,
"__pxTotalOffsetX": 0,
"__pxTotalOffsetY": 0,
"__tilesetDefUid": null,
"__tilesetRelPath": null,
"iid": "83bcbf42-b0a0-11ee-9688-bbe3c56b05f1",
"levelId": 114,
"layerDefUid": 109,
"pxOffsetX": 0,
"pxOffsetY": 0,
"visible": true,
"optionalRules": [],
"intGridCsv": [],
"autoLayerTiles": [],
"seed": 6163427,
"overrideTilesetUid": null,
"gridTiles": [],
"entityInstances": []
}
],
"__neighbours": [ { "levelIid": "462ad270-b0a0-11ee-9688-1965f9834bf0", "dir": "sw" }, { "levelIid": "44be1120-b0a0-11ee-9688-9bb02c281059", "dir": "s" }, { "levelIid": "fc4befd0-b0a0-11ee-9688-7b6d330109d6", "dir": "e" }, { "levelIid": "9cfeb340-b0a0-11ee-9688-372759f9430d", "dir": "ne" } ]
@ -6131,6 +6138,31 @@
"externalRelPath": null,
"fieldInstances": [],
"layerInstances": [
{
"__identifier": "entities",
"__type": "Entities",
"__cWid": 32,
"__cHei": 18,
"__gridSize": 8,
"__opacity": 1,
"__pxTotalOffsetX": 0,
"__pxTotalOffsetY": 0,
"__tilesetDefUid": null,
"__tilesetRelPath": null,
"iid": "fc4c16e1-b0a0-11ee-9688-91ca54d577bf",
"levelId": 115,
"layerDefUid": 109,
"pxOffsetX": 0,
"pxOffsetY": 0,
"visible": true,
"optionalRules": [],
"intGridCsv": [],
"autoLayerTiles": [],
"seed": 3325108,
"overrideTilesetUid": null,
"gridTiles": [],
"entityInstances": []
},
{
"__identifier": "conceptual",
"__type": "IntGrid",
@ -6716,31 +6748,6 @@
"overrideTilesetUid": null,
"gridTiles": [],
"entityInstances": []
},
{
"__identifier": "entities",
"__type": "Entities",
"__cWid": 32,
"__cHei": 18,
"__gridSize": 8,
"__opacity": 1,
"__pxTotalOffsetX": 0,
"__pxTotalOffsetY": 0,
"__tilesetDefUid": null,
"__tilesetRelPath": null,
"iid": "fc4c16e1-b0a0-11ee-9688-91ca54d577bf",
"levelId": 115,
"layerDefUid": 109,
"pxOffsetX": 0,
"pxOffsetY": 0,
"visible": true,
"optionalRules": [],
"intGridCsv": [],
"autoLayerTiles": [],
"seed": 3325108,
"overrideTilesetUid": null,
"gridTiles": [],
"entityInstances": []
}
],
"__neighbours": [ { "levelIid": "44be1120-b0a0-11ee-9688-9bb02c281059", "dir": "sw" }, { "levelIid": "83bcbf40-b0a0-11ee-9688-274a3797c34e", "dir": "w" }, { "levelIid": "9cfeb340-b0a0-11ee-9688-372759f9430d", "dir": "n" } ]
@ -6766,6 +6773,31 @@
"externalRelPath": null,
"fieldInstances": [],
"layerInstances": [
{
"__identifier": "entities",
"__type": "Entities",
"__cWid": 32,
"__cHei": 18,
"__gridSize": 8,
"__opacity": 1,
"__pxTotalOffsetX": 0,
"__pxTotalOffsetY": 0,
"__tilesetDefUid": null,
"__tilesetRelPath": null,
"iid": "9cfeb342-b0a0-11ee-9688-893b5cec4ff7",
"levelId": 116,
"layerDefUid": 109,
"pxOffsetX": 0,
"pxOffsetY": 0,
"visible": true,
"optionalRules": [],
"intGridCsv": [],
"autoLayerTiles": [],
"seed": 6743182,
"overrideTilesetUid": null,
"gridTiles": [],
"entityInstances": []
},
{
"__identifier": "conceptual",
"__type": "IntGrid",
@ -6808,31 +6840,6 @@
"overrideTilesetUid": null,
"gridTiles": [],
"entityInstances": []
},
{
"__identifier": "entities",
"__type": "Entities",
"__cWid": 32,
"__cHei": 18,
"__gridSize": 8,
"__opacity": 1,
"__pxTotalOffsetX": 0,
"__pxTotalOffsetY": 0,
"__tilesetDefUid": null,
"__tilesetRelPath": null,
"iid": "9cfeb342-b0a0-11ee-9688-893b5cec4ff7",
"levelId": 116,
"layerDefUid": 109,
"pxOffsetX": 0,
"pxOffsetY": 0,
"visible": true,
"optionalRules": [],
"intGridCsv": [],
"autoLayerTiles": [],
"seed": 6743182,
"overrideTilesetUid": null,
"gridTiles": [],
"entityInstances": []
}
],
"__neighbours": [ { "levelIid": "83bcbf40-b0a0-11ee-9688-274a3797c34e", "dir": "sw" }, { "levelIid": "fc4befd0-b0a0-11ee-9688-7b6d330109d6", "dir": "s" } ]

View File

@ -1,6 +1,7 @@
import sys
import json
import shared
import textwrap
TEMPLATE = """
// generated code! be nice
@ -136,7 +137,7 @@ def format_field_value(ty, val):
elif ty == "String":
if val is None:
return "NULL", "scalar", "const char*"
return json.dumps(val), "scalar" # this is close enough to being right in C
return json.dumps(wrap(val)), "scalar" # this is close enough to being right in C
elif ty == "Array<Int>":
return [format_field_value("Int", i)[0] for i in val], "array", "sys_i32"
elif ty == "Array<String>":
@ -145,6 +146,9 @@ def format_field_value(ty, val):
assert False, f"unknown type: {ty}"
def wrap(s):
return textwrap.fill(s, width=28)
def annot_xy(lst, w, h):
assert len(lst) == w * h
for y in range(h):