mirror of
https://git.planet-casio.com/Slyvtt/Collab_RPG.git
synced 2024-12-28 20:43:42 +01:00
separated dialogs into 1 file per map with link in tmx + created dialog sequence/kinkage system + adjusted all maps data accordingly
This commit is contained in:
parent
4a81853505
commit
d81616ad38
22 changed files with 294 additions and 269 deletions
|
@ -31,7 +31,6 @@ set(SOURCES
|
||||||
# Shared assets, fx-9860G-only assets and fx-CG-50-only assets
|
# Shared assets, fx-9860G-only assets and fx-CG-50-only assets
|
||||||
set(ASSETS
|
set(ASSETS
|
||||||
assets/WorldRPG.world
|
assets/WorldRPG.world
|
||||||
assets/DialogsRPG.json
|
|
||||||
# ...
|
# ...
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
35
assets/DialogsLvl1.json
Normal file
35
assets/DialogsLvl1.json
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
{ "dialogs":[
|
||||||
|
{ "ID":0,
|
||||||
|
"dialog":"Le tombeau du Chevalier Legendaire",
|
||||||
|
"isQuestion":0,
|
||||||
|
"choice":"_",
|
||||||
|
"conclusion1":"_",
|
||||||
|
"next1":-1,
|
||||||
|
"conclusion2":"_",
|
||||||
|
"next2":-1,
|
||||||
|
"nextOther":1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ID":1,
|
||||||
|
"dialog":"Salut, je suis le gardien du Tombeau. As-tu remarque quelque chose d'etrange en venant ici ?",
|
||||||
|
"isQuestion":1,
|
||||||
|
"choice":"Rien de special$Des pas dans les bois",
|
||||||
|
"conclusion1":"Ok, soit prudent tout de meme",
|
||||||
|
"next1":2,
|
||||||
|
"conclusion2":"Je vais finir mon tour de ronde et verifier",
|
||||||
|
"next2":2,
|
||||||
|
"nextOther":-1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ID":2,
|
||||||
|
"dialog":"A bientot l'ami et prend garde aux brigands.",
|
||||||
|
"isQuestion":0,
|
||||||
|
"choice":"_",
|
||||||
|
"conclusion1":"_",
|
||||||
|
"next1":-1,
|
||||||
|
"conclusion2":"_",
|
||||||
|
"next2":-1,
|
||||||
|
"nextOther":-1
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
46
assets/DialogsLvl2.json
Normal file
46
assets/DialogsLvl2.json
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
{ "dialogs":[
|
||||||
|
{ "ID":0,
|
||||||
|
"dialog":"Encore une tombe ...",
|
||||||
|
"isQuestion":0,
|
||||||
|
"choice":"_",
|
||||||
|
"conclusion1":"_",
|
||||||
|
"next1":-1,
|
||||||
|
"conclusion2":"_",
|
||||||
|
"next2":-1,
|
||||||
|
"nextOther":-1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ID":1,
|
||||||
|
"dialog":"Un passage souterrain ...",
|
||||||
|
"isQuestion":0,
|
||||||
|
"choice":"_",
|
||||||
|
"conclusion1":"_",
|
||||||
|
"next1":-1,
|
||||||
|
"conclusion2":"_",
|
||||||
|
"next2":-1,
|
||||||
|
"nextOther":2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ID":2,
|
||||||
|
"dialog":"Je me demande bien ou il peut conduire. Une prochaine expedition a faire peut-etre ...",
|
||||||
|
"isQuestion":0,
|
||||||
|
"choice":"_",
|
||||||
|
"conclusion1":"_",
|
||||||
|
"next1":-1,
|
||||||
|
"conclusion2":"_",
|
||||||
|
"next2":-1,
|
||||||
|
"nextOther":-1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ID":3,
|
||||||
|
"dialog":"C'est la maison du gardien du cimetiere",
|
||||||
|
"isQuestion":0,
|
||||||
|
"choice":"_",
|
||||||
|
"conclusion1":"_",
|
||||||
|
"next1":-1,
|
||||||
|
"conclusion2":"_",
|
||||||
|
"next2":-1,
|
||||||
|
"nextOther":-1
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
59
assets/DialogsLvl3.json
Normal file
59
assets/DialogsLvl3.json
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
{
|
||||||
|
"dialogs": [
|
||||||
|
{
|
||||||
|
"ID": 0,
|
||||||
|
"dialog": "Maison du Fermier",
|
||||||
|
"isQuestion": 0,
|
||||||
|
"choice": "_",
|
||||||
|
"conclusion1": "_",
|
||||||
|
"next1": -1,
|
||||||
|
"conclusion2": "_",
|
||||||
|
"next2": -1,
|
||||||
|
"nextOther": -1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ID": 1,
|
||||||
|
"dialog": "Maison du Marechal Ferrand",
|
||||||
|
"isQuestion": 0,
|
||||||
|
"choice": "_",
|
||||||
|
"conclusion1": "_",
|
||||||
|
"next1": -1,
|
||||||
|
"conclusion2": "_",
|
||||||
|
"next2": -1,
|
||||||
|
"nextOther": -1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ID": 2,
|
||||||
|
"dialog": "Maison du Boucher",
|
||||||
|
"isQuestion": 0,
|
||||||
|
"choice": "_",
|
||||||
|
"conclusion1": "_",
|
||||||
|
"next1": -1,
|
||||||
|
"conclusion2": "_",
|
||||||
|
"next2": -1,
|
||||||
|
"nextOther": -1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ID": 3,
|
||||||
|
"dialog": "Maison du Boulanger",
|
||||||
|
"isQuestion": 0,
|
||||||
|
"choice": "_",
|
||||||
|
"conclusion1": "_",
|
||||||
|
"next1": -1,
|
||||||
|
"conclusion2": "_",
|
||||||
|
"next2": -1,
|
||||||
|
"nextOther": -1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ID": 4,
|
||||||
|
"dialog": "Maison du Maire",
|
||||||
|
"isQuestion": 0,
|
||||||
|
"choice": "_",
|
||||||
|
"conclusion1": "_",
|
||||||
|
"next1": -1,
|
||||||
|
"conclusion2": "_",
|
||||||
|
"next2": -1,
|
||||||
|
"nextOther": -1
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -6,6 +6,27 @@
|
||||||
"width": 384,
|
"width": 384,
|
||||||
"x": 0,
|
"x": 0,
|
||||||
"y": 0
|
"y": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fileName": "level1.tmx",
|
||||||
|
"height": 192,
|
||||||
|
"width": 384,
|
||||||
|
"x": 384,
|
||||||
|
"y": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fileName": "level2.tmx",
|
||||||
|
"height": 192,
|
||||||
|
"width": 384,
|
||||||
|
"x": 0,
|
||||||
|
"y": 192
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fileName": "level3.tmx",
|
||||||
|
"height": 192,
|
||||||
|
"width": 384,
|
||||||
|
"x": 384,
|
||||||
|
"y": 192
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"onlyShowAdjacentMaps": false,
|
"onlyShowAdjacentMaps": false,
|
||||||
|
|
|
@ -1,34 +0,0 @@
|
||||||
{
|
|
||||||
"maps": [
|
|
||||||
{
|
|
||||||
"fileName": "level0.tmx",
|
|
||||||
"height": 192,
|
|
||||||
"width": 384,
|
|
||||||
"x": 0,
|
|
||||||
"y": 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"fileName": "level1.tmx",
|
|
||||||
"height": 192,
|
|
||||||
"width": 384,
|
|
||||||
"x": 384,
|
|
||||||
"y": 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"fileName": "level2.tmx",
|
|
||||||
"height": 192,
|
|
||||||
"width": 384,
|
|
||||||
"x": 0,
|
|
||||||
"y": 192
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"fileName": "level3.tmx",
|
|
||||||
"height": 192,
|
|
||||||
"width": 384,
|
|
||||||
"x": 384,
|
|
||||||
"y": 192
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"onlyShowAdjacentMaps": false,
|
|
||||||
"type": "world"
|
|
||||||
}
|
|
|
@ -21,7 +21,8 @@ def convert(input, output, params, target):
|
||||||
convert_font(input, output, params, target)
|
convert_font(input, output, params, target)
|
||||||
return 0
|
return 0
|
||||||
elif params["custom-type"] == "dialogs":
|
elif params["custom-type"] == "dialogs":
|
||||||
convert_dialogs(input, output, params, target)
|
print("ERROR : Asset ", params["name"], " has legacy type dialog")
|
||||||
|
#convert_dialogs(input, output, params, target)
|
||||||
return 0
|
return 0
|
||||||
else:
|
else:
|
||||||
return 1
|
return 1
|
||||||
|
@ -148,6 +149,8 @@ def get_tile_map_data(input, output, params, target, xmin, ymin, xmax, ymax):
|
||||||
structMap += fxconv.ptr(walk_data)
|
structMap += fxconv.ptr(walk_data)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
nbextra = 0
|
nbextra = 0
|
||||||
extradata = fxconv.Structure()
|
extradata = fxconv.Structure()
|
||||||
|
|
||||||
|
@ -161,6 +164,26 @@ def get_tile_map_data(input, output, params, target, xmin, ymin, xmax, ymax):
|
||||||
structMap += fxconv.ptr( extradata )
|
structMap += fxconv.ptr( extradata )
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
nameDialog = data["properties"][0]["value"]
|
||||||
|
dialogfile = "/".join(input.split("/")[:-nbRetour]) + "/" + nameDialog
|
||||||
|
print( "THE DIALOGS ARE CONTAINED IN THE FILE : ", dialogfile )
|
||||||
|
|
||||||
|
nbdiag = 0
|
||||||
|
diagdata = fxconv.Structure()
|
||||||
|
|
||||||
|
nbdiag, diagdata = convert_dialogs(dialogfile, output, params, target)
|
||||||
|
|
||||||
|
if (nbdiag==0):
|
||||||
|
structMap += fxconv.u32( 0 )
|
||||||
|
structMap += fxconv.u32( 0 )
|
||||||
|
else:
|
||||||
|
structMap += fxconv.u32( int(nbdiag) )
|
||||||
|
structMap += fxconv.ptr( diagdata )
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#extraction of the data contained in the layer "Background" and "Foreground" of the map
|
#extraction of the data contained in the layer "Background" and "Foreground" of the map
|
||||||
|
|
||||||
|
|
||||||
|
@ -353,6 +376,7 @@ def convert_dialogs(input, output, params, target):
|
||||||
data = json.load(open(input, "r"))
|
data = json.load(open(input, "r"))
|
||||||
|
|
||||||
structDialogs = fxconv.Structure()
|
structDialogs = fxconv.Structure()
|
||||||
|
nbdialogs = 0
|
||||||
|
|
||||||
for d in data["dialogs"]:
|
for d in data["dialogs"]:
|
||||||
print( int(d[ "ID" ]))
|
print( int(d[ "ID" ]))
|
||||||
|
@ -364,6 +388,7 @@ def convert_dialogs(input, output, params, target):
|
||||||
# print( d[ "conclusion2" ] )
|
# print( d[ "conclusion2" ] )
|
||||||
# print( int(d[ "next2" ] ) )
|
# print( int(d[ "next2" ] ) )
|
||||||
# print( int(d[ "nextOther" ]) )
|
# print( int(d[ "nextOther" ]) )
|
||||||
|
nbdialogs = nbdialogs + 1
|
||||||
|
|
||||||
structDialogs += fxconv.u32( int(d[ "ID" ] ) )
|
structDialogs += fxconv.u32( int(d[ "ID" ] ) )
|
||||||
structDialogs += fxconv.string( d[ "dialog" ] )
|
structDialogs += fxconv.string( d[ "dialog" ] )
|
||||||
|
@ -375,5 +400,6 @@ def convert_dialogs(input, output, params, target):
|
||||||
structDialogs += fxconv.u32( int(d[ "next2" ] ) )
|
structDialogs += fxconv.u32( int(d[ "next2" ] ) )
|
||||||
structDialogs += fxconv.u32( int(d[ "nextOther" ] ) )
|
structDialogs += fxconv.u32( int(d[ "nextOther" ] ) )
|
||||||
|
|
||||||
|
return nbdialogs, structDialogs
|
||||||
|
|
||||||
fxconv.elf(structDialogs, output, "_" + params["name"], **target)
|
#fxconv.elf(structDialogs, output, "_" + params["name"], **target)
|
|
@ -1,134 +0,0 @@
|
||||||
[
|
|
||||||
{
|
|
||||||
"ID": 0,
|
|
||||||
"dialog": "Bienvenue a Toi, l'Ami, dans cette magnifique ville de Nabrouch. Comme tu peux le constater, les habitants ne sont pas tres nombreux et ont tendance a se terrer dans leur maison depuis la revolution. Il faut dire que les Anciens dirigeants, bien qu'exiles, exercent encore une certaine forme de pouvoir ...",
|
|
||||||
"isQuestion": 0,
|
|
||||||
"choice": "_",
|
|
||||||
"conclusion1": "_",
|
|
||||||
"next1": -1,
|
|
||||||
"conclusion2": "_",
|
|
||||||
"next2": -1,
|
|
||||||
"nextOther": 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"ID": 1,
|
|
||||||
"dialog": "Depuis la mort de ton Pere, la region a bien change ... Enfin, surtout ses habitants. Tu devras te mefier de tout le monde.",
|
|
||||||
"isQuestion": 0,
|
|
||||||
"choice": "_",
|
|
||||||
"conclusion1": "_",
|
|
||||||
"next1": -1,
|
|
||||||
"conclusion2": "_",
|
|
||||||
"next2": -1,
|
|
||||||
"nextOther": 2
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"ID": 2,
|
|
||||||
"dialog": "Tu devrais commencer par rejoindre la taverne que ton pere t'a laisse en heritage.",
|
|
||||||
"isQuestion": 0,
|
|
||||||
"choice": "_",
|
|
||||||
"conclusion1": "_",
|
|
||||||
"next1": -1,
|
|
||||||
"conclusion2": "_",
|
|
||||||
"next2": -1,
|
|
||||||
"nextOther": -1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"ID": 3,
|
|
||||||
"dialog": "Taverne de Pue Le Bouc",
|
|
||||||
"isQuestion": 0,
|
|
||||||
"choice": "_",
|
|
||||||
"conclusion1": "_",
|
|
||||||
"next1": -1,
|
|
||||||
"conclusion2": "_",
|
|
||||||
"next2": -1,
|
|
||||||
"nextOther": -1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"ID": 4,
|
|
||||||
"dialog": "Tiens !! Quelqu'un est mort ici. Tu le connais ?",
|
|
||||||
"isQuestion": 1,
|
|
||||||
"choice": "Oui$Non",
|
|
||||||
"conclusion1": "C'est bien triste mon Ami.`$life-2``$power-5`",
|
|
||||||
"next1": -1,
|
|
||||||
"conclusion2": "Dommage quand meme pour Lui.",
|
|
||||||
"next2": -1,
|
|
||||||
"nextOther": -1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"ID": 5,
|
|
||||||
"dialog": "Salut Hero !! Quel bon vent t'ammene ici a Nabrouch ?",
|
|
||||||
"isQuestion": 1,
|
|
||||||
"choice": "De Passage$La Famille",
|
|
||||||
"conclusion1": "Entre donc te reposer dans la taverne, c'est la seule du coin.",
|
|
||||||
"next1": -1,
|
|
||||||
"conclusion2": "Fais bien attention alors.",
|
|
||||||
"next2": 6,
|
|
||||||
"nextOther": -1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"ID": 6,
|
|
||||||
"dialog": "On dit qu'il se passe des choses étranges par ici depuis quelques temps. Fais bien attention a Toi.",
|
|
||||||
"isQuestion": 0,
|
|
||||||
"choice": "_",
|
|
||||||
"conclusion1": "_",
|
|
||||||
"next1": -1,
|
|
||||||
"conclusion2": "_",
|
|
||||||
"next2": -1,
|
|
||||||
"nextOther": -1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"ID": 7,
|
|
||||||
"dialog": "Salut Hero, je suis le cremier. Veux tu me delester un peu ?",
|
|
||||||
"isQuestion": 1,
|
|
||||||
"choice": "Oui$Non",
|
|
||||||
"conclusion1": "Voici donc pour toi`$life+5``$mana+5``$power+2`",
|
|
||||||
"next1": -1,
|
|
||||||
"conclusion2": "Bon bah casse toi ...",
|
|
||||||
"next2": -1,
|
|
||||||
"nextOther": -1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"ID": 8,
|
|
||||||
"dialog": "Le Sanctuaire Maudit ...",
|
|
||||||
"isQuestion": 0,
|
|
||||||
"choice": "_",
|
|
||||||
"conclusion1": "_",
|
|
||||||
"next1": -1,
|
|
||||||
"conclusion2": "_",
|
|
||||||
"next2": -1,
|
|
||||||
"nextOther": -1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"ID": 9,
|
|
||||||
"dialog": "Etrange ce coffre abandonne et ouvert ... Fouiller dedans ?",
|
|
||||||
"isQuestion": 1,
|
|
||||||
"choice": "Oui$Non",
|
|
||||||
"conclusion1": "Trop cool, du stuff `$life+5``$mana+5``$power+2`",
|
|
||||||
"next1": -1,
|
|
||||||
"conclusion2": "Je ferai mieux de partir loin ...",
|
|
||||||
"next2": -1,
|
|
||||||
"nextOther": -1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"ID": 10,
|
|
||||||
"dialog": "Et sa tombe est en train d'etre creusee ?",
|
|
||||||
"isQuestion": 0,
|
|
||||||
"choice": "_",
|
|
||||||
"conclusion1": "_",
|
|
||||||
"next1": -1,
|
|
||||||
"conclusion2": "_",
|
|
||||||
"next2": -1,
|
|
||||||
"nextOther": 11
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"ID": 11,
|
|
||||||
"dialog": "Beaucoup de morts pour une si petite bourgade ...",
|
|
||||||
"isQuestion": 0,
|
|
||||||
"choice": "_",
|
|
||||||
"conclusion1": "_",
|
|
||||||
"next1": -1,
|
|
||||||
"conclusion2": "_",
|
|
||||||
"next2": -1,
|
|
||||||
"nextOther": -1
|
|
||||||
}
|
|
||||||
]
|
|
|
@ -2,6 +2,6 @@ WorldRPG.world:
|
||||||
custom-type: world
|
custom-type: world
|
||||||
name: worldRPG
|
name: worldRPG
|
||||||
|
|
||||||
DialogsRPG.json:
|
#DialogsRPG.json:
|
||||||
custom-type: dialogs
|
# custom-type: dialogs
|
||||||
name: dialogRPG
|
# name: dialogRPG
|
||||||
|
|
|
@ -3,6 +3,9 @@
|
||||||
<editorsettings>
|
<editorsettings>
|
||||||
<export target="level0.json" format="json"/>
|
<export target="level0.json" format="json"/>
|
||||||
</editorsettings>
|
</editorsettings>
|
||||||
|
<properties>
|
||||||
|
<property name="dialogFile" type="file" value="DialogsLvl0.json"/>
|
||||||
|
</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="48" height="24">
|
<layer id="1" name="Background" width="48" height="24">
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<map version="1.10" tiledversion="1.10.1" orientation="orthogonal" renderorder="right-down" width="48" height="24" tilewidth="8" tileheight="8" infinite="0" nextlayerid="5" nextobjectid="4">
|
<map version="1.10" tiledversion="1.10.1" 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="DialogsLvl1.json"/>
|
||||||
|
</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="48" height="24">
|
<layer id="1" name="Background" width="48" height="24">
|
||||||
|
@ -89,27 +92,25 @@
|
||||||
<objectgroup id="4" name="ExtraData">
|
<objectgroup id="4" name="ExtraData">
|
||||||
<object id="1" name="INFO1" type="INFO" x="303.75" y="143.25">
|
<object id="1" name="INFO1" type="INFO" x="303.75" y="143.25">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="choices" value="_"/>
|
<property name="dialogID" type="int" value="0"/>
|
||||||
<property name="conclusion1" value="_"/>
|
<property name="needAction" type="int" value="1"/>
|
||||||
<property name="conclusion2" value="_"/>
|
|
||||||
<property name="dialog" value="Le tombeau du Chevalier Legendaire"/>
|
|
||||||
<property name="isQuestion" type="int" value="0"/>
|
|
||||||
</properties>
|
</properties>
|
||||||
<point/>
|
<point/>
|
||||||
</object>
|
</object>
|
||||||
<object id="2" name="Gardien" type="NPC" x="303.636" y="117.273">
|
<object id="2" name="Gardien" type="NPC" x="303.636" y="117.273">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="choices" value=""_""/>
|
<property name="dialogID" type="int" value="1"/>
|
||||||
<property name="conclusion1" value=""_""/>
|
|
||||||
<property name="conclusion2" value=""_""/>
|
|
||||||
<property name="dialog" value=""Salut, je suis la gardien du Tombeau""/>
|
|
||||||
<property name="hasPath" type="int" value="1"/>
|
<property name="hasPath" type="int" value="1"/>
|
||||||
<property name="isQuestion" type="int" value="0"/>
|
<property name="needAction" type="int" value="1"/>
|
||||||
<property name="path" type="object" value="3"/>
|
<property name="path" type="object" value="3"/>
|
||||||
</properties>
|
</properties>
|
||||||
<point/>
|
<point/>
|
||||||
</object>
|
</object>
|
||||||
<object id="3" name="Chemin Gardien" x="303.818" y="117.455">
|
<object id="3" name="Chemin Gardien" x="303.818" y="117.455">
|
||||||
|
<properties>
|
||||||
|
<property name="dialogID" type="int" value="0"/>
|
||||||
|
<property name="needAction" type="int" value="1"/>
|
||||||
|
</properties>
|
||||||
<polyline points="0,0 -31.2727,-11.0909 -87.2727,-16.1818 -100.909,-6.72727 -100.182,28.9091 -72.3636,32.7273 -11.4546,37.8181 42.5455,42.5454 75.4546,22.9091 77.4545,1.45453 32.3636,-0.727273"/>
|
<polyline points="0,0 -31.2727,-11.0909 -87.2727,-16.1818 -100.909,-6.72727 -100.182,28.9091 -72.3636,32.7273 -11.4546,37.8181 42.5455,42.5454 75.4546,22.9091 77.4545,1.45453 32.3636,-0.727273"/>
|
||||||
</object>
|
</object>
|
||||||
</objectgroup>
|
</objectgroup>
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<map version="1.10" tiledversion="1.10.1" orientation="orthogonal" renderorder="right-down" width="48" height="24" tilewidth="8" tileheight="8" infinite="0" nextlayerid="5" nextobjectid="5">
|
<map version="1.10" tiledversion="1.10.1" 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="DialogsLvl2.json"/>
|
||||||
|
</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="48" height="24">
|
<layer id="1" name="Background" width="48" height="24">
|
||||||
|
@ -89,31 +92,22 @@
|
||||||
<objectgroup id="4" name="ExtraData">
|
<objectgroup id="4" name="ExtraData">
|
||||||
<object id="1" name="INFO1" type="INFO" x="128" y="87.5">
|
<object id="1" name="INFO1" type="INFO" x="128" y="87.5">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="choices" value="_"/>
|
<property name="dialogID" type="int" value="0"/>
|
||||||
<property name="conclusion1" value="_"/>
|
<property name="needAction" type="int" value="1"/>
|
||||||
<property name="conclusion2" value="_"/>
|
|
||||||
<property name="dialog" value="Encore une tombe ..."/>
|
|
||||||
<property name="isQuestion" type="int" value="0"/>
|
|
||||||
</properties>
|
</properties>
|
||||||
<point/>
|
<point/>
|
||||||
</object>
|
</object>
|
||||||
<object id="2" name="INFO2" type="INFO" x="262.75" y="49">
|
<object id="2" name="INFO2" type="INFO" x="262.75" y="49">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="choices" value="_"/>
|
<property name="dialogID" type="int" value="1"/>
|
||||||
<property name="conclusion1" value="_"/>
|
<property name="needAction" type="int" value="1"/>
|
||||||
<property name="conclusion2" value="_"/>
|
|
||||||
<property name="dialog" value="Un passage souterrain ..."/>
|
|
||||||
<property name="isQuestion" type="int" value="0"/>
|
|
||||||
</properties>
|
</properties>
|
||||||
<point/>
|
<point/>
|
||||||
</object>
|
</object>
|
||||||
<object id="3" name="SGN1" type="SGN" x="296" y="143.75">
|
<object id="3" name="SGN1" type="SGN" x="296" y="143.75">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="choices" value="_"/>
|
<property name="dialogID" type="int" value="3"/>
|
||||||
<property name="conclusion1" value="_"/>
|
<property name="needAction" type="int" value="1"/>
|
||||||
<property name="conclusion2" value="_"/>
|
|
||||||
<property name="dialog" value="C'est la maison du gardien du cimetiere"/>
|
|
||||||
<property name="isQuestion" type="int" value="0"/>
|
|
||||||
</properties>
|
</properties>
|
||||||
<point/>
|
<point/>
|
||||||
</object>
|
</object>
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<map version="1.10" tiledversion="1.10.1" orientation="orthogonal" renderorder="right-down" width="48" height="24" tilewidth="8" tileheight="8" infinite="0" nextlayerid="5" nextobjectid="6">
|
<map version="1.10" tiledversion="1.10.1" 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="DialogsLvl3.json"/>
|
||||||
|
</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="48" height="24">
|
<layer id="1" name="Background" width="48" height="24">
|
||||||
|
@ -89,51 +92,36 @@
|
||||||
<objectgroup id="4" name="ExtraData">
|
<objectgroup id="4" name="ExtraData">
|
||||||
<object id="1" name="SGN5" type="SGN" x="224" y="183.25">
|
<object id="1" name="SGN5" type="SGN" x="224" y="183.25">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="choices" value="_"/>
|
<property name="dialogID" type="int" value="4"/>
|
||||||
<property name="conclusion1" value="_"/>
|
<property name="needAction" type="int" value="1"/>
|
||||||
<property name="conclusion2" value="_"/>
|
|
||||||
<property name="dialog" value="Maison du Maire"/>
|
|
||||||
<property name="isQuestion" type="int" value="0"/>
|
|
||||||
</properties>
|
</properties>
|
||||||
<point/>
|
<point/>
|
||||||
</object>
|
</object>
|
||||||
<object id="5" name="SGN4" type="SGN" x="320.5" y="159.25">
|
<object id="5" name="SGN4" type="SGN" x="320.5" y="159.25">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="choices" value="_"/>
|
<property name="dialogID" type="int" value="3"/>
|
||||||
<property name="conclusion1" value="_"/>
|
<property name="needAction" type="int" value="1"/>
|
||||||
<property name="conclusion2" value="_"/>
|
|
||||||
<property name="dialog" value="Maison du Boulanger"/>
|
|
||||||
<property name="isQuestion" type="int" value="0"/>
|
|
||||||
</properties>
|
</properties>
|
||||||
<point/>
|
<point/>
|
||||||
</object>
|
</object>
|
||||||
<object id="3" name="SGN3" type="SGN" x="184.25" y="95.75">
|
<object id="3" name="SGN3" type="SGN" x="184.25" y="95.75">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="choices" value="Oui$Non"/>
|
<property name="dialogID" type="int" value="2"/>
|
||||||
<property name="conclusion1" value="Super te voila requinque."/>
|
<property name="needAction" type="int" value="1"/>
|
||||||
<property name="conclusion2" value="J'aime pas la viande."/>
|
|
||||||
<property name="dialog" value="Maison du Boucher. Tu veux un steak ?"/>
|
|
||||||
<property name="isQuestion" type="int" value="1"/>
|
|
||||||
</properties>
|
</properties>
|
||||||
<point/>
|
<point/>
|
||||||
</object>
|
</object>
|
||||||
<object id="4" name="SGN2" type="SGN" x="343.75" y="80">
|
<object id="4" name="SGN2" type="SGN" x="343.75" y="80">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="choices" value="_"/>
|
<property name="dialogID" type="int" value="1"/>
|
||||||
<property name="conclusion1" value="_"/>
|
<property name="needAction" type="int" value="1"/>
|
||||||
<property name="conclusion2" value="_"/>
|
|
||||||
<property name="dialog" value="Maison du Marechal Ferrand"/>
|
|
||||||
<property name="isQuestion" type="int" value="0"/>
|
|
||||||
</properties>
|
</properties>
|
||||||
<point/>
|
<point/>
|
||||||
</object>
|
</object>
|
||||||
<object id="2" name="SGN1" type="SGN" x="71.75" y="143.25">
|
<object id="2" name="SGN1" type="SGN" x="71.75" y="143.25">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="choices" value="_"/>
|
<property name="dialogID" type="int" value="0"/>
|
||||||
<property name="conclusion1" value="_"/>
|
<property name="needAction" type="int" value="1"/>
|
||||||
<property name="conclusion2" value="_"/>
|
|
||||||
<property name="dialog" value="Maison du Fermier"/>
|
|
||||||
<property name="isQuestion" type="int" value="0"/>
|
|
||||||
</properties>
|
</properties>
|
||||||
<point/>
|
<point/>
|
||||||
</object>
|
</object>
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
{ "columns":24,
|
|
||||||
"image":"tileset.png",
|
|
||||||
"imageheight":136,
|
|
||||||
"imagewidth":192,
|
|
||||||
"margin":0,
|
|
||||||
"name":"tileset",
|
|
||||||
"spacing":0,
|
|
||||||
"tilecount":408,
|
|
||||||
"tiledversion":"1.8.0",
|
|
||||||
"tileheight":8,
|
|
||||||
"tilewidth":8,
|
|
||||||
"type":"tileset",
|
|
||||||
"version":"1.8"
|
|
||||||
}
|
|
1
clean
1
clean
|
@ -1,5 +1,6 @@
|
||||||
cd assets
|
cd assets
|
||||||
rm -f level*.json
|
rm -f level*.json
|
||||||
|
rm -f tilesetnpp.json
|
||||||
rm -r __pycache__
|
rm -r __pycache__
|
||||||
cd ..
|
cd ..
|
||||||
rm -r build-cg
|
rm -r build-cg
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "game.h"
|
||||||
|
|
||||||
|
|
||||||
#define BOX_HEIGHT (F_HEIGHT/PXSIZE+8)
|
#define BOX_HEIGHT (F_HEIGHT/PXSIZE+8)
|
||||||
|
@ -329,3 +330,47 @@ int showtext_dialog_ask(Game *game, bopti_image_t *face, char *text, bool start,
|
||||||
return showtext_opt(game, face, text, _choice_call_before_end, start, end,
|
return showtext_opt(game, face, text, _choice_call_before_end, start, end,
|
||||||
_choice_screen_call, 100, true, 0, true);
|
_choice_screen_call, 100, true, 0, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void initiate_dialog_sequence(Game *game, bopti_image_t *face, uint32_t dialogNumber )
|
||||||
|
{
|
||||||
|
Dialog *currentDiag = &game->map_level->dialogs[ dialogNumber ];
|
||||||
|
|
||||||
|
/* we collect the information */
|
||||||
|
char *text = currentDiag->dialog;
|
||||||
|
|
||||||
|
char *choices = currentDiag->choices ;
|
||||||
|
char *conclusion1 = currentDiag->conclusion1;
|
||||||
|
int next1 = currentDiag->next1;
|
||||||
|
char *conclusion2 = currentDiag->conclusion2;
|
||||||
|
int next2 = currentDiag->next2;
|
||||||
|
int nextOther = currentDiag->nextOther;
|
||||||
|
int isQuestion = currentDiag->isQuestion;
|
||||||
|
|
||||||
|
/* we treat the action - i.e. we show a dialog */
|
||||||
|
if (isQuestion == 1) /* we have to manage a question */
|
||||||
|
{
|
||||||
|
int answer = showtext_dialog_ask( game, face, text, true, true, choices, 2, 0 );
|
||||||
|
|
||||||
|
/* TO DO we need to split the strings conclusion1 and conclusion2 */
|
||||||
|
/* to extract the "gift" part */
|
||||||
|
|
||||||
|
if (answer==0)
|
||||||
|
{
|
||||||
|
showtext_dialog( game, face, conclusion1, true, true );
|
||||||
|
if (next1!=-1) initiate_dialog_sequence( game, face, next1 );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
showtext_dialog( game, face, conclusion2, true, true );
|
||||||
|
if (next2!=-1) initiate_dialog_sequence( game, face, next2 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
showtext_dialog( game, face, text, true, true );
|
||||||
|
if (nextOther!=-1) initiate_dialog_sequence( game, face, nextOther );
|
||||||
|
}
|
||||||
|
}
|
|
@ -89,4 +89,6 @@ int showtext_dialog_ask(Game *game, bopti_image_t *face, char *text, bool start,
|
||||||
bool end, char *choices, int choices_amount,
|
bool end, char *choices, int choices_amount,
|
||||||
int default_choice);
|
int default_choice);
|
||||||
|
|
||||||
|
void initiate_dialog_sequence(Game *game, bopti_image_t *face, uint32_t dialogNumber );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -113,6 +113,10 @@ typedef struct {
|
||||||
uint32_t nbextradata;
|
uint32_t nbextradata;
|
||||||
ExtraData *extradata;
|
ExtraData *extradata;
|
||||||
|
|
||||||
|
/* structure that contains all the dialogs for that part of the map */
|
||||||
|
uint32_t nbdialogsdata;
|
||||||
|
Dialog *dialogs;
|
||||||
|
|
||||||
/* list of all the tiles to draw the background and the foreground layers */
|
/* list of all the tiles to draw the background and the foreground layers */
|
||||||
uint16_t *layers[];
|
uint16_t *layers[];
|
||||||
} Map;
|
} Map;
|
||||||
|
|
|
@ -28,7 +28,6 @@ extern bopti_image_t player_face_img;
|
||||||
|
|
||||||
|
|
||||||
extern Map *worldRPG[];
|
extern Map *worldRPG[];
|
||||||
extern Dialog dialogRPG[];
|
|
||||||
|
|
||||||
/* Game data (defined in "game.h")*/
|
/* Game data (defined in "game.h")*/
|
||||||
Game game = {
|
Game game = {
|
||||||
|
@ -158,8 +157,8 @@ int main(void) {
|
||||||
game.map_level->extradata[i].x,
|
game.map_level->extradata[i].x,
|
||||||
game.map_level->extradata[i].y,
|
game.map_level->extradata[i].y,
|
||||||
game.map_level->extradata[i].dialogID,
|
game.map_level->extradata[i].dialogID,
|
||||||
dialogRPG[ game.map_level->extradata[i].dialogID ].ID,
|
game.map_level->dialogs[ game.map_level->extradata[i].dialogID ].ID,
|
||||||
dialogRPG[ game.map_level->extradata[i].dialogID ].conclusion1[0] );
|
game.map_level->dialogs[ game.map_level->extradata[i].dialogID ].conclusion1[0] );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#include <gint/display.h>
|
#include <gint/display.h>
|
||||||
|
|
||||||
extern Map *worldRPG[];
|
extern Map *worldRPG[];
|
||||||
extern ExtraData *extraRPG[];
|
//extern ExtraData *extraRPG[];
|
||||||
|
|
||||||
|
|
||||||
void render_map(Game *game) {
|
void render_map(Game *game) {
|
||||||
|
|
38
src/player.c
38
src/player.c
|
@ -27,13 +27,6 @@ const char damage_taken_walkable[WALKABLE_TILE_MAX] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
extern bopti_image_t demo_player_img;
|
extern bopti_image_t demo_player_img;
|
||||||
extern bopti_image_t NPC_Icon_img;
|
|
||||||
extern bopti_image_t SGN_Icon_img;
|
|
||||||
extern bopti_image_t INFO_Icon_img;
|
|
||||||
|
|
||||||
|
|
||||||
extern Dialog dialogRPG[];
|
|
||||||
|
|
||||||
|
|
||||||
void player_draw(Game *game) {
|
void player_draw(Game *game) {
|
||||||
Player *player = &game->player;
|
Player *player = &game->player;
|
||||||
|
@ -86,6 +79,12 @@ void player_move(Game *game, Direction direction) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
extern bopti_image_t demo_player_img;
|
||||||
|
extern bopti_image_t NPC_Icon_img;
|
||||||
|
extern bopti_image_t SGN_Icon_img;
|
||||||
|
extern bopti_image_t INFO_Icon_img;
|
||||||
|
|
||||||
|
|
||||||
void player_action(Game *game) {
|
void player_action(Game *game) {
|
||||||
if( game->player.isDoingAction ) return; /* alreday doing something */
|
if( game->player.isDoingAction ) return; /* alreday doing something */
|
||||||
|
|
||||||
|
@ -96,10 +95,11 @@ void player_action(Game *game) {
|
||||||
|
|
||||||
ExtraData *currentData = &game->map_level->extradata[game->player.whichAction];
|
ExtraData *currentData = &game->map_level->extradata[game->player.whichAction];
|
||||||
|
|
||||||
/* we collect the information */
|
|
||||||
char *text = dialogRPG[ currentData->dialogID].dialog;
|
|
||||||
/* we use the correct image as per the class of the item */
|
/* we use the correct image as per the class of the item */
|
||||||
|
|
||||||
bopti_image_t *face;
|
bopti_image_t *face;
|
||||||
|
/* we use the correct image as per the class of the item */
|
||||||
|
|
||||||
|
|
||||||
if (strcmp("INFO", currentData->type)==0)
|
if (strcmp("INFO", currentData->type)==0)
|
||||||
face = &INFO_Icon_img;
|
face = &INFO_Icon_img;
|
||||||
|
@ -109,25 +109,9 @@ void player_action(Game *game) {
|
||||||
face = &SGN_Icon_img;
|
face = &SGN_Icon_img;
|
||||||
else face = &demo_player_img;
|
else face = &demo_player_img;
|
||||||
|
|
||||||
/* we treat the action - i.e. we show a dialog */
|
uint32_t dialogStart = currentData->dialogID;
|
||||||
if (dialogRPG[ currentData->dialogID ].isQuestion == 1) /* we have to manage a question */
|
|
||||||
{
|
|
||||||
char *choices = dialogRPG[ currentData->dialogID].choices ;
|
|
||||||
char *conclusion1 = dialogRPG[currentData->dialogID].conclusion1;
|
|
||||||
char *conclusion2 = dialogRPG[currentData->dialogID].conclusion2;
|
|
||||||
|
|
||||||
int answer = showtext_dialog_ask( game, face, text, true, true, choices, 2, 0 );
|
initiate_dialog_sequence( game, face, dialogStart );
|
||||||
|
|
||||||
/* TO DO we need to split the strings conclusion1 and conclusion2 */
|
|
||||||
/* to extract the "gift" part */
|
|
||||||
|
|
||||||
if (answer==0) showtext_dialog( game, face, conclusion1, true, true );
|
|
||||||
else showtext_dialog( game, face, conclusion2, true, true );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
showtext_dialog( game, face, text, true, true );
|
|
||||||
}
|
|
||||||
|
|
||||||
/* when done we release the occupied status of the player */
|
/* when done we release the occupied status of the player */
|
||||||
game->player.isDoingAction = false;
|
game->player.isDoingAction = false;
|
||||||
|
|
Loading…
Reference in a new issue