Mercurial > hg > forks > yadex
comparison src/editobj.cc @ 66:794b7bb40d7f
Initial work on cleaning up and improving the texture alignment functionality.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 26 Sep 2011 10:16:55 +0300 |
parents | 2537585c2b93 |
children | 2f1ecc1c5f72 |
comparison
equal
deleted
inserted
replaced
65:2537585c2b93 | 66:794b7bb40d7f |
---|---|
653 NotImplemented(); | 653 NotImplemented(); |
654 break; | 654 break; |
655 } | 655 } |
656 } | 656 } |
657 | 657 |
658 static void AlignTexturesMenu(int xc, int yc, int mode, SelPtr *list) | |
659 { | |
660 int opt_sdef; | |
661 bool opt_offset = false, opt_check = false; | |
662 | |
663 switch (vDisplayMenu(xc, yc, | |
664 mode ? "Aligning textures (Y offset) :" : "Aligning textures (X offset) :", | |
665 | |
666 " Sidedef 1, Check for identical textures. ", YK_, 0, | |
667 " Sidedef 1, As above, but with initial offset.", YK_, 0, | |
668 " Sidedef 1, No texture checking. ", YK_, 0, | |
669 " Sidedef 1, As above, but with initial offset.", YK_, 0, | |
670 " Sidedef 2, Check for identical textures. ", YK_, 0, | |
671 " Sidedef 2, As above, but with initial offset.", YK_, 0, | |
672 " Sidedef 2, No texture checking. ", YK_, 0, | |
673 " Sidedef 2, As above, but with initial offset.", YK_, 0, | |
674 NULL)) | |
675 { | |
676 case 1: /* Sidedef 1 with checking for same textures */ | |
677 opt_sdef = 1; | |
678 opt_check = true; | |
679 opt_offset = false; | |
680 break; | |
681 | |
682 case 2: /* Sidedef 1 as above, but with inital offset */ | |
683 opt_sdef = 1; | |
684 opt_check = true; | |
685 opt_offset = true; | |
686 break; | |
687 | |
688 case 3: /* Sidedef 1 regardless of same textures */ | |
689 opt_sdef = 1; | |
690 opt_check = false; | |
691 opt_offset = false; | |
692 break; | |
693 | |
694 case 4: /* Sidedef 1 as above, but with inital offset */ | |
695 opt_sdef = 1; | |
696 opt_check = false; | |
697 opt_offset = true; | |
698 break; | |
699 | |
700 case 5: /* Sidedef 2 with checking for same textures */ | |
701 opt_sdef = 2; | |
702 opt_check = true; | |
703 opt_offset = false; | |
704 break; | |
705 | |
706 case 6: /* Sidedef 2 as above, but with initial offset */ | |
707 opt_sdef = 2; | |
708 opt_check = true; | |
709 opt_offset = true; | |
710 break; | |
711 | |
712 case 7: /* Sidedef 2 regardless of same textures */ | |
713 opt_sdef = 2; | |
714 opt_check = false; | |
715 opt_offset = false; | |
716 break; | |
717 | |
718 case 8: /* Sidedef 2 as above, but with initial offset */ | |
719 opt_sdef = 2; | |
720 opt_check = false; | |
721 opt_offset = true; | |
722 break; | |
723 | |
724 default: | |
725 return; | |
726 } | |
727 | |
728 /* Select all sidedefs */ | |
729 SelPtr sdlist = NULL, cur; | |
730 for (cur = *list; cur; cur = cur->next) | |
731 { | |
732 if (opt_sdef == 1 && LineDefs[cur->objnum].sidedef1 >= 0) | |
733 SelectObject(&sdlist, LineDefs[cur->objnum].sidedef1); | |
734 | |
735 if (opt_sdef == 2 && LineDefs[cur->objnum].sidedef2 >= 0) | |
736 SelectObject(&sdlist, LineDefs[cur->objnum].sidedef2); | |
737 } | |
738 | |
739 if (mode == 0) | |
740 /* Align the textures along the X axis (width) */ | |
741 AlignTexturesX(&sdlist, opt_sdef, opt_check, opt_offset, -1); | |
742 else | |
743 /* Align the textures along the Y axis (height) */ | |
744 AlignTexturesY(&sdlist, opt_sdef, opt_check); | |
745 } | |
658 | 746 |
659 | 747 |
660 /* | 748 /* |
661 menu of miscellaneous operations | 749 * Menu of miscellaneous operations |
662 */ | 750 */ |
663 | |
664 void MiscOperations(int objtype, SelPtr * list, int val) /* SWAP! */ | 751 void MiscOperations(int objtype, SelPtr * list, int val) /* SWAP! */ |
665 { | 752 { |
666 char msg[80]; | 753 char msg[80]; |
667 int angle, scale; | 754 int angle, scale; |
668 | 755 |
871 | 958 |
872 case 8: | 959 case 8: |
873 // Linedef -> Align textures vertically | 960 // Linedef -> Align textures vertically |
874 if (objtype == OBJ_LINEDEFS) | 961 if (objtype == OBJ_LINEDEFS) |
875 { | 962 { |
876 SelPtr sdlist, cur; | 963 AlignTexturesMenu(250, 110, 1, list); |
877 | |
878 /* select all sidedefs */ | |
879 sdlist = 0; | |
880 for (cur = *list; cur; cur = cur->next) | |
881 { | |
882 if (LineDefs[cur->objnum].sidedef1 >= 0) | |
883 SelectObject(&sdlist, LineDefs[cur->objnum].sidedef1); | |
884 if (LineDefs[cur->objnum].sidedef2 >= 0) | |
885 SelectObject(&sdlist, LineDefs[cur->objnum].sidedef2); | |
886 } | |
887 /* align the textures along the Y axis (height) */ | |
888 AlignTexturesY(&sdlist); | |
889 } | 964 } |
890 // Sector -> Brighten or darken | 965 // Sector -> Brighten or darken |
891 else if (objtype == OBJ_SECTORS) | 966 else if (objtype == OBJ_SECTORS) |
892 { | 967 { |
893 BrightenOrDarkenSectors(*list); | 968 BrightenOrDarkenSectors(*list); |
896 | 971 |
897 case 9: | 972 case 9: |
898 // Linedef -> Align texture horizontally | 973 // Linedef -> Align texture horizontally |
899 if (objtype == OBJ_LINEDEFS) | 974 if (objtype == OBJ_LINEDEFS) |
900 { | 975 { |
901 SelPtr sdlist, cur; | 976 AlignTexturesMenu(250, 110, 0, list); |
902 | |
903 /* select all sidedefs */ | |
904 sdlist = 0; | |
905 for (cur = *list; cur; cur = cur->next) | |
906 { | |
907 if (LineDefs[cur->objnum].sidedef1 >= 0) | |
908 SelectObject(&sdlist, LineDefs[cur->objnum].sidedef1); | |
909 if (LineDefs[cur->objnum].sidedef2 >= 0) | |
910 SelectObject(&sdlist, LineDefs[cur->objnum].sidedef2); | |
911 } | |
912 /* align the textures along the X axis (width) */ | |
913 AlignTexturesX(&sdlist); | |
914 } | 977 } |
915 // Sector -> Unlink room | 978 // Sector -> Unlink room |
916 else if (objtype == OBJ_SECTORS) | 979 else if (objtype == OBJ_SECTORS) |
917 { | 980 { |
918 NotImplemented(); // FIXME | 981 NotImplemented(); // FIXME |