From f03281507cce0f030716839700d110c48b6ebb8c Mon Sep 17 00:00:00 2001 From: mibi88 Date: Fri, 18 Aug 2023 15:41:19 +0200 Subject: [PATCH] Fixed a little displaying error in the dialog code --- src/dialogs.c | 10 ++++++---- src/main.c | 27 +++++++++++++++++++-------- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/src/dialogs.c b/src/dialogs.c index c6ce40f..f982581 100644 --- a/src/dialogs.c +++ b/src/dialogs.c @@ -239,16 +239,18 @@ int _choice_call_before_end(Game *game, unsigned int org_i) { dsize(">", &FONT_USED, &arrow_width, &arrow_height); /* Add the character spacing of the font to it. */ arrow_width += FONT_USED.char_spacing; + for(i=0;i<_choices_amount;i++){ + dtext(i*choice_size+arrow_width+PXSIZE, + (BOX_HEIGHT+CHOICE_BOX_PADDING_TOP)*PXSIZE, C_BLACK, + _choices+pos); + pos += strlen(_choices+pos)+1; + } do{ /* Display the diffrent choices. */ for(i=0;i<_choices_amount;i++){ if(i == selected) dtext(i*choice_size+PXSIZE, (BOX_HEIGHT+CHOICE_BOX_PADDING_TOP)*PXSIZE, C_BLACK, ">"); - dtext(i*choice_size+arrow_width+PXSIZE, - (BOX_HEIGHT+CHOICE_BOX_PADDING_TOP)*PXSIZE, C_BLACK, - _choices+pos); - pos += strlen(_choices+pos)+1; } blit(); key = getkey().key; diff --git a/src/main.c b/src/main.c index f7893c9..f0a98dc 100644 --- a/src/main.c +++ b/src/main.c @@ -108,13 +108,11 @@ int main(void) { dgray(DGRAY_ON); #endif -/* showtext_dialog(&game, &player_face_img, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet.", true, true); int in = showtext_dialog_ask(&game, &player_face_img, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet.", true, false, "Lorem\0Ipsum\0Dolor", 3, 0); if(in==2) showtext_dialog(&game, &player_face_img, "You choosed Dolor", false, true); else if(in==1) showtext_dialog(&game, &player_face_img, "You choosed Ipsum", false, true); else showtext_dialog(&game, &player_face_img, "You choosed Lorem", false, true); -*/ do{ /* clear screen */ @@ -128,22 +126,35 @@ int main(void) { { dfont( NULL ); drect( 5, 5,390, 55, C_WHITE ); - dprint( 10, 10, C_RED, "Map[%d] : Xmn %d Ymn %d Xmx %d Ymx %d", 0, worldRPG[0]->xmin, worldRPG[0]->ymin, worldRPG[0]->xmax, worldRPG[0]->ymax ); - dprint( 10, 20, C_RED, "Map[%d] : Xmn %d Ymn %d Xmx %d Ymx %d", 1, worldRPG[1]->xmin, worldRPG[1]->ymin, worldRPG[1]->xmax, worldRPG[1]->ymax ); - dprint( 10, 30, C_RED, "Map[%d] : Xmn %d Ymn %d Xmx %d Ymx %d", 2, worldRPG[2]->xmin, worldRPG[2]->ymin, worldRPG[2]->xmax, worldRPG[2]->ymax ); - dprint( 10, 40, C_RED, "Map[%d] : Xmn %d Ymn %d Xmx %d Ymx %d", 3, worldRPG[3]->xmin, worldRPG[3]->ymin, worldRPG[3]->xmax, worldRPG[3]->ymax ); + dprint(10, 10, C_RED, "Map[%d] : Xmn %d Ymn %d Xmx %d Ymx %d", + 0, worldRPG[0]->xmin, worldRPG[0]->ymin, + worldRPG[0]->xmax, worldRPG[0]->ymax); + dprint(10, 20, C_RED, "Map[%d] : Xmn %d Ymn %d Xmx %d Ymx %d", + 1, worldRPG[1]->xmin, worldRPG[1]->ymin, + worldRPG[1]->xmax, worldRPG[1]->ymax); + dprint(10, 30, C_RED, "Map[%d] : Xmn %d Ymn %d Xmx %d Ymx %d", + 2, worldRPG[2]->xmin, worldRPG[2]->ymin, + worldRPG[2]->xmax, worldRPG[2]->ymax); + dprint(10, 40, C_RED, "Map[%d] : Xmn %d Ymn %d Xmx %d Ymx %d", + 3, worldRPG[3]->xmin, worldRPG[3]->ymin, + worldRPG[3]->xmax, worldRPG[3]->ymax); } if (game.debug_player) { dfont( NULL ); drect( 5, 55,390, 75, C_WHITE ); - dprint( 10, 60, C_BLUE, "X= %d - Y= %d / Wx= %d - Wy= %d", game.player.x, game.player.y, game.player.wx, game.player.wy ); + dprint( 10, 60, C_BLUE, "X= %d - Y= %d / Wx= %d - Wy= %d", + game.player.x, game.player.y, game.player.wx, + game.player.wy ); } if (game.debug_extra) { dfont( NULL ); for (int i=0; inbextradata; i++ ) - dprint( 10, 90+i*15, C_RED, "X= %d - Y= %d - T: %s", game.map_level->extradata[i].x, game.map_level->extradata[i].y, game.map_level->extradata[i].dialog ); + dprint( 10, 90+i*15, C_RED, "X= %d - Y= %d - T: %s", + game.map_level->extradata[i].x, + game.map_level->extradata[i].y, + game.map_level->extradata[i].dialog ); } #endif