mirror of
https://git.planet-casio.com/Slyvtt/Collab_RPG.git
synced 2024-12-28 04:23:42 +01:00
Converting portals. Not tested yet.
This commit is contained in:
parent
d34398f9b9
commit
48f1f44b5b
8 changed files with 75 additions and 18 deletions
|
@ -47,6 +47,8 @@ set(ASSETS
|
||||||
assets/level2.tmx
|
assets/level2.tmx
|
||||||
assets/level3.tmx
|
assets/level3.tmx
|
||||||
assets/level4.tmx
|
assets/level4.tmx
|
||||||
|
assets/interior1_0_dialogs.json
|
||||||
|
assets/interior1_0.tmx
|
||||||
# ...
|
# ...
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -69,6 +69,9 @@ def convert_map(input: str, output: str, params: dict, target):
|
||||||
npc_paths = {}
|
npc_paths = {}
|
||||||
npcs = {}
|
npcs = {}
|
||||||
signs = {}
|
signs = {}
|
||||||
|
portals = {}
|
||||||
|
|
||||||
|
name = os.path.splitext(os.path.basename(input))[0]
|
||||||
|
|
||||||
map_struct = fxconv.Structure()
|
map_struct = fxconv.Structure()
|
||||||
|
|
||||||
|
@ -226,6 +229,17 @@ def convert_map(input: str, output: str, params: dict, target):
|
||||||
"icon": SIGN_TYPES.index(object.type)
|
"icon": SIGN_TYPES.index(object.type)
|
||||||
}
|
}
|
||||||
signs[object.id] = data
|
signs[object.id] = data
|
||||||
|
# Get the portals
|
||||||
|
for object in ed_objgroup.objects:
|
||||||
|
if (object.get_data_type() == "rectangle"
|
||||||
|
and object.type == "PORTAL"):
|
||||||
|
data = {
|
||||||
|
"rect": object.get_data(),
|
||||||
|
"name": object.name,
|
||||||
|
"dest": object.get_property("dest"),
|
||||||
|
"destPortal": object.get_property("destPortal")
|
||||||
|
}
|
||||||
|
portals[object.id] = data
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
# Show a simple error message on failure.
|
# Show a simple error message on failure.
|
||||||
sys.stderr.write(f"ERROR: Failed to get the extra data.\n"
|
sys.stderr.write(f"ERROR: Failed to get the extra data.\n"
|
||||||
|
@ -297,8 +311,23 @@ def convert_map(input: str, output: str, params: dict, target):
|
||||||
sign_struct += fxconv.u32(i["needAction"])
|
sign_struct += fxconv.u32(i["needAction"])
|
||||||
map_struct += fxconv.ptr(sign_struct)
|
map_struct += fxconv.ptr(sign_struct)
|
||||||
# Load portals
|
# Load portals
|
||||||
map_struct += fxconv.u32(0) # TODO: Portal support in-game
|
map_struct += fxconv.u32(len(portals))
|
||||||
map_struct += fxconv.ptr(bytes())
|
portal_struct = fxconv.Structure()
|
||||||
|
for i in portals.values():
|
||||||
|
dest_file_name = os.path.splitext(os.path.basename(i["dest"]))[0]
|
||||||
|
dest_portal = i["destPortal"]
|
||||||
|
portal_name = i["name"]
|
||||||
|
if VERBOSE: print(f"INFO: Storing portal {name}_{portal_name}")
|
||||||
|
portal_struct += fxconv.sym(f"{name}_{portal_name}")
|
||||||
|
# Add the collider
|
||||||
|
rect = i["rect"]
|
||||||
|
portal_struct += fxconv.u32(rect[0])
|
||||||
|
portal_struct += fxconv.u32(rect[1])
|
||||||
|
portal_struct += fxconv.u32(rect[2])
|
||||||
|
portal_struct += fxconv.u32(rect[3])
|
||||||
|
# Add a reference to the destination portal
|
||||||
|
portal_struct += fxconv.ref(f"{dest_file_name}_{dest_portal}")
|
||||||
|
map_struct += fxconv.ptr(portal_struct)
|
||||||
map_struct += fxconv.u32(dialog_num)
|
map_struct += fxconv.u32(dialog_num)
|
||||||
|
|
||||||
# Get the name of the dialog file and create a reference to it: it is built
|
# Get the name of the dialog file and create a reference to it: it is built
|
||||||
|
@ -319,7 +348,6 @@ def convert_map(input: str, output: str, params: dict, target):
|
||||||
map_struct += fxconv.ptr(foreground_data)
|
map_struct += fxconv.ptr(foreground_data)
|
||||||
|
|
||||||
# Create the fxconv object
|
# Create the fxconv object
|
||||||
name = os.path.splitext(os.path.basename(input))[0]
|
|
||||||
fxconv.elf(map_struct, output, f"_{name}", **target)
|
fxconv.elf(map_struct, output, f"_{name}", **target)
|
||||||
|
|
||||||
def convert_dialog(input: str, output: str, params: dict, target):
|
def convert_dialog(input: str, output: str, params: dict, target):
|
||||||
|
|
|
@ -37,3 +37,11 @@ level3_dialogs.json:
|
||||||
level4_dialogs.json:
|
level4_dialogs.json:
|
||||||
custom-type: dialog
|
custom-type: dialog
|
||||||
name: level4_dialogs
|
name: level4_dialogs
|
||||||
|
|
||||||
|
interior1_0.tmx:
|
||||||
|
custom-type: tmx
|
||||||
|
name: level0
|
||||||
|
|
||||||
|
interior1_0_dialogs.json:
|
||||||
|
custom-type: dialog
|
||||||
|
name: interior1_0_dialogs
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<map version="1.8" tiledversion="1.8.2" orientation="orthogonal" renderorder="right-down" width="12" height="8" tilewidth="8" tileheight="8" infinite="0" nextlayerid="5" nextobjectid="2">
|
<map version="1.8" tiledversion="1.8.2" orientation="orthogonal" renderorder="right-down" width="12" height="8" tilewidth="8" tileheight="8" infinite="0" nextlayerid="5" nextobjectid="3">
|
||||||
|
<properties>
|
||||||
|
<property name="dialogFile" type="file" value="interior1_0_dialogs.json"/>
|
||||||
|
<property name="mapX" type="int" value="65536"/>
|
||||||
|
<property name="mapY" type="int" value="65536"/>
|
||||||
|
</properties>
|
||||||
<tileset firstgid="1" source="tilesetnpp.tsx"/>
|
<tileset firstgid="1" source="tilesetnpp.tsx"/>
|
||||||
<tileset firstgid="409" source="Walkable.tsx"/>
|
<tileset firstgid="409" source="Walkable.tsx"/>
|
||||||
<layer id="1" name="Background" width="12" height="8">
|
<layer id="1" name="Background" width="12" height="8">
|
||||||
|
@ -39,14 +44,11 @@
|
||||||
</data>
|
</data>
|
||||||
</layer>
|
</layer>
|
||||||
<objectgroup id="4" name="ExtraData">
|
<objectgroup id="4" name="ExtraData">
|
||||||
<object id="1" name="Porte" type="PORTAL" x="47.862" y="63.6163">
|
<object id="2" name="porte" type="PORTAL" x="39.9918" y="56.0098" width="15.8058" height="7.84986">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="h" value="1"/>
|
<property name="dest" type="file" value="level0.tmx"/>
|
||||||
<property name="tp_interior" value="0"/>
|
<property name="destPortal" value="taverne"/>
|
||||||
<property name="tp_to" value="0"/>
|
|
||||||
<property name="w" value="2"/>
|
|
||||||
</properties>
|
</properties>
|
||||||
<point/>
|
|
||||||
</object>
|
</object>
|
||||||
</objectgroup>
|
</objectgroup>
|
||||||
</map>
|
</map>
|
13
assets/interior1_0_dialogs.json
Normal file
13
assets/interior1_0_dialogs.json
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
{ "dialogs":[
|
||||||
|
{ "ID":0,
|
||||||
|
"dialog":"_",
|
||||||
|
"isQuestion":0,
|
||||||
|
"choice":"_",
|
||||||
|
"conclusion1":"_",
|
||||||
|
"next1":-1,
|
||||||
|
"conclusion2":"_",
|
||||||
|
"next2":-1,
|
||||||
|
"nextOther":1
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-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="8" nextobjectid="14">
|
<map version="1.8" tiledversion="1.8.2" orientation="orthogonal" renderorder="right-down" width="48" height="24" tilewidth="8" tileheight="8" infinite="0" nextlayerid="8" nextobjectid="17">
|
||||||
<editorsettings>
|
<editorsettings>
|
||||||
<export target="level0.json" format="json"/>
|
<export target="level0.json" format="json"/>
|
||||||
</editorsettings>
|
</editorsettings>
|
||||||
|
@ -173,5 +173,11 @@
|
||||||
<object id="13" name="Chemin 100pas Client Auberge" type="TRJ" x="267.25" y="126.25">
|
<object id="13" name="Chemin 100pas Client Auberge" type="TRJ" x="267.25" y="126.25">
|
||||||
<polyline points="0,0 -30.5,16.75 -182.5,15.75 -195.25,-26 -183.25,16.5 -29.25,18.5"/>
|
<polyline points="0,0 -30.5,16.75 -182.5,15.75 -195.25,-26 -183.25,16.5 -29.25,18.5"/>
|
||||||
</object>
|
</object>
|
||||||
|
<object id="16" name="taverne" type="PORTAL" x="128.974" y="111.676" width="14.7688" height="7.99134">
|
||||||
|
<properties>
|
||||||
|
<property name="dest" type="file" value="interior1_0.tmx"/>
|
||||||
|
<property name="destPortal" value="porte"/>
|
||||||
|
</properties>
|
||||||
|
</object>
|
||||||
</objectgroup>
|
</objectgroup>
|
||||||
</map>
|
</map>
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit f426664f4444d4c8a6054bc7b69fb676ed43bcaa
|
Subproject commit b084ecda91a2352a72a5d1a61b37e0009228ee40
|
10
src/game.h
10
src/game.h
|
@ -12,8 +12,8 @@ typedef enum { D_UP, D_DOWN, D_LEFT, D_RIGHT } Direction;
|
||||||
typedef enum { P_LEFTUP = -1, P_CENTER = 0, P_RIGHTDOWN = 1 } Checkpos;
|
typedef enum { P_LEFTUP = -1, P_CENTER = 0, P_RIGHTDOWN = 1 } Checkpos;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint32_t x, y;
|
uint32_t x1, y1;
|
||||||
uint32_t w, h;
|
uint32_t x2, y2;
|
||||||
|
|
||||||
} Collider;
|
} Collider;
|
||||||
|
|
||||||
|
@ -109,10 +109,8 @@ typedef struct {
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Collider collider;
|
Collider collider;
|
||||||
/*if the portal tps to an interior or exterior map*/
|
/* The destination portal */
|
||||||
uint16_t tp_interior;
|
void *portal;
|
||||||
/*Id of the interior/exterior map to transport the player to*/
|
|
||||||
uint16_t tp_to;
|
|
||||||
} Portal;
|
} Portal;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
Loading…
Reference in a new issue