From 7b76a54756ae4a858cc112d8d47b72e6fc2abf76 Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Fri, 22 Sep 2023 22:28:56 +0200 Subject: [PATCH] WIP: Et maintenant, il faut distinguer les arrows-data des arrows-en-place --- src/graphics/graphics.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/graphics/graphics.c b/src/graphics/graphics.c index c0dc646..d72068d 100644 --- a/src/graphics/graphics.c +++ b/src/graphics/graphics.c @@ -53,11 +53,11 @@ static int buffer_plans_size = 0; static GLuint arrows[] = { 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, - /* 1, 1, 0, 0, 0, */ - /* 1, 2, 0, 0, 0, */ - /* 1, 3, 0, 0, 0, */ - /* 1, 4, 0, 0, 0, */ - /* 1, 5, 0, 0, 0, */ + 1, 1, 0, 0, 0, + 1, 2, 0, 0, 0, + 1, 3, 0, 0, 0, + 1, 4, 0, 0, 0, + 1, 5, 0, 0, 0, // load, site, x, y, z }; @@ -160,7 +160,7 @@ static bool erase_arrow (int address, int site, int x, int y, int z) return 1; } -static int check_for_arrow (int site, int x, int y, int z) +static int check_for_arrow (int weight, int site, int x, int y, int z) { int arrows_nb = get_arrows_nb(); if (arrows_nb == 0) return -1; @@ -174,7 +174,7 @@ static int check_for_arrow (int site, int x, int y, int z) f_y = *(arrows + i * 5 + 3); f_z = *(arrows + i * 5 + 4); - if (f_site == site && f_x == x && f_y == y && f_z == z) { + if (f_weight == weight && f_site == site && f_x == x && f_y == y && f_z == z) { address = i * 5; if (DETAIL) printf("arrows_nb = %d checked arrow (%d,%d,%d,%d) found at address %d (line %d)",\ arrows_nb, site, x, y, z, address, address / 5); @@ -215,7 +215,7 @@ static void show_arrows_array (int address, int weight, int site, int x, int y, static int set_arrow (int weight, int site, int x, int y, int z) { - int address = (check_for_arrow (site, x, y, z)); + int address = (check_for_arrow (weight, site, x, y, z)); show_arrows_array(address, weight, site, x, y, z); if (address == -1 && weight == 0) return 0; @@ -790,7 +790,7 @@ void main_test_graphics (void) /* ARROWS */ arrows_write_terminations (x, y, z); - int arrows_nb = get_arrows_nb(); + int arrows_nb = get_arrows_nb(), cube_coord = 0; for (int i = 0; i < arrows_nb; i++) { weight = arrows[i * 5 + 0]; @@ -801,8 +801,8 @@ void main_test_graphics (void) set_arrow (weight, site, x, y, z); - /* // cube coordinates = 12 * (stx * x + sty * y + stz * z); */ - arrow_offset = offset_after_grids + 12 * (stx * x + sty * y + stz * z); + cube_coord = 12 * (stx * x + sty * y + stz * z); + arrow_offset = offset_after_grids + cube_coord; arrows_write_basis (arrow_offset); switch(site){ @@ -819,6 +819,8 @@ void main_test_graphics (void) offset_after_arrows, offset_after_arrows, offset_after_grids,\ difference, difference, difference / 12); if (0) printf("main_test_graphics [ok]\n"); + if (1) printf("\n Et maintenant, il faut distinguer les arrows-data des arrows-en-place\n\ + [to be] vs. [done]\n\n"); }