mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-04-04 17:02:24 +00:00
455: Add speed increment timing (~EFFECT4) to FadeColormap
This commit is contained in:
parent
baf3aa5078
commit
5aa66f8872
3 changed files with 24 additions and 8 deletions
|
@ -1687,6 +1687,7 @@ static void SaveFadeColormapThinker(const thinker_t *th, const UINT8 type)
|
|||
WRITEUINT32(save_p, SaveSector(ht->sector));
|
||||
SaveExtraColormap(save_p, ht->source_exc);
|
||||
SaveExtraColormap(save_p, ht->dest_exc);
|
||||
WRITEUINT8(save_p, (UINT8)ht->ticbased);
|
||||
WRITEINT32(save_p, ht->duration);
|
||||
WRITEINT32(save_p, ht->timer);
|
||||
}
|
||||
|
@ -2686,6 +2687,7 @@ static inline void LoadFadeColormapThinker(actionf_p1 thinker)
|
|||
ht->sector = LoadSector(READUINT32(save_p));
|
||||
ht->source_exc = LoadExtraColormap(save_p);
|
||||
ht->dest_exc = LoadExtraColormap(save_p);
|
||||
ht->ticbased = (boolean)READUINT8(save_p);
|
||||
ht->duration = READINT32(save_p);
|
||||
ht->timer = READINT32(save_p);
|
||||
if (ht->sector)
|
||||
|
|
25
src/p_spec.c
25
src/p_spec.c
|
@ -105,7 +105,7 @@ static void Add_Pusher(pushertype_e type, fixed_t x_mag, fixed_t y_mag, mobj_t *
|
|||
static void Add_MasterDisappearer(tic_t appeartime, tic_t disappeartime, tic_t offset, INT32 line, INT32 sourceline);
|
||||
static void P_ResetColormapFader(sector_t *sector);
|
||||
static void Add_ColormapFader(sector_t *sector, extracolormap_t *source_exc, extracolormap_t *dest_exc,
|
||||
INT32 duration);
|
||||
boolean ticbased, INT32 duration);
|
||||
static void P_AddBlockThinker(sector_t *sec, line_t *sourceline);
|
||||
static void P_AddFloatThinker(sector_t *sec, INT32 tag, line_t *sourceline);
|
||||
//static void P_AddBridgeThinker(line_t *sourceline, sector_t *sec);
|
||||
|
@ -3445,7 +3445,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
|||
else
|
||||
Z_Free(exc);
|
||||
|
||||
Add_ColormapFader(§ors[secnum], source_exc, dest_exc,
|
||||
Add_ColormapFader(§ors[secnum], source_exc, dest_exc, (line->flags & ML_EFFECT4), // tic-based timing
|
||||
(line->sidenum[1] != 0xFFFF ? abs(sides[line->sidenum[1]].rowoffset >> FRACBITS) : abs(P_AproxDistance(line->dx, line->dy) >> FRACBITS)));
|
||||
}
|
||||
break;
|
||||
|
@ -7480,7 +7480,7 @@ static void P_ResetColormapFader(sector_t *sector)
|
|||
}
|
||||
|
||||
static void Add_ColormapFader(sector_t *sector, extracolormap_t *source_exc, extracolormap_t *dest_exc,
|
||||
INT32 duration)
|
||||
boolean ticbased, INT32 duration)
|
||||
{
|
||||
P_ResetColormapFader(sector);
|
||||
|
||||
|
@ -7496,7 +7496,18 @@ static void Add_ColormapFader(sector_t *sector, extracolormap_t *source_exc, ext
|
|||
d->sector = sector;
|
||||
d->source_exc = source_exc;
|
||||
d->dest_exc = dest_exc;
|
||||
d->duration = d->timer = duration;
|
||||
|
||||
if (ticbased)
|
||||
{
|
||||
d->ticbased = true;
|
||||
d->duration = d->timer = duration;
|
||||
}
|
||||
else
|
||||
{
|
||||
d->ticbased = false;
|
||||
d->timer = 256;
|
||||
d->duration = duration; // use as speed
|
||||
}
|
||||
|
||||
sector->fadecolormapdata = d;
|
||||
P_AddThinker(&d->thinker); // add thinker
|
||||
|
@ -7504,7 +7515,8 @@ static void Add_ColormapFader(sector_t *sector, extracolormap_t *source_exc, ext
|
|||
|
||||
void T_FadeColormap(fadecolormap_t *d)
|
||||
{
|
||||
if (--d->timer <= 0)
|
||||
if ((d->ticbased && --d->timer <= 0)
|
||||
|| (!d->ticbased && (d->timer -= d->duration) <= 0)) // d->duration used as speed decrement
|
||||
{
|
||||
d->sector->extra_colormap = d->dest_exc;
|
||||
P_ResetColormapFader(d->sector);
|
||||
|
@ -7512,7 +7524,8 @@ void T_FadeColormap(fadecolormap_t *d)
|
|||
else
|
||||
{
|
||||
extracolormap_t *exc;
|
||||
fixed_t factor = min(FixedDiv(d->duration - d->timer, d->duration), 1*FRACUNIT);
|
||||
INT32 duration = d->ticbased ? d->duration : 256;
|
||||
fixed_t factor = min(FixedDiv(duration - d->timer, duration), 1*FRACUNIT);
|
||||
INT16 cr, cg, cb, ca, fadestart, fadeend, fog;
|
||||
INT32 rgba, fadergba;
|
||||
|
||||
|
|
|
@ -461,8 +461,9 @@ typedef struct
|
|||
sector_t *sector; ///< Sector where action is taking place.
|
||||
extracolormap_t *source_exc;
|
||||
extracolormap_t *dest_exc;
|
||||
INT32 duration; ///< Total duration for tic-based logic
|
||||
INT32 timer; ///< Timer for tic-based logic
|
||||
boolean ticbased; ///< Tic-based timing
|
||||
INT32 duration; ///< Total duration for tic-based logic (OR: speed increment)
|
||||
INT32 timer; ///< Timer for tic-based logic (OR: internal speed counter)
|
||||
} fadecolormap_t;
|
||||
|
||||
void T_FadeColormap(fadecolormap_t *d);
|
||||
|
|
Loading…
Reference in a new issue