mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-24 10:40:46 +00:00
Refactor tsprite creation into renderAddTSpriteFromSprite
git-svn-id: https://svn.eduke32.com/eduke32@8521 1a8010ca-5511-0410-912e-c29ae57300e0 # Conflicts: # source/build/src/polymer.cpp # source/duke3d/src/m32exec.cpp
This commit is contained in:
parent
422601bc82
commit
6465feb438
4 changed files with 45 additions and 27 deletions
|
@ -449,6 +449,39 @@ static FORCE_INLINE void sprite_tracker_hook__(intptr_t const address)
|
|||
}
|
||||
#endif
|
||||
|
||||
static inline tspriteptr_t renderMakeTSpriteFromSprite(tspriteptr_t const tspr, uint16_t const spritenum)
|
||||
{
|
||||
auto const spr = (uspriteptr_t)&sprite[spritenum];
|
||||
|
||||
tspr->pos = spr->pos;
|
||||
tspr->cstat = spr->cstat;
|
||||
tspr->picnum = spr->picnum;
|
||||
tspr->shade = spr->shade;
|
||||
tspr->pal = spr->pal;
|
||||
tspr->blend = spr->blend;
|
||||
tspr->xrepeat = spr->xrepeat;
|
||||
tspr->yrepeat = spr->yrepeat;
|
||||
tspr->xoffset = spr->xoffset;
|
||||
tspr->yoffset = spr->yoffset;
|
||||
tspr->sectnum = spr->sectnum;
|
||||
tspr->statnum = spr->statnum;
|
||||
tspr->ang = spr->ang;
|
||||
tspr->vel = spr->vel;
|
||||
tspr->lotag = spr->lotag;
|
||||
tspr->hitag = spr->hitag;
|
||||
|
||||
tspr->clipdist = 0;
|
||||
tspr->owner = spritenum;
|
||||
tspr->extra = 0;
|
||||
|
||||
return tspr;
|
||||
}
|
||||
|
||||
static inline tspriteptr_t renderAddTSpriteFromSprite(uint16_t const spritenum)
|
||||
{
|
||||
return renderMakeTSpriteFromSprite(&tsprite[spritesortcnt++], spritenum);
|
||||
}
|
||||
|
||||
|
||||
EXTERN int16_t maskwall[MAXWALLSB], maskwallcnt;
|
||||
EXTERN int16_t thewall[MAXWALLSB];
|
||||
|
|
|
@ -824,11 +824,8 @@ static void yax_copytsprites()
|
|||
if (spritesortcnt >= maxspritesonscreen)
|
||||
break;
|
||||
|
||||
Bmemcpy(&tsprite[spritesortcnt], spr, sizeof(tspritetype));
|
||||
tsprite[spritesortcnt].owner = spritenum;
|
||||
tsprite[spritesortcnt].extra = 0;
|
||||
tsprite[spritesortcnt].sectnum = sectnum; // potentially tweak sectnum!
|
||||
spritesortcnt++;
|
||||
tspriteptr_t tsp = renderAddTSpriteFromSprite(spritenum);
|
||||
tsp->sectnum = sectnum; // potentially tweak sectnum!
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1465,9 +1462,7 @@ int32_t renderAddTsprite(int16_t z, int16_t sectnum)
|
|||
if (spritesortcnt >= maxspritesonscreen)
|
||||
return 1;
|
||||
|
||||
Bmemcpy(&tsprite[spritesortcnt], spr, sizeof(tspritetype));
|
||||
tsprite[spritesortcnt].extra = 0;
|
||||
tsprite[spritesortcnt++].owner = z;
|
||||
renderAddTSpriteFromSprite(z);
|
||||
|
||||
#ifdef YAX_ENABLE
|
||||
}
|
||||
|
|
|
@ -362,17 +362,14 @@ static void G_OROR_DupeSprites(spritetype const *sp)
|
|||
|
||||
if (sprite[k].picnum != SECTOREFFECTOR && sprite[k].z >= sp->z)
|
||||
{
|
||||
Bmemcpy(&tsprite[spritesortcnt], &sprite[k], sizeof(tspritetype));
|
||||
tspriteptr_t tsp = renderAddTSpriteFromSprite(k);
|
||||
|
||||
tsprite[spritesortcnt].x += (refsp->x - sp->x);
|
||||
tsprite[spritesortcnt].y += (refsp->y - sp->y);
|
||||
tsprite[spritesortcnt].z = tsprite[spritesortcnt].z - sp->z + actor[sp->yvel].ceilingz;
|
||||
tsprite[spritesortcnt].sectnum = refsp->sectnum;
|
||||
tsprite[spritesortcnt].owner = k;
|
||||
tsprite[spritesortcnt].extra = 0;
|
||||
tsp->x += (refsp->x - sp->x);
|
||||
tsp->y += (refsp->y - sp->y);
|
||||
tsp->z += -sp->z + actor[sp->yvel].ceilingz;
|
||||
tsp->sectnum = refsp->sectnum;
|
||||
|
||||
// OSD_Printf("duped sprite of pic %d at %d %d %d\n",tsprite[spritesortcnt].picnum,tsprite[spritesortcnt].x,tsprite[spritesortcnt].y,tsprite[spritesortcnt].z);
|
||||
spritesortcnt++;
|
||||
// OSD_Printf("duped sprite of pic %d at %d %d %d\n",tsp->picnum,tsp->x,tsp->y,tsp->z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -600,10 +600,7 @@ void WarpCopySprite(void)
|
|||
if (sprite[spnum].picnum == ST1)
|
||||
continue;
|
||||
|
||||
tspriteptr_t New = &tsprite[spritesortcnt];
|
||||
memcpy(New, &sprite[spnum], sizeof(tspritetype));
|
||||
spritesortcnt++;
|
||||
New->owner = spnum;
|
||||
tspriteptr_t New = renderAddTSpriteFromSprite(spnum);
|
||||
New->statnum = 0;
|
||||
|
||||
xoff = sp1->x - New->x;
|
||||
|
@ -624,10 +621,7 @@ void WarpCopySprite(void)
|
|||
if (sprite[spnum].picnum == ST1)
|
||||
continue;
|
||||
|
||||
tspriteptr_t New = &tsprite[spritesortcnt];
|
||||
memcpy(New, &sprite[spnum], sizeof(tspritetype));
|
||||
spritesortcnt++;
|
||||
New->owner = spnum;
|
||||
tspriteptr_t New = renderAddTSpriteFromSprite(spnum);
|
||||
New->statnum = 0;
|
||||
|
||||
xoff = sp2->x - New->x;
|
||||
|
@ -1492,8 +1486,7 @@ void SpriteSortList2D(int tx, int ty)
|
|||
|
||||
if (dist < 22000)
|
||||
{
|
||||
memcpy(&tsprite[spritesortcnt], sp, sizeof(tspritetype));
|
||||
tsprite[spritesortcnt++].owner = i;
|
||||
renderAddTSpriteFromSprite(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue