diff --git a/CMakeLists.txt b/CMakeLists.txt index b6ba6dd..c66b518 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,7 +14,7 @@ find_package(LibProf 2.4 REQUIRED) #set the color mode either to 1b or 2b set(COLORMODE_fx 2b) #set the color mode either to 1b, 2b or EGA64 -set(COLORMODE_cg EGA64) +set(COLORMODE_cg 1b) fxconv_declare_converters(assets/converters.py) diff --git a/assets/converters.py b/assets/converters.py index b073ed6..e12b782 100644 --- a/assets/converters.py +++ b/assets/converters.py @@ -234,47 +234,76 @@ def get_extra_map_data(input, output, params, target, xmin, ymin, xmax, ymax): nbExtraData = 0 layer = data["layers"][layer_extradata] for i in layer["objects"]: - nbExtraData = nbExtraData + 1 - x = i["x"] + xmin - y = i["y"] + ymin - nme = i["name"] - tpe = i["type"] - stg = None - quest = 0 - choi = None - conc1 = None - conc2 = None + #get the type of the item + tpe = i["type"] + + #we check if the type corresponds to a items of type Point in Tiled + if tpe in ( "SGN", "NPC", "INFO" ): + + nbExtraData = nbExtraData + 1 + x = i["x"] + xmin + y = i["y"] + ymin + nme = i["name"] + + + dialog = None + quest = 0 + choi = None + conc1 = None + conc2 = None + path = 0 + path_length = 0 + xdata = None + ydata = None - for j in i["properties"]: - #property "dialog" - if j["name"]=="dialog": stg = j[ "value" ] - #property "isQuestion" - elif j["name"]=="isQuestion": quest = 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: print( "UNIDENTIFIED PROPERTY : ", j["name"]) + #we now fill all the properties of this item + for j in i["properties"]: + #property "dialog" + if j["name"]=="dialog": dialog = j[ "value" ] + #property "isQuestion" + elif j["name"]=="isQuestion": quest = 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: + #Extra properties for NPCs (path) + if tpe=="NPC": + if j["name"]=="hasPath": + path = j[ "value" ] + if path==1: print( "PNJ has path" ) + else: print( "PNJ has no Path" ) - print( "OBJECT X= ", x, " Y= ", y, "STR= ", stg ) - print( " Type= ", tpe, " Name= ", nme ) - print( " Q?= ", quest, " Choi= ", choi ) - print( " c1= ", conc1, " c2=", conc2) - - structData += fxconv.u32( int(x) ) - structData += fxconv.u32( int(y) ) - structData += fxconv.string( nme ) - structData += fxconv.string( tpe ) - structData += fxconv.string( stg ) - structData += fxconv.u32( int(quest) ) - structData += fxconv.string( choi ) - structData += fxconv.string( conc1 ) - structData += fxconv.string( conc2 ) + else: + print( "UNIDENTIFIED PROPERTY : ", j["name"]) + + print( "OBJECT X= ", x, " Y= ", y, "STR= ", dialog ) + print( " Type= ", tpe, " Name= ", nme ) + print( " Q?= ", quest, " Choi= ", choi ) + print( " c1= ", conc1, " c2=", conc2) + + structData += fxconv.u32( int(x) ) + structData += fxconv.u32( int(y) ) + structData += fxconv.string( nme ) + structData += fxconv.string( tpe ) + structData += fxconv.string( dialog ) + structData += fxconv.u32( int(quest) ) + structData += fxconv.string( choi ) + structData += fxconv.string( conc1 ) + structData += fxconv.string( conc2 ) + structData += fxconv.u32(0) + structData += fxconv.u32(0) + structData += fxconv.u32(0) + structData += fxconv.u32(0) + + #else we do nothing (yet) + else: + break return nbExtraData, structData diff --git a/assets/level0.tmx b/assets/level0.tmx index efa3940..a7f1590 100644 --- a/assets/level0.tmx +++ b/assets/level0.tmx @@ -1,5 +1,5 @@ - + @@ -126,7 +126,9 @@ + + @@ -150,5 +152,8 @@ + + + diff --git a/src/dialogs.c b/src/dialogs.c index f982581..4a44fac 100644 --- a/src/dialogs.c +++ b/src/dialogs.c @@ -10,6 +10,10 @@ #define BOX_HEIGHT (F_HEIGHT/PXSIZE+8) +#define CHOICE_BOX_HEIGHT 10 +#define CHOICE_BOX_PADDING_TOP 3 + + extern font_t fontRPG; #define FONT_USED fontRPG @@ -19,6 +23,14 @@ extern font_t fontRPG; uint32_t *lightVRAMcurrent, *darkVRAMcurrent; #endif //GRAYMODEOK +/* the color of the text to go to the next dialog phase */ +/* it improves readability to have somathing lighter */ +#if GRAYMODEOK || (defined(FXCG50) && !defined(COLOR1BIT)) + #define NEXT_COLOR C_LIGHT +#else + #define NEXT_COLOR C_BLACK +#endif + void blit() { @@ -125,15 +137,15 @@ int showtext_opt(Game *game, bopti_image_t *face, char *text, if(update_screen) blit(); while(game->frame_duration < line_duration) sleep(); game->frame_duration = 0; - /* Ask the user to press EXE to continue. */ - dtext(BOX_HEIGHT*PXSIZE, y, C_BLACK, "[EXE] to continue ..."); + /* Ask the user to press SHIFT to continue. */ + dtext(BOX_HEIGHT*PXSIZE, y, NEXT_COLOR, "[SHIFT] : suite..."); } /* Make a little animation :). */ if(update_screen) blit(); if(l>=max_lines_amount-1){ /* If we drew one entire screen. */ - /* Wait that the EXE key is pressed if we should. */ - if(wait_continue) while(getkey().key != KEY_EXE) sleep(); + /* Wait that the SHIFT key is pressed if we should. */ + if(wait_continue) while(getkey_opt(GETKEY_DEFAULT & ~GETKEY_MOD_SHIFT & ~GETKEY_MOD_ALPHA, NULL).key != KEY_SHIFT) sleep(); /* Clear the text area. */ drect(BOX_HEIGHT*PXSIZE, 0, DWIDTH, (BOX_HEIGHT-1)*PXSIZE-2, C_WHITE); @@ -153,11 +165,11 @@ int showtext_opt(Game *game, bopti_image_t *face, char *text, if(update_screen) blit(); while(game->frame_duration < line_duration) sleep(); game->frame_duration = 0; - /* Ask the user to press EXE to continue. */ - dtext(BOX_HEIGHT*PXSIZE, y, C_BLACK, "[EXE] to continue ..."); - /* Update the screen and wait for EXE being pressed, if needed. */ + /* Ask the user to press SHIFT to continue. */ + dtext(BOX_HEIGHT*PXSIZE, y, NEXT_COLOR, "[SHIFT] : suite..."); + /* Update the screen and wait for SHIFT being pressed, if needed. */ if(update_screen) blit(); - if(wait_continue) while(getkey().key != KEY_EXE) sleep(); + if(wait_continue) while(getkey_opt( GETKEY_DEFAULT & ~GETKEY_MOD_SHIFT & ~GETKEY_MOD_ALPHA, NULL).key != KEY_SHIFT) sleep(); } if(call_before_end) return_int = call_before_end(game, i); if(end_anim){ @@ -187,8 +199,6 @@ void showtext_dialog(Game *game, bopti_image_t *face, char *text, true, 0, true); } -#define CHOICE_BOX_HEIGHT 10 -#define CHOICE_BOX_PADDING_TOP 3 /* Some variables and pointers used to get some arguments passed in * showtext_dialog_ask in _choice_call_before_end. */ @@ -253,7 +263,7 @@ int _choice_call_before_end(Game *game, unsigned int org_i) { C_BLACK, ">"); } blit(); - key = getkey().key; + key = getkey_opt( GETKEY_DEFAULT & ~GETKEY_MOD_SHIFT & ~GETKEY_MOD_ALPHA, NULL).key; /* If the player pressed the left arrow key and has not already selected * the first possible choice. */ if(key == KEY_LEFT && selected > 0){ @@ -280,9 +290,9 @@ int _choice_call_before_end(Game *game, unsigned int org_i) { /* Move the selection arrow and update the selected item. */ selected++; } - /* If the user has not validated his choice by pressing EXE, we loop one + /* If the user has not validated his choice by pressing SHIFT, we loop one * more time. */ - }while(key != KEY_EXE); + }while(key != KEY_SHIFT); /* Make a little animation because we looove little animations ;) */ for(i=DWIDTH/8+1;i>0;i--){ /* I'm drawing the same box as on the start animation */ diff --git a/src/game.h b/src/game.h index adb7cdc..aacf89d 100644 --- a/src/game.h +++ b/src/game.h @@ -60,6 +60,13 @@ typedef struct { /* Note : it may contain a set of event with a dedicated syntax */ char *conclusion1; char *conclusion2; + + /* data for NPC's trajectories */ + uint32_t hasPath; + uint32_t path_length; + uint16_t *xpath; + uint16_t *ypath; + /* ... this can be extended as per needs ... */ } ExtraData;