package mapped;

import java.util.HashMap;
import java.util.Map;
import net.runelite.mapping.ObfuscatedGetter;
import net.runelite.mapping.ObfuscatedName;
import net.runelite.mapping.ObfuscatedSignature;
import net.runelite.rs.api.RSFrames;
import net.runelite.rs.api.RSModel;
import net.runelite.rs.api.RSSequenceDefinition;

@ObfuscatedName("hx")
public class SequenceDefinition extends DualNode implements RSSequenceDefinition {
   @ObfuscatedName("at")
   static boolean field2206;
   @ObfuscatedName("au")
   @ObfuscatedSignature(
      descriptor = "Lol;"
   )
   public static AbstractArchive SequenceDefinition_animationsArchive;
   @ObfuscatedName("aa")
   @ObfuscatedSignature(
      descriptor = "Lol;"
   )
   public static AbstractArchive SequenceDefinition_skeletonsArchive;
   @ObfuscatedName("ac")
   @ObfuscatedSignature(
      descriptor = "Llk;"
   )
   public static EvictingDualNodeHashTable SequenceDefinition_cached;
   @ObfuscatedName("al")
   @ObfuscatedSignature(
      descriptor = "Llk;"
   )
   public static EvictingDualNodeHashTable SequenceDefinition_cachedFrames;
   @ObfuscatedName("az")
   @ObfuscatedSignature(
      descriptor = "Llk;"
   )
   public static EvictingDualNodeHashTable SequenceDefinition_cachedModel;
   @ObfuscatedName("ap")
   @ObfuscatedGetter(
      intValue = -569745451
   )
   public int SequenceDefinition_cachedModelId;
   @ObfuscatedName("av")
   public Map field2212;
   @ObfuscatedName("ax")
   @ObfuscatedGetter(
      intValue = -843852473
   )
   int field2213;
   @ObfuscatedName("as")
   @ObfuscatedGetter(
      intValue = 1032248213
   )
   int field2219;
   @ObfuscatedName("ay")
   public int[] frameIds;
   @ObfuscatedName("ak")
   int[] chatFrameIds;
   @ObfuscatedName("aj")
   public int[] frameLengths;
   @ObfuscatedName("am")
   public int[] soundEffects;
   @ObfuscatedName("aq")
   @ObfuscatedGetter(
      intValue = -1433820539
   )
   public int frameCount;
   @ObfuscatedName("ai")
   int[] field2220;
   @ObfuscatedName("aw")
   boolean[] field2221;
   @ObfuscatedName("ae")
   public boolean field2224;
   @ObfuscatedName("an")
   @ObfuscatedGetter(
      intValue = 1596578627
   )
   public int field2223;
   @ObfuscatedName("ag")
   @ObfuscatedGetter(
      intValue = -1008837529
   )
   public int shield;
   @ObfuscatedName("ad")
   @ObfuscatedGetter(
      intValue = 640845315
   )
   public int weapon;
   @ObfuscatedName("af")
   @ObfuscatedGetter(
      intValue = -893117653
   )
   public int field2211;
   @ObfuscatedName("be")
   public boolean field2210;
   @ObfuscatedName("bd")
   @ObfuscatedGetter(
      intValue = -595997513
   )
   public int field2218;
   @ObfuscatedName("bl")
   @ObfuscatedGetter(
      intValue = 1548671259
   )
   public int field2205;
   @ObfuscatedName("bi")
   @ObfuscatedGetter(
      intValue = -1712808465
   )
   public int restartMode;
   @ObfuscatedName("id")
   public int field2232;

   static {
      field2206 = false;
      SequenceDefinition_cached = new EvictingDualNodeHashTable(64);
      SequenceDefinition_cachedFrames = new EvictingDualNodeHashTable(100);
      SequenceDefinition_cachedModel = new EvictingDualNodeHashTable(100);
   }

   SequenceDefinition() {
      this.SequenceDefinition_cachedModelId = -1;
      this.field2213 = 0;
      this.field2219 = 0;
      this.frameCount = -1;
      this.field2224 = false;
      this.field2223 = 5;
      this.shield = -1;
      this.weapon = -1;
      this.field2211 = 99;
      this.field2210 = false;
      this.field2218 = -1;
      this.field2205 = -1;
      this.restartMode = 2;
   }

   @ObfuscatedName("ah")
   @ObfuscatedSignature(
      descriptor = "(Luj;I)V",
      garbageValue = "724172563"
   )
   void method4039(Buffer var1) {
      while(true) {
         int var2 = var1.readUnsignedByte_base();
         if(var2 == 0) {
            return;
         }

         this.method4040(var1, var2);
      }
   }

   @ObfuscatedName("ar")
   @ObfuscatedSignature(
      descriptor = "(Luj;II)V",
      garbageValue = "-848433725"
   )
   void method4040(Buffer var1, int var2) {
      int var3;
      int var4;
      if(var2 == 1) {
         var3 = var1.readUnsignedShort_base();
         this.frameLengths = new int[var3];

         for(var4 = 0; var4 < var3; ++var4) {
            this.frameLengths[var4] = var1.readUnsignedShort_base();
         }

         this.frameIds = new int[var3];

         for(var4 = 0; var4 < var3; ++var4) {
            this.frameIds[var4] = var1.readUnsignedShort_base();
         }

         for(var4 = 0; var4 < var3; ++var4) {
            this.frameIds[var4] += var1.readUnsignedShort_base() << 16;
         }
      } else if(var2 == 2) {
         this.frameCount = var1.readUnsignedShort_base();
      } else if(var2 == 3) {
         var3 = var1.readUnsignedByte_base();
         this.field2220 = new int[var3 + 1];

         for(var4 = 0; var4 < var3; ++var4) {
            this.field2220[var4] = var1.readUnsignedByte_base();
         }

         this.field2220[var3] = 9999999;
      } else if(var2 == 4) {
         this.field2224 = true;
      } else if(var2 == 5) {
         this.field2223 = var1.readUnsignedByte_base();
      } else if(var2 == 6) {
         this.shield = var1.readUnsignedShort_base();
      } else if(var2 == 7) {
         this.weapon = var1.readUnsignedShort_base();
      } else if(var2 == 8) {
         this.field2211 = var1.readUnsignedByte_base();
         this.field2210 = true;
      } else if(var2 == 9) {
         this.field2218 = var1.readUnsignedByte_base();
      } else if(var2 == 10) {
         this.field2205 = var1.readUnsignedByte_base();
      } else if(var2 == 11) {
         this.restartMode = var1.readUnsignedByte_base();
      } else if(var2 == 12) {
         var3 = var1.readUnsignedByte_base();
         this.chatFrameIds = new int[var3];

         for(var4 = 0; var4 < var3; ++var4) {
            this.chatFrameIds[var4] = var1.readUnsignedShort_base();
         }

         for(var4 = 0; var4 < var3; ++var4) {
            this.chatFrameIds[var4] += var1.readUnsignedShort_base() << 16;
         }
      } else if(var2 == 13) {
         var3 = var1.readUnsignedByte_base();
         this.soundEffects = new int[var3];

         for(var4 = 0; var4 < var3; ++var4) {
            this.soundEffects[var4] = var1.readUnsignedMedium_base();
         }
      } else if(var2 == 14) {
         this.SequenceDefinition_cachedModelId = var1.readInt_base();
      } else if(var2 == 15) {
         var3 = var1.readUnsignedShort_base();
         this.field2212 = new HashMap();

         for(var4 = 0; var4 < var3; ++var4) {
            int var5 = var1.readUnsignedShort_base();
            int var6 = var1.readUnsignedMedium_base();
            this.field2212.put(Integer.valueOf(var5), Integer.valueOf(var6));
         }
      } else if(var2 == 16) {
         this.field2213 = var1.readUnsignedShort_base();
         this.field2219 = var1.readUnsignedShort_base();
      } else if(var2 == 17) {
         this.field2221 = new boolean[256];

         for(var3 = 0; var3 < this.field2221.length; ++var3) {
            this.field2221[var3] = false;
         }

         var3 = var1.readUnsignedByte_base();

         for(var4 = 0; var4 < var3; ++var4) {
            this.field2221[var1.readUnsignedByte_base()] = true;
         }
      }

   }

   @ObfuscatedName("ao")
   @ObfuscatedSignature(
      descriptor = "(B)V",
      garbageValue = "-73"
   )
   void postDecode_base() {
      if(this.field2218 == -1) {
         if(this.field2220 == null && this.field2221 == null) {
            this.field2218 = 0;
         } else {
            this.field2218 = 2;
         }
      }

      if(this.field2205 == -1) {
         if(this.field2220 == null && this.field2221 == null) {
            this.field2205 = 0;
         } else {
            this.field2205 = 2;
         }
      }

   }

   @ObfuscatedName("ab")
   @ObfuscatedSignature(
      descriptor = "(Lka;IB)Lka;",
      garbageValue = "52"
   )
   public Model method4042(Model var1, int var2) {
      if(var2 >= 0 || isCachedModelIdSet()) {
         if (var2 < 0)
         {
            int packed = var2 ^ Integer.MIN_VALUE;
            var2 = packed & 0xFFFF;
         }

         return (Model)this.copy$transformActorModel(var1, var2, (byte)61);
      } else {
         int var3 = var2 ^ Integer.MIN_VALUE;
         int var4 = var3 >> 16;
         var2 = var3 & 65535;
         int var5 = var2 + 1;
         if(var5 >= this.getFrameIDs().length) {
            var5 = -1;
         }

         int[] var6 = this.getFrameIDs();
         int var7 = var6[var2];
         RSFrames var8 = SpriteMask.client.getFrames(var7 >> 16);
         int var9 = var7 & 65535;
         int var10 = -1;
         RSFrames var11 = null;
         if(var5 != -1) {
            int var12 = var6[var5];
            var11 = SpriteMask.client.getFrames(var12 >> 16);
            var10 = var12 & 65535;
         }

         if(var8 == null) {
            return (Model)var1.toSharedModel(true);
         } else {
            RSModel var13 = var1.toSharedModel(!var8.getFrames()[var9].isShowing());
            var13.interpolateFrames(var8, var9, var11, var10, var4, this.getFrameLengths()[var2]);
            return (Model)var13;
         }
      }
   }

   @ObfuscatedName("au")
   @ObfuscatedSignature(
      descriptor = "(Lka;III)Lka;",
      garbageValue = "-1872374798"
   )
   Model method4044(Model var1, int var2, int var3) {
      if(var2 >= 0 || isCachedModelIdSet()) {
         if (var2 < 0)
         {
            int packed = var2 ^ Integer.MIN_VALUE;
            var2 = packed & 0xFFFF;
         }

         return (Model)this.copy$transformObjectModel(var1, var2, var3, -1872374798);
      } else {
         int var4 = var2 ^ Integer.MIN_VALUE;
         int var5 = var4 >> 16;
         var2 = var4 & 65535;
         int var6 = var2 + 1;
         if(var6 >= this.getFrameIDs().length) {
            var6 = -1;
         }

         int[] var7 = this.getFrameIDs();
         int var8 = var7[var2];
         RSFrames var9 = SpriteMask.client.getFrames(var8 >> 16);
         int var10 = var8 & 65535;
         int var11 = -1;
         RSFrames var12 = null;
         if(var6 != -1) {
            int var13 = var7[var6];
            var12 = SpriteMask.client.getFrames(var13 >> 16);
            var11 = var13 & 65535;
         }

         if(var9 == null) {
            return (Model)var1.toSharedModel(true);
         } else {
            RSModel var14 = var1.toSharedModel(!var9.getFrames()[var10].isShowing());
            var3 &= 3;
            if(var3 == 1) {
               var14.rs$rotateY270Ccw();
            } else if(var3 == 2) {
               var14.rs$rotateY180Ccw();
            } else if(var3 == 3) {
               var14.rs$rotateY90Ccw();
            }

            var14.interpolateFrames(var9, var10, var12, var11, var5, this.getFrameLengths()[var2]);
            if(var3 == 1) {
               var14.rs$rotateY90Ccw();
            } else if(var3 == 2) {
               var14.rs$rotateY180Ccw();
            } else if(var3 == 3) {
               var14.rs$rotateY270Ccw();
            }

            return (Model)var14;
         }
      }
   }

   @ObfuscatedName("aa")
   @ObfuscatedSignature(
      descriptor = "(Lka;IB)Lka;",
      garbageValue = "55"
   )
   Model method4049(Model var1, int var2) {
      if(var2 >= 0 || isCachedModelIdSet()) {
         if (var2 < 0)
         {
            int packed = var2 ^ Integer.MIN_VALUE;
            var2 = packed & 0xFFFF;
         }

         return (Model)this.copy$transformSpotAnimationModel(var1, var2, (byte)55);
      } else {
         int var3 = var2 ^ Integer.MIN_VALUE;
         int var4 = var3 >> 16;
         var2 = var3 & 65535;
         int var5 = var2 + 1;
         if(var5 >= this.getFrameIDs().length) {
            var5 = -1;
         }

         int[] var6 = this.getFrameIDs();
         int var7 = var6[var2];
         RSFrames var8 = SpriteMask.client.getFrames(var7 >> 16);
         int var9 = var7 & 65535;
         int var10 = -1;
         RSFrames var11 = null;
         if(var5 != -1) {
            int var12 = var6[var5];
            var11 = SpriteMask.client.getFrames(var12 >> 16);
            var10 = var12 & 65535;
         }

         if(var8 == null) {
            return (Model)var1.toSharedSpotAnimModel(true);
         } else {
            RSModel var13 = var1.toSharedSpotAnimModel(!var8.getFrames()[var9].isShowing());
            var13.interpolateFrames(var8, var9, var11, var10, var4, this.getFrameLengths()[var2]);
            return (Model)var13;
         }
      }
   }

   @ObfuscatedName("ac")
   @ObfuscatedSignature(
      descriptor = "(Lka;ILhx;IB)Lka;",
      garbageValue = "-75"
   )
   public Model method4045(Model var1, int var2, SequenceDefinition var3, int var4) {
      int var5;
      if(var2 < 0) {
         var5 = var2 ^ Integer.MIN_VALUE;
         var2 = var5 & 65535;
      }

      if(var4 < 0) {
         var5 = var4 ^ Integer.MIN_VALUE;
         var4 = var5 & 65535;
      }

      return (Model)this.copy$applyTransformations(var1, var2, var3, var4, (byte)-75);
   }

   @ObfuscatedName("al")
   @ObfuscatedSignature(
      descriptor = "(Lka;ILhx;II)Lka;",
      garbageValue = "1735546670"
   )
   Model method4074(Model var1, int var2, SequenceDefinition var3, int var4) {
      var2 = this.frameIds[var2];
      Frames var5 = class102.method2746(var2 >> 16);
      var2 &= 65535;
      if(var5 == null) {
         return var3.method4042(var1, var4);
      } else {
         var4 = var3.frameIds[var4];
         Frames var6 = class102.method2746(var4 >> 16);
         var4 &= 65535;
         Model var7;
         if(var6 == null) {
            var7 = var1.method5563(!var5.hasAlphaTransform_base(var2));
            var7.method5571(var5, var2);
            return var7;
         } else {
            var7 = var1.method5563(!var5.hasAlphaTransform_base(var2) & !var6.hasAlphaTransform_base(var4));
            var7.method5629(var5, var2, var6, var4, this.field2220);
            return var7;
         }
      }
   }

   @ObfuscatedName("az")
   @ObfuscatedSignature(
      descriptor = "(Lka;II)Lka;",
      garbageValue = "1947242189"
   )
   public Model method4041(Model var1, int var2) {
      if(var2 >= 0) {
         return (Model)this.copy$transformWidgetModel(var1, var2, 1947242189);
      } else {
         int var3 = var2 ^ Integer.MIN_VALUE;
         int var4 = var3 >> 16;
         var2 = var3 & 65535;
         int var5 = var2 + 1;
         if(var5 >= this.getFrameIDs().length) {
            var5 = -1;
         }

         int[] var6 = this.getFrameIDs();
         int var7 = var6[var2];
         RSFrames var8 = SpriteMask.client.getFrames(var7 >> 16);
         int var9 = var7 & 65535;
         int var10 = -1;
         RSFrames var11 = null;
         if(var5 != -1) {
            int var12 = var6[var5];
            var11 = SpriteMask.client.getFrames(var12 >> 16);
            var10 = var12 & 65535;
         }

         if(var8 == null) {
            return (Model)var1.toSharedModel(true);
         } else {
            RSFrames var17 = null;
            int var13 = 0;
            if(this.getChatFrameIds() != null && var2 < this.getChatFrameIds().length) {
               int var14 = this.getChatFrameIds()[var2];
               var17 = SpriteMask.client.getFrames(var14 >> 16);
               var13 = var14 & 65535;
            }

            if(var17 != null && var13 != 65535) {
               RSFrames var20 = null;
               int var15 = -1;
               if(var5 != -1 && var5 < this.getChatFrameIds().length) {
                  int var16 = this.getChatFrameIds()[var5];
                  var20 = SpriteMask.client.getFrames(var16 >> 16);
                  var15 = var16 & 65535;
               }

               if(var15 == 65535) {
                  var20 = null;
               }

               RSModel var19 = var1.toSharedModel(!var8.getFrames()[var9].isShowing() & !var17.getFrames()[var13].isShowing());
               var19.interpolateFrames(var8, var9, var11, var10, var4, this.getFrameLengths()[var2]);
               var19.interpolateFrames(var17, var13, var20, var15, var4, this.getFrameLengths()[var2]);
               return (Model)var19;
            } else {
               RSModel var18 = var1.toSharedModel(!var8.getFrames()[var9].isShowing());
               var18.interpolateFrames(var8, var9, var11, var10, var4, this.getFrameLengths()[var2]);
               return (Model)var18;
            }
         }
      }
   }

   @ObfuscatedName("ap")
   @ObfuscatedSignature(
      descriptor = "(I)Z",
      garbageValue = "-2015458472"
   )
   public boolean isCachedModelIdSet_base() {
      return this.SequenceDefinition_cachedModelId >= 0;
   }

   @ObfuscatedName("av")
   @ObfuscatedSignature(
      descriptor = "(I)I",
      garbageValue = "759292138"
   )
   public int method4064_base() {
      return this.field2219 - this.field2213;
   }

   @ObfuscatedName("ay")
   @ObfuscatedSignature(
      descriptor = "(B)Lfo;",
      garbageValue = "52"
   )
   class139 method4061_base() {
      return this.isCachedModelIdSet_base()?class151.method3292_base(this.SequenceDefinition_cachedModelId):null;
   }

   public int[] getFrameLengths() {
      return this.frameLengths;
   }

   @ObfuscatedSignature(
      descriptor = "(Lka;III)Lka;",
      garbageValue = "-1872374798"
   )
   public Model copy$transformObjectModel(Model var1, int var2, int var3, int var4) {
      Model var6;
      if(!this.isCachedModelIdSet_base()) {
         var2 = this.frameIds[var2];
         Frames var7 = class102.method2746(var2 >> 16);
         var2 &= 65535;
         if(var7 == null) {
            return var1.method5563(true);
         } else {
            var6 = var1.method5563(!var7.hasAlphaTransform_base(var2));
            var3 &= 3;
            if(var3 == 1) {
               var6.rotateY270Ccw_base();
            } else if(var3 == 2) {
               var6.rotateY180_base();
            } else if(var3 == 3) {
               var6.rotateY90Ccw_base();
            }

            var6.method5571(var7, var2);
            if(var3 == 1) {
               var6.rotateY90Ccw_base();
            } else if(var3 == 2) {
               var6.rotateY180_base();
            } else if(var3 == 3) {
               var6.rotateY270Ccw_base();
            }

            return var6;
         }
      } else {
         class139 var5 = class151.method3292_base(this.SequenceDefinition_cachedModelId);
         if(var5 == null) {
            return var1.method5563(true);
         } else {
            var6 = var1.method5563(!var5.method3187_base());
            var3 &= 3;
            if(var3 == 1) {
               var6.rotateY270Ccw_base();
            } else if(var3 == 2) {
               var6.rotateY180_base();
            } else if(var3 == 3) {
               var6.rotateY90Ccw_base();
            }

            var6.method5572_base(var5, var2);
            if(var3 == 1) {
               var6.rotateY90Ccw_base();
            } else if(var3 == 2) {
               var6.rotateY180_base();
            } else if(var3 == 3) {
               var6.rotateY270Ccw_base();
            }

            return var6;
         }
      }
   }

   @ObfuscatedSignature(
      descriptor = "(Lka;II)Lka;",
      garbageValue = "1947242189"
   )
   public Model copy$transformWidgetModel(Model var1, int var2, int var3) {
      if(!this.isCachedModelIdSet_base()) {
         int var4 = this.frameIds[var2];
         Frames var5 = class102.method2746(var4 >> 16);
         var4 &= 65535;
         if(var5 == null) {
            return var1.method5563(true);
         } else {
            Frames var6 = null;
            int var7 = 0;
            if(this.chatFrameIds != null && var2 < this.chatFrameIds.length) {
               var7 = this.chatFrameIds[var2];
               var6 = class102.method2746(var7 >> 16);
               var7 &= 65535;
            }

            Model var8;
            if(var6 != null && var7 != 65535) {
               var8 = var1.method5563(!var5.hasAlphaTransform_base(var4) & !var6.hasAlphaTransform_base(var7));
               var8.method5571(var5, var4);
               var8.method5571(var6, var7);
               return var8;
            } else {
               var8 = var1.method5563(!var5.hasAlphaTransform_base(var4));
               var8.method5571(var5, var4);
               return var8;
            }
         }
      } else {
         return this.method4042(var1, var2);
      }
   }

   @ObfuscatedSignature(
      descriptor = "(Lka;IB)Lka;",
      garbageValue = "55"
   )
   public Model copy$transformSpotAnimationModel(Model var1, int var2, byte var3) {
      Model var5;
      if(!this.isCachedModelIdSet_base()) {
         var2 = this.frameIds[var2];
         Frames var6 = class102.method2746(var2 >> 16);
         var2 &= 65535;
         if(var6 == null) {
            return var1.method5636(true);
         } else {
            var5 = var1.method5636(!var6.hasAlphaTransform_base(var2));
            var5.method5571(var6, var2);
            return var5;
         }
      } else {
         class139 var4 = class151.method3292_base(this.SequenceDefinition_cachedModelId);
         if(var4 == null) {
            return var1.method5636(true);
         } else {
            var5 = var1.method5636(!var4.method3187_base());
            var5.method5572_base(var4, var2);
            return var5;
         }
      }
   }

   @ObfuscatedSignature(
      descriptor = "(Lka;IB)Lka;",
      garbageValue = "61"
   )
   public Model copy$transformActorModel(Model var1, int var2, byte var3) {
      Model var5;
      if(!this.isCachedModelIdSet_base()) {
         var2 = this.frameIds[var2];
         Frames var6 = class102.method2746(var2 >> 16);
         var2 &= 65535;
         if(var6 == null) {
            return var1.method5563(true);
         } else {
            var5 = var1.method5563(!var6.hasAlphaTransform_base(var2));
            var5.method5571(var6, var2);
            return var5;
         }
      } else {
         class139 var4 = class151.method3292_base(this.SequenceDefinition_cachedModelId);
         if(var4 == null) {
            return var1.method5563(true);
         } else {
            var5 = var1.method5563(!var4.method3187_base());
            var5.method5572_base(var4, var2);
            return var5;
         }
      }
   }

   @ObfuscatedSignature(
      descriptor = "(Lka;ILhx;IB)Lka;",
      garbageValue = "-75"
   )
   public Model copy$applyTransformations(Model var1, int var2, SequenceDefinition var3, int var4, byte var5) {
      if(field2206 && !this.isCachedModelIdSet_base() && !var3.isCachedModelIdSet_base()) {
         return this.method4074(var1, var2, var3, var4);
      } else {
         Model var6 = var1.method5563(false);
         boolean var7 = false;
         Frames var8 = null;
         Skeleton var9 = null;
         class139 var10;
         if(this.isCachedModelIdSet_base()) {
            var10 = this.method4061_base();
            if(var10 == null) {
               return var6;
            }

            if(var3.isCachedModelIdSet_base() && this.field2221 == null) {
               var6.method5572_base(var10, var2);
               return var6;
            }

            var9 = var10.field1600;
            var6.method5576(var9, var10, var2, this.field2221, false, !var3.isCachedModelIdSet_base());
         } else {
            var2 = this.frameIds[var2];
            var8 = class102.method2746(var2 >> 16);
            var2 &= 65535;
            if(var8 == null) {
               return var3.method4042(var1, var4);
            }

            if(!var3.isCachedModelIdSet_base() && (this.field2220 == null || var4 == -1)) {
               var6.method5571(var8, var2);
               return var6;
            }

            if(this.field2220 == null || var4 == -1) {
               var6.method5571(var8, var2);
               return var6;
            }

            var7 = var3.isCachedModelIdSet_base();
            if(!var7) {
               var6.method5577(var8, var2, this.field2220, false);
            }
         }

         if(var3.isCachedModelIdSet_base()) {
            var10 = var3.method4061_base();
            if(var10 == null) {
               return var6;
            }

            if(var9 == null) {
               var9 = var10.field1600;
            }

            var6.method5576(var9, var10, var4, this.field2221, true, true);
         } else {
            var4 = var3.frameIds[var4];
            Frames var11 = class102.method2746(var4 >> 16);
            var4 &= 65535;
            if(var11 == null) {
               return this.method4042(var1, var2);
            }

            var6.method5577(var11, var4, this.field2220, true);
         }

         if(var7 && var8 != null) {
            var6.method5577(var8, var2, this.field2220, false);
         }

         var6.resetBounds_base();
         return var6;
      }
   }

   public int[] getFrameIDs() {
      return this.frameIds;
   }

   public int[] getChatFrameIds() {
      return this.chatFrameIds;
   }

   public int getId() {
      return this.field2232;
   }

   public void setId(int var1) {
      this.field2232 = var1;
   }

   public int getNumFrames() {
      return this.getFrameLengths().length;
   }

   public int getFrameCount() {
      return this.frameCount;
   }

   public int getRestartMode() {
      return this.restartMode;
   }

   public void setRestartMode(int var1) {
      this.restartMode = var1;
   }

   public RSModel transformSpotAnimationModel(RSModel var1, int var2) {
      return this.method4049((Model)var1, var2);
   }

   public boolean isCachedModelIdSet() {
      return this.isCachedModelIdSet_base();
   }

   @ObfuscatedName("at")
   @ObfuscatedSignature(
      descriptor = "(II)I",
      garbageValue = "-139033810"
   )
   public static int method4092_base(int var0) {
      return var0 >>> 12;
   }

   @ObfuscatedName("at")
   @ObfuscatedSignature(
      descriptor = "(IIB)I",
      garbageValue = "67"
   )
   public static int method4094_base(int var0, int var1) {
      return (int)(Math.atan2((double)var0, (double)var1) * 325.94932345220167D) & 2047;
   }

   @ObfuscatedName("bv")
   @ObfuscatedSignature(
      descriptor = "(ILdt;ZI)I",
      garbageValue = "2048798044"
   )
   static int method4096(int var0, Script var1, boolean var2) {
      return 2;
   }

   @ObfuscatedName("hu")
   @ObfuscatedSignature(
      descriptor = "(IZZZZZI)Loh;",
      garbageValue = "550564154"
   )
   static Archive method4093(int var0, boolean var1, boolean var2, boolean var3, boolean var4, boolean var5) {
      ArchiveDisk var6 = null;
      if(JagexCache.JagexCache_dat2File != null) {
         var6 = new ArchiveDisk(var0, JagexCache.JagexCache_dat2File, KeyHandler.JagexCache_idxFiles[var0], 1000000);
      }

      return new Archive(var6, class302.masterDisk, WorldMapSectionType.field2556, var0, var1, var2, var3, var4, var5);
   }

   @ObfuscatedSignature(
      descriptor = "(II)Lhx;",
      garbageValue = "-1047374686"
   )
   public static SequenceDefinition copy$SequenceDefinition_get(int var0, int var1) {
      SequenceDefinition var2 = (SequenceDefinition)SequenceDefinition_cached.get((long)var0);
      if(var2 != null) {
         return var2;
      } else {
         byte[] var3 = class369.SequenceDefinition_archive.takeFile_base(12, var0);
         var2 = new SequenceDefinition();
         if(var3 != null) {
            var2.method4039(new Buffer(var3));
         }

         var2.postDecode_base();
         SequenceDefinition_cached.put(var2, (long)var0);
         return var2;
      }
   }
}
