Move fadingdata (fade_t thinker) to line_t
This commit is contained in:
parent
cf853e3982
commit
2e252cb905
|
@ -2578,8 +2578,8 @@ static inline void LoadFadeThinker(actionf_p1 thinker)
|
||||||
ht->doghostfade = READUINT8(save_p);
|
ht->doghostfade = READUINT8(save_p);
|
||||||
|
|
||||||
line_t *ffloorline = LoadLine(ht->affectee);
|
line_t *ffloorline = LoadLine(ht->affectee);
|
||||||
if (ffloorline && ffloorline->frontsector)
|
if (ffloorline)
|
||||||
ffloorline->frontsector->fadingdata = ht;
|
ffloorline->fadingdata = ht;
|
||||||
|
|
||||||
P_AddThinker(&ht->thinker);
|
P_AddThinker(&ht->thinker);
|
||||||
}
|
}
|
||||||
|
@ -2770,7 +2770,13 @@ static void P_NetUnArchiveThinkers(void)
|
||||||
// clear sector thinker pointers so they don't point to non-existant thinkers for all of eternity
|
// clear sector thinker pointers so they don't point to non-existant thinkers for all of eternity
|
||||||
for (i = 0; i < numsectors; i++)
|
for (i = 0; i < numsectors; i++)
|
||||||
{
|
{
|
||||||
sectors[i].floordata = sectors[i].ceilingdata = sectors[i].lightingdata = sectors[i].fadingdata = NULL;
|
sectors[i].floordata = sectors[i].ceilingdata = sectors[i].lightingdata = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// same for line thinker pointers
|
||||||
|
for (i = 0; i < numlines; i++)
|
||||||
|
{
|
||||||
|
lines[i].fadingdata = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// read in saved thinkers
|
// read in saved thinkers
|
||||||
|
|
|
@ -693,7 +693,6 @@ static void P_LoadRawSectors(UINT8 *data, size_t i)
|
||||||
ss->floordata = NULL;
|
ss->floordata = NULL;
|
||||||
ss->ceilingdata = NULL;
|
ss->ceilingdata = NULL;
|
||||||
ss->lightingdata = NULL;
|
ss->lightingdata = NULL;
|
||||||
ss->fadingdata = NULL;
|
|
||||||
|
|
||||||
ss->linecount = 0;
|
ss->linecount = 0;
|
||||||
ss->lines = NULL;
|
ss->lines = NULL;
|
||||||
|
@ -1311,6 +1310,8 @@ static void P_LoadRawLineDefs(UINT8 *data, size_t i)
|
||||||
#ifdef POLYOBJECTS
|
#ifdef POLYOBJECTS
|
||||||
ld->polyobj = NULL;
|
ld->polyobj = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
ld->fadingdata = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
132
src/p_spec.c
132
src/p_spec.c
|
@ -3103,43 +3103,91 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
||||||
|
|
||||||
case 452: // Fade FOF
|
case 452: // Fade FOF
|
||||||
{
|
{
|
||||||
INT32 s, j;
|
INT16 destvalue = (INT16)(sides[line->sidenum[1]].textureoffset>>FRACBITS);
|
||||||
for (s = -1; (s = P_FindSectorFromLineTag(line, s)) >= 0 ;)
|
INT16 speed = (INT16)(sides[line->sidenum[1]].rowoffset>>FRACBITS);
|
||||||
for (j = 0; (unsigned)j < sectors[s].linecount; j++)
|
INT16 sectag = (INT16)(sides[line->sidenum[0]].textureoffset>>FRACBITS);
|
||||||
if (sectors[s].lines[j]->special >= 100 && sectors[s].lines[j]->special < 300)
|
INT16 foftag = (INT16)(sides[line->sidenum[0]].rowoffset>>FRACBITS);
|
||||||
{
|
sector_t *sec; // Sector that the FOF is visible in
|
||||||
if (sides[line->sidenum[0]].rowoffset>>FRACBITS > 0)
|
ffloor_t *rover; // FOF that we are going to crumble
|
||||||
P_AddMasterFader(sides[line->sidenum[0]].textureoffset>>FRACBITS,
|
|
||||||
sides[line->sidenum[0]].rowoffset>>FRACBITS,
|
for (secnum = -1; (secnum = P_FindSectorFromTag(sectag, secnum)) >= 0 ;)
|
||||||
(line->flags & ML_BLOCKMONSTERS), // handle FF_EXISTS
|
{
|
||||||
!(line->flags & ML_NOCLIMB), // do not handle FF_TRANSLUCENT
|
sec = sectors + secnum;
|
||||||
(line->flags & ML_BOUNCY), // handle FF_SOLID
|
|
||||||
(line->flags & ML_EFFECT1), // handle spawnflags
|
if (!sec->ffloors)
|
||||||
(line->flags & ML_EFFECT2), // enable flags on fade-in finish only
|
{
|
||||||
(INT32)(sectors[s].lines[j]-lines));
|
CONS_Debug(DBG_GAMELOGIC, "Line type 452 Executor: Target sector #%d has no FOFs.\n", secnum);
|
||||||
else
|
return;
|
||||||
{
|
}
|
||||||
P_RemoveFading(&lines[(INT32)(sectors[s].lines[j]-lines)]);
|
|
||||||
P_FindFakeFloorsDoAlpha(sides[line->sidenum[0]].textureoffset>>FRACBITS,
|
for (rover = sec->ffloors; rover; rover = rover->next)
|
||||||
0, // set alpha immediately
|
{
|
||||||
(line->flags & ML_BLOCKMONSTERS), // handle FF_EXISTS
|
if (rover->master->frontsector->tag == foftag)
|
||||||
!(line->flags & ML_NOCLIMB), // do not handle FF_TRANSLUCENT
|
break;
|
||||||
(line->flags & ML_BOUNCY), // handle FF_SOLID
|
}
|
||||||
(line->flags & ML_EFFECT1), // handle spawnflags
|
|
||||||
(line->flags & ML_EFFECT2), // enable flags on fade-in finish only
|
if (!rover)
|
||||||
(INT32)(sectors[s].lines[j]-lines));
|
{
|
||||||
}
|
CONS_Debug(DBG_GAMELOGIC, "Line type 452 Executor: Can't find a FOF control sector with tag %d\n", foftag);
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (speed > 0)
|
||||||
|
P_AddMasterFader(destvalue, speed,
|
||||||
|
(line->flags & ML_BLOCKMONSTERS), // handle FF_EXISTS
|
||||||
|
!(line->flags & ML_NOCLIMB), // do not handle FF_TRANSLUCENT
|
||||||
|
(line->flags & ML_BOUNCY), // handle FF_SOLID
|
||||||
|
(line->flags & ML_EFFECT1), // handle spawnflags
|
||||||
|
(line->flags & ML_EFFECT2), // enable flags on fade-in finish only
|
||||||
|
(INT32)(rover->master-lines));
|
||||||
|
else
|
||||||
|
{
|
||||||
|
P_RemoveFading(&lines[(INT32)(rover->master-lines)]);
|
||||||
|
P_FindFakeFloorsDoAlpha(destvalue, 0, // set alpha immediately
|
||||||
|
(line->flags & ML_BLOCKMONSTERS), // handle FF_EXISTS
|
||||||
|
!(line->flags & ML_NOCLIMB), // do not handle FF_TRANSLUCENT
|
||||||
|
(line->flags & ML_BOUNCY), // handle FF_SOLID
|
||||||
|
(line->flags & ML_EFFECT1), // handle spawnflags
|
||||||
|
(line->flags & ML_EFFECT2), // enable flags on fade-in finish only
|
||||||
|
(INT32)(rover->master-lines));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 453: // Stop fading FOF
|
case 453: // Stop fading FOF
|
||||||
{
|
{
|
||||||
INT32 s, j;
|
INT16 sectag = (INT16)(sides[line->sidenum[0]].textureoffset>>FRACBITS);
|
||||||
for (s = -1; (s = P_FindSectorFromLineTag(line, s)) >= 0 ;)
|
INT16 foftag = (INT16)(sides[line->sidenum[0]].rowoffset>>FRACBITS);
|
||||||
for (j = 0; (unsigned)j < sectors[s].linecount; j++)
|
sector_t *sec; // Sector that the FOF is visible in
|
||||||
if (sectors[s].lines[j]->special >= 100 && sectors[s].lines[j]->special < 300)
|
ffloor_t *rover; // FOF that we are going to crumble
|
||||||
P_RemoveFading(&lines[(INT32)(sectors[s].lines[j]-lines)]);
|
|
||||||
|
for (secnum = -1; (secnum = P_FindSectorFromTag(sectag, secnum)) >= 0 ;)
|
||||||
|
{
|
||||||
|
sec = sectors + secnum;
|
||||||
|
|
||||||
|
if (!sec->ffloors)
|
||||||
|
{
|
||||||
|
CONS_Debug(DBG_GAMELOGIC, "Line type 453 Executor: Target sector #%d has no FOFs.\n", secnum);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (rover = sec->ffloors; rover; rover = rover->next)
|
||||||
|
{
|
||||||
|
if (rover->master->frontsector->tag == foftag)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!rover)
|
||||||
|
{
|
||||||
|
CONS_Debug(DBG_GAMELOGIC, "Line type 453 Executor: Can't find a FOF control sector with tag %d\n", foftag);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
P_RemoveFading(&lines[(INT32)(rover->master-lines)]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7151,25 +7199,13 @@ void T_Disappear(disappear_t *d)
|
||||||
*/
|
*/
|
||||||
static void P_ResetFading(line_t *line, fade_t *data)
|
static void P_ResetFading(line_t *line, fade_t *data)
|
||||||
{
|
{
|
||||||
ffloor_t *rover;
|
|
||||||
register INT32 s;
|
|
||||||
|
|
||||||
// find any existing thinkers and remove them, then replace with new data
|
// find any existing thinkers and remove them, then replace with new data
|
||||||
for (s = -1; (s = P_FindSectorFromLineTag(line, s)) >= 0 ;)
|
if(((fade_t *)line->fadingdata) != data)
|
||||||
{
|
{
|
||||||
for (rover = sectors[s].ffloors; rover; rover = rover->next)
|
if(&((fade_t *)line->fadingdata)->thinker)
|
||||||
{
|
P_RemoveThinker(&((fade_t *)line->fadingdata)->thinker);
|
||||||
if (rover->master != line)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if(((fade_t *)rover->master->frontsector->fadingdata) != data)
|
line->fadingdata = data;
|
||||||
{
|
|
||||||
if(&((fade_t *)rover->master->frontsector->fadingdata)->thinker)
|
|
||||||
P_RemoveThinker(&((fade_t *)rover->master->frontsector->fadingdata)->thinker);
|
|
||||||
|
|
||||||
rover->master->frontsector->fadingdata = data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -308,7 +308,6 @@ typedef struct sector_s
|
||||||
void *floordata; // floor move thinker
|
void *floordata; // floor move thinker
|
||||||
void *ceilingdata; // ceiling move thinker
|
void *ceilingdata; // ceiling move thinker
|
||||||
void *lightingdata; // lighting change thinker
|
void *lightingdata; // lighting change thinker
|
||||||
void *fadingdata; // fading FOF thinker
|
|
||||||
|
|
||||||
// floor and ceiling texture offsets
|
// floor and ceiling texture offsets
|
||||||
fixed_t floor_xoffs, floor_yoffs;
|
fixed_t floor_xoffs, floor_yoffs;
|
||||||
|
@ -444,6 +443,8 @@ typedef struct line_s
|
||||||
|
|
||||||
char *text; // a concatination of all front and back texture names, for linedef specials that require a string.
|
char *text; // a concatination of all front and back texture names, for linedef specials that require a string.
|
||||||
INT16 callcount; // no. of calls left before triggering, for the "X calls" linedef specials, defaults to 0
|
INT16 callcount; // no. of calls left before triggering, for the "X calls" linedef specials, defaults to 0
|
||||||
|
|
||||||
|
void *fadingdata; // fading FOF thinker
|
||||||
} line_t;
|
} line_t;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in a new issue