From 5c02111ac26fc8a459e9feec24b4f540d7d49c62 Mon Sep 17 00:00:00 2001 From: mibi88 Date: Wed, 19 Jul 2023 00:17:38 +0200 Subject: [PATCH] Still trying to fix my image_t problems ... --- src/dialogs.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/dialogs.c b/src/dialogs.c index 90ed03d..cb537fc 100644 --- a/src/dialogs.c +++ b/src/dialogs.c @@ -183,22 +183,26 @@ int _choices_amount, _default_choice; #ifdef FXCG50 #include image_t vram_part_reference; - image_t vram_part; + image_t *vram_part = NULL; #else // Really need to code this! #endif void store_vram_part(int x, int y, int w, int h) { #ifdef FXCG50 + if(image_valid(vram_part)) image_free(vram_part); image_sub(image_create_vram(), x, y, w, h, &vram_part_reference); - image_copy(&vram_part_reference, &vram_part, true); + vram_part = image_create(w, h, IMAGE_RGB565); + if(vram_part){ + image_copy(&vram_part_reference, vram_part, true); + } #else // Really need to code this! #endif } void restore_vram_part(int x, int y) { #ifdef FXCG50 - dimage(x, y, &vram_part); + dimage(x, y, vram_part); #else // Really need to code this! #endif @@ -258,7 +262,7 @@ int _choice_call_before_end(Game *game) { }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+1)*PXSIZE+40); + restore_vram_part(0, (BOX_HEIGHT+1)*PXSIZE); 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, @@ -270,7 +274,7 @@ int _choice_call_before_end(Game *game) { game->frame_duration = 0; } #ifdef FXCG50 - // + if(image_valid(vram_part)) image_free(vram_part); #else // Really need to code this! #endif