mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-24 10:40:46 +00:00
- rewrite of tileCopySection
This commit is contained in:
parent
8657ecb35d
commit
1f5f7c63fe
5 changed files with 47 additions and 56 deletions
|
@ -724,7 +724,6 @@ set (PCH_SOURCES
|
|||
build/src/pragmas.cpp
|
||||
build/src/scriptfile.cpp
|
||||
build/src/sdlayer.cpp
|
||||
build/src/tiles.cpp
|
||||
build/src/timer.cpp
|
||||
build/src/voxmodel.cpp
|
||||
|
||||
|
|
|
@ -842,7 +842,6 @@ int32_t qloadkvx(int32_t voxindex, const char *filename);
|
|||
void vox_undefine(int32_t const);
|
||||
void vox_deinit();
|
||||
|
||||
void tileCopySection(int32_t tilenume1, int32_t sx1, int32_t sy1, int32_t xsiz, int32_t ysiz, int32_t tilenume2, int32_t sx2, int32_t sy2);
|
||||
void squarerotatetile(int16_t tilenume);
|
||||
|
||||
int32_t videoSetGameMode(char davidoption, int32_t daupscaledxdim, int32_t daupscaledydim, int32_t dabpp, int32_t daupscalefactor);
|
||||
|
|
|
@ -1,54 +0,0 @@
|
|||
// "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)
|
||||
|
||||
#include "compat.h"
|
||||
#include "build.h"
|
||||
#include "baselayer.h"
|
||||
#include "engine_priv.h"
|
||||
|
||||
|
||||
//
|
||||
// copytilepiece
|
||||
//
|
||||
void tileCopySection(int32_t tilenume1, int32_t sx1, int32_t sy1, int32_t xsiz, int32_t ysiz,
|
||||
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))
|
||||
{
|
||||
tileLoad(tilenume1);
|
||||
if (tileData(tilenume2) == 0) return; // Error: Destination is not writable.
|
||||
|
||||
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))
|
||||
{
|
||||
auto ptr1 = tilePtr(tilenume1) + x1 * ysiz1 + y1;
|
||||
auto ptr2 = tileData(tilenume2) + x2 * ysiz2 + y2;
|
||||
auto dat = *ptr1;
|
||||
if (dat != 255)
|
||||
*ptr2 = *ptr1;
|
||||
}
|
||||
|
||||
y1++; if (y1 >= ysiz1) y1 = 0;
|
||||
}
|
||||
x1++; if (x1 >= xsiz1) x1 = 0;
|
||||
}
|
||||
}
|
||||
tileInvalidate(tilenume2, -1, -1);
|
||||
}
|
||||
|
|
@ -826,6 +826,52 @@ int tileDeleteReplacement(int picnum, int palnum)
|
|||
}
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// Copy a block of a tile.
|
||||
// Only used by RR's bowling lane.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void tileCopySection(int tilenum1, int sx1, int sy1, int xsiz, int ysiz, int tilenum2, int sx2, int sy2)
|
||||
{
|
||||
int xsiz1 = tilesiz[tilenum1].x;
|
||||
int ysiz1 = tilesiz[tilenum1].y;
|
||||
int xsiz2 = tilesiz[tilenum2].x;
|
||||
int ysiz2 = tilesiz[tilenum2].y;
|
||||
if (xsiz1 > 0 && ysiz1 > 0 && xsiz2 > 0 && ysiz2 > 0)
|
||||
{
|
||||
auto p1 = tilePtr(tilenum1);
|
||||
auto p2 = tileData(tilenum2);
|
||||
if (p2 == nullptr) return; // Error: Destination is not writable.
|
||||
|
||||
int x1 = sx1;
|
||||
int x2 = sx2;
|
||||
for (int i=0; i<xsiz; i++)
|
||||
{
|
||||
int y1 = sy1;
|
||||
int y2 = sy2;
|
||||
for (int j=0; j<ysiz; j++)
|
||||
{
|
||||
if (x2 >= 0 && y2 >= 0 && x2 < xsiz2 && y2 < ysiz2)
|
||||
{
|
||||
auto src = p1[x1 * ysiz1 + y1];
|
||||
if (src != 255)
|
||||
p2[x2 * ysiz2 + y2] = src;
|
||||
}
|
||||
|
||||
y1++;
|
||||
y2++;
|
||||
if (y1 >= ysiz1) y1 = 0;
|
||||
}
|
||||
x1++;
|
||||
x2++;
|
||||
if (x1 >= xsiz1) x1 = 0;
|
||||
}
|
||||
}
|
||||
TileFiles.InvalidateTile(tilenum2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
TileSiz tilesiz;
|
||||
|
|
|
@ -566,6 +566,7 @@ void tileSetAnim(int tile, const picanm_t& anm);
|
|||
int tileSetHightileReplacement(int picnum, int palnum, const char *filen, float alphacut, float xscale, float yscale, float specpower, float specfactor, uint8_t flags);
|
||||
int tileSetSkybox(int picnum, int palnum, const char **facenames, int flags );
|
||||
int tileDeleteReplacement(int picnum, int palnum);
|
||||
void tileCopySection(int tilenum1, int sx1, int sy1, int xsiz, int ysiz, int tilenum2, int sx2, int sy2);
|
||||
|
||||
extern BuildTiles TileFiles;
|
||||
inline bool tileCheck(int num)
|
||||
|
|
Loading…
Reference in a new issue