Example #1
0
        /// <summary>
        /// Get the material name, initialize its class and inject into Vector.
        /// </summary>
        /// <param name="byteptr_t">Pointer to the beginning of material block in Global data.</param>
        /// <param name="db">Database to which add classes.</param>
        private static unsafe void E_Material(byte *byteptr_t, Database.Carbon db)
        {
            // Get collection name of the material, starts at 0x14
            string CName = ScriptX.NullTerminatedString(byteptr_t + 0x1C, 0x1C);

            CName = Resolve.GetPathFromCollection(CName);
            Resolve.GetWindowTintString(CName);
            Map.BinKeys[Bin.Hash(CName)] = CName;

            var Class = new Material((IntPtr)byteptr_t, CName, db);

            db.Materials.Collections.Add(Class);
        }
Example #2
0
        /// <summary>
        /// Decompile entire cartypeinfo block into Vector of separate elements.
        /// </summary>
        /// <param name="byteptr_t">Pointer to the beginning of cartypeinfo block in Global data.</param>
        /// <param name="length">Length of the block to be read.</param>
        /// <param name="db">Database to which add classes.</param>
        private static unsafe void E_CarTypeInfo(byte *byteptr_t, uint length, Database.Underground2 db)
        {
            const uint size = 0x890;

            for (uint loop = 0; loop < length / size; ++loop)
            {
                uint offset = 8 + loop * size; // current offset of the cartypeinfo (padding included)

                // Get CollectionName
                string CName = ScriptX.NullTerminatedString(byteptr_t + offset, 0x10);

                CName = Resolve.GetPathFromCollection(CName);
                Map.BinKeys[Bin.Hash(CName)] = CName;

                var Class = new CarTypeInfo((IntPtr)(byteptr_t + offset), CName, db);
                db.CarTypeInfos.Collections.Add(Class);
            }
        }
Example #3
0
        /// <summary>
        /// Decompile entire preset rides block into Vector of separate elements.
        /// </summary>
        /// <param name="byteptr_t">Pointer to the beginning of preset rides block in Global data.</param>
        /// <param name="length">Length of the block to be read.</param>
        /// <param name="db">Database to which add classes.</param>
        private static unsafe void E_PresetRides(byte *byteptr_t, uint length, Database.Underground2 db)
        {
            const uint size = 0x338;

            for (uint loop = 0; loop < length / size; ++loop)
            {
                uint offset = loop * size; // current offset of the preset ride

                // Get CollectionName
                string CName = ScriptX.NullTerminatedString(byteptr_t + offset + 0x28, 0x20);

                CName = Resolve.GetPathFromCollection(CName);
                Map.BinKeys[Bin.Hash(CName)] = CName;

                var Class = new PresetRide((IntPtr)(byteptr_t + offset), CName, db);
                db.PresetRides.Collections.Add(Class);
            }
        }
Example #4
0
        /// <summary>
        /// Decompile entire acid effects block into Vector of separate elements.
        /// </summary>
        /// <param name="byteptr_t">Pointer to the beginning of acid effects block in Global data.</param>
        /// <param name="length">Length of the block to be read.</param>
        /// <param name="db">Database to which add classes.</param>
        private static unsafe void E_AcidEffects(byte *byteptr_t, uint length, Database.Underground2 db)
        {
            const uint size = 0xD0;

            for (uint loop = 0; loop < length / size; ++loop)
            {
                uint offset = 0x18 + loop * size; // current offset of the acid effect (padding included)

                // Get CollectionName
                string CName = ScriptX.NullTerminatedString(byteptr_t + offset + 0x90, 0x40);

                CName = Resolve.GetPathFromCollection(CName);
                Map.BinKeys[Bin.Hash(CName)] = CName;

                var Class = new AcidEffect((IntPtr)(byteptr_t + offset), CName, db);
                db.AcidEffects.Collections.Add(Class);
            }
        }