-// static char *VB_Name = "DDSpriteBuffer";
-// static boolean VB_GlobalNameSpace = False;
-// static boolean VB_Creatable = True;
-// static boolean VB_PredeclaredId = False;
-// static boolean VB_Exposed = False;
-// --- Option Explicit
-
-// needs reference to: DirectX7 for Visual Basic Type Library
-
-DirectDrawSurface7 Buffer;
-DirectDrawSurface7 mDest;
-long mXSpriteCount, mYSpriteCount;
-long mSpriteWidth, mSpriteHeight;
-long mDestXOff, mDestYOff;
-
-void DDSpriteBuffer_Let_DestXOff(long NewVal)
-{
- mDestXOff = NewVal;
-}
-
-long DDSpriteBuffer_Get_DestXOff()
-{
- long DestXOff;
-
- DestXOff = mDestXOff;
-
- return DestXOff;
-}
-
-void DDSpriteBuffer_Let_DestYOff(long NewVal)
-{
- mDestYOff = NewVal;
-}
-
-long DDSpriteBuffer_Get_DestYOff()
-{
- long DestYOff;
-
- DestYOff = mDestYOff;
-
- return DestYOff;
-}
-
-int DDSpriteBuffer_Set_DestinationSurface(DirectDrawSurface7 DSurface)
-{
- int DestinationSurface;
-
- mDest = DSurface;
-
- return DestinationSurface;
-}
-
-DirectDrawSurface7 DDSpriteBuffer_Get_Surface()
-{
- DirectDrawSurface7 Surface;
-
- Surface = Buffer;
-
- return Surface;
-}
-
-long DDSpriteBuffer_Get_Width()
-{
- long Width;
-
- Width = mSpriteWidth * mXSpriteCount;
-
- return Width;
-}
-
-int DDSpriteBuffer_Get_Height()
-{
- int Height;
-
- Height = mSpriteHeight * mYSpriteCount;
-
- return Height;
-}
-
-boolean DDSpriteBuffer_CreateFromFile(char *Path, long xSprites, long ySprites)
-{
- boolean CreateFromFile;
-
- DDSURFACEDESC2 SD;
-
- {
- SD.lFlags = DDSD_CAPS; // Or DDSD_WIDTH Or DDSD_HEIGHT
- SD.ddsCaps.lCaps = DDSCAPS_VIDEOMEMORY; // DDSCAPS_SYSTEMMEMORY 'DDSCAPS_OFFSCREENPLAIN
- }
-
- // --- On Error GoTo CreateFromFileEH
-#if 1
- SD.LWidth = 16 * TILEX;
- SD.LHeight = 16 * TILEY;
-#else
- Buffer = DDraw.CreateSurfaceFromFile(Path, SD);
-#endif
- // --- On Error GoTo 0
-
-#if 0
- Buffer.GetSurfaceDesc(SD);
-#endif
-
- mSpriteWidth = SD.LWidth / xSprites;
- mSpriteHeight = SD.LHeight / ySprites;
- mXSpriteCount = xSprites;
- mYSpriteCount = ySprites;
-
- CreateFromFile = True;
- return CreateFromFile;
-
- // CreateFromFileEH:
- CreateFromFile = False;
-
- return CreateFromFile;
-}
-
-boolean DDSpriteBuffer_CreateAtSize(long Width, long Height, long xSprites, long ySprites)
-{
- boolean CreateAtSize;
-
- DDSURFACEDESC2 SD;
-
- {
- SD.lFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
- SD.ddsCaps.lCaps = DDSCAPS_VIDEOMEMORY;
- // SD.ddsCaps.lCaps = DDSCAPS_OFFSCREENPLAIN
- SD.LWidth = Width;
- SD.LHeight = Height;
- }
-
- // --- On Error GoTo CreateAtSizeEH
- Buffer = DDraw.CreateSurface(SD);
- // --- On Error GoTo 0
-
- mSpriteWidth = Width / xSprites;
- mSpriteHeight = Height / ySprites;
- mXSpriteCount = xSprites;
- mYSpriteCount = ySprites;
- CreateAtSize = True;
- return CreateAtSize;
-
- // CreateAtSizeEH:
- CreateAtSize = False;
-
- return CreateAtSize;
-}
-
-void DDSpriteBuffer_Cls(int BackColor)
-{
- RECT EmptyRect;