Skip to content

Commit

Permalink
Added 'sortby' field to OBJECTS resource (thanks Iratahack)
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephane-D committed Feb 25, 2025
1 parent a8e9012 commit e468c53
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Binary file modified bin/rescomp.jar
Binary file not shown.
7 changes: 4 additions & 3 deletions bin/rescomp.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ResComp 3.92 (January 2025)
ResComp 3.93 (February 2025)
Copyright Stephane Dallongeville
https://github.com/Stephane-D/SGDK

Expand Down Expand Up @@ -285,11 +285,12 @@ The Tiled objects has some default attributes that you can use:
To enable export of these fields, you need to add a custom boolean 'exportSize' field and set its value to 'true'.

Syntax:
OBJECTS name tmx_file layer_id field_defs [decl_type [type_filter]]
OBJECTS name tmx_file layer_id field_defs [sortby:<field>] [decl_type [type_filter]]

name name of the output array Objects structure
tmx_file path of the input TMX file (TMX Tiled file)
layer_id object group/layer name we want to export object from.
sortby field name to sort objects by. e.g. "sortby:x" to sort objects by x position.
field_defs name and type of fields we want to export (also define the order of extraction) in <name>:<type> format.
Field type can be any of the usual SGDK base type: u8, s8, u16, s16, u32, s32, f16, f32, bool, string, object
Some examples of 'field_defs' declaration:
Expand All @@ -301,7 +302,7 @@ OBJECTS name tmx_file layer_id field_defs [decl_type [type_filter]]
type_filter define a type filter if we only want to extract Tiled objects of a specific type (see above).

Tips:
- Objects are sorted (ascending order) using the values of these fields (in this order): 'index', 'ind', 'tileIndex', 'id' .
- When 'sortby' is not used, objects are sorted (ascending order) using the values of these fields (in this order): 'index', 'ind', 'tileIndex', 'id'.
- You can export the tile index value corresponding to x + (y * map_width)) in 'tileIndex' field by adding a custom boolean 'exportTileIndex'
field with value set to 'true'. When you enable the 'tileIndex' export then objects are sorted (ascending order) using the field value
allowing fast tile index based searchs (be careful: 'index' or 'ind' fields has priority for sorting if they exist).
Expand Down

0 comments on commit e468c53

Please sign in to comment.