mirror of
https://git.planet-casio.com/Slyvtt/Collab_RPG.git
synced 2024-12-29 13:03:43 +01:00
first attempt of external dialogs with level0.tmx only - currently buggy - not compiling
This commit is contained in:
parent
9c38862507
commit
35e173f838
15 changed files with 415 additions and 104 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -13,4 +13,4 @@ __pycache__/
|
||||||
*.sublime-workspace
|
*.sublime-workspace
|
||||||
.vscode
|
.vscode
|
||||||
|
|
||||||
*.json
|
level*.json
|
||||||
|
|
|
@ -31,6 +31,7 @@ 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
|
||||||
# ...
|
# ...
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
134
assets/DialogsRPG.json
Normal file
134
assets/DialogsRPG.json
Normal file
|
@ -0,0 +1,134 @@
|
||||||
|
{ "dialogs":[
|
||||||
|
{ "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
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -6,27 +6,6 @@
|
||||||
"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,
|
||||||
|
|
34
assets/WorldRPG.world.bak
Normal file
34
assets/WorldRPG.world.bak
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
{
|
||||||
|
"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"
|
||||||
|
}
|
|
@ -19,6 +19,9 @@ def convert(input, output, params, target):
|
||||||
elif params["custom-type"] == "font":
|
elif params["custom-type"] == "font":
|
||||||
convert_font(input, output, params, target)
|
convert_font(input, output, params, target)
|
||||||
return 0
|
return 0
|
||||||
|
elif params["custom-type"] == "dialogs":
|
||||||
|
convert_dialogs(input, output, params, target)
|
||||||
|
return 0
|
||||||
else:
|
else:
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
@ -68,20 +71,8 @@ def convert_world(input, output, params, target):
|
||||||
print( "Map = ", map )
|
print( "Map = ", map )
|
||||||
structWorld += fxconv.ptr( map )
|
structWorld += fxconv.ptr( map )
|
||||||
|
|
||||||
#ext = get_extra_map_data( mapPath, output, params, target, xmin, ymin, xmax, ymax )
|
|
||||||
#print( "Data = ", ext )
|
|
||||||
#if (ext!=fxconv.u32(0)): structExtra += fxconv.ptr( ext )
|
|
||||||
|
|
||||||
structWorld += fxconv.u32(0)
|
structWorld += fxconv.u32(0)
|
||||||
|
|
||||||
#structExtra += fxconv.u32(0)
|
|
||||||
"""
|
|
||||||
#and all the extra data (PNJ, SGN, ...)
|
|
||||||
fxconv.elf_multi(
|
|
||||||
[("_" + params["varMapData"], structWorld),
|
|
||||||
("_" + params["varExtraData"], structExtra)],
|
|
||||||
output, **target)
|
|
||||||
"""
|
|
||||||
#generate !
|
#generate !
|
||||||
fxconv.elf(structWorld, output, "_" + params["name"], **target)
|
fxconv.elf(structWorld, output, "_" + params["name"], **target)
|
||||||
|
|
||||||
|
@ -251,11 +242,8 @@ def get_extra_map_data(input, output, params, target, xmin, ymin, xmax, ymax):
|
||||||
nme = i["name"]
|
nme = i["name"]
|
||||||
|
|
||||||
|
|
||||||
dialog = None
|
dialogID = None
|
||||||
quest = 0
|
needAction = None
|
||||||
choi = None
|
|
||||||
conc1 = None
|
|
||||||
conc2 = None
|
|
||||||
path = 0
|
path = 0
|
||||||
path_length = 0
|
path_length = 0
|
||||||
xdata = None
|
xdata = None
|
||||||
|
@ -264,17 +252,10 @@ def get_extra_map_data(input, output, params, target, xmin, ymin, xmax, ymax):
|
||||||
#we now fill all the properties of this item
|
#we now fill all the properties of this item
|
||||||
for j in i["properties"]:
|
for j in i["properties"]:
|
||||||
#property "dialog"
|
#property "dialog"
|
||||||
if j["name"]=="dialog": dialog = j[ "value" ]
|
if j["name"]=="dialogID": dialogID = j[ "value" ]
|
||||||
#property "isQuestion"
|
#property "isQuestion"
|
||||||
elif j["name"]=="isQuestion": quest = j[ "value" ]
|
elif j["name"]=="needAction": needAction = j[ "value" ]
|
||||||
#property "choices"
|
|
||||||
elif j["name"]=="choices":
|
|
||||||
choi = j[ "value" ]
|
|
||||||
choi = choi.replace( '$', chr(0) )
|
|
||||||
#property "conclusion1"
|
|
||||||
elif j["name"]=="conclusion1": conc1 = j[ "value" ]
|
|
||||||
#property "conclusion2"
|
|
||||||
elif j["name"]=="conclusion2": conc2 = j[ "value" ]
|
|
||||||
else:
|
else:
|
||||||
#Extra properties for NPCs (path)
|
#Extra properties for NPCs (path)
|
||||||
if tpe=="NPC":
|
if tpe=="NPC":
|
||||||
|
@ -316,15 +297,14 @@ def get_extra_map_data(input, output, params, target, xmin, ymin, xmax, ymax):
|
||||||
print( " Q?= ", quest, " Choi= ", choi )
|
print( " Q?= ", quest, " Choi= ", choi )
|
||||||
print( " c1= ", conc1, " c2=", conc2)
|
print( " c1= ", conc1, " c2=", conc2)
|
||||||
|
|
||||||
|
|
||||||
structData += fxconv.u32( int(x) )
|
structData += fxconv.u32( int(x) )
|
||||||
structData += fxconv.u32( int(y) )
|
structData += fxconv.u32( int(y) )
|
||||||
structData += fxconv.string( nme )
|
structData += fxconv.string( nme )
|
||||||
structData += fxconv.string( tpe )
|
structData += fxconv.string( tpe )
|
||||||
structData += fxconv.string( dialog )
|
structData += fxconv.u32( int(dialogID))
|
||||||
structData += fxconv.u32( int(quest) )
|
structData += fxconv.u32( int(needAction) )
|
||||||
structData += fxconv.string( choi )
|
|
||||||
structData += fxconv.string( conc1 )
|
|
||||||
structData += fxconv.string( conc2 )
|
|
||||||
if path==0:
|
if path==0:
|
||||||
structData += fxconv.u32(0)
|
structData += fxconv.u32(0)
|
||||||
structData += fxconv.u32(0)
|
structData += fxconv.u32(0)
|
||||||
|
@ -347,6 +327,7 @@ def get_extra_map_data(input, output, params, target, xmin, ymin, xmax, ymax):
|
||||||
|
|
||||||
return nbExtraData, structData
|
return nbExtraData, structData
|
||||||
|
|
||||||
|
|
||||||
def convert_custom_image(input, output, params, target):
|
def convert_custom_image(input, output, params, target):
|
||||||
scale = int(params.get("scale", 1))
|
scale = int(params.get("scale", 1))
|
||||||
|
|
||||||
|
@ -358,6 +339,31 @@ def convert_custom_image(input, output, params, target):
|
||||||
o = fxconv.convert_image_cg(im, params)
|
o = fxconv.convert_image_cg(im, params)
|
||||||
fxconv.elf(o, output, "_" + params["name"], **target)
|
fxconv.elf(o, output, "_" + params["name"], **target)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def convert_font(input, output, params, target):
|
def convert_font(input, output, params, target):
|
||||||
o = fxconv.convert_topti(input, params)
|
o = fxconv.convert_topti(input, params)
|
||||||
fxconv.elf(o, output, "_" + params["name"], **target)
|
fxconv.elf(o, output, "_" + params["name"], **target)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def convert_dialogs(input, output, params, target):
|
||||||
|
|
||||||
|
print( "WE ARE COMPUTING THE DIALOGS FROM : ", input )
|
||||||
|
data = json.load(open(input, "r"))
|
||||||
|
|
||||||
|
structDialogs = fxconv.Structure()
|
||||||
|
|
||||||
|
for d in data["dialogs"]:
|
||||||
|
structDialogs += fxconv.u32( int(d[ "ID" ] ) )
|
||||||
|
structDialogs += fxconv.string( int(d[ "dialog" ] ) )
|
||||||
|
structDialogs += fxconv.u32( int(d[ "isQuestion" ] ) )
|
||||||
|
structDialogs += fxconv.string( int(d[ "choice" ] ) )
|
||||||
|
structDialogs += fxconv.string( int(d[ "conclusion1" ] ) )
|
||||||
|
structDialogs += fxconv.u32( int(d[ "next1" ] ) )
|
||||||
|
structDialogs += fxconv.string( int(d[ "conclusion2" ] ) )
|
||||||
|
structDialogs += fxconv.u32( int(d[ "next2" ] ) )
|
||||||
|
structDialogs += fxconv.u32( int(d[ "nextOther" ] ) )
|
||||||
|
|
||||||
|
|
||||||
|
fxconv.elf(structDialogs, output, "_" + params["name"], **target)
|
134
assets/dialogs.json.bak
Normal file
134
assets/dialogs.json.bak
Normal file
|
@ -0,0 +1,134 @@
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"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
|
||||||
|
}
|
||||||
|
]
|
|
@ -1,3 +1,7 @@
|
||||||
WorldRPG.world:
|
WorldRPG.world:
|
||||||
custom-type: world
|
custom-type: world
|
||||||
name: worldRPG
|
name: worldRPG
|
||||||
|
|
||||||
|
DialogsRPG.json
|
||||||
|
custom-type: dialogs
|
||||||
|
name: dialogRPG
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?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="8" nextobjectid="11">
|
<map version="1.10" tiledversion="1.10.1" orientation="orthogonal" renderorder="right-down" width="48" height="24" tilewidth="8" tileheight="8" infinite="0" nextlayerid="8" nextobjectid="12">
|
||||||
<editorsettings>
|
<editorsettings>
|
||||||
<export target="level0.json" format="json"/>
|
<export target="level0.json" format="json"/>
|
||||||
</editorsettings>
|
</editorsettings>
|
||||||
|
@ -92,80 +92,66 @@
|
||||||
<objectgroup id="4" name="ExtraData">
|
<objectgroup id="4" name="ExtraData">
|
||||||
<object id="1" name="INFO3" type="INFO" x="232" y="79.75">
|
<object id="1" name="INFO3" type="INFO" x="232" y="79.75">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="choices" value="Oui$Non"/>
|
<property name="dialogID" type="int" value="9"/>
|
||||||
<property name="conclusion1" value="Trop cool, du stuff `$life+5``$mana+5``$power+2`"/>
|
<property name="needAction" type="int" value="1"/>
|
||||||
<property name="conclusion2" value="Je ferai mieux de partir loin ..."/>
|
|
||||||
<property name="dialog" value="Etrange ce coffre ouvert ... Fouiller dedans ?"/>
|
|
||||||
<property name="isQuestion" type="int" value="1"/>
|
|
||||||
</properties>
|
</properties>
|
||||||
<point/>
|
<point/>
|
||||||
</object>
|
</object>
|
||||||
<object id="8" name="INFO2" type="INFO" x="119.75" y="47.25">
|
<object id="8" name="INFO2" type="INFO" x="119.75" y="47.25">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="choices" value="_"/>
|
<property name="dialogID" type="int" value="10"/>
|
||||||
<property name="conclusion1" value="_"/>
|
<property name="needAction" type="int" value="1"/>
|
||||||
<property name="conclusion2" value="_"/>
|
|
||||||
<property name="dialog" value="Et sa tombe est en train d'etre creusee ...^"/>
|
|
||||||
<property name="isQuestion" type="int" value="0"/>
|
|
||||||
</properties>
|
</properties>
|
||||||
<point/>
|
<point/>
|
||||||
</object>
|
</object>
|
||||||
<object id="7" name="INFO1" type="INFO" x="52" y="44">
|
<object id="7" name="INFO1" type="INFO" x="52" y="44">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="choices" value="Oui$Non"/>
|
<property name="dialogID" type="int" value="4"/>
|
||||||
<property name="conclusion1" value="C'est triste mon Ami`$life-2``$power-5`"/>
|
<property name="needAction" type="int" value="1"/>
|
||||||
<property name="conclusion2" value="Dommage quand meme pour Lui."/>
|
|
||||||
<property name="dialog" value="Quelqu'un est mort ici ... Tu le connais ?"/>
|
|
||||||
<property name="isQuestion" type="int" value="1"/>
|
|
||||||
</properties>
|
</properties>
|
||||||
<point/>
|
<point/>
|
||||||
</object>
|
</object>
|
||||||
<object id="2" name="PNJ2" type="NPC" x="164" y="132">
|
<object id="2" name="PNJ2" type="NPC" x="164" y="132">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="choices" value="_"/>
|
<property name="dialogID" type="int" value="5"/>
|
||||||
<property name="conclusion1" value="_"/>
|
|
||||||
<property name="conclusion2" value="_"/>
|
|
||||||
<property name="dialog" value="Salut Hero, j'habite ici."/>
|
|
||||||
<property name="hasPath" type="int" value="0"/>
|
<property name="hasPath" type="int" value="0"/>
|
||||||
<property name="isQuestion" type="int" value="0"/>
|
<property name="needAction" type="int" value="1"/>
|
||||||
<property name="path" type="object" value="0"/>
|
<property name="path" type="object" value="0"/>
|
||||||
</properties>
|
</properties>
|
||||||
<point/>
|
<point/>
|
||||||
</object>
|
</object>
|
||||||
<object id="10" name="PNJ1" type="NPC" x="252" y="164">
|
<object id="10" name="PNJ1" type="NPC" x="252" y="164">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="choices" value="Oui$Non"/>
|
<property name="dialogID" type="int" value="7"/>
|
||||||
<property name="conclusion1" value="Voici donc pour toi`$life+5``$mana+5``$power+2`"/>
|
|
||||||
<property name="conclusion2" value="Bon bah casse toi ..."/>
|
|
||||||
<property name="dialog" value="Salut Hero, je suis le cremier. Veux tu me delester un peu ?"/>
|
|
||||||
<property name="hasPath" type="int" value="1"/>
|
<property name="hasPath" type="int" value="1"/>
|
||||||
<property name="isQuestion" type="int" value="1"/>
|
<property name="needAction" type="int" value="1"/>
|
||||||
<property name="path" type="object" value="9"/>
|
<property name="path" type="object" value="9"/>
|
||||||
</properties>
|
</properties>
|
||||||
<point/>
|
<point/>
|
||||||
</object>
|
</object>
|
||||||
<object id="4" name="SGN1" type="SGN" x="96" y="136">
|
<object id="4" name="SGN1" type="SGN" x="96" y="136">
|
||||||
<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="Indication sur le panneau. Bienvenue dans la maison du Tondu ..."/>
|
|
||||||
<property name="isQuestion" type="int" value="0"/>
|
|
||||||
</properties>
|
</properties>
|
||||||
<point/>
|
<point/>
|
||||||
</object>
|
</object>
|
||||||
<object id="5" name="SGN2" type="SGN" x="288" y="128">
|
<object id="5" name="SGN2" type="SGN" x="288" y="128">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="choices" value="_"/>
|
<property name="dialogID" type="int" value="8"/>
|
||||||
<property name="conclusion1" value="_"/>
|
<property name="needAction" type="int" value="1"/>
|
||||||
<property name="conclusion2" value="_"/>
|
|
||||||
<property name="dialog" value="Indication sur le panneau. Entree dans le Sanctuaire Maudit ..."/>
|
|
||||||
<property name="isQuestion" type="int" value="0"/>
|
|
||||||
</properties>
|
</properties>
|
||||||
<point/>
|
<point/>
|
||||||
</object>
|
</object>
|
||||||
<object id="9" name="Chemin Crémier" type="TRJ" x="251.967" y="164.12">
|
<object id="9" name="Chemin Crémier" type="TRJ" x="251.967" y="164.12">
|
||||||
<polyline points="0,0 -72.25,-18.5 -171.75,-19 -172.5,-99.25 -206.25,-122.75 -140.75,-114.75 -175.25,-97.5 -174.5,-33 -148.25,-20.5 -73.25,-20.25 39,-30.25 81.25,-45 79.25,-24.5"/>
|
<polyline points="0,0 -72.25,-18.5 -171.75,-19 -172.5,-99.25 -206.25,-122.75 -140.75,-114.75 -175.25,-97.5 -174.5,-33 -148.25,-20.5 -73.25,-20.25 39,-30.25 81.25,-45 79.25,-24.5"/>
|
||||||
</object>
|
</object>
|
||||||
|
<object id="11" name="DébutHistoire" type="INFO" x="71.3333" y="84.6667">
|
||||||
|
<properties>
|
||||||
|
<property name="dialogID" type="int" value="0"/>
|
||||||
|
<property name="needAction" type="int" value="0"/>
|
||||||
|
</properties>
|
||||||
|
<point/>
|
||||||
|
</object>
|
||||||
</objectgroup>
|
</objectgroup>
|
||||||
</map>
|
</map>
|
||||||
|
|
14
assets/tilesetnpp.json
Normal file
14
assets/tilesetnpp.json
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
{ "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"
|
||||||
|
}
|
2
clean
2
clean
|
@ -1,5 +1,5 @@
|
||||||
cd assets
|
cd assets
|
||||||
rm -f *.json
|
rm -f level*.json
|
||||||
rm -r __pycache__
|
rm -r __pycache__
|
||||||
cd ..
|
cd ..
|
||||||
rm -r build-cg
|
rm -r build-cg
|
||||||
|
|
|
@ -13,6 +13,8 @@
|
||||||
|
|
||||||
extern bopti_image_t SignAction_img;
|
extern bopti_image_t SignAction_img;
|
||||||
|
|
||||||
|
extern Dialog *dialogRPG;
|
||||||
|
|
||||||
|
|
||||||
#define MAX_INTERACTION_DISTANCE 12
|
#define MAX_INTERACTION_DISTANCE 12
|
||||||
|
|
||||||
|
|
28
src/game.h
28
src/game.h
|
@ -43,13 +43,6 @@ typedef struct {
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/* position of the item */
|
|
||||||
uint32_t x;
|
|
||||||
uint32_t y;
|
|
||||||
/* its name */
|
|
||||||
char *name;
|
|
||||||
/* its class (NPC, SGN, INFO, ... )*/
|
|
||||||
char *type;
|
|
||||||
/* data to be shown in the dialog*/
|
/* data to be shown in the dialog*/
|
||||||
char *dialog;
|
char *dialog;
|
||||||
/* is it a question or a simple dialog ? */
|
/* is it a question or a simple dialog ? */
|
||||||
|
@ -59,7 +52,28 @@ typedef struct {
|
||||||
/* the conclusion of the dialog for answer 1 and 2 respectively */
|
/* the conclusion of the dialog for answer 1 and 2 respectively */
|
||||||
/* Note : it may contain a set of event with a dedicated syntax */
|
/* Note : it may contain a set of event with a dedicated syntax */
|
||||||
char *conclusion1;
|
char *conclusion1;
|
||||||
|
int32_t next1;
|
||||||
char *conclusion2;
|
char *conclusion2;
|
||||||
|
int32_t next2;
|
||||||
|
int32_t nextOther;
|
||||||
|
} Dialog;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
/* position of the item */
|
||||||
|
uint32_t x;
|
||||||
|
uint32_t y;
|
||||||
|
/* its name */
|
||||||
|
char *name;
|
||||||
|
/* its class (NPC, SGN, INFO, ... )*/
|
||||||
|
char *type;
|
||||||
|
|
||||||
|
/* the ID of the first element of the dialog */
|
||||||
|
/* (to be aligned with "dialogs.json" IDs)*/
|
||||||
|
uint32_t dialogID;
|
||||||
|
/* 0 if imperative dialog (story mode) */
|
||||||
|
/* or 1 if the player need to press [SHIFT] to initiate the sequence*/
|
||||||
|
uint32_t needAction;
|
||||||
|
|
||||||
/* data for NPC's trajectories */
|
/* data for NPC's trajectories */
|
||||||
uint32_t hasPath;
|
uint32_t hasPath;
|
||||||
|
|
|
@ -156,7 +156,7 @@ int main(void) {
|
||||||
dprint( 10, 90+i*15, C_RED, "X= %d - Y= %d - T: %s",
|
dprint( 10, 90+i*15, C_RED, "X= %d - Y= %d - T: %s",
|
||||||
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].dialog );
|
game.map_level->extradata[i].dialogID );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
13
src/player.c
13
src/player.c
|
@ -32,6 +32,9 @@ extern bopti_image_t SGN_Icon_img;
|
||||||
extern bopti_image_t INFO_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;
|
||||||
dimage(player->px-P_WIDTH/2, player->py-P_HEIGHT/2, &demo_player_img);
|
dimage(player->px-P_WIDTH/2, player->py-P_HEIGHT/2, &demo_player_img);
|
||||||
|
@ -94,7 +97,7 @@ 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 */
|
/* we collect the information */
|
||||||
char *text = currentData->dialog;
|
char *text = currentData->dialogID;
|
||||||
/* 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;
|
||||||
if (strcmp("INFO", currentData->type)==0)
|
if (strcmp("INFO", currentData->type)==0)
|
||||||
|
@ -106,11 +109,11 @@ void player_action(Game *game) {
|
||||||
else face = &demo_player_img;
|
else face = &demo_player_img;
|
||||||
|
|
||||||
/* we treat the action - i.e. we show a dialog */
|
/* we treat the action - i.e. we show a dialog */
|
||||||
if (currentData->isQuestion==1) /* we have to manage a question */
|
if (dialogRPG[ currentData->dialogID ].isQuestion ==1) /* we have to manage a question */
|
||||||
{
|
{
|
||||||
char *choices = currentData->choices;
|
char *choices = dialogRPG[ currentData->dialogID].choices ;
|
||||||
char *conclusion1 = currentData->conclusion1;
|
char *conclusion1 = dialogRPG[currentData->dialogID].conclusion1;
|
||||||
char *conclusion2 = currentData->conclusion2;
|
char *conclusion2 = dialogRPG[currentData->dialogID].conclusion2;
|
||||||
|
|
||||||
int answer = showtext_dialog_ask( game, face, text, true, true, choices, 2, 0 );
|
int answer = showtext_dialog_ask( game, face, text, true, true, choices, 2, 0 );
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue