diff --git a/CPC.g1a b/CPC.g1a index 9d8e540..04060e7 100644 Binary files a/CPC.g1a and b/CPC.g1a differ diff --git a/build-fx/CPC.bin b/build-fx/CPC.bin index d51dd68..5ec222b 100755 Binary files a/build-fx/CPC.bin and b/build-fx/CPC.bin differ diff --git a/build-fx/CPC.elf b/build-fx/CPC.elf index 311b56f..bd9fda8 100755 Binary files a/build-fx/CPC.elf and b/build-fx/CPC.elf differ diff --git a/build-fx/map b/build-fx/map index 31acc1e..a2d7e69 100644 --- a/build-fx/map +++ b/build-fx/map @@ -244,61 +244,62 @@ LOAD /home/michel/Documents/gcc/sh-elf-2.34-9.2.0/lib/gcc/sh3eb-elf/9.2.0/libgcc .text 0x0000000000300b2c 0xe0 build-fx/src/main.c.o 0x0000000000300b2c _tile 0x0000000000300be8 _perso - .text.startup 0x0000000000300c0c 0x114 build-fx/src/main.c.o + .text.startup 0x0000000000300c0c 0x110 build-fx/src/main.c.o 0x0000000000300c0c _main - .text 0x0000000000300d20 0x3fc /home/michel/Documents/gcc/sh-elf-2.34-9.2.0/lib/gcc/sh3eb-elf/9.2.0/libgint-fx.a(keysc.c.o) - 0x0000000000300ec8 _pollevent - 0x000000000030100c _waitevent - 0x0000000000301058 _clearevents - 0x0000000000301078 _keydown - 0x00000000003010a4 _keydown_all - 0x00000000003010e0 _keydown_any - .text 0x000000000030111c 0x124 /home/michel/Documents/gcc/sh-elf-2.34-9.2.0/lib/gcc/sh3eb-elf/9.2.0/libgint-fx.a(iokbd.c.o) - 0x0000000000301128 _iokbd_row - 0x0000000000301210 _iokbd_scan - .text 0x0000000000301240 0x0 /home/michel/Documents/gcc/sh-elf-2.34-9.2.0/lib/gcc/sh3eb-elf/9.2.0/libgint-fx.a(hardware.c.o) - .text 0x0000000000301240 0x0 /home/michel/Documents/gcc/sh-elf-2.34-9.2.0/lib/gcc/sh3eb-elf/9.2.0/libgint-fx.a(start.c.o) - .text 0x0000000000301240 0x56c /home/michel/Documents/gcc/sh-elf-2.34-9.2.0/lib/gcc/sh3eb-elf/9.2.0/libgint-fx.a(tmu.c.o) - 0x0000000000301560 _timer_setup - 0x00000000003015f0 _timer_delay - 0x0000000000301650 _timer_start - 0x0000000000301684 _timer_reload - 0x00000000003016a4 _timer_pause - 0x00000000003016d8 _timer_stop - 0x0000000000301734 _timer_timeout - 0x0000000000301740 _timer_address - 0x000000000030177c _timer_clear - .text 0x00000000003017ac 0x0 /home/michel/Documents/gcc/sh-elf-2.34-9.2.0/lib/gcc/sh3eb-elf/9.2.0/libgint-fx.a(inth.s.o) - .text 0x00000000003017ac 0xdc /home/michel/Documents/gcc/sh-elf-2.34-9.2.0/lib/gcc/sh3eb-elf/9.2.0/libgint-fx.a(memory.c.o) - 0x00000000003017ac _memcpy - 0x0000000000301866 __memmove - 0x000000000030186a __memcmp - 0x000000000030186e _memset - .text 0x0000000000301888 0xf4 /home/michel/Documents/gcc/sh-elf-2.34-9.2.0/lib/gcc/sh3eb-elf/9.2.0/libgint-fx.a(gimage.c.o) - 0x0000000000301888 _gimage - 0x00000000003018f8 _gsubimage - .text 0x000000000030197c 0x5c /home/michel/Documents/gcc/sh-elf-2.34-9.2.0/lib/gcc/sh3eb-elf/9.2.0/libgint-fx.a(gclear.c.o) - 0x000000000030197c _gclear - .text 0x00000000003019d8 0x17c /home/michel/Documents/gcc/sh-elf-2.34-9.2.0/lib/gcc/sh3eb-elf/9.2.0/libgint-fx.a(engine.c.o) - 0x00000000003019d8 _gray_int - 0x0000000000301a28 _gray_start - 0x0000000000301a98 _gray_stop - 0x0000000000301ab4 _gray_delays - 0x0000000000301ac0 _gray_config - 0x0000000000301ae4 _gupdate - 0x0000000000301af4 _gvram - 0x0000000000301b24 _gvraml - 0x0000000000301b3c _gvramd - .text.startup 0x0000000000301b54 0x40 /home/michel/Documents/gcc/sh-elf-2.34-9.2.0/lib/gcc/sh3eb-elf/9.2.0/libgint-fx.a(engine.c.o) - .text.exit 0x0000000000301b94 0x28 /home/michel/Documents/gcc/sh-elf-2.34-9.2.0/lib/gcc/sh3eb-elf/9.2.0/libgint-fx.a(engine.c.o) - .text 0x0000000000301bbc 0x410 /home/michel/Documents/gcc/sh-elf-2.34-9.2.0/lib/gcc/sh3eb-elf/9.2.0/libgint-fx.a(bopti.c.o) - 0x0000000000301bbc _bopti_grid - 0x0000000000301d30 _bopti_render - 0x0000000000301e60 _bopti_render_clip - 0x0000000000301f74 _bopti_render_noclip - .text 0x0000000000301fcc 0x24 /home/michel/Documents/gcc/sh-elf-2.34-9.2.0/lib/gcc/sh3eb-elf/9.2.0/libgint-fx.a(dupdate.c.o) - 0x0000000000301fcc _dupdate - 0x0000000000301fe4 _dupdate_noint + .text 0x0000000000300d1c 0x3fc /home/michel/Documents/gcc/sh-elf-2.34-9.2.0/lib/gcc/sh3eb-elf/9.2.0/libgint-fx.a(keysc.c.o) + 0x0000000000300ec4 _pollevent + 0x0000000000301008 _waitevent + 0x0000000000301054 _clearevents + 0x0000000000301074 _keydown + 0x00000000003010a0 _keydown_all + 0x00000000003010dc _keydown_any + .text 0x0000000000301118 0x124 /home/michel/Documents/gcc/sh-elf-2.34-9.2.0/lib/gcc/sh3eb-elf/9.2.0/libgint-fx.a(iokbd.c.o) + 0x0000000000301124 _iokbd_row + 0x000000000030120c _iokbd_scan + .text 0x000000000030123c 0x0 /home/michel/Documents/gcc/sh-elf-2.34-9.2.0/lib/gcc/sh3eb-elf/9.2.0/libgint-fx.a(hardware.c.o) + .text 0x000000000030123c 0x0 /home/michel/Documents/gcc/sh-elf-2.34-9.2.0/lib/gcc/sh3eb-elf/9.2.0/libgint-fx.a(start.c.o) + .text 0x000000000030123c 0x56c /home/michel/Documents/gcc/sh-elf-2.34-9.2.0/lib/gcc/sh3eb-elf/9.2.0/libgint-fx.a(tmu.c.o) + 0x000000000030155c _timer_setup + 0x00000000003015ec _timer_delay + 0x000000000030164c _timer_start + 0x0000000000301680 _timer_reload + 0x00000000003016a0 _timer_pause + 0x00000000003016d4 _timer_stop + 0x0000000000301730 _timer_timeout + 0x000000000030173c _timer_address + 0x0000000000301778 _timer_clear + .text 0x00000000003017a8 0x0 /home/michel/Documents/gcc/sh-elf-2.34-9.2.0/lib/gcc/sh3eb-elf/9.2.0/libgint-fx.a(inth.s.o) + .text 0x00000000003017a8 0xdc /home/michel/Documents/gcc/sh-elf-2.34-9.2.0/lib/gcc/sh3eb-elf/9.2.0/libgint-fx.a(memory.c.o) + 0x00000000003017a8 _memcpy + 0x0000000000301862 __memmove + 0x0000000000301866 __memcmp + 0x000000000030186a _memset + .text 0x0000000000301884 0xf4 /home/michel/Documents/gcc/sh-elf-2.34-9.2.0/lib/gcc/sh3eb-elf/9.2.0/libgint-fx.a(gimage.c.o) + 0x0000000000301884 _gimage + 0x00000000003018f4 _gsubimage + .text 0x0000000000301978 0x5c /home/michel/Documents/gcc/sh-elf-2.34-9.2.0/lib/gcc/sh3eb-elf/9.2.0/libgint-fx.a(gclear.c.o) + 0x0000000000301978 _gclear + .text 0x00000000003019d4 0x17c /home/michel/Documents/gcc/sh-elf-2.34-9.2.0/lib/gcc/sh3eb-elf/9.2.0/libgint-fx.a(engine.c.o) + 0x00000000003019d4 _gray_int + 0x0000000000301a24 _gray_start + 0x0000000000301a94 _gray_stop + 0x0000000000301ab0 _gray_delays + 0x0000000000301abc _gray_config + 0x0000000000301ae0 _gupdate + 0x0000000000301af0 _gvram + 0x0000000000301b20 _gvraml + 0x0000000000301b38 _gvramd + .text.startup 0x0000000000301b50 0x40 /home/michel/Documents/gcc/sh-elf-2.34-9.2.0/lib/gcc/sh3eb-elf/9.2.0/libgint-fx.a(engine.c.o) + .text.exit 0x0000000000301b90 0x28 /home/michel/Documents/gcc/sh-elf-2.34-9.2.0/lib/gcc/sh3eb-elf/9.2.0/libgint-fx.a(engine.c.o) + .text 0x0000000000301bb8 0x410 /home/michel/Documents/gcc/sh-elf-2.34-9.2.0/lib/gcc/sh3eb-elf/9.2.0/libgint-fx.a(bopti.c.o) + 0x0000000000301bb8 _bopti_grid + 0x0000000000301d2c _bopti_render + 0x0000000000301e5c _bopti_render_clip + 0x0000000000301f70 _bopti_render_noclip + .text 0x0000000000301fc8 0x24 /home/michel/Documents/gcc/sh-elf-2.34-9.2.0/lib/gcc/sh3eb-elf/9.2.0/libgint-fx.a(dupdate.c.o) + 0x0000000000301fc8 _dupdate + 0x0000000000301fe0 _dupdate_noint + *fill* 0x0000000000301fec 0x4 .text 0x0000000000301ff0 0x150 /home/michel/Documents/gcc/sh-elf-2.34-9.2.0/lib/gcc/sh3eb-elf/9.2.0/libgint-fx.a(bopti-asm-gray.s.o) 0x0000000000301ff0 _bopti_gasm_mono 0x000000000030202c _bopti_gasm_mono_alpha diff --git a/build-fx/src/main.c.o b/build-fx/src/main.c.o index 9363de7..c51f75c 100644 Binary files a/build-fx/src/main.c.o and b/build-fx/src/main.c.o differ diff --git a/src/main.c b/src/main.c index 49c4a21..baa49fa 100644 --- a/src/main.c +++ b/src/main.c @@ -4,8 +4,8 @@ #include //Boucle qui va afficher l'image correspondante à l'emplacement dans le tableau 'map' -void tile(int* map, int* img, int* sup); -void perso(int* tp, int* perso); +void tile(int* map, image_t** img, image_t** sup); +void perso(int* tp, image_t** perso); int main(void) { @@ -60,25 +60,25 @@ int main(void) //2xx: Rebond //{, , , , , , , , , , , , , , , } //La carte de l'ecran pour les tiles - int map[8][16] = { - {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}, - {15, 115, 215, 315, 415, 515, 615, 715, 815, 915, 1015, 1115, 1215, 1315, 1415, 1515}, - {17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17}, - {6, 1614, 1714, 12, 16, 17, 6, 14, 14, 14, 14, 14, 14, 14, 14, 12}, - {7, 15, 15, 115, 14, 14, 815, 15, 15, 15, 15, 15, 15, 15, 15, 13}, - {3, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 9}, - {17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17}, - {17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17}}; + int map[128] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 15, 115, 215, 315, 415, 515, 615, 715, 815, 915, 1015, 1115, 1215, 1315, 1415, 1515, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 6, 1614, 1714, 12, 16, 17, 6, 14, 14, 14, 14, 14, 14, 14, 14, 12, + 7, 15, 15, 115, 14, 14, 815, 15, 15, 15, 15, 15, 15, 15, 15, 13, + 3, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 9, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17}; //Les pointeurs des images - int p_img[17] = {&img_t0, &img_t1, &img_t2, &img_t3, &img_t4, &img_t5, &img_t6, &img_t7, &img_t8, &img_t9, &img_t10, &img_t11, &img_t12, &img_t13, &img_t14, &img_t15, &img_Porte}; - int p_sup[17] = {&img_1, &img_2, &img_3, &img_4, &img_5, &img_6, &img_7, &img_8, &img_9, &img_10, &img_11, &img_12, &img_13, &img_14, &img_15, &img_Vitesse, &img_Rebond}; - int p_perso[3] = {&img_G, &img_N, &img_D}; + image_t* p_img[17] = {&img_t0, &img_t1, &img_t2, &img_t3, &img_t4, &img_t5, &img_t6, &img_t7, &img_t8, &img_t9, &img_t10, &img_t11, &img_t12, &img_t13, &img_t14, &img_t15, &img_Porte}; + image_t* p_sup[17] = {&img_1, &img_2, &img_3, &img_4, &img_5, &img_6, &img_7, &img_8, &img_9, &img_10, &img_11, &img_12, &img_13, &img_14, &img_15, &img_Vitesse, &img_Rebond}; + image_t* p_perso[3] = {&img_G, &img_N, &img_D}; //Le dessin ^^ while (boucle == 0) { - gclear('white'); - tile(&map, &p_img, &p_sup); - perso(&tp, &p_perso); + gclear(C_WHITE); + tile(map, p_img, p_sup); + perso(tp, p_perso); //L'affichage gupdate(); touche = pollevent(); @@ -106,18 +106,18 @@ int main(void) return 1; } -void tile(int* map, int* img, int* sup) +void tile(int* map, image_t** img, image_t** sup) { for (int i = 0 ; i <= 7 ; i++) { for (int j = 0 ; j <= 15 ; j++) { - if (*(map + 16*i + j) != 17) + if (map[16*i + j] != 17) { - gimage(8*j, 8*i, *(img + *(map + 16*i + j) - 100 * (*(map + 16*i + j) / 100))); - if (*(map + 16*i + j) > 99) + gimage(8*j, 8*i, img[map[16*i+j]-(map[16*i+j]/100)*100]/**(img + *(map + 16*i + j) - 100 * (*(map + 16*i + j) / 100))*/); + if (map[16*i+j] > 99) { - gimage(8*j, 8*i, *(sup + (*(map + 16*i + j) / 100) -1)); + gimage(8*j, 8*i, sup[(map[16*i+j]/100)-1]); } } @@ -125,12 +125,12 @@ void tile(int* map, int* img, int* sup) } } -void perso(int* tp, int* perso) +void perso(int* tp, image_t** perso) { - if (*tp == 1) - gimage(2, 18, *perso); - else if (*(tp+1) == 1) - gimage(2, 18, *(perso+2)); + if (tp[0] == 1) + gimage(2, 18, perso[0]); + else if (tp[1] == 1) + gimage(2, 18, perso[2]); else - gimage(2, 18, *(perso+1)); + gimage(2, 18, perso[1]); }