mirror of
https://git.planet-casio.com/Slyvtt/Collab_RPG.git
synced 2025-04-19 01:17:10 +02:00
Everything is now working, except the animation after choosing.
This commit is contained in:
parent
acb859eaa8
commit
ea66f50f44
3 changed files with 33 additions and 14 deletions
Binary file not shown.
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 1.2 KiB |
Binary file not shown.
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 956 B |
|
@ -2,7 +2,6 @@
|
|||
|
||||
#include <gint/keyboard.h>
|
||||
#include <gint/cpu.h>
|
||||
#include <gint/image.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
@ -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 <gint/image.h>
|
||||
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;i<DWIDTH/8+1;i++){
|
||||
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();
|
||||
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();
|
||||
|
|
Loading…
Add table
Reference in a new issue