Merge branch 'master' into pet-robo

This commit is contained in:
Sally Coolatta 2020-05-24 17:18:02 -04:00
commit 9933687c6e
17 changed files with 147 additions and 88 deletions

View file

@ -514,6 +514,7 @@ extern tic_t mapreset;
extern boolean thwompsactive;
extern SINT8 spbplace;
extern tic_t bombflashtimer; // Used to avoid causing seizures if multiple mines explode close to you :)
extern boolean legitimateexit;
extern boolean comebackshowninfo;
extern tic_t curlap, bestlap;

View file

@ -285,6 +285,7 @@ boolean thwompsactive; // Thwomps activate on lap 2
SINT8 spbplace; // SPB exists, give the person behind better items
// Client-sided, unsynched variables (NEVER use in anything that needs to be synced with other players)
tic_t bombflashtimer = 0; // Cooldown before another FlashPal can be intialized by a bomb exploding near a displayplayer. Avoids seizures.
boolean legitimateexit; // Did this client actually finish the match?
boolean comebackshowninfo; // Have you already seen the "ATTACK OR PROTECT" message?
tic_t curlap; // Current lap time

View file

@ -223,40 +223,27 @@ UINT8 HWR_FogBlockAlpha(INT32 light, extracolormap_t *colormap) // Let's see if
return surfcolor.s.alpha;
}
static FUINT HWR_CalcWallLight(FUINT lightnum, fixed_t v1x, fixed_t v1y, fixed_t v2x, fixed_t v2y)
// Lightnum = current light
// line = the seg to get the light offset from
static FUINT HWR_CalcWallLight(seg_t *line, FUINT lightnum)
{
INT16 finallight = lightnum;
if (cv_grfakecontrast.value != 0)
fixed_t extralight = 0;
if (cv_grfakecontrast.value == 1) // Smooth setting
extralight += line->hwLightOffset;
else
extralight += line->lightOffset * 8;
if (extralight != 0)
{
const UINT8 contrast = 8;
fixed_t extralight = 0;
finallight += extralight;
if (cv_grfakecontrast.value == 2) // Smooth setting
{
extralight = (-(contrast<<FRACBITS) +
FixedDiv(AngleFixed(R_PointToAngle2(0, 0,
abs(v1x - v2x),
abs(v1y - v2y))), 90<<FRACBITS)
* (contrast * 2)) >> FRACBITS;
}
else
{
if (v1y == v2y)
extralight = -contrast;
else if (v1x == v2x)
extralight = contrast;
}
if (extralight != 0)
{
finallight += extralight;
if (finallight < 0)
finallight = 0;
if (finallight > 255)
finallight = 255;
}
if (finallight < 0)
finallight = 0;
if (finallight > 255)
finallight = 255;
}
return (FUINT)finallight;
@ -618,7 +605,7 @@ void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, FSurfa
INT32 solid, i;
lightlist_t * list = sector->lightlist;
const UINT8 alpha = Surf->PolyColor.s.alpha;
FUINT lightnum = HWR_CalcWallLight(sector->lightlevel, v1x, v1y, v2x, v2y);
FUINT lightnum = HWR_CalcWallLight(gr_curline, sector->lightlevel);
extracolormap_t *colormap = NULL;
realtop = top = wallVerts[3].y;
@ -647,12 +634,12 @@ void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, FSurfa
{
if (pfloor && (pfloor->flags & FF_FOG))
{
lightnum = HWR_CalcWallLight(pfloor->master->frontsector->lightlevel, v1x, v1y, v2x, v2y);
lightnum = HWR_CalcWallLight(gr_curline, pfloor->master->frontsector->lightlevel);
colormap = pfloor->master->frontsector->extra_colormap;
}
else
{
lightnum = HWR_CalcWallLight(*list[i].lightlevel, v1x, v1y, v2x, v2y);
lightnum = HWR_CalcWallLight(gr_curline, *list[i].lightlevel);
colormap = list[i].extra_colormap;
}
}
@ -933,7 +920,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
cliphigh = (float)(texturehpeg + (gr_curline->flength*FRACUNIT));
}
lightnum = HWR_CalcWallLight(gr_frontsector->lightlevel, vs.x, vs.y, ve.x, ve.y);
lightnum = HWR_CalcWallLight(gr_curline, gr_frontsector->lightlevel);
colormap = gr_frontsector->extra_colormap;
if (gr_frontsector)
@ -1759,7 +1746,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
blendmode = PF_Fog|PF_NoTexture;
lightnum = HWR_CalcWallLight(rover->master->frontsector->lightlevel, vs.x, vs.y, ve.x, ve.y);
lightnum = HWR_CalcWallLight(gr_curline, rover->master->frontsector->lightlevel);
colormap = rover->master->frontsector->extra_colormap;
Surf.PolyColor.s.alpha = HWR_FogBlockAlpha(rover->master->frontsector->lightlevel, rover->master->frontsector->extra_colormap);
@ -1871,7 +1858,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
blendmode = PF_Fog|PF_NoTexture;
lightnum = HWR_CalcWallLight(rover->master->frontsector->lightlevel, vs.x, vs.y, ve.x, ve.y);
lightnum = HWR_CalcWallLight(gr_curline, rover->master->frontsector->lightlevel);
colormap = rover->master->frontsector->extra_colormap;
Surf.PolyColor.s.alpha = HWR_FogBlockAlpha(rover->master->frontsector->lightlevel, rover->master->frontsector->extra_colormap);
@ -3596,10 +3583,10 @@ static int CompareVisSprites(const void *p1, const void *p2)
gr_vissprite_t* spr2 = *(gr_vissprite_t*const*)p2;
int idiff;
float fdiff;
// make transparent sprites last
// "boolean to int"
int transparency1 = (spr1->mobj->flags2 & MF2_SHADOW) || (spr1->mobj->frame & FF_TRANSMASK);
int transparency2 = (spr2->mobj->flags2 & MF2_SHADOW) || (spr2->mobj->frame & FF_TRANSMASK);
idiff = transparency1 - transparency2;

View file

@ -2244,6 +2244,12 @@ boolean K_ApplyOffroad(player_t *player)
return true;
}
static fixed_t K_FlameShieldDashVar(INT32 val)
{
// 1 second = 75% + 50% top speed
return (3*FRACUNIT/4) + (((val * FRACUNIT) / TICRATE) / 2);
}
// sets k_boostpower, k_speedboost, and k_accelboost to whatever we need it to be
static void K_GetKartBoostPower(player_t *player)
{
@ -2280,10 +2286,7 @@ static void K_GetKartBoostPower(player_t *player)
ADDBOOST((3*FRACUNIT)/8, 3*FRACUNIT); // + 37.5% top speed, + 300% acceleration
if (player->kartstuff[k_flamedash]) // Flame Shield dash
{
fixed_t dashval = ((player->kartstuff[k_flamedash]<<FRACBITS) / TICRATE) / 2; // 1 second = +50% top speed
ADDBOOST((3*FRACUNIT)/4 + dashval, 3*FRACUNIT); // + infinite top speed, + 300% acceleration
}
ADDBOOST(K_FlameShieldDashVar(player->kartstuff[k_flamedash]), 3*FRACUNIT); // + infinite top speed, + 300% acceleration
if (player->kartstuff[k_startboost]) // Startup Boost
ADDBOOST(FRACUNIT/4, 6*FRACUNIT); // + 25% top speed, + 600% acceleration
@ -2903,10 +2906,7 @@ void K_ExplodePlayer(player_t *player, mobj_t *source, mobj_t *inflictor) // A b
K_PlayPainSound(player->mo);
if (P_IsDisplayPlayer(player))
{
quake.intensity = 64*FRACUNIT;
quake.time = 5;
}
P_StartQuake(64<<FRACBITS, 5);
player->kartstuff[k_instashield] = 15;
K_DropItems(player);
@ -3070,6 +3070,8 @@ void K_SpawnKartExplosion(fixed_t x, fixed_t y, fixed_t z, fixed_t radius, INT32
}
}
#define MINEQUAKEDIST 4096
// Spawns the purely visual explosion
void K_SpawnMineExplosion(mobj_t *source, UINT8 color)
{
@ -3078,6 +3080,28 @@ void K_SpawnMineExplosion(mobj_t *source, UINT8 color)
mobj_t *dust;
mobj_t *truc;
INT32 speed, speed2;
INT32 pnum;
player_t *p;
// check for potential display players near the source so we can have a sick earthquake / flashpal.
for (pnum = 0; pnum < MAXPLAYERS; pnum++)
{
p = &players[pnum];
if (!playeringame[pnum] || !P_IsDisplayPlayer(p))
continue;
if (R_PointToDist2(p->mo->x, p->mo->y, source->x, source->y) < mapobjectscale*MINEQUAKEDIST)
{
P_StartQuake(55<<FRACBITS, 12);
if (!bombflashtimer && P_CheckSight(p->mo, source))
{
bombflashtimer = TICRATE*2;
P_FlashPal(p, 1, 1);
}
break; // we can break right now because quakes are global to all split players somehow.
}
}
K_MatchGenericExtraFlags(smoldering, source);
smoldering->tics = TICRATE*3;
@ -3148,6 +3172,8 @@ void K_SpawnMineExplosion(mobj_t *source, UINT8 color)
}
}
#undef MINEQUAKEDIST
static mobj_t *K_SpawnKartMissile(mobj_t *source, mobjtype_t type, angle_t an, INT32 flags2, fixed_t speed)
{
mobj_t *th;
@ -4990,7 +5016,7 @@ static void K_MoveHeldObjects(player_t *player)
if (cur->type == MT_EGGMANITEM_SHIELD)
{
// Decided that this should use their "canon" color.
cur->color = SKINCOLOR_BLACK;
cur->color = SKINCOLOR_BLACK;
}
cur->flags &= ~MF_NOCLIPTHING;
@ -5359,7 +5385,7 @@ static void K_UpdateInvincibilitySounds(player_t *player)
{
if (player->kartstuff[k_invincibilitytimer] > 0) // Prioritize invincibility
sfxnum = sfx_alarmi;
else if (player->kartstuff[k_growshrinktimer] > 0)
else if (player->kartstuff[k_growshrinktimer] > 0)
sfxnum = sfx_alarmg;
}
else
@ -6565,12 +6591,20 @@ INT16 K_GetKartTurnValue(player_t *player, INT16 turnvalue)
turnvalue = 5*turnvalue/4;
}
if (player->kartstuff[k_flamedash] > 0)
{
fixed_t multiplier = K_FlameShieldDashVar(player->kartstuff[k_flamedash]);
multiplier = FRACUNIT + (FixedDiv(multiplier, FRACUNIT/2) / 4);
turnvalue = FixedMul(turnvalue * FRACUNIT, multiplier) / FRACUNIT;
}
if (player->mo->eflags & (MFE_UNDERWATER|MFE_TOUCHWATER))
{
turnvalue = 3*turnvalue/2;
}
turnvalue = FixedMul(turnvalue * FRACUNIT, weightadjust) / FRACUNIT; // Weight has a small effect on turning
// Weight has a small effect on turning
turnvalue = FixedMul(turnvalue * FRACUNIT, weightadjust) / FRACUNIT;
return turnvalue;
}
@ -6933,6 +6967,7 @@ void K_StripOther(player_t *player)
static INT32 K_FlameShieldMax(player_t *player)
{
UINT32 disttofinish = 0;
UINT32 distv = DISTVAR;
UINT8 numplayers = 0;
UINT8 i;
@ -6954,8 +6989,8 @@ static INT32 K_FlameShieldMax(player_t *player)
}
disttofinish = player->distancetofinish - disttofinish;
return min(16, 1 + (disttofinish / DISTVAR));
distv = FixedDiv(distv * FRACUNIT, mapobjectscale) / FRACUNIT;
return min(16, 1 + (disttofinish / distv));
}
//

View file

@ -1519,8 +1519,7 @@ static int lib_pStartQuake(lua_State *L)
quake.radius = luaL_optinteger(L, 4, 512*FRACUNIT);
// These things are actually used in 2.1.
quake.intensity = q_intensity;
quake.time = q_time;
P_StartQuake(q_intensity, q_time);
return 0;
}

View file

@ -636,7 +636,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
P_SetTarget(&special->tracer, toucher);
toucher->flags |= MF_NOGRAVITY;
toucher->momz = (8*toucher->scale) * P_MobjFlip(toucher);
S_StartSound(toucher, sfx_s1b2);
S_StartSound(toucher, sfx_s1b2);
return;
// ***************************************** //
@ -3162,10 +3162,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
K_KartPainEnergyFling(player);
if (P_IsDisplayPlayer(player))
{
quake.intensity = 32*FRACUNIT;
quake.time = 5;
}
P_StartQuake(32<<FRACBITS, 5);
}
else
K_SpinPlayer(player, source, 0, inflictor, false);

View file

@ -1856,7 +1856,7 @@ static boolean PIT_CheckLine(line_t *ld)
{
if (ld->flags & ML_IMPASSABLE) // block objects from moving through this linedef.
return false;
if (tmthing->player && ld->flags & ML_BLOCKPLAYERS)
if (tmthing->player && !tmthing->player->spectator && ld->flags & ML_BLOCKPLAYERS)
return false; // SRB2Kart: Only block players, not items
}
@ -3222,7 +3222,7 @@ static boolean PTR_SlideTraverse(intercept_t *in)
if (li->flags & ML_IMPASSABLE)
goto isblocking;
if (slidemo->player && li->flags & ML_BLOCKPLAYERS)
if (slidemo->player && !slidemo->player->spectator && li->flags & ML_BLOCKPLAYERS)
goto isblocking;
}

View file

@ -8724,7 +8724,7 @@ void P_MobjThinker(mobj_t *mobj)
fixed_t destx, desty;
statenum_t curstate;
statenum_t underlayst = S_NULL;
INT32 flamemax = mobj->target->player->kartstuff[k_flamelength] * flameseg;
INT32 flamemax = 0;
if (!mobj->target || !mobj->target->health || !mobj->target->player
|| mobj->target->player->kartstuff[k_curshield] != KSHIELD_FLAME)
@ -8732,6 +8732,9 @@ void P_MobjThinker(mobj_t *mobj)
P_RemoveMobj(mobj);
return;
}
flamemax = mobj->target->player->kartstuff[k_flamelength] * flameseg;
P_SetScale(mobj, (mobj->destscale = (5*mobj->target->scale)>>2));
curstate = ((mobj->tics == 1) ? (mobj->state->nextstate) : ((statenum_t)(mobj->state-states)));
@ -8811,7 +8814,7 @@ void P_MobjThinker(mobj_t *mobj)
if (curstate >= S_FLAMESHIELD1 && curstate < S_FLAMESHIELDDASH1 && ((curstate-S_FLAMESHIELD1) & 1))
viewingangle += ANGLE_180;
destx = mobj->target->x + P_ReturnThrustX(mobj->target, viewingangle, mobj->scale>>4);
desty = mobj->target->y + P_ReturnThrustY(mobj->target, viewingangle, mobj->scale>>4);
}

View file

@ -1407,7 +1407,10 @@ static boolean Polyobj_rotate(polyobj_t *po, angle_t delta, UINT8 turnthings)
{
// update seg angles (used only by renderer)
for (i = 0; i < po->segCount; ++i)
{
po->segs[i]->angle += delta;
P_UpdateSegLightOffset(po->segs[i]);
}
// update polyobject's angle
po->angle += delta;

View file

@ -447,6 +447,27 @@ static inline float P_SegLengthFloat(seg_t *seg)
}
#endif
/** Updates the light offset
*
* \param li Seg to update the light offsets of
*/
void P_UpdateSegLightOffset(seg_t *li)
{
const UINT8 contrast = 16;
fixed_t extralight = 0;
extralight = -((fixed_t)contrast*FRACUNIT) +
FixedDiv(AngleFixed(R_PointToAngle2(0, 0,
abs(li->v1->x - li->v2->x),
abs(li->v1->y - li->v2->y))), 90*FRACUNIT) * ((fixed_t)contrast * 2);
// Between -2 and 2 for software, -16 and 16 for hardware
li->lightOffset = FixedFloor((extralight / 8) + (FRACUNIT / 2)) / FRACUNIT;
#ifdef HWRENDER
li->hwLightOffset = FixedFloor(extralight + (FRACUNIT / 2)) / FRACUNIT;
#endif
}
/** Loads the SEGS resource from a level.
*
* \param lump Lump number of the SEGS resource.
@ -493,6 +514,8 @@ static void P_LoadRawSegs(UINT8 *data, size_t i)
li->numlights = 0;
li->rlights = NULL;
P_UpdateSegLightOffset(li);
}
}
@ -1092,7 +1115,7 @@ static void P_LoadThings(void)
|| mt->type == 1705 || mt->type == 1713 || mt->type == 1800)
{
sector_t *mtsector = R_PointInSubsector(mt->x << FRACBITS, mt->y << FRACBITS)->sector;
mt->mobj = NULL;
// Z for objects

View file

@ -66,6 +66,7 @@ boolean P_DelWadFile(void);
#endif
boolean P_RunSOC(const char *socfilename);
void P_WriteThings(lumpnum_t lump);
void P_UpdateSegLightOffset(seg_t *li);
size_t P_PrecacheLevelFlats(void);
void P_AllocMapHeader(INT16 i);

View file

@ -8233,3 +8233,11 @@ static void P_SearchForDisableLinedefs(void)
}
}
}
// Rudimentary function to start a earthquake.
// epicenter and radius are not yet used.
void P_StartQuake(fixed_t intensity, tic_t time)
{
quake.intensity = intensity;
quake.time = time;
}

View file

@ -19,6 +19,10 @@
extern mobj_t *skyboxmo[2];
// Something that should've been done long ago???
// We won't be using epicenter or radius anytime soon so I don't think it's worth it yet.
void P_StartQuake(fixed_t intensity, tic_t time);
// GETSECSPECIAL (specialval, section)
//
// Pulls out the special # from a particular section.

View file

@ -722,6 +722,9 @@ void P_Ticker(boolean run)
K_CalculateBattleWanted();
}
if (bombflashtimer)
bombflashtimer--; // Bomb seizure prevention
if (quake.time)
{
fixed_t ir = quake.intensity>>1;

View file

@ -565,6 +565,12 @@ typedef struct seg_s
polyobj_t *polyseg;
boolean dontrenderme;
#endif
// Fake contrast calculated on level load
SINT8 lightOffset;
#ifdef HWRENDER
INT16 hwLightOffset;
#endif
} seg_t;
//

View file

@ -412,10 +412,8 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
if (rlight->extra_colormap && rlight->extra_colormap->fog)
;
else if (curline->v1->y == curline->v2->y)
lightnum--;
else if (curline->v1->x == curline->v2->x)
lightnum++;
else
lightnum += curline->lightOffset;
rlight->lightnum = lightnum;
}
@ -435,10 +433,8 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
if (colfunc == R_DrawFogColumn_8
|| (frontsector->extra_colormap && frontsector->extra_colormap->fog))
;
else if (curline->v1->y == curline->v2->y)
lightnum--;
else if (curline->v1->x == curline->v2->x)
lightnum++;
else
lightnum += curline->lightOffset;
if (lightnum < 0)
walllights = scalelight[0];
@ -932,10 +928,8 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
if (pfloor->flags & FF_FOG || rlight->flags & FF_FOG || (rlight->extra_colormap && rlight->extra_colormap->fog))
;
else if (curline->v1->y == curline->v2->y)
rlight->lightnum--;
else if (curline->v1->x == curline->v2->x)
rlight->lightnum++;
else
rlight->lightnum += curline->lightOffset;
p++;
}
@ -955,11 +949,10 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
lightnum = R_FakeFlat(frontsector, &tempsec, &templight, &templight, false)
->lightlevel >> LIGHTSEGSHIFT;
if (pfloor->flags & FF_FOG || (frontsector->extra_colormap && frontsector->extra_colormap->fog));
else if (curline->v1->y == curline->v2->y)
lightnum--;
else if (curline->v1->x == curline->v2->x)
lightnum++;
if (pfloor->flags & FF_FOG || (frontsector->extra_colormap && frontsector->extra_colormap->fog))
;
else
lightnum += curline->lightOffset;
if (lightnum < 0)
walllights = scalelight[0];
@ -1492,10 +1485,8 @@ static void R_RenderSegLoop (void)
if (dc_lightlist[i].extra_colormap)
;
else if (curline->v1->y == curline->v2->y)
lightnum--;
else if (curline->v1->x == curline->v2->x)
lightnum++;
else
lightnum += curline->lightOffset;
if (lightnum < 0)
xwalllights = scalelight[0];
@ -2639,10 +2630,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
// OPTIMIZE: get rid of LIGHTSEGSHIFT globally
lightnum = (frontsector->lightlevel >> LIGHTSEGSHIFT);
if (curline->v1->y == curline->v2->y)
lightnum--;
else if (curline->v1->x == curline->v2->x)
lightnum++;
lightnum += curline->lightOffset;
if (lightnum < 0)
walllights = scalelight[0];

View file

@ -84,7 +84,7 @@ static void CV_Gammaxxx_ONChange(void);
// - You can change them in software,
// but they won't do anything.
static CV_PossibleValue_t grgamma_cons_t[] = {{1, "MIN"}, {255, "MAX"}, {0, NULL}};
static CV_PossibleValue_t grfakecontrast_cons_t[] = {{0, "Off"}, {1, "Standard"}, {2, "Smooth"}, {0, NULL}};
static CV_PossibleValue_t grfakecontrast_cons_t[] = {{0, "Standard"}, {1, "Smooth"}, {0, NULL}};
consvar_t cv_grshaders = {"gr_shaders", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_grfovchange = {"gr_fovchange", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};