2018-11-05 07:28:01 +00:00
|
|
|
// "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman
|
|
|
|
// Ken Silverman's official web site: "http://www.advsys.net/ken"
|
|
|
|
// See the included license file "BUILDLIC.TXT" for license info.
|
|
|
|
//
|
|
|
|
// This file has been modified from Ken Silverman's original release
|
|
|
|
// by Jonathon Fowler (jf@jonof.id.au)
|
|
|
|
// by the EDuke32 team (development@voidpoint.com)
|
2016-06-21 00:34:25 +00:00
|
|
|
|
|
|
|
#include "compat.h"
|
|
|
|
#include "build.h"
|
2016-09-16 21:55:21 +00:00
|
|
|
#include "baselayer.h"
|
2016-06-21 00:34:25 +00:00
|
|
|
#include "engine_priv.h"
|
|
|
|
#include "cache1d.h"
|
|
|
|
#include "lz4.h"
|
2019-09-22 21:15:46 +00:00
|
|
|
#include "crc32_.h"
|
2016-06-21 00:34:25 +00:00
|
|
|
|
2019-03-01 08:51:50 +00:00
|
|
|
#include "vfs.h"
|
|
|
|
|
2019-10-11 19:04:31 +00:00
|
|
|
|
2019-10-16 18:39:59 +00:00
|
|
|
//
|
2016-06-21 00:34:25 +00:00
|
|
|
// copytilepiece
|
|
|
|
//
|
2018-04-12 21:03:30 +00:00
|
|
|
void tileCopySection(int32_t tilenume1, int32_t sx1, int32_t sy1, int32_t xsiz, int32_t ysiz,
|
2016-06-21 00:34:25 +00:00
|
|
|
int32_t tilenume2, int32_t sx2, int32_t sy2)
|
|
|
|
{
|
|
|
|
int32_t xsiz1, ysiz1, xsiz2, ysiz2, i, j, x1, y1, x2, y2;
|
|
|
|
|
|
|
|
xsiz1 = tilesiz[tilenume1].x; ysiz1 = tilesiz[tilenume1].y;
|
|
|
|
xsiz2 = tilesiz[tilenume2].x; ysiz2 = tilesiz[tilenume2].y;
|
|
|
|
if ((xsiz1 > 0) && (ysiz1 > 0) && (xsiz2 > 0) && (ysiz2 > 0))
|
|
|
|
{
|
2019-10-15 18:02:37 +00:00
|
|
|
tileLoad(tilenume1);
|
|
|
|
if (tileData(tilenume2) == 0) return; // Error: Destination is not writable.
|
2016-06-21 00:34:25 +00:00
|
|
|
|
|
|
|
x1 = sx1;
|
|
|
|
for (i=0; i<xsiz; i++)
|
|
|
|
{
|
|
|
|
y1 = sy1;
|
|
|
|
for (j=0; j<ysiz; j++)
|
|
|
|
{
|
|
|
|
x2 = sx2+i;
|
|
|
|
y2 = sy2+j;
|
|
|
|
if ((x2 >= 0) && (y2 >= 0) && (x2 < xsiz2) && (y2 < ysiz2))
|
|
|
|
{
|
2019-10-11 21:31:59 +00:00
|
|
|
auto ptr1 = tilePtr(tilenume1) + x1 * ysiz1 + y1;
|
|
|
|
auto ptr2 = tileData(tilenume2) + x2 * ysiz2 + y2;
|
|
|
|
auto dat = *ptr1;
|
2016-06-21 00:34:25 +00:00
|
|
|
if (dat != 255)
|
|
|
|
*ptr2 = *ptr1;
|
|
|
|
}
|
|
|
|
|
|
|
|
y1++; if (y1 >= ysiz1) y1 = 0;
|
|
|
|
}
|
|
|
|
x1++; if (x1 >= xsiz1) x1 = 0;
|
|
|
|
}
|
|
|
|
}
|
2019-10-10 19:05:10 +00:00
|
|
|
tileInvalidate(tilenume2, -1, -1);
|
2016-06-21 00:34:25 +00:00
|
|
|
}
|
|
|
|
|