mirror of
https://git.planet-casio.com/Slyvtt/Collab_RPG.git
synced 2024-12-29 13:03:43 +01:00
Started adding comments. Still have this weird bug on the mono calculator
This commit is contained in:
parent
c82a9fc5da
commit
d1e32de9c5
2 changed files with 24 additions and 9 deletions
|
@ -39,7 +39,7 @@ int showtext_opt(Game *game, bopti_image_t *face, char *text,
|
||||||
bool start_anim,
|
bool start_anim,
|
||||||
bool end_anim,
|
bool end_anim,
|
||||||
void for_each_screen(Game *game, unsigned int i),
|
void for_each_screen(Game *game, unsigned int i),
|
||||||
int line_duration, bool line_anim, unsigned int start_i,
|
int line_duration, bool update_screen, unsigned int start_i,
|
||||||
bool wait_continue) {
|
bool wait_continue) {
|
||||||
dfont(&FONT_USED);
|
dfont(&FONT_USED);
|
||||||
unsigned int i, n, y = PXSIZE, l = 0;
|
unsigned int i, n, y = PXSIZE, l = 0;
|
||||||
|
@ -50,10 +50,17 @@ int showtext_opt(Game *game, bopti_image_t *face, char *text,
|
||||||
if(start_anim){
|
if(start_anim){
|
||||||
/* Run a little fancy animation. */
|
/* Run a little fancy animation. */
|
||||||
for(i=0;i<=BOX_HEIGHT;i++){
|
for(i=0;i<=BOX_HEIGHT;i++){
|
||||||
|
/* Redrawing the entire screen, because maybe there was no dialog
|
||||||
|
displayed before. */
|
||||||
draw(game);
|
draw(game);
|
||||||
|
|
||||||
|
/* Fill the dialog box with white */
|
||||||
drect(0, 0, DWIDTH, i*PXSIZE, C_WHITE);
|
drect(0, 0, DWIDTH, i*PXSIZE, C_WHITE);
|
||||||
|
/* Draw a thick black line on the bottom of the dialog. */
|
||||||
drect(0, i*PXSIZE, DWIDTH, (i+1)*PXSIZE, C_BLACK);
|
drect(0, i*PXSIZE, DWIDTH, (i+1)*PXSIZE, C_BLACK);
|
||||||
|
|
||||||
|
/* Draw the part of the face of the player that can fit correctly in
|
||||||
|
* the dialog drawn. */
|
||||||
dsubimage(4*PXSIZE, 2*PXSIZE, face, 0, 0, F_WIDTH, (i-8)*PXSIZE,
|
dsubimage(4*PXSIZE, 2*PXSIZE, face, 0, 0, F_WIDTH, (i-8)*PXSIZE,
|
||||||
DIMAGE_NONE);
|
DIMAGE_NONE);
|
||||||
|
|
||||||
|
@ -63,16 +70,20 @@ int showtext_opt(Game *game, bopti_image_t *face, char *text,
|
||||||
game->frame_duration = 0;
|
game->frame_duration = 0;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
|
/* Here I'm drawing the same as if start_anim is true, but whitout
|
||||||
|
* making an animation. */
|
||||||
draw(game);
|
draw(game);
|
||||||
drect(0, 0, DWIDTH, BOX_HEIGHT*PXSIZE, C_WHITE);
|
drect(0, 0, DWIDTH, BOX_HEIGHT*PXSIZE, C_WHITE);
|
||||||
drect(0, BOX_HEIGHT*PXSIZE, DWIDTH, (BOX_HEIGHT+1)*PXSIZE, C_BLACK);
|
drect(0, BOX_HEIGHT*PXSIZE, DWIDTH, (BOX_HEIGHT+1)*PXSIZE, C_BLACK);
|
||||||
dimage(4*PXSIZE, 2*PXSIZE, face);
|
dimage(4*PXSIZE, 2*PXSIZE, face);
|
||||||
|
|
||||||
if(line_anim) blit();
|
if(update_screen){
|
||||||
|
blit();
|
||||||
|
|
||||||
while(game->frame_duration < 20) sleep();
|
while(game->frame_duration < 20) sleep();
|
||||||
game->frame_duration = 0;
|
game->frame_duration = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/* We should start to drawing the text on the x axis at BOX_HEIGHT to avoid
|
/* We should start to drawing the text on the x axis at BOX_HEIGHT to avoid
|
||||||
* drawing on the face. */
|
* drawing on the face. */
|
||||||
for(i=start_i;i<strlen(text);i++){
|
for(i=start_i;i<strlen(text);i++){
|
||||||
|
@ -111,15 +122,17 @@ int showtext_opt(Game *game, bopti_image_t *face, char *text,
|
||||||
/* We drew one entire screen, reset everything to draw the next one.
|
/* We drew one entire screen, reset everything to draw the next one.
|
||||||
*/
|
*/
|
||||||
/* Make a little animation :). */
|
/* Make a little animation :). */
|
||||||
if(line_anim) blit();
|
if(update_screen) blit();
|
||||||
while(game->frame_duration < line_duration) sleep();
|
while(game->frame_duration < line_duration) sleep();
|
||||||
game->frame_duration = 0;
|
game->frame_duration = 0;
|
||||||
/* Ask the user to press EXE to continue. */
|
/* Ask the user to press EXE to continue. */
|
||||||
dtext(BOX_HEIGHT*PXSIZE, y, C_BLACK, "[EXE] to continue ...");
|
dtext(BOX_HEIGHT*PXSIZE, y, C_BLACK, "[EXE] to continue ...");
|
||||||
}
|
}
|
||||||
/* Make a little animation :). */
|
/* Make a little animation :). */
|
||||||
if(line_anim) blit();
|
if(update_screen) blit();
|
||||||
if(l>=max_lines_amount-1){
|
if(l>=max_lines_amount-1){
|
||||||
|
/* If we drew one entire screen. */
|
||||||
|
/* Wait that the EXE key is pressed if we should. */
|
||||||
if(wait_continue) while(getkey().key != KEY_EXE) sleep();
|
if(wait_continue) while(getkey().key != KEY_EXE) sleep();
|
||||||
/* Clear the text area. */
|
/* Clear the text area. */
|
||||||
drect(BOX_HEIGHT*PXSIZE, 0, DWIDTH, (BOX_HEIGHT-1)*PXSIZE-2,
|
drect(BOX_HEIGHT*PXSIZE, 0, DWIDTH, (BOX_HEIGHT-1)*PXSIZE-2,
|
||||||
|
@ -129,6 +142,7 @@ int showtext_opt(Game *game, bopti_image_t *face, char *text,
|
||||||
l = 0;
|
l = 0;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
/* Else, wait a bit for the animation. */
|
||||||
while(game->frame_duration < line_duration) sleep();
|
while(game->frame_duration < line_duration) sleep();
|
||||||
game->frame_duration = 0;
|
game->frame_duration = 0;
|
||||||
}
|
}
|
||||||
|
@ -136,12 +150,13 @@ int showtext_opt(Game *game, bopti_image_t *face, char *text,
|
||||||
if(l<max_lines_amount-1){
|
if(l<max_lines_amount-1){
|
||||||
/* If we have not filled everthing with text at the end. */
|
/* If we have not filled everthing with text at the end. */
|
||||||
/* Make a little animation :). */
|
/* Make a little animation :). */
|
||||||
if(line_anim) blit();
|
if(update_screen) blit();
|
||||||
while(game->frame_duration < line_duration) sleep();
|
while(game->frame_duration < line_duration) sleep();
|
||||||
game->frame_duration = 0;
|
game->frame_duration = 0;
|
||||||
/* Ask the user to press EXE to continue. */
|
/* Ask the user to press EXE to continue. */
|
||||||
dtext(BOX_HEIGHT*PXSIZE, y, C_BLACK, "[EXE] to continue ...");
|
dtext(BOX_HEIGHT*PXSIZE, y, C_BLACK, "[EXE] to continue ...");
|
||||||
if(line_anim) blit();
|
/* Update the screen and wait for EXE being pressed, if needed. */
|
||||||
|
if(update_screen) blit();
|
||||||
if(wait_continue) while(getkey().key != KEY_EXE) sleep();
|
if(wait_continue) while(getkey().key != KEY_EXE) sleep();
|
||||||
}
|
}
|
||||||
if(call_before_end) return_int = call_before_end(game, i);
|
if(call_before_end) return_int = call_before_end(game, i);
|
||||||
|
|
|
@ -14,7 +14,7 @@ int showtext_opt(Game *game, bopti_image_t *face, char *text,
|
||||||
bool start_anim,
|
bool start_anim,
|
||||||
bool end_anim,
|
bool end_anim,
|
||||||
void for_each_screen(Game *game, unsigned int i),
|
void for_each_screen(Game *game, unsigned int i),
|
||||||
int line_duration, bool line_anim, unsigned int start_i,
|
int line_duration, bool update_screen, unsigned int start_i,
|
||||||
bool wait_continue);
|
bool wait_continue);
|
||||||
|
|
||||||
void showtext_dialog(Game *game, bopti_image_t *face, char *text,
|
void showtext_dialog(Game *game, bopti_image_t *face, char *text,
|
||||||
|
|
Loading…
Reference in a new issue