From 30d2b8cb4f33872d4fc8173bd9adabd56a83c01f Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Sun, 6 Dec 2015 15:57:44 -0600 Subject: [PATCH] MI's slope compiling fixes --- src/p_map.c | 16 +++++--- src/p_maputl.c | 21 ++++++---- src/p_mobj.c | 10 +++-- src/p_slopes.c | 34 +++++++++-------- src/p_slopes.h | 5 +++ src/p_spec.c | 5 ++- src/p_user.c | 3 +- src/r_bsp.c | 1 + src/r_draw.h | 7 ++-- src/r_draw8.c | 101 +++++++++++++++++++++++++++---------------------- src/r_plane.c | 17 +++++++-- src/r_segs.c | 9 ++++- src/r_things.c | 1 + 13 files changed, 140 insertions(+), 90 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index c4dafe81d..224ed31bf 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1245,11 +1245,13 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y) for (rover = newsubsec->sector->ffloors; rover; rover = rover->next) { + fixed_t topheight, bottomheight; + if (!(rover->flags & FF_EXISTS)) continue; - fixed_t topheight = P_GetFOFTopZ(thing, newsubsec->sector, rover, x, y, NULL); - fixed_t bottomheight = P_GetFOFBottomZ(thing, newsubsec->sector, rover, x, y, NULL); + topheight = P_GetFOFTopZ(thing, newsubsec->sector, rover, x, y, NULL); + bottomheight = P_GetFOFBottomZ(thing, newsubsec->sector, rover, x, y, NULL); if (rover->flags & FF_GOOWATER && !(thing->flags & MF_NOGRAVITY)) { @@ -1549,11 +1551,12 @@ boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam) for (rover = newsubsec->sector->ffloors; rover; rover = rover->next) { + fixed_t topheight, bottomheight; if (!(rover->flags & FF_BLOCKOTHERS) || !(rover->flags & FF_EXISTS) || !(rover->flags & FF_RENDERALL) || GETSECSPECIAL(rover->master->frontsector->special, 4) == 12) continue; - fixed_t topheight = P_CameraGetFOFTopZ(thiscam, newsubsec->sector, rover, x, y, NULL); - fixed_t bottomheight = P_CameraGetFOFBottomZ(thiscam, newsubsec->sector, rover, x, y, NULL); + topheight = P_CameraGetFOFTopZ(thiscam, newsubsec->sector, rover, x, y, NULL); + bottomheight = P_CameraGetFOFBottomZ(thiscam, newsubsec->sector, rover, x, y, NULL); delta1 = thiscam->z - (bottomheight + ((topheight - bottomheight)/2)); @@ -3943,14 +3946,15 @@ fixed_t P_FloorzAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t height) for (rover = sec->ffloors; rover; rover = rover->next) { + fixed_t topheight, bottomheight; if (!(rover->flags & FF_EXISTS)) continue; if ((!(rover->flags & FF_SOLID || rover->flags & FF_QUICKSAND) || (rover->flags & FF_SWIMMABLE))) continue; - fixed_t topheight = *rover->topheight; - fixed_t bottomheight = *rover->bottomheight; + topheight = *rover->topheight; + bottomheight = *rover->bottomheight; #ifdef ESLOPE if (*rover->t_slope) diff --git a/src/p_maputl.c b/src/p_maputl.c index c9a42bd43..8f349a2a9 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -20,6 +20,7 @@ #include "r_data.h" #include "p_maputl.h" #include "p_polyobj.h" +#include "p_slopes.h" #include "z_zone.h" // @@ -442,11 +443,12 @@ void P_CameraLineOpening(line_t *linedef) if (front->ffloors) for (rover = front->ffloors; rover; rover = rover->next) { + fixed_t topheight, bottomheight; if (!(rover->flags & FF_BLOCKOTHERS) || !(rover->flags & FF_RENDERALL) || !(rover->flags & FF_EXISTS) || GETSECSPECIAL(rover->master->frontsector->special, 4) == 12) continue; - fixed_t topheight = P_CameraGetFOFTopZ(mapcampointer, front, rover, tmx, tmy, linedef); - fixed_t bottomheight = P_CameraGetFOFBottomZ(mapcampointer, front, rover, tmx, tmy, linedef); + topheight = P_CameraGetFOFTopZ(mapcampointer, front, rover, tmx, tmy, linedef); + bottomheight = P_CameraGetFOFBottomZ(mapcampointer, front, rover, tmx, tmy, linedef); delta1 = abs(mapcampointer->z - (bottomheight + ((topheight - bottomheight)/2))); delta2 = abs(thingtop - (bottomheight + ((topheight - bottomheight)/2))); @@ -465,11 +467,12 @@ void P_CameraLineOpening(line_t *linedef) if (back->ffloors) for (rover = back->ffloors; rover; rover = rover->next) { + fixed_t topheight, bottomheight; if (!(rover->flags & FF_BLOCKOTHERS) || !(rover->flags & FF_RENDERALL) || !(rover->flags & FF_EXISTS) || GETSECSPECIAL(rover->master->frontsector->special, 4) == 12) continue; - fixed_t topheight = P_CameraGetFOFTopZ(mapcampointer, back, rover, tmx, tmy, linedef); - fixed_t bottomheight = P_CameraGetFOFBottomZ(mapcampointer, back, rover, tmx, tmy, linedef); + topheight = P_CameraGetFOFTopZ(mapcampointer, back, rover, tmx, tmy, linedef); + bottomheight = P_CameraGetFOFBottomZ(mapcampointer, back, rover, tmx, tmy, linedef); delta1 = abs(mapcampointer->z - (bottomheight + ((topheight - bottomheight)/2))); delta2 = abs(thingtop - (bottomheight + ((topheight - bottomheight)/2))); @@ -636,6 +639,7 @@ void P_LineOpening(line_t *linedef) // Check for frontsector's fake floors for (rover = front->ffloors; rover; rover = rover->next) { + fixed_t topheight, bottomheight; if (!(rover->flags & FF_EXISTS)) continue; @@ -645,8 +649,8 @@ void P_LineOpening(line_t *linedef) || (rover->flags & FF_BLOCKOTHERS && !tmthing->player))) continue; - fixed_t topheight = P_GetFOFTopZ(tmthing, front, rover, tmx, tmy, linedef); - fixed_t bottomheight = P_GetFOFBottomZ(tmthing, front, rover, tmx, tmy, linedef); + topheight = P_GetFOFTopZ(tmthing, front, rover, tmx, tmy, linedef); + bottomheight = P_GetFOFBottomZ(tmthing, front, rover, tmx, tmy, linedef); delta1 = abs(tmthing->z - (bottomheight + ((topheight - bottomheight)/2))); delta2 = abs(thingtop - (bottomheight + ((topheight - bottomheight)/2))); @@ -679,6 +683,7 @@ void P_LineOpening(line_t *linedef) // Check for backsectors fake floors for (rover = back->ffloors; rover; rover = rover->next) { + fixed_t topheight, bottomheight; if (!(rover->flags & FF_EXISTS)) continue; @@ -688,8 +693,8 @@ void P_LineOpening(line_t *linedef) || (rover->flags & FF_BLOCKOTHERS && !tmthing->player))) continue; - fixed_t topheight = P_GetFOFTopZ(tmthing, back, rover, tmx, tmy, linedef); - fixed_t bottomheight = P_GetFOFBottomZ(tmthing, back, rover, tmx, tmy, linedef); + topheight = P_GetFOFTopZ(tmthing, back, rover, tmx, tmy, linedef); + bottomheight = P_GetFOFBottomZ(tmthing, back, rover, tmx, tmy, linedef); delta1 = abs(tmthing->z - (bottomheight + ((topheight - bottomheight)/2))); delta2 = abs(thingtop - (bottomheight + ((topheight - bottomheight)/2))); diff --git a/src/p_mobj.c b/src/p_mobj.c index 324989067..fd5b2d455 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -696,6 +696,7 @@ void P_ExplodeMissile(mobj_t *mo) // Returns TRUE if mobj is inside a non-solid 3d floor. boolean P_InsideANonSolidFFloor(mobj_t *mobj, ffloor_t *rover) { + fixed_t topheight, bottomheight; if (!(rover->flags & FF_EXISTS)) return false; @@ -703,8 +704,8 @@ boolean P_InsideANonSolidFFloor(mobj_t *mobj, ffloor_t *rover) || ((rover->flags & FF_BLOCKOTHERS) && !mobj->player))) return false; - fixed_t topheight = *rover->topheight; - fixed_t bottomheight = *rover->bottomheight; + topheight = *rover->topheight; + bottomheight = *rover->bottomheight; #ifdef ESLOPE if (*rover->t_slope) @@ -3006,13 +3007,14 @@ void P_MobjCheckWater(mobj_t *mobj) for (rover = sector->ffloors; rover; rover = rover->next) { + fixed_t topheight, bottomheight; if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_SWIMMABLE) || (((rover->flags & FF_BLOCKPLAYER) && mobj->player) || ((rover->flags & FF_BLOCKOTHERS) && !mobj->player))) continue; - fixed_t topheight = *rover->topheight; - fixed_t bottomheight = *rover->bottomheight; + topheight = *rover->topheight; + bottomheight = *rover->bottomheight; #ifdef ESLOPE if (*rover->t_slope) diff --git a/src/p_slopes.c b/src/p_slopes.c index bb150944e..755939039 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -32,6 +32,7 @@ #include "r_state.h" #include "m_bbox.h" #include "z_zone.h" +#include "p_local.h" #include "p_spec.h" #include "p_slopes.h" #include "p_setup.h" @@ -140,7 +141,8 @@ void P_RunDynamicSlopes(void) { case 5: // vertices { mapthing_t *mt; - size_t i, l; + size_t i; + INT32 l; line_t *line; for (i = 0; i < 3; i++) { @@ -322,7 +324,8 @@ void P_SpawnSlope_Line(int linenum) if(frontfloor) { - + fixed_t highest, lowest; + size_t l; point.z = line->frontsector->floorheight; // Startz dz = FixedDiv(origin.z - point.z, extent); // Destinationz @@ -351,12 +354,11 @@ void P_SpawnSlope_Line(int linenum) // *You can use sourceline as a reference to see if two slopes really are the same // Default points for high and low - fixed_t highest = point.z > origin.z ? point.z : origin.z; - fixed_t lowest = point.z < origin.z ? point.z : origin.z; + highest = point.z > origin.z ? point.z : origin.z; + lowest = point.z < origin.z ? point.z : origin.z; // Now check to see what the REAL high and low points of the slope inside the sector // TODO: Is this really needed outside of FOFs? -Red - size_t l; for (l = 0; l < line->frontsector->linecount; l++) { @@ -380,6 +382,8 @@ void P_SpawnSlope_Line(int linenum) } if(frontceil) { + fixed_t highest, lowest; + size_t l; origin.z = line->backsector->ceilingheight; point.z = line->frontsector->ceilingheight; dz = FixedDiv(origin.z - point.z, extent); @@ -396,9 +400,8 @@ void P_SpawnSlope_Line(int linenum) cslope->sourceline = line; // Remember the way the slope is formed - fixed_t highest = point.z > origin.z ? point.z : origin.z; - fixed_t lowest = point.z < origin.z ? point.z : origin.z; - size_t l; + highest = point.z > origin.z ? point.z : origin.z; + lowest = point.z < origin.z ? point.z : origin.z; for (l = 0; l < line->frontsector->linecount; l++) { @@ -446,6 +449,8 @@ void P_SpawnSlope_Line(int linenum) if(backfloor) { + fixed_t highest, lowest; + size_t l; point.z = line->backsector->floorheight; dz = FixedDiv(origin.z - point.z, extent); @@ -461,9 +466,8 @@ void P_SpawnSlope_Line(int linenum) fslope->sourceline = line; // Remember the way the slope is formed - fixed_t highest = point.z > origin.z ? point.z : origin.z; - fixed_t lowest = point.z < origin.z ? point.z : origin.z; - size_t l; + highest = point.z > origin.z ? point.z : origin.z; + lowest = point.z < origin.z ? point.z : origin.z; for (l = 0; l < line->backsector->linecount; l++) { @@ -487,6 +491,8 @@ void P_SpawnSlope_Line(int linenum) } if(backceil) { + fixed_t highest, lowest; + size_t l; origin.z = line->frontsector->ceilingheight; point.z = line->backsector->ceilingheight; dz = FixedDiv(origin.z - point.z, extent); @@ -503,10 +509,8 @@ void P_SpawnSlope_Line(int linenum) cslope->sourceline = line; // Remember the way the slope is formed - fixed_t highest = point.z > origin.z ? point.z : origin.z; - fixed_t lowest = point.z < origin.z ? point.z : origin.z; - - size_t l; + highest = point.z > origin.z ? point.z : origin.z; + lowest = point.z < origin.z ? point.z : origin.z; for (l = 0; l < line->backsector->linecount; l++) { diff --git a/src/p_slopes.h b/src/p_slopes.h index 8d82632ff..f2d1cd81e 100644 --- a/src/p_slopes.h +++ b/src/p_slopes.h @@ -29,6 +29,9 @@ #define P_SLOPES_H__ #ifdef ESLOPE +void P_CalculateSlopeNormal(pslope_t *slope); +void P_ReconfigureVertexSlope(pslope_t *slope); + void P_ResetDynamicSlopes(void); void P_RunDynamicSlopes(void); // P_SpawnSlope_Line @@ -36,6 +39,8 @@ void P_RunDynamicSlopes(void); // sectors. void P_SpawnSlope_Line(int linenum); +pslope_t *P_NewVertexSlope(INT16 tag1, INT16 tag2, INT16 tag3, UINT8 flags); + #ifdef SPRINGCLEAN // Loads just map objects that make slopes, // terrain affecting objects have to be spawned first diff --git a/src/p_spec.c b/src/p_spec.c index 694893502..3f39bd08e 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -29,6 +29,7 @@ #include "r_main.h" //Two extra includes. #include "r_sky.h" #include "p_polyobj.h" +#include "p_slopes.h" #include "hu_stuff.h" #include "m_misc.h" #include "m_cond.h" //unlock triggers @@ -7043,7 +7044,7 @@ static void Add_Friction(INT32 friction, INT32 movefactor, INT32 affectee, INT32 */ void T_Friction(friction_t *f) { - sector_t *sec, *referrer; + sector_t *sec, *referrer = NULL; mobj_t *thing; msecnode_t *node; @@ -7371,7 +7372,7 @@ static inline boolean PIT_PushThing(mobj_t *thing) */ void T_Pusher(pusher_t *p) { - sector_t *sec, *referrer; + sector_t *sec, *referrer = NULL; mobj_t *thing; msecnode_t *node; INT32 xspeed = 0,yspeed = 0; diff --git a/src/p_user.c b/src/p_user.c index b0eb2a224..d693cb277 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -29,6 +29,7 @@ #include "m_random.h" #include "m_misc.h" #include "i_video.h" +#include "p_slopes.h" #include "p_spec.h" #include "r_splats.h" #include "z_zone.h" @@ -2317,11 +2318,11 @@ static void P_DoClimbing(player_t *player) boolean thrust; boolean boostup; boolean skyclimber; + fixed_t floorheight, ceilingheight; // ESLOPE thrust = false; floorclimb = false; boostup = false; skyclimber = false; - fixed_t floorheight, ceilingheight; // ESLOPE #ifdef ESLOPE floorheight = glidesector->sector->f_slope ? P_GetZAt(glidesector->sector->f_slope, player->mo->x, player->mo->y) diff --git a/src/r_bsp.c b/src/r_bsp.c index 503b2e1f0..badf8bdac 100644 --- a/src/r_bsp.c +++ b/src/r_bsp.c @@ -18,6 +18,7 @@ #include "r_splats.h" #include "p_local.h" // camera +#include "p_slopes.h" #include "z_zone.h" // Check R_Prep3DFloors seg_t *curline; diff --git a/src/r_draw.h b/src/r_draw.h index 63fecc046..0ece26487 100644 --- a/src/r_draw.h +++ b/src/r_draw.h @@ -65,9 +65,9 @@ typedef struct { float x, y, z; } floatv3_t; -pslope_t *ds_slope; // Current slope being used -floatv3_t ds_su, ds_sv, ds_sz; // Vectors for... stuff? -float focallengthf, zeroheight; +extern pslope_t *ds_slope; // Current slope being used +extern floatv3_t ds_su, ds_sv, ds_sz; // Vectors for... stuff? +extern float focallengthf, zeroheight; #endif // Variable flat sizes @@ -152,6 +152,7 @@ void R_DrawTranslatedColumn_8(void); void R_DrawTranslatedTranslucentColumn_8(void); void R_DrawSpan_8(void); #ifdef ESLOPE +void R_CalcTiltedLighting(fixed_t start, fixed_t end); void R_DrawTiltedSpan_8(void); void R_DrawTiltedTranslucentSpan_8(void); void R_DrawTiltedSplat_8(void); diff --git a/src/r_draw8.c b/src/r_draw8.c index f78f1494b..2a4c89be7 100644 --- a/src/r_draw8.c +++ b/src/r_draw8.c @@ -529,14 +529,14 @@ void R_DrawSpan_8 (void) #ifdef ESLOPE // R_CalcTiltedLighting // Exactly what it says on the tin. I wish I wasn't too lazy to explain things properly. -static size_t tiltlighting[MAXVIDWIDTH]; +static INT32 tiltlighting[MAXVIDWIDTH]; void R_CalcTiltedLighting(fixed_t start, fixed_t end) { // ZDoom uses a different lighting setup to us, and I couldn't figure out how to adapt their version // of this function. Here's my own. INT32 left = ds_x1, right = ds_x2; fixed_t step = (end-start)/(ds_x2-ds_x1+1); - size_t i; + INT32 i; // I wanna do some optimizing by checking for out-of-range segments on either side to fill in all at once, // but I'm too bad at coding to not crash the game trying to do that. I guess this is fast enough for now... @@ -566,6 +566,11 @@ void R_DrawTiltedSpan_8(void) UINT8 *colormap; UINT8 *dest; + double startz, startu, startv; + double izstep, uzstep, vzstep; + double endz, endu, endv; + UINT32 stepu, stepv; + iz = ds_sz.z + ds_sz.y*(centery-ds_y) + ds_sz.x*(ds_x1-centerx); // Lighting is simple. It's just linear interpolation from start to end @@ -608,10 +613,9 @@ void R_DrawTiltedSpan_8(void) #define SPANSIZE 16 #define INVSPAN 0.0625f - double startz = 1.f/iz; - double startu = uz*startz; - double startv = vz*startz; - double izstep, uzstep, vzstep; + startz = 1.f/iz; + startu = uz*startz; + startv = vz*startz; izstep = ds_sz.x * SPANSIZE; uzstep = ds_su.x * SPANSIZE; @@ -625,11 +629,11 @@ void R_DrawTiltedSpan_8(void) uz += uzstep; vz += vzstep; - double endz = 1.f/iz; - double endu = uz*endz; - double endv = vz*endz; - UINT32 stepu = (INT64)((endu - startu) * INVSPAN); - UINT32 stepv = (INT64)((endv - startv) * INVSPAN); + endz = 1.f/iz; + endu = uz*endz; + endv = vz*endz; + stepu = (INT64)((endu - startu) * INVSPAN); + stepv = (INT64)((endv - startv) * INVSPAN); u = (INT64)(startu) + viewx; v = (INT64)(startv) + viewy; @@ -661,12 +665,12 @@ void R_DrawTiltedSpan_8(void) uz += ds_su.x * left; vz += ds_sv.x * left; - double endz = 1.f/iz; - double endu = uz*endz; - double endv = vz*endz; + endz = 1.f/iz; + endu = uz*endz; + endv = vz*endz; left = 1.f/left; - UINT32 stepu = (INT64)((endu - startu) * left); - UINT32 stepv = (INT64)((endv - startv) * left); + stepu = (INT64)((endu - startu) * left); + stepv = (INT64)((endv - startv) * left); u = (INT64)(startu) + viewx; v = (INT64)(startv) + viewy; @@ -683,7 +687,6 @@ void R_DrawTiltedSpan_8(void) #endif } - /** \brief The R_DrawTiltedTranslucentSpan_8 function Like DrawTiltedSpan, but translucent */ @@ -699,6 +702,11 @@ void R_DrawTiltedTranslucentSpan_8(void) UINT8 *colormap; UINT8 *dest; + double startz, startu, startv; + double izstep, uzstep, vzstep; + double endz, endu, endv; + UINT32 stepu, stepv; + iz = ds_sz.z + ds_sz.y*(centery-ds_y) + ds_sz.x*(ds_x1-centerx); // Lighting is simple. It's just linear interpolation from start to end @@ -741,10 +749,9 @@ void R_DrawTiltedTranslucentSpan_8(void) #define SPANSIZE 16 #define INVSPAN 0.0625f - double startz = 1.f/iz; - double startu = uz*startz; - double startv = vz*startz; - double izstep, uzstep, vzstep; + startz = 1.f/iz; + startu = uz*startz; + startv = vz*startz; izstep = ds_sz.x * SPANSIZE; uzstep = ds_su.x * SPANSIZE; @@ -758,11 +765,11 @@ void R_DrawTiltedTranslucentSpan_8(void) uz += uzstep; vz += vzstep; - double endz = 1.f/iz; - double endu = uz*endz; - double endv = vz*endz; - UINT32 stepu = (INT64)((endu - startu) * INVSPAN); - UINT32 stepv = (INT64)((endv - startv) * INVSPAN); + endz = 1.f/iz; + endu = uz*endz; + endv = vz*endz; + stepu = (INT64)((endu - startu) * INVSPAN); + stepv = (INT64)((endv - startv) * INVSPAN); u = (INT64)(startu) + viewx; v = (INT64)(startv) + viewy; @@ -794,12 +801,12 @@ void R_DrawTiltedTranslucentSpan_8(void) uz += ds_su.x * left; vz += ds_sv.x * left; - double endz = 1.f/iz; - double endu = uz*endz; - double endv = vz*endz; + endz = 1.f/iz; + endu = uz*endz; + endv = vz*endz; left = 1.f/left; - UINT32 stepu = (INT64)((endu - startu) * left); - UINT32 stepv = (INT64)((endv - startv) * left); + stepu = (INT64)((endu - startu) * left); + stepv = (INT64)((endv - startv) * left); u = (INT64)(startu) + viewx; v = (INT64)(startv) + viewy; @@ -830,6 +837,11 @@ void R_DrawTiltedSplat_8(void) UINT8 val; + double startz, startu, startv; + double izstep, uzstep, vzstep; + double endz, endu, endv; + UINT32 stepu, stepv; + iz = ds_sz.z + ds_sz.y*(centery-ds_y) + ds_sz.x*(ds_x1-centerx); // Lighting is simple. It's just linear interpolation from start to end @@ -874,10 +886,9 @@ void R_DrawTiltedSplat_8(void) #define SPANSIZE 16 #define INVSPAN 0.0625f - double startz = 1.f/iz; - double startu = uz*startz; - double startv = vz*startz; - double izstep, uzstep, vzstep; + startz = 1.f/iz; + startu = uz*startz; + startv = vz*startz; izstep = ds_sz.x * SPANSIZE; uzstep = ds_su.x * SPANSIZE; @@ -891,11 +902,11 @@ void R_DrawTiltedSplat_8(void) uz += uzstep; vz += vzstep; - double endz = 1.f/iz; - double endu = uz*endz; - double endv = vz*endz; - UINT32 stepu = (INT64)((endu - startu) * INVSPAN); - UINT32 stepv = (INT64)((endv - startv) * INVSPAN); + endz = 1.f/iz; + endu = uz*endz; + endv = vz*endz; + stepu = (INT64)((endu - startu) * INVSPAN); + stepv = (INT64)((endv - startv) * INVSPAN); u = (INT64)(startu) + viewx; v = (INT64)(startv) + viewy; @@ -931,12 +942,12 @@ void R_DrawTiltedSplat_8(void) uz += ds_su.x * left; vz += ds_sv.x * left; - double endz = 1.f/iz; - double endu = uz*endz; - double endv = vz*endz; + endz = 1.f/iz; + endu = uz*endz; + endv = vz*endz; left = 1.f/left; - UINT32 stepu = (INT64)((endu - startu) * left); - UINT32 stepv = (INT64)((endv - startv) * left); + stepu = (INT64)((endu - startu) * left); + stepv = (INT64)((endv - startv) * left); u = (INT64)(startu) + viewx; v = (INT64)(startv) + viewy; diff --git a/src/r_plane.c b/src/r_plane.c index 406a38d7b..fa0e0eac3 100644 --- a/src/r_plane.c +++ b/src/r_plane.c @@ -28,6 +28,8 @@ #include "p_setup.h" // levelflats +#include "p_slopes.h" + // // opening // @@ -952,6 +954,9 @@ void R_DrawSinglePlane(visplane_t *pl) float ang; float vx, vy, vz; float fudge; + // compiler complains when P_GetZAt is used in FLOAT_TO_FIXED directly + // use this as a temp var to store P_GetZAt's return value each time + fixed_t temp; xoffs &= ((1 << (32-nflatshiftup))-1); yoffs &= ((1 << (32-nflatshiftup))-1); @@ -969,7 +974,8 @@ void R_DrawSinglePlane(visplane_t *pl) vy = FIXED_TO_FLOAT(viewy-yoffs); vz = FIXED_TO_FLOAT(viewz); - zeroheight = FIXED_TO_FLOAT(P_GetZAt(pl->slope, viewx, viewy)); + temp = P_GetZAt(pl->slope, viewx, viewy); + zeroheight = FIXED_TO_FLOAT(temp); #define ANG2RAD(angle) ((float)((angle)*M_PI)/ANGLE_180) @@ -979,7 +985,8 @@ void R_DrawSinglePlane(visplane_t *pl) ang = ANG2RAD(ANGLE_270 - viewangle); p.x = vx * cos(ang) - vy * sin(ang); p.z = vx * sin(ang) + vy * cos(ang); - p.y = FIXED_TO_FLOAT(P_GetZAt(pl->slope, -xoffs, yoffs)) - vz; + temp = P_GetZAt(pl->slope, -xoffs, yoffs); + p.y = FIXED_TO_FLOAT(temp) - vz; // m is the v direction vector in view space ang = ANG2RAD(ANGLE_180 - viewangle - pl->plangle); @@ -991,8 +998,10 @@ void R_DrawSinglePlane(visplane_t *pl) n.z = -cos(ang); ang = ANG2RAD(pl->plangle); - m.y = FIXED_TO_FLOAT(P_GetZAt(pl->slope, viewx + FLOAT_TO_FIXED(sin(ang)), viewy + FLOAT_TO_FIXED(cos(ang)))) - zeroheight; - n.y = FIXED_TO_FLOAT(P_GetZAt(pl->slope, viewx + FLOAT_TO_FIXED(cos(ang)), viewy - FLOAT_TO_FIXED(sin(ang)))) - zeroheight; + temp = P_GetZAt(pl->slope, viewx + FLOAT_TO_FIXED(sin(ang)), viewy + FLOAT_TO_FIXED(cos(ang))); + m.y = FIXED_TO_FLOAT(temp) - zeroheight; + temp = P_GetZAt(pl->slope, viewx + FLOAT_TO_FIXED(cos(ang)), viewy - FLOAT_TO_FIXED(sin(ang))); + n.y = FIXED_TO_FLOAT(temp) - zeroheight; m.x /= fudge; m.y /= fudge; diff --git a/src/r_segs.c b/src/r_segs.c index 2d41d702c..75e7b8b98 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -22,6 +22,7 @@ #include "d_netcmd.h" #include "m_misc.h" #include "p_local.h" // Camera... +#include "p_slopes.h" #include "console.h" // con_clipviewtop // OPTIMIZE: closed two sided lines as single sided @@ -1489,7 +1490,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) fixed_t hyp; fixed_t sineval; angle_t distangle, offsetangle; - fixed_t vtop; + //fixed_t vtop; INT32 lightnum; INT32 i, p; lightlist_t *light; @@ -1502,6 +1503,10 @@ void R_StoreWallRange(INT32 start, INT32 stop) maskedtextureheight = NULL; + //initialize segleft and segright + memset(&segleft, 0x00, sizeof(segleft)); + memset(&segright, 0x00, sizeof(segright)); + if (ds_p == drawsegs+maxdrawsegs) { size_t pos = ds_p - drawsegs; @@ -2630,11 +2635,11 @@ void R_StoreWallRange(INT32 start, INT32 stop) { ffloor_t * rover; - i = 0; #ifdef ESLOPE fixed_t rovertest; fixed_t planevistest; #endif + i = 0; if (backsector->ffloors) { diff --git a/src/r_things.c b/src/r_things.c index 3a38eb482..85221dce2 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -24,6 +24,7 @@ #include "r_plane.h" #include "p_tick.h" #include "p_local.h" +#include "p_slopes.h" #include "dehacked.h" // get_number (for thok) #include "d_netfil.h" // blargh. for nameonly(). #include "m_cheat.h" // objectplace