Fixed a little displaying error in the dialog code

This commit is contained in:
mibi88 2023-08-18 15:41:19 +02:00
parent 8f5eb159a1
commit f03281507c
2 changed files with 25 additions and 12 deletions

View file

@ -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;

View file

@ -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; i<game.map_level->nbextradata; 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