mirror of
https://git.planet-casio.com/Slyvtt/Collab_RPG.git
synced 2025-04-19 17:37:36 +02:00
Ok, bugs are fixed - need now to implement dialog sequence and automatic story mode
This commit is contained in:
parent
35e173f838
commit
4a81853505
6 changed files with 35 additions and 20 deletions
|
@ -6,6 +6,7 @@ import pathlib
|
||||||
import csv
|
import csv
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
||||||
def convert(input, output, params, target):
|
def convert(input, output, params, target):
|
||||||
if params["custom-type"] == "map":
|
if params["custom-type"] == "map":
|
||||||
print("ERROR : Asset ", params["name"], " has legacy type map")
|
print("ERROR : Asset ", params["name"], " has legacy type map")
|
||||||
|
@ -275,16 +276,14 @@ def get_extra_map_data(input, output, params, target, xmin, ymin, xmax, ymax):
|
||||||
if v[ "id" ] == pathID:
|
if v[ "id" ] == pathID:
|
||||||
print( "path data found : " )
|
print( "path data found : " )
|
||||||
|
|
||||||
xdata = bytes("", "UTF-16")
|
xdata = bytes()
|
||||||
ydata = bytes("", "UTF-16")
|
ydata = bytes()
|
||||||
|
|
||||||
for w in v[ "polyline" ]:
|
for w in v[ "polyline" ]:
|
||||||
path_length = path_length + 1
|
path_length = path_length + 1
|
||||||
print( "X= ", w[ "x" ], " Y= ", w[ "y" ] )
|
print( "X= ", w[ "x" ], " Y= ", w[ "y" ] )
|
||||||
xdata += fxconv.u16( int( w[ "x" ] ) )
|
xdata += fxconv.u16( int( w[ "x" ] ) )
|
||||||
ydata += fxconv.u16( int( w[ "y" ] ) )
|
ydata += fxconv.u16( int( w[ "y" ] ) )
|
||||||
print("xdata : ", xdata)
|
|
||||||
print("ydata : ", ydata)
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print( "PNJ has no Path" )
|
print( "PNJ has no Path" )
|
||||||
|
@ -292,17 +291,17 @@ def get_extra_map_data(input, output, params, target, xmin, ymin, xmax, ymax):
|
||||||
else:
|
else:
|
||||||
print( "UNIDENTIFIED PROPERTY : ", j["name"])
|
print( "UNIDENTIFIED PROPERTY : ", j["name"])
|
||||||
|
|
||||||
print( "OBJECT X= ", x, " Y= ", y, "STR= ", dialog )
|
print( "OBJECT X= ", x, " Y= ", y, "STR= ", dialogID )
|
||||||
print( " Type= ", tpe, " Name= ", nme )
|
print( " Type= ", tpe, " Name= ", nme )
|
||||||
print( " Q?= ", quest, " Choi= ", choi )
|
print( " Action?= ", needAction )
|
||||||
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.u32( int(dialogID))
|
structData += fxconv.u32( int(dialogID) )
|
||||||
structData += fxconv.u32( int(needAction) )
|
structData += fxconv.u32( int(needAction) )
|
||||||
|
|
||||||
if path==0:
|
if path==0:
|
||||||
|
@ -323,7 +322,8 @@ def get_extra_map_data(input, output, params, target, xmin, ymin, xmax, ymax):
|
||||||
|
|
||||||
#else we do nothing (yet)
|
#else we do nothing (yet)
|
||||||
else:
|
else:
|
||||||
break
|
print( "Skip this object" )
|
||||||
|
|
||||||
|
|
||||||
return nbExtraData, structData
|
return nbExtraData, structData
|
||||||
|
|
||||||
|
@ -355,13 +355,23 @@ def convert_dialogs(input, output, params, target):
|
||||||
structDialogs = fxconv.Structure()
|
structDialogs = fxconv.Structure()
|
||||||
|
|
||||||
for d in data["dialogs"]:
|
for d in data["dialogs"]:
|
||||||
|
print( int(d[ "ID" ]))
|
||||||
|
# print( d[ "dialog" ] )
|
||||||
|
print( int(d[ "isQuestion" ]) )
|
||||||
|
# print( d[ "choice" ].replace('$', chr(0)) )
|
||||||
|
# print( d[ "conclusion1" ] )
|
||||||
|
# print( int(d[ "next1" ] ) )
|
||||||
|
# print( d[ "conclusion2" ] )
|
||||||
|
# print( int(d[ "next2" ] ) )
|
||||||
|
# print( int(d[ "nextOther" ]) )
|
||||||
|
|
||||||
structDialogs += fxconv.u32( int(d[ "ID" ] ) )
|
structDialogs += fxconv.u32( int(d[ "ID" ] ) )
|
||||||
structDialogs += fxconv.string( int(d[ "dialog" ] ) )
|
structDialogs += fxconv.string( d[ "dialog" ] )
|
||||||
structDialogs += fxconv.u32( int(d[ "isQuestion" ] ) )
|
structDialogs += fxconv.u32( int(d[ "isQuestion" ] ) )
|
||||||
structDialogs += fxconv.string( int(d[ "choice" ] ) )
|
structDialogs += fxconv.string( d[ "choice" ].replace('$', chr(0)) )
|
||||||
structDialogs += fxconv.string( int(d[ "conclusion1" ] ) )
|
structDialogs += fxconv.string( d[ "conclusion1" ] )
|
||||||
structDialogs += fxconv.u32( int(d[ "next1" ] ) )
|
structDialogs += fxconv.u32( int(d[ "next1" ] ) )
|
||||||
structDialogs += fxconv.string( int(d[ "conclusion2" ] ) )
|
structDialogs += fxconv.string( d[ "conclusion2" ] )
|
||||||
structDialogs += fxconv.u32( int(d[ "next2" ] ) )
|
structDialogs += fxconv.u32( int(d[ "next2" ] ) )
|
||||||
structDialogs += fxconv.u32( int(d[ "nextOther" ] ) )
|
structDialogs += fxconv.u32( int(d[ "nextOther" ] ) )
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -146,7 +146,7 @@
|
||||||
<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">
|
<object id="11" name="DébutHistoire" type="INFO" x="18.6666" y="42.6667">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="dialogID" type="int" value="0"/>
|
<property name="dialogID" type="int" value="0"/>
|
||||||
<property name="needAction" type="int" value="0"/>
|
<property name="needAction" type="int" value="0"/>
|
||||||
|
|
|
@ -43,6 +43,7 @@ typedef struct {
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
uint32_t ID;
|
||||||
/* 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 ? */
|
||||||
|
|
|
@ -28,6 +28,7 @@ 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 = {
|
||||||
|
@ -153,10 +154,12 @@ int main(void) {
|
||||||
{
|
{
|
||||||
dfont( NULL );
|
dfont( NULL );
|
||||||
for (int i=0; i<game.map_level->nbextradata; i++ )
|
for (int i=0; i<game.map_level->nbextradata; i++ )
|
||||||
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: %d - ID: %d - S: %c",
|
||||||
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,
|
||||||
|
dialogRPG[ game.map_level->extradata[i].dialogID ].conclusion1[0] );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ extern bopti_image_t SGN_Icon_img;
|
||||||
extern bopti_image_t INFO_Icon_img;
|
extern bopti_image_t INFO_Icon_img;
|
||||||
|
|
||||||
|
|
||||||
extern Dialog *dialogRPG;
|
extern Dialog dialogRPG[];
|
||||||
|
|
||||||
|
|
||||||
void player_draw(Game *game) {
|
void player_draw(Game *game) {
|
||||||
|
@ -97,9 +97,10 @@ 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->dialogID;
|
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;
|
||||||
|
|
||||||
if (strcmp("INFO", currentData->type)==0)
|
if (strcmp("INFO", currentData->type)==0)
|
||||||
face = &INFO_Icon_img;
|
face = &INFO_Icon_img;
|
||||||
else if (strcmp("NPC", currentData->type)==0)
|
else if (strcmp("NPC", currentData->type)==0)
|
||||||
|
@ -109,7 +110,7 @@ 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 (dialogRPG[ currentData->dialogID ].isQuestion ==1) /* we have to manage a question */
|
if (dialogRPG[ currentData->dialogID ].isQuestion == 1) /* we have to manage a question */
|
||||||
{
|
{
|
||||||
char *choices = dialogRPG[ currentData->dialogID].choices ;
|
char *choices = dialogRPG[ currentData->dialogID].choices ;
|
||||||
char *conclusion1 = dialogRPG[currentData->dialogID].conclusion1;
|
char *conclusion1 = dialogRPG[currentData->dialogID].conclusion1;
|
||||||
|
|
Loading…
Add table
Reference in a new issue