Alignement entre converters.py et game.h

This commit is contained in:
attilavs2 2024-07-28 22:03:11 +02:00
parent 82a519659d
commit 32764e675a
2 changed files with 63 additions and 15 deletions

View file

@ -267,7 +267,7 @@ def get_extra_map_data(input, output, params, target, xmin, ymin, xmax, ymax):
tpe = i["type"] tpe = i["type"]
#we check if the type corresponds to a items of type Point in Tiled #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() currData = fxconv.Structure()
x = i["x"] + xmin x = i["x"] + xmin
@ -333,20 +333,27 @@ def get_extra_map_data(input, output, params, target, xmin, ymin, xmax, ymax):
print( " Action?= ", needAction ) print( " Action?= ", needAction )
currData += fxconv.u32(0)
currData += fxconv.u32(0)
currData += fxconv.u32( int(x) ) currData += fxconv.u32( int(x) )
currData += fxconv.u32( int(y) ) currData += fxconv.u32( int(y) )
currData += fxconv.string( nme )
currData += fxconv.string( tpe ) currData += fxconv.u16(0) #TODO : faceid
currData += fxconv.string(face_type)
currData += fxconv.u8(0)
currData += fxconv.u8(1)
currData += fxconv.u32( int(dialogID) ) currData += fxconv.u32( int(dialogID) )
currData += fxconv.u32( int(needAction) ) currData += fxconv.u32( int(needAction) )
currData += fxconv.string( nme )
if path==0: if path==0:
currData += fxconv.u32(0) currData += fxconv.u32(0)
currData += fxconv.u32(0) currData += fxconv.u32(0)
currData += fxconv.u32(0) currData += fxconv.u32(0)
currData += fxconv.u32(0) currData += fxconv.u32(0)
currData += fxconv.u32(0)
else: else:
o_xdata = fxconv.Structure() o_xdata = fxconv.Structure()
o_xdata += xdata 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)
currData += fxconv.u32(path_length) currData += fxconv.u32(path_length)
currData += fxconv.u32(0)
currData += fxconv.ptr(o_xdata) currData += fxconv.ptr(o_xdata)
currData += fxconv.ptr(o_ydata) currData += fxconv.ptr(o_ydata)
if tpe == "SGN" or tpe == "INFO": #TODO
nbSign += 1 currData += fxconv.i32(0)
signs += currData 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: else:
nbNPC += 1 icon = 1
signs += currData
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": elif tpe == "PORTAL":
nbPortal+=1 nbPortal+=1

View file

@ -73,7 +73,7 @@ typedef struct
uint32_t x; uint32_t x;
uint32_t y; uint32_t y;
/*id of it's icon*/ /*id of it's icon*/
uint16_t icon; uint32_t icon;
char *name; char *name;
@ -96,9 +96,9 @@ typedef struct
/* id of it's face*/ /* id of it's face*/
uint16_t 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 */ /* the ID of the first element of the dialog */
/* (to be aligned with "dialogs.json" IDs)*/ /* (to be aligned with "dialogs.json" IDs)*/
uint32_t dialogID; uint32_t dialogID;
@ -116,8 +116,10 @@ typedef struct
int type; int type;
int8_t current_group; uint8_t current_group;
int8_t hostile_to_group; uint8_t hostile_to_group;
uint16_t __padding;
} NPC; } NPC;