Unified · Split
| @@ -113,7 +113,7 @@ int big9logo[FIELD_HEIGHT][FIELD_WIDTH] = { · 112 unmodified lines | |||
| 113 | { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, | 113 | { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, |
| 114 | }; | 114 | }; |
| 115 | 115 | ||
| 116 | Image *colorimages[8]; | 116 | Image *colorimages[8], *grey; |
| 117 | int field[FIELD_HEIGHT][FIELD_WIDTH]; | 117 | int field[FIELD_HEIGHT][FIELD_WIDTH]; |
| 118 | Piece *currentpiece; | 118 | Piece *currentpiece; |
| 119 | Point currentpiecepos; | 119 | Point currentpiecepos; |
| @@ -131,6 +131,25 @@ void currentpiecestuck(void); · 11 unmodified lines | |||
| 131 | void clearrows(void); | 131 | void clearrows(void); |
| 132 | void startgame(void); | 132 | void startgame(void); |
| 133 | 133 | ||
| 134 | static char *helps[3][5] = { | ||
| 135 | { | ||
| 136 | "** PAUSED **", | ||
| 137 | nil, | ||
| 138 | }, | ||
| 139 | { | ||
| 140 | "** GAME OVER **", | ||
| 141 | "Press enter for a new game", | ||
| 142 | nil, | ||
| 143 | }, | ||
| 144 | { | ||
| 145 | "Move: o/p ", | ||
| 146 | "Rotate: q/w ", | ||
| 147 | "Fast: space", | ||
| 148 | "Start/Pause: enter", | ||
| 149 | nil, | ||
| 150 | }, | ||
| 151 | }; | ||
| 152 | |||
| 134 | void | 153 | void |
| 135 | rotatepieceleft(Piece *p) | 154 | rotatepieceleft(Piece *p) |
| 136 | { | 155 | { |
| @@ -277,6 +296,7 @@ setupcolors(void) · 140 unmodified lines | |||
| 277 | colorimages[ORANGE] = eallocimage(r, 1, DDarkyellow); | 296 | colorimages[ORANGE] = eallocimage(r, 1, DDarkyellow); |
| 278 | colorimages[CYAN] = eallocimage(r, 1, DCyan); | 297 | colorimages[CYAN] = eallocimage(r, 1, DCyan); |
| 279 | colorimages[PURPLE] = eallocimage(r, 1, DPurpleblue); | 298 | colorimages[PURPLE] = eallocimage(r, 1, DPurpleblue); |
| 299 | grey = eallocimage(r, 1, 0xb0b0b0ff); | ||
| 280 | } | 300 | } |
| 281 | 301 | ||
| 282 | void | 302 | void |
| @@ -299,17 +319,18 @@ drawblock(int row, int col, int color) · 16 unmodified lines | |||
| 299 | void | 319 | void |
| 300 | drawgrid(void) | 320 | drawgrid(void) |
| 301 | { | 321 | { |
| 302 | /* Horizontal lines */ | 322 | int i; |
| 303 | for(int i = 0; i <= FIELD_HEIGHT; i++){ | 323 | |
| 324 | for(i = 0; i <= FIELD_HEIGHT; i++){ | ||
| 304 | Point p0 = Pt(0, i * BLOCK_SIZE); | 325 | Point p0 = Pt(0, i * BLOCK_SIZE); |
| 305 | Point p1 = Pt(FIELD_WIDTH * BLOCK_SIZE, i * BLOCK_SIZE); | 326 | Point p1 = Pt(FIELD_WIDTH * BLOCK_SIZE+1, i * BLOCK_SIZE); |
| 306 | line(screen, addpt(p0, center.min), addpt(p1, center.min), 0, 0, 0, display->black, ZP); | 327 | line(screen, addpt(p0, center.min), addpt(p1, center.min), 0, 0, 0, (i % FIELD_HEIGHT) ? grey : display->black, ZP); |
| 307 | } | 328 | } |
| 308 | /* Vertial lines */ | 329 | |
| 309 | for(int j = 0; j <= FIELD_WIDTH; j++){ | 330 | for(i = 0; i <= FIELD_WIDTH; i++){ |
| 310 | Point p0 = Pt(j * BLOCK_SIZE, 0); | 331 | Point p0 = Pt(i * BLOCK_SIZE, (i % FIELD_WIDTH) ? 1 : 0); |
| 311 | Point p1 = Pt(j * BLOCK_SIZE, FIELD_HEIGHT * BLOCK_SIZE); | 332 | Point p1 = Pt(i * BLOCK_SIZE, FIELD_HEIGHT * BLOCK_SIZE); |
| 312 | line(screen, addpt(p0, center.min), addpt(p1, center.min), 0, 0, 0, display->black, ZP); | 333 | line(screen, addpt(p0, center.min), addpt(p1, center.min), 0, 0, 0, (i % FIELD_WIDTH) ? grey : display->black, ZP); |
| 313 | } | 334 | } |
| 314 | } | 335 | } |
| 315 | 336 | ||
| @@ -338,25 +359,6 @@ drawcurrentpiece(void) · 22 unmodified lines | |||
| 338 | } | 359 | } |
| 339 | } | 360 | } |
| 340 | 361 | ||
| 341 | static char *helps[3][5] = { | ||
| 342 | { | ||
| 343 | "** PAUSED **", | ||
| 344 | nil, | ||
| 345 | }, | ||
| 346 | { | ||
| 347 | "** GAME OVER **", | ||
| 348 | "Press enter for a new game", | ||
| 349 | nil, | ||
| 350 | }, | ||
| 351 | { | ||
| 352 | "Move: o/p ", | ||
| 353 | "Rotate: q/w ", | ||
| 354 | "Fast: space", | ||
| 355 | "Start/Pause: enter", | ||
| 356 | nil, | ||
| 357 | }, | ||
| 358 | }; | ||
| 359 | |||
| 360 | void | 362 | void |
| 361 | drawinfo(void) | 363 | drawinfo(void) |
| 362 | { | 364 | { |
| @@ -448,7 +450,6 @@ iscurrentpiececolliding(void) · 85 unmodified lines | |||
| 448 | return ispiececolliding(currentpiece, currentpiecepos); | 450 | return ispiececolliding(currentpiece, currentpiecepos); |
| 449 | } | 451 | } |
| 450 | 452 | ||
| 451 | |||
| 452 | int | 453 | int |
| 453 | isrowfull(int row) | 454 | isrowfull(int row) |
| 454 | { | 455 | { |