/paste fix, use light data from destination not the source

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6804 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
Bukz
2012-05-23 15:21:24 +00:00
parent be0f32d2c7
commit 0a0d09e73a
3 changed files with 26 additions and 5 deletions
+24 -3
View File
@@ -337,16 +337,37 @@ block *blockcopy(const block &s)
return b;
}
void blockpaste(const block &b, int bx, int by)
void blockpaste(const block &b, int bx, int by, bool light)
{
const sqr *q = (const sqr *)((&b)+1);
for(int y = by; y<b.ys+by; y++) for(int x = bx; x<b.xs+bx; x++) *S(x,y) = *q++;
sqr *dest = 0;
uchar tr, tg, tb;
for(int y = by; y<b.ys+by; y++)
for(int x = bx; x<b.xs+bx; x++)
{
dest = S(x,y);
// retain light info for edit mode paste
tr = dest->r;
tg = dest->g;
tb = dest->b;
*dest = *q++;
if (light) //edit mode paste
{
dest->r = tr;
dest->g = tg;
dest->b = tb;
}
}
remipmore(b);
}
void blockpaste(const block &b)
{
blockpaste(b, b.x, b.y);
blockpaste(b, b.x, b.y, false);
}
void freeblock(block *&b)