/// <summary> /// /// </summary> /// <param name="osc"></param> /// /// <param name="zone"></param> /// <param name="waveSequence"></param> public override void SetWaveSequence(int osc, int zone, IWaveSequence waveSequence) { IntParameter parameter = new IntParameter(); // ReSharper disable once SwitchStatementMissingSomeCases switch (PcgRoot.Model.OsVersion) { case Models.EOsVersion.EOsVersionKronos10_11: // FALL THROUGH case Models.EOsVersion.EOsVersionKronos15_16: var bankIndex = ((IBank)waveSequence.Parent).Index; if (bankIndex >= 0x40) { bankIndex -= 0x40; // 40..46.. U-A..U-G } parameter.Set(Root, Root.Content, GetZoneMsByteOffset(osc, zone) + 1, 7, 0, false, this); parameter.Value = bankIndex; parameter.Set(Root, Root.Content, GetZoneMsByteOffset(osc, zone) + 2, 7, 0, false, this); parameter.Value = waveSequence.Index; break; case Models.EOsVersion.EOsVersionKronos2x: // FALL THROUGH case Models.EOsVersion.EOsVersionKronos3x: parameter.SetMultiBytes(Root, Root.Content, GetZoneMsByteOffset(osc, zone), 2, false, false, null); parameter.Value = GetWaveSequenceIndex(waveSequence); break; default: throw new ApplicationException("Illegal (non Kronos) model"); } }
/// <summary> /// /// </summary> /// <param name="osc"></param> /// <param name="zone"></param> /// <returns></returns> private EMode GetZoneMsType(int osc, int zone) { var offset = ByteOffset + 2774 + osc * (3240 - 2774) + zone * (2796 - 2774); var parameter = new IntParameter(); parameter.Set(Root, Root.Content, offset, 1, 0, false, null); int value = parameter.Value; EMode mode; switch (value) { case 0: mode = EMode.Off; break; case 1: mode = EMode.Sample; break; case 2: mode = EMode.WaveSequence; break; default: mode = EMode.Off; // Not supported, selected when copy drum kit from Kronos OS3.0 file. // throw new ApplicationException("Illegal case"); break; } return(mode); }
public override void InitializeStates(out BaseState default_state) { default_state = goingtoeat; root.Enter("SetTarget", delegate(Instance smi) { targetCell.Set(smi.GetSMI <GasAndLiquidConsumerMonitor.Instance>().targetCell, smi); }); goingtoeat.MoveTo((Instance smi) => targetCell.Get(smi), inhaling, null, false).ToggleStatusItem(CREATURES.STATUSITEMS.LOOKINGFORFOOD.NAME, CREATURES.STATUSITEMS.LOOKINGFORFOOD.TOOLTIP, category: Db.Get().StatusItemCategories.Main, icon: string.Empty, icon_type: StatusItem.IconType.Info, notification_type: (NotificationType)0, allow_multiples: false, render_overlay: default(HashedString), status_overlays: 0, resolve_string_callback: null, resolve_tooltip_callback: null); inhaling.DefaultState(inhaling.pre).ToggleStatusItem(CREATURES.STATUSITEMS.INHALING.NAME, CREATURES.STATUSITEMS.INHALING.TOOLTIP, category: Db.Get().StatusItemCategories.Main, icon: string.Empty, icon_type: StatusItem.IconType.Info, notification_type: (NotificationType)0, allow_multiples: false, render_overlay: default(HashedString), status_overlays: 0, resolve_string_callback: null, resolve_tooltip_callback: null); inhaling.pre.PlayAnim("inhale_pre").QueueAnim("inhale_loop", true, null).Update("Consume", delegate(Instance smi, float dt) { smi.GetSMI <GasAndLiquidConsumerMonitor.Instance>().Consume(dt); }, UpdateRate.SIM_200ms, false) .EventTransition(GameHashes.ElementNoLongerAvailable, inhaling.pst, null) .Enter("StartInhaleSound", delegate(Instance smi) { smi.StartInhaleSound(); }) .Exit("StopInhaleSound", delegate(Instance smi) { smi.StopInhaleSound(); }) .ScheduleGoTo((Instance smi) => smi.def.inhaleTime, inhaling.pst); inhaling.pst.Transition(inhaling.full, IsFull, UpdateRate.SIM_200ms).Transition(behaviourcomplete, GameStateMachine <InhaleStates, Instance, IStateMachineTarget, Def> .Not(IsFull), UpdateRate.SIM_200ms); inhaling.full.QueueAnim("inhale_pst", false, null).OnAnimQueueComplete(behaviourcomplete); behaviourcomplete.PlayAnim("idle_loop", KAnim.PlayMode.Loop).BehaviourComplete(GameTags.Creatures.WantsToEat, false); }
/// <summary> /// /// </summary> /// /// <param name="osc"></param> /// <param name="zone"></param> /// <returns></returns> public override IWaveSequence GetUsedWaveSequence(int osc, int zone) { IWaveSequence waveSequence = null; if (GetZoneMsType(osc, zone) == EMode.WaveSequence) { var parameter = new IntParameter(); var waveSequenceByteOffset = GetZoneMsByteOffset(osc, zone); int bankIndex; int patchIndex; // ReSharper disable once SwitchStatementMissingSomeCases switch (PcgRoot.Model.OsVersion) { case Models.EOsVersion.EOsVersionKronos10_11: // FALL THROUGH case Models.EOsVersion.EOsVersionKronos15_16: parameter.Set(Root, Root.Content, waveSequenceByteOffset + 16, 1, 0, false, this); bankIndex = parameter.Value; if (bankIndex >= 0x40) { bankIndex -= 0x40; // 40..46.. U-A..U-G } parameter.Set(Root, Root.Content, waveSequenceByteOffset + 17, 1, 0, false, this); patchIndex = parameter.Value; waveSequence = (IWaveSequence)PcgRoot.WaveSequenceBanks[bankIndex].Patches[patchIndex]; break; case Models.EOsVersion.EOsVersionKronos2x: // FALL THROUGH case Models.EOsVersion.EOsVersionKronos3x: parameter.Set(Root, Root.Content, waveSequenceByteOffset + 16, 2, 0, false, this); int waveSequenceIndex = parameter.Value; GetWaveSequenceIndices(waveSequenceIndex, out bankIndex, out patchIndex); waveSequence = (IWaveSequence)PcgRoot.WaveSequenceBanks[bankIndex].Patches[patchIndex]; break; default: throw new ApplicationException("Illegal (non Kronos) model"); } } return(waveSequence); }
public override void InitializeStates(out BaseState default_state) { default_state = goingtopoop; root.Enter("SetTarget", delegate(Instance smi) { targetCell.Set(smi.GetSMI <GasAndLiquidConsumerMonitor.Instance>().targetCell, smi); }); goingtopoop.MoveTo((Instance smi) => smi.GetLastPoopCell(), pooping, updatepoopcell, false); pooping.PlayAnim("poop").ToggleStatusItem(CREATURES.STATUSITEMS.EXPELLING_SOLID.NAME, CREATURES.STATUSITEMS.EXPELLING_SOLID.TOOLTIP, category: Db.Get().StatusItemCategories.Main, icon: string.Empty, icon_type: StatusItem.IconType.Info, notification_type: NotificationType.Neutral, allow_multiples: false, render_overlay: default(HashedString), status_overlays: 129022, resolve_string_callback: null, resolve_tooltip_callback: null).OnAnimQueueComplete(behaviourcomplete); updatepoopcell.Enter(delegate(Instance smi) { smi.SetLastPoopCell(); }).GoTo(pooping); behaviourcomplete.PlayAnim("idle_loop", KAnim.PlayMode.Loop).BehaviourComplete(GameTags.Creatures.Poop, false); }
/// <summary> /// /// </summary> /// /// <param name="osc"></param> /// <param name="zone"></param> /// <returns></returns> public override IWaveSequence GetUsedWaveSequence(int osc, int zone) { IWaveSequence waveSequence = null; if (GetZoneMsType(osc, zone) == EMode.WaveSequence) { IntParameter parameter = new IntParameter(); int waveSequenceByteOffset = GetZoneMsByteOffset(osc, zone); int bankIndex; int patchIndex; parameter.Set(Root, Root.Content, waveSequenceByteOffset + 16, 2, 0, false, this); int waveSequenceIndex = parameter.Value; GetWaveSequenceIndices(waveSequenceIndex, out bankIndex, out patchIndex); waveSequence = (IWaveSequence)PcgRoot.WaveSequenceBanks[bankIndex].Patches[patchIndex]; } return(waveSequence); }