From 4e06ddce105a2588856ad5d9199b33bd6201bd7a Mon Sep 17 00:00:00 2001 From: mibi88 Date: Wed, 12 Jul 2023 12:42:28 +0200 Subject: [PATCH] Dialogs displaying now works on cg! --- src/dialogs.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/dialogs.c b/src/dialogs.c index fa93bdb..cb11bbc 100644 --- a/src/dialogs.c +++ b/src/dialogs.c @@ -10,9 +10,10 @@ extern font_t fontRPG; void showtext(Game *game, bopti_image_t *face, char *text) { dfont(&FONT_USED); - unsigned int i, n, y = 1, l = 0; + unsigned int i, n, y = PXSIZE, l = 0; int line_max_chars; - unsigned int max_lines_amount = (BOX_HEIGHT-1)/FONT_USED.line_height; + unsigned int max_lines_amount = (BOX_HEIGHT-2)*PXSIZE/ + (FONT_USED.line_height+PXSIZE); const char *c; /* Run a little fancy animation. */ for(i=0;iframe_duration < 100) sleep(); + while(game->frame_duration < 1000) sleep(); game->frame_duration = 0; /* Ask the user to press EXE to continue. */ - dtext(BOX_HEIGHT, y, C_BLACK, "[EXE] to continue ..."); + dtext(BOX_HEIGHT*PXSIZE, y, C_BLACK, "[EXE] to continue ..."); } /* Make a little animation :). */ dupdate(); if(l>=max_lines_amount-1){ while(getkey().key != KEY_EXE) sleep(); /* Clear the screen. */ - drect(BOX_HEIGHT*PXSIZE, 0, DWIDTH, (BOX_HEIGHT-1)*PXSIZE, C_WHITE); + drect(BOX_HEIGHT*PXSIZE, 0, DWIDTH, (BOX_HEIGHT-1)*PXSIZE-1, + C_WHITE); /* Reset y and l. */ - y = 1; + y = PXSIZE; l = 0; } else{ - while(game->frame_duration < 100) sleep(); + while(game->frame_duration < 1000) sleep(); + game->frame_duration = 0; } - game->frame_duration = 0; } if(lframe_duration < 100) sleep(); + while(game->frame_duration < 1000) sleep(); game->frame_duration = 0; /* Ask the user to press EXE to continue. */ dtext(1, y, C_BLACK, "[EXE] To continue ...");