Assign light SEs (lotags 49 and 50) to an exclusive status number. EXPERIMENTAL!

The primary reason for doing this is that handing of moving sectors is
significantly simplified. Because moving sectors usually don't move containing
SEs/effector-statnum sprites, no special handing code is needed to move light
SEs with them. Thus, this commit sets light SEs to a new statnum when they're
spawned *from premap*, and a new G_Move*-like function (called G_DoPolymerLights)
is added to process every sprite in that status list.

This should "fix" light SEs moving together with a variety of moving sectors,
but CON programs expecting the old behavior may break, therefore this commit is
marked as experimental.

Additionally, a problem with the old implementation is identified: it seems like
the correct functioning is dependent upon the order of processing between the
sector movement effector and the light SE, so this makes it another good reason
for the change.  (A third one is that all lights can be processed with a per-
statnum loop, but CON coders should not do this until the change is considered
final).

git-svn-id: https://svn.eduke32.com/eduke32@2646 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2012-05-06 21:01:52 +00:00
parent 2cef17641a
commit 144897d524
5 changed files with 38 additions and 22 deletions

View file

@ -664,7 +664,6 @@ void Sect_ClearInterpolation(int32_t sectnum)
static int32_t move_fixed_sprite(int32_t j, int32_t pivotspr, int32_t daang)
{
if ((FIXSPR_STATNUMP(sprite[j].statnum) ||
(sprite[j].picnum==SECTOREFFECTOR && (sprite[j].lotag==49||sprite[j].lotag==50)) ||
((sprite[j].statnum==1 || sprite[j].statnum==2) && (ActorType[sprite[j].picnum]&4)))
&& actor[j].t_data[7]==(0x18190000|pivotspr))
{
@ -5668,7 +5667,7 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
{
// that hardcoded SE light behavior here should be considered temporary at best...
// really need some more general system for handling them!
if ((sprite[p].statnum != STAT_EFFECTOR || (sprite[p].lotag==49||sprite[p].lotag==50))
if ((sprite[p].statnum != STAT_EFFECTOR)
&& sprite[p].statnum != STAT_PROJECTILE)
if (sprite[p].picnum != LASERLINE)
{
@ -5700,7 +5699,7 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
for (p=headspritesect[s->sectnum]; p>=0; p=nextspritesect[p])
{
// keep this conditional in sync with above!
if ((sprite[p].statnum != STAT_EFFECTOR || (sprite[p].lotag==49||sprite[p].lotag==50))
if ((sprite[p].statnum != STAT_EFFECTOR)
&& sprite[p].statnum != STAT_PROJECTILE)
if (sprite[p].picnum != LASERLINE)
{
@ -7626,7 +7625,33 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
A_SetSprite(k,CLIPMASK0);
}
break;
}
BOLT:
i = nexti;
}
//Sloped sin-wave floors!
for (i=headspritestat[STAT_EFFECTOR]; i>=0; i=nextspritestat[i])
{
const spritetype *s = &sprite[i];
sectortype *sc;
if (s->lotag != 29) continue;
sc = &sector[s->sectnum];
if (sc->wallnum != 4) continue;
wal = &wall[sc->wallptr+2];
alignflorslope(s->sectnum,wal->x,wal->y,sector[wal->nextsector].floorz);
}
}
static void G_DoPolymerLights(void) // STATNUM 14
{
int32_t i;
for (i=headspritestat[STAT_LIGHT]; i>=0; i=nextspritestat[i])
{
switch (sprite[i].lotag)
{
#ifdef POLYMER
case 49:
{
@ -7777,23 +7802,7 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
break;
}
#endif // POLYMER
}
BOLT:
i = nexti;
}
//Sloped sin-wave floors!
for (i=headspritestat[STAT_EFFECTOR]; i>=0; i=nextspritestat[i])
{
const spritetype *s = &sprite[i];
sectortype *sc;
if (s->lotag != 29) continue;
sc = &sector[s->sectnum];
if (sc->wallnum != 4) continue;
wal = &wall[sc->wallptr+2];
alignflorslope(s->sectnum,wal->x,wal->y,sector[wal->nextsector].floorz);
}
}
@ -7987,6 +7996,11 @@ void G_MoveWorld(void)
G_MoveMisc(); //ST 5
G_MoveActors(); //ST 1
// XXX: Has to be before effectors, in particular movers?
// TODO: lights in moving sectors ought to be interpolated
G_DoPolymerLights();
G_MoveEffectors(); //ST 3
G_MoveStandables(); //ST 6

View file

@ -41,6 +41,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define STAT_FX 11
#define STAT_FALLER 12
#define STAT_DUMMYPLAYER 13
#define STAT_LIGHT 14
// Defines the motion characteristics of an actor
enum amoveflags_t {

View file

@ -96,7 +96,8 @@ extern "C" {
#define TILE_VIEWSCR (MAXTILES-5)
// sprites with these statnums should be considered for fixing (bitmap)
#define FIXSPR_STATNUMP(k) ((k)==STAT_DEFAULT || (k)==STAT_STANDABLE || ((k)==STAT_FX) || ((k)==STAT_FALLER))
#define FIXSPR_STATNUMP(k) ((k)==STAT_DEFAULT || (k)==STAT_STANDABLE || (k)==STAT_FX || \
(k)==STAT_FALLER || (k)==STAT_LIGHT)
// JBF 20040604: sync is a function on some platforms
#define sync dsync

View file

@ -5349,6 +5349,7 @@ int32_t A_Spawn(int32_t j, int32_t pn)
break;
case 46:
ror_protectedsectors[sp->sectnum] = 1;
/* XXX: fall-through intended? */
case 49:
case 50:
{
@ -5358,7 +5359,7 @@ int32_t A_Spawn(int32_t j, int32_t pn)
if (sprite[j].picnum == ACTIVATOR || sprite[j].picnum == ACTIVATORLOCKED)
actor[i].flags |= SPRITE_USEACTIVATOR;
}
changespritestat(i, STAT_EFFECTOR);
changespritestat(i, sp->lotag==46 ? STAT_EFFECTOR : STAT_LIGHT);
goto SPAWN_END;
break;
}

View file

@ -1069,7 +1069,6 @@ static void premap_setup_fixed_sprites(void)
// TRIPBOMB uses t_data[7] for its own purposes. Wouldn't be
// too useful with moving sectors anyway
if ((FIXSPR_STATNUMP(sprite[j].statnum) && sprite[j].picnum!=TRIPBOMB) ||
(sprite[j].picnum==SECTOREFFECTOR && (sprite[j].lotag==49||sprite[j].lotag==50)) ||
((sprite[j].statnum==1 || sprite[j].statnum==2) && (ActorType[sprite[j].picnum]&4)))
{
pivot = i;