MCPcopy Create free account
hub / github.com/NetHack/NetHack / new_angle

Function new_angle

src/vision.c:413–451  ·  view source on GitHub ↗

* new_angle() * * Return the new angle seen by the hero for this location. The angle * bit is given in the value pointed at by sv. * * For T walls and crosswall, just setting the angle bit, even though * it is technically correct, doesn't look good. If we can see the * next position beyond the current one and it is a wall that we can * see, then we want to extend a spine of the T to conn

Source from the content-addressed store, hash-verified

411 * checks. - Dean 2/11/93
412 */
413staticfn int
414new_angle(struct rm *lev, unsigned char *sv, int row, int col)
415{
416 int res = *sv;
417
418 /*
419 * Do extra checks for crosswalls and T walls if we see them from
420 * an angle.
421 */
422 if (lev->typ >= CROSSWALL && lev->typ <= TRWALL) {
423 switch (res) {
424 case SV0:
425 if (col > 0 && viz_clear[row][col - 1])
426 res |= SV7;
427 if (row > 0 && viz_clear[row - 1][col])
428 res |= SV1;
429 break;
430 case SV2:
431 if (row > 0 && viz_clear[row - 1][col])
432 res |= SV1;
433 if (col < COLNO - 1 && viz_clear[row][col + 1])
434 res |= SV3;
435 break;
436 case SV4:
437 if (col < COLNO - 1 && viz_clear[row][col + 1])
438 res |= SV3;
439 if (row < ROWNO - 1 && viz_clear[row + 1][col])
440 res |= SV5;
441 break;
442 case SV6:
443 if (row < ROWNO - 1 && viz_clear[row + 1][col])
444 res |= SV5;
445 if (col > 0 && viz_clear[row][col - 1])
446 res |= SV7;
447 break;
448 }
449 }
450 return res;
451}
452#else
453/*
454 * new_angle()

Callers 1

vision_recalcFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected