diff --git a/source/proc_arounders.cpp b/source/proc_arounders.cpp index d0d3102..aba9d28 100644 --- a/source/proc_arounders.cpp +++ b/source/proc_arounders.cpp @@ -74,8 +74,8 @@ namespace arounders void afegir() { arounder *a = new arounder(); - a->x = mapa::ini_x; - a->y = mapa::ini_y; + a->x = mapa::ini_x*16+8; + a->y = mapa::ini_y*16+8; a->orientacio = mapa::arounders::orientacio_inicial; a->frame = a->frameX = a->frameY = a->altura = 0; @@ -97,9 +97,9 @@ namespace arounders { arounder *a = arounders::first; + draw::setSource(sprites); while (a) { - draw::setSource(sprites); draw::draw(a->x, a->y, 8, 8, a->frameX*8, a->frameY); a = a->siguiente; } @@ -168,10 +168,30 @@ namespace arounders case arounders::accions::suicidi: procesarSuicidi(a); break; } - if (a->x == mapa::fin_x && a->y == mapa::fin_y) initArrivat(a); + if (a->x == (mapa::fin_x*16)+8 && a->y == (mapa::fin_y*16)+8) initArrivat(a); a = a->siguiente; } + + a = arounders::first; + if (a) + { + while (a->siguiente) a = a->siguiente; + + while (a) { + if (a->accio == arounders::accions::mort) { + arounder *borrar = a; + if (borrar->siguiente) borrar->siguiente->anterior = borrar->anterior; + if (borrar->anterior) borrar->anterior->siguiente = borrar->siguiente; + if (borrar == arounders::first) arounders::first = borrar->siguiente; + if (borrar == arounders::seleccionat) arounders::seleccionat = nullptr; + a = borrar->anterior; + delete borrar; + } else { + a = a->anterior; + } + } + } } uint8_t get_pixel(const int x, const int y) @@ -316,7 +336,11 @@ namespace arounders { a->frame = 0; a->prevista = arounders::accions::baixarcorda; - a->x = a->orientacio == arounders::orientacions::dreta ? a->x + 2 : a->x - 2; + if (a->orientacio == arounders::orientacions::dreta) { + a->x += 2; + } else { + a->x -= 2; + } procesarBaixarCorda(a); }