Abt to update mapcompile into files

This commit is contained in:
2025-06-23 09:26:42 -05:00
parent 5d92f54f52
commit 344aaa7e4f
7 changed files with 77 additions and 44 deletions

View File

@ -10,5 +10,18 @@
"properties": [
],
"propertyTypes": [
{
"id": 1,
"name": "npcInteractType",
"storageType": "string",
"type": "enum",
"values": [
"NPC_INTERACT_TYPE_NONE",
"NPC_INTERACT_TYPE_TEXT",
"NPC_INTERACT_TYPE_CONVO",
"NPC_INTERACT_TYPE_EVENT"
],
"valuesAsFlags": false
}
]
}

View File

@ -1,5 +1,5 @@
{
"activeFile": "minogram.tsx",
"activeFile": "map.tmj",
"expandedProjectPaths": [
"templates",
"."
@ -16,8 +16,8 @@
"scale": 3,
"selectedLayer": 2,
"viewCenter": {
"x": 6520.166666666666,
"y": 6836.833333333333
"x": 6585.833333333333,
"y": 6840.833333333333
}
},
"minogram.tsx": {
@ -33,16 +33,14 @@
"last.imagePath": "/home/yourwishes/htdocs/dusk/data",
"last.objectTemplatePath": "/home/yourwishes/htdocs/dusk/data/templates",
"openFiles": [
"map.tmj",
"overworld.tsx",
"minogram.tsx"
"map.tmj"
],
"project": "map project.tiled-project",
"property.type": "int",
"property.type": "string",
"recentFiles": [
"map.tmj",
"overworld.tsx",
"minogram.tsx",
"overworld.tsx",
"entities.tsx"
],
"tileset.lastUsedFilter": "Tiled tileset files (*.tsx *.xml)",

View File

@ -410,12 +410,6 @@
"id":3,
"name":"Object Layer 1",
"objects":[
{
"id":4,
"template":"templates\/NPC.tx",
"x":6650.41666666667,
"y":6753.58333333334
},
{
"gid":257,
"height":16,
@ -425,32 +419,26 @@
"type":"player_spawn",
"visible":true,
"width":16,
"x":6384.58333333333,
"y":6846.91666666667
"x":6578.25,
"y":6794.25
},
{
"id":7,
"id":13,
"properties":[
{
"name":"interactText",
"type":"string",
"value":"test.npc.text"
},
{
"name":"interactType",
"propertytype":"npcInteractType",
"type":"string",
"value":"NPC_INTERACT_TYPE_TEXT"
}],
"template":"templates\/NPC.tx",
"x":6383.25,
"y":6880.08333333333
},
{
"id":8,
"template":"templates\/NPC.tx",
"x":6559,
"y":6754.75
},
{
"id":9,
"template":"templates\/NPC.tx",
"x":6376.33333333333,
"y":6720.33333333333
},
{
"id":10,
"template":"templates\/NPC.tx",
"x":6697,
"y":6769.08333333333
"x":6575,
"y":6837.33333333333
}],
"opacity":1,
"type":"objectgroup",
@ -459,7 +447,7 @@
"y":0
}],
"nextlayerid":6,
"nextobjectid":13,
"nextobjectid":14,
"orientation":"orthogonal",
"renderorder":"right-down",
"tiledversion":"1.11.1",

View File

@ -1,5 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<template>
<tileset firstgid="1" source="../entities.tsx"/>
<object name="NPC" type="npc" gid="1" width="16" height="16"/>
<object name="NPC" type="ENTITY_TYPE_NPC" gid="1" width="16" height="16">
<properties>
<property name="interactText" value=""/>
<property name="interactType" propertytype="npcInteractType" value="NPC_INTERACT_TYPE_NONE"/>
</properties>
</object>
</template>

View File

@ -5,7 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#include "npc.h"
#include "entity.h"
#include "ui/uitextbox.h"
#include "locale/language.h"
#include "assert/assert.h"
@ -19,6 +19,25 @@ void npcUpdate(entity_t *entity) {
}
void npcInteract(entity_t *player, entity_t *self) {
assertTrue(self->type == ENTITY_TYPE_NPC, "Entity must be of type NPC");
switch(self->npc.interactType) {
case NPC_INTERACT_TYPE_NONE:
break;
case NPC_INTERACT_TYPE_TEXT:
break;
case NPC_INTERACT_TYPE_CONVO:
break;
case NPC_INTERACT_TYPE_EVENT:
break;
default:
assertUnreachable("Unknown NPC interaction type");
}
// uiTextboxSetText(
// "Hello World how are you today? Hope things are going well for you! I am "
// "having a great day, hope you are too. Did I ever tell you about the tragedy "

View File

@ -4,8 +4,21 @@
typedef struct _entity_t entity_t;
#define NPC_INTERACT_TEXTS_MAX 4
typedef enum {
NPC_INTERACT_TYPE_NONE = 0,
NPC_INTERACT_TYPE_TEXT = 1,
NPC_INTERACT_TYPE_CONVO = 2,
NPC_INTERACT_TYPE_EVENT = 3,
} npcinteracttype_t;
typedef struct {
uint32_t nothing;
npcinteracttype_t interactType;
union {
char_t* texts[NPC_INTERACT_TEXTS_MAX];
};
} npc_t;
/**

View File

@ -185,7 +185,6 @@ for layerIndex, layer in enumerate(tileLayers):
# Pre generate entity data
nextEntityId = 100
for obIndex, ob in enumerate(objectLayer['objects']):
if 'x' not in ob or 'y' not in ob:
print(f"Error: Object in object layer does not contain 'x' or 'y' key.")
@ -200,8 +199,6 @@ for obIndex, ob in enumerate(objectLayer['objects']):
# Round off the coordinates
ob['x'] = round(ob['x'])
ob['y'] = round(ob['y'])
ob['id'] = nextEntityId
nextEntityId += 1
objectLayer['objects'][obIndex] = ob