public static bool LoadConfig() { if (GameGraphics == null) GameGraphics = new GameImage(512, 346, 4000); sbyte[] abyte0 = UnpackData("config.jag", "Configuration", 10); if (abyte0 == null) { // errorLoading = true; return false; } Data.load(abyte0); sbyte[] abyte1 = UnpackData("filter.jag", "Chat system", 15); if (abyte1 == null) { // errorLoading = true; return false; } sbyte[] abyte2 = DataOperations.loadData("fragmentsenc.txt", 0, abyte1); sbyte[] abyte3 = DataOperations.loadData("badenc.txt", 0, abyte1); sbyte[] abyte4 = DataOperations.loadData("hostenc.txt", 0, abyte1); sbyte[] abyte5 = DataOperations.loadData("tldlist.txt", 0, abyte1); //ChatFilter.addFilterData(new DataEncryption(abyte2), new DataEncryption(abyte3), new DataEncryption(abyte4), new DataEncryption(abyte5)); return true; }
public static void load(sbyte[] arg0) { //org.moparscape.msc.client.Data.load(arg0); stringData = DataOperations.loadData("string.dat", 0, arg0); stringDataIndex = 0; integerData = DataOperations.loadData("integer.dat", 0, arg0); integerDataIndex = 0; itemCount = readShort(); itemName = new String[itemCount]; itemDescription = new String[itemCount]; itemCommand = new String[itemCount]; itemInventoryPicture = new int[itemCount]; itemBasePrice = new int[itemCount]; itemStackable = new int[itemCount]; itemUnused = new int[itemCount]; itemIsEquippable = new int[itemCount]; itemPictureMask = new int[itemCount]; itemSpecial = new int[itemCount]; itemMembers = new int[itemCount]; for (int i = 0; i < itemCount; i++) { itemName[i] = readString(); } for (int j = 0; j < itemCount; j++) { itemDescription[j] = readString(); } for (int k = 0; k < itemCount; k++) { itemCommand[k] = readString(); } for (int l = 0; l < itemCount; l++) { itemInventoryPicture[l] = readShort(); if (itemInventoryPicture[l] + 1 > highestLoadedPicture) { highestLoadedPicture = itemInventoryPicture[l] + 1; } } for (int i1 = 0; i1 < itemCount; i1++) { itemBasePrice[i1] = readInt(); } for (int j1 = 0; j1 < itemCount; j1++) { itemStackable[j1] = readByte(); } for (int k1 = 0; k1 < itemCount; k1++) { itemUnused[k1] = readByte(); } for (int l1 = 0; l1 < itemCount; l1++) { itemIsEquippable[l1] = readShort(); } for (int i2 = 0; i2 < itemCount; i2++) { itemPictureMask[i2] = readInt(); } for (int j2 = 0; j2 < itemCount; j2++) { itemSpecial[j2] = readByte(); } for (int k2 = 0; k2 < itemCount; k2++) { itemMembers[k2] = readByte(); } for (int l2 = 0; l2 < itemCount; l2++) { if (/*!Config.MEMBERS_FEATURES && */ false && itemMembers[l2] == 1) { itemName[l2] = "Members object"; itemDescription[l2] = "You need to be a member to use this object"; itemBasePrice[l2] = 0; itemCommand[l2] = ""; itemUnused[0] = 0; itemIsEquippable[l2] = 0; itemSpecial[l2] = 1; } } npcCount = readShort(); npcName = new String[npcCount]; npcDescription = new String[npcCount]; npcCommand = new String[npcCount]; npcAttack = new int[npcCount]; npcStrength = new int[npcCount]; npcHits = new int[npcCount]; npcDefense = new int[npcCount]; npcAttackable = new int[npcCount]; npcAnimationCount = new int[npcCount][]; // 12 for (int j = 0; j < npcCount; j++) { npcAnimationCount[j] = new int[12]; } npcHairColor = new int[npcCount]; npcTopColor = new int[npcCount]; npcBottomColor = new int[npcCount]; npcSkinColor = new int[npcCount]; npcCameraArray1 = new int[npcCount]; npcCameraArray2 = new int[npcCount]; npcWalkModelArray = new int[npcCount]; npcCombatModel = new int[npcCount]; npcCombatSprite = new int[npcCount]; for (int i3 = 0; i3 < npcCount; i3++) { npcName[i3] = readString(); } for (int j3 = 0; j3 < npcCount; j3++) { npcDescription[j3] = readString(); } for (int k3 = 0; k3 < npcCount; k3++) { npcAttack[k3] = readByte(); } for (int l3 = 0; l3 < npcCount; l3++) { npcStrength[l3] = readByte(); } for (int i4 = 0; i4 < npcCount; i4++) { npcHits[i4] = readByte(); } for (int j4 = 0; j4 < npcCount; j4++) { npcDefense[j4] = readByte(); } for (int k4 = 0; k4 < npcCount; k4++) { npcAttackable[k4] = readByte(); } for (int l4 = 0; l4 < npcCount; l4++) { for (int i5 = 0; i5 < 12; i5++) { npcAnimationCount[l4][i5] = readByte(); if (npcAnimationCount[l4][i5] == 255) { npcAnimationCount[l4][i5] = -1; } } } for (int j5 = 0; j5 < npcCount; j5++) { npcHairColor[j5] = readInt(); } for (int k5 = 0; k5 < npcCount; k5++) { npcTopColor[k5] = readInt(); } for (int l5 = 0; l5 < npcCount; l5++) { npcBottomColor[l5] = readInt(); } for (int i6 = 0; i6 < npcCount; i6++) { npcSkinColor[i6] = readInt(); } for (int j6 = 0; j6 < npcCount; j6++) { npcCameraArray1[j6] = readShort(); } for (int k6 = 0; k6 < npcCount; k6++) { npcCameraArray2[k6] = readShort(); } for (int l6 = 0; l6 < npcCount; l6++) { npcWalkModelArray[l6] = readByte(); } for (int i7 = 0; i7 < npcCount; i7++) { npcCombatModel[i7] = readByte(); } for (int j7 = 0; j7 < npcCount; j7++) { npcCombatSprite[j7] = readByte(); } for (int k7 = 0; k7 < npcCount; k7++) { npcCommand[k7] = readString(); } textureCount = readShort(); textureName = new String[textureCount]; textureSubName = new String[textureCount]; for (int l7 = 0; l7 < textureCount; l7++) { textureName[l7] = readString(); } for (int i8 = 0; i8 < textureCount; i8++) { textureSubName[i8] = readString(); } animationCount = readShort(); animationName = new String[animationCount]; animationCharacterColor = new int[animationCount]; animationGenderModels = new int[animationCount]; animationHasA = new int[animationCount]; animationHasF = new int[animationCount]; animationNumber = new int[animationCount]; for (int j8 = 0; j8 < animationCount; j8++) { animationName[j8] = readString(); } for (int k8 = 0; k8 < animationCount; k8++) { animationCharacterColor[k8] = readInt(); } for (int l8 = 0; l8 < animationCount; l8++) { animationGenderModels[l8] = readByte(); } for (int i9 = 0; i9 < animationCount; i9++) { animationHasA[i9] = readByte(); } for (int j9 = 0; j9 < animationCount; j9++) { animationHasF[j9] = readByte(); } for (int k9 = 0; k9 < animationCount; k9++) { animationNumber[k9] = readByte(); } objectCount = readShort(); objectName = new String[objectCount]; objectDescription = new String[objectCount]; objectCommand1 = new String[objectCount]; objectCommand2 = new String[objectCount]; objectModelNumber = new int[objectCount]; objectWidth = new int[objectCount]; objectHeight = new int[objectCount]; objectType = new int[objectCount]; objectGroundItemVar = new int[objectCount]; for (int l9 = 0; l9 < objectCount; l9++) { objectName[l9] = readString(); } for (int i10 = 0; i10 < objectCount; i10++) { objectDescription[i10] = readString(); } for (int j10 = 0; j10 < objectCount; j10++) { objectCommand1[j10] = readString(); } for (int k10 = 0; k10 < objectCount; k10++) { objectCommand2[k10] = readString(); } for (int l10 = 0; l10 < objectCount; l10++) { objectModelNumber[l10] = getModelNameIndex(readString()); } for (int i11 = 0; i11 < objectCount; i11++) { objectWidth[i11] = readByte(); } for (int j11 = 0; j11 < objectCount; j11++) { objectHeight[j11] = readByte(); } for (int k11 = 0; k11 < objectCount; k11++) { objectType[k11] = readByte(); } for (int l11 = 0; l11 < objectCount; l11++) { objectGroundItemVar[l11] = readByte(); } wallObjectCount = readShort(); wallObjectName = new String[wallObjectCount]; wallObjectDescription = new String[wallObjectCount]; wallObjectCommand1 = new String[wallObjectCount]; wallObjectCommand2 = new String[wallObjectCount]; wallObjectModelHeight = new int[wallObjectCount]; wallObjectModel_TextureIndex = new int[wallObjectCount]; wallObjectModel_ColorIndex = new int[wallObjectCount]; wallObjectType = new int[wallObjectCount]; wallObjectUnknown = new int[wallObjectCount]; for (int i12 = 0; i12 < wallObjectCount; i12++) { wallObjectName[i12] = readString(); } for (int j12 = 0; j12 < wallObjectCount; j12++) { wallObjectDescription[j12] = readString(); } for (int k12 = 0; k12 < wallObjectCount; k12++) { wallObjectCommand1[k12] = readString(); } for (int l12 = 0; l12 < wallObjectCount; l12++) { wallObjectCommand2[l12] = readString(); } for (int i13 = 0; i13 < wallObjectCount; i13++) { wallObjectModelHeight[i13] = readShort(); } for (int j13 = 0; j13 < wallObjectCount; j13++) { wallObjectModel_TextureIndex[j13] = readInt(); } for (int k13 = 0; k13 < wallObjectCount; k13++) { wallObjectModel_ColorIndex[k13] = readInt(); } for (int l13 = 0; l13 < wallObjectCount; l13++) { wallObjectType[l13] = readByte(); } for (int i14 = 0; i14 < wallObjectCount; i14++) { wallObjectUnknown[i14] = readByte(); } akd = readShort(); roofs = new int[akd]; aln = new int[akd]; for (int j14 = 0; j14 < akd; j14++) { roofs[j14] = readByte(); } for (int k14 = 0; k14 < akd; k14++) { aln[k14] = readByte(); } /*System.out.println("akd:"); * for(int i = 0; i < akd; i++) { * System.out.println(i + ": " + alm[i] + " " + aln[i]); * }*/ overlayTextureCount = readShort(); TileGroundOverlayTexture = new int[overlayTextureCount]; tileGroundOverlayTypes = new int[overlayTextureCount]; tileWalkable = new int[overlayTextureCount]; for (int l14 = 0; l14 < overlayTextureCount; l14++) { TileGroundOverlayTexture[l14] = readInt(); } for (int i15 = 0; i15 < overlayTextureCount; i15++) { tileGroundOverlayTypes[i15] = readByte(); } for (int j15 = 0; j15 < overlayTextureCount; j15++) { tileWalkable[j15] = readByte(); } /*System.out.println("overlayTextureCount:"); * for(int i = 0; i < overlayTextureCount; i++) { * System.out.println(i + ": " + akg[i] + " " + akh[i] + " " + tileWalkable[i]); * }*/ spellProjectileCount = readShort(); spellCount = readShort(); spellName = new String[spellCount]; spellDescription = new String[spellCount]; spellRequiredLevel = new int[spellCount]; spellDifferentRuneCount = new int[spellCount]; spellType = new int[spellCount]; spelRequiredRuneID = new int[spellCount][]; spellRequiredRuneCount = new int[spellCount][]; for (int k15 = 0; k15 < spellCount; k15++) { spellName[k15] = readString(); } for (int l15 = 0; l15 < spellCount; l15++) { spellDescription[l15] = readString(); } for (int i16 = 0; i16 < spellCount; i16++) { spellRequiredLevel[i16] = readByte(); } for (int j16 = 0; j16 < spellCount; j16++) { spellDifferentRuneCount[j16] = readByte(); } for (int k16 = 0; k16 < spellCount; k16++) { spellType[k16] = readByte(); } for (int l16 = 0; l16 < spellCount; l16++) { int i17 = readByte(); spelRequiredRuneID[l16] = new int[i17]; for (int k17 = 0; k17 < i17; k17++) { spelRequiredRuneID[l16][k17] = readShort(); } } for (int j17 = 0; j17 < spellCount; j17++) { int l17 = readByte(); spellRequiredRuneCount[j17] = new int[l17]; for (int j18 = 0; j18 < l17; j18++) { spellRequiredRuneCount[j17][j18] = readByte(); } } prayerCount = readShort(); prayerName = new String[prayerCount]; prayerDescription = new String[prayerCount]; prayerRequiredLevel = new int[prayerCount]; prayerDrainRate = new int[prayerCount]; for (int i18 = 0; i18 < prayerCount; i18++) { prayerName[i18] = readString(); } for (int k18 = 0; k18 < prayerCount; k18++) { prayerDescription[k18] = readString(); } for (int l18 = 0; l18 < prayerCount; l18++) { prayerRequiredLevel[l18] = readByte(); } for (int i19 = 0; i19 < prayerCount; i19++) { prayerDrainRate[i19] = readByte(); } stringData = null; integerData = null; }
public static bool LoadAnimations() { if (GameGraphics == null) GameGraphics = new GameImage(512, 346, 4000); StringBuilder sb = new StringBuilder(); sbyte[] abyte0 = null; sbyte[] abyte1 = null; abyte0 = UnpackData("entity.jag", "people and monsters", 30); if (abyte0 == null) { return false; } abyte1 = DataOperations.loadData("index.dat", 0, abyte0); sbyte[] abyte2 = null; sbyte[] abyte3 = null; abyte2 = UnpackData("entity.mem", "member graphics", 45); if (abyte2 == null) { return false; } abyte3 = DataOperations.loadData("index.dat", 0, abyte2); int l = 0; var animationNumber = 0; //label0: for (int i1 = 0; i1 < Data.animationCount; i1++) { // label4: bool breakThis = false; String s1 = Data.animationName[i1]; for (int j1 = 0; j1 < i1; j1++) { if (!Data.animationName[j1].ToLower().Equals(s1)) continue; Data.animationNumber[i1] = Data.animationNumber[j1]; // i1++; // goto label0; //break; breakThis = true; break; } if (breakThis) continue; //label4: sbyte[] abyte7 = DataOperations.loadData(s1 + ".dat", 0, abyte0); sbyte[] abyte4 = abyte1; if (abyte7 == null) { abyte7 = DataOperations.loadData(s1 + ".dat", 0, abyte2); abyte4 = abyte3; } if (abyte7 != null) { try { GameGraphics.unpackImageData(animationNumber, abyte7, abyte4, 15); l += 15; if (Data.animationHasA[i1] == 1) { sbyte[] abyte8 = DataOperations.loadData(s1 + "a.dat", 0, abyte0); sbyte[] abyte5 = abyte1; if (abyte8 == null) { abyte8 = DataOperations.loadData(s1 + "a.dat", 0, abyte2); abyte5 = abyte3; } GameGraphics.unpackImageData(animationNumber + 15, abyte8, abyte5, 3); l += 3; } if (Data.animationHasF[i1] == 1) { sbyte[] abyte9 = DataOperations.loadData(s1 + "f.dat", 0, abyte0); sbyte[] abyte6 = abyte1; if (abyte9 == null) { abyte9 = DataOperations.loadData(s1 + "f.dat", 0, abyte2); abyte6 = abyte3; } GameGraphics.unpackImageData(animationNumber + 18, abyte9, abyte6, 9); l += 9; } if (Data.animationGenderModels[i1] != 0) { for (int k1 = animationNumber; k1 < animationNumber + 27; k1++) GameGraphics.loadImage(k1, true); } } catch { } } Data.animationNumber[i1] = animationNumber; animationNumber += 27; sb.AppendLine("Loaded: " + l + " frames of animation"); /* #warning ugly fix for forcing animation count to 1143. if (l == 1143) break; */ endOfLoop: { } } var str = sb.ToString(); Debug.Log("Loaded: " + l + " frames of animation"); return true; }
public static bool LoadMedia() //Sprites { if (GameGraphics == null) GameGraphics = new GameImage(512, 346, 4000); sbyte[] media = UnpackData("media.jag", "2d graphics", 20); if (media == null) { return false; } baseInventoryPic = 2000; baseScrollPic = baseInventoryPic + 100; baseItemPicture = baseScrollPic + 50; baseLoginScreenBackgroundPic = baseItemPicture + 1000; baseProjectilePic = baseLoginScreenBackgroundPic + 10; baseTexturePic = baseProjectilePic + 50; subTexturePic = baseTexturePic + 10; sbyte[] abyte1 = DataOperations.loadData("index.dat", 0, media); GameGraphics.unpackImageData(baseInventoryPic, DataOperations.loadData("inv1.dat", 0, media), abyte1, 1); GameGraphics.unpackImageData(baseInventoryPic + 1, DataOperations.loadData("inv2.dat", 0, media), abyte1, 6); GameGraphics.unpackImageData(baseInventoryPic + 9, DataOperations.loadData("bubble.dat", 0, media), abyte1, 1); GameGraphics.unpackImageData(baseInventoryPic + 10, DataOperations.loadData("runescape.dat", 0, media), abyte1, 1); GameGraphics.unpackImageData(baseInventoryPic + 11, DataOperations.loadData("splat.dat", 0, media), abyte1, 3); GameGraphics.unpackImageData(baseInventoryPic + 14, DataOperations.loadData("icon.dat", 0, media), abyte1, 8); GameGraphics.unpackImageData(baseInventoryPic + 22, DataOperations.loadData("hbar.dat", 0, media), abyte1, 1); GameGraphics.unpackImageData(baseInventoryPic + 23, DataOperations.loadData("hbar2.dat", 0, media), abyte1, 1); GameGraphics.unpackImageData(baseInventoryPic + 24, DataOperations.loadData("compass.dat", 0, media), abyte1, 1); GameGraphics.unpackImageData(baseInventoryPic + 25, DataOperations.loadData("buttons.dat", 0, media), abyte1, 2); GameGraphics.unpackImageData(baseScrollPic, DataOperations.loadData("scrollbar.dat", 0, media), abyte1, 2); GameGraphics.unpackImageData(baseScrollPic + 2, DataOperations.loadData("corners.dat", 0, media), abyte1, 4); GameGraphics.unpackImageData(baseScrollPic + 6, DataOperations.loadData("arrows.dat", 0, media), abyte1, 2); GameGraphics.unpackImageData(baseProjectilePic, DataOperations.loadData("projectile.dat", 0, media), abyte1, Data.spellProjectileCount); int l = Data.highestLoadedPicture; for (int i1 = 1; l > 0; i1++) { int j1 = l; l -= 30; if (j1 > 30) j1 = 30; GameGraphics.unpackImageData(baseItemPicture + (i1 - 1) * 30, DataOperations.loadData("objects" + i1 + ".dat", 0, media), abyte1, j1); } //GameGraphics.UpdateGameImage(); GameGraphics.loadImage(baseInventoryPic); GameGraphics.loadImage(baseInventoryPic + 9); for (int k1 = 10 /*11*/; k1 <= /* 26 */ 2000; k1++) GameGraphics.loadImage(baseInventoryPic + k1); /* for (int l1 = 0; l1 < Data.spellProjectileCount; l1++) GameGraphics.loadImage(baseProjectilePic + l1); for (int i2 = 0; i2 < Data.highestLoadedPicture; i2++) GameGraphics.loadImage(baseProjectilePic + i2); */ return true; }
public static bool LoadTextures() { if (GameGraphics == null) GameGraphics = new GameImage(512, 346, 4000); sbyte[] _textureData = UnpackData("textures.jag", "Textures", 50); if (_textureData == null) { return false; } var baseInventoryPic = 2000; var baseScrollPic = baseInventoryPic + 100; var baseItemPicture = baseScrollPic + 50; var baseLoginScreenBackgroundPic = baseItemPicture + 1000; var baseProjectilePic = baseLoginScreenBackgroundPic + 10; var baseTexturePic = baseProjectilePic + 50; var subTexturePic = baseTexturePic + 10; sbyte[] indexData = DataOperations.loadData("index.dat", 0, _textureData); //gameCamera.CreateTexture(Data.textureCount, 7, 11); for (int l = 0; l < Data.textureCount; l++) { String s1 = Data.textureName[l]; sbyte[] textureData = DataOperations.loadData(s1 + ".dat", 0, _textureData); var texture = TextureManager.CreateTexture(baseTexturePic + l, textureData, indexData, 1); if (l == 8 || l == 16 || l == 33 || l == 34) { // Rotate clockwise.. if (texture != null && texture.Length == 1) { // var t = texture[0]; // TextureBaker baker = new TextureBaker(Game1.DeviceInstance, new Vector2(t.Height, t.Width)); // baker.BakeTexture(t, RotateFlipType.Rotate90FlipNone); // texture[0] = baker.GetTexture(); texture[0] = TextureManager.Rotate(texture[0], RotateFlipType.Rotate270FlipNone); texture[0] = TextureManager.Rotate(texture[0], RotateFlipType.Rotate180FlipNone); } } String s2 = Data.textureSubName[l]; if (string.IsNullOrEmpty(s2)) { if (texture != null && texture.Length > 0) { for (var j = 0; j < texture.Length; j++) { //var bakerman = new TextureBaker(Game1.DeviceInstance, new Vector2(texture[j].Height, texture[j].Width)); //bakerman.BakeTexture(texture[j], RotateFlipType.Rotate270FlipNone); //texture[j] = bakerman.GetTexture(); /* using (var stream = System.IO.File.Create("c:/jpg/" + (subTexturePic + l) + ".png")) { texture[j].SaveAsPng(stream, texture[j].Width, texture[j].Height); } */ texture[j] = TextureManager.Rotate(texture[j], RotateFlipType.Rotate270FlipNone); texture[j] = TextureManager.Rotate(texture[j], RotateFlipType.Rotate180FlipNone); TextureManager.Textures.Add(new TextureData((subTexturePic + l/*textureIndex*/), texture[j])); } } } if (!string.IsNullOrEmpty(s2)) { Texture2D backTexture = null; if (texture != null && texture.Any()) { backTexture = texture[0]; } sbyte[] subTextureData = DataOperations.loadData(s2 + ".dat", 0, _textureData); var subTexture = TextureManager.CreateTexture(baseTexturePic, subTextureData, indexData, 1, backTexture /*null*/); if (subTexture != null && subTexture.Length > 0) { foreach (var t in subTexture) { /* using (var stream = System.IO.File.Create("c:/jpg/" + (subTexturePic + l) + ".png")) { t.SaveAsPng(stream, t.Width, t.Height); } * */ var t2 = TextureManager.Rotate(t, RotateFlipType.Rotate180FlipNone); TextureManager.Textures.Add(new TextureData((subTexturePic /*baseTexturePic*/+ l /*textureIndex*/), t2)); } } // gameGraphics.unpackImageData(baseTexturePic, abyte3, abyte1, 1); // gameGraphics.drawPicture(0, 0, baseTexturePic); } } TextureManager.GenerateTextureAtlas(); return true; }