예제 #1
0
        protected virtual void SerializeImpl(IO.BitStream s)
        {
            var condition_write_order = s.IsWriting ? mCompilerState.ConditionWriteOrder : null;
            var action_write_order    = s.IsWriting ? mCompilerState.ActionWriteOrder : null;
            var trigger_write_order   = s.IsWriting ? mCompilerState.TriggerWriteOrder : null;

            Collections.ActiveListUtil.Serialize(s, Conditions, Database.Limits.Conditions.CountBitLength,
                                                 this, NewConditionFromBitStream, condition_write_order);
            Collections.ActiveListUtil.Serialize(s, Actions, Database.Limits.Actions.CountBitLength,
                                                 this, NewActionFromBitStream, action_write_order);
            Collections.ActiveListUtil.Serialize(s, Triggers, Database.Limits.Triggers.CountBitLength,
                                                 this, NewTriggerFromBitStream, trigger_write_order);
            s.StreamElements(GameStatistics, Database.Limits.GameStatistics.CountBitLength, this, _model => _model.NewGameStatistic());
            GlobalVariables.Serialize(this, s);
            PlayerVariables.Serialize(this, s);
            ObjectVariables.Serialize(this, s);
            TeamVariables.Serialize(this, s);
            s.StreamElements(HudWidgets, Database.Limits.HudWidgets.CountBitLength);
            SerializeTriggerEntryPoints(s);
            ObjectTypeReferences.SerializeWords(s, Shell.EndianFormat.Little);
            s.StreamElements(ObjectFilters, Database.Limits.ObjectFilters.CountBitLength);
            if (Database.Limits.SupportsGameObjectFilters)
            {
                SerializeGameObjectFilters(s);
            }
        }
예제 #2
0
        public void Serialize(IO.BitStream s)
        {
            using (s.EnterOwnerBookmark(this))
            {
                s.Stream(ref mEncodingVersion);
                if (s.IsReading && !VerifyEncodingVersion())
                {
                    throw new IO.VersionMismatchException("Megalo encoding", (uint)mEncodingVersion);
                }

                s.Stream(ref EngineVersion);                                            // global, not a c_game_engine_megalo_variant member
                s.StreamObject(BaseVariant);
                s.StreamElements(PlayerTraits,
                                 MegaloDatabase.Limits.PlayerTraits.CountBitLength,
                                 this, _this => _this.NewMegaloPlayerTraits());
                s.StreamElements(UserDefinedOptions,
                                 MegaloDatabase.Limits.UserDefinedOptions.CountBitLength);
                s.StreamObject(StringTable);
                StreamStringTableIndexPointer(s, ref BaseNameStringIndex);
                SerializeDescriptionLocaleStrings(s);
                s.StreamNoneable(ref EngineIconIndex,
                                 MegaloDatabase.Limits.EngineCategories.IndexBitLength);
                s.StreamNoneable(ref EngineCategory,
                                 MegaloDatabase.Limits.EngineCategories.IndexBitLength);
                s.StreamObject(MapPermissions);
                s.StreamObject(PlayerRatingParameters);
                s.Stream(ref ScoreToWinRound);

                SerializeImpl(s);
            }
        }
예제 #3
0
 public void Serialize(MegaloScriptModel model, IO.BitStream s)
 {
     s.StreamElements(Numerics, ProtoData.Traits[MegaloScriptVariableType.Numeric].CountBitLength, model, _model => _model.NewCustomVariable());
     s.StreamElements(Timers, ProtoData.Traits[MegaloScriptVariableType.Timer].CountBitLength, model, _model => _model.NewTimerVariable());
     s.StreamElements(Teams, ProtoData.Traits[MegaloScriptVariableType.Team].CountBitLength, model, _model => _model.NewTeamVariable());
     s.StreamElements(Players, ProtoData.Traits[MegaloScriptVariableType.Player].CountBitLength, model, _model => _model.NewPlayerVariable());
     s.StreamElements(Objects, ProtoData.Traits[MegaloScriptVariableType.Object].CountBitLength, model, _model => _model.NewObjectVariable());
 }
예제 #4
0
 public void Serialize(IO.BitStream s)
 {
     s.Stream(ref PlayerRequisitionFrequencySeconds);
     s.Stream(ref InitialGameCurrency);
     s.StreamElements(RequisitionItems, 7);                                              // 0x26E0	0x26E4
     Contract.Assert(RequisitionItems.Count == 0);
 }
예제 #5
0
        protected virtual void SerializeGameObjectFilters(IO.BitStream s)
        {
            int game_object_filter_count = s.IsReading ? 0 : CandySpawnerFilters.Count;

            s.Stream(ref game_object_filter_count, Database.Limits.GameObjectFilters.CountBitLength);
            s.StreamElements(CandySpawnerFilters, Database.Limits.GameObjectFilters.CountBitLength);
            Contract.Assert(CandySpawnerFilters.Count == game_object_filter_count);
        }
        protected override void SerializeImpl(IO.BitStream s)
        {
            #region struct
            // 0x								BaseVariant
            // 0x33EC							StringTable
            // 0xE79C							EncodingVersion
            // 0xE7A0, 0xE7A4, sizeof(0x104)	PlayerTraits
            // 0xF7E8, 0xFCA8, 0xF7E4;count		UserDefinedOptions
            // 0xFCC8							EngineDefinition
            // 0x18274							BaseNameStringIndex
            // 0x1AC64							EngineIconIndex
            // 0x1AC60							EngineCategory
            // 0x1AC68							MapPermissions
            // 0x1ACB0							PlayerRatingParameters
            // 0x1ACF0							ScoreToWinRound
            // 0x1ACF2
            // 0x1ACF3
            // 0x1ACF4
            // 0x1ACF8							Loadouts
            // 0x18278							DisabledEngineOptions
            // 0x182E0							HiddenEngineOptions
            // 0x18348							DisabledUserOptions
            // 0x1834C							HiddenUserOptions
            // 0x1AE44							TU5
            #endregion

            s.Stream(ref unk1ACF2);
            s.Stream(ref unk1ACF3);
            s.Stream(ref unk1ACF4);
            s.StreamElements(Loadouts, Bits.kInt32BitCount);
            SerializeOptionToggles(s);
            s.StreamObject(EngineDefinition);

            if (HasWeaponTuning)
            {
                WeaponTuning.Serialize(s);
            }
        }
예제 #7
0
 public void Serialize(IO.BitStream s)
 {
     s.StreamElements(MapIds, 6, Bits.kInt16BitCount);
     s.Stream(ref ExceptionType, 1, MapPermissionsExceptionTypeBitStreamer.Instance);
 }