예제 #1
0
        public static CollideActivation Read(Reader reader, Pointer offset, CollSet collset, CollideType type)
        {
            CollideActivation a = new CollideActivation(offset);

            if (Settings.s.linkedListType != LinkedList.Type.Minimize)
            {
                a.off_next = Pointer.Read(reader);
                if (Settings.s.hasLinkedListHeaderPointers)
                {
                    a.off_prev   = Pointer.Read(reader);
                    a.off_header = Pointer.Read(reader);
                }
            }
            a.off_activationZone = Pointer.Read(reader);
            Pointer.DoAt(ref reader, a.off_activationZone, () => {
                a.activationZone = LinkedList <CollideActivationZone> .Read(ref reader, offset,
                                                                            (off_element) => {
                    return(CollideActivationZone.Read(reader, off_element));
                },
                                                                            flags: (Settings.s.hasLinkedListHeaderPointers ?
                                                                                    LinkedList.Flags.HasHeaderPointers :
                                                                                    LinkedList.Flags.NoPreviousPointersForDouble),
                                                                            type: LinkedList.Type.Minimize
                                                                            );
            });
            a.index = reader.ReadUInt16();
            reader.ReadUInt16();
            if (Settings.s.linkedListType == LinkedList.Type.Minimize)
            {
                a.off_next = Pointer.Current(reader);
            }
            return(a);
        }
예제 #2
0
        public CollSet Clone(UnityEngine.Transform parent)
        {
            CollSet m = (CollSet)MemberwiseClone();

            m.zdxList = new Dictionary <CollideType, LinkedList <GeometricObjectCollide> >();
            foreach (KeyValuePair <CollideType, LinkedList <GeometricObjectCollide> > kv in zdxList)
            {
                LinkedList <GeometricObjectCollide> geos = new LinkedList <GeometricObjectCollide>(kv.Value.offset, kv.Value.off_head, kv.Value.off_tail, (uint)kv.Value.Count, kv.Value.type);
                for (int i = 0; i < kv.Value.Count; i++)
                {
                    geos[i] = kv.Value[i].Clone();
                    geos[i].gao.transform.SetParent(parent);
                }
                m.zdxList.Add(kv.Key, geos);
            }
            return(m);
        }
예제 #3
0
        public static CollSet Read(Reader reader, Perso perso, Pointer offset)
        {
            MapLoader l = MapLoader.Loader;
            //if (Settings.s.platform == Settings.Platform.DC) return null;
            //l.print("CollSet @ " + offset);
            CollSet c = new CollSet(perso, offset);

            c.off_zdxList[CollideType.ZDD] = Pointer.Read(reader);
            c.off_zdxList[CollideType.ZDE] = Pointer.Read(reader);
            c.off_zdxList[CollideType.ZDM] = Pointer.Read(reader);
            c.off_zdxList[CollideType.ZDR] = Pointer.Read(reader);

            c.off_activationList[CollideType.ZDD] = Pointer.Read(reader);
            c.off_activationList[CollideType.ZDE] = Pointer.Read(reader);
            c.off_activationList[CollideType.ZDM] = Pointer.Read(reader);
            c.off_activationList[CollideType.ZDR] = Pointer.Read(reader);

            c.off_zones[CollideType.ZDD] = Pointer.Read(reader);
            c.off_zones[CollideType.ZDE] = Pointer.Read(reader);
            c.off_zones[CollideType.ZDM] = Pointer.Read(reader);
            c.off_zones[CollideType.ZDR] = Pointer.Read(reader);

            if (Settings.s.engineVersion > Settings.EngineVersion.Montreal)
            {
                c.privilegedActivations[CollideType.ZDD] = reader.ReadInt32();
                c.privilegedActivations[CollideType.ZDE] = reader.ReadInt32();
                c.privilegedActivations[CollideType.ZDM] = reader.ReadInt32();
                c.privilegedActivations[CollideType.ZDR] = reader.ReadInt32();
            }

            foreach (KeyValuePair <CollideType, Pointer> entry in c.off_zdxList)
            {
                Pointer.DoAt(ref reader, entry.Value, () => {
                    //zdxList = LinkedList<CollideMeshObject>.ReadHeader(r1, o1);
                    c.zdxList[entry.Key] = LinkedList <GeometricObjectCollide> .Read(ref reader, entry.Value,
                                                                                     (off_element) => {
                        GeometricObjectCollide col = GeometricObjectCollide.Read(reader, off_element, type: entry.Key);
                        col.gao.transform.SetParent(perso.Gao.transform);
                        return(col);
                    },
                                                                                     flags: LinkedList.Flags.ReadAtPointer
                                                                                     | (Settings.s.hasLinkedListHeaderPointers ?
                                                                                        LinkedList.Flags.HasHeaderPointers :
                                                                                        LinkedList.Flags.NoPreviousPointersForDouble),
                                                                                     type: LinkedList.Type.Minimize
                                                                                     );
                });
            }
            foreach (KeyValuePair <CollideType, Pointer> entry in c.off_zones)
            {
                Pointer.DoAt(ref reader, entry.Value, () => {
                    //zdxList = LinkedList<CollideMeshObject>.ReadHeader(r1, o1);
                    c.zones[entry.Key] = LinkedList <CollideActivationZone> .Read(ref reader, entry.Value,
                                                                                  (off_element) => {
                        return(CollideActivationZone.Read(reader, off_element));
                    },
                                                                                  flags: (Settings.s.hasLinkedListHeaderPointers ?
                                                                                          LinkedList.Flags.HasHeaderPointers :
                                                                                          LinkedList.Flags.NoPreviousPointersForDouble),
                                                                                  type: LinkedList.Type.Minimize
                                                                                  );
                });
            }
            foreach (KeyValuePair <CollideType, Pointer> entry in c.off_activationList)
            {
                Pointer.DoAt(ref reader, entry.Value, () => {
                    //zdxList = LinkedList<CollideMeshObject>.ReadHeader(r1, o1);
                    c.activationList[entry.Key] = LinkedList <CollideActivation> .Read(ref reader, entry.Value,
                                                                                       (off_element) => {
                        return(CollideActivation.Read(reader, off_element, c, entry.Key));
                    },
                                                                                       flags: (Settings.s.hasLinkedListHeaderPointers ?
                                                                                               LinkedList.Flags.HasHeaderPointers :
                                                                                               LinkedList.Flags.NoPreviousPointersForDouble),
                                                                                       type: LinkedList.Type.Minimize
                                                                                       );
                });
            }

            return(c);
        }