From fc789790bb8747e053d2a12d083566c4e5fd4a39 Mon Sep 17 00:00:00 2001 From: Latapostrophe Date: Thu, 14 May 2020 17:28:33 +0200 Subject: [PATCH 01/11] Create a quick P_StartQuake without epicenter/radius support and clean up the grand total of 4 earthquake uses in the code --- src/k_kart.c | 9 +++------ src/lua_baselib.c | 3 +-- src/p_inter.c | 7 ++----- src/p_spec.c | 8 ++++++++ src/p_spec.h | 4 ++++ 5 files changed, 18 insertions(+), 13 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 2610de1f5..eac5c4bad 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -3157,10 +3157,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<kartstuff[k_instashield] = 15; K_DropItems(player); @@ -5244,7 +5241,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; @@ -5613,7 +5610,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 diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 421af0238..21342d936 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -1518,8 +1518,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; } diff --git a/src/p_inter.c b/src/p_inter.c index 56885f56f..8286b6e3d 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -638,7 +638,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; // ***************************************** // @@ -3192,10 +3192,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< Date: Thu, 14 May 2020 17:55:33 +0200 Subject: [PATCH 02/11] Make explosions cause earthquakes and initiate flashpals --- src/doomstat.h | 1 + src/g_game.c | 1 + src/k_kart.c | 26 ++++++++++++++++++++++++++ src/p_tick.c | 3 +++ 4 files changed, 31 insertions(+) diff --git a/src/doomstat.h b/src/doomstat.h index 9971fdfc5..cffecce9a 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -513,6 +513,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; diff --git a/src/g_game.c b/src/g_game.c index 11cc2fbe8..4eafb9103 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -288,6 +288,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 diff --git a/src/k_kart.c b/src/k_kart.c index eac5c4bad..e8b126e43 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -3321,6 +3321,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) { @@ -3329,6 +3331,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<mo, source)) + { + bombflashtimer = TICRATE*5; + 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; @@ -3399,6 +3423,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; diff --git a/src/p_tick.c b/src/p_tick.c index 385985c34..d57a6dc43 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -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; From 6aa6521fb45960a92f1d109f6cbf166edbf91415 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Mon, 18 May 2020 14:52:26 -0400 Subject: [PATCH 03/11] Allow spectators through Block Players lines --- src/p_map.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index a6306bb19..fec884f66 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1941,7 +1941,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 } @@ -3307,7 +3307,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; } From 8b0aa9e3333bffb98db4066d26144a43582aeb8a Mon Sep 17 00:00:00 2001 From: Latapostrophe Date: Wed, 20 May 2020 14:21:50 +0200 Subject: [PATCH 04/11] Change flash cooldown from 5 to 2 seconds --- src/k_kart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/k_kart.c b/src/k_kart.c index e8b126e43..673c66822 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -3347,7 +3347,7 @@ void K_SpawnMineExplosion(mobj_t *source, UINT8 color) P_StartQuake(55<mo, source)) { - bombflashtimer = TICRATE*5; + bombflashtimer = TICRATE*2; P_FlashPal(p, 1, 1); } break; // we can break right now because quakes are global to all split players somehow. From d4080e94f7fa862b77ab759e6f57e3a13ba78d18 Mon Sep 17 00:00:00 2001 From: Sryder Date: Thu, 21 May 2020 16:32:34 +0100 Subject: [PATCH 05/11] Better fake contrast. Fake contrast for the segs are calculated at map load. OpenGL only has the options "Standard" and "Smooth" now. Standard is default and replicates software. Smooth changes the contrast more smoothly depending on angle. --- src/hardware/hw_main.c | 61 +++++++++++++++++------------------------- src/p_setup.c | 14 +++++++++- src/r_defs.h | 6 +++++ src/r_segs.c | 38 +++++++++----------------- src/v_video.c | 2 +- 5 files changed, 57 insertions(+), 64 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 4a4b6d600..3d4f26df9 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -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; - } - 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; diff --git a/src/p_setup.c b/src/p_setup.c index 2ea730126..f56b2f4ea 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -457,6 +457,7 @@ static void P_LoadRawSegs(UINT8 *data, size_t i) mapseg_t *ml; seg_t *li; line_t *ldef; + fixed_t extralight = 0; numsegs = i / sizeof (mapseg_t); if (numsegs <= 0) @@ -492,6 +493,17 @@ static void P_LoadRawSegs(UINT8 *data, size_t i) li->numlights = 0; li->rlights = NULL; + + extralight = -(8*FRACUNIT) + + FixedDiv(AngleFixed(R_PointToAngle2(0, 0, + abs(li->v1->x - li->v2->x), + abs(li->v1->y - li->v2->y))), 90*FRACUNIT) * 16; + + // Between -1 and 1 for software, -8 and 8 for hardware + li->lightOffset = FixedFloor((extralight / 8) + (FRACUNIT / 2)) / FRACUNIT; +#ifdef HWRENDER + li->hwLightOffset = FixedFloor(extralight + (FRACUNIT / 2)) / FRACUNIT; +#endif } } @@ -1091,7 +1103,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 diff --git a/src/r_defs.h b/src/r_defs.h index 02c82bf56..b186fecdf 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -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; // diff --git a/src/r_segs.c b/src/r_segs.c index 2304540fe..efb1f4887 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -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]; diff --git a/src/v_video.c b/src/v_video.c index 7f1bcb7ce..e5fed2a16 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -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}; From 195920acdcffca94bb335bc06d3dea5cd238da43 Mon Sep 17 00:00:00 2001 From: Sryder Date: Thu, 21 May 2020 17:15:50 +0100 Subject: [PATCH 06/11] Update light offset on polyobjects when they rotate --- src/p_polyobj.c | 3 +++ src/p_setup.c | 31 +++++++++++++++++++++---------- src/p_setup.h | 1 + 3 files changed, 25 insertions(+), 10 deletions(-) diff --git a/src/p_polyobj.c b/src/p_polyobj.c index 03fb10d0f..12708a44b 100644 --- a/src/p_polyobj.c +++ b/src/p_polyobj.c @@ -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; diff --git a/src/p_setup.c b/src/p_setup.c index f56b2f4ea..259d8f5ff 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -446,6 +446,26 @@ 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) +{ + fixed_t extralight = 0; + + extralight = -(8*FRACUNIT) + + FixedDiv(AngleFixed(R_PointToAngle2(0, 0, + abs(li->v1->x - li->v2->x), + abs(li->v1->y - li->v2->y))), 90*FRACUNIT) * 16; + + // Between -1 and 1 for software, -8 and 8 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. @@ -494,16 +514,7 @@ static void P_LoadRawSegs(UINT8 *data, size_t i) li->numlights = 0; li->rlights = NULL; - extralight = -(8*FRACUNIT) + - FixedDiv(AngleFixed(R_PointToAngle2(0, 0, - abs(li->v1->x - li->v2->x), - abs(li->v1->y - li->v2->y))), 90*FRACUNIT) * 16; - - // Between -1 and 1 for software, -8 and 8 for hardware - li->lightOffset = FixedFloor((extralight / 8) + (FRACUNIT / 2)) / FRACUNIT; -#ifdef HWRENDER - li->hwLightOffset = FixedFloor(extralight + (FRACUNIT / 2)) / FRACUNIT; -#endif + P_UpdateSegLightOffset(li); } } diff --git a/src/p_setup.h b/src/p_setup.h index 9abcfe5f6..c0b30ca6a 100644 --- a/src/p_setup.h +++ b/src/p_setup.h @@ -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); From 8d34ca0533fc46248e169c4953a32353fc503b57 Mon Sep 17 00:00:00 2001 From: Sryder Date: Thu, 21 May 2020 17:55:33 +0100 Subject: [PATCH 07/11] Use a const for the contrast, and double it for extra impact. --- src/p_setup.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/p_setup.c b/src/p_setup.c index 259d8f5ff..ea0c04d5c 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -452,15 +452,16 @@ static inline float P_SegLengthFloat(seg_t *seg) */ void P_UpdateSegLightOffset(seg_t *li) { + const UINT8 contrast = 16; fixed_t extralight = 0; - extralight = -(8*FRACUNIT) + + 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) * 16; + abs(li->v1->y - li->v2->y))), 90*FRACUNIT) * ((fixed_t)contrast * 2); - // Between -1 and 1 for software, -8 and 8 for hardware - li->lightOffset = FixedFloor((extralight / 8) + (FRACUNIT / 2)) / FRACUNIT; + // Between -2 and 2 for software, -16 and 16 for hardware + li->lightOffset = FixedFloor((extralight / contrast) + (FRACUNIT / 2)) / FRACUNIT; #ifdef HWRENDER li->hwLightOffset = FixedFloor(extralight + (FRACUNIT / 2)) / FRACUNIT; #endif @@ -477,7 +478,6 @@ static void P_LoadRawSegs(UINT8 *data, size_t i) mapseg_t *ml; seg_t *li; line_t *ldef; - fixed_t extralight = 0; numsegs = i / sizeof (mapseg_t); if (numsegs <= 0) From ad51b791d5d65eb3d35adbd24d1af4e4cfcaf0d2 Mon Sep 17 00:00:00 2001 From: Sryder Date: Thu, 21 May 2020 18:11:38 +0100 Subject: [PATCH 08/11] Fix software not contrasting properly to +-2 --- src/p_setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_setup.c b/src/p_setup.c index ea0c04d5c..cd1cabdc9 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -461,7 +461,7 @@ void P_UpdateSegLightOffset(seg_t *li) 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 / contrast) + (FRACUNIT / 2)) / FRACUNIT; + li->lightOffset = FixedFloor((extralight / 8) + (FRACUNIT / 2)) / FRACUNIT; #ifdef HWRENDER li->hwLightOffset = FixedFloor(extralight + (FRACUNIT / 2)) / FRACUNIT; #endif From f5b570da399d51ae251f86e515caf11147ea2899 Mon Sep 17 00:00:00 2001 From: Sryder Date: Sat, 23 May 2020 16:08:51 +0100 Subject: [PATCH 09/11] Set this variable after making sure the target and player exist. --- src/p_mobj.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index a224d5b58..6aaf6b414 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -8728,7 +8728,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) @@ -8736,6 +8736,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))); @@ -8815,7 +8818,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); } From b1ec2d8f74b065199afa7e21758e73b3282b0732 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Sat, 23 May 2020 21:34:30 -0400 Subject: [PATCH 10/11] Scale with mapobjectscale --- src/k_kart.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index c046b2c49..ebd9655b8 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -6787,6 +6787,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; @@ -6808,8 +6809,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)); } // From 12be3ea882a2dc092043ebe0b75cd98d88a1e7e9 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Sat, 23 May 2020 21:50:52 -0400 Subject: [PATCH 11/11] Increase handling with flame shield dash --- src/k_kart.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index ebd9655b8..697881bc9 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -2192,6 +2192,12 @@ void K_MomentumToFacing(player_t *player) player->mo->momy = FixedMul(player->mo->momy - player->cmomy, player->mo->friction) + player->cmomy; } +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) { @@ -2229,10 +2235,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]<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 @@ -6416,12 +6419,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; }