Skip to content

Commit

Permalink
Reformatting
Browse files Browse the repository at this point in the history
  • Loading branch information
MrAlaux committed Nov 25, 2023
1 parent 25f9410 commit 541b255
Show file tree
Hide file tree
Showing 4 changed files with 178 additions and 186 deletions.
42 changes: 25 additions & 17 deletions src/f_wipe.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,15 @@ static int wipe_doColorXForm(int width, int height, int ticks)
ticks >>= hires;
ticks = MAX(1, ticks);

for (;w != end; w++, e++) {
if (*w != *e) {
int newval;
unchanged = false;
*w = *w > *e ? (newval = *w - ticks) < *e
? *e : newval
: (newval = *w + ticks) > *e
? *e : newval ;
}
}
for (;w != end; w++, e++)
if (*w != *e)
{
int newval;
unchanged = false;
*w = *w > *e ?
(newval = *w - ticks) < *e ? *e : newval :
(newval = *w + ticks) > *e ? *e : newval ;
}
return unchanged;
}

Expand Down Expand Up @@ -163,7 +162,7 @@ static int wipe_exitMelt(int width, int height, int ticks)
return 0;
}

// [Nugget] "Fade" wipe
// [Nugget] "Fade" wipe /-----------------------------------------------------

static boolean fadeIn;

Expand All @@ -186,18 +185,24 @@ static int wipe_doFade(int width, int height, int ticks)

memcpy(wipe_scr, fadeIn ? wipe_scr_end : wipe_scr_start, width * height);

for (y = 0; y < width * height; y++)
{ wipe_scr[y] = colormaps[0][screenshade * 256 + wipe_scr[y]]; }
for (y = 0; y < width * height; y++)
{ wipe_scr[y] = colormaps[0][(screenshade * 256) + wipe_scr[y]]; }

if (!fadeIn)
{
// Fade out to black

if (!fadeIn) { // Fade out to black
screenshade += ticks;

if (screenshade > targshade) {
screenshade = targshade;
fadeIn = true;
}
}
else { // Fade in from black
else
{
// Fade in from black

screenshade -= ticks;

if (screenshade < 1) {
Expand All @@ -214,6 +219,8 @@ static int wipe_exitFade(int width, int height, int ticks)
return 0;
}

// [Nugget] -----------------------------------------------------------------/

int wipe_StartScreen(int x, int y, int width, int height)
{
I_ReadScreen(wipe_scr_start = screens[2]);
Expand All @@ -229,17 +236,18 @@ int wipe_EndScreen(int x, int y, int width, int height)

// [Nugget] Rearranged for convenience
static int (*const wipes[])(int, int, int) = {
0, 0, 0, // [Nugget]
0, 0, 0, // [Nugget] Dummies for "no wipe"
wipe_initMelt,
wipe_doMelt,
wipe_exitMelt,
wipe_initColorXForm,
wipe_doColorXForm,
wipe_exitColorXForm,
// [Nugget] All of the following:
// [Nugget] "Fade" wipe /------------
wipe_initFade,
wipe_doFade,
wipe_exitFade
// [Nugget] ------------------------/
};

// killough 3/5/98: reformatted and cleaned up
Expand Down
Loading

0 comments on commit 541b255

Please sign in to comment.