//0x10 /// <summary> /// Increment a "dest" variable by a "src" variable. /// </summary> public static HITResult Add(HITThread thread) { var dest = thread.ReadByte(); var src = thread.ReadByte(); var result = thread.ReadVar(dest) + thread.ReadVar(src); thread.WriteVar(dest, result); thread.SetFlags(result); return HITResult.CONTINUE; }
/// <summary> /// Stop playing a track, whose ID resides in the specified variable. /// </summary> public static HITResult StopTrack(HITThread thread) { var src = thread.ReadByte(); return HITResult.CONTINUE; }
/// <summary> /// Choose a global hitlist, or 0 for the one local to the track (source: defaultsyms.txt). /// </summary> public static HITResult SmartSetList(HITThread thread) { //sets the hitlist var src = thread.ReadByte(); thread.LoadHitlist((uint)thread.ReadVar(src)); return HITResult.CONTINUE; }
public static HITResult SmartRemoveAll(HITThread thread) { return HITResult.CONTINUE; //unused in the sims }
/// <summary> /// Set the specified variable to a random entry from the selected hitlist. /// </summary> public static HITResult SmartChoose(HITThread thread) { var dest = thread.ReadByte(); thread.WriteVar(dest, (int)thread.HitlistChoose()); return HITResult.CONTINUE; }
public static HITResult SetSrcDataField(HITThread thread) { var value = thread.ReadByte(); var src = thread.ReadByte(); var field = thread.ReadByte(); //TODO: System for keeping track of which objects correspond to ObjectID. return HITResult.CONTINUE; //you can set these??? what }
/// <summary> /// Wait for the previously selected note to finish playing. /// </summary> public static HITResult WaitSamp(HITThread thread) { if (thread.NoteActive(thread.LastNote)) { thread.PC--; return HITResult.HALT; } else return HITResult.HALT; }
/// <summary> /// Wait until two variables are equal. /// </summary> public static HITResult WaitEqual(HITThread thread) { var dest = thread.ReadByte(); var src = thread.ReadByte(); if (thread.ReadVar(dest) != thread.ReadVar(dest)) { thread.PC -= 3; return HITResult.HALT; } else return HITResult.CONTINUE; }
public static HITResult Dec(HITThread thread) //0x30 { return(HITResult.CONTINUE); //unused in the sims }
public static HITResult SmartSetCrit(HITThread thread) { return(HITResult.CONTINUE); //unused in the sims }
public static HITResult SmartRemoveAll(HITThread thread) { return(HITResult.CONTINUE); //unused in the sims }
public static HITResult SetLoop(HITThread thread) { thread.LoopPointer = (int)thread.PC; return(HITResult.CONTINUE); }
public static HITResult Loop(HITThread thread) //0x20 { thread.PC = (uint)thread.LoopPointer; return(HITResult.CONTINUE); }
public static HITResult RemoveFromGroup(HITThread thread) { return(HITResult.CONTINUE); //unused in the sims }
public static HITResult NOP(HITThread thread) { return(HITResult.CONTINUE); }
public static HITResult Test1(HITThread thread) { //no idea what these do. examples? return HITResult.CONTINUE; }
/// <summary> /// Unducks all audio back to the volume before Duck() was called. /// </summary> public static HITResult Unduck(HITThread thread) { thread.Unduck(); return HITResult.CONTINUE; //quack }
public static HITResult KillTrack(HITThread thread) { var src = thread.ReadByte(); return(HITResult.CONTINUE); }
public static HITResult WaitLessOrEq(HITThread thread) { return HITResult.CONTINUE; //unused in the sims }
public static HITResult Pop(HITThread thread) { return(HITResult.CONTINUE); //unused in the sims }
public static HITResult CallEntryPoint(HITThread thread) { return(HITResult.CONTINUE); //unused in the sims }
public static HITResult Test1(HITThread thread) { //no idea what these do. examples? return(HITResult.CONTINUE); }
public static HITResult SetTL(HITThread thread) { var dest = thread.ReadByte(); var src = thread.ReadByte(); return HITResult.CONTINUE; //unused in the sims }
/// <summary> /// Kill a sequence group with the return value specified by a constant. /// </summary> public static HITResult SeqGroupReturn(HITThread thread) { var src = thread.ReadByte(); return HITResult.CONTINUE; }
/// <summary> /// Load a track ("index" variable) from a hitlist ("table" variable). /// </summary> public static HITResult SmartIndex(HITThread thread) { var dest = thread.ReadVar(thread.ReadByte()); var index = thread.ReadVar(thread.ReadByte()); thread.LoadHitlist((byte)index); //Converting this to an int is a hack because WriteVar only takes an int... o_O int TrackID = (int)thread.LoadTrack(index); thread.WriteVar(dest, TrackID); return HITResult.CONTINUE; //Appears to be unused. }
public static HITResult SeqGroupTrackID(HITThread thread) { var dest = thread.ReadByte(); //uhhhh var src = thread.ReadByte(); return HITResult.CONTINUE; }
public static HITResult SmartSetCrit(HITThread thread) { return HITResult.CONTINUE; //unused in the sims }
//unused in the sims public static HITResult SeqGroupWait(HITThread thread) { return HITResult.CONTINUE; }
/// <summary> /// Copy the contents of one variable into another. /// </summary> public static HITResult Set(HITThread thread) { var dest = thread.ReadByte(); var src = thread.ReadVar(thread.ReadByte()); thread.WriteVar(dest, src); thread.SetFlags(src); return HITResult.CONTINUE; }
public static HITResult SetChanReg(HITThread thread) { return HITResult.CONTINUE; //unused in the sims }
/// <summary> /// Examine a variable and set the flags. /// </summary> public static HITResult Test(HITThread thread) { var value = thread.ReadVar(thread.ReadByte()); thread.SetFlags(value); return HITResult.CONTINUE; }
/// <summary> /// Read globally, set locally (source: defaultsyms.txt). /// </summary> public static HITResult SetGL(HITThread thread) { var dest = thread.ReadByte(); var src = thread.ReadInt32(); int Global = thread.VM.ReadGlobal(src); thread.WriteVar(dest, Global); return HITResult.CONTINUE; }
public static HITResult Test4(HITThread thread) { return HITResult.CONTINUE; }
/// <summary> /// Set global = local (source: defaultsyms.txt). /// </summary> public static HITResult SetLG(HITThread thread) { var local = thread.ReadByte(); var global = thread.ReadInt32(); thread.VM.WriteGlobal(global, local); return HITResult.CONTINUE; }
/// <summary> /// Wait for a length of time in milliseconds, specified by a variable. /// </summary> public static HITResult Wait(HITThread thread) { var src = thread.ReadByte(); if (thread.WaitRemain == -1) thread.WaitRemain = thread.ReadVar(src); thread.WaitRemain -= 16; //assuming tick rate is 60 times a second if (thread.WaitRemain > 0) { thread.PC -= 2; return HITResult.HALT; } else { thread.WaitRemain = -1; return HITResult.CONTINUE; } }
/// <summary> /// Copy the contents of one variable into another (equivalent to set and settt; /// defaultsyms.txt says "ISN'T THIS THE SAME AS SET TOO?") /// </summary> public static HITResult SetLL(HITThread thread) { Set(thread); return HITResult.CONTINUE; }
public static HITResult WaitGreater(HITThread thread) { return HITResult.CONTINUE; //unused in the sims }
/// <summary> /// Set the loop point to the current position. /// </summary> public static HITResult SetLoop(HITThread thread) { thread.LoopPointer = (int)thread.PC; return HITResult.CONTINUE; }
public static HITResult WaitNotEqual(HITThread thread) { return HITResult.CONTINUE; //unused in the sims }
public static HITResult SetLT(HITThread thread) { //set local... to... t... yeah i don't know either //might be object vars var dest = thread.ReadByte(); var src = thread.ReadByte(); return HITResult.CONTINUE; }
public static HITResult And(HITThread thread) { return HITResult.CONTINUE; //unused in the sims }
public HITSound PlaySoundEvent(string evt) { evt = evt.ToLower(); HITThread InterruptBlocker = null; //the thread we have to wait for to finish before we begin. if (ActiveEvents.ContainsKey(evt)) { var aevt = ActiveEvents[evt]; if (aevt.Dead) { ActiveEvents.Remove(evt); //if the last event is dead, remove and make a new one } else { if (aevt != null && ((HITThread)(aevt)).InterruptBlocker != null) { //we can stop this thread - steal its waiter ((HITThread)(aevt)).Dead = true; InterruptBlocker = ((HITThread)(aevt)).InterruptBlocker; } else if (aevt != null && ((HITThread)(aevt)).Interruptable == true) { InterruptBlocker = ((HITThread)(aevt)); } else { return(aevt); //an event of this type is already alive - here, take it. } } } var content = FSO.Content.Content.Get(); if (Events.ContainsKey(evt)) { var evtent = Events[evt]; if (evt.Equals("piano_play", StringComparison.InvariantCultureIgnoreCase)) { evt = "playpiano"; if (ActiveEvents.ContainsKey(evt)) { if (ActiveEvents[evt].Dead) { ActiveEvents.Remove(evt); //if the last event is dead, remove and make a new one } else { return(ActiveEvents[evt]); //an event of this type is already alive - here, take it. } } } uint TrackID = 0; uint SubroutinePointer = 0; if (evtent.ResGroup.hsm != null) { var c = evtent.ResGroup.hsm.Constants; if (c.ContainsKey(evt)) { SubroutinePointer = (uint)c[evt]; } var trackIdName = "guid_tkd_" + evt; if (c.ContainsKey(trackIdName)) { TrackID = (uint)c[trackIdName]; } else { TrackID = evtent.TrackID; } } else { //no hsm, fallback to eent and event track ids (tsov2) var entPoints = evtent.ResGroup.hit.EntryPointByTrackID; TrackID = evtent.TrackID; if (entPoints.ContainsKey(evtent.TrackID)) { SubroutinePointer = entPoints[evtent.TrackID]; } } if (evtent.EventType == HITEvents.kTurnOnTV) { var thread = new HITTVOn(evtent.TrackID, this); thread.VolGroup = HITVolumeGroup.FX; Threads.Add(thread); ActiveEvents.Add(evt, thread); return(thread); } else if (evtent.EventType == HITEvents.kSetMusicMode) { var thread = new HITTVOn(evtent.TrackID, this, true); thread.VolGroup = HITVolumeGroup.MUSIC; ActiveEvents.Add(evt, thread); if (NextMusic != null) { NextMusic.Kill(); } if (MusicEvent != null) { MusicEvent.Fade(); } NextMusic = thread; return(thread); } else if (SubroutinePointer != 0) { var thread = new HITThread(evtent.ResGroup.hit, this); thread.PC = SubroutinePointer; if (TrackID != 0) { thread.SetTrack(TrackID); } Threads.Add(thread); if (!ActiveEvents.ContainsKey(evt)) { ActiveEvents.Add(evt, thread); } if (InterruptBlocker != null) { InterruptBlocker.Interrupt(thread); InterruptBlocker.KillVocals(); } return(thread); } else if (TrackID != 0 && content.Audio.TracksById.ContainsKey(TrackID)) { var thread = new HITThread(TrackID); Threads.Add(thread); ActiveEvents.Add(evt, thread); if (InterruptBlocker != null) { InterruptBlocker.Interrupt(thread); InterruptBlocker.KillVocals(); } return(thread); } } return(null); }