Skip to content

Commit

Permalink
Reimplement alternative intermission background
Browse files Browse the repository at this point in the history
Now, instead of using a static snapshot, the background is animated by means of spinning the camera in place.

Also reduced darkening factor and FOV.

Additionally, some reformatting.
  • Loading branch information
MrAlaux committed Dec 26, 2023
1 parent a2f73f0 commit 9e0f3d3
Show file tree
Hide file tree
Showing 10 changed files with 99 additions and 103 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ For these settings, their CVAR names are provided alongside the _CFG-Only_ label
- **_Fake Contrast_** setting
- Toggle for **Diminished Lighting** (CFG-Only: `diminished_lighting`)
- **_Screen Wipe speed percentage_** setting
- **_Alternative Intermission Background_** setting, to replace the intermission graphic with a darkened snapshot of the player's rear view
- **_Alternative Intermission Background_** setting, to replace the intermission graphic with a darkened spinning camera view
- **_Sound Clipping Distance_** selection, to optionally double the distance at which SFX become audible
- **_Organize Saves by IWAD_** setting
- **_One-Key Quick Save/Load_** setting, to skip the confirmation prompt
Expand Down
11 changes: 10 additions & 1 deletion src/g_game.c
Original file line number Diff line number Diff line change
Expand Up @@ -829,11 +829,20 @@ static void G_DoLoadLevel(void)
}
}

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

// Minimap
if (minimap_was_on) {
AM_ChangeMode(AM_MINI);
minimap_was_on = false;
}

// Alt. intermission background
if (STRICTMODE(alt_interpic)) {
fovchange = true;
R_SetViewSize(screenblocks);
R_ExecuteSetViewSize();
}
}

extern int ddt_cheating;
Expand Down
12 changes: 5 additions & 7 deletions src/hu_stuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -1622,15 +1622,13 @@ void HU_UpdateCrosshairLock(int x, int y)

void HU_DrawCrosshair(void)
{
// [Nugget] Change conditions
// [Nugget] Removed some conditions
if (plr->playerstate != PST_LIVE
|| automapactive == AM_FULL
/* || menuactive
|| paused
|| secret_on */
// [Nugget]
|| !crosshair.cr
|| (chasecam_mode && !chasecam_crosshair)
// [Nugget] New conditions
|| !crosshair.cr // Crash fix
|| (chasecam_mode && !chasecam_crosshair) // Chasecam
|| (gamestate == GS_INTERMISSION) // Alt. intermission background
)
{
return;
Expand Down
7 changes: 3 additions & 4 deletions src/i_video.c
Original file line number Diff line number Diff line change
Expand Up @@ -1535,11 +1535,10 @@ void I_ResetScreen(void)

ST_Start(); // Reset palette

if (gamestate == GS_INTERMISSION)
if (gamestate == GS_INTERMISSION
&& !STRICTMODE(alt_interpic)) // [Nugget] Alt. intermission background
{
// [Nugget] Alt. intermission background:
// use `WI_slamBackground()` directly
WI_slamBackground();
WI_DrawBackground();
}

M_ResetSetupMenuVideo();
Expand Down
30 changes: 21 additions & 9 deletions src/m_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -4930,16 +4930,20 @@ setup_menu_t gen_settings6[] = {
{0,S_SKIP|S_END,m_null}
};

static const char *fake_contrast_styles[] = {
"Off", "Smooth", "Vanilla", NULL
};
void M_ToggleAltInterpic(void)
{
if (gamestate == GS_INTERMISSION)
{
if (!STRICTMODE(alt_interpic))
{ R_SetViewSize(screenblocks); }

static const char *s_clipping_dists[] = {
"1200", "2400", NULL
};
fovchange = true;
R_ExecuteSetViewSize();
}
}

static const char *page_ticking_conds[] = {
"Always", "Not In Menus", "Never", NULL
static const char *fake_contrast_styles[] = {
"Off", "Smooth", "Vanilla", NULL
};

setup_menu_t gen_settings7[] = {
Expand All @@ -4954,7 +4958,7 @@ setup_menu_t gen_settings7[] = {
{"Bonus Tint Cap", S_NUM |S_STRICT, m_null, M_X, M_Y + gen7_boncountcap * M_SPC, {"bonuscount_cap"}},
{"Fake Contrast", S_CHOICE|S_STRICT, m_null, M_X, M_Y + gen7_fakecontrast * M_SPC, {"fake_contrast"}, 0, NULL, fake_contrast_styles},
{"Screen Wipe Speed Percentage", S_NUM |S_STRICT, m_null, M_X, M_Y + gen7_wipespeed * M_SPC, {"wipe_speed_percentage"}},
{"Alt. Intermission Background", S_YESNO |S_STRICT, m_null, M_X, M_Y + gen7_altinterpic * M_SPC, {"alt_interpic"}},
{"Alt. Intermission Background", S_YESNO |S_STRICT, m_null, M_X, M_Y + gen7_altinterpic * M_SPC, {"alt_interpic"}, 0, M_ToggleAltInterpic},

{"<- PREV", S_SKIP|S_PREV, m_null, M_X_PREV, M_Y_PREVNEXT, {gen_settings6}},
{"NEXT ->", S_SKIP|S_NEXT, m_null, M_X_NEXT, M_Y_PREVNEXT, {gen_settings8}},
Expand All @@ -4964,6 +4968,14 @@ setup_menu_t gen_settings7[] = {
{0,S_SKIP|S_END,m_null}
};

static const char *s_clipping_dists[] = {
"1200", "2400", NULL
};

static const char *page_ticking_conds[] = {
"Always", "Not In Menus", "Never", NULL
};

setup_menu_t gen_settings8[] = { // [Nugget]

{"Nugget - Miscellaneous", S_SKIP|S_TITLE, m_null, M_X, M_Y + gen8_title1 * M_SPC},
Expand Down
2 changes: 1 addition & 1 deletion src/m_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,7 @@ default_t defaults[] = {
"alt_interpic",
(config_t *) &alt_interpic, NULL,
{0}, {0,1}, number, ss_gen, wad_yes,
"Alternative intermission background (darkened rear-view snapshot)"
"Alternative intermission background (spinning camera view)"
},

{
Expand Down
43 changes: 37 additions & 6 deletions src/r_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,10 @@ void R_ExecuteSetViewSize (void)

setsizeneeded = false;

// [Nugget] Alt. intermission background
if (STRICTMODE(alt_interpic) && (gamestate == GS_INTERMISSION))
{ setblocks = 11; }

if (setblocks >= 11) // [Nugget] Crispy minimalistic HUD
{
scaledviewwidth_nonwide = NONWIDEWIDTH;
Expand Down Expand Up @@ -712,7 +716,9 @@ void R_ExecuteSetViewSize (void)
for (i = 0; i < NUMFOVFX; i++)
{ fx += fovfx[i].current; }

rfov = bfov + fx;
rfov = (STRICTMODE(alt_interpic) && (gamestate == GS_INTERMISSION))
? 150 : bfov + fx;

fovdiff = (float) ORIGFOV / rfov;
pitchmax = PITCHMAX * FOVDIFF2; // Mitigate `PLAYER_SLOPE()` and `lookdir` misalignment
}
Expand Down Expand Up @@ -875,6 +881,7 @@ void R_SetupFrame (player_t *player)
int tempCentery, pitch;
// [Nugget]
int playerz, lookdir;
static angle_t old_interangle, target_interangle;
static fixed_t chasecamheight;

viewplayer = player;
Expand Down Expand Up @@ -912,10 +919,29 @@ void R_SetupFrame (player_t *player)
pitch = lookdir + player->recoilpitch + player->impactpitch; // [Nugget]
}

// [Nugget] Mitigate `PLAYER_SLOPE()` and `lookdir` misalignment
pitch *= FOVDIFF2;
// [Nugget]
// Alt. intermission background
if (STRICTMODE(alt_interpic) && (gamestate == GS_INTERMISSION))
{
static int oldtic = -1;

if (oldtic != gametic) {
old_interangle = viewangle = target_interangle + viewangleoffset;
target_interangle += ANG1;
}
else if (uncapped) // Currently not functional, since the framerate is capped during intermissions
{ viewangle = R_InterpolateAngle(old_interangle, target_interangle, fractionaltic) + viewangleoffset; }

oldtic = gametic;

if (STRICTMODE(st_crispyhud)) { pitch += nughud.viewoffset; } // [Nugget] NUGHUD
pitch = 0;
}
else {
target_interangle = viewangle + viewangleoffset;

pitch *= FOVDIFF2; // Mitigate `PLAYER_SLOPE()` and `lookdir` misalignment
if (STRICTMODE(st_crispyhud)) { pitch += nughud.viewoffset; } // NUGHUD
}

// [Nugget] Explosion shake effect
chasecamheight = chasecam_height * FRACUNIT;
Expand Down Expand Up @@ -944,8 +970,11 @@ void R_SetupFrame (player_t *player)
chasecamheight += zofs;
}

// [Nugget] Chasecam
chasecam_on = STRICTMODE(chasecam_mode || (death_camera && player->mo->health <= 0 && player->playerstate == PST_DEAD));
// [Nugget] Chasecam /------------------------------------------------------

chasecam_on = STRICTMODE(chasecam_mode || (death_camera && player->mo->health <= 0 && player->playerstate == PST_DEAD))
&& !(alt_interpic && (gamestate == GS_INTERMISSION));

if (chasecam_on)
{
static fixed_t oldextradist = 0, extradist = 0;
Expand Down Expand Up @@ -1017,6 +1046,8 @@ void R_SetupFrame (player_t *player)
}
else { chasexofs = chaseyofs = chaseaofs = 0; }

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

// [Nugget]: [crispy] A11Y
if (!NOTSTRICTMODE(a11y_weapon_flash))
extralight = 0;
Expand Down
5 changes: 4 additions & 1 deletion src/r_things.c
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,10 @@ void R_DrawPSprite (pspdef_t *psp, boolean translucent) // [Nugget] Translucent
vis->texturemid += (centery - viewheight/2) * pspriteiscale
- (STRICTMODE(st_crispyhud) ? nughud.weapheight*FRACUNIT : 0); // [Nugget] NUGHUD

if (STRICTMODE(hide_weapon || chasecam_on)) // [Nugget] Chasecam
if (STRICTMODE(hide_weapon)
// [Nugget]
|| chasecam_on // Chasecam
|| (STRICTMODE(alt_interpic) && (gamestate == GS_INTERMISSION))) // Alt. intermission background
return;

R_DrawVisSprite(vis, vis->x1, vis->x2);
Expand Down
88 changes: 17 additions & 71 deletions src/wi_stuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -382,17 +382,6 @@ static int num_lnames;

static const char *exitpic, *enterpic;

// [Nugget] Alt. intermission background /------------------------------------

struct {
byte *pic; // The snapshot itself
int old_hires, old_widescreen;
} intersnapshot = { NULL, -1, -1 };

#define ALTINTERPIC (STRICTMODE(alt_interpic) && intersnapshot.pic)

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

//
// CODE
//
Expand All @@ -404,27 +393,23 @@ struct {
// Args: none
// Returns: void
//
// [Nugget] Not static anymore
void WI_slamBackground(void)
static void WI_slamBackground(void)
{
// [Nugget] Alt. intermission background
if (ALTINTERPIC && (intersnapshot.old_hires == hires)
&& (intersnapshot.old_widescreen == widescreen))
if (STRICTMODE(alt_interpic))
{
memcpy(screens[1], intersnapshot.pic, (SCREENWIDTH * hires) * (SCREENHEIGHT * hires));
}
else
WI_DrawBackground();
const size_t size = (SCREENWIDTH * hires) * (SCREENHEIGHT * hires);

if ((intersnapshot.old_hires != hires) || (intersnapshot.old_widescreen != widescreen))
{
intersnapshot.old_hires = hires;
intersnapshot.old_widescreen = widescreen;
R_RenderPlayerView(&players[displayplayer]);

if (intersnapshot.pic) {
Z_Free(intersnapshot.pic);
intersnapshot.pic = NULL;
}
// Darken background a bit
for (int y = 0; y < size; y++)
{ screens[0][y] = colormaps[0][17 * 256 + screens[0][y]]; }

memcpy(screens[1], screens[0], size);
}
else {
WI_DrawBackground();
}

V_CopyRect(0, 0, 1, SCREENWIDTH, SCREENHEIGHT, 0, 0, 0); // killough 11/98
Expand Down Expand Up @@ -732,7 +717,7 @@ static void WI_drawAnimatedBack(void)
if (wbs->epsd > 2)
return;

if (ALTINTERPIC) { return; } // [Nugget] Alt. intermission background
if (STRICTMODE(alt_interpic)) { return; } // [Nugget] Alt. intermission background

for (i=0 ; i<NUMANIMS[wbs->epsd] ; i++)
{
Expand Down Expand Up @@ -1088,7 +1073,7 @@ static void WI_drawShowNextLoc(void)
if ( gamemode != commercial)
{
if (wbs->epsd > 2
|| ALTINTERPIC) // [Nugget] Alt. intermission background
|| STRICTMODE(alt_interpic)) // [Nugget] Alt. intermission background
{
WI_drawEL(); // "Entering..." if not E1 or E2
return;
Expand Down Expand Up @@ -2165,51 +2150,12 @@ void WI_loadData(void)
bp[i] = W_CacheLumpName(name, PU_STATIC);
}

{ // [Nugget] Alt. intermission background
const size_t size = (SCREENWIDTH * hires) * (SCREENHEIGHT * hires);
byte *old_screen = Z_Malloc(size, PU_STATIC, NULL);

const int old_fov = fov,
old_screenblocks = screenblocks,
old_hide_weapon = hide_weapon,
old_chasecam = chasecam_mode;

player_t *const player = &players[displayplayer];

intersnapshot.old_hires = hires;
intersnapshot.old_widescreen = widescreen;
// [Nugget] Alt. intermission background ---------------------------------

if (intersnapshot.pic) { Z_Free(intersnapshot.pic); }
intersnapshot.pic = Z_Malloc(size, PU_STATIC, NULL);

memcpy(old_screen, screens[0], size);

R_SetFOV(MAXFOV);
if (STRICTMODE(alt_interpic)) {
fovchange = true;
R_ClearFOVFX();
R_SetViewSize(11);
R_ExecuteSetViewSize();
hide_weapon = true;
if (chasecam_on)
{ chasecam_mode = (!MAX(0, chasecam_mode - 1) + 1); }
else
{ player->mo->oldangle = (player->mo->angle += ANG180); }

R_RenderPlayerView(player);

memcpy(intersnapshot.pic, screens[0], size);

// Darken snapshot a bit
for (int y = 0; y < size; y++)
{ intersnapshot.pic[y] = colormaps[0][19 * 256 + intersnapshot.pic[y]]; }

R_SetFOV(old_fov);
R_SetViewSize(old_screenblocks);
R_ExecuteSetViewSize();
hide_weapon = old_hide_weapon;
chasecam_mode = old_chasecam;

memcpy(screens[0], old_screen, size);
Z_Free(old_screen);
}
}

Expand Down
2 changes: 0 additions & 2 deletions src/wi_stuff.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ void WI_checkForAccelerate(void); // killough 11/98

void WI_DrawBackground(void); // killough 11/98

void WI_slamBackground(void); // [Nugget]

#endif

//----------------------------------------------------------------------------
Expand Down

0 comments on commit 9e0f3d3

Please sign in to comment.