Beispiel #1
0
        // TODO: RBSONG
        public static RBSong.RBSong MakeRBSong(DataArray array)
        {
            var drumBank = array.Array("drum_bank")?.Any(1)
                           .Replace("sfx", "fusion/patches")
                           .Replace("_bank.milo", ".fusion")
                           ?? "fusion/patches/kit01.fusion";
            var editorComponent = new Component
            {
                ClassName = "Editor",
                Name      = "Editor",
                Unknown1  = 3,
                Unknown2  = 2,
                Props     = new[]
                {
                    new Property("capabilities", new FlagValue(50))
                }
            };
            var vec3     = StructType.FromData(DTX.FromDtaString("define vec3 (props (x float) (y float) (z float))"));
            var xfm_type = StructType.FromData(DTX.FromDtaString(
                                                   @"define xfm
            (props
              (basis_x vec3)
              (basis_y vec3)
              (basis_z vec3)
              (translate vec3))"));
            var entityHeaderComponent = new Component
            {
                ClassName = "EntityHeader",
                Name      = "EntityHeader",
                Unknown1  = 3,
                Unknown2  = 1,
                Props     = new[]
                {
                    new Property("copy_on_instance", new BoolValue(true)),
                    new Property("drives_parent", new BoolValue(false)),
                    new Property("static", new BoolValue(false)),
                    new Property("instance_polling_mode", new IntValue(0)),
                    new Property("num_instances", new IntValue(0)),
                    new Property("num_meshes", new IntValue(0)),
                    new Property("num_particles", new IntValue(0)),
                    new Property("num_propanims", new IntValue(0)),
                    new Property("num_lights", new IntValue(0)),
                    new Property("num_verts", new IntValue(0)),
                    new Property("num_faces", new IntValue(0)),
                    new Property("changelist", new IntValue(0)),
                    new Property("icon_cam_initialized", new BoolValue(false)),
                    new Property("icon_cam_near", new FloatValue(0.1f)),
                    new Property("icon_cam_far", new FloatValue(1000f)),
                    new Property("icon_cam_xfm", StructValue.FromData(xfm_type, DTX.FromDtaString(
                                                                          @"(basis_x ((x 1.0) (y 0.0) (z 0.0)))
              (basis_y ((x 0.0) (y 1.0) (z 0.0)))
              (basis_z ((x 0.0) (y 0.0) (z 1.0)))
              (translate ((x 0.0) (y 0.0) (z 0.0)))"))),
                    new Property("icon_data",
                                 new ArrayValue(new ArrayType {
                        ElementType = PrimitiveType.Byte, InternalType = RBSong.DataType.Uint8 | RBSong.DataType.Array
                    }, new Value[] { }))
                }
            };

            return(new RBSong.RBSong
            {
                Version = 0xE,
                Object1 = new ObjectContainer
                {
                    Unknown1 = 20,
                    Unknown2 = 1,
                    Unknown3 = 20,
                    Unknown4 = 0,
                    Unknown5 = 1,
                    Entities = new[] {
                        new Entity
                        {
                            Index0 = 0,
                            Index1 = 0,
                            Name = "root",
                            Coms = new Component[] {
                                editorComponent,
                                entityHeaderComponent,
                                new Component
                                {
                                    ClassName = "RBSongMetadata",
                                    Name = "RBSongMetadata",
                                    Unknown1 = 3,
                                    Unknown2 = 4,
                                    Props = new[]
                                    {
                                        new Property("tempo", new SymbolValue("medium")),
                                        new Property("vocal_tonic_note", new LongValue(array.Array("vocal_tonic_note")?.Int(1) ?? 0)),
                                        new Property("vocal_track_scroll_duration_ms", new LongValue(array.Array("song_scroll_speed")?.Int(1) ?? 2300)),
                                        new Property("global_tuning_offset", new FloatValue(array.Array("tuning_offset_cents")?.Number(1) ?? 0)),
                                        new Property("band_fail_sound_event", new SymbolValue("", true)),
                                        new Property("vocal_percussion_patch", new ResourcePathValue("fusion/patches/vox_perc_tambourine.fusion", true)),
                                        new Property("drum_kit_patch", new ResourcePathValue(drumBank)),
                                        new Property("improv_solo_patch", new SymbolValue("gtrsolo_amer_03")),
                                        new Property("dynamic_drum_fill_override", new IntValue(10)),
                                        new Property("improv_solo_volume_db", new FloatValue(-9))
                                    }
                                },
                                new Component
                                {
                                    ClassName = "RBVenueAuthoring",
                                    Name = "RBVenueAuthoring",
                                    Unknown1 = 3,
                                    Unknown2 = 0,
                                    Props = new[]
                                    {
                                        new Property("part2_instrument", new IntValue(2)),
                                        new Property("part3_instrument", new IntValue(0)),
                                        new Property("part4_instrument", new IntValue(1))
                                    }
                                }
                            }
                        }
                    }
                },
                KV = new KeyValue
                {
                    Str1 = "PropAnimResource",
                    Str2 = "venue_authoring_data"
                },
                Object2 = new ObjectContainer
                {
                    Unknown1 = 20,
                    Unknown2 = 1,
                    Unknown3 = 20,
                    Unknown4 = 0,
                    Unknown5 = 1,
                    Entities = new[] {
                        new Entity
                        {
                            Index0 = 0,
                            Index1 = 0,
                            Name = "root",
                            Coms = new[]
                            {
                                editorComponent,
                                entityHeaderComponent,
                                new Component
                                {
                                    ClassName = "PropAnim",
                                    Name = "PropAnim",
                                    Unknown1 = 3,
                                    Unknown2 = 0,
                                    Props = StructValue.FromData(
                                        StructType.FromData(DTX.FromDtaString(
                                                                @"(props 
                                  (frame_range_start float)
                                  (frame_range_end float)
                                  (time_units int)
                                  (is_looping bool))")),
                                        DTX.FromDtaString(
                                            @"(frame_range_start 3.402823E+38)
                                (frame_range_end -3.402823E+38)
                                (time_units 0)
                                (is_looping 0)")).Props
                                }
                            }
                        }
                    }
                }
            });
        }