Esempio n. 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);
        }
Esempio n. 2
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);
        }