diff options
author | William Wilgus <wilgus.william@gmail.com> | 2021-04-16 09:45:03 -0400 |
---|---|---|
committer | William Wilgus <wilgus.william@gmail.com> | 2021-04-16 10:10:15 -0400 |
commit | a9d3e9a13d17c9036e88b4e4a0df40f210cf06d6 (patch) | |
tree | 187e3170e7dbe46cd3bfbd133f83f51a79ecbe06 | |
parent | 42dba708e3bcd2fa448f9d2865157b910a62a11a (diff) | |
download | rockbox-a9d3e9a13d17c9036e88b4e4a0df40f210cf06d6.tar.gz rockbox-a9d3e9a13d17c9036e88b4e4a0df40f210cf06d6.zip |
The Matrix plugin -- Bugfix
Off by one errorS in the matrix plugin
might even say its the matrix plugin re-loaded
Change-Id: I2bc7487615a9e28fcd1d170961fb0b5ee6da6af7
-rw-r--r-- | apps/plugins/matrix.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/apps/plugins/matrix.c b/apps/plugins/matrix.c index 087a501474..1b2f6d465a 100644 --- a/apps/plugins/matrix.c +++ b/apps/plugins/matrix.c | |||
@@ -166,7 +166,7 @@ static void matrix_loop(void) | |||
166 | */ | 166 | */ |
167 | /* A little more random now for spaces */ | 167 | /* A little more random now for spaces */ |
168 | if (rb->rand() % randomness == 1){ | 168 | if (rb->rand() % randomness == 1){ |
169 | while (i <= ROWS && (matrix[i][j].val == 129 || | 169 | while (i < ROWS && (matrix[i][j].val == 129 || |
170 | matrix[i][j].val == -1)){ | 170 | matrix[i][j].val == -1)){ |
171 | i++; | 171 | i++; |
172 | randomness--; | 172 | randomness--; |
@@ -179,19 +179,19 @@ static void matrix_loop(void) | |||
179 | } | 179 | } |
180 | 180 | ||
181 | 181 | ||
182 | if (i > ROWS) | 182 | if (i >= ROWS) |
183 | break; | 183 | break; |
184 | 184 | ||
185 | /* Go to the head of this collumn */ | 185 | /* Go to the head of this collumn */ |
186 | z = i; | 186 | z = i; |
187 | y = 0; | 187 | y = 0; |
188 | while (i <= ROWS && (matrix[i][j].val != 129 && | 188 | while (i < ROWS && (matrix[i][j].val != 129 && |
189 | matrix[i][j].val != -1)) { | 189 | matrix[i][j].val != -1)) { |
190 | i++; | 190 | i++; |
191 | y++; | 191 | y++; |
192 | } | 192 | } |
193 | 193 | ||
194 | if (i > ROWS) { | 194 | if (i >= ROWS) { |
195 | matrix[z][j].val = 129; | 195 | matrix[z][j].val = 129; |
196 | matrix[ROWS - 1][j].bold = 1; | 196 | matrix[ROWS - 1][j].bold = 1; |
197 | matrix_blit_char(z - 1, j, matrix[z][j].val); | 197 | matrix_blit_char(z - 1, j, matrix[z][j].val); |
@@ -200,7 +200,7 @@ static void matrix_loop(void) | |||
200 | 200 | ||
201 | matrix[i][j].val = rb->rand() % (MAXCHARS-1) + 1; | 201 | matrix[i][j].val = rb->rand() % (MAXCHARS-1) + 1; |
202 | 202 | ||
203 | if (matrix[i - 1][j].bold == 2) { | 203 | if (i > 0 && matrix[i - 1][j].bold == 2) { |
204 | matrix[i - 1][j].bold = 1; | 204 | matrix[i - 1][j].bold = 1; |
205 | matrix[i][j].bold = 2; | 205 | matrix[i][j].bold = 2; |
206 | } | 206 | } |