mirror of
https://git.planet-casio.com/Slyvtt/Collab_RPG.git
synced 2025-04-20 01:47:34 +02:00
Managing interactive dialogs. Nothing tested yet.
This commit is contained in:
parent
6ccd93843d
commit
1a6ed047ea
1 changed files with 52 additions and 3 deletions
|
@ -151,8 +151,57 @@ void showtext_dialog_end(Game *game, bopti_image_t *face, char *text) {
|
||||||
showtext_opt(game, face, text, NULL, false, true);
|
showtext_opt(game, face, text, NULL, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
char **choices;
|
#define CHOICE_BOX_HEIGHT 10
|
||||||
|
#define CHOICE_BOX_PADDING_TOP 3
|
||||||
|
|
||||||
void _choice_call_before_end(void) {
|
char **choices;
|
||||||
//
|
int choices_amount, default_choice;
|
||||||
|
|
||||||
|
int _choice_call_before_end(void) {
|
||||||
|
int i, key;
|
||||||
|
/* Make a little animation because we looove little animations ;) */
|
||||||
|
for(i=0;i<DWIDTH/8+1;i++){
|
||||||
|
drect(0, (BOX_HEIGHT+CHOICE_BOX_HEIGHT)*PXSIZE, i*(DWIDTH/8),
|
||||||
|
(BOX_HEIGHT+CHOICE_BOX_HEIGHT)*PXSIZE, C_WHITE);
|
||||||
|
drect(i*(DWIDTH/8), 0, i*(DWIDTH/8)+PXSIZE,
|
||||||
|
(BOX_HEIGHT+CHOICE_BOX_HEIGHT)*PXSIZE, C_BLACK);
|
||||||
|
drect(0, (BOX_HEIGHT+CHOICE_BOX_HEIGHT)*PXSIZE, i*(DWIDTH/8),
|
||||||
|
(BOX_HEIGHT+CHOICE_BOX_HEIGHT+1)*PXSIZE, C_BLACK);
|
||||||
|
blit();
|
||||||
|
while(game->frame_duration < 20) sleep();
|
||||||
|
game->frame_duration = 0;
|
||||||
|
}
|
||||||
|
const int choice_size = DWIDTH/choices_amount;
|
||||||
|
int arrow_width, selected = default_choice;
|
||||||
|
dsize(">", FONT_USED, &arrow_width, NULL);
|
||||||
|
do{
|
||||||
|
/* Clear the box. */
|
||||||
|
drect(0, (BOX_HEIGHT+CHOICE_BOX_HEIGHT)*PXSIZE, (DWIDTH/8)*(DWIDTH/8),
|
||||||
|
(BOX_HEIGHT+CHOICE_BOX_HEIGHT)*PXSIZE, C_WHITE);
|
||||||
|
for(i=0;i<choices_amount;i++){
|
||||||
|
if(i == selected) dtext(i*choice_size,
|
||||||
|
BOX_HEIGHT+PXSIZE*CHOICE_BOX_PADDING_TOP,
|
||||||
|
C_BLACK, ">");
|
||||||
|
dtext(i*choice_size+arrow_width,
|
||||||
|
BOX_HEIGHT+PXSIZE*CHOICE_BOX_PADDING_TOP, C_BLACK,
|
||||||
|
choices[i]);
|
||||||
|
}
|
||||||
|
blit();
|
||||||
|
key = getkey().key;
|
||||||
|
if(key == KEY_LEFT && selected > 0) selected--;
|
||||||
|
else if(key == KEY_RIGHT && selected < choices_amount) selected++;
|
||||||
|
}while(key != KEY_EXE);
|
||||||
|
/* Make a little animation because we looove little animations ;) */
|
||||||
|
for(i=DWIDTH/8+1;i>0;i++){
|
||||||
|
drect(0, (BOX_HEIGHT+CHOICE_BOX_HEIGHT)*PXSIZE, i*(DWIDTH/8),
|
||||||
|
(BOX_HEIGHT+CHOICE_BOX_HEIGHT)*PXSIZE, C_WHITE);
|
||||||
|
drect(i*(DWIDTH/8), 0, i*(DWIDTH/8)+PXSIZE,
|
||||||
|
(BOX_HEIGHT+CHOICE_BOX_HEIGHT)*PXSIZE, C_BLACK);
|
||||||
|
drect(0, (BOX_HEIGHT+CHOICE_BOX_HEIGHT)*PXSIZE, i*(DWIDTH/8),
|
||||||
|
(BOX_HEIGHT+CHOICE_BOX_HEIGHT+1)*PXSIZE, C_BLACK);
|
||||||
|
blit();
|
||||||
|
while(game->frame_duration < 20) sleep();
|
||||||
|
game->frame_duration = 0;
|
||||||
|
}
|
||||||
|
return selected;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue