MCPcopy Create free account
hub / github.com/diasurgical/devilution / SetAutomapView

Function SetAutomapView

Source/automap.cpp:570–640  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

568}
569
570void SetAutomapView(int x, int y)
571{
572 WORD maptype, solid;
573 int xx, yy;
574
575 xx = (x - 16) >> 1;
576 yy = (y - 16) >> 1;
577
578 if (xx < 0 || xx >= DMAXX || yy < 0 || yy >= DMAXY) {
579 return;
580 }
581
582 automapview[xx][yy] = TRUE;
583
584 maptype = GetAutomapType(xx, yy, FALSE);
585 solid = maptype & 0x4000;
586
587 switch (maptype & 0xF) {
588 case 2:
589 if (solid) {
590 if (GetAutomapType(xx, yy + 1, FALSE) == 0x4007)
591 automapview[xx][yy + 1] = TRUE;
592 } else if (GetAutomapType(xx - 1, yy, FALSE) & 0x4000) {
593 automapview[xx - 1][yy] = TRUE;
594 }
595 break;
596 case 3:
597 if (solid) {
598 if (GetAutomapType(xx + 1, yy, FALSE) == 0x4007)
599 automapview[xx + 1][yy] = TRUE;
600 } else if (GetAutomapType(xx, yy - 1, FALSE) & 0x4000) {
601 automapview[xx][yy - 1] = TRUE;
602 }
603 break;
604 case 4:
605 if (solid) {
606 if (GetAutomapType(xx, yy + 1, FALSE) == 0x4007)
607 automapview[xx][yy + 1] = TRUE;
608 if (GetAutomapType(xx + 1, yy, FALSE) == 0x4007)
609 automapview[xx + 1][yy] = TRUE;
610 } else {
611 if (GetAutomapType(xx - 1, yy, FALSE) & 0x4000)
612 automapview[xx - 1][yy] = TRUE;
613 if (GetAutomapType(xx, yy - 1, FALSE) & 0x4000)
614 automapview[xx][yy - 1] = TRUE;
615 if (GetAutomapType(xx - 1, yy - 1, FALSE) & 0x4000)
616 automapview[xx - 1][yy - 1] = TRUE;
617 }
618 break;
619 case 5:
620 if (solid) {
621 if (GetAutomapType(xx, yy - 1, FALSE) & 0x4000)
622 automapview[xx][yy - 1] = TRUE;
623 if (GetAutomapType(xx, yy + 1, FALSE) == 0x4007)
624 automapview[xx][yy + 1] = TRUE;
625 } else if (GetAutomapType(xx - 1, yy, FALSE) & 0x4000) {
626 automapview[xx - 1][yy] = TRUE;
627 }

Callers 1

DoVisionFunction · 0.85

Calls 1

GetAutomapTypeFunction · 0.85

Tested by

no test coverage detected