mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 15:22:15 +00:00
Merge branch 'master' of https://github.com/rheit/zdoom into z_osx_clean
This commit is contained in:
commit
b6404180bb
7 changed files with 1060 additions and 1019 deletions
|
@ -120,6 +120,16 @@ FRandom pr_acs ("ACS");
|
|||
#define SDF_ABSANGLE 1
|
||||
#define SDF_PERMANENT 2
|
||||
|
||||
// GetArmorInfo
|
||||
enum
|
||||
{
|
||||
ARMORINFO_CLASSNAME,
|
||||
ARMORINFO_SAVEAMOUNT,
|
||||
ARMORINFO_SAVEPERCENT,
|
||||
ARMORINFO_MAXABSORB,
|
||||
ARMORINFO_MAXFULLABSORB,
|
||||
};
|
||||
|
||||
struct CallReturn
|
||||
{
|
||||
CallReturn(int pc, ScriptFunction *func, FBehavior *module, SDWORD *locals, ACSLocalArrays *arrays, bool discard, unsigned int runaway)
|
||||
|
@ -4349,6 +4359,7 @@ enum EACSFunctions
|
|||
ACSF_GetActorPowerupTics,
|
||||
ACSF_ChangeActorAngle,
|
||||
ACSF_ChangeActorPitch, // 80
|
||||
ACSF_GetArmorInfo,
|
||||
|
||||
/* Zandronum's - these must be skipped when we reach 99!
|
||||
-100:ResetMap(0),
|
||||
|
@ -4822,6 +4833,38 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, SDWORD *args, const
|
|||
return 0;
|
||||
}
|
||||
|
||||
case ACSF_GetArmorInfo:
|
||||
{
|
||||
if (activator == NULL || activator->player == NULL) return 0;
|
||||
|
||||
ABasicArmor * equippedarmor = (ABasicArmor *) activator->FindInventory(NAME_BasicArmor);
|
||||
|
||||
if (equippedarmor && equippedarmor->Amount != 0)
|
||||
{
|
||||
switch(args[0])
|
||||
{
|
||||
case ARMORINFO_CLASSNAME:
|
||||
return GlobalACSStrings.AddString(equippedarmor->ArmorType.GetChars(), stack, stackdepth);
|
||||
|
||||
case ARMORINFO_SAVEAMOUNT:
|
||||
return equippedarmor->MaxAmount;
|
||||
|
||||
case ARMORINFO_SAVEPERCENT:
|
||||
return equippedarmor->SavePercent;
|
||||
|
||||
case ARMORINFO_MAXABSORB:
|
||||
return equippedarmor->MaxAbsorb;
|
||||
|
||||
case ARMORINFO_MAXFULLABSORB:
|
||||
return equippedarmor->MaxFullAbsorb;
|
||||
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return args[0] == ARMORINFO_CLASSNAME ? GlobalACSStrings.AddString("None", stack, stackdepth) : 0;
|
||||
}
|
||||
|
||||
case ACSF_SpawnSpotForced:
|
||||
return DoSpawnSpot(args[0], args[1], args[2], args[3], true);
|
||||
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
|
||||
// MACROS ------------------------------------------------------------------
|
||||
|
||||
//#define SHADE2LIGHT(s) (clamp (160-2*(s), 0, 255))
|
||||
#define SHADE2LIGHT(s) (clamp (255-2*s, 0, 255))
|
||||
//#define SHADE2LIGHT(s) (160-2*(s))
|
||||
#define SHADE2LIGHT(s) (255-2*s)
|
||||
|
||||
// TYPES -------------------------------------------------------------------
|
||||
|
||||
|
@ -249,7 +249,7 @@ static bool P_LoadBloodMap (BYTE *data, size_t len, FMapThing **mapthings, int *
|
|||
BYTE infoBlock[37];
|
||||
int mapver = data[5];
|
||||
DWORD matt;
|
||||
int numRevisions, numWalls, numsprites, skyLen;
|
||||
int numRevisions, numWalls, numsprites, skyLen, visibility, parallaxType;
|
||||
int i;
|
||||
int k;
|
||||
|
||||
|
@ -269,11 +269,14 @@ static bool P_LoadBloodMap (BYTE *data, size_t len, FMapThing **mapthings, int *
|
|||
{
|
||||
memcpy (infoBlock, data + 6, 37);
|
||||
}
|
||||
skyLen = 2 << LittleShort(*(WORD *)(infoBlock + 16));
|
||||
visibility = LittleLong(*(DWORD *)(infoBlock + 18));
|
||||
parallaxType = infoBlock[26];
|
||||
numRevisions = LittleLong(*(DWORD *)(infoBlock + 27));
|
||||
numsectors = LittleShort(*(WORD *)(infoBlock + 31));
|
||||
numWalls = LittleShort(*(WORD *)(infoBlock + 33));
|
||||
numsprites = LittleShort(*(WORD *)(infoBlock + 35));
|
||||
skyLen = 2 << LittleShort(*(WORD *)(infoBlock + 16));
|
||||
Printf("Visibility: %d\n", visibility);
|
||||
|
||||
if (mapver == 7)
|
||||
{
|
||||
|
|
|
@ -3466,31 +3466,33 @@ fixed_t P_AimLineAttack (AActor *t1, angle_t angle, fixed_t distance, AActor **p
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
static ETraceStatus CheckForGhost (FTraceResults &res, void *userdata)
|
||||
struct Origin
|
||||
{
|
||||
AActor *Caller;
|
||||
bool hitGhosts;
|
||||
bool hitSameSpecies;
|
||||
};
|
||||
|
||||
static ETraceStatus CheckForActor(FTraceResults &res, void *userdata)
|
||||
{
|
||||
if (res.HitType != TRACE_HitActor)
|
||||
{
|
||||
return TRACE_Stop;
|
||||
}
|
||||
|
||||
// check for physical attacks on a ghost
|
||||
if (res.Actor->flags3 & MF3_GHOST || res.Actor->flags4 & MF4_SPECTRAL)
|
||||
Origin *data = (Origin *)userdata;
|
||||
|
||||
// check for physical attacks on spectrals
|
||||
if (res.Actor->flags4 & MF4_SPECTRAL)
|
||||
{
|
||||
return TRACE_Skip;
|
||||
}
|
||||
|
||||
return TRACE_Stop;
|
||||
}
|
||||
|
||||
static ETraceStatus CheckForSpectral (FTraceResults &res, void *userdata)
|
||||
if (data->hitSameSpecies && res.Actor->GetSpecies() == data->Caller->GetSpecies())
|
||||
{
|
||||
if (res.HitType != TRACE_HitActor)
|
||||
{
|
||||
return TRACE_Stop;
|
||||
return TRACE_Skip;
|
||||
}
|
||||
|
||||
// check for physical attacks on spectrals
|
||||
if (res.Actor->flags4 & MF4_SPECTRAL)
|
||||
if (data->hitGhosts && res.Actor->flags3 & MF3_GHOST)
|
||||
{
|
||||
return TRACE_Skip;
|
||||
}
|
||||
|
@ -3511,9 +3513,10 @@ AActor *P_LineAttack (AActor *t1, angle_t angle, fixed_t distance,
|
|||
{
|
||||
fixed_t vx, vy, vz, shootz;
|
||||
FTraceResults trace;
|
||||
Origin TData;
|
||||
TData.Caller = t1;
|
||||
angle_t srcangle = angle;
|
||||
int srcpitch = pitch;
|
||||
bool hitGhosts;
|
||||
bool killPuff = false;
|
||||
AActor *puff = NULL;
|
||||
int pflag = 0;
|
||||
|
@ -3556,11 +3559,13 @@ AActor *P_LineAttack (AActor *t1, angle_t angle, fixed_t distance,
|
|||
// We need to check the defaults of the replacement here
|
||||
AActor *puffDefaults = GetDefaultByType(pufftype->GetReplacement());
|
||||
|
||||
hitGhosts = (t1->player != NULL &&
|
||||
TData.hitGhosts = (t1->player != NULL &&
|
||||
t1->player->ReadyWeapon != NULL &&
|
||||
(t1->player->ReadyWeapon->flags2 & MF2_THRUGHOST)) ||
|
||||
(puffDefaults && (puffDefaults->flags2 & MF2_THRUGHOST));
|
||||
|
||||
TData.hitSameSpecies = (puffDefaults && (puffDefaults->flags6 & MF6_MTHRUSPECIES));
|
||||
|
||||
// if the puff uses a non-standard damage type, this will override default, hitscan and melee damage type.
|
||||
// All other explicitly passed damage types (currenty only MDK) will be preserved.
|
||||
if ((damageType == NAME_None || damageType == NAME_Melee || damageType == NAME_Hitscan) &&
|
||||
|
@ -3575,7 +3580,7 @@ AActor *P_LineAttack (AActor *t1, angle_t angle, fixed_t distance,
|
|||
|
||||
if (!Trace(t1->x, t1->y, shootz, t1->Sector, vx, vy, vz, distance,
|
||||
MF_SHOOTABLE, ML_BLOCKEVERYTHING | ML_BLOCKHITSCAN, t1, trace,
|
||||
tflags, hitGhosts ? CheckForGhost : CheckForSpectral))
|
||||
tflags, CheckForActor, &TData))
|
||||
{ // hit nothing
|
||||
if (puffDefaults == NULL)
|
||||
{
|
||||
|
@ -5274,8 +5279,7 @@ bool P_ChangeSector (sector_t *sector, int crunch, int amt, int floorOrCeil, boo
|
|||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
while (n);
|
||||
} while (n);
|
||||
}
|
||||
}
|
||||
P_Recalculate3DFloors(sector); // Must recalculate the 3d floor and light lists
|
||||
|
|
|
@ -408,7 +408,7 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec,
|
|||
rw_frontcz2 <= s->floorplane.ZatPoint (curline->v2->x, curline->v2->y))
|
||||
{
|
||||
// Check that the window is actually visible
|
||||
for (int z = WallC.SX1; z < WallC.SX2; ++z)
|
||||
for (int z = WallC.sx1; z < WallC.sx2; ++z)
|
||||
{
|
||||
if (floorclip[z] > ceilingclip[z])
|
||||
{
|
||||
|
@ -541,12 +541,12 @@ void R_AddLine (seg_t *line)
|
|||
if (WallC.Init(tx1, ty1, tx2, ty2, 32))
|
||||
return;
|
||||
|
||||
if (WallC.SX1 > WindowRight || WallC.SX2 < WindowLeft)
|
||||
if (WallC.sx1 > WindowRight || WallC.sx2 < WindowLeft)
|
||||
return;
|
||||
|
||||
if (line->linedef == NULL)
|
||||
{
|
||||
if (R_CheckClipWallSegment (WallC.SX1, WallC.SX2))
|
||||
if (R_CheckClipWallSegment (WallC.sx1, WallC.sx2))
|
||||
{
|
||||
InSubsector->flags |= SSECF_DRAWN;
|
||||
}
|
||||
|
@ -695,7 +695,7 @@ void R_AddLine (seg_t *line)
|
|||
// mark their subsectors as visible for automap texturing.
|
||||
if (hasglnodes && !(InSubsector->flags & SSECF_DRAWN))
|
||||
{
|
||||
if (R_CheckClipWallSegment(WallC.SX1, WallC.SX2))
|
||||
if (R_CheckClipWallSegment(WallC.sx1, WallC.sx2))
|
||||
{
|
||||
InSubsector->flags |= SSECF_DRAWN;
|
||||
}
|
||||
|
@ -709,8 +709,8 @@ void R_AddLine (seg_t *line)
|
|||
if (line->linedef->special == Line_Horizon)
|
||||
{
|
||||
// Be aware: Line_Horizon does not work properly with sloped planes
|
||||
clearbufshort (walltop+WallC.SX1, WallC.SX2 - WallC.SX1, centery);
|
||||
clearbufshort (wallbottom+WallC.SX1, WallC.SX2 - WallC.SX1, centery);
|
||||
clearbufshort (walltop+WallC.sx1, WallC.sx2 - WallC.sx1, centery);
|
||||
clearbufshort (wallbottom+WallC.sx1, WallC.sx2 - WallC.sx1, centery);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -735,7 +735,7 @@ void R_AddLine (seg_t *line)
|
|||
#endif
|
||||
}
|
||||
|
||||
if (R_ClipWallSegment (WallC.SX1, WallC.SX2, solid))
|
||||
if (R_ClipWallSegment (WallC.sx1, WallC.sx2, solid))
|
||||
{
|
||||
InSubsector->flags |= SSECF_DRAWN;
|
||||
}
|
||||
|
@ -748,58 +748,58 @@ void R_AddLine (seg_t *line)
|
|||
//
|
||||
bool FWallCoords::Init(int x1, int y1, int x2, int y2, int too_close)
|
||||
{
|
||||
TX1 = DMulScale20(x1, viewsin, -y1, viewcos);
|
||||
TX2 = DMulScale20(x2, viewsin, -y2, viewcos);
|
||||
tx1 = DMulScale20(x1, viewsin, -y1, viewcos);
|
||||
tx2 = DMulScale20(x2, viewsin, -y2, viewcos);
|
||||
|
||||
TY1 = DMulScale20(x1, viewtancos, y1, viewtansin);
|
||||
TY2 = DMulScale20(x2, viewtancos, y2, viewtansin);
|
||||
ty1 = DMulScale20(x1, viewtancos, y1, viewtansin);
|
||||
ty2 = DMulScale20(x2, viewtancos, y2, viewtansin);
|
||||
|
||||
if (MirrorFlags & RF_XFLIP)
|
||||
{
|
||||
int t = 256 - TX1;
|
||||
TX1 = 256 - TX2;
|
||||
TX2 = t;
|
||||
swapvalues(TY1, TY2);
|
||||
int t = 256 - tx1;
|
||||
tx1 = 256 - tx2;
|
||||
tx2 = t;
|
||||
swapvalues(ty1, ty2);
|
||||
}
|
||||
|
||||
if (TX1 >= -TY1)
|
||||
if (tx1 >= -ty1)
|
||||
{
|
||||
if (TX1 > TY1) return true; // left edge is off the right side
|
||||
if (TY1 == 0) return true;
|
||||
SX1 = (centerxfrac + Scale(TX1, centerxfrac, TY1)) >> FRACBITS;
|
||||
if (TX1 >= 0) SX1 = MIN(viewwidth, SX1+1); // fix for signed divide
|
||||
SZ1 = TY1;
|
||||
if (tx1 > ty1) return true; // left edge is off the right side
|
||||
if (ty1 == 0) return true;
|
||||
sx1 = (centerxfrac + Scale(tx1, centerxfrac, ty1)) >> FRACBITS;
|
||||
if (tx1 >= 0) sx1 = MIN(viewwidth, sx1+1); // fix for signed divide
|
||||
sz1 = ty1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (TX2 < -TY2) return true; // wall is off the left side
|
||||
fixed_t den = TX1 - TX2 - TY2 + TY1;
|
||||
if (tx2 < -ty2) return true; // wall is off the left side
|
||||
fixed_t den = tx1 - tx2 - ty2 + ty1;
|
||||
if (den == 0) return true;
|
||||
SX1 = 0;
|
||||
SZ1 = TY1 + Scale(TY2 - TY1, TX1 + TY1, den);
|
||||
sx1 = 0;
|
||||
sz1 = ty1 + Scale(ty2 - ty1, tx1 + ty1, den);
|
||||
}
|
||||
|
||||
if (SZ1 < too_close)
|
||||
if (sz1 < too_close)
|
||||
return true;
|
||||
|
||||
if (TX2 <= TY2)
|
||||
if (tx2 <= ty2)
|
||||
{
|
||||
if (TX2 < -TY2) return true; // right edge is off the left side
|
||||
if (TY2 == 0) return true;
|
||||
SX2 = (centerxfrac + Scale(TX2, centerxfrac, TY2)) >> FRACBITS;
|
||||
if (TX2 >= 0) SX2 = MIN(viewwidth, SX2+1); // fix for signed divide
|
||||
SZ2 = TY2;
|
||||
if (tx2 < -ty2) return true; // right edge is off the left side
|
||||
if (ty2 == 0) return true;
|
||||
sx2 = (centerxfrac + Scale(tx2, centerxfrac, ty2)) >> FRACBITS;
|
||||
if (tx2 >= 0) sx2 = MIN(viewwidth, sx2+1); // fix for signed divide
|
||||
sz2 = ty2;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (TX1 > TY1) return true; // wall is off the right side
|
||||
fixed_t den = TY2 - TY1 - TX2 + TX1;
|
||||
if (tx1 > ty1) return true; // wall is off the right side
|
||||
fixed_t den = ty2 - ty1 - tx2 + tx1;
|
||||
if (den == 0) return true;
|
||||
SX2 = viewwidth;
|
||||
SZ2 = TY1 + Scale(TY2 - TY1, TX1 - TY1, den);
|
||||
sx2 = viewwidth;
|
||||
sz2 = ty1 + Scale(ty2 - ty1, tx1 - ty1, den);
|
||||
}
|
||||
|
||||
if (SZ2 < too_close || SX2 <= SX1)
|
||||
if (sz2 < too_close || sx2 <= sx1)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
@ -809,17 +809,17 @@ void FWallTmapVals::InitFromWallCoords(const FWallCoords *wallc)
|
|||
{
|
||||
if (MirrorFlags & RF_XFLIP)
|
||||
{
|
||||
UoverZorg = (float)wallc->TX2 * WallTMapScale;
|
||||
UoverZstep = (float)(-wallc->TY2) * 32.f;
|
||||
InvZorg = (float)(wallc->TX2 - wallc->TX1) * WallTMapScale;
|
||||
InvZstep = (float)(wallc->TY1 - wallc->TY2) * 32.f;
|
||||
UoverZorg = (float)wallc->tx2 * WallTMapScale;
|
||||
UoverZstep = (float)(-wallc->ty2) * 32.f;
|
||||
InvZorg = (float)(wallc->tx2 - wallc->tx1) * WallTMapScale;
|
||||
InvZstep = (float)(wallc->ty1 - wallc->ty2) * 32.f;
|
||||
}
|
||||
else
|
||||
{
|
||||
UoverZorg = (float)wallc->TX1 * WallTMapScale;
|
||||
UoverZstep = (float)(-wallc->TY1) * 32.f;
|
||||
InvZorg = (float)(wallc->TX1 - wallc->TX2) * WallTMapScale;
|
||||
InvZstep = (float)(wallc->TY2 - wallc->TY1) * 32.f;
|
||||
UoverZorg = (float)wallc->tx1 * WallTMapScale;
|
||||
UoverZstep = (float)(-wallc->ty1) * 32.f;
|
||||
InvZorg = (float)(wallc->tx1 - wallc->tx2) * WallTMapScale;
|
||||
InvZstep = (float)(wallc->ty2 - wallc->ty1) * 32.f;
|
||||
}
|
||||
InitDepth();
|
||||
}
|
||||
|
|
11
src/r_bsp.h
11
src/r_bsp.h
|
@ -33,14 +33,11 @@
|
|||
|
||||
struct FWallCoords
|
||||
{
|
||||
fixed_t TX1, TX2; // x coords at left, right of wall in view space
|
||||
fixed_t TY1, TY2; // y coords at left, right of wall in view space
|
||||
fixed_t tx1, tx2; // x coords at left, right of wall in view space rx1,rx2
|
||||
fixed_t ty1, ty2; // y coords at left, right of wall in view space ry1,ry2
|
||||
|
||||
fixed_t CX1, CX2; // x coords at left, right of wall in camera space
|
||||
fixed_t CY1, CY2; // y coords at left, right of wall in camera space
|
||||
|
||||
int SX1, SX2; // x coords at left, right of wall in screen space
|
||||
fixed_t SZ1, SZ2; // depth at left, right of wall in screen space
|
||||
short sx1, sx2; // x coords at left, right of wall in screen space xb1,xb2
|
||||
fixed_t sz1, sz2; // depth at left, right of wall in screen space yb1,yb2
|
||||
|
||||
bool Init(int x1, int y1, int x2, int y2, int too_close);
|
||||
};
|
||||
|
|
180
src/r_segs.cpp
180
src/r_segs.cpp
|
@ -376,10 +376,10 @@ void R_RenderMaskedSegRange (drawseg_t *ds, int x1, int x2)
|
|||
goto clearfog;
|
||||
}
|
||||
|
||||
WallC.SZ1 = ds->sz1;
|
||||
WallC.SZ2 = ds->sz2;
|
||||
WallC.SX1 = ds->sx1;
|
||||
WallC.SX2 = ds->sx2;
|
||||
WallC.sz1 = ds->sz1;
|
||||
WallC.sz2 = ds->sz2;
|
||||
WallC.sx1 = ds->sx1;
|
||||
WallC.sx2 = ds->sx2;
|
||||
|
||||
if (fake3D & FAKE3D_CLIPTOP)
|
||||
{
|
||||
|
@ -467,10 +467,10 @@ void R_RenderMaskedSegRange (drawseg_t *ds, int x1, int x2)
|
|||
}
|
||||
else
|
||||
{ // Texture does wrap vertically.
|
||||
WallC.SZ1 = ds->sz1;
|
||||
WallC.SZ2 = ds->sz2;
|
||||
WallC.SX1 = ds->sx1;
|
||||
WallC.SX2 = ds->sx2;
|
||||
WallC.sz1 = ds->sz1;
|
||||
WallC.sz2 = ds->sz2;
|
||||
WallC.sx1 = ds->sx1;
|
||||
WallC.sx2 = ds->sx2;
|
||||
|
||||
if (CurrentSkybox)
|
||||
{ // Midtex clipping doesn't work properly with skyboxes, since you're normally below the floor
|
||||
|
@ -587,14 +587,14 @@ void R_RenderFakeWall(drawseg_t *ds, int x1, int x2, F3DFloor *rover)
|
|||
else if (fixedcolormap != NULL)
|
||||
dc_colormap = fixedcolormap;
|
||||
|
||||
WallC.SZ1 = ds->sz1;
|
||||
WallC.SZ2 = ds->sz2;
|
||||
WallC.SX1 = ds->sx1;
|
||||
WallC.SX2 = ds->sx2;
|
||||
WallC.TX1 = ds->cx;
|
||||
WallC.TY1 = ds->cy;
|
||||
WallC.TX2 = ds->cx + ds->cdx;
|
||||
WallC.TY2 = ds->cy + ds->cdy;
|
||||
WallC.sz1 = ds->sz1;
|
||||
WallC.sz2 = ds->sz2;
|
||||
WallC.sx1 = ds->sx1;
|
||||
WallC.sx2 = ds->sx2;
|
||||
WallC.tx1 = ds->cx;
|
||||
WallC.ty1 = ds->cy;
|
||||
WallC.tx2 = ds->cx + ds->cdx;
|
||||
WallC.ty2 = ds->cy + ds->cdy;
|
||||
WallT = ds->tmapvals;
|
||||
|
||||
OWallMost(wallupper, sclipTop - viewz, &WallC);
|
||||
|
@ -1209,8 +1209,8 @@ void wallscan_striped (int x1, int x2, short *uwal, short *dwal, fixed_t *swal,
|
|||
up = uwal;
|
||||
down = most1;
|
||||
|
||||
assert(WallC.SX1 <= x1);
|
||||
assert(WallC.SX2 > x2);
|
||||
assert(WallC.sx1 <= x1);
|
||||
assert(WallC.sx2 > x2);
|
||||
|
||||
// kg3D - fake floors instead of zdoom light list
|
||||
for (unsigned int i = 0; i < frontsector->e->XFloor.lightlist.Size(); i++)
|
||||
|
@ -1821,7 +1821,7 @@ void R_RenderSegLoop ()
|
|||
yscale = FixedMul(rw_pic->yScale, rw_midtexturescaley);
|
||||
if (xscale != lwallscale)
|
||||
{
|
||||
PrepLWall (lwall, curline->sidedef->TexelLength*xscale, WallC.SX1, WallC.SX2);
|
||||
PrepLWall (lwall, curline->sidedef->TexelLength*xscale, WallC.sx1, WallC.sx2);
|
||||
lwallscale = xscale;
|
||||
}
|
||||
if (midtexture->bWorldPanning)
|
||||
|
@ -1864,7 +1864,7 @@ void R_RenderSegLoop ()
|
|||
yscale = FixedMul(rw_pic->yScale, rw_toptexturescaley);
|
||||
if (xscale != lwallscale)
|
||||
{
|
||||
PrepLWall (lwall, curline->sidedef->TexelLength*xscale, WallC.SX1, WallC.SX2);
|
||||
PrepLWall (lwall, curline->sidedef->TexelLength*xscale, WallC.sx1, WallC.sx2);
|
||||
lwallscale = xscale;
|
||||
}
|
||||
if (toptexture->bWorldPanning)
|
||||
|
@ -1910,7 +1910,7 @@ void R_RenderSegLoop ()
|
|||
yscale = FixedMul(rw_pic->yScale, rw_bottomtexturescaley);
|
||||
if (xscale != lwallscale)
|
||||
{
|
||||
PrepLWall (lwall, curline->sidedef->TexelLength*xscale, WallC.SX1, WallC.SX2);
|
||||
PrepLWall (lwall, curline->sidedef->TexelLength*xscale, WallC.sx1, WallC.sx2);
|
||||
lwallscale = xscale;
|
||||
}
|
||||
if (bottomtexture->bWorldPanning)
|
||||
|
@ -2030,7 +2030,7 @@ void R_NewWall (bool needlights)
|
|||
{
|
||||
if (rw_havehigh)
|
||||
{ // front ceiling is above back ceiling
|
||||
memcpy (&walltop[WallC.SX1], &wallupper[WallC.SX1], (WallC.SX2 - WallC.SX1)*sizeof(walltop[0]));
|
||||
memcpy (&walltop[WallC.sx1], &wallupper[WallC.sx1], (WallC.sx2 - WallC.sx1)*sizeof(walltop[0]));
|
||||
rw_havehigh = false;
|
||||
}
|
||||
else if (rw_havelow && frontsector->ceilingplane != backsector->ceilingplane)
|
||||
|
@ -2255,15 +2255,15 @@ void R_NewWall (bool needlights)
|
|||
bottomtexture ? FixedMul(bottomtexture->xScale, sidedef->GetTextureXScale(side_t::bottom)) :
|
||||
FRACUNIT;
|
||||
|
||||
PrepWall (swall, lwall, sidedef->TexelLength * lwallscale, WallC.SX1, WallC.SX2);
|
||||
PrepWall (swall, lwall, sidedef->TexelLength * lwallscale, WallC.sx1, WallC.sx2);
|
||||
|
||||
if (fixedcolormap == NULL && fixedlightlev < 0)
|
||||
{
|
||||
wallshade = LIGHT2SHADE(curline->sidedef->GetLightLevel(foggy, frontsector->lightlevel)
|
||||
+ r_actualextralight);
|
||||
GlobVis = r_WallVisibility;
|
||||
rw_lightleft = SafeDivScale12 (GlobVis, WallC.SZ1);
|
||||
rw_lightstep = (SafeDivScale12 (GlobVis, WallC.SZ2) - rw_lightleft) / (WallC.SX2 - WallC.SX1);
|
||||
rw_lightleft = SafeDivScale12 (GlobVis, WallC.sz1);
|
||||
rw_lightstep = (SafeDivScale12 (GlobVis, WallC.sz2) - rw_lightleft) / (WallC.sx2 - WallC.sx1);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2337,19 +2337,19 @@ void R_StoreWallRange (int start, int stop)
|
|||
}
|
||||
|
||||
rw_offset = sidedef->GetTextureXOffset(side_t::mid);
|
||||
rw_light = rw_lightleft + rw_lightstep * (start - WallC.SX1);
|
||||
rw_light = rw_lightleft + rw_lightstep * (start - WallC.sx1);
|
||||
|
||||
ds_p->sx1 = WallC.SX1;
|
||||
ds_p->sx2 = WallC.SX2;
|
||||
ds_p->sz1 = WallC.SZ1;
|
||||
ds_p->sz2 = WallC.SZ2;
|
||||
ds_p->cx = WallC.TX1;
|
||||
ds_p->cy = WallC.TY1;
|
||||
ds_p->cdx = WallC.TX2 - WallC.TX1;
|
||||
ds_p->cdy = WallC.TY2 - WallC.TY1;
|
||||
ds_p->sx1 = WallC.sx1;
|
||||
ds_p->sx2 = WallC.sx2;
|
||||
ds_p->sz1 = WallC.sz1;
|
||||
ds_p->sz2 = WallC.sz2;
|
||||
ds_p->cx = WallC.tx1;
|
||||
ds_p->cy = WallC.ty1;
|
||||
ds_p->cdx = WallC.tx2 - WallC.tx1;
|
||||
ds_p->cdy = WallC.ty2 - WallC.ty1;
|
||||
ds_p->tmapvals = WallT;
|
||||
ds_p->siz1 = (DWORD)DivScale32 (1, WallC.SZ1) >> 1;
|
||||
ds_p->siz2 = (DWORD)DivScale32 (1, WallC.SZ2) >> 1;
|
||||
ds_p->siz1 = (DWORD)DivScale32 (1, WallC.sz1) >> 1;
|
||||
ds_p->siz2 = (DWORD)DivScale32 (1, WallC.sz2) >> 1;
|
||||
ds_p->x1 = rw_x = start;
|
||||
ds_p->x2 = stop-1;
|
||||
ds_p->curline = curline;
|
||||
|
@ -2442,7 +2442,7 @@ void R_StoreWallRange (int start, int stop)
|
|||
if ((TexMan(sidedef->GetTexture(side_t::mid), true)->UseType != FTexture::TEX_Null || ds_p->bFakeBoundary || IsFogBoundary (frontsector, backsector)) &&
|
||||
(rw_ceilstat != 12 || !sidedef->GetTexture(side_t::top).isValid()) &&
|
||||
(rw_floorstat != 3 || !sidedef->GetTexture(side_t::bottom).isValid()) &&
|
||||
(WallC.SZ1 >= TOO_CLOSE_Z && WallC.SZ2 >= TOO_CLOSE_Z))
|
||||
(WallC.sz1 >= TOO_CLOSE_Z && WallC.sz2 >= TOO_CLOSE_Z))
|
||||
{
|
||||
fixed_t *swal;
|
||||
fixed_t *lwal;
|
||||
|
@ -2590,59 +2590,59 @@ int OWallMost (short *mostbuf, fixed_t z, const FWallCoords *wallc)
|
|||
fixed_t s1, s2, s3, s4;
|
||||
|
||||
z = -(z >> 4);
|
||||
s1 = MulScale16 (globaluclip, wallc->SZ1); s2 = MulScale16 (globaluclip, wallc->SZ2);
|
||||
s3 = MulScale16 (globaldclip, wallc->SZ1); s4 = MulScale16 (globaldclip, wallc->SZ2);
|
||||
s1 = MulScale16 (globaluclip, wallc->sz1); s2 = MulScale16 (globaluclip, wallc->sz2);
|
||||
s3 = MulScale16 (globaldclip, wallc->sz1); s4 = MulScale16 (globaldclip, wallc->sz2);
|
||||
bad = (z<s1)+((z<s2)<<1)+((z>s3)<<2)+((z>s4)<<3);
|
||||
|
||||
#if 1
|
||||
if ((bad&3) == 3)
|
||||
{
|
||||
memset (&mostbuf[wallc->SX1], 0, (wallc->SX2 - wallc->SX1)*sizeof(mostbuf[0]));
|
||||
memset (&mostbuf[wallc->sx1], 0, (wallc->sx2 - wallc->sx1)*sizeof(mostbuf[0]));
|
||||
return bad;
|
||||
}
|
||||
|
||||
if ((bad&12) == 12)
|
||||
{
|
||||
clearbufshort (&mostbuf[wallc->SX1], wallc->SX2 - wallc->SX1, viewheight);
|
||||
clearbufshort (&mostbuf[wallc->sx1], wallc->sx2 - wallc->sx1, viewheight);
|
||||
return bad;
|
||||
}
|
||||
#endif
|
||||
ix1 = wallc->SX1; iy1 = wallc->SZ1;
|
||||
ix2 = wallc->SX2; iy2 = wallc->SZ2;
|
||||
ix1 = wallc->sx1; iy1 = wallc->sz1;
|
||||
ix2 = wallc->sx2; iy2 = wallc->sz2;
|
||||
#if 1
|
||||
if (bad & 3)
|
||||
{
|
||||
int t = DivScale30 (z-s1, s2-s1);
|
||||
int inty = wallc->SZ1 + MulScale30 (wallc->SZ2 - wallc->SZ1, t);
|
||||
int xcross = wallc->SX1 + Scale (MulScale30 (wallc->SZ2, t), wallc->SX2 - wallc->SX1, inty);
|
||||
int inty = wallc->sz1 + MulScale30 (wallc->sz2 - wallc->sz1, t);
|
||||
int xcross = wallc->sx1 + Scale (MulScale30 (wallc->sz2, t), wallc->sx2 - wallc->sx1, inty);
|
||||
|
||||
if ((bad & 3) == 2)
|
||||
{
|
||||
if (wallc->SX1 <= xcross) { iy2 = inty; ix2 = xcross; }
|
||||
if (wallc->SX2 > xcross) memset (&mostbuf[xcross], 0, (wallc->SX2-xcross)*sizeof(mostbuf[0]));
|
||||
if (wallc->sx1 <= xcross) { iy2 = inty; ix2 = xcross; }
|
||||
if (wallc->sx2 > xcross) memset (&mostbuf[xcross], 0, (wallc->sx2-xcross)*sizeof(mostbuf[0]));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (xcross <= wallc->SX2) { iy1 = inty; ix1 = xcross; }
|
||||
if (xcross > wallc->SX1) memset (&mostbuf[wallc->SX1], 0, (xcross-wallc->SX1)*sizeof(mostbuf[0]));
|
||||
if (xcross <= wallc->sx2) { iy1 = inty; ix1 = xcross; }
|
||||
if (xcross > wallc->sx1) memset (&mostbuf[wallc->sx1], 0, (xcross-wallc->sx1)*sizeof(mostbuf[0]));
|
||||
}
|
||||
}
|
||||
|
||||
if (bad & 12)
|
||||
{
|
||||
int t = DivScale30 (z-s3, s4-s3);
|
||||
int inty = wallc->SZ1 + MulScale30 (wallc->SZ2 - wallc->SZ1, t);
|
||||
int xcross = wallc->SX1 + Scale (MulScale30 (wallc->SZ2, t), wallc->SX2 - wallc->SX1, inty);
|
||||
int inty = wallc->sz1 + MulScale30 (wallc->sz2 - wallc->sz1, t);
|
||||
int xcross = wallc->sx1 + Scale (MulScale30 (wallc->sz2, t), wallc->sx2 - wallc->sx1, inty);
|
||||
|
||||
if ((bad & 12) == 8)
|
||||
{
|
||||
if (wallc->SX1 <= xcross) { iy2 = inty; ix2 = xcross; }
|
||||
if (wallc->SX2 > xcross) clearbufshort (&mostbuf[xcross], wallc->SX2 - xcross, viewheight);
|
||||
if (wallc->sx1 <= xcross) { iy2 = inty; ix2 = xcross; }
|
||||
if (wallc->sx2 > xcross) clearbufshort (&mostbuf[xcross], wallc->sx2 - xcross, viewheight);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (xcross <= wallc->SX2) { iy1 = inty; ix1 = xcross; }
|
||||
if (xcross > wallc->SX1) clearbufshort (&mostbuf[wallc->SX1], xcross - wallc->SX1, viewheight);
|
||||
if (xcross <= wallc->sx2) { iy1 = inty; ix1 = xcross; }
|
||||
if (xcross > wallc->sx1) clearbufshort (&mostbuf[wallc->sx1], xcross - wallc->sx1, viewheight);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2660,12 +2660,12 @@ int OWallMost (short *mostbuf, fixed_t z, const FWallCoords *wallc)
|
|||
double max = viewheight;
|
||||
double zz = z / 65536.0;
|
||||
#if 0
|
||||
double z1 = zz * InvZtoScale / wallc->SZ1;
|
||||
double z2 = zz * InvZtoScale / wallc->SZ2 - z1;
|
||||
z2 /= (wallc->SX2 - wallc->SX1);
|
||||
double z1 = zz * InvZtoScale / wallc->sz1;
|
||||
double z2 = zz * InvZtoScale / wallc->sz2 - z1;
|
||||
z2 /= (wallc->sx2 - wallc->sx1);
|
||||
z1 += centeryfrac / 65536.0;
|
||||
|
||||
for (int x = wallc->SX1; x < wallc->SX2; ++x)
|
||||
for (int x = wallc->sx1; x < wallc->sx2; ++x)
|
||||
{
|
||||
mostbuf[x] = xs_RoundToInt(clamp(z1, 0.0, max));
|
||||
z1 += z2;
|
||||
|
@ -2673,12 +2673,12 @@ int OWallMost (short *mostbuf, fixed_t z, const FWallCoords *wallc)
|
|||
#else
|
||||
double top, bot, i;
|
||||
|
||||
i = wallc->SX1 - centerx;
|
||||
i = wallc->sx1 - centerx;
|
||||
top = WallT.UoverZorg + WallT.UoverZstep * i;
|
||||
bot = WallT.InvZorg + WallT.InvZstep * i;
|
||||
double cy = centeryfrac / 65536.0;
|
||||
|
||||
for (int x = wallc->SX1; x < wallc->SX2; x++)
|
||||
for (int x = wallc->sx1; x < wallc->sx2; x++)
|
||||
{
|
||||
double frac = top / bot;
|
||||
double scale = frac * WallT.DepthScale + WallT.DepthOrg;
|
||||
|
@ -2711,21 +2711,21 @@ int WallMost (short *mostbuf, const secplane_t &plane, const FWallCoords *wallc)
|
|||
{
|
||||
x = curline->v2->x;
|
||||
y = curline->v2->y;
|
||||
if (wallc->SX1 == 0 && 0 != (den = wallc->TX1 - wallc->TX2 + wallc->TY1 - wallc->TY2))
|
||||
if (wallc->sx1 == 0 && 0 != (den = wallc->tx1 - wallc->tx2 + wallc->ty1 - wallc->ty2))
|
||||
{
|
||||
int frac = SafeDivScale30 (wallc->TY1 + wallc->TX1, den);
|
||||
int frac = SafeDivScale30 (wallc->ty1 + wallc->tx1, den);
|
||||
x -= MulScale30 (frac, x - curline->v1->x);
|
||||
y -= MulScale30 (frac, y - curline->v1->y);
|
||||
}
|
||||
z1 = viewz - plane.ZatPoint (x, y);
|
||||
|
||||
if (wallc->SX2 > wallc->SX1 + 1)
|
||||
if (wallc->sx2 > wallc->sx1 + 1)
|
||||
{
|
||||
x = curline->v1->x;
|
||||
y = curline->v1->y;
|
||||
if (wallc->SX2 == viewwidth && 0 != (den = wallc->TX1 - wallc->TX2 - wallc->TY1 + wallc->TY2))
|
||||
if (wallc->sx2 == viewwidth && 0 != (den = wallc->tx1 - wallc->tx2 - wallc->ty1 + wallc->ty2))
|
||||
{
|
||||
int frac = SafeDivScale30 (wallc->TY2 - wallc->TX2, den);
|
||||
int frac = SafeDivScale30 (wallc->ty2 - wallc->tx2, den);
|
||||
x += MulScale30 (frac, curline->v2->x - x);
|
||||
y += MulScale30 (frac, curline->v2->y - y);
|
||||
}
|
||||
|
@ -2740,21 +2740,21 @@ int WallMost (short *mostbuf, const secplane_t &plane, const FWallCoords *wallc)
|
|||
{
|
||||
x = curline->v1->x;
|
||||
y = curline->v1->y;
|
||||
if (wallc->SX1 == 0 && 0 != (den = wallc->TX1 - wallc->TX2 + wallc->TY1 - wallc->TY2))
|
||||
if (wallc->sx1 == 0 && 0 != (den = wallc->tx1 - wallc->tx2 + wallc->ty1 - wallc->ty2))
|
||||
{
|
||||
int frac = SafeDivScale30 (wallc->TY1 + wallc->TX1, den);
|
||||
int frac = SafeDivScale30 (wallc->ty1 + wallc->tx1, den);
|
||||
x += MulScale30 (frac, curline->v2->x - x);
|
||||
y += MulScale30 (frac, curline->v2->y - y);
|
||||
}
|
||||
z1 = viewz - plane.ZatPoint (x, y);
|
||||
|
||||
if (wallc->SX2 > wallc->SX1 + 1)
|
||||
if (wallc->sx2 > wallc->sx1 + 1)
|
||||
{
|
||||
x = curline->v2->x;
|
||||
y = curline->v2->y;
|
||||
if (wallc->SX2 == viewwidth && 0 != (den = wallc->TX1 - wallc->TX2 - wallc->TY1 + wallc->TY2))
|
||||
if (wallc->sx2 == viewwidth && 0 != (den = wallc->tx1 - wallc->tx2 - wallc->ty1 + wallc->ty2))
|
||||
{
|
||||
int frac = SafeDivScale30 (wallc->TY2 - wallc->TX2, den);
|
||||
int frac = SafeDivScale30 (wallc->ty2 - wallc->tx2, den);
|
||||
x -= MulScale30 (frac, x - curline->v1->x);
|
||||
y -= MulScale30 (frac, y - curline->v1->y);
|
||||
}
|
||||
|
@ -2766,12 +2766,12 @@ int WallMost (short *mostbuf, const secplane_t &plane, const FWallCoords *wallc)
|
|||
}
|
||||
}
|
||||
|
||||
s1 = MulScale12 (globaluclip, wallc->SZ1); s2 = MulScale12 (globaluclip, wallc->SZ2);
|
||||
s3 = MulScale12 (globaldclip, wallc->SZ1); s4 = MulScale12 (globaldclip, wallc->SZ2);
|
||||
s1 = MulScale12 (globaluclip, wallc->sz1); s2 = MulScale12 (globaluclip, wallc->sz2);
|
||||
s3 = MulScale12 (globaldclip, wallc->sz1); s4 = MulScale12 (globaldclip, wallc->sz2);
|
||||
bad = (z1<s1)+((z2<s2)<<1)+((z1>s3)<<2)+((z2>s4)<<3);
|
||||
|
||||
ix1 = wallc->SX1; ix2 = wallc->SX2;
|
||||
iy1 = wallc->SZ1; iy2 = wallc->SZ2;
|
||||
ix1 = wallc->sx1; ix2 = wallc->sx2;
|
||||
iy1 = wallc->sz1; iy2 = wallc->sz2;
|
||||
oz1 = z1; oz2 = z2;
|
||||
|
||||
if ((bad&3) == 3)
|
||||
|
@ -2791,9 +2791,9 @@ int WallMost (short *mostbuf, const secplane_t &plane, const FWallCoords *wallc)
|
|||
{
|
||||
//inty = intz / (globaluclip>>16)
|
||||
int t = SafeDivScale30 (oz1-s1, s2-s1+oz1-oz2);
|
||||
int inty = wallc->SZ1 + MulScale30 (wallc->SZ2-wallc->SZ1,t);
|
||||
int inty = wallc->sz1 + MulScale30 (wallc->sz2-wallc->sz1,t);
|
||||
int intz = oz1 + MulScale30 (oz2-oz1,t);
|
||||
int xcross = wallc->SX1 + Scale (MulScale30 (wallc->SZ2, t), wallc->SX2-wallc->SX1, inty);
|
||||
int xcross = wallc->sx1 + Scale (MulScale30 (wallc->sz2, t), wallc->sx2-wallc->sx1, inty);
|
||||
|
||||
//t = divscale30((x1<<4)-xcross*yb1[w],xcross*(yb2[w]-yb1[w])-((x2-x1)<<4));
|
||||
//inty = yb1[w] + mulscale30(yb2[w]-yb1[w],t);
|
||||
|
@ -2801,13 +2801,13 @@ int WallMost (short *mostbuf, const secplane_t &plane, const FWallCoords *wallc)
|
|||
|
||||
if ((bad&3) == 2)
|
||||
{
|
||||
if (wallc->SX1 <= xcross) { z2 = intz; iy2 = inty; ix2 = xcross; }
|
||||
memset (&mostbuf[xcross], 0, (wallc->SX2-xcross)*sizeof(mostbuf[0]));
|
||||
if (wallc->sx1 <= xcross) { z2 = intz; iy2 = inty; ix2 = xcross; }
|
||||
memset (&mostbuf[xcross], 0, (wallc->sx2-xcross)*sizeof(mostbuf[0]));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (xcross <= wallc->SX2) { z1 = intz; iy1 = inty; ix1 = xcross; }
|
||||
memset (&mostbuf[wallc->SX1], 0, (xcross-wallc->SX1)*sizeof(mostbuf[0]));
|
||||
if (xcross <= wallc->sx2) { z1 = intz; iy1 = inty; ix1 = xcross; }
|
||||
memset (&mostbuf[wallc->sx1], 0, (xcross-wallc->sx1)*sizeof(mostbuf[0]));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2815,9 +2815,9 @@ int WallMost (short *mostbuf, const secplane_t &plane, const FWallCoords *wallc)
|
|||
{
|
||||
//inty = intz / (globaldclip>>16)
|
||||
int t = SafeDivScale30 (oz1-s3, s4-s3+oz1-oz2);
|
||||
int inty = wallc->SZ1 + MulScale30 (wallc->SZ2-wallc->SZ1,t);
|
||||
int inty = wallc->sz1 + MulScale30 (wallc->sz2-wallc->sz1,t);
|
||||
int intz = oz1 + MulScale30 (oz2-oz1,t);
|
||||
int xcross = wallc->SX1 + Scale (MulScale30 (wallc->SZ2, t), wallc->SX2-wallc->SX1,inty);
|
||||
int xcross = wallc->sx1 + Scale (MulScale30 (wallc->sz2, t), wallc->sx2-wallc->sx1,inty);
|
||||
|
||||
//t = divscale30((x1<<4)-xcross*yb1[w],xcross*(yb2[w]-yb1[w])-((x2-x1)<<4));
|
||||
//inty = yb1[w] + mulscale30(yb2[w]-yb1[w],t);
|
||||
|
@ -2825,13 +2825,13 @@ int WallMost (short *mostbuf, const secplane_t &plane, const FWallCoords *wallc)
|
|||
|
||||
if ((bad&12) == 8)
|
||||
{
|
||||
if (wallc->SX1 <= xcross) { z2 = intz; iy2 = inty; ix2 = xcross; }
|
||||
if (wallc->SX2 > xcross) clearbufshort (&mostbuf[xcross], wallc->SX2-xcross, viewheight);
|
||||
if (wallc->sx1 <= xcross) { z2 = intz; iy2 = inty; ix2 = xcross; }
|
||||
if (wallc->sx2 > xcross) clearbufshort (&mostbuf[xcross], wallc->sx2-xcross, viewheight);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (xcross <= wallc->SX2) { z1 = intz; iy1 = inty; ix1 = xcross; }
|
||||
if (xcross > wallc->SX1) clearbufshort (&mostbuf[wallc->SX1], xcross-wallc->SX1, viewheight);
|
||||
if (xcross <= wallc->sx2) { z1 = intz; iy1 = inty; ix1 = xcross; }
|
||||
if (xcross > wallc->sx1) clearbufshort (&mostbuf[wallc->sx1], xcross-wallc->sx1, viewheight);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3041,8 +3041,8 @@ static void R_RenderDecal (side_t *wall, DBaseDecal *decal, drawseg_t *clipper,
|
|||
if (WallC.Init(lx, ly, lx2, ly2, TOO_CLOSE_Z))
|
||||
goto done;
|
||||
|
||||
x1 = WallC.SX1;
|
||||
x2 = WallC.SX2;
|
||||
x1 = WallC.sx1;
|
||||
x2 = WallC.sx2;
|
||||
|
||||
if (x1 > clipper->x2 || x2 <= clipper->x1)
|
||||
goto done;
|
||||
|
@ -3145,7 +3145,7 @@ static void R_RenderDecal (side_t *wall, DBaseDecal *decal, drawseg_t *clipper,
|
|||
rereadcolormap = false;
|
||||
}
|
||||
|
||||
rw_light = rw_lightleft + (x1 - WallC.SX1) * rw_lightstep;
|
||||
rw_light = rw_lightleft + (x1 - WallC.sx1) * rw_lightstep;
|
||||
if (fixedlightlev >= 0)
|
||||
dc_colormap = usecolormap->Maps + fixedlightlev;
|
||||
else if (fixedcolormap != NULL)
|
||||
|
|
|
@ -409,16 +409,15 @@ void R_DrawWallSprite(vissprite_t *spr)
|
|||
{
|
||||
int x1, x2;
|
||||
fixed_t yscale;
|
||||
int shade = LIGHT2SHADE(140);
|
||||
|
||||
x1 = MAX<int>(spr->x1, spr->wallc.SX1);
|
||||
x2 = MIN<int>(spr->x2, spr->wallc.SX2 + 1);
|
||||
x1 = MAX<int>(spr->x1, spr->wallc.sx1);
|
||||
x2 = MIN<int>(spr->x2 + 1, spr->wallc.sx2 + 1);
|
||||
if (x1 >= x2)
|
||||
return;
|
||||
WallT.InitFromWallCoords(&spr->wallc);
|
||||
PrepWall(swall, lwall, spr->pic->GetWidth() << FRACBITS, x1, x2);
|
||||
dc_texturemid = spr->gzt - viewz;
|
||||
yscale = FRACUNIT;
|
||||
yscale = spr->yscale;
|
||||
dc_texturemid = FixedDiv(spr->gzt - viewz, yscale);
|
||||
if (spr->renderflags & RF_XFLIP)
|
||||
{
|
||||
int right = (spr->pic->GetWidth() << FRACBITS) - 1;
|
||||
|
@ -440,7 +439,11 @@ void R_DrawWallSprite(vissprite_t *spr)
|
|||
rereadcolormap = false;
|
||||
}
|
||||
|
||||
rw_light = rw_lightleft + (x1 - spr->wallc.SX1) * rw_lightstep;
|
||||
int shade = LIGHT2SHADE(spr->sector->lightlevel + r_actualextralight);
|
||||
GlobVis = r_WallVisibility;
|
||||
rw_lightleft = SafeDivScale12(GlobVis, spr->wallc.sz1);
|
||||
rw_lightstep = (SafeDivScale12(GlobVis, spr->wallc.sz2) - rw_lightleft) / (spr->wallc.sx2 - spr->wallc.sx1);
|
||||
rw_light = rw_lightleft + (x1 - spr->wallc.sx1) * rw_lightstep;
|
||||
if (fixedlightlev >= 0)
|
||||
dc_colormap = usecolormap->Maps + fixedlightlev;
|
||||
else if (fixedcolormap != NULL)
|
||||
|
@ -1057,7 +1060,7 @@ static void R_ProjectWallSprite(AActor *thing, fixed_t fx, fixed_t fy, fixed_t f
|
|||
if (wallc.Init(lx1, ly1, lx2, ly2, TOO_CLOSE_Z))
|
||||
return;
|
||||
|
||||
if (wallc.SX1 > WindowRight || wallc.SX2 <= WindowLeft)
|
||||
if (wallc.sx1 > WindowRight || wallc.sx2 <= WindowLeft)
|
||||
return;
|
||||
|
||||
// Sprite sorting should probably treat these as walls, not sprites,
|
||||
|
@ -1070,8 +1073,9 @@ static void R_ProjectWallSprite(AActor *thing, fixed_t fx, fixed_t fy, fixed_t f
|
|||
gzb = fz + yscale * scaled_bo;
|
||||
|
||||
vis = R_NewVisSprite();
|
||||
vis->x1 = wallc.SX1 < WindowLeft ? WindowLeft : wallc.SX1;
|
||||
vis->x2 = wallc.SX2 >= WindowRight ? WindowRight-1 : wallc.SX2-1;
|
||||
vis->x1 = wallc.sx1 < WindowLeft ? WindowLeft : wallc.sx1;
|
||||
vis->x2 = wallc.sx2 >= WindowRight ? WindowRight : wallc.sx2-1;
|
||||
vis->yscale = yscale;
|
||||
vis->idepth = (unsigned)DivScale32(1, tz) >> 1;
|
||||
vis->depth = tz;
|
||||
vis->sector = thing->Sector;
|
||||
|
@ -2072,19 +2076,9 @@ void R_DrawSprite (vissprite_t *spr)
|
|||
r1 = MAX<int> (ds->x1, x1);
|
||||
r2 = MIN<int> (ds->x2, x2);
|
||||
|
||||
fixed_t neardepth, fardepth;
|
||||
if (ds->sz1 < ds->sz2)
|
||||
{
|
||||
neardepth = ds->sz1, fardepth = ds->sz2;
|
||||
}
|
||||
else
|
||||
{
|
||||
neardepth = ds->sz2, fardepth = ds->sz1;
|
||||
}
|
||||
if (neardepth > spr->depth || (fardepth > spr->depth &&
|
||||
// Check if sprite is in front of draw seg:
|
||||
DMulScale32(spr->gy - ds->curline->v1->y, ds->curline->v2->x - ds->curline->v1->x,
|
||||
ds->curline->v1->x - spr->gx, ds->curline->v2->y - ds->curline->v1->y) <= 0))
|
||||
if (DMulScale32(spr->gy - ds->curline->v1->y, ds->curline->v2->x - ds->curline->v1->x,
|
||||
ds->curline->v1->x - spr->gx, ds->curline->v2->y - ds->curline->v1->y) <= 0)
|
||||
{
|
||||
// seg is behind sprite, so draw the mid texture if it has one
|
||||
if (ds->maskedtexturecol != -1 || ds->bFogBoundary)
|
||||
|
|
Loading…
Reference in a new issue