From bbfd2fdd6cb5e792870d4cd8eba82d0b62a0d289 Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Fri, 3 Nov 2023 15:58:42 +0100 Subject: [PATCH] WIP Bon. Il reste juste cette inversion Nord/Sud dans le dessin, semble-t-il. --- src/graphics/arrows.c | 2 -- src/graphics/graphics.c | 19 +++++++++++-------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/graphics/arrows.c b/src/graphics/arrows.c index bf5fe84..3dc2d7c 100644 --- a/src/graphics/arrows.c +++ b/src/graphics/arrows.c @@ -90,5 +90,3 @@ int write_one_arrow_line(int offset_vertex, int print) graphics_write_line (offset_vertex + 0, offset_vertex + 1, print); return 2; } - - diff --git a/src/graphics/graphics.c b/src/graphics/graphics.c index b641468..0a75b80 100644 --- a/src/graphics/graphics.c +++ b/src/graphics/graphics.c @@ -596,6 +596,7 @@ bool graphics_shutdown(const void *gl_area) static int rewrite_arrow (int arrows_nb, int address, int load, int site, int x, int y, int z, int console) { + printf("WARNING in rewrite_arrow() <> address or address / 5 ? (et pourquoi ?)\n"); arrows_ptr[address].load = load; if (console) print_arrows_array (arrows_ptr, arrows_nb, 2); @@ -665,11 +666,13 @@ static inline int erase_arrow (int arrows_nb, int arrow_address_in_list, arrows_nb + 1, arrows_nb, arrow_address_in_list, arrow_address_in_list, mem, arrows_nb, arrows_ptr[arrows_nb].site); } - for (long i = 0 + arrow_address_in_list * 6; i < 6 + arrow_address_in_list * 6; i++) - buffer_vertex_origin [buffer_vertex_0_arrow + i] = buffer_vertex_origin [buffer_vertex_size - 6 + i]; + for (long i = 0; i < 6; i++) + buffer_vertex_origin [buffer_vertex_0_arrow + arrow_address_in_list * 6 + i] + = buffer_vertex_origin [buffer_vertex_size - 6 + i]; - for (long i = 0 + arrow_address_in_list * 6; i < 6 + arrow_address_in_list * 6; i++) - buffer_colors_origin [buffer_colors_0_arrow + i] = buffer_colors_origin [buffer_colors_size - 6 + i]; + for (long i = 0; i < 6; i++) + buffer_colors_origin [buffer_colors_0_arrow + arrow_address_in_list * 6 + i] + = buffer_colors_origin [buffer_colors_size - 6 + i]; buffer_vertex_size -= 6; // <<< l'inverse de ce qui est fait dans : graphics_write_vertex() buffer_colors_size -= 6; // <<< l'inverse de ce qui est fait dans : graphics_write_colors() @@ -725,7 +728,7 @@ static inline int set_arrow (struct arrow_t *arrows_ptr, int arrows_nb, int spac if (address >= 0 && requested_weight == 0) // address >= 0 if and only if arrows_nb > 0 return erase_arrow (arrows_nb, address, site, arrow_x, arrow_y, arrow_z, console); if (address >= 0 && current_weight != requested_weight) - return rewrite_arrow (arrows_nb, address/5, requested_weight, site, arrow_x, arrow_y, arrow_z, console); + return rewrite_arrow (arrows_nb, address, requested_weight, site, arrow_x, arrow_y, arrow_z, console); if (address >= 0 && current_weight == requested_weight && console) print_arrows_array(arrows_ptr, arrows_nb, 3); if (address == -1 && requested_weight == 0 && console) print_arrows_array(arrows_ptr, arrows_nb, 4); @@ -784,11 +787,11 @@ void main_test_graphics (void) rand() % space_Z, // z console); /* else for (int i = 0; i < 1; i++) ; */ - arrows_nb = set_arrow (arrows_ptr, arrows_nb, 1, 1, 1, 0, 0, 0, 0, 0, 1); - arrows_nb = set_arrow (arrows_ptr, arrows_nb, 1, 1, 1, 0, 1, 0, 0, 0, 1); + /* arrows_nb = set_arrow (arrows_ptr, arrows_nb, 1, 1, 1, 0, 0, 0, 0, 0, 1); */ + /* arrows_nb = set_arrow (arrows_ptr, arrows_nb, 1, 1, 1, 0, 1, 0, 0, 0, 1); */ /* arrows_nb = set_arrow (arrows_ptr, arrows_nb, 1, 1, 1, 0, 2, 0, 0, 0, 1); */ /* arrows_nb = set_arrow (arrows_ptr, arrows_nb, 1, 1, 1, 0, 3, 0, 0, 0, 1); */ - /* arrows_nb = set_arrow (arrows_ptr, arrows_nb, 1, 1, 1, 0, 4, 0, 0, 0, 1); */ + arrows_nb = set_arrow (arrows_ptr, arrows_nb, 1, 1, 1, 0, 4, 0, 0, 0, 1); /* arrows_nb = set_arrow (arrows_ptr, arrows_nb, 1, 1, 1, 0, 5, 0, 0, 0, 1); */ /* arrows_nb = set_arrow (arrows_ptr, arrows_nb, 1, 1, 1, 0, 6, 0, 0, 0, 1); */