anchor.diff:  
     { TDef }
   
  -  TDef = class (IResource)
  -  strict private
  +  TDef = class
  +  private
       FPaletteID: GLuint;
   
  -    typ: UInt32;
  +    //typ: UInt32;
       FWidth: UInt32;
       FHeight: UInt32;
  -    blockCount: UInt32;
  -    palette: TRGBAPalette;
  +
       entries: TDefEntries;
   
       FTexturesBinded: boolean;
   
  -    //FBuffer: packed array of TRBGAColor;
  -    FBuffer: packed array of byte;
  -    procedure ResizeBuffer(w,h: Integer);
  -
       function GetFrameCount: Integer; inline;
   
  -    procedure LoadSprite(AStream: TStream; const SpriteIndex: UInt8; ATextureID: GLuint; offset: Uint32);
       procedure MayBeUnBindTextures; inline;
       procedure UnBindTextures;
  -  private //for internal use
  -     (*H3 def format*)
  -    procedure LoadFromStream(AStream: TStream);
   
     public
       constructor Create;
  
positive.code: 
  end;
  
  procedure TDef.ResizeBuffer(w, h: Integer);
  var
    old_len, new_len: Integer;
  begin
    old_len := Length(FBuffer);
    new_len := h * w;
    new_len := Max(old_len,new_len);
    SetLength(FBuffer, new_len);
  end;
  
  procedure TDef.UnBindTextures;
  var
    SpriteIndex: Integer;
  
negative.code:     constructor Create;
    end;
  
    { TDefFormatLoader }
  
    TDefFormatLoader = class (IResource)
    strict private
      const
        INITIAL_BUFFER_SIZE = 32768;
    strict private
      FBuffer: packed array of byte; //indexed bitmap
      palette: TRGBAPalette;
      procedure IncreaseBuffer(ANewSize: SizeInt);
    private
      FCurrentDef: TDef;
      procedure LoadSprite(AStream: TStream; const SpriteIndex: UInt8; ATextureID: GLuint; offset: Uint32);
      procedure LoadFromStream(AStream: TStream);//IResource
      procedure SetCurrentDef(AValue: TDef);
  
  
    public
      constructor Create;
      destructor Destroy; override;
  
      property CurrentDef: TDef read FCurrentDef write SetCurrentDef;
    end;
  
    { TGraphicsManager }
  
    TGraphicsManager = class (TFSConsumer)
    private
      FNameToDefMap: TDefMap;
      FDefLoader: TDefFormatLoader;
  
      FHeroFlagDefs: array[TPlayerColor] of TDef;
  
  