コード例 #1
0
ファイル: RSInterface.cs プロジェクト: lackey94/rsunity-1
        public static void unpack(StreamLoader streamLoader, TextDrawingArea[] textDrawingAreas, StreamLoader streamLoader_1)
        {
            aMRUNodes_238 = new MRUNodes(50000);
            Stream stream = new Stream(streamLoader.getDataForName("data"));
            int    i      = -1;
            int    j      = stream.readUnsignedWord();

            interfaceCache = new RSInterface[j];
            while (stream.currentOffset < stream.buffer.Length)
            {
                int k = stream.readUnsignedWord();
                if (k == 65535)
                {
                    i = stream.readUnsignedWord();
                    k = stream.readUnsignedWord();
                }

                RSInterface rsInterface = interfaceCache[k] = new RSInterface();
                rsInterface.id           = k;
                rsInterface.parentID     = i;
                rsInterface.type         = stream.readUnsignedByte();
                rsInterface.atActionType = stream.readUnsignedByte();
                rsInterface.anInt214     = stream.readUnsignedWord();
                rsInterface.width        = stream.readUnsignedWord();
                rsInterface.height       = stream.readUnsignedWord();
                rsInterface.aByte254     = (byte)stream.readUnsignedByte();
                rsInterface.anInt230     = stream.readUnsignedByte();
                if (rsInterface.anInt230 != 0)
                {
                    rsInterface.anInt230 = (rsInterface.anInt230 - 1 << 8) + stream.readUnsignedByte();
                }
                else
                {
                    rsInterface.anInt230 = -1;
                }
                int i1 = stream.readUnsignedByte();
                if (i1 > 0)
                {
                    rsInterface.anIntArray245 = new int[i1];
                    rsInterface.anIntArray212 = new int[i1];
                    for (int j1 = 0; j1 < i1; j1++)
                    {
                        rsInterface.anIntArray245[j1] = stream.readUnsignedByte();
                        rsInterface.anIntArray212[j1] = stream.readUnsignedWord();
                    }
                }
                int k1 = stream.readUnsignedByte();
                if (k1 > 0)
                {
                    rsInterface.valueIndexArray = new int[k1][];
                    for (int l1 = 0; l1 < k1; l1++)
                    {
                        int i3 = stream.readUnsignedWord();
                        rsInterface.valueIndexArray[l1] = new int[i3];
                        for (int l4 = 0; l4 < i3; l4++)
                        {
                            rsInterface.valueIndexArray[l1][l4] = stream.readUnsignedWord();
                        }
                    }
                }
                if (rsInterface.type == 0)
                {
                    rsInterface.scrollMax   = stream.readUnsignedWord();
                    rsInterface.aBoolean266 = stream.readUnsignedByte() == 1;
                    int i2 = stream.readUnsignedWord();
                    rsInterface.children = new int[i2];
                    rsInterface.childX   = new int[i2];
                    rsInterface.childY   = new int[i2];
                    for (int j3 = 0; j3 < i2; j3++)
                    {
                        rsInterface.children[j3] = stream.readUnsignedWord();
                        rsInterface.childX[j3]   = stream.readSignedWord();
                        rsInterface.childY[j3]   = stream.readSignedWord();
                    }
                }
                if (rsInterface.type == 1)
                {
                    stream.readUnsignedWord();
                    stream.readUnsignedByte();
                }
                if (rsInterface.type == 2)
                {
                    rsInterface.inv                  = new int[rsInterface.width * rsInterface.height];
                    rsInterface.invStackSizes        = new int[rsInterface.width * rsInterface.height];
                    rsInterface.aBoolean259          = stream.readUnsignedByte() == 1;
                    rsInterface.isInventoryInterface = stream.readUnsignedByte() == 1;
                    rsInterface.usableItemInterface  = stream.readUnsignedByte() == 1;
                    rsInterface.aBoolean235          = stream.readUnsignedByte() == 1;
                    rsInterface.invSpritePadX        = stream.readUnsignedByte();
                    rsInterface.invSpritePadY        = stream.readUnsignedByte();
                    rsInterface.spritesX             = new int[20];
                    rsInterface.spritesY             = new int[20];
                    rsInterface.sprites              = new Sprite[20];
                    for (int j2 = 0; j2 < 20; j2++)
                    {
                        int k3 = stream.readUnsignedByte();
                        if (k3 == 1)
                        {
                            rsInterface.spritesX[j2] = stream.readSignedWord();
                            rsInterface.spritesY[j2] = stream.readSignedWord();
                            String s1 = stream.readString();
                            if (streamLoader_1 != null && s1.Length > 0)
                            {
                                int i5 = s1.LastIndexOf(",");
                                rsInterface.sprites[j2] = method207(int.Parse(s1.Substring(i5 + 1)), streamLoader_1, s1.Substring(0, i5));
                            }
                        }
                    }

                    rsInterface.actions = new String[5];
                    for (int l3 = 0; l3 < 5; l3++)
                    {
                        rsInterface.actions[l3] = stream.readString();
                        if (rsInterface.actions[l3].Length == 0)
                        {
                            rsInterface.actions[l3] = null;
                        }
                    }
                }
                if (rsInterface.type == 3)
                {
                    rsInterface.aBoolean227 = stream.readUnsignedByte() == 1;
                }
                if (rsInterface.type == 4 || rsInterface.type == 1)
                {
                    rsInterface.aBoolean223 = stream.readUnsignedByte() == 1;
                    int k2 = stream.readUnsignedByte();
                    if (textDrawingAreas != null)
                    {
                        rsInterface.textDrawingAreas = textDrawingAreas[k2];
                    }
                    rsInterface.aBoolean268 = stream.readUnsignedByte() == 1;
                }
                if (rsInterface.type == 4)
                {
                    rsInterface.message    = stream.readString();
                    rsInterface.aString228 = stream.readString();
                }
                if (rsInterface.type == 1 || rsInterface.type == 3 || rsInterface.type == 4)
                {
                    rsInterface.textColor = stream.readDWord();
                }
                if (rsInterface.type == 3 || rsInterface.type == 4)
                {
                    rsInterface.anInt219 = stream.readDWord();
                    rsInterface.anInt216 = stream.readDWord();
                    rsInterface.anInt239 = stream.readDWord();
                }
                if (rsInterface.type == 5)
                {
                    String s = stream.readString();
                    if (streamLoader_1 != null && s.Length > 0)
                    {
                        int i4 = s.LastIndexOf(",");
                        rsInterface.sprite1 = method207(int.Parse(s.Substring(i4 + 1)), streamLoader_1, s.Substring(0, i4));
                    }
                    s = stream.readString();
                    if (streamLoader_1 != null && s.Length > 0)
                    {
                        int j4 = s.LastIndexOf(",");
                        rsInterface.sprite2 = method207(int.Parse(s.Substring(j4 + 1)), streamLoader_1, s.Substring(0, j4));
                    }
                }
                if (rsInterface.type == 6)
                {
                    int l = stream.readUnsignedByte();
                    if (l != 0)
                    {
                        rsInterface.anInt233 = 1;
                        rsInterface.mediaID  = (l - 1 << 8) + stream.readUnsignedByte();
                    }
                    l = stream.readUnsignedByte();
                    if (l != 0)
                    {
                        rsInterface.anInt255 = 1;
                        rsInterface.anInt256 = (l - 1 << 8) + stream.readUnsignedByte();
                    }
                    l = stream.readUnsignedByte();
                    if (l != 0)
                    {
                        rsInterface.anInt257 = (l - 1 << 8) + stream.readUnsignedByte();
                    }
                    else
                    {
                        rsInterface.anInt257 = -1;
                    }
                    l = stream.readUnsignedByte();
                    if (l != 0)
                    {
                        rsInterface.anInt258 = (l - 1 << 8) + stream.readUnsignedByte();
                    }
                    else
                    {
                        rsInterface.anInt258 = -1;
                    }
                    rsInterface.anInt269 = stream.readUnsignedWord();
                    rsInterface.anInt270 = stream.readUnsignedWord();
                    rsInterface.anInt271 = stream.readUnsignedWord();
                }
                if (rsInterface.type == 7)
                {
                    rsInterface.inv           = new int[rsInterface.width * rsInterface.height];
                    rsInterface.invStackSizes = new int[rsInterface.width * rsInterface.height];
                    rsInterface.aBoolean223   = stream.readUnsignedByte() == 1;
                    int l2 = stream.readUnsignedByte();
                    if (textDrawingAreas != null)
                    {
                        rsInterface.textDrawingAreas = textDrawingAreas[l2];
                    }
                    rsInterface.aBoolean268          = stream.readUnsignedByte() == 1;
                    rsInterface.textColor            = stream.readDWord();
                    rsInterface.invSpritePadX        = stream.readSignedWord();
                    rsInterface.invSpritePadY        = stream.readSignedWord();
                    rsInterface.isInventoryInterface = stream.readUnsignedByte() == 1;
                    rsInterface.actions = new String[5];
                    for (int k4 = 0; k4 < 5; k4++)
                    {
                        rsInterface.actions[k4] = stream.readString();
                        if (rsInterface.actions[k4].Length == 0)
                        {
                            rsInterface.actions[k4] = null;
                        }
                    }
                }
                if (rsInterface.atActionType == 2 || rsInterface.type == 2)
                {
                    rsInterface.selectedActionName = stream.readString();
                    rsInterface.spellName          = stream.readString();
                    rsInterface.spellUsableOn      = stream.readUnsignedWord();
                }

                if (rsInterface.type == 8)
                {
                    rsInterface.message = stream.readString();
                }

                if (rsInterface.atActionType == 1 || rsInterface.atActionType == 4 || rsInterface.atActionType == 5 || rsInterface.atActionType == 6)
                {
                    rsInterface.tooltip = stream.readString();
                    if (rsInterface.tooltip.Length == 0)
                    {
                        if (rsInterface.atActionType == 1)
                        {
                            rsInterface.tooltip = "Ok";
                        }
                        if (rsInterface.atActionType == 4)
                        {
                            rsInterface.tooltip = "Select";
                        }
                        if (rsInterface.atActionType == 5)
                        {
                            rsInterface.tooltip = "Select";
                        }
                        if (rsInterface.atActionType == 6)
                        {
                            rsInterface.tooltip = "Continue";
                        }
                    }
                }

                //aryan	Bot.notifyInterface(rsInterface);
            }
            interfaceCache[11877] = null;
            interfaceCache[426]   = null;
            interfaceCache[370]   = null;
            interfaceCache[481]   = null;
            interfaceCache[482]   = null;
            aMRUNodes_238         = null;
        }
コード例 #2
0
ファイル: ObjectDef.cs プロジェクト: lackey94/rsunity-1
        private void readValues(Stream buffer)
        {
            int i = -1;

            do
            {
                int opcode;
                //do {
                opcode = buffer.readUnsignedByte();
                if (opcode == 0)
                {
                    goto breaklabel0;
                }
                if (opcode == 1)
                {
                    int k = buffer.readUnsignedByte();
                    if (k > 0)
                    {
                        if (anIntArray773 == null || lowMem)
                        {
                            anIntArray776 = new int[k];
                            anIntArray773 = new int[k];
                            for (int k1 = 0; k1 < k; k1++)
                            {
                                anIntArray773[k1] = buffer.readUnsignedWord();
                                anIntArray776[k1] = buffer.readUnsignedByte();
                            }
                        }
                        else
                        {
                            buffer.currentOffset += k * 3;
                        }
                    }
                }
                else if (opcode == 2)
                {
                    name = buffer.readNewString();
                }
                else if (opcode == 3)
                {
                    description = buffer.readBytes();
                }
                else if (opcode == 5)
                {
                    int l = buffer.readUnsignedByte();
                    if (l > 0)
                    {
                        if (anIntArray773 == null || lowMem)
                        {
                            anIntArray776 = null;
                            anIntArray773 = new int[l];
                            for (int l1 = 0; l1 < l; l1++)
                            {
                                anIntArray773[l1] = buffer.readUnsignedWord();
                            }
                        }
                        else
                        {
                            buffer.currentOffset += l * 2;
                        }
                    }
                }
                else if (opcode == 14)
                {
                    anInt744 = buffer.readUnsignedByte();
                }
                else if (opcode == 15)
                {
                    anInt761 = buffer.readUnsignedByte();
                }
                else if (opcode == 17)
                {
                    aBoolean767 = false;
                }
                else if (opcode == 18)
                {
                    aBoolean757 = false;
                }
                else if (opcode == 19)
                {
                    hasActions = (buffer.readUnsignedByte() == 1);
                    //i = buffer.readUnsignedByte();
                    //if (i == 1)
                    //	hasActions = true;
                }
                else if (opcode == 21)
                {
                    aBoolean762 = true;
                }
                else if (opcode == 22)
                {
                    aBoolean769 = false;                            //
                }
                else if (opcode == 23)
                {
                    aBoolean764 = true;
                }
                else if (opcode == 24)
                {
                    animId = buffer.readUnsignedWord();
                    if (animId == 65535)
                    {
                        animId = -1;
                    }
                }
                else if (opcode == 28)
                {
                    anInt775 = buffer.readUnsignedByte();
                }
                else if (opcode == 29)
                {
                    aByte737 = (byte)buffer.readSignedByte();
                }
                else if (opcode == 39)
                {
                    aByte742 = (byte)buffer.readSignedByte();
                }
                else if (opcode >= 30 && opcode < 39)
                {
                    if (actions == null)
                    {
                        actions = new String[10];
                    }
                    actions[opcode - 30] = buffer.readNewString();
                    if (actions[opcode - 30].ToLower().Equals("hidden"))
                    {
                        actions[opcode - 30] = null;
                    }
                }
                else if (opcode == 40)
                {
                    int i1 = buffer.readUnsignedByte();
                    modifiedModelColors = new int[i1];
                    originalModelColors = new int[i1];
                    for (int i2 = 0; i2 < i1; i2++)
                    {
                        modifiedModelColors[i2] = buffer.readUnsignedWord();
                        originalModelColors[i2] = buffer.readUnsignedWord();
                    }
                }
                else if (opcode == 41)
                {
                    int k = buffer.readUnsignedByte();
                    //retextureSrc = new int[k];
                    //retextureDst = new int[k];
                    for (int k1 = 0; k1 < k; k1++)
                    {
                        /*retextureSrc[k1] = */ buffer.readUnsignedWord();
                        /*retextureDst[k1] = */ buffer.readUnsignedWord();
                    }
                }

                else if (opcode == 60)
                {
                    anInt746 = buffer.readUnsignedWord();
                }
                else if (opcode == 62)
                {
                    aBoolean751 = true;
                }
                else if (opcode == 64)
                {
                    aBoolean779 = false;
                }
                else if (opcode == 65)
                {
                    anInt748 = buffer.readUnsignedWord();
                }
                else if (opcode == 66)
                {
                    anInt772 = buffer.readUnsignedWord();
                }
                else if (opcode == 67)
                {
                    anInt740 = buffer.readUnsignedWord();
                }
                else if (opcode == 68)
                {
                    anInt758 = buffer.readUnsignedWord();
                }
                else if (opcode == 69)
                {
                    anInt768 = buffer.readUnsignedByte();
                }
                else if (opcode == 70)
                {
                    anInt738 = buffer.readSignedWord();
                }
                else if (opcode == 71)
                {
                    anInt745 = buffer.readSignedWord();
                }
                else if (opcode == 72)
                {
                    anInt783 = buffer.readSignedWord();
                }
                else if (opcode == 73)
                {
                    aBoolean736 = true;
                }
                else if (opcode == 74)
                {
                    aBoolean766 = true;
                }
                else if (opcode == 75)
                {
                    anInt760 = buffer.readUnsignedByte();
                }
                else if (opcode == 77)
                {
                    anInt774 = buffer.readUnsignedWord();
                    if (anInt774 == 65535)
                    {
                        anInt774 = -1;
                    }
                    anInt749 = buffer.readUnsignedWord();
                    if (anInt749 == 65535)
                    {
                        anInt749 = -1;
                    }
                    int j1 = buffer.readUnsignedByte();
                    childrenIDs = new int[j1 + 1];
                    for (int j2 = 0; j2 <= j1; j2++)
                    {
                        childrenIDs[j2] = buffer.readUnsignedWord();
                        if (childrenIDs[j2] == 65535)
                        {
                            childrenIDs[j2] = -1;
                        }
                    }
                }
                else if (78 == opcode)
                {
                    /*audioType = */ buffer.readUnsignedWord();
                    /*anInt7406 = */ buffer.readUnsignedByte();
                }
                else if (opcode == 79)
                {
                    /*anInt7409 = */ buffer.readUnsignedWord();
                    /*anInt7410 = */ buffer.readUnsignedWord();
                    /*anInt7406 = */ buffer.readUnsignedByte();
                    int i_36_ = buffer.readUnsignedByte();
                    //audioTracks = new int[i_36_];
                    for (int i_37_ = 0; i_37_ < i_36_; i_37_++)
                    {
                        /*audioTracks[i_37_] = */ buffer.readUnsignedWord();
                    }
                }
                else if (81 == opcode)
                {
                    //aByte7368 = (byte) 2;
                    /*anInt7369 = */ buffer.readUnsignedByte();
                }
//					} else {
//						if (opcode != 75)
//							continue;
//						anInt760 = buffer.readUnsignedByte();
//					}
//					continue;
                //} while (true);
//				anInt774 = buffer.readUnsignedWord();
//				if (anInt774 == 65535)
//					anInt774 = -1;
//				anInt749 = buffer.readUnsignedWord();
//				if (anInt749 == 65535)
//					anInt749 = -1;
//				int j1 = buffer.readUnsignedByte();
//				childrenIDs = new int[j1 + 1];
//				for (int j2 = 0; j2 <= j1; j2++) {
//					childrenIDs[j2] = buffer.readUnsignedWord();
//					if (childrenIDs[j2] == 65535)
//						childrenIDs[j2] = -1;
//				}
            } while (true);
breaklabel0:
            if (i == -1)
            {
                hasActions = anIntArray773 != null && (anIntArray776 == null || anIntArray776[0] == 10);
                if (actions != null)
                {
                    hasActions = true;
                }
            }
            if (aBoolean766)
            {
                aBoolean767 = false;
                aBoolean757 = false;
            }
            if (anInt760 == -1)
            {
                anInt760 = aBoolean767 ? 1 : 0;
            }
        }