mirror of
https://git.planet-casio.com/Slyvtt/Collab_RPG.git
synced 2025-05-28 14:35:18 +02:00
Added sign support back
This commit is contained in:
parent
563ed47753
commit
da63b8ce06
8 changed files with 48 additions and 24 deletions
|
@ -7,7 +7,8 @@ import fxconv
|
|||
from tiled import *
|
||||
|
||||
VERBOSE = 1
|
||||
SIGN_TYPES = ["INFO", "SGN"]
|
||||
SIGN_TYPES = ["SGN", "INFO"]
|
||||
FACES = ["MALE", "FEMALE", "MILKMAN", "POLICE"]
|
||||
|
||||
def convert(input, output, params, target):
|
||||
if params["custom-type"] == "tmx":
|
||||
|
@ -49,6 +50,17 @@ def convert_map(input, output, params, target):
|
|||
+ f" Error message: {e}\n")
|
||||
sys.exit(1)
|
||||
|
||||
# Get the map position
|
||||
try:
|
||||
if VERBOSE: print("INFO: Getting the map position")
|
||||
map_x = int(input_map.get_property("mapX"))
|
||||
map_y = int(input_map.get_property("mapY"))
|
||||
if VERBOSE: print(f"INFO: Map position: ({map_x}, {map_y}).")
|
||||
except Exception as e:
|
||||
sys.stderr.write(f"ERROR: Failed to get the map position.\n"
|
||||
+ f" Error message: {e}\n")
|
||||
sys.exit(1)
|
||||
|
||||
# Get informations about dialogs
|
||||
try:
|
||||
if VERBOSE: print("INFO: Getting informations about dialogs")
|
||||
|
@ -148,9 +160,10 @@ def convert_map(input, output, params, target):
|
|||
raise Exception("Path required but not found!")
|
||||
data = {
|
||||
"position": object.get_data(),
|
||||
"needAction": object.get_property("needAction"),
|
||||
"dialogID": object.get_property("dialogID"),
|
||||
#"face": object.get_property("face"),
|
||||
"name": object.name,
|
||||
"needAction": int(object.get_property("needAction")),
|
||||
"dialogID": int(object.get_property("dialogID")),
|
||||
"face": FACES.index(object.get_property("face")),
|
||||
"path": path
|
||||
}
|
||||
npcs[object.id] = data
|
||||
|
@ -158,8 +171,11 @@ def convert_map(input, output, params, target):
|
|||
for object in ed_objgroup.objects:
|
||||
if object.get_data_type() == "point" and object.type in SIGN_TYPES:
|
||||
data = {
|
||||
"needAction": object.get_property("needAction"),
|
||||
"dialogID": object.get_property("dialogID")
|
||||
"position": object.get_data(),
|
||||
"name": object.name,
|
||||
"needAction": int(object.get_property("needAction")),
|
||||
"dialogID": int(object.get_property("dialogID")),
|
||||
"icon": SIGN_TYPES.index(object.type)
|
||||
}
|
||||
signs[object.id] = data
|
||||
except Exception as e:
|
||||
|
@ -187,8 +203,17 @@ def convert_map(input, output, params, target):
|
|||
map_struct += fxconv.u32(0) # TODO: NPC support in-game
|
||||
map_struct += fxconv.ptr(bytes())
|
||||
# Load signs
|
||||
map_struct += fxconv.u32(0) # TODO: Sign support in-game
|
||||
map_struct += fxconv.ptr(bytes())
|
||||
map_struct += fxconv.u32(len(signs)) # TODO: Sign support in-game
|
||||
sign_struct = fxconv.Structure()
|
||||
for i in signs.values():
|
||||
sign_struct += fxconv.u32(i["position"][0])
|
||||
sign_struct += fxconv.u32(i["position"][1])
|
||||
sign_struct += fxconv.u32(i["icon"])
|
||||
sign_struct += fxconv.string(i["name"])
|
||||
sign_struct += fxconv.u32(i["dialogID"])
|
||||
sign_struct += fxconv.u32(i["needAction"])
|
||||
map_struct += fxconv.ptr(sign_struct)
|
||||
# Load portals
|
||||
map_struct += fxconv.u32(0) # TODO: Portal support in-game
|
||||
map_struct += fxconv.ptr(bytes())
|
||||
map_struct += fxconv.u32(dialog_num)
|
||||
|
@ -227,7 +252,7 @@ def convert_dialog(input, output, params, target):
|
|||
dialog_struct += fxconv.u32(dialog_id)
|
||||
dialog_struct += fxconv.string(i["dialog"])
|
||||
dialog_struct += fxconv.u32(i["isQuestion"])
|
||||
dialog_struct += fxconv.string(i["choice"])
|
||||
dialog_struct += fxconv.string(i["choice"].replace('$', '\0'))
|
||||
dialog_struct += fxconv.string(i["conclusion1"])
|
||||
dialog_struct += fxconv.u32(i["next1"])
|
||||
dialog_struct += fxconv.string(i["conclusion2"])
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
</editorsettings>
|
||||
<properties>
|
||||
<property name="dialogFile" type="file" value="level0_dialogs.json"/>
|
||||
<property name="mapX" type="int" value="0"/>
|
||||
<property name="mapY" type="int" value="0"/>
|
||||
</properties>
|
||||
<tileset firstgid="1" source="tilesetnpp.tsx"/>
|
||||
<tileset firstgid="409" source="Walkable.tsx"/>
|
||||
|
@ -117,6 +119,7 @@
|
|||
<object id="12" name="PNJ3" type="NPC" x="267.25" y="125.75">
|
||||
<properties>
|
||||
<property name="dialogID" type="int" value="12"/>
|
||||
<property name="face" value="FEMALE"/>
|
||||
<property name="hasPath" type="int" value="1"/>
|
||||
<property name="needAction" type="int" value="1"/>
|
||||
<property name="path" type="object" value="13"/>
|
||||
|
@ -126,6 +129,7 @@
|
|||
<object id="2" name="PNJ2" type="NPC" x="164" y="132">
|
||||
<properties>
|
||||
<property name="dialogID" type="int" value="5"/>
|
||||
<property name="face" value="MALE"/>
|
||||
<property name="hasPath" type="int" value="0"/>
|
||||
<property name="needAction" type="int" value="1"/>
|
||||
<property name="path" type="object" value="0"/>
|
||||
|
@ -135,6 +139,7 @@
|
|||
<object id="10" name="PNJ1" type="NPC" x="252" y="164">
|
||||
<properties>
|
||||
<property name="dialogID" type="int" value="7"/>
|
||||
<property name="face" value="MILKMAN"/>
|
||||
<property name="hasPath" type="int" value="1"/>
|
||||
<property name="needAction" type="int" value="1"/>
|
||||
<property name="path" type="object" value="9"/>
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
<map version="1.8" tiledversion="1.8.2" orientation="orthogonal" renderorder="right-down" width="48" height="24" tilewidth="8" tileheight="8" infinite="0" nextlayerid="5" nextobjectid="4">
|
||||
<properties>
|
||||
<property name="dialogFile" type="file" value="level1_dialogs.json"/>
|
||||
<property name="mapX" type="int" value="48"/>
|
||||
<property name="mapY" type="int" value="0"/>
|
||||
</properties>
|
||||
<tileset firstgid="1" source="tilesetnpp.tsx"/>
|
||||
<tileset firstgid="409" source="Walkable.tsx"/>
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
<map version="1.8" tiledversion="1.8.2" orientation="orthogonal" renderorder="right-down" width="48" height="24" tilewidth="8" tileheight="8" infinite="0" nextlayerid="5" nextobjectid="5">
|
||||
<properties>
|
||||
<property name="dialogFile" type="file" value="level2_dialogs.json"/>
|
||||
<property name="mapX" type="int" value="0"/>
|
||||
<property name="mapY" type="int" value="24"/>
|
||||
</properties>
|
||||
<tileset firstgid="1" source="tilesetnpp.tsx"/>
|
||||
<tileset firstgid="409" source="Walkable.tsx"/>
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
<map version="1.8" tiledversion="1.8.2" orientation="orthogonal" renderorder="right-down" width="48" height="24" tilewidth="8" tileheight="8" infinite="0" nextlayerid="5" nextobjectid="6">
|
||||
<properties>
|
||||
<property name="dialogFile" type="file" value="level3_dialogs.json"/>
|
||||
<property name="mapX" type="int" value="48"/>
|
||||
<property name="mapY" type="int" value="24"/>
|
||||
</properties>
|
||||
<tileset firstgid="1" source="tilesetnpp.tsx"/>
|
||||
<tileset firstgid="409" source="Walkable.tsx"/>
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
<map version="1.8" tiledversion="1.8.2" orientation="orthogonal" renderorder="right-down" width="48" height="24" tilewidth="8" tileheight="8" infinite="0" nextlayerid="6" nextobjectid="9">
|
||||
<properties>
|
||||
<property name="dialogFile" type="file" value="level4_dialogs.json"/>
|
||||
<property name="mapX" type="int" value="48"/>
|
||||
<property name="mapY" type="int" value="48"/>
|
||||
</properties>
|
||||
<tileset firstgid="1" source="tilesetnpp.tsx"/>
|
||||
<tileset firstgid="409" source="Walkable.tsx"/>
|
||||
|
@ -100,7 +102,7 @@
|
|||
<object id="6" name="NPC1" type="NPC" x="147.952" y="62.6849">
|
||||
<properties>
|
||||
<property name="dialogID" type="int" value="0"/>
|
||||
<property name="face" value="MAN"/>
|
||||
<property name="face" value="MALE"/>
|
||||
<property name="hasPath" type="int" value="1"/>
|
||||
<property name="needAction" type="int" value="1"/>
|
||||
<property name="path" type="object" value="8"/>
|
||||
|
|
|
@ -224,8 +224,3 @@ short int map_get_walkable(Game *game, int x, int y) {
|
|||
? map_level->walkable[y * map_level->w + x]
|
||||
: MAP_OUTSIDE;
|
||||
}
|
||||
|
||||
/* return the pointer to the map containing the given position */
|
||||
Map *map_get_for_coordinates(Game *game, int x, int y) {
|
||||
return game->map_level;
|
||||
}
|
||||
|
|
|
@ -50,13 +50,4 @@ short int map_get_tile(Game *game, int x, int y, int l);
|
|||
*/
|
||||
short int map_get_walkable(Game *game, int x, int y);
|
||||
|
||||
/* map_get_for_coordinates()
|
||||
*
|
||||
* return the pointer to the map containing the given position.
|
||||
* game: The game struct.
|
||||
* x: The coordinates to look at.
|
||||
* y: The coordinates to look at.
|
||||
*/
|
||||
Map *map_get_for_coordinates(Game *game, int x, int y);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue