MI's slope compiling fixes

This commit is contained in:
RedEnchilada 2015-12-06 15:57:44 -06:00
parent 773e5fbda6
commit 30d2b8cb4f
13 changed files with 140 additions and 90 deletions

View file

@ -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) for (rover = newsubsec->sector->ffloors; rover; rover = rover->next)
{ {
fixed_t topheight, bottomheight;
if (!(rover->flags & FF_EXISTS)) if (!(rover->flags & FF_EXISTS))
continue; continue;
fixed_t topheight = P_GetFOFTopZ(thing, newsubsec->sector, rover, x, y, NULL); topheight = P_GetFOFTopZ(thing, newsubsec->sector, rover, x, y, NULL);
fixed_t bottomheight = P_GetFOFBottomZ(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)) 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) 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) if (!(rover->flags & FF_BLOCKOTHERS) || !(rover->flags & FF_EXISTS) || !(rover->flags & FF_RENDERALL) || GETSECSPECIAL(rover->master->frontsector->special, 4) == 12)
continue; continue;
fixed_t topheight = P_CameraGetFOFTopZ(thiscam, newsubsec->sector, rover, x, y, NULL); topheight = P_CameraGetFOFTopZ(thiscam, newsubsec->sector, rover, x, y, NULL);
fixed_t bottomheight = P_CameraGetFOFBottomZ(thiscam, newsubsec->sector, rover, x, y, NULL); bottomheight = P_CameraGetFOFBottomZ(thiscam, newsubsec->sector, rover, x, y, NULL);
delta1 = thiscam->z - (bottomheight delta1 = thiscam->z - (bottomheight
+ ((topheight - bottomheight)/2)); + ((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) for (rover = sec->ffloors; rover; rover = rover->next)
{ {
fixed_t topheight, bottomheight;
if (!(rover->flags & FF_EXISTS)) if (!(rover->flags & FF_EXISTS))
continue; continue;
if ((!(rover->flags & FF_SOLID || rover->flags & FF_QUICKSAND) || (rover->flags & FF_SWIMMABLE))) if ((!(rover->flags & FF_SOLID || rover->flags & FF_QUICKSAND) || (rover->flags & FF_SWIMMABLE)))
continue; continue;
fixed_t topheight = *rover->topheight; topheight = *rover->topheight;
fixed_t bottomheight = *rover->bottomheight; bottomheight = *rover->bottomheight;
#ifdef ESLOPE #ifdef ESLOPE
if (*rover->t_slope) if (*rover->t_slope)

View file

@ -20,6 +20,7 @@
#include "r_data.h" #include "r_data.h"
#include "p_maputl.h" #include "p_maputl.h"
#include "p_polyobj.h" #include "p_polyobj.h"
#include "p_slopes.h"
#include "z_zone.h" #include "z_zone.h"
// //
@ -442,11 +443,12 @@ void P_CameraLineOpening(line_t *linedef)
if (front->ffloors) if (front->ffloors)
for (rover = front->ffloors; rover; rover = rover->next) 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) if (!(rover->flags & FF_BLOCKOTHERS) || !(rover->flags & FF_RENDERALL) || !(rover->flags & FF_EXISTS) || GETSECSPECIAL(rover->master->frontsector->special, 4) == 12)
continue; continue;
fixed_t topheight = P_CameraGetFOFTopZ(mapcampointer, front, rover, tmx, tmy, linedef); topheight = P_CameraGetFOFTopZ(mapcampointer, front, rover, tmx, tmy, linedef);
fixed_t bottomheight = P_CameraGetFOFBottomZ(mapcampointer, front, rover, tmx, tmy, linedef); bottomheight = P_CameraGetFOFBottomZ(mapcampointer, front, rover, tmx, tmy, linedef);
delta1 = abs(mapcampointer->z - (bottomheight + ((topheight - bottomheight)/2))); delta1 = abs(mapcampointer->z - (bottomheight + ((topheight - bottomheight)/2)));
delta2 = abs(thingtop - (bottomheight + ((topheight - bottomheight)/2))); delta2 = abs(thingtop - (bottomheight + ((topheight - bottomheight)/2)));
@ -465,11 +467,12 @@ void P_CameraLineOpening(line_t *linedef)
if (back->ffloors) if (back->ffloors)
for (rover = back->ffloors; rover; rover = rover->next) 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) if (!(rover->flags & FF_BLOCKOTHERS) || !(rover->flags & FF_RENDERALL) || !(rover->flags & FF_EXISTS) || GETSECSPECIAL(rover->master->frontsector->special, 4) == 12)
continue; continue;
fixed_t topheight = P_CameraGetFOFTopZ(mapcampointer, back, rover, tmx, tmy, linedef); topheight = P_CameraGetFOFTopZ(mapcampointer, back, rover, tmx, tmy, linedef);
fixed_t bottomheight = P_CameraGetFOFBottomZ(mapcampointer, back, rover, tmx, tmy, linedef); bottomheight = P_CameraGetFOFBottomZ(mapcampointer, back, rover, tmx, tmy, linedef);
delta1 = abs(mapcampointer->z - (bottomheight + ((topheight - bottomheight)/2))); delta1 = abs(mapcampointer->z - (bottomheight + ((topheight - bottomheight)/2)));
delta2 = abs(thingtop - (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 // Check for frontsector's fake floors
for (rover = front->ffloors; rover; rover = rover->next) for (rover = front->ffloors; rover; rover = rover->next)
{ {
fixed_t topheight, bottomheight;
if (!(rover->flags & FF_EXISTS)) if (!(rover->flags & FF_EXISTS))
continue; continue;
@ -645,8 +649,8 @@ void P_LineOpening(line_t *linedef)
|| (rover->flags & FF_BLOCKOTHERS && !tmthing->player))) || (rover->flags & FF_BLOCKOTHERS && !tmthing->player)))
continue; continue;
fixed_t topheight = P_GetFOFTopZ(tmthing, front, rover, tmx, tmy, linedef); topheight = P_GetFOFTopZ(tmthing, front, rover, tmx, tmy, linedef);
fixed_t bottomheight = P_GetFOFBottomZ(tmthing, front, rover, tmx, tmy, linedef); bottomheight = P_GetFOFBottomZ(tmthing, front, rover, tmx, tmy, linedef);
delta1 = abs(tmthing->z - (bottomheight + ((topheight - bottomheight)/2))); delta1 = abs(tmthing->z - (bottomheight + ((topheight - bottomheight)/2)));
delta2 = abs(thingtop - (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 // Check for backsectors fake floors
for (rover = back->ffloors; rover; rover = rover->next) for (rover = back->ffloors; rover; rover = rover->next)
{ {
fixed_t topheight, bottomheight;
if (!(rover->flags & FF_EXISTS)) if (!(rover->flags & FF_EXISTS))
continue; continue;
@ -688,8 +693,8 @@ void P_LineOpening(line_t *linedef)
|| (rover->flags & FF_BLOCKOTHERS && !tmthing->player))) || (rover->flags & FF_BLOCKOTHERS && !tmthing->player)))
continue; continue;
fixed_t topheight = P_GetFOFTopZ(tmthing, back, rover, tmx, tmy, linedef); topheight = P_GetFOFTopZ(tmthing, back, rover, tmx, tmy, linedef);
fixed_t bottomheight = P_GetFOFBottomZ(tmthing, back, rover, tmx, tmy, linedef); bottomheight = P_GetFOFBottomZ(tmthing, back, rover, tmx, tmy, linedef);
delta1 = abs(tmthing->z - (bottomheight + ((topheight - bottomheight)/2))); delta1 = abs(tmthing->z - (bottomheight + ((topheight - bottomheight)/2)));
delta2 = abs(thingtop - (bottomheight + ((topheight - bottomheight)/2))); delta2 = abs(thingtop - (bottomheight + ((topheight - bottomheight)/2)));

View file

@ -696,6 +696,7 @@ void P_ExplodeMissile(mobj_t *mo)
// Returns TRUE if mobj is inside a non-solid 3d floor. // Returns TRUE if mobj is inside a non-solid 3d floor.
boolean P_InsideANonSolidFFloor(mobj_t *mobj, ffloor_t *rover) boolean P_InsideANonSolidFFloor(mobj_t *mobj, ffloor_t *rover)
{ {
fixed_t topheight, bottomheight;
if (!(rover->flags & FF_EXISTS)) if (!(rover->flags & FF_EXISTS))
return false; return false;
@ -703,8 +704,8 @@ boolean P_InsideANonSolidFFloor(mobj_t *mobj, ffloor_t *rover)
|| ((rover->flags & FF_BLOCKOTHERS) && !mobj->player))) || ((rover->flags & FF_BLOCKOTHERS) && !mobj->player)))
return false; return false;
fixed_t topheight = *rover->topheight; topheight = *rover->topheight;
fixed_t bottomheight = *rover->bottomheight; bottomheight = *rover->bottomheight;
#ifdef ESLOPE #ifdef ESLOPE
if (*rover->t_slope) if (*rover->t_slope)
@ -3006,13 +3007,14 @@ void P_MobjCheckWater(mobj_t *mobj)
for (rover = sector->ffloors; rover; rover = rover->next) for (rover = sector->ffloors; rover; rover = rover->next)
{ {
fixed_t topheight, bottomheight;
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_SWIMMABLE) if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_SWIMMABLE)
|| (((rover->flags & FF_BLOCKPLAYER) && mobj->player) || (((rover->flags & FF_BLOCKPLAYER) && mobj->player)
|| ((rover->flags & FF_BLOCKOTHERS) && !mobj->player))) || ((rover->flags & FF_BLOCKOTHERS) && !mobj->player)))
continue; continue;
fixed_t topheight = *rover->topheight; topheight = *rover->topheight;
fixed_t bottomheight = *rover->bottomheight; bottomheight = *rover->bottomheight;
#ifdef ESLOPE #ifdef ESLOPE
if (*rover->t_slope) if (*rover->t_slope)

View file

@ -32,6 +32,7 @@
#include "r_state.h" #include "r_state.h"
#include "m_bbox.h" #include "m_bbox.h"
#include "z_zone.h" #include "z_zone.h"
#include "p_local.h"
#include "p_spec.h" #include "p_spec.h"
#include "p_slopes.h" #include "p_slopes.h"
#include "p_setup.h" #include "p_setup.h"
@ -140,7 +141,8 @@ void P_RunDynamicSlopes(void) {
case 5: // vertices case 5: // vertices
{ {
mapthing_t *mt; mapthing_t *mt;
size_t i, l; size_t i;
INT32 l;
line_t *line; line_t *line;
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
@ -322,7 +324,8 @@ void P_SpawnSlope_Line(int linenum)
if(frontfloor) if(frontfloor)
{ {
fixed_t highest, lowest;
size_t l;
point.z = line->frontsector->floorheight; // Startz point.z = line->frontsector->floorheight; // Startz
dz = FixedDiv(origin.z - point.z, extent); // Destinationz 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 // *You can use sourceline as a reference to see if two slopes really are the same
// Default points for high and low // Default points for high and low
fixed_t highest = point.z > origin.z ? point.z : origin.z; highest = point.z > origin.z ? point.z : origin.z;
fixed_t lowest = 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 // 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 // TODO: Is this really needed outside of FOFs? -Red
size_t l;
for (l = 0; l < line->frontsector->linecount; l++) for (l = 0; l < line->frontsector->linecount; l++)
{ {
@ -380,6 +382,8 @@ void P_SpawnSlope_Line(int linenum)
} }
if(frontceil) if(frontceil)
{ {
fixed_t highest, lowest;
size_t l;
origin.z = line->backsector->ceilingheight; origin.z = line->backsector->ceilingheight;
point.z = line->frontsector->ceilingheight; point.z = line->frontsector->ceilingheight;
dz = FixedDiv(origin.z - point.z, extent); dz = FixedDiv(origin.z - point.z, extent);
@ -396,9 +400,8 @@ void P_SpawnSlope_Line(int linenum)
cslope->sourceline = line; cslope->sourceline = line;
// Remember the way the slope is formed // Remember the way the slope is formed
fixed_t highest = point.z > origin.z ? point.z : origin.z; highest = point.z > origin.z ? point.z : origin.z;
fixed_t lowest = point.z < origin.z ? point.z : origin.z; lowest = point.z < origin.z ? point.z : origin.z;
size_t l;
for (l = 0; l < line->frontsector->linecount; l++) for (l = 0; l < line->frontsector->linecount; l++)
{ {
@ -446,6 +449,8 @@ void P_SpawnSlope_Line(int linenum)
if(backfloor) if(backfloor)
{ {
fixed_t highest, lowest;
size_t l;
point.z = line->backsector->floorheight; point.z = line->backsector->floorheight;
dz = FixedDiv(origin.z - point.z, extent); dz = FixedDiv(origin.z - point.z, extent);
@ -461,9 +466,8 @@ void P_SpawnSlope_Line(int linenum)
fslope->sourceline = line; fslope->sourceline = line;
// Remember the way the slope is formed // Remember the way the slope is formed
fixed_t highest = point.z > origin.z ? point.z : origin.z; highest = point.z > origin.z ? point.z : origin.z;
fixed_t lowest = point.z < origin.z ? point.z : origin.z; lowest = point.z < origin.z ? point.z : origin.z;
size_t l;
for (l = 0; l < line->backsector->linecount; l++) for (l = 0; l < line->backsector->linecount; l++)
{ {
@ -487,6 +491,8 @@ void P_SpawnSlope_Line(int linenum)
} }
if(backceil) if(backceil)
{ {
fixed_t highest, lowest;
size_t l;
origin.z = line->frontsector->ceilingheight; origin.z = line->frontsector->ceilingheight;
point.z = line->backsector->ceilingheight; point.z = line->backsector->ceilingheight;
dz = FixedDiv(origin.z - point.z, extent); dz = FixedDiv(origin.z - point.z, extent);
@ -503,10 +509,8 @@ void P_SpawnSlope_Line(int linenum)
cslope->sourceline = line; cslope->sourceline = line;
// Remember the way the slope is formed // Remember the way the slope is formed
fixed_t highest = point.z > origin.z ? point.z : origin.z; highest = point.z > origin.z ? point.z : origin.z;
fixed_t lowest = point.z < origin.z ? point.z : origin.z; lowest = point.z < origin.z ? point.z : origin.z;
size_t l;
for (l = 0; l < line->backsector->linecount; l++) for (l = 0; l < line->backsector->linecount; l++)
{ {

View file

@ -29,6 +29,9 @@
#define P_SLOPES_H__ #define P_SLOPES_H__
#ifdef ESLOPE #ifdef ESLOPE
void P_CalculateSlopeNormal(pslope_t *slope);
void P_ReconfigureVertexSlope(pslope_t *slope);
void P_ResetDynamicSlopes(void); void P_ResetDynamicSlopes(void);
void P_RunDynamicSlopes(void); void P_RunDynamicSlopes(void);
// P_SpawnSlope_Line // P_SpawnSlope_Line
@ -36,6 +39,8 @@ void P_RunDynamicSlopes(void);
// sectors. // sectors.
void P_SpawnSlope_Line(int linenum); void P_SpawnSlope_Line(int linenum);
pslope_t *P_NewVertexSlope(INT16 tag1, INT16 tag2, INT16 tag3, UINT8 flags);
#ifdef SPRINGCLEAN #ifdef SPRINGCLEAN
// Loads just map objects that make slopes, // Loads just map objects that make slopes,
// terrain affecting objects have to be spawned first // terrain affecting objects have to be spawned first

View file

@ -29,6 +29,7 @@
#include "r_main.h" //Two extra includes. #include "r_main.h" //Two extra includes.
#include "r_sky.h" #include "r_sky.h"
#include "p_polyobj.h" #include "p_polyobj.h"
#include "p_slopes.h"
#include "hu_stuff.h" #include "hu_stuff.h"
#include "m_misc.h" #include "m_misc.h"
#include "m_cond.h" //unlock triggers #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) void T_Friction(friction_t *f)
{ {
sector_t *sec, *referrer; sector_t *sec, *referrer = NULL;
mobj_t *thing; mobj_t *thing;
msecnode_t *node; msecnode_t *node;
@ -7371,7 +7372,7 @@ static inline boolean PIT_PushThing(mobj_t *thing)
*/ */
void T_Pusher(pusher_t *p) void T_Pusher(pusher_t *p)
{ {
sector_t *sec, *referrer; sector_t *sec, *referrer = NULL;
mobj_t *thing; mobj_t *thing;
msecnode_t *node; msecnode_t *node;
INT32 xspeed = 0,yspeed = 0; INT32 xspeed = 0,yspeed = 0;

View file

@ -29,6 +29,7 @@
#include "m_random.h" #include "m_random.h"
#include "m_misc.h" #include "m_misc.h"
#include "i_video.h" #include "i_video.h"
#include "p_slopes.h"
#include "p_spec.h" #include "p_spec.h"
#include "r_splats.h" #include "r_splats.h"
#include "z_zone.h" #include "z_zone.h"
@ -2317,11 +2318,11 @@ static void P_DoClimbing(player_t *player)
boolean thrust; boolean thrust;
boolean boostup; boolean boostup;
boolean skyclimber; boolean skyclimber;
fixed_t floorheight, ceilingheight; // ESLOPE
thrust = false; thrust = false;
floorclimb = false; floorclimb = false;
boostup = false; boostup = false;
skyclimber = false; skyclimber = false;
fixed_t floorheight, ceilingheight; // ESLOPE
#ifdef ESLOPE #ifdef ESLOPE
floorheight = glidesector->sector->f_slope ? P_GetZAt(glidesector->sector->f_slope, player->mo->x, player->mo->y) floorheight = glidesector->sector->f_slope ? P_GetZAt(glidesector->sector->f_slope, player->mo->x, player->mo->y)

View file

@ -18,6 +18,7 @@
#include "r_splats.h" #include "r_splats.h"
#include "p_local.h" // camera #include "p_local.h" // camera
#include "p_slopes.h"
#include "z_zone.h" // Check R_Prep3DFloors #include "z_zone.h" // Check R_Prep3DFloors
seg_t *curline; seg_t *curline;

View file

@ -65,9 +65,9 @@ typedef struct {
float x, y, z; float x, y, z;
} floatv3_t; } floatv3_t;
pslope_t *ds_slope; // Current slope being used extern pslope_t *ds_slope; // Current slope being used
floatv3_t ds_su, ds_sv, ds_sz; // Vectors for... stuff? extern floatv3_t ds_su, ds_sv, ds_sz; // Vectors for... stuff?
float focallengthf, zeroheight; extern float focallengthf, zeroheight;
#endif #endif
// Variable flat sizes // Variable flat sizes
@ -152,6 +152,7 @@ void R_DrawTranslatedColumn_8(void);
void R_DrawTranslatedTranslucentColumn_8(void); void R_DrawTranslatedTranslucentColumn_8(void);
void R_DrawSpan_8(void); void R_DrawSpan_8(void);
#ifdef ESLOPE #ifdef ESLOPE
void R_CalcTiltedLighting(fixed_t start, fixed_t end);
void R_DrawTiltedSpan_8(void); void R_DrawTiltedSpan_8(void);
void R_DrawTiltedTranslucentSpan_8(void); void R_DrawTiltedTranslucentSpan_8(void);
void R_DrawTiltedSplat_8(void); void R_DrawTiltedSplat_8(void);

View file

@ -529,14 +529,14 @@ void R_DrawSpan_8 (void)
#ifdef ESLOPE #ifdef ESLOPE
// R_CalcTiltedLighting // R_CalcTiltedLighting
// Exactly what it says on the tin. I wish I wasn't too lazy to explain things properly. // 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) 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 // 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. // of this function. Here's my own.
INT32 left = ds_x1, right = ds_x2; INT32 left = ds_x1, right = ds_x2;
fixed_t step = (end-start)/(ds_x2-ds_x1+1); 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, // 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... // 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 *colormap;
UINT8 *dest; 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); 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 // 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 SPANSIZE 16
#define INVSPAN 0.0625f #define INVSPAN 0.0625f
double startz = 1.f/iz; startz = 1.f/iz;
double startu = uz*startz; startu = uz*startz;
double startv = vz*startz; startv = vz*startz;
double izstep, uzstep, vzstep;
izstep = ds_sz.x * SPANSIZE; izstep = ds_sz.x * SPANSIZE;
uzstep = ds_su.x * SPANSIZE; uzstep = ds_su.x * SPANSIZE;
@ -625,11 +629,11 @@ void R_DrawTiltedSpan_8(void)
uz += uzstep; uz += uzstep;
vz += vzstep; vz += vzstep;
double endz = 1.f/iz; endz = 1.f/iz;
double endu = uz*endz; endu = uz*endz;
double endv = vz*endz; endv = vz*endz;
UINT32 stepu = (INT64)((endu - startu) * INVSPAN); stepu = (INT64)((endu - startu) * INVSPAN);
UINT32 stepv = (INT64)((endv - startv) * INVSPAN); stepv = (INT64)((endv - startv) * INVSPAN);
u = (INT64)(startu) + viewx; u = (INT64)(startu) + viewx;
v = (INT64)(startv) + viewy; v = (INT64)(startv) + viewy;
@ -661,12 +665,12 @@ void R_DrawTiltedSpan_8(void)
uz += ds_su.x * left; uz += ds_su.x * left;
vz += ds_sv.x * left; vz += ds_sv.x * left;
double endz = 1.f/iz; endz = 1.f/iz;
double endu = uz*endz; endu = uz*endz;
double endv = vz*endz; endv = vz*endz;
left = 1.f/left; left = 1.f/left;
UINT32 stepu = (INT64)((endu - startu) * left); stepu = (INT64)((endu - startu) * left);
UINT32 stepv = (INT64)((endv - startv) * left); stepv = (INT64)((endv - startv) * left);
u = (INT64)(startu) + viewx; u = (INT64)(startu) + viewx;
v = (INT64)(startv) + viewy; v = (INT64)(startv) + viewy;
@ -683,7 +687,6 @@ void R_DrawTiltedSpan_8(void)
#endif #endif
} }
/** \brief The R_DrawTiltedTranslucentSpan_8 function /** \brief The R_DrawTiltedTranslucentSpan_8 function
Like DrawTiltedSpan, but translucent Like DrawTiltedSpan, but translucent
*/ */
@ -699,6 +702,11 @@ void R_DrawTiltedTranslucentSpan_8(void)
UINT8 *colormap; UINT8 *colormap;
UINT8 *dest; 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); 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 // 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 SPANSIZE 16
#define INVSPAN 0.0625f #define INVSPAN 0.0625f
double startz = 1.f/iz; startz = 1.f/iz;
double startu = uz*startz; startu = uz*startz;
double startv = vz*startz; startv = vz*startz;
double izstep, uzstep, vzstep;
izstep = ds_sz.x * SPANSIZE; izstep = ds_sz.x * SPANSIZE;
uzstep = ds_su.x * SPANSIZE; uzstep = ds_su.x * SPANSIZE;
@ -758,11 +765,11 @@ void R_DrawTiltedTranslucentSpan_8(void)
uz += uzstep; uz += uzstep;
vz += vzstep; vz += vzstep;
double endz = 1.f/iz; endz = 1.f/iz;
double endu = uz*endz; endu = uz*endz;
double endv = vz*endz; endv = vz*endz;
UINT32 stepu = (INT64)((endu - startu) * INVSPAN); stepu = (INT64)((endu - startu) * INVSPAN);
UINT32 stepv = (INT64)((endv - startv) * INVSPAN); stepv = (INT64)((endv - startv) * INVSPAN);
u = (INT64)(startu) + viewx; u = (INT64)(startu) + viewx;
v = (INT64)(startv) + viewy; v = (INT64)(startv) + viewy;
@ -794,12 +801,12 @@ void R_DrawTiltedTranslucentSpan_8(void)
uz += ds_su.x * left; uz += ds_su.x * left;
vz += ds_sv.x * left; vz += ds_sv.x * left;
double endz = 1.f/iz; endz = 1.f/iz;
double endu = uz*endz; endu = uz*endz;
double endv = vz*endz; endv = vz*endz;
left = 1.f/left; left = 1.f/left;
UINT32 stepu = (INT64)((endu - startu) * left); stepu = (INT64)((endu - startu) * left);
UINT32 stepv = (INT64)((endv - startv) * left); stepv = (INT64)((endv - startv) * left);
u = (INT64)(startu) + viewx; u = (INT64)(startu) + viewx;
v = (INT64)(startv) + viewy; v = (INT64)(startv) + viewy;
@ -830,6 +837,11 @@ void R_DrawTiltedSplat_8(void)
UINT8 val; 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); 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 // 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 SPANSIZE 16
#define INVSPAN 0.0625f #define INVSPAN 0.0625f
double startz = 1.f/iz; startz = 1.f/iz;
double startu = uz*startz; startu = uz*startz;
double startv = vz*startz; startv = vz*startz;
double izstep, uzstep, vzstep;
izstep = ds_sz.x * SPANSIZE; izstep = ds_sz.x * SPANSIZE;
uzstep = ds_su.x * SPANSIZE; uzstep = ds_su.x * SPANSIZE;
@ -891,11 +902,11 @@ void R_DrawTiltedSplat_8(void)
uz += uzstep; uz += uzstep;
vz += vzstep; vz += vzstep;
double endz = 1.f/iz; endz = 1.f/iz;
double endu = uz*endz; endu = uz*endz;
double endv = vz*endz; endv = vz*endz;
UINT32 stepu = (INT64)((endu - startu) * INVSPAN); stepu = (INT64)((endu - startu) * INVSPAN);
UINT32 stepv = (INT64)((endv - startv) * INVSPAN); stepv = (INT64)((endv - startv) * INVSPAN);
u = (INT64)(startu) + viewx; u = (INT64)(startu) + viewx;
v = (INT64)(startv) + viewy; v = (INT64)(startv) + viewy;
@ -931,12 +942,12 @@ void R_DrawTiltedSplat_8(void)
uz += ds_su.x * left; uz += ds_su.x * left;
vz += ds_sv.x * left; vz += ds_sv.x * left;
double endz = 1.f/iz; endz = 1.f/iz;
double endu = uz*endz; endu = uz*endz;
double endv = vz*endz; endv = vz*endz;
left = 1.f/left; left = 1.f/left;
UINT32 stepu = (INT64)((endu - startu) * left); stepu = (INT64)((endu - startu) * left);
UINT32 stepv = (INT64)((endv - startv) * left); stepv = (INT64)((endv - startv) * left);
u = (INT64)(startu) + viewx; u = (INT64)(startu) + viewx;
v = (INT64)(startv) + viewy; v = (INT64)(startv) + viewy;

View file

@ -28,6 +28,8 @@
#include "p_setup.h" // levelflats #include "p_setup.h" // levelflats
#include "p_slopes.h"
// //
// opening // opening
// //
@ -952,6 +954,9 @@ void R_DrawSinglePlane(visplane_t *pl)
float ang; float ang;
float vx, vy, vz; float vx, vy, vz;
float fudge; 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); xoffs &= ((1 << (32-nflatshiftup))-1);
yoffs &= ((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); vy = FIXED_TO_FLOAT(viewy-yoffs);
vz = FIXED_TO_FLOAT(viewz); 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) #define ANG2RAD(angle) ((float)((angle)*M_PI)/ANGLE_180)
@ -979,7 +985,8 @@ void R_DrawSinglePlane(visplane_t *pl)
ang = ANG2RAD(ANGLE_270 - viewangle); ang = ANG2RAD(ANGLE_270 - viewangle);
p.x = vx * cos(ang) - vy * sin(ang); p.x = vx * cos(ang) - vy * sin(ang);
p.z = vx * sin(ang) + vy * cos(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 // m is the v direction vector in view space
ang = ANG2RAD(ANGLE_180 - viewangle - pl->plangle); ang = ANG2RAD(ANGLE_180 - viewangle - pl->plangle);
@ -991,8 +998,10 @@ void R_DrawSinglePlane(visplane_t *pl)
n.z = -cos(ang); n.z = -cos(ang);
ang = ANG2RAD(pl->plangle); 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; temp = P_GetZAt(pl->slope, viewx + FLOAT_TO_FIXED(sin(ang)), viewy + FLOAT_TO_FIXED(cos(ang)));
n.y = FIXED_TO_FLOAT(P_GetZAt(pl->slope, viewx + FLOAT_TO_FIXED(cos(ang)), viewy - FLOAT_TO_FIXED(sin(ang)))) - zeroheight; 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.x /= fudge;
m.y /= fudge; m.y /= fudge;

View file

@ -22,6 +22,7 @@
#include "d_netcmd.h" #include "d_netcmd.h"
#include "m_misc.h" #include "m_misc.h"
#include "p_local.h" // Camera... #include "p_local.h" // Camera...
#include "p_slopes.h"
#include "console.h" // con_clipviewtop #include "console.h" // con_clipviewtop
// OPTIMIZE: closed two sided lines as single sided // OPTIMIZE: closed two sided lines as single sided
@ -1489,7 +1490,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
fixed_t hyp; fixed_t hyp;
fixed_t sineval; fixed_t sineval;
angle_t distangle, offsetangle; angle_t distangle, offsetangle;
fixed_t vtop; //fixed_t vtop;
INT32 lightnum; INT32 lightnum;
INT32 i, p; INT32 i, p;
lightlist_t *light; lightlist_t *light;
@ -1502,6 +1503,10 @@ void R_StoreWallRange(INT32 start, INT32 stop)
maskedtextureheight = NULL; maskedtextureheight = NULL;
//initialize segleft and segright
memset(&segleft, 0x00, sizeof(segleft));
memset(&segright, 0x00, sizeof(segright));
if (ds_p == drawsegs+maxdrawsegs) if (ds_p == drawsegs+maxdrawsegs)
{ {
size_t pos = ds_p - drawsegs; size_t pos = ds_p - drawsegs;
@ -2630,11 +2635,11 @@ void R_StoreWallRange(INT32 start, INT32 stop)
{ {
ffloor_t * rover; ffloor_t * rover;
i = 0;
#ifdef ESLOPE #ifdef ESLOPE
fixed_t rovertest; fixed_t rovertest;
fixed_t planevistest; fixed_t planevistest;
#endif #endif
i = 0;
if (backsector->ffloors) if (backsector->ffloors)
{ {

View file

@ -24,6 +24,7 @@
#include "r_plane.h" #include "r_plane.h"
#include "p_tick.h" #include "p_tick.h"
#include "p_local.h" #include "p_local.h"
#include "p_slopes.h"
#include "dehacked.h" // get_number (for thok) #include "dehacked.h" // get_number (for thok)
#include "d_netfil.h" // blargh. for nameonly(). #include "d_netfil.h" // blargh. for nameonly().
#include "m_cheat.h" // objectplace #include "m_cheat.h" // objectplace