mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-18 07:22:28 +00:00
Replace firsttic with timer increment
This commit is contained in:
parent
3f4656e57e
commit
573e1d0017
4 changed files with 11 additions and 17 deletions
|
@ -2873,9 +2873,9 @@ void T_PolyObjFade(polyfade_t *th)
|
|||
if (po->thinker == NULL)
|
||||
po->thinker = &th->thinker;
|
||||
|
||||
stillfading = !(gametic - th->firsttic >= th->duration);
|
||||
stillfading = !(--(th->timer) <= 0);
|
||||
|
||||
if (gametic - th->firsttic >= th->duration)
|
||||
if (th->timer <= 0)
|
||||
{
|
||||
po->translucency = th->destvalue; // set to dest translucency
|
||||
|
||||
|
@ -2884,7 +2884,7 @@ void T_PolyObjFade(polyfade_t *th)
|
|||
po->thinker = NULL;
|
||||
P_RemoveThinker(&th->thinker);
|
||||
}
|
||||
else if (!((gametic - th->firsttic) % th->interval))
|
||||
else if (!(th->timer % th->interval))
|
||||
{
|
||||
if (th->speed <= 0)
|
||||
po->translucency = max(po->translucency + th->speed, th->destvalue);
|
||||
|
@ -2968,10 +2968,9 @@ INT32 EV_DoPolyObjFade(polyfadedata_t *pfdata)
|
|||
th->destvalue = pfdata->destvalue;
|
||||
th->docollision = pfdata->docollision;
|
||||
th->doghostfade = pfdata->doghostfade;
|
||||
th->duration = pfdata->duration;
|
||||
th->timer = pfdata->timer;
|
||||
th->speed = pfdata->speed;
|
||||
th->interval = pfdata->interval;
|
||||
th->firsttic = pfdata->firsttic;
|
||||
|
||||
oldpo = po;
|
||||
|
||||
|
|
|
@ -215,10 +215,9 @@ typedef struct polyfade_s
|
|||
INT32 destvalue;
|
||||
boolean docollision;
|
||||
boolean doghostfade;
|
||||
UINT32 duration;
|
||||
INT32 timer;
|
||||
INT32 speed;
|
||||
UINT32 interval;
|
||||
tic_t firsttic;
|
||||
} polyfade_t;
|
||||
|
||||
//
|
||||
|
@ -286,10 +285,9 @@ typedef struct polyfadedata_s
|
|||
INT32 destvalue;
|
||||
boolean docollision;
|
||||
boolean doghostfade;
|
||||
UINT32 duration;
|
||||
INT32 timer;
|
||||
INT32 speed;
|
||||
UINT32 interval;
|
||||
tic_t firsttic;
|
||||
} polyfadedata_t;
|
||||
|
||||
//
|
||||
|
|
|
@ -1708,10 +1708,9 @@ static void SavePolyfadeThinker(const thinker_t *th, const UINT8 type)
|
|||
WRITEINT32(save_p, ht->destvalue);
|
||||
WRITEUINT8(save_p, (UINT8)ht->docollision);
|
||||
WRITEUINT8(save_p, (UINT8)ht->doghostfade);
|
||||
WRITEUINT32(save_p, ht->duration);
|
||||
WRITEINT32(save_p, ht->timer);
|
||||
WRITEINT32(save_p, ht->speed);
|
||||
WRITEUINT32(save_p, ht->interval);
|
||||
WRITEUINT32(save_p, (UINT32)ht->firsttic);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -2723,10 +2722,9 @@ static void LoadPolyfadeThinker(actionf_p1 thinker)
|
|||
ht->destvalue = READINT32(save_p);
|
||||
ht->docollision = (boolean)READUINT8(save_p);
|
||||
ht->doghostfade = (boolean)READUINT8(save_p);
|
||||
ht->duration = READUINT32(save_p);
|
||||
ht->timer = READINT32(save_p);
|
||||
ht->speed = READINT32(save_p);
|
||||
ht->interval = READUINT32(save_p);
|
||||
ht->firsttic = (tic_t)READUINT32(save_p);
|
||||
P_AddThinker(&ht->thinker);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1276,12 +1276,11 @@ static boolean PolyFade(line_t *line)
|
|||
pfd.docollision = !(line->flags & ML_BOUNCY), // do not handle collision flags
|
||||
pfd.doghostfade = (line->flags & ML_EFFECT1), // do ghost fade (no collision flags during fade)
|
||||
|
||||
pfd.duration = abs(sides[line->sidenum[0]].rowoffset>>FRACBITS);
|
||||
pfd.speed = FixedFloor(FixedDiv(pfd.destvalue - po->translucency, pfd.duration))/FRACUNIT;
|
||||
pfd.timer = abs(sides[line->sidenum[0]].rowoffset>>FRACBITS);
|
||||
pfd.speed = FixedFloor(FixedDiv(pfd.destvalue - po->translucency, pfd.timer))/FRACUNIT;
|
||||
if (!pfd.speed)
|
||||
pfd.speed = (pfd.destvalue < po->translucency) ? -1 : 1;
|
||||
pfd.interval = max(FixedFloor(FixedDiv(pfd.duration, abs(pfd.destvalue - po->translucency)))/FRACUNIT, 1);
|
||||
pfd.firsttic = gametic;
|
||||
pfd.interval = max(FixedFloor(FixedDiv(pfd.timer, abs(pfd.destvalue - po->translucency)))/FRACUNIT, 1);
|
||||
|
||||
return EV_DoPolyObjFade(&pfd);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue