Ejemplo n.º 1
0
            // combo
            public void Write(BinaryWriter writer, FindLogic.Combo.EffectInfoCombo effectInfo, FindLogic.Combo.ComboInfo info, Dictionary <ulong, HashSet <FindLogic.Combo.VoiceLineInstanceInfo> > svceLines)
            {
                writer.Write(new string(Identifier));
                writer.Write(VersionMajor);
                writer.Write(VersionMinor);

                EffectParser.EffectInfo effect = effectInfo.Effect;

                writer.Write(GUID.Index(effect.GUID));
                writer.Write(effect.EffectLength);

                writer.Write(effect.DMCEs.Count);
                writer.Write(effect.CECEs.Count);
                writer.Write(effect.NECEs.Count);
                writer.Write(effect.RPCEs.Count);
                writer.Write(effect.FECEs.Count);
                writer.Write(effect.OSCEs.Count);
                writer.Write(effect.SVCEs.Count);

                foreach (EffectParser.DMCEInfo dmceInfo in effect.DMCEs)
                {
                    WriteTime(writer, dmceInfo.PlaybackInfo);
                    writer.Write(dmceInfo.Animation);
                    writer.Write(dmceInfo.Material);
                    writer.Write(dmceInfo.Model);
                    FindLogic.Combo.ModelInfoNew modelInfo = info.Models[dmceInfo.Model];
                    writer.Write($"Models\\{modelInfo.GetName()}\\{modelInfo.GetNameIndex()}.owmdl");
                    if (dmceInfo.Animation == 0)
                    {
                        writer.Write("null");
                    }
                    else
                    {
                        FindLogic.Combo.AnimationInfoNew animationInfo = info.Animations[dmceInfo.Animation];
                        writer.Write($"Models\\{modelInfo.GetName()}\\{Model.AnimationEffectDir}\\{animationInfo.GetNameIndex()}\\{animationInfo.GetNameIndex()}.owanim");
                    }
                }

                foreach (EffectParser.CECEInfo ceceInfo in effect.CECEs)
                {
                    WriteTime(writer, ceceInfo.PlaybackInfo);
                    writer.Write((byte)ceceInfo.Action);
                    writer.Write(ceceInfo.Animation);
                    writer.Write(ceceInfo.EntityVariable);
                    writer.Write(GUID.Index(ceceInfo.EntityVariable));
                    if (ceceInfo.Animation != 0)
                    {
                        FindLogic.Combo.AnimationInfoNew animationInfo = info.Animations[ceceInfo.Animation];
                        writer.Write($"{Model.AnimationEffectDir}\\{animationInfo.GetNameIndex()}\\{animationInfo.GetNameIndex()}.owanim");
                    }
                    else
                    {
                        writer.Write("null");
                    }
                }

                foreach (EffectParser.NECEInfo neceInfo in effect.NECEs)
                {
                    WriteTime(writer, neceInfo.PlaybackInfo);
                    writer.Write(neceInfo.GUID);
                    writer.Write(GUID.Index(neceInfo.Variable));
                    FindLogic.Combo.EntityInfoNew entityInfo = info.Entities[neceInfo.GUID];

                    writer.Write($"Entities\\{entityInfo.GetName()}\\{entityInfo.GetName()}.owentity");
                }

                foreach (EffectParser.RPCEInfo rpceInfo in effect.RPCEs)
                {
                    WriteTime(writer, rpceInfo.PlaybackInfo);
                    writer.Write(rpceInfo.Model);
                    // todo: make the materials work
                    writer.Write(rpceInfo.Material);
                    FindLogic.Combo.ModelInfoNew modelInfo = info.Models[rpceInfo.Model];
                    //writer.Write(rpceInfo.TextureDefiniton);

                    writer.Write($"Models\\{modelInfo.GetName()}\\{modelInfo.GetName()}.owmdl");
                }

                foreach (EffectParser.SVCEInfo svceInfo in effect.SVCEs)
                {
                    WriteTime(writer, svceInfo.PlaybackInfo);
                    writer.Write(GUID.Index(svceInfo.VoiceStimulus));
                    if (svceLines.ContainsKey(svceInfo.VoiceStimulus))
                    {
                        HashSet <FindLogic.Combo.VoiceLineInstanceInfo> lines = svceLines[svceInfo.VoiceStimulus];
                        writer.Write(lines.Count);

                        foreach (FindLogic.Combo.VoiceLineInstanceInfo voiceLineInstance in lines)
                        {
                            writer.Write(voiceLineInstance.SoundFiles.Count);
                            foreach (ulong soundFile in voiceLineInstance.SoundFiles)
                            {
                                FindLogic.Combo.SoundFileInfo soundFileInfo =
                                    info.VoiceSoundFiles[soundFile];
                                writer.Write($"Sounds\\{soundFileInfo.GetNameIndex()}.ogg");
                            }
                        }
                    }
                    else
                    {
                        writer.Write(0);
                    }
                }

                // foreach (EffectParser.FECEInfo feceInfo in effect.FECEs) {
                //     WriteTime(writer, feceInfo.PlaybackInfo);
                //     writer.Write(feceInfo.GUID);
                // }
                //
                // foreach (EffectParser.OSCEInfo osceInfo in effect.OSCEs) {
                //     // this needs preprocessing, get the sounds
                //     WriteTime(writer, osceInfo.PlaybackInfo);
                //     writer.Write(osceInfo.Sound);
                // }
            }
Ejemplo n.º 2
0
            protected void WriteEffect(BinaryWriter writer)
            {
                writer.Write("oweffect");
                writer.Write(EffectVersionMajor);
                writer.Write(EffectVersionMinor);

                EffectParser.EffectInfo effect = EffectInfo.Effect;

                writer.Write(teResourceGUID.Index(effect.GUID));
                writer.Write(effect.EffectLength);

                writer.Write(effect.DMCEs.Count);
                writer.Write(effect.CECEs.Count);
                writer.Write(effect.NECEs.Count);
                writer.Write(effect.RPCEs.Count);
                writer.Write(effect.FECEs.Count);
                writer.Write(effect.OSCEs.Count);
                writer.Write(effect.SVCEs.Count);

                foreach (EffectParser.DMCEInfo dmceInfo in effect.DMCEs)
                {
                    WriteTime(writer, dmceInfo.PlaybackInfo);
                    writer.Write(dmceInfo.Animation);
                    writer.Write(dmceInfo.Material);
                    writer.Write(dmceInfo.Model);
                    FindLogic.Combo.ModelInfoNew modelInfo = Info.Models[dmceInfo.Model];
                    writer.Write($"Models\\{modelInfo.GetName()}\\{modelInfo.GetNameIndex()}.owmdl");
                    if (dmceInfo.Animation == 0)
                    {
                        writer.Write("null");
                    }
                    else
                    {
                        FindLogic.Combo.AnimationInfoNew animationInfo = Info.Animations[dmceInfo.Animation];
                        writer.Write($"Models\\{modelInfo.GetName()}\\{OverwatchAnimationEffect.AnimationEffectDir}\\{animationInfo.GetNameIndex()}\\{animationInfo.GetNameIndex()}.owanim");
                    }
                }

                foreach (EffectParser.CECEInfo ceceInfo in effect.CECEs)
                {
                    WriteTime(writer, ceceInfo.PlaybackInfo);
                    writer.Write((byte)ceceInfo.Action);
                    writer.Write(ceceInfo.Animation);
                    writer.Write(ceceInfo.Identifier);
                    writer.Write(teResourceGUID.Index(ceceInfo.Identifier));
                    if (ceceInfo.Animation != 0)
                    {
                        FindLogic.Combo.AnimationInfoNew animationInfo = Info.Animations[ceceInfo.Animation];
                        writer.Write($"{OverwatchAnimationEffect.AnimationEffectDir}\\{animationInfo.GetNameIndex()}\\{animationInfo.GetNameIndex()}.owanim");
                    }
                    else
                    {
                        writer.Write("null");
                    }
                }

                foreach (EffectParser.NECEInfo neceInfo in effect.NECEs)
                {
                    WriteTime(writer, neceInfo.PlaybackInfo);
                    writer.Write(neceInfo.GUID);
                    writer.Write(teResourceGUID.Index(neceInfo.Identifier));
                    FindLogic.Combo.EntityInfoNew entityInfo = Info.Entities[neceInfo.GUID];

                    writer.Write($"Entities\\{entityInfo.GetName()}\\{entityInfo.GetName()}.owentity");
                }

                foreach (EffectParser.RPCEInfo rpceInfo in effect.RPCEs)
                {
                    WriteTime(writer, rpceInfo.PlaybackInfo);
                    writer.Write(rpceInfo.Model);
                    // todo: make the materials work
                    writer.Write(rpceInfo.Material);
                    FindLogic.Combo.ModelInfoNew modelInfo = Info.Models[rpceInfo.Model];
                    //writer.Write(rpceInfo.TextureDefiniton);

                    writer.Write($"Models\\{modelInfo.GetName()}\\{modelInfo.GetName()}.owmdl");
                }

                foreach (EffectParser.SVCEInfo svceInfo in effect.SVCEs)
                {
                    WriteTime(writer, svceInfo.PlaybackInfo);
                    writer.Write(teResourceGUID.Index(svceInfo.VoiceStimulus));
                    if (VoiceStimuli.ContainsKey(svceInfo.VoiceStimulus))
                    {
                        HashSet <FindLogic.Combo.VoiceLineInstanceInfo> lines = VoiceStimuli[svceInfo.VoiceStimulus];
                        writer.Write(lines.Count);

                        foreach (FindLogic.Combo.VoiceLineInstanceInfo voiceLineInstance in lines)
                        {
                            writer.Write(voiceLineInstance.SoundFiles.Count);
                            foreach (ulong soundFile in voiceLineInstance.SoundFiles)
                            {
                                FindLogic.Combo.SoundFileInfo soundFileInfo =
                                    Info.VoiceSoundFiles[soundFile];
                                writer.Write($"Sounds\\{soundFileInfo.GetNameIndex()}.ogg");
                            }
                        }
                    }
                    else
                    {
                        writer.Write(0);
                    }
                }
            }