/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:
@@ -303,7 +303,7 @@ void paste()
|
||||
sel.y = sely + dy;
|
||||
if(!correctsel(sel) || sel.xs!=copyblock->xs || sel.ys!=copyblock->ys) { conoutf("incorrect selection"); return; }
|
||||
makeundo(sel);
|
||||
blockpaste(*copyblock, sel.x, sel.y);
|
||||
blockpaste(*copyblock, sel.x, sel.y, true);
|
||||
}
|
||||
remipmore(sel);
|
||||
}
|
||||
|
||||
+1
-1
@@ -474,7 +474,7 @@ extern void undodynlights();
|
||||
extern void cleardynlights();
|
||||
extern void removedynlights(physent *owner);
|
||||
extern block *blockcopy(const block &b);
|
||||
extern void blockpaste(const block &b, int bx, int by);
|
||||
extern void blockpaste(const block &b, int bx, int by, bool light);
|
||||
extern void blockpaste(const block &b);
|
||||
extern void freeblock(block *&b);
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user