@@ -647,6 +647,223 @@ func (view *ObjectsView) renderPropertyControl(lvl *level.Level, readOnly bool,
647
647
})
648
648
})
649
649
650
+ simplifier .SetSpecialHandler ("MultiAnimation" , func () {
651
+ /*
652
+ animationTypes := []string{"Random"}
653
+ selectedType := -1
654
+ if unifier.IsUnique() {
655
+ value := int(unifier.Unified().(int32))
656
+ selectedType = value >> 12
657
+ }
658
+
659
+ values.RenderUnifiedCombo(readOnly, key+"###"+fullKey+"-Type", unifier,
660
+ func(u values.Unifier) int {
661
+ key := unifier.Unified().(int32)
662
+ return int(key >> 12)
663
+ },
664
+ func(index int) string { return animationTypes[index] },
665
+ len(animationTypes),
666
+ func(newIndex int) {
667
+ updater(func(oldValue uint32) uint32 {
668
+ result := oldValue & ^uint32(0xF000)
669
+ result |= uint32(newIndex<<12) & uint32(0xF000)
670
+ return result
671
+ })
672
+ })
673
+ */
674
+
675
+ // if selectedType == 0 {
676
+ values .RenderUnifiedSliderInt (readOnly , key + " infrequency###" + fullKey + "-infrequency" , unifier ,
677
+ func (u values.Unifier ) int {
678
+ key := unifier .Unified ().(int32 )
679
+ return int (key & 0x0FFF )
680
+ },
681
+ func (value int ) string { return "%d" },
682
+ 0 , 0x0FFF ,
683
+ func (newValue int ) {
684
+ updater (func (oldValue uint32 ) uint32 {
685
+ result := oldValue & ^ uint32 (0x0FFF )
686
+ result |= uint32 (newValue ) & uint32 (0x0FFF )
687
+ return result
688
+ })
689
+ })
690
+ //}
691
+ })
692
+
693
+ simplifier .SetSpecialHandler ("PictureSource" , func () {
694
+ indexConverter := func (u values.Unifier ) int { return int (u .Unified ().(int32 )) & 0x007F }
695
+ indexUpdater := func (newValue int ) {
696
+ updater (func (oldValue uint32 ) uint32 {
697
+ result := oldValue & ^ uint32 (0x007F )
698
+ result |= uint32 (newValue ) & uint32 (0x007F )
699
+ return result
700
+ })
701
+ }
702
+
703
+ sourceType := []string {"Data" , "ObjectID" }
704
+ selectedType := - 1
705
+ if unifier .IsUnique () {
706
+ value := int (unifier .Unified ().(int32 ))
707
+ selectedType = (value & 0x1000 ) >> 12
708
+ }
709
+
710
+ imgui .Separator ()
711
+ imgui .Text (key + ":" )
712
+
713
+ values .RenderUnifiedCombo (readOnly , "Source###" + fullKey + "-Source" , unifier ,
714
+ func (u values.Unifier ) int {
715
+ key := unifier .Unified ().(int32 )
716
+ return int ((key & 0x1000 ) >> 12 )
717
+ },
718
+ func (index int ) string { return sourceType [index ] },
719
+ len (sourceType ),
720
+ func (newIndex int ) {
721
+ updater (func (oldValue uint32 ) uint32 {
722
+ result := oldValue & ^ uint32 (0x1000 )
723
+ result |= uint32 (newIndex << 12 ) & uint32 (0x1000 )
724
+ return result
725
+ })
726
+ })
727
+
728
+ if selectedType == 0 {
729
+ dataType := []string {"Screen" , "Custom" , "Text" , "Scrolling Text" }
730
+ textureData := - 1
731
+ index := - 1
732
+ selectedDataType := - 1
733
+
734
+ if unifier .IsUnique () {
735
+ value := int (unifier .Unified ().(int32 ))
736
+ textureData = value & 0x0FFF
737
+ index = textureData & 0x007F
738
+ selectedDataType = (value & 0x0180 ) >> 7
739
+ }
740
+
741
+ values .RenderUnifiedCombo (readOnly , "Type###" + fullKey + "-Type" , unifier ,
742
+ func (u values.Unifier ) int {
743
+ key := unifier .Unified ().(int32 )
744
+ return int ((key & 0x0180 ) >> 7 )
745
+ },
746
+ func (index int ) string { return dataType [index ] },
747
+ len (dataType ),
748
+ func (newIndex int ) {
749
+ updater (func (oldValue uint32 ) uint32 {
750
+ result := oldValue & ^ uint32 (0x0180 )
751
+ result |= uint32 (newIndex << 7 ) & uint32 (0x0180 )
752
+ return result
753
+ })
754
+ })
755
+
756
+ if selectedDataType == 0 { // Screen
757
+ resInfo , _ := ids .Info (ids .ScreenTextures )
758
+
759
+ values .RenderUnifiedSliderInt (readOnly , "Index###" + fullKey + "-Index" , unifier ,
760
+ indexConverter ,
761
+ func (value int ) string { return "%d" },
762
+ 0 , resInfo .MaxCount - 1 ,
763
+ indexUpdater )
764
+
765
+ render .TextureSelector (key + "-Screen###" + fullKey + "-Screen" , - 1 , view .guiScale , resInfo .MaxCount , index ,
766
+ view .textureCache ,
767
+ func (index int ) resource.Key {
768
+ return resource .KeyOf (ids .ScreenTextures .Plus (index ), resource .LangAny , 0 )
769
+ },
770
+ func (index int ) string { return fmt .Sprintf ("%3d" , index ) },
771
+ func (index int ) {
772
+ if ! readOnly {
773
+ indexUpdater (index )
774
+ }
775
+ })
776
+ } else if selectedDataType == 1 { // Custom
777
+ values .RenderUnifiedSliderInt (readOnly , "Index###" + fullKey + "-Index" , unifier ,
778
+ indexConverter ,
779
+ func (value int ) string {
780
+ if value >= 0x78 && value <= (0x78 + 8 ) {
781
+ return "%d - Camera"
782
+ } else if value == 0x77 {
783
+ return "%d - Static"
784
+ } else if value == 0x76 {
785
+ return "%d - SHODAN Proximity"
786
+ } else if value >= 0x70 && value <= (0x70 + 6 ) {
787
+ return "%d - Automap"
788
+ } else {
789
+ return "%d"
790
+ }
791
+ },
792
+ 0 , 0x007F ,
793
+ indexUpdater )
794
+
795
+ resInfo , _ := ids .Info (ids .ObjectMaterialBitmaps )
796
+ if index < resInfo .MaxCount {
797
+ render .TextureImage ("Preview" , view .textureCache , resource .KeyOf (ids .ObjectMaterialBitmaps .Plus (index ), resource .LangAny , 0 ), imgui.Vec2 {X : 64 * view .guiScale , Y : 64 * view .guiScale })
798
+ }
799
+ } else if selectedDataType == 2 { // Text
800
+ values .RenderUnifiedSliderInt (readOnly , "Index###" + fullKey + "-Index" , unifier ,
801
+ indexConverter ,
802
+ func (value int ) string {
803
+ if value == 0x007F {
804
+ return "%d - (Random number)"
805
+ } else {
806
+ return "%d"
807
+ }
808
+ },
809
+ 0 , 0x007F ,
810
+ indexUpdater )
811
+ } else if selectedDataType == 3 { // Scrolling Text
812
+ values .RenderUnifiedSliderInt (readOnly , "Index###" + fullKey + "-Index" , unifier ,
813
+ indexConverter ,
814
+ func (value int ) string { return "%d" },
815
+ 0 , 0x007F ,
816
+ indexUpdater )
817
+ }
818
+
819
+ if selectedDataType == 2 || selectedDataType == 3 {
820
+ fontNames := []string {"Large Tech" , "Small Tech" }
821
+ values .RenderUnifiedCombo (readOnly , "Font###" + fullKey + "-Font" , unifier ,
822
+ func (u values.Unifier ) int {
823
+ key := unifier .Unified ().(int32 )
824
+ return int ((key & 0x0800 ) >> 11 )
825
+ },
826
+ func (value int ) string { return fontNames [value ] },
827
+ len (fontNames ),
828
+ func (newValue int ) {
829
+ updater (func (oldValue uint32 ) uint32 {
830
+ result := oldValue & ^ uint32 (0x0800 )
831
+ result |= uint32 (newValue << 11 ) & uint32 (0x0800 )
832
+ return result
833
+ })
834
+ })
835
+ }
836
+
837
+ values .RenderUnifiedSliderInt (readOnly , "Scale###" + fullKey + "-Scale" , unifier ,
838
+ func (u values.Unifier ) int {
839
+ key := unifier .Unified ().(int32 )
840
+ return int ((key & 0x0600 ) >> 9 )
841
+ },
842
+ func (value int ) string { return "%d" },
843
+ 0 , 3 ,
844
+ func (newValue int ) {
845
+ updater (func (oldValue uint32 ) uint32 {
846
+ result := oldValue & ^ uint32 (0x0600 )
847
+ result |= uint32 (newValue << 9 ) & uint32 (0x0600 )
848
+ return result
849
+ })
850
+ })
851
+ } else {
852
+ // Indirection to another object
853
+ values .RenderUnifiedSliderInt (readOnly , "ObjectID###" + fullKey + "-Object" , unifier ,
854
+ func (u values.Unifier ) int { return int (u .Unified ().(int32 )) & 0x0FFF },
855
+ func (value int ) string { return "%d" },
856
+ 0 , lvl .ObjectCapacity (),
857
+ func (newValue int ) {
858
+ updater (func (oldValue uint32 ) uint32 {
859
+ result := oldValue & ^ uint32 (0x0FFF )
860
+ result |= uint32 (newValue ) & uint32 (0x0FFF )
861
+ return result
862
+ })
863
+ })
864
+ }
865
+ })
866
+
650
867
describer (simplifier )
651
868
}
652
869
0 commit comments