for #wizfliplevel; not needed when flipping during level creation; update seen vector for whole flip area and glyph for known walls */
| 455 | /* for #wizfliplevel; not needed when flipping during level creation; |
| 456 | update seen vector for whole flip area and glyph for known walls */ |
| 457 | staticfn void |
| 458 | flip_visuals(int flp, int minx, int miny, int maxx, int maxy) |
| 459 | { |
| 460 | struct rm *lev; |
| 461 | int x, y, seenv; |
| 462 | |
| 463 | for (y = miny; y <= maxy; ++y) { |
| 464 | for (x = minx; x <= maxx; ++x) { |
| 465 | lev = &levl[x][y]; |
| 466 | seenv = lev->seenv & 0xff; |
| 467 | /* locations which haven't been seen can be skipped */ |
| 468 | if (seenv == 0) |
| 469 | continue; |
| 470 | /* flip <x,y>'s seen vector; not necessary for locations seen |
| 471 | from all directions (the whole level after magic mapping) */ |
| 472 | if (seenv != SVALL) { |
| 473 | /* SV2 SV1 SV0 * |
| 474 | * SV3 -+- SV7 * |
| 475 | * SV4 SV5 SV6 */ |
| 476 | if (flp & 1) { /* swap top and bottom */ |
| 477 | seenv = swapbits(seenv, 2, 4); |
| 478 | seenv = swapbits(seenv, 1, 5); |
| 479 | seenv = swapbits(seenv, 0, 6); |
| 480 | } |
| 481 | if (flp & 2) { /* swap left and right */ |
| 482 | seenv = swapbits(seenv, 2, 0); |
| 483 | seenv = swapbits(seenv, 3, 7); |
| 484 | seenv = swapbits(seenv, 4, 6); |
| 485 | } |
| 486 | lev->seenv = (uchar) seenv; |
| 487 | } |
| 488 | /* if <x,y> is displayed as a wall, reset its display glyph so |
| 489 | that remembered, out of view T's and corners get flipped */ |
| 490 | if ((IS_WALL(lev->typ) || lev->typ == SDOOR) |
| 491 | && glyph_is_cmap(lev->glyph)) |
| 492 | lev->glyph = back_to_glyph(x, y); |
| 493 | } |
| 494 | } |
| 495 | } |
| 496 | |
| 497 | /* transpose an encoded direction */ |
| 498 | staticfn int |
no test coverage detected