Skip to content

Commit

Permalink
Merge remote-tracking branch 'eduke32/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Hendricks266 committed Aug 27, 2023
2 parents f4ca9cd + 6e6b82d commit 5cefe35
Show file tree
Hide file tree
Showing 29 changed files with 1,385 additions and 1,352 deletions.
2 changes: 1 addition & 1 deletion source/blood/src/mapedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1555,7 +1555,7 @@ void adjustSprites()
spritetype* pSprite = &sprite[i];
if (pSprite->statnum < kMaxStatus)
{
if ((pSprite->cstat & CSTAT_SPRITE_ALIGNMENT_MASK) == CSTAT_SPRITE_ALIGNMENT_SLAB) pSprite->cstat &= ~CSTAT_SPRITE_ALIGNMENT_MASK;
if ((pSprite->cstat & CSTAT_SPRITE_ALIGNMENT_MASK) == CSTAT_SPRITE_ALIGNMENT_MASK) pSprite->cstat &= ~CSTAT_SPRITE_ALIGNMENT_MASK;
if (pSprite->statnum == 1) continue;

// don't turn unnamed types in Decoration
Expand Down
14 changes: 8 additions & 6 deletions source/blood/src/view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2486,8 +2486,8 @@ tspritetype *viewAddEffect(int nTSprite, VIEW_EFFECT nViewEffect)
const int nVoxel = voxelIndex[nTile];
if (gShowWeapon == 2 && usevoxels && gDetail >= 4 && videoGetRenderMode() != REND_POLYMER && nVoxel != -1)
{
pNSprite->cstat |= 48;
pNSprite->cstat &= ~8;
pNSprite->clipdist |= TSPR_FLAGS_SLAB;
pNSprite->cstat &= ~(8|CSTAT_SPRITE_ALIGNMENT);
pNSprite->picnum = nVoxel;
if (pPlayer->curWeapon == kWeaponLifeLeech) // position lifeleech behind player
{
Expand Down Expand Up @@ -2548,6 +2548,8 @@ void viewProcessSprites(int32_t cX, int32_t cY, int32_t cZ, int32_t cA, int32_t
continue;
}

auto const tsprflags = pTSprite->clipdist;

if (gViewInterpolate && TestBitString(gInterpolateSprite, nSprite) && !(pTSprite->flags&512))
{
LOCATION *pPrevLoc = &gPrevSpriteLoc[nSprite];
Expand Down Expand Up @@ -2640,8 +2642,8 @@ void viewProcessSprites(int32_t cX, int32_t cY, int32_t cZ, int32_t cA, int32_t
{
if ((pTSprite->flags&kHitagRespawn) == 0)
{
pTSprite->cstat |= 48;
pTSprite->cstat &= ~(4|8);
pTSprite->clipdist |= TSPR_FLAGS_SLAB;
pTSprite->cstat &= ~(4|8|CSTAT_SPRITE_ALIGNMENT);
pTSprite->yoffset += picanm[pTSprite->picnum].yofs;
pTSprite->picnum = voxelIndex[pTSprite->picnum];
if (!voxoff[pTSprite->picnum][0])
Expand All @@ -2661,7 +2663,7 @@ void viewProcessSprites(int32_t cX, int32_t cY, int32_t cZ, int32_t cA, int32_t
nAnim--;
}

if ((pTSprite->cstat&48) != 48 && usevoxels && videoGetRenderMode() != REND_POLYMER && !(spriteext[nSprite].flags&SPREXT_NOTMD))
if (!(tsprflags & TSPR_FLAGS_SLAB) && usevoxels && videoGetRenderMode() != REND_POLYMER && !(spriteext[nSprite].flags&SPREXT_NOTMD))
{
int const nRootTile = pTSprite->picnum;
#if 0
Expand All @@ -2680,7 +2682,7 @@ void viewProcessSprites(int32_t cX, int32_t cY, int32_t cZ, int32_t cA, int32_t
}

#ifdef USE_OPENGL
if ((pTSprite->cstat&48) != 48 && usemodels && !(spriteext[nSprite].flags&SPREXT_NOTMD))
if (!(tsprflags & TSPR_FLAGS_SLAB) && usemodels && !(spriteext[nSprite].flags&SPREXT_NOTMD))
{
int const nRootTile = pTSprite->picnum;
int nAnimTile = pTSprite->picnum + animateoffs_replace(pTSprite->picnum, 32768+nSprite);
Expand Down
1 change: 1 addition & 0 deletions source/build/include/build.h
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,7 @@ enum
TSPR_FLAGS_NO_SHADOW = 1u<<2u,
TSPR_FLAGS_INVISIBLE_WITH_SHADOW = 1u<<3u,
TSPR_FLAGS_SLOPE_SPRITE = 1u<<4u,
TSPR_FLAGS_SLAB = 1u<<5u,
};

EXTERN int32_t guniqhudid;
Expand Down
1 change: 0 additions & 1 deletion source/build/include/buildtypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ enum
CSTAT_SPRITE_ALIGNMENT_FACING = 0,
CSTAT_SPRITE_ALIGNMENT_WALL = 1u<<4u,
CSTAT_SPRITE_ALIGNMENT_FLOOR = 1u<<5u,
CSTAT_SPRITE_ALIGNMENT_SLAB = 1u<<4u | 1u<<5u,
CSTAT_SPRITE_ALIGNMENT_SLOPE = 1u<<4u | 1u<<5u,

CSTAT_SPRITE_ALIGNMENT_MASK = 1u<<4u | 1u<<5u,
Expand Down
3 changes: 2 additions & 1 deletion source/build/src/2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1245,7 +1245,8 @@ static void editorDraw2dSprite(int32_t j, int32_t posxe, int32_t posye, int32_t
{
auto const spr = &sprite[j];
int16_t const blocking = (spr->cstat&1), hitblocking = (spr->cstat&256);
int16_t const flooraligned = (spr->cstat&48) >= 32, wallaligned = (spr->cstat&48) == 16;
int16_t const flooraligned = spr->cstat & CSTAT_SPRITE_ALIGNMENT_FLOOR;
int16_t const wallaligned = (spr->cstat & CSTAT_SPRITE_ALIGNMENT) == CSTAT_SPRITE_ALIGNMENT_WALL;

int16_t const angofs = m32_sideview ? m32_sideang : 0;
int32_t const ang = spr->ang + angofs;
Expand Down
14 changes: 7 additions & 7 deletions source/build/src/build.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1006,9 +1006,9 @@ void spriteoncfz(int32_t i, int32_t *czptr, int32_t *fzptr)
int32_t height, zofs;

getzsofslope(sprite[i].sectnum, sprite[i].x,sprite[i].y, czptr, fzptr);
if ((sprite[i].cstat&48)==32)
if ((sprite[i].cstat & CSTAT_SPRITE_ALIGNMENT) == CSTAT_SPRITE_ALIGNMENT_FLOOR)
return;
if ((sprite[i].cstat&48)==48)
if ((sprite[i].cstat & CSTAT_SPRITE_ALIGNMENT) == CSTAT_SPRITE_ALIGNMENT_SLOPE)
{
int32_t const heinum = spriteGetSlope(i);
int32_t const ratio = divscale12(heinum, ksqrt(heinum*heinum+16777216));
Expand Down Expand Up @@ -1550,10 +1550,10 @@ void editinput(void)
spriteoncfz(i, &cz, &fz);
sprite[i].z = clamp2(hit.z, cz, fz);

if (AIMING_AT_WALL || AIMING_AT_MASKWALL || (AIMING_AT_SPRITE && (sprite[searchwall].cstat & CSTAT_SPRITE_ALIGNMENT_SLAB) == CSTAT_SPRITE_ALIGNMENT_WALL))
if (AIMING_AT_WALL || AIMING_AT_MASKWALL || (AIMING_AT_SPRITE && (sprite[searchwall].cstat & CSTAT_SPRITE_ALIGNMENT_MASK) == CSTAT_SPRITE_ALIGNMENT_WALL))
{
sprite[i].cstat &= ~48;
sprite[i].cstat |= (16+64);
sprite[i].cstat &= ~CSTAT_SPRITE_ALIGNMENT;
sprite[i].cstat |= CSTAT_SPRITE_ONE_SIDED|CSTAT_SPRITE_ALIGNMENT_WALL;

correct_ornamented_sprite(i, hit);
}
Expand Down Expand Up @@ -2440,7 +2440,7 @@ static int32_t insert_sprite_common(int32_t sectnum, int32_t dax, int32_t day)

void correct_sprite_yoffset(int32_t i)
{
if ((sprite[i].cstat&48) >= 32)
if (sprite[i].cstat & CSTAT_SPRITE_ALIGNMENT_FLOOR)
return;
int32_t tileyofs = picanm[sprite[i].picnum].yofs;
int32_t tileysiz = tilesiz[sprite[i].picnum].y;
Expand Down Expand Up @@ -3741,7 +3741,7 @@ extern void editorFlipHighlightedSectors(int about_x, int doMirror)
sprite[j].ang = (2048-sprite[j].ang)&2047; //flip ang about 512
}

if (doMirror && (sprite[j].cstat & 0x30))
if (doMirror && (sprite[j].cstat & CSTAT_SPRITE_ALIGNMENT))
sprite[j].cstat ^= 4; // mirror sprites about dax/day (don't mirror monsters)

j = nextspritesect[j];
Expand Down
6 changes: 3 additions & 3 deletions source/build/src/clip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ int32_t engineLoadClipMaps(void)
if (i>=fispr[fi])
break;
LOG_F(WARNING, "Error in %s: sprite %d points neither northward nor southward. %s will be incorrect.",
g_clipMapFiles[fi], i-fispr[fi], (sprite[i].cstat&48)==32 ? "Scaling and flipping" : "X-flipping");
g_clipMapFiles[fi], i-fispr[fi], (sprite[i].cstat & CSTAT_SPRITE_ALIGNMENT) == CSTAT_SPRITE_ALIGNMENT_FLOOR ? "Scaling and flipping" : "X-flipping");
}
}

Expand Down Expand Up @@ -1362,7 +1362,7 @@ int32_t clipmove(vec3_t * const pos, int16_t * const sectnum, int32_t xvect, int
#endif
vec2_t p1 = spr->xy;

switch (cstat & (CSTAT_SPRITE_ALIGNMENT_WALL | CSTAT_SPRITE_ALIGNMENT_FLOOR))
switch (cstat & CSTAT_SPRITE_ALIGNMENT_MASK)
{
case CSTAT_SPRITE_ALIGNMENT_FACING:
if (p1.x >= clipMin.x && p1.x <= clipMax.x && p1.y >= clipMin.y && p1.y <= clipMax.y)
Expand Down Expand Up @@ -1723,7 +1723,7 @@ int pushmove(vec3_t *const vect, int16_t *const sectnum,
for (i=headspritesect[clipsectorlist[clipsectcnt]]; i>=0; i=nextspritesect[i])
{
spr = &sprite[i];
if (((spr->cstat&48) != 0) && ((spr->cstat&48) != 48)) continue;
if ((spr->cstat & CSTAT_SPRITE_ALIGNMENT) != CSTAT_SPRITE_ALIGNMENT_FACING) continue;
if ((spr->cstat&dasprclipmask) == 0) continue;

dax = (vect->x)-spr->x; day = (vect->y)-spr->y;
Expand Down
Loading

0 comments on commit 5cefe35

Please sign in to comment.