This file is indexed.

/usr/share/ecere/extras/tiles/sprite.ec is in ecere-extras 0.44.15-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
/****************************************************************************
   ECERE Tile Engine

   Copyright (c) 1997-2005 Jerome Jacovella-St-Louis
   All Rights Reserved.

   sprite.ec - Bitmap Sprite System
****************************************************************************/
import "ecere"

struct SpriteFrame
{
   byte xDis, yDis;
   Bitmap bitmap;
};

class Sprite
{
   byte numFrames;
   uint16 maxWidth,maxHeight;
   SpriteFrame *frames;

   ~Sprite()
   {
      Free();
   }

   void Free()
   {
      int c;
      if(frames)
      {
         for(c=0; c<numFrames; c++)
            delete frames[c].bitmap;
         delete frames;
      }
   }

   bool Load(const char *bmpname, const char *sizefile, bool trans, bool usePaletteShades, ColorAlpha * palette, DisplaySystem displaySystem)
   {
      bool result = false;
      File f = FileOpen(sizefile, read);
      if(f)
      {
         Bitmap bmpFrames {};
         if(bmpFrames.Load(bmpname, null, null))
         {
            f.Getc((char *)&numFrames);
            f.Read(&maxWidth,  sizeof(uint16),1);
            f.Read(&maxHeight, sizeof(uint16),1);
            frames = new0 SpriteFrame[numFrames];
            if(frames)
            {
               uint startY=0;
               int c;
               result = true;
               for(c=0; c<numFrames; c++)
               {
                  byte width,height;
                  f.Getc((char *)&width);
                  f.Getc((char *)&height);
                  f.Getc((char *)&frames[c].xDis);
                  f.Getc((char *)&frames[c].yDis);

                  frames[c].bitmap = Bitmap {};
                  if(frames[c].bitmap.Allocate(null, width,height,0,bmpFrames.pixelFormat, false))
                  {
                     frames[c].bitmap.transparent = trans;
                     frames[c].bitmap.Grab(bmpFrames,0,startY);

                     frames[c].bitmap.palette = palette;
                     if(!usePaletteShades)
                     {
                        if(displaySystem)
                           frames[c].bitmap.MakeDD(displaySystem);
                        if(!frames[c].bitmap)
                           Logf("Couldn't adapt bitmap %s.\n", bmpname);
                     }
                     startY+=height;
                  }
                  else
                  {
                     delete frames[c].bitmap;
                     result = false;
                     Logf("Couldn't allocate bitmap loading sprite %s.\n", bmpname);
                     break;
                  }
               }
            }
            else
               Logf("Couldn't allocate frames for sprite %s.\n", bmpname);
         }
         else
            Logf("Couldn't load sprite bitmap %s.\n", bmpname);

         delete bmpFrames;
         delete f;
         if(!result)
            Free();
      }
      else
         Logf("Couldn't load sprite info %s.\n", sizefile);
      return result;
   }

   void DisplayFrame(Surface surface, int frameNum, int x, int y, bool flip, byte * inPal)
   {
      SpriteFrame * frame;
      int dx,dy;
      int lx = 0,ly = 0;
      int rx, ry;

      if(!frames) return;

      frame = &frames[frameNum];
      if(!frame) return;
      rx=frame->bitmap.width;
      ry=frame->bitmap.height;
      if(flip)
      {
         dx = x-(frame->xDis+frame->bitmap.width)+maxWidth;
         dy = y+frame->yDis;
      }
      else
      {
         dx = x+frame->xDis;
         dy = y+frame->yDis;
      }

      if(inPal)
         frame->bitmap.paletteShades = inPal;

      surface.Blit(frame->bitmap, dx,dy, lx,ly, flip?(-rx):(rx), ry);
   }
};