Shrink growtime 2x, global darkness when using shrink

This commit is contained in:
AJ Martinez 2023-09-01 20:40:52 -07:00
parent 428fa11231
commit d3316ff614
8 changed files with 41 additions and 4 deletions

View file

@ -777,6 +777,9 @@ struct exitcondition_t
extern tic_t racecountdown, exitcountdown, musiccountdown;
extern exitcondition_t g_exit;
extern tic_t darktimer;
extern fixed_t darkness;
#define DEFAULT_GRAVITY (4*FRACUNIT/5)
extern fixed_t gravity;
extern fixed_t mapobjectscale;

View file

@ -279,6 +279,9 @@ mobj_t *hunt3;
tic_t racecountdown, exitcountdown, musiccountdown; // for racing
exitcondition_t g_exit;
tic_t darktimer;
fixed_t darkness;
fixed_t gravity;
fixed_t mapobjectscale;

View file

@ -86,6 +86,8 @@ extern boolean pausebreakkey;
extern boolean promptactive;
extern tic_t darktimer;
extern fixed_t darkness;
extern consvar_t cv_tutorialprompt;

View file

@ -101,6 +101,7 @@ static void K_SpawnDuelOnlyItems(void)
void K_TimerReset(void)
{
starttime = introtime = 0;
darkness = darktimer = 0;
numbulbs = 1;
inDuel = rainbowstartavailable = false;
timelimitintics = extratimeintics = secretextratime = 0;

View file

@ -32,7 +32,7 @@
// ██║░░░░░██║██╔╝╚██╗██║░╚═╝░██║███████╗
// ╚═╝░░░░░╚═╝╚═╝░░╚═╝╚═╝░░░░░╚═╝╚══════╝
//
// vertical flip
// FIXME (because it was completely unsearchable): vertical flip
//
#define POHBEE_HOVER (128 << FRACBITS)
@ -544,7 +544,7 @@ boolean Obj_ShrinkLaserCollide(mobj_t *gun, mobj_t *victim)
K_RemoveGrowShrink(victim->player);
}
victim->player->growshrinktimer += 3*TICRATE;
victim->player->growshrinktimer += 6*TICRATE;
S_StartSound(victim, sfx_kc5a);
if (prevTimer <= 0)
@ -739,6 +739,8 @@ void Obj_CreateShrinkPohbees(player_t *owner)
ownerPos = owner->position;
darktimer = POHBEE_TIME;
for (i = 0; i < MAXPLAYERS; i++)
{
player_t *player = NULL;

View file

@ -5875,6 +5875,9 @@ static void P_NetArchiveMisc(savebuffer_t *save, boolean resending)
WRITEUINT32(save->p, g_pointlimit);
WRITEUINT32(save->p, darktimer);
WRITEUINT32(save->p, darkness);
// Is it paused?
if (paused)
WRITEUINT8(save->p, 0x2f);
@ -6054,6 +6057,9 @@ static boolean P_NetUnArchiveMisc(savebuffer_t *save, boolean reloading)
g_pointlimit = READUINT32(save->p);
darktimer = READUINT32(save->p);
darkness = READUINT32(save->p);
// Is it paused?
if (READUINT8(save->p) == 0x2f)
paused = true;

View file

@ -942,6 +942,23 @@ void P_Ticker(boolean run)
if (racecountdown > 1)
racecountdown--;
const fixed_t darkdelta = FRACUNIT/50;
if (darktimer) // dark or darkening
{
darktimer--;
darkness += darkdelta;
darkness = min(darkness, FRACUNIT/6);
}
else if (darkness >= darkdelta) // lightening
{
darkness -= darkdelta;
}
else // light
{
darkness = 0;
}
if (exitcountdown > 1)
{
exitcountdown--;

View file

@ -19,6 +19,7 @@
#include "m_fixed.h"
#include "r_draw.h"
#include "r_main.h"
#include "g_game.h"
using namespace srb2::r_debug;
@ -38,12 +39,14 @@ void R_CheckDebugHighlight(debugrender_highlight_t k)
INT32 R_AdjustLightLevel(INT32 light)
{
constexpr fixed_t kRange = (LIGHTLEVELS - 1) * FRACUNIT;
if (!debugrender_highlight && cv_debugrender_contrast.value == 0)
{
return light;
const fixed_t darken = FixedMul(darkness, kRange);
return std::clamp((light * FRACUNIT) - darken, 0, kRange) / FRACUNIT;
}
constexpr fixed_t kRange = (LIGHTLEVELS - 1) * FRACUNIT;
const fixed_t adjust = FixedMul(cv_debugrender_contrast.value, kRange);
if (debugrender_highlight)