comparison src/objects.cc @ 97:adfc24b6a7b7

More cosmetics.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 06 Oct 2014 01:47:27 +0300
parents 091ec1d89876
children 18d7e613b075
comparison
equal deleted inserted replaced
96:091ec1d89876 97:adfc24b6a7b7
674 { 674 {
675 /* get the nearest LineDef in that direction (increasing Y's: North) */ 675 /* get the nearest LineDef in that direction (increasing Y's: North) */
676 bestdist = 32767; 676 bestdist = 32767;
677 bestmdist = 32767; 677 bestmdist = 32767;
678 for (ld2 = 0; ld2 < NumLineDefs; ld2++) 678 for (ld2 = 0; ld2 < NumLineDefs; ld2++)
679 if (ld2 != ld1 && ((Vertices[LineDefs[ld2].start].x > x1) 679 if (ld2 != ld1 && (Vertices[LineDefs[ld2].start].x > x1) != (Vertices[LineDefs[ld2].end].x > x1))
680 != (Vertices[LineDefs[ld2].end].x > x1)))
681 { 680 {
682 GetLDCoords(ld2, &x2, &y2, &dx2, &dy2); 681 GetLDCoords(ld2, &x2, &y2, &dx2, &dy2);
683 dist = y2 + (int) ((x1 - x2) * dy2 / dx2); 682 dist = y2 + (int) ((x1 - x2) * dy2 / dx2);
684 if (dist > y1 && (dist < bestdist || (dist == bestdist && (y2 + dy2 / 2) < bestmdist))) 683 if (dist > y1 && (dist < bestdist || (dist == bestdist && (y2 + dy2 / 2) < bestmdist)))
685 { 684 {
693 { 692 {
694 /* get the nearest LineDef in that direction (decreasing Y's: South) */ 693 /* get the nearest LineDef in that direction (decreasing Y's: South) */
695 bestdist = -32767; 694 bestdist = -32767;
696 bestmdist = -32767; 695 bestmdist = -32767;
697 for (ld2 = 0; ld2 < NumLineDefs; ld2++) 696 for (ld2 = 0; ld2 < NumLineDefs; ld2++)
698 if (ld2 != ld1 && ((Vertices[LineDefs[ld2].start].x > x1) 697 if (ld2 != ld1 && (Vertices[LineDefs[ld2].start].x > x1) != (Vertices[LineDefs[ld2].end].x > x1))
699 != (Vertices[LineDefs[ld2].end].x > x1)))
700 { 698 {
701 GetLDCoords(ld2, &x2, &y2, &dx2, &dy2); 699 GetLDCoords(ld2, &x2, &y2, &dx2, &dy2);
702 dist = y2 + (int) ((x1 - x2) * dy2 / dx2); 700 dist = y2 + (int) ((x1 - x2) * dy2 / dx2);
703 if (dist < y1 && (dist > bestdist || (dist == bestdist && (y2 + dy2 / 2) > bestmdist))) 701 if (dist < y1 && (dist > bestdist || (dist == bestdist && (y2 + dy2 / 2) > bestmdist)))
704 { 702 {
715 { 713 {
716 /* get the nearest LineDef in that direction (increasing X's: East) */ 714 /* get the nearest LineDef in that direction (increasing X's: East) */
717 bestdist = 32767; 715 bestdist = 32767;
718 bestmdist = 32767; 716 bestmdist = 32767;
719 for (ld2 = 0; ld2 < NumLineDefs; ld2++) 717 for (ld2 = 0; ld2 < NumLineDefs; ld2++)
720 if (ld2 != ld1 && ((Vertices[LineDefs[ld2].start].y > y1) 718 if (ld2 != ld1 && (Vertices[LineDefs[ld2].start].y > y1) != (Vertices[LineDefs[ld2].end].y > y1))
721 != (Vertices[LineDefs[ld2].end].y > y1)))
722 { 719 {
723 GetLDCoords(ld2, &x2, &y2, &dx2, &dy2); 720 GetLDCoords(ld2, &x2, &y2, &dx2, &dy2);
724 dist = x2 + (int) ((y1 - y2) * dx2 / dy2); 721 dist = x2 + (int) ((y1 - y2) * dx2 / dy2);
725 if (dist > x1 && (dist < bestdist || (dist == bestdist && (x2 + dx2 / 2) < bestmdist))) 722 if (dist > x1 && (dist < bestdist || (dist == bestdist && (x2 + dx2 / 2) < bestmdist)))
726 { 723 {
734 { 731 {
735 /* get the nearest LineDef in that direction (decreasing X's: West) */ 732 /* get the nearest LineDef in that direction (decreasing X's: West) */
736 bestdist = -32767; 733 bestdist = -32767;
737 bestmdist = -32767; 734 bestmdist = -32767;
738 for (ld2 = 0; ld2 < NumLineDefs; ld2++) 735 for (ld2 = 0; ld2 < NumLineDefs; ld2++)
739 if (ld2 != ld1 && ((Vertices[LineDefs[ld2].start].y > y1) 736 if (ld2 != ld1 && (Vertices[LineDefs[ld2].start].y > y1) != (Vertices[LineDefs[ld2].end].y > y1))
740 != (Vertices[LineDefs[ld2].end].y > y1)))
741 { 737 {
742 GetLDCoords(ld2, &x2, &y2, &dx2, &dy2); 738 GetLDCoords(ld2, &x2, &y2, &dx2, &dy2);
743 dist = x2 + (int) ((y1 - y2) * dx2 / dy2); 739 dist = x2 + (int) ((y1 - y2) * dx2 / dy2);
744 if (dist < x1 && (dist > bestdist || (dist == bestdist && (x2 + dx2 / 2) > bestmdist))) 740 if (dist < x1 && (dist > bestdist || (dist == bestdist && (x2 + dx2 / 2) > bestmdist)))
745 { 741 {