From 32764e675acd2b759b42d7af126145f20ca75bbd Mon Sep 17 00:00:00 2001 From: attilavs2 Date: Sun, 28 Jul 2024 22:03:11 +0200 Subject: [PATCH] Alignement entre converters.py et game.h --- assets/converters.py | 66 +++++++++++++++++++++++++++++++++++++------- src/game.h | 12 ++++---- 2 files changed, 63 insertions(+), 15 deletions(-) diff --git a/assets/converters.py b/assets/converters.py index 95356ea..ad29f80 100644 --- a/assets/converters.py +++ b/assets/converters.py @@ -267,7 +267,7 @@ def get_extra_map_data(input, output, params, target, xmin, ymin, xmax, ymax): tpe = i["type"] #we check if the type corresponds to a items of type Point in Tiled - if tpe in ( "SGN", "NPC", "INFO"): + if tpe in ("NPC"): currData = fxconv.Structure() x = i["x"] + xmin @@ -333,20 +333,27 @@ def get_extra_map_data(input, output, params, target, xmin, ymin, xmax, ymax): print( " Action?= ", needAction ) - + currData += fxconv.u32(0) + currData += fxconv.u32(0) currData += fxconv.u32( int(x) ) currData += fxconv.u32( int(y) ) - currData += fxconv.string( nme ) - currData += fxconv.string( tpe ) - currData += fxconv.string(face_type) + + currData += fxconv.u16(0) #TODO : faceid + + currData += fxconv.u8(0) + + currData += fxconv.u8(1) currData += fxconv.u32( int(dialogID) ) currData += fxconv.u32( int(needAction) ) + currData += fxconv.string( nme ) + if path==0: currData += fxconv.u32(0) currData += fxconv.u32(0) currData += fxconv.u32(0) currData += fxconv.u32(0) + currData += fxconv.u32(0) else: o_xdata = fxconv.Structure() o_xdata += xdata @@ -355,15 +362,54 @@ def get_extra_map_data(input, output, params, target, xmin, ymin, xmax, ymax): currData += fxconv.u32(path) currData += fxconv.u32(path_length) + currData += fxconv.u32(0) currData += fxconv.ptr(o_xdata) currData += fxconv.ptr(o_ydata) - if tpe == "SGN" or tpe == "INFO": - nbSign += 1 - signs += currData + #TODO + currData += fxconv.i32(0) + currData += fxconv.u8(0) + currData += fxconv.u8(0) + + currData += fxconv.u16(0) + + nbNPC += 1 + signs += currData + + elif tpe in ["SGN", "INFO"]: + currData = fxconv.Structure() + + x = i["x"] + xmin + y = i["y"] + ymin + nme = i["name"] + if tpe == "SIGN": + icon = 0 else: - nbNPC += 1 - signs += currData + icon = 1 + + dialogID = None + needAction = None + + #we now fill all the properties of this item + for j in i["properties"]: + #property "dialog" + if j["name"]=="dialogID": + dialogID = j[ "value" ] + nbDiag += 1 + #property "isQuestion" + elif j["name"]=="needAction": needAction = j[ "value" ] + else: + print( "UNIDENTIFIED PROPERTY : ", j["name"]) + + currData += fxconv.u32( int(x) ) + currData += fxconv.u32( int(y) ) + currData += fxconv.u32(icon) + currData += fxconv.string( nme ) + currData += fxconv.u32( int(dialogID) ) + currData += fxconv.u32( int(needAction) ) + + nbSign += 1 + signs += currData elif tpe == "PORTAL": nbPortal+=1 diff --git a/src/game.h b/src/game.h index 2925135..d419115 100644 --- a/src/game.h +++ b/src/game.h @@ -73,7 +73,7 @@ typedef struct uint32_t x; uint32_t y; /*id of it's icon*/ - uint16_t icon; + uint32_t icon; char *name; @@ -96,9 +96,9 @@ typedef struct /* id of it's face*/ uint16_t face; - bool paused; + uint8_t paused; - bool has_dialogue; + uint8_t has_dialogue; /* the ID of the first element of the dialog */ /* (to be aligned with "dialogs.json" IDs)*/ uint32_t dialogID; @@ -116,8 +116,10 @@ typedef struct int type; - int8_t current_group; - int8_t hostile_to_group; + uint8_t current_group; + uint8_t hostile_to_group; + + uint16_t __padding; } NPC;