ReadByte() public method

public ReadByte ( ) : byte
return byte
Ejemplo n.º 1
0
        public static HITResult SeqGroupTrackID(HITThread thread)
        {
            var dest = thread.ReadByte(); //uhhhh
            var src  = thread.ReadByte();

            return(HITResult.CONTINUE);
        }
Ejemplo n.º 2
0
        public static HITResult SetTL(HITThread thread)
        {
            var dest = thread.ReadByte();
            var src  = thread.ReadByte();

            return(HITResult.CONTINUE); //unused in the sims
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        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
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Sign-extend a 1-byte constant to 4 bytes and write to a variable.
        /// </summary>
        public static HITResult LoadB(HITThread thread)
        {
            var dest  = thread.ReadByte();
            var value = (sbyte)thread.ReadByte();

            thread.WriteVar(dest, value);

            thread.SetFlags(value);

            return(HITResult.CONTINUE);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Compare two variables and set the flags.
        /// </summary>
        public static HITResult Cmp(HITThread thread) //same as sub, but does not set afterwards.
        {
            var dest = thread.ReadByte();
            var src  = thread.ReadByte();

            var result = thread.ReadVar(dest) - thread.ReadVar(src);

            thread.SetFlags(result);

            return(HITResult.CONTINUE);
        }
Ejemplo n.º 7
0
        /// <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);
        }
Ejemplo n.º 8
0
        /// <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);
            int TrackID = (int)thread.LoadTrack(index);

            thread.WriteVar(dest, TrackID);

            return(HITResult.CONTINUE); //Appears to be unused.
        }
Ejemplo n.º 9
0
        //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;
        }
Ejemplo n.º 10
0
        /// <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.
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Multiply a "dest" variable by a "src" variable.
        /// </summary>
        public static HITResult Mul(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);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Generate a random number between "low" and "high" variables, inclusive,
        /// and store the result in the "dest" variable.
        /// </summary>
        public static HITResult Rand(HITThread thread)
        {
            var dest = thread.ReadByte();
            var low  = thread.ReadByte();
            var high = thread.ReadByte();

            var result = (new Random()).Next(high + 1 - low) + low;

            thread.WriteVar(dest, result);

            thread.SetFlags(result);

            return(HITResult.CONTINUE);
        }
Ejemplo n.º 13
0
        public static HITResult GetSrcDataField(HITThread thread)
        {
            var dest  = thread.ReadByte();
            var src   = thread.ReadByte();
            var field = thread.ReadByte();

            int ObjectVar = thread.ReadVar(src);

            ObjectVar = thread.ReadVar(10010 + ObjectVar);
            thread.WriteVar(dest, ObjectVar);
            thread.SetFlags(ObjectVar);

            return(HITResult.CONTINUE);
        }
Ejemplo n.º 14
0
        /// <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);
            }
        }
Ejemplo n.º 15
0
        /// <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);
        }
Ejemplo n.º 16
0
        public static HITResult NoteOnLoop(HITThread thread) //0x60
        {
            var dest = thread.ReadByte();

            thread.WriteVar(dest, thread.NoteLoop());
            return(HITResult.HALT);
        }
Ejemplo n.º 17
0
        /// <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);
        }
Ejemplo n.º 18
0
        /// <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);
        }
Ejemplo n.º 19
0
        /// <summary>
        /// Play a note, whose ID resides in the specified variable.
        /// </summary>
        public static HITResult NoteOn(HITThread thread)
        {
            var dest = thread.ReadByte();

            thread.WriteVar(dest, thread.NoteOn());

            return(HITResult.CONTINUE);
        }
Ejemplo n.º 20
0
        /// <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);
        }
Ejemplo n.º 21
0
        /// <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);
        }
Ejemplo n.º 22
0
        /// <summary>
        /// Find the lower of a "dest" variable and a "src" constant and store the result in the variable.
        /// </summary>
        public static HITResult Min(HITThread thread)
        {
            var dest = thread.ReadByte();
            var src  = thread.ReadInt32();

            var result = Math.Min(thread.ReadVar(dest), src);

            thread.WriteVar(dest, result);

            thread.SetFlags(result);
            return(HITResult.CONTINUE); //unused in the sims
        }
Ejemplo n.º 23
0
        /// <summary>
        /// Jump to a given address.
        /// </summary>
        public static HITResult Jump(HITThread thread)
        {
            var read = thread.ReadByte();

            if (read > 15)   //literal
            {
                thread.PC--; //backtraaackkk
                thread.PC = PCTrans(thread.ReadUInt32(), thread);
            }
            else //no idea if there are collisions. if there are i'm blaming fatbag. >:)
            {
                thread.PC = PCTrans((uint)thread.ReadVar(read), thread);
                if (thread.ReadByte() == 0)
                {
                    thread.PC += 2;                         //if next is no-op, the operand is 4 byte
                }
                else
                {
                    thread.PC--;  //operand is 1 byte (next is an instruction), backtrack
                }
            }

            return(HITResult.CONTINUE);
        }
Ejemplo n.º 24
0
        /// <summary>
        /// Kill an actor's vocals, given a constant ID.
        /// </summary>
        public static HITResult SeqGroupKill(HITThread thread)
        {
            var src = thread.ReadByte();

            if (src == (byte)HITPerson.Instance)
            {
                thread.KillVocals();
            }
            else
            {
                //TODO: Implement system for keeping track of which object created a thread
                //      and kill that thread's sounds (src == ObjectID).
            }

            return(HITResult.CONTINUE);
        }
Ejemplo n.º 25
0
        /// <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);
            }
        }
Ejemplo n.º 26
0
        /// <summary>
        /// Play a track, whose ID resides in the specified variable.
        /// </summary>
        public static HITResult PlayTrack(HITThread thread)
        {
            var dest = thread.ReadByte();

            return(HITResult.CONTINUE); //Not used in TSO.
        }
Ejemplo n.º 27
0
        /// <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;
        }
Ejemplo n.º 28
0
        /// <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.
        }
Ejemplo n.º 29
0
        /// <summary>
        /// Write a 4-byte constant to a variable.
        /// </summary>
        public static HITResult LoadL(HITThread thread)
        {
            var dest = thread.ReadByte();
            var value = thread.ReadInt32();

            thread.WriteVar(dest, value);
            thread.SetFlags(value);

            return HITResult.CONTINUE;
        }
Ejemplo n.º 30
0
        //0x60
        public static HITResult NoteOnLoop(HITThread thread)
        {
            var dest = thread.ReadByte();
            thread.WriteVar(dest, thread.NoteLoop());

            return HITResult.CONTINUE;
        }
Ejemplo n.º 31
0
 /// <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;
 }
Ejemplo n.º 32
0
        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
        }
Ejemplo n.º 33
0
        public static HITResult GetSrcDataField(HITThread thread)
        {
            var dest = thread.ReadByte();
            var src = thread.ReadByte();
            var field = thread.ReadByte();

            int ObjectVar = thread.ReadVar(src);
            ObjectVar = thread.ReadVar(10010 + ObjectVar);
            thread.WriteVar(dest, ObjectVar);
            thread.SetFlags(ObjectVar);

            return HITResult.CONTINUE;
        }
Ejemplo n.º 34
0
        /// <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;
        }
Ejemplo n.º 35
0
 /// <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;
     }
 }
Ejemplo n.º 36
0
 /// <summary>
 /// Play a track, whose ID resides in the specified variable.
 /// </summary>
 public static HITResult PlayTrack(HITThread thread)
 {
     var dest = thread.ReadByte();
     return HITResult.CONTINUE; //Not used in TSO.
 }
Ejemplo n.º 37
0
        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;
        }
Ejemplo n.º 38
0
        /// <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;
        }
Ejemplo n.º 39
0
        /// <summary>
        /// Generate a random number between "low" and "high" variables, inclusive, 
        /// and store the result in the "dest" variable.
        /// </summary>
        public static HITResult Rand(HITThread thread)
        {
            var dest = thread.ReadByte();
            var low = thread.ReadByte();
            var high = thread.ReadByte();

            var result = (new Random()).Next(high+1-low)+low;
            thread.WriteVar(dest, result);

            thread.SetFlags(result);

            return HITResult.CONTINUE;
        }
Ejemplo n.º 40
0
        /// <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);
        }
Ejemplo n.º 41
0
        /// <summary>
        /// Jump to a given address.
        /// </summary>
        public static HITResult Jump(HITThread thread)
        {
            var read = thread.ReadByte();

            if (read > 15) //literal
            {
                thread.PC--; //backtraaackkk
                thread.PC = thread.ReadUInt32();
            }
            else //no idea if there are collisions. if there are i'm blaming fatbag. >:)
            {
                thread.PC = (uint)thread.ReadVar(read);
                if (thread.ReadByte() == 0) thread.PC += 2; //if next is no-op, the operand is 4 byte
                else thread.PC--; //operand is 1 byte (next is an instruction), backtrack
            }

            return HITResult.CONTINUE;
        }
Ejemplo n.º 42
0
        /// <summary>
        /// Find the lower of a "dest" variable and a "src" constant and store the result in the variable.
        /// </summary>
        public static HITResult Min(HITThread thread)
        {
            var dest = thread.ReadByte();
            var src = thread.ReadInt32();

            var result = Math.Min(thread.ReadVar(dest), src);
            thread.WriteVar(dest, result);

            thread.SetFlags(result);
            return HITResult.CONTINUE; //unused in the sims
        }
Ejemplo n.º 43
0
 public static HITResult SeqGroupTrackID(HITThread thread)
 {
     var dest = thread.ReadByte(); //uhhhh
     var src = thread.ReadByte();
     return HITResult.CONTINUE;
 }
Ejemplo n.º 44
0
        /// <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;
        }
Ejemplo n.º 45
0
        public static HITResult SetTL(HITThread thread)
        {
            var dest = thread.ReadByte();
            var src = thread.ReadByte();

            return HITResult.CONTINUE; //unused in the sims
        }
Ejemplo n.º 46
0
        /// <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;
        }
Ejemplo n.º 47
0
 /// <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;
 }
Ejemplo n.º 48
0
        /// <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);
        }
Ejemplo n.º 49
0
        /// <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;
        }
Ejemplo n.º 50
0
        /// <summary>
        /// Kill an actor's vocals, given a constant ID.
        /// </summary>
        public static HITResult SeqGroupKill(HITThread thread)
        {
            var src = thread.ReadByte();

            if (src == (byte)HITPerson.Instance)
                thread.KillVocals();
            else
            {
                //TODO: Implement system for keeping track of which object created a thread
                //      and kill that thread's sounds (src == ObjectID).
            }

            return HITResult.CONTINUE;
        }
Ejemplo n.º 51
0
 /// <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;
 }