mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-27 09:20:51 +00:00
- use a sprite flag to mark mapped sprites.
This avoids another global array which needs to be addressed by sprite index.
This commit is contained in:
parent
88e86b4248
commit
62d0d3712e
10 changed files with 14 additions and 17 deletions
|
@ -191,6 +191,7 @@ enum
|
||||||
{
|
{
|
||||||
CSTAT2_SPRITE_MDLROTATE = 1, // Only for tsprites: rotate if this is a model or voxel.
|
CSTAT2_SPRITE_MDLROTATE = 1, // Only for tsprites: rotate if this is a model or voxel.
|
||||||
CSTAT2_SPRITE_NOFIND = 2, // Invisible to neartag and hitscan
|
CSTAT2_SPRITE_NOFIND = 2, // Invisible to neartag and hitscan
|
||||||
|
CSTAT2_SPRITE_MAPPED = 4, // sprite was mapped for automap
|
||||||
|
|
||||||
};
|
};
|
||||||
enum
|
enum
|
||||||
|
|
|
@ -3253,7 +3253,7 @@ void polymost_drawsprite(int32_t snum)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((unsigned)spritenum < MAXSPRITES)
|
if ((unsigned)spritenum < MAXSPRITES)
|
||||||
show2dsprite.Set(spritenum);
|
sprite[spritenum].cstat2 |= CSTAT2_SPRITE_MAPPED;
|
||||||
|
|
||||||
_drawsprite_return:
|
_drawsprite_return:
|
||||||
;
|
;
|
||||||
|
|
|
@ -63,7 +63,6 @@ bool automapping;
|
||||||
bool gFullMap;
|
bool gFullMap;
|
||||||
FixedBitArray<MAXSECTORS> show2dsector;
|
FixedBitArray<MAXSECTORS> show2dsector;
|
||||||
FixedBitArray<MAXWALLS> show2dwall;
|
FixedBitArray<MAXWALLS> show2dwall;
|
||||||
FixedBitArray<MAXSPRITES> show2dsprite;
|
|
||||||
static int x_min_bound = INT_MAX, y_min_bound, x_max_bound, y_max_bound;
|
static int x_min_bound = INT_MAX, y_min_bound, x_max_bound, y_max_bound;
|
||||||
|
|
||||||
CVAR(Color, am_twosidedcolor, 0xaaaaaa, CVAR_ARCHIVE)
|
CVAR(Color, am_twosidedcolor, 0xaaaaaa, CVAR_ARCHIVE)
|
||||||
|
@ -271,7 +270,6 @@ void SerializeAutomap(FSerializer& arc)
|
||||||
// Only store what's needed. Unfortunately for sprites it is not that easy
|
// Only store what's needed. Unfortunately for sprites it is not that easy
|
||||||
.SerializeMemory("mappedsectors", show2dsector.Storage(), (numsectors + 7) / 8)
|
.SerializeMemory("mappedsectors", show2dsector.Storage(), (numsectors + 7) / 8)
|
||||||
.SerializeMemory("mappedwalls", show2dwall.Storage(), (numwalls + 7) / 8)
|
.SerializeMemory("mappedwalls", show2dwall.Storage(), (numwalls + 7) / 8)
|
||||||
.SerializeMemory("mappedsprites", show2dsprite.Storage(), MAXSPRITES / 8)
|
|
||||||
.EndObject();
|
.EndObject();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -287,7 +285,6 @@ void ClearAutomap()
|
||||||
{
|
{
|
||||||
show2dsector.Zero();
|
show2dsector.Zero();
|
||||||
show2dwall.Zero();
|
show2dwall.Zero();
|
||||||
show2dsprite.Zero();
|
|
||||||
x_min_bound = INT_MAX;
|
x_min_bound = INT_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -630,7 +627,7 @@ void renderDrawMapView(int cposx, int cposy, int czoom, int cang)
|
||||||
vertices.Resize(4);
|
vertices.Resize(4);
|
||||||
for (auto sn : floorsprites)
|
for (auto sn : floorsprites)
|
||||||
{
|
{
|
||||||
if (!gFullMap && !show2dsprite[sn]) continue;
|
if (!gFullMap && !(sprite[sn].cstat2 & CSTAT2_SPRITE_MAPPED)) continue;
|
||||||
auto spr = &sprite[sn];
|
auto spr = &sprite[sn];
|
||||||
vec2_t pp[4];
|
vec2_t pp[4];
|
||||||
GetFlatSpritePosition(spr, spr->pos.vec2, pp, true);
|
GetFlatSpritePosition(spr, spr->pos.vec2, pp, true);
|
||||||
|
|
|
@ -12,7 +12,6 @@ extern bool automapping;
|
||||||
extern bool gFullMap;
|
extern bool gFullMap;
|
||||||
extern FixedBitArray<MAXSECTORS> show2dsector;
|
extern FixedBitArray<MAXSECTORS> show2dsector;
|
||||||
extern FixedBitArray<MAXWALLS> show2dwall;
|
extern FixedBitArray<MAXWALLS> show2dwall;
|
||||||
extern FixedBitArray<MAXSPRITES> show2dsprite;
|
|
||||||
|
|
||||||
void SerializeAutomap(FSerializer& arc);
|
void SerializeAutomap(FSerializer& arc);
|
||||||
void ClearAutomap();
|
void ClearAutomap();
|
||||||
|
|
|
@ -282,7 +282,7 @@ void HWDrawInfo::DispatchSprites()
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if ((unsigned)spritenum < MAXSPRITES)
|
if ((unsigned)spritenum < MAXSPRITES)
|
||||||
show2dsprite.Set(spritenum);
|
sprite[spritenum].cstat2 |= CSTAT2_SPRITE_MAPPED;
|
||||||
|
|
||||||
setgotpic(tilenum);
|
setgotpic(tilenum);
|
||||||
|
|
||||||
|
|
|
@ -6546,7 +6546,7 @@ DBloodActor* actSpawnThing(int nSector, int x, int y, int z, int nThingType)
|
||||||
pSprite->pal = pThingInfo->pal;
|
pSprite->pal = pThingInfo->pal;
|
||||||
if (pThingInfo->xrepeat) pSprite->xrepeat = pThingInfo->xrepeat;
|
if (pThingInfo->xrepeat) pSprite->xrepeat = pThingInfo->xrepeat;
|
||||||
if (pThingInfo->yrepeat) pSprite->yrepeat = pThingInfo->yrepeat;
|
if (pThingInfo->yrepeat) pSprite->yrepeat = pThingInfo->yrepeat;
|
||||||
show2dsprite.Set(pSprite->index);
|
pSprite->cstat2 |= CSTAT2_SPRITE_MAPPED;
|
||||||
switch (nThingType)
|
switch (nThingType)
|
||||||
{
|
{
|
||||||
case kThingVoodooHead:
|
case kThingVoodooHead:
|
||||||
|
@ -6764,8 +6764,7 @@ DBloodActor* actFireMissile(DBloodActor* actor, int a2, int a3, int a4, int a5,
|
||||||
}
|
}
|
||||||
auto spawned = actSpawnSprite(pSprite->sectnum, x, y, z, 5, 1);
|
auto spawned = actSpawnSprite(pSprite->sectnum, x, y, z, 5, 1);
|
||||||
spritetype* pMissile = &spawned->s();
|
spritetype* pMissile = &spawned->s();
|
||||||
int nMissile = pMissile->index;
|
pMissile->cstat2 |= CSTAT2_SPRITE_MAPPED;
|
||||||
show2dsprite.Set(nMissile);
|
|
||||||
pMissile->type = nType;
|
pMissile->type = nType;
|
||||||
pMissile->shade = pMissileInfo->shade;
|
pMissile->shade = pMissileInfo->shade;
|
||||||
pMissile->pal = 0;
|
pMissile->pal = 0;
|
||||||
|
|
|
@ -1193,9 +1193,9 @@ void nnExtProcessSuperSprites() {
|
||||||
int index = sprite[gSightSpritesList[i]].index;
|
int index = sprite[gSightSpritesList[i]].index;
|
||||||
|
|
||||||
// sprite is drawn for one of players
|
// sprite is drawn for one of players
|
||||||
if ((pXSightSpr->unused3 & kTriggerSpriteScreen) && show2dsprite[index]) {
|
if ((pXSightSpr->unused3 & kTriggerSpriteScreen) && (gSightSpritesList[i]->s().cstat2 & CSTAT2_SPRITE_MAPPED))
|
||||||
trTriggerSprite(index, pXSightSpr, kCmdSpriteSight);
|
trTriggerSprite(index, pXSightSpr, kCmdSpriteSight);
|
||||||
show2dsprite.Clear(index);
|
gSightSpritesList[i]->s().cstat2 &= ~CSTAT2_SPRITE_MAPPED;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2521,7 +2521,7 @@ void usePropertiesChanger(XSPRITE* pXSource, short objType, int objIndex) {
|
||||||
|
|
||||||
// set new cstat
|
// set new cstat
|
||||||
if ((pSource->flags & kModernTypeFlag1)) pSprite->cstat |= pXSource->data4; // relative
|
if ((pSource->flags & kModernTypeFlag1)) pSprite->cstat |= pXSource->data4; // relative
|
||||||
else pSprite->cstat = pXSource->data4; // absolute
|
else pSprite->cstat = pXSource->data4 & 0xffff; // absolute
|
||||||
|
|
||||||
// and handle exceptions
|
// and handle exceptions
|
||||||
if ((old & 0x1000) && !(pSprite->cstat & 0x1000)) pSprite->cstat |= 0x1000; //kSpritePushable
|
if ((old & 0x1000) && !(pSprite->cstat & 0x1000)) pSprite->cstat |= 0x1000; //kSpritePushable
|
||||||
|
@ -7839,6 +7839,7 @@ void callbackUniMissileBurst(int nSprite) // 22
|
||||||
pBurst->shade = pSprite->shade;
|
pBurst->shade = pSprite->shade;
|
||||||
pBurst->picnum = pSprite->picnum;
|
pBurst->picnum = pSprite->picnum;
|
||||||
|
|
||||||
|
|
||||||
pBurst->cstat = pSprite->cstat;
|
pBurst->cstat = pSprite->cstat;
|
||||||
if ((pBurst->cstat & CSTAT_SPRITE_BLOCK)) {
|
if ((pBurst->cstat & CSTAT_SPRITE_BLOCK)) {
|
||||||
pBurst->cstat &= ~CSTAT_SPRITE_BLOCK; // we don't want missiles impact each other
|
pBurst->cstat &= ~CSTAT_SPRITE_BLOCK; // we don't want missiles impact each other
|
||||||
|
|
|
@ -673,7 +673,7 @@ void playerStart(int nPlayer, int bNewLevel)
|
||||||
playerResetPosture(pPlayer);
|
playerResetPosture(pPlayer);
|
||||||
seqSpawn(pDudeInfo->seqStartID, 3, pSprite->extra, -1);
|
seqSpawn(pDudeInfo->seqStartID, 3, pSprite->extra, -1);
|
||||||
if (pPlayer == gMe)
|
if (pPlayer == gMe)
|
||||||
show2dsprite.Set(pSprite->index);
|
actor->s().cstat2 |= CSTAT2_SPRITE_MAPPED;
|
||||||
int top, bottom;
|
int top, bottom;
|
||||||
GetSpriteExtents(pSprite, &top, &bottom);
|
GetSpriteExtents(pSprite, &top, &bottom);
|
||||||
pSprite->z -= bottom - pSprite->z;
|
pSprite->z -= bottom - pSprite->z;
|
||||||
|
|
|
@ -119,8 +119,8 @@ DDukeActor* EGS(short whatsect, int s_x, int s_y, int s_z, short s_pn, signed ch
|
||||||
s->hitag = 0;
|
s->hitag = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (show2dsector[s->sectnum]) show2dsprite.Set(i);
|
if (show2dsector[s->sectnum]) act->s->cstat2 |= CSTAT2_SPRITE_MAPPED;
|
||||||
else show2dsprite.Clear(i);
|
else act->s->cstat2 &= ~CSTAT2_SPRITE_MAPPED;
|
||||||
|
|
||||||
spriteext[i] = {};
|
spriteext[i] = {};
|
||||||
spritesmooth[i] = {};
|
spritesmooth[i] = {};
|
||||||
|
|
|
@ -1738,7 +1738,7 @@ bool GameInterface::DrawAutomapPlayer(int cposx, int cposy, int czoom, int cang,
|
||||||
goto SHOWSPRITE;
|
goto SHOWSPRITE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (gFullMap || show2dsprite[j])
|
if (gFullMap || (sprite[j].cstat2 & CSTAT2_SPRITE_MAPPED))
|
||||||
{
|
{
|
||||||
SHOWSPRITE:
|
SHOWSPRITE:
|
||||||
spr = &sprite[j];
|
spr = &sprite[j];
|
||||||
|
|
Loading…
Reference in a new issue