Merge branch 'fix-ripple-crash' into 'master'

Fix software water ripple crash

See merge request KartKrew/Kart!1455
This commit is contained in:
Eidolon 2023-09-03 15:36:40 +00:00
commit c23127c030
3 changed files with 15 additions and 10 deletions

View file

@ -72,7 +72,7 @@ add_executable(SRB2SDL2 MACOSX_BUNDLE WIN32
r_draw.c
r_fps.c
r_main.c
r_plane.c
r_plane.cpp
r_segs.cpp
r_skins.c
r_sky.c

View file

@ -201,6 +201,11 @@ static void R_MapPlane(INT32 y, INT32 x1, INT32 x2)
ds_xfrac += planeripple.xfrac;
ds_yfrac += planeripple.yfrac;
ds_bgofs >>= FRACBITS;
if ((y + ds_bgofs) >= viewheight)
ds_bgofs = viewheight-y-1;
if ((y + ds_bgofs) < 0)
ds_bgofs = -y;
}
pindex = distance >> LIGHTZSHIFT;
@ -330,7 +335,7 @@ static visplane_t *new_visplane(unsigned hash)
visplane_t *check = freetail;
if (!check)
{
check = calloc(1, sizeof (*check));
check = static_cast<visplane_t*>(calloc(1, sizeof (*check)));
if (check == NULL) I_Error("%s: Out of memory", "new_visplane"); // FIXME: ugly
}
else
@ -786,11 +791,11 @@ d->z = (v1.x * v2.y) - (v1.y * v2.x)
void R_SetTiltedSpan(INT32 span)
{
if (ds_su == NULL)
ds_su = Z_Malloc(sizeof(*ds_su) * vid.height, PU_STATIC, NULL);
ds_su = static_cast<floatv3_t*>(Z_Malloc(sizeof(*ds_su) * vid.height, PU_STATIC, NULL));
if (ds_sv == NULL)
ds_sv = Z_Malloc(sizeof(*ds_sv) * vid.height, PU_STATIC, NULL);
ds_sv = static_cast<floatv3_t*>(Z_Malloc(sizeof(*ds_sv) * vid.height, PU_STATIC, NULL));
if (ds_sz == NULL)
ds_sz = Z_Malloc(sizeof(*ds_sz) * vid.height, PU_STATIC, NULL);
ds_sz = static_cast<floatv3_t*>(Z_Malloc(sizeof(*ds_sz) * vid.height, PU_STATIC, NULL));
ds_sup = &ds_su[span];
ds_svp = &ds_sv[span];
@ -840,7 +845,7 @@ void R_DrawSinglePlane(visplane_t *pl)
INT32 x, stop;
ffloor_t *rover;
INT32 type, spanfunctype = BASEDRAWFUNC;
debugrender_highlight_t debug = 0;
debugrender_highlight_t debug = debugrender_highlight_t::SW_HI_PLANES;
void (*mapfunc)(INT32, INT32, INT32) = R_MapPlane;
if (!(pl->minx <= pl->maxx))

View file

@ -2408,7 +2408,7 @@ static void R_ProjectSprite(mobj_t *thing)
vis->xscale = FixedMul(spritexscale, xscale); //SoM: 4/17/2000
vis->scale = FixedMul(spriteyscale, yscale); //<<detailshift;
vis->thingscale = interp.scale;
vis->thingscale = this_scale;
vis->spritexscale = spritexscale;
vis->spriteyscale = spriteyscale;
@ -2649,7 +2649,7 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing)
vis = R_NewVisSprite();
vis->scale = FixedMul(yscale, this_scale);
vis->sortscale = yscale; //<<detailshift;
vis->thingscale = interp.scale;
vis->thingscale = this_scale;
vis->dispoffset = 0; // Monster Iestyn: 23/11/15
vis->gx = interp.x;
vis->gy = interp.y;
@ -3635,14 +3635,14 @@ void R_ClipSprites(drawseg_t* dsstart, portal_t* portal)
// e6y: ~13% of speed improvement on sunder.wad map10
if (ds->x1 < cx)
{
drawsegs_xranges[1].items[drawsegs_xranges[1].count] =
drawsegs_xranges[1].items[drawsegs_xranges[1].count] =
drawsegs_xranges[0].items[drawsegs_xranges[0].count];
drawsegs_xranges[1].count++;
}
if (ds->x2 >= cx)
{
drawsegs_xranges[2].items[drawsegs_xranges[2].count] =
drawsegs_xranges[2].items[drawsegs_xranges[2].count] =
drawsegs_xranges[0].items[drawsegs_xranges[0].count];
drawsegs_xranges[2].count++;
}