Make the Polymode cstat bits Duke-only by translating them to tspr->clipdist

git-svn-id: https://svn.eduke32.com/eduke32@8523 1a8010ca-5511-0410-912e-c29ae57300e0

# Conflicts:
#	source/build/src/polymer.cpp
#	source/build/src/polymost.cpp
#	source/duke3d/src/astub.cpp
#	source/duke3d/src/common_game.h

# Conflicts:
#	source/duke3d/src/common_game.h
This commit is contained in:
hendricks266 2019-12-26 06:28:08 +00:00 committed by Christoph Oelckers
parent 6a5906833b
commit 456d975392
5 changed files with 31 additions and 10 deletions

View file

@ -369,6 +369,9 @@ typedef struct {
enum enum
{ {
TSPR_FLAGS_MDHACK = 1u<<0u, TSPR_FLAGS_MDHACK = 1u<<0u,
TSPR_FLAGS_DRAW_LAST = 1u<<1u,
TSPR_FLAGS_NO_SHADOW = 1u<<2u,
TSPR_FLAGS_INVISIBLE_WITH_SHADOW = 1u<<3u,
}; };
EXTERN int32_t guniqhudid; EXTERN int32_t guniqhudid;

View file

@ -132,10 +132,6 @@ enum
CSTAT_SPRITE_RESERVED4 = 1u<<13u, // used by Duke 3D (Polymer), Shadow Warrior, Blood CSTAT_SPRITE_RESERVED4 = 1u<<13u, // used by Duke 3D (Polymer), Shadow Warrior, Blood
CSTAT_SPRITE_RESERVED5 = 1u<<14u, // used by Duke 3D (Polymer), Shadow Warrior, Blood CSTAT_SPRITE_RESERVED5 = 1u<<14u, // used by Duke 3D (Polymer), Shadow Warrior, Blood
// TODO: Make these two Duke3D-only by translating them to bits in tspr
CSTAT_SPRITE_NO_SHADOW = 1u<<13u, // re-defined in Shadow Warrior
CSTAT_SPRITE_INVISIBLE_WITH_SHADOW = 1u<<14u, // re-defined in Shadow Warrior
CSTAT_SPRITE_INVISIBLE = 1u<<15u, CSTAT_SPRITE_INVISIBLE = 1u<<15u,
}; };
enum enum

View file

@ -418,7 +418,7 @@ int32_t polymost_maskWallHasTranslucency(uwalltype const * const wall)
int32_t polymost_spriteHasTranslucency(tspritetype const * const tspr) int32_t polymost_spriteHasTranslucency(tspritetype const * const tspr)
{ {
if ((tspr->cstat & (CSTAT_SPRITE_TRANSLUCENT | CSTAT_SPRITE_RESERVED1)) || if ((tspr->cstat & CSTAT_SPRITE_TRANSLUCENT) || (tspr->clipdist & TSPR_FLAGS_DRAW_LAST) ||
((unsigned)tspr->owner < MAXSPRITES && spriteext[tspr->owner].alpha)) ((unsigned)tspr->owner < MAXSPRITES && spriteext[tspr->owner].alpha))
return true; return true;

View file

@ -7,6 +7,7 @@
#ifndef EDUKE32_COMMON_GAME_H_ #ifndef EDUKE32_COMMON_GAME_H_
#define EDUKE32_COMMON_GAME_H_ #define EDUKE32_COMMON_GAME_H_
#include "build.h"
#include "gamecontrol.h" #include "gamecontrol.h"
BEGIN_DUKE_NS BEGIN_DUKE_NS
@ -55,5 +56,23 @@ extern void G_LoadLookups(void);
////////// //////////
static inline void Duke_ApplySpritePropertiesToTSprite(tspriteptr_t tspr, uspriteptr_t spr)
{
EDUKE32_STATIC_ASSERT(CSTAT_SPRITE_RESERVED1 >> 9 == TSPR_FLAGS_DRAW_LAST);
EDUKE32_STATIC_ASSERT(CSTAT_SPRITE_RESERVED4 >> 11 == TSPR_FLAGS_NO_SHADOW);
EDUKE32_STATIC_ASSERT(CSTAT_SPRITE_RESERVED5 >> 11 == TSPR_FLAGS_INVISIBLE_WITH_SHADOW);
auto const cstat = spr->cstat;
tspr->clipdist |= ((cstat & CSTAT_SPRITE_RESERVED1) >> 9) | ((cstat & (CSTAT_SPRITE_RESERVED4|CSTAT_SPRITE_RESERVED5)) >> 11);
}
void Duke_CommonCleanup(void);
#if defined HAVE_FLAC || defined HAVE_VORBIS
# define FORMAT_UPGRADE_ELIGIBLE
extern int g_maybeUpgradeSoundFormats;
extern buildvfs_kfd S_OpenAudio(const char *fn, char searchfirst, uint8_t ismusic);
#else
# define S_OpenAudio(fn, searchfirst, ismusic) kopen4loadfrommod(fn, searchfirst)
END_DUKE_NS END_DUKE_NS
#endif #endif

View file

@ -363,6 +363,7 @@ static void G_OROR_DupeSprites(spritetype const *sp)
if (sprite[k].picnum != SECTOREFFECTOR && sprite[k].z >= sp->z) if (sprite[k].picnum != SECTOREFFECTOR && sprite[k].z >= sp->z)
{ {
tspriteptr_t tsp = renderAddTSpriteFromSprite(k); tspriteptr_t tsp = renderAddTSpriteFromSprite(k);
Duke_ApplySpritePropertiesToTSprite(tsp, (uspriteptr_t)&sprite[k]);
tsp->x += (refsp->x - sp->x); tsp->x += (refsp->x - sp->x);
tsp->y += (refsp->y - sp->y); tsp->y += (refsp->y - sp->y);
@ -3502,6 +3503,8 @@ void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t ourz, int32_t oura
const int32_t i = t->owner; const int32_t i = t->owner;
auto const s = &sprite[i]; auto const s = &sprite[i];
Duke_ApplySpritePropertiesToTSprite(t, (uspriteptr_t)s);
switch (DYNAMICTILEMAP(s->picnum)) switch (DYNAMICTILEMAP(s->picnum))
{ {
case SECTOREFFECTOR__STATIC: case SECTOREFFECTOR__STATIC:
@ -3633,7 +3636,7 @@ void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t ourz, int32_t oura
if (pSprite->picnum == NATURALLIGHTNING) if (pSprite->picnum == NATURALLIGHTNING)
{ {
t->shade = -127; t->shade = -127;
t->cstat |= 8192; t->clipdist |= TSPR_FLAGS_NO_SHADOW;
} }
#endif #endif
if (t->statnum == TSPR_TEMP) if (t->statnum == TSPR_TEMP)
@ -3936,7 +3939,7 @@ void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t ourz, int32_t oura
if ((!g_netServer && ud.multimode < 2) || ((g_netServer || ud.multimode > 1) && playerNum == screenpeek)) if ((!g_netServer && ud.multimode < 2) || ((g_netServer || ud.multimode > 1) && playerNum == screenpeek))
{ {
if (videoGetRenderMode() == REND_POLYMER) if (videoGetRenderMode() == REND_POLYMER)
t->cstat |= 16384; t->clipdist |= TSPR_FLAGS_INVISIBLE_WITH_SHADOW;
else else
{ {
t->owner = -1; t->owner = -1;
@ -4219,7 +4222,7 @@ skip:
//g_restorePalette = 1; // JBF 20040101: why? //g_restorePalette = 1; // JBF 20040101: why?
} }
t->shade = -127; t->shade = -127;
t->cstat |= 8192+1024; t->clipdist |= TSPR_FLAGS_DRAW_LAST | TSPR_FLAGS_NO_SHADOW;
break; break;
#ifndef EDUKE32_STANDALONE #ifndef EDUKE32_STANDALONE
case FIRE__STATIC: case FIRE__STATIC:
@ -4233,11 +4236,11 @@ skip:
t->shade = -127; t->shade = -127;
fallthrough__; fallthrough__;
case SMALLSMOKE__STATIC: case SMALLSMOKE__STATIC:
t->cstat |= 8192+1024; t->clipdist |= TSPR_FLAGS_DRAW_LAST | TSPR_FLAGS_NO_SHADOW;
break; break;
case COOLEXPLOSION1__STATIC: case COOLEXPLOSION1__STATIC:
t->shade = -127; t->shade = -127;
t->cstat |= 8192+1024; t->clipdist |= TSPR_FLAGS_DRAW_LAST | TSPR_FLAGS_NO_SHADOW;
t->picnum += (pSprite->shade>>1); t->picnum += (pSprite->shade>>1);
break; break;
case PLAYERONWATER__STATIC: case PLAYERONWATER__STATIC: