The Matrix plugin -- Bugfix

Off by one errorS in the matrix plugin

might even say its the matrix plugin re-loaded

Change-Id: I2bc7487615a9e28fcd1d170961fb0b5ee6da6af7
This commit is contained in:
William Wilgus 2021-04-16 09:45:03 -04:00
parent 42dba708e3
commit a9d3e9a13d

View file

@ -166,7 +166,7 @@ static void matrix_loop(void)
*/ */
/* A little more random now for spaces */ /* A little more random now for spaces */
if (rb->rand() % randomness == 1){ if (rb->rand() % randomness == 1){
while (i <= ROWS && (matrix[i][j].val == 129 || while (i < ROWS && (matrix[i][j].val == 129 ||
matrix[i][j].val == -1)){ matrix[i][j].val == -1)){
i++; i++;
randomness--; randomness--;
@ -179,19 +179,19 @@ static void matrix_loop(void)
} }
if (i > ROWS) if (i >= ROWS)
break; break;
/* Go to the head of this collumn */ /* Go to the head of this collumn */
z = i; z = i;
y = 0; y = 0;
while (i <= ROWS && (matrix[i][j].val != 129 && while (i < ROWS && (matrix[i][j].val != 129 &&
matrix[i][j].val != -1)) { matrix[i][j].val != -1)) {
i++; i++;
y++; y++;
} }
if (i > ROWS) { if (i >= ROWS) {
matrix[z][j].val = 129; matrix[z][j].val = 129;
matrix[ROWS - 1][j].bold = 1; matrix[ROWS - 1][j].bold = 1;
matrix_blit_char(z - 1, j, matrix[z][j].val); matrix_blit_char(z - 1, j, matrix[z][j].val);
@ -200,7 +200,7 @@ static void matrix_loop(void)
matrix[i][j].val = rb->rand() % (MAXCHARS-1) + 1; matrix[i][j].val = rb->rand() % (MAXCHARS-1) + 1;
if (matrix[i - 1][j].bold == 2) { if (i > 0 && matrix[i - 1][j].bold == 2) {
matrix[i - 1][j].bold = 1; matrix[i - 1][j].bold = 1;
matrix[i][j].bold = 2; matrix[i][j].bold = 2;
} }