diff --git a/assets-cg/font.png b/assets-cg/font.png index 148bcb3..e661cc4 100644 Binary files a/assets-cg/font.png and b/assets-cg/font.png differ diff --git a/assets-fx/font.png b/assets-fx/font.png index 8733b1e..f7b376a 100644 Binary files a/assets-fx/font.png and b/assets-fx/font.png differ diff --git a/src/dialogs.c b/src/dialogs.c index 1528344..90ed03d 100644 --- a/src/dialogs.c +++ b/src/dialogs.c @@ -2,7 +2,6 @@ #include #include -#include #include @@ -65,6 +64,9 @@ int showtext_opt(Game *game, bopti_image_t *face, char *text, (BOX_HEIGHT-7)*PXSIZE, DIMAGE_NONE); dupdate(); + + while(game->frame_duration < 20) sleep(); + game->frame_duration = 0; } /* We should start to drawing the text on the x axis at BOX_HEIGHT to avoid * drawing on the face. */ @@ -179,14 +181,17 @@ int _choices_amount, _default_choice; * int y) are needed in the animations of the interaction dialog. */ #ifdef FXCG50 + #include + image_t vram_part_reference; image_t vram_part; #else // Really need to code this! #endif -void store_vram_part(int x1, int y1, int x2, int y2) { +void store_vram_part(int x, int y, int w, int h) { #ifdef FXCG50 - image_sub(image_create_vram(), x1, y1, x2-x1, y2-y1, &vram_part); + image_sub(image_create_vram(), x, y, w, h, &vram_part_reference); + image_copy(&vram_part_reference, &vram_part, true); #else // Really need to code this! #endif @@ -203,25 +208,23 @@ int _choice_call_before_end(Game *game) { int i, key; /* Make a little animation because we looove little animations ;) */ store_vram_part(0, (BOX_HEIGHT+1)*PXSIZE, - DWIDTH, (BOX_HEIGHT+CHOICE_BOX_HEIGHT+1)*PXSIZE); + DWIDTH, (CHOICE_BOX_HEIGHT+1)*PXSIZE); for(i=0;iframe_duration < 20) sleep(); game->frame_duration = 0; } const int choice_size = DWIDTH/_choices_amount; - int arrow_width, selected = _default_choice, pos = 0; - dsize(">", &FONT_USED, &arrow_width, NULL); + int arrow_width, arrow_height, selected = _default_choice, pos = 0; + dsize(">", &FONT_USED, &arrow_width, &arrow_height); + arrow_width += FONT_USED.char_spacing; do{ - /* Clear the box. */ - drect(0, (BOX_HEIGHT+CHOICE_BOX_HEIGHT)*PXSIZE, DWIDTH, - (BOX_HEIGHT+CHOICE_BOX_HEIGHT)*PXSIZE-1, C_WHITE); /* Display the diffrent choices. */ for(i=0;i<_choices_amount;i++){ if(i == selected) dtext(i*choice_size+PXSIZE, @@ -234,17 +237,33 @@ int _choice_call_before_end(Game *game) { } blit(); key = getkey().key; - if(key == KEY_LEFT && selected > 0) selected--; - else if(key == KEY_RIGHT && selected < _choices_amount) selected++; + if(key == KEY_LEFT && selected > 0){ + /* Remove the old arrow. */ + drect(selected*choice_size+PXSIZE, + (BOX_HEIGHT+CHOICE_BOX_PADDING_TOP)*PXSIZE, + selected*choice_size+PXSIZE+arrow_width, + (BOX_HEIGHT+CHOICE_BOX_PADDING_TOP)*PXSIZE+arrow_height, + C_WHITE); + selected--; + } + else if(key == KEY_RIGHT && selected < _choices_amount){ + /* Remove the old arrow. */ + drect(selected*choice_size+PXSIZE, + (BOX_HEIGHT+CHOICE_BOX_PADDING_TOP)*PXSIZE, + selected*choice_size+PXSIZE+arrow_width, + (BOX_HEIGHT+CHOICE_BOX_PADDING_TOP)*PXSIZE+arrow_height, + C_WHITE); + selected++; + } }while(key != KEY_EXE); /* Make a little animation because we looove little animations ;) */ for(i=DWIDTH/8+1;i>0;i--){ - restore_vram_part(0, BOX_HEIGHT*PXSIZE); + restore_vram_part(0, (BOX_HEIGHT+1)*PXSIZE+40); drect(0, BOX_HEIGHT*PXSIZE, i*(DWIDTH/8), (BOX_HEIGHT+CHOICE_BOX_HEIGHT)*PXSIZE, C_WHITE); drect(i*(DWIDTH/8), BOX_HEIGHT*PXSIZE, i*(DWIDTH/8)+PXSIZE, (BOX_HEIGHT+CHOICE_BOX_HEIGHT)*PXSIZE, C_BLACK); - drect(0, (BOX_HEIGHT+CHOICE_BOX_HEIGHT)*PXSIZE, i*(DWIDTH/8), + drect(0, (BOX_HEIGHT+CHOICE_BOX_HEIGHT)*PXSIZE+1, i*(DWIDTH/8), (BOX_HEIGHT+CHOICE_BOX_HEIGHT+1)*PXSIZE, C_BLACK); blit(); while(game->frame_duration < 20) sleep();