mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 08:51:24 +00:00
- WarpCopySprite
This commit is contained in:
parent
dce8531c48
commit
c61e4de409
1 changed files with 18 additions and 30 deletions
|
@ -444,7 +444,6 @@ void SetVoxelSprite(SPRITEp sp, int pic)
|
||||||
|
|
||||||
void WarpCopySprite(tspritetype* tsprite, int& spritesortcnt)
|
void WarpCopySprite(tspritetype* tsprite, int& spritesortcnt)
|
||||||
{
|
{
|
||||||
SPRITEp sp1, sp2, sp;
|
|
||||||
int spnum;
|
int spnum;
|
||||||
int xoff,yoff,zoff;
|
int xoff,yoff,zoff;
|
||||||
int match;
|
int match;
|
||||||
|
@ -453,65 +452,54 @@ void WarpCopySprite(tspritetype* tsprite, int& spritesortcnt)
|
||||||
SWStatIterator it(STAT_WARP_COPY_SPRITE1);
|
SWStatIterator it(STAT_WARP_COPY_SPRITE1);
|
||||||
while (auto itActor = it.Next())
|
while (auto itActor = it.Next())
|
||||||
{
|
{
|
||||||
sp1 = &itActor->s();
|
match = itActor->spr.lotag;
|
||||||
match = sp1->lotag;
|
|
||||||
|
|
||||||
// look for the second one
|
// look for the second one
|
||||||
SWStatIterator it1(STAT_WARP_COPY_SPRITE2);
|
SWStatIterator it1(STAT_WARP_COPY_SPRITE2);
|
||||||
while (auto itActor1 = it.Next())
|
while (auto itActor1 = it.Next())
|
||||||
{
|
{
|
||||||
sp = &itActor1->s();
|
if (itActor1->spr.lotag == match)
|
||||||
|
|
||||||
if (sp->lotag == match)
|
|
||||||
{
|
{
|
||||||
sp2 = sp;
|
auto sect1 = itActor->spr.sector();
|
||||||
auto sect1 = sp1->sector();
|
auto sect2 = itActor1->spr.sector();
|
||||||
auto sect2 = sp2->sector();
|
|
||||||
|
|
||||||
SWSectIterator it2(sect1);
|
SWSectIterator it2(sect1);
|
||||||
while (auto itActor2 = it.Next())
|
while (auto itActor2 = it.Next())
|
||||||
{
|
{
|
||||||
auto spit = &itActor2->s();
|
if (itActor2 == itActor)
|
||||||
if (spit == sp1)
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (spit->picnum == ST1)
|
if (itActor2->spr.picnum == ST1)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
tspriteptr_t newTSpr = renderAddTsprite(tsprite, spritesortcnt, itActor2);
|
tspriteptr_t newTSpr = renderAddTsprite(tsprite, spritesortcnt, itActor2);
|
||||||
newTSpr->statnum = 0;
|
newTSpr->statnum = 0;
|
||||||
|
|
||||||
xoff = sp1->pos.X - newTSpr->pos.X;
|
xoff = itActor->spr.pos.X - newTSpr->pos.X;
|
||||||
yoff = sp1->pos.Y - newTSpr->pos.Y;
|
yoff = itActor->spr.pos.Y - newTSpr->pos.Y;
|
||||||
zoff = sp1->pos.Z - newTSpr->pos.Z;
|
zoff = itActor->spr.pos.Z - newTSpr->pos.Z;
|
||||||
|
|
||||||
newTSpr->pos.X = sp2->pos.X - xoff;
|
newTSpr->pos.X = itActor1->spr.pos.X - xoff;
|
||||||
newTSpr->pos.Y = sp2->pos.Y - yoff;
|
newTSpr->pos.Y = itActor1->spr.pos.Y - yoff;
|
||||||
newTSpr->pos.Z = sp2->pos.Z - zoff;
|
newTSpr->pos.Z = itActor1->spr.pos.Z - zoff;
|
||||||
newTSpr->setsector(sp2->sector());
|
newTSpr->setsector(itActor1->spr.sector());
|
||||||
}
|
}
|
||||||
|
|
||||||
it2.Reset(sect2);
|
it2.Reset(sect2);
|
||||||
while (auto itActor2 = it2.Next())
|
while (auto itActor2 = it2.Next())
|
||||||
{
|
{
|
||||||
auto spit = &itActor2->s();
|
if (itActor2 == itActor1)
|
||||||
if (spit == sp2)
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (spit->picnum == ST1)
|
if (itActor2->spr.picnum == ST1)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
tspriteptr_t newTSpr = renderAddTsprite(tsprite, spritesortcnt, itActor2);
|
tspriteptr_t newTSpr = renderAddTsprite(tsprite, spritesortcnt, itActor2);
|
||||||
newTSpr->statnum = 0;
|
newTSpr->statnum = 0;
|
||||||
|
|
||||||
xoff = sp2->pos.X - newTSpr->pos.X;
|
auto off = itActor1->spr.pos - newTSpr->pos;
|
||||||
yoff = sp2->pos.Y - newTSpr->pos.Y;
|
newTSpr->pos = itActor->spr.pos - off;
|
||||||
zoff = sp2->pos.Z - newTSpr->pos.Z;
|
newTSpr->setsector(itActor->spr.sector());
|
||||||
|
|
||||||
newTSpr->pos.X = sp1->pos.X - xoff;
|
|
||||||
newTSpr->pos.Y = sp1->pos.Y - yoff;
|
|
||||||
newTSpr->pos.Z = sp1->pos.Z - zoff;
|
|
||||||
newTSpr->setsector(sp1->sector());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue