From 5b74a5e4b991ba9b8c21252e37d85ae9d6482cd4 Mon Sep 17 00:00:00 2001 From: attilavs2 Date: Sat, 19 Aug 2023 15:34:26 +0200 Subject: [PATCH] Solved TLB miss by changing bytes() to bytes("", "UTF-16") --- assets/converters.py | 14 ++++++++------ src/npc.c | 4 ++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/assets/converters.py b/assets/converters.py index a942fa6..6108a85 100644 --- a/assets/converters.py +++ b/assets/converters.py @@ -7,8 +7,7 @@ import os def convert(input, output, params, target): if params["custom-type"] == "map": - #convert_map(input, output, params, target) - #return 0 + print("ERROR : Asset ", params["name"], " has legacy type map") return 1 elif params["custom-type"] == "world": convert_world(input, output, params, target) @@ -208,8 +207,7 @@ def get_tile_map_data(input, output, params, target, xmin, ymin, xmax, ymax): def get_extra_map_data(input, output, params, target, xmin, ymin, xmax, ymax): print( "WE ARE COMPUTING THE EXTRA DATA OF THE MAP : ", input ) data = json.load(open(input, "r")) - - + nblayer = ["id" in i for i in data["layers"]].count(True) - 1 print( "I found ", nblayer, " of extradata") @@ -288,13 +286,17 @@ def get_extra_map_data(input, output, params, target, xmin, ymin, xmax, ymax): for v in layer["objects"]: if v[ "id" ] == pathID: print( "path data found : " ) - xdata = bytes() - ydata = bytes() + + xdata = bytes("", "UTF-16") + ydata = bytes("", "UTF-16") + for w in v[ "polyline" ]: path_length = path_length + 1 print( "X= ", w[ "x" ], " Y= ", w[ "y" ] ) xdata += fxconv.u16( int( w[ "x" ] ) ) ydata += fxconv.u16( int( w[ "y" ] ) ) + print("xdata : ", xdata) + print("ydata : ", ydata) else: print( "PNJ has no Path" ) diff --git a/src/npc.c b/src/npc.c index ca7b4a7..105355f 100644 --- a/src/npc.c +++ b/src/npc.c @@ -37,7 +37,7 @@ void npc_draw(Game *game) { for(int v=0; vxpath[v % NbPoints] * PXSIZE))-(int16_t) player->wx; int16_t deltaY1=((int16_t) (Data->ypath[v % NbPoints] * PXSIZE))-(int16_t) player->wy; @@ -47,7 +47,7 @@ void npc_draw(Game *game) { dline( player->px + deltaX1, player->py + deltaY1, player->px + deltaX2, player->py + deltaY2, PATH_COLOR); - */ + }