# Conflicts:
#	src/r_defs.h
This commit is contained in:
Christoph Oelckers 2016-04-24 12:19:07 +02:00
commit 2914cdc939
40 changed files with 208 additions and 175 deletions

View file

@ -132,6 +132,11 @@ FBaseCVar::~FBaseCVar ()
} }
} }
const char *FBaseCVar::GetHumanString(int precision) const
{
return GetGenericRep(CVAR_String).String;
}
void FBaseCVar::ForceSet (UCVarValue value, ECVarType type, bool nouserinfosend) void FBaseCVar::ForceSet (UCVarValue value, ECVarType type, bool nouserinfosend)
{ {
DoSet (value, type); DoSet (value, type);
@ -281,7 +286,9 @@ const char *FBaseCVar::ToString (UCVarValue value, ECVarType type)
break; break;
case CVAR_Float: case CVAR_Float:
mysnprintf (cstrbuf, countof(cstrbuf), "%g", value.Float); IGNORE_FORMAT_PRE
mysnprintf (cstrbuf, countof(cstrbuf), "%H", value.Float);
IGNORE_FORMAT_POST
break; break;
case CVAR_GUID: case CVAR_GUID:
@ -399,7 +406,9 @@ UCVarValue FBaseCVar::FromFloat (float value, ECVarType type)
break; break;
case CVAR_String: case CVAR_String:
mysnprintf (cstrbuf, countof(cstrbuf), "%g", value); IGNORE_FORMAT_PRE
mysnprintf (cstrbuf, countof(cstrbuf), "%H", value);
IGNORE_FORMAT_POST
ret.String = cstrbuf; ret.String = cstrbuf;
break; break;
@ -746,6 +755,16 @@ ECVarType FFloatCVar::GetRealType () const
return CVAR_Float; return CVAR_Float;
} }
const char *FFloatCVar::GetHumanString(int precision) const
{
if (precision < 0)
{
precision = 6;
}
mysnprintf(cstrbuf, countof(cstrbuf), "%.*g", precision, Value);
return cstrbuf;
}
UCVarValue FFloatCVar::GetGenericRep (ECVarType type) const UCVarValue FFloatCVar::GetGenericRep (ECVarType type) const
{ {
return FromFloat (Value, type); return FromFloat (Value, type);
@ -1671,7 +1690,7 @@ void FBaseCVar::ListVars (const char *filter, bool plain)
if (!(flags & CVAR_UNSETTABLE)) if (!(flags & CVAR_UNSETTABLE))
{ {
++count; ++count;
Printf ("%s : %s\n", var->GetName(), var->GetGenericRep(CVAR_String).String); Printf ("%s : %s\n", var->GetName(), var->GetHumanString());
} }
} }
else else
@ -1688,7 +1707,7 @@ void FBaseCVar::ListVars (const char *filter, bool plain)
flags & CVAR_MOD ? 'M' : ' ', flags & CVAR_MOD ? 'M' : ' ',
flags & CVAR_IGNORE ? 'X' : ' ', flags & CVAR_IGNORE ? 'X' : ' ',
var->GetName(), var->GetName(),
var->GetGenericRep(CVAR_String).String); var->GetHumanString());
} }
} }
var = var->m_Next; var = var->m_Next;

View file

@ -108,6 +108,7 @@ public:
virtual ECVarType GetRealType () const = 0; virtual ECVarType GetRealType () const = 0;
virtual const char *GetHumanString(int precision=-1) const;
virtual UCVarValue GetGenericRep (ECVarType type) const = 0; virtual UCVarValue GetGenericRep (ECVarType type) const = 0;
virtual UCVarValue GetFavoriteRep (ECVarType *type) const = 0; virtual UCVarValue GetFavoriteRep (ECVarType *type) const = 0;
@ -268,6 +269,7 @@ public:
virtual UCVarValue GetGenericRepDefault (ECVarType type) const; virtual UCVarValue GetGenericRepDefault (ECVarType type) const;
virtual UCVarValue GetFavoriteRepDefault (ECVarType *type) const; virtual UCVarValue GetFavoriteRepDefault (ECVarType *type) const;
virtual void SetGenericRepDefault (UCVarValue value, ECVarType type); virtual void SetGenericRepDefault (UCVarValue value, ECVarType type);
const char *GetHumanString(int precision) const override;
float operator= (float floatval) float operator= (float floatval)
{ UCVarValue val; val.Float = floatval; SetGenericRep (val, CVAR_Float); return floatval; } { UCVarValue val; val.Float = floatval; SetGenericRep (val, CVAR_Float); return floatval; }

View file

@ -651,8 +651,7 @@ void C_DoCommand (const char *cmd, int keynum)
} }
else else
{ // Get the variable's value { // Get the variable's value
UCVarValue val = var->GetGenericRep (CVAR_String); Printf ("\"%s\" is \"%s\"\n", var->GetName(), var->GetHumanString());
Printf ("\"%s\" is \"%s\"\n", var->GetName(), val.String);
} }
} }
else else

View file

@ -993,8 +993,7 @@ CCMD (playerinfo)
if (pair->Key != NAME_Name && pair->Key != NAME_Team && pair->Key != NAME_Skin && if (pair->Key != NAME_Name && pair->Key != NAME_Team && pair->Key != NAME_Skin &&
pair->Key != NAME_Gender && pair->Key != NAME_PlayerClass) pair->Key != NAME_Gender && pair->Key != NAME_PlayerClass)
{ {
UCVarValue val = pair->Value->GetGenericRep(CVAR_String); Printf("%20s: %s\n", pair->Key.GetChars(), pair->Value->GetHumanString());
Printf("%20s: %s\n", pair->Key.GetChars(), val.String);
} }
} }
if (argv.argc() > 2) if (argv.argc() > 2)

View file

@ -2185,7 +2185,7 @@ void FParser::SF_SetLineMonsterBlocking(void)
{ {
if (CheckArgs(2)) if (CheckArgs(2))
{ {
int blocking = intvalue(t_argv[1]) ? ML_BLOCKMONSTERS : 0; int blocking = intvalue(t_argv[1]) ? (int)ML_BLOCKMONSTERS : 0;
int tag=intvalue(t_argv[0]); int tag=intvalue(t_argv[0]);
FLineIdIterator itr(tag); FLineIdIterator itr(tag);

View file

@ -250,27 +250,27 @@ FTextureID DBaseDecal::StickToWall (side_t *wall, double x, double y, F3DFloor *
{ {
RenderFlags |= RF_RELMID; RenderFlags |= RF_RELMID;
if (line->flags & ML_DONTPEGBOTTOM) if (line->flags & ML_DONTPEGBOTTOM)
Z -= front->GetPlaneTexZF(sector_t::floor); Z -= front->GetPlaneTexZ(sector_t::floor);
else else
Z -= front->GetPlaneTexZF(sector_t::ceiling); Z -= front->GetPlaneTexZ(sector_t::ceiling);
tex = wall->GetTexture(side_t::mid); tex = wall->GetTexture(side_t::mid);
} }
else if (back->floorplane.ZatPoint (x, y) >= Z) else if (back->floorplane.ZatPoint (x, y) >= Z)
{ {
RenderFlags |= RF_RELLOWER|RF_CLIPLOWER; RenderFlags |= RF_RELLOWER|RF_CLIPLOWER;
if (line->flags & ML_DONTPEGBOTTOM) if (line->flags & ML_DONTPEGBOTTOM)
Z -= front->GetPlaneTexZF(sector_t::ceiling); Z -= front->GetPlaneTexZ(sector_t::ceiling);
else else
Z -= back->GetPlaneTexZF(sector_t::floor); Z -= back->GetPlaneTexZ(sector_t::floor);
tex = wall->GetTexture(side_t::bottom); tex = wall->GetTexture(side_t::bottom);
} }
else if (back->ceilingplane.ZatPoint (x, y) <= Z) else if (back->ceilingplane.ZatPoint (x, y) <= Z)
{ {
RenderFlags |= RF_RELUPPER|RF_CLIPUPPER; RenderFlags |= RF_RELUPPER|RF_CLIPUPPER;
if (line->flags & ML_DONTPEGTOP) if (line->flags & ML_DONTPEGTOP)
Z -= front->GetPlaneTexZF(sector_t::ceiling); Z -= front->GetPlaneTexZ(sector_t::ceiling);
else else
Z -= back->GetPlaneTexZF(sector_t::ceiling); Z -= back->GetPlaneTexZ(sector_t::ceiling);
tex = wall->GetTexture(side_t::top); tex = wall->GetTexture(side_t::top);
} }
else if (ffloor) // this is a 3d-floor segment - do this only if we know which one! else if (ffloor) // this is a 3d-floor segment - do this only if we know which one!
@ -278,9 +278,9 @@ FTextureID DBaseDecal::StickToWall (side_t *wall, double x, double y, F3DFloor *
Sector=ffloor->model; Sector=ffloor->model;
RenderFlags |= RF_RELMID|RF_CLIPMID; RenderFlags |= RF_RELMID|RF_CLIPMID;
if (line->flags & ML_DONTPEGBOTTOM) if (line->flags & ML_DONTPEGBOTTOM)
Z -= Sector->GetPlaneTexZF(sector_t::floor); Z -= Sector->GetPlaneTexZ(sector_t::floor);
else else
Z -= Sector->GetPlaneTexZF(sector_t::ceiling); Z -= Sector->GetPlaneTexZ(sector_t::ceiling);
if (ffloor->flags & FF_UPPERTEXTURE) if (ffloor->flags & FF_UPPERTEXTURE)
{ {
@ -335,29 +335,29 @@ double DBaseDecal::GetRealZ (const side_t *wall) const
case RF_RELUPPER: case RF_RELUPPER:
if (line->flags & ML_DONTPEGTOP) if (line->flags & ML_DONTPEGTOP)
{ {
return Z + front->GetPlaneTexZF(sector_t::ceiling); return Z + front->GetPlaneTexZ(sector_t::ceiling);
} }
else else
{ {
return Z + back->GetPlaneTexZF(sector_t::ceiling); return Z + back->GetPlaneTexZ(sector_t::ceiling);
} }
case RF_RELLOWER: case RF_RELLOWER:
if (line->flags & ML_DONTPEGBOTTOM) if (line->flags & ML_DONTPEGBOTTOM)
{ {
return Z + front->GetPlaneTexZF(sector_t::ceiling); return Z + front->GetPlaneTexZ(sector_t::ceiling);
} }
else else
{ {
return Z + back->GetPlaneTexZF(sector_t::floor); return Z + back->GetPlaneTexZ(sector_t::floor);
} }
case RF_RELMID: case RF_RELMID:
if (line->flags & ML_DONTPEGBOTTOM) if (line->flags & ML_DONTPEGBOTTOM)
{ {
return Z + front->GetPlaneTexZF(sector_t::floor); return Z + front->GetPlaneTexZ(sector_t::floor);
} }
else else
{ {
return Z + front->GetPlaneTexZF(sector_t::ceiling); return Z + front->GetPlaneTexZ(sector_t::ceiling);
} }
} }
} }

View file

@ -295,10 +295,10 @@ public:
} }
else else
{ {
UCVarValue cv = mCVar->GetGenericRep(CVAR_String); const char *cv = mCVar->GetHumanString();
for(unsigned i = 0; i < (*opt)->mValues.Size(); i++) for(unsigned i = 0; i < (*opt)->mValues.Size(); i++)
{ {
if ((*opt)->mValues[i].TextValue.CompareNoCase(cv.String) == 0) if ((*opt)->mValues[i].TextValue.CompareNoCase(cv) == 0)
{ {
Selection = i; Selection = i;
break; break;
@ -995,7 +995,7 @@ public:
if ( mCVar == NULL ) if ( mCVar == NULL )
return ""; return "";
return mCVar->GetGenericRep( CVAR_String ).String; return mCVar->GetHumanString();
} }
virtual FString Represent() virtual FString Represent()

View file

@ -242,14 +242,14 @@ bool P_GetMidTexturePosition(const line_t *line, int sideno, double *ptextop, do
if(line->flags & ML_DONTPEGBOTTOM) if(line->flags & ML_DONTPEGBOTTOM)
{ {
*ptexbot = y_offset + *ptexbot = y_offset +
MAX(line->frontsector->GetPlaneTexZF(sector_t::floor), line->backsector->GetPlaneTexZF(sector_t::floor)); MAX(line->frontsector->GetPlaneTexZ(sector_t::floor), line->backsector->GetPlaneTexZ(sector_t::floor));
*ptextop = *ptexbot + textureheight; *ptextop = *ptexbot + textureheight;
} }
else else
{ {
*ptextop = y_offset + *ptextop = y_offset +
MIN(line->frontsector->GetPlaneTexZF(sector_t::ceiling), line->backsector->GetPlaneTexZF(sector_t::ceiling)); MIN(line->frontsector->GetPlaneTexZ(sector_t::ceiling), line->backsector->GetPlaneTexZ(sector_t::ceiling));
*ptexbot = *ptextop - textureheight; *ptexbot = *ptextop - textureheight;
} }

View file

@ -593,11 +593,11 @@ static void LoadWalls (walltype *walls, int numwalls, sectortype *bsec)
{ {
if (walls[i].cstat & 512) if (walls[i].cstat & 512)
{ {
lines[j].Alpha = TRANSLUC33; lines[j].alpha = 1/3.;
} }
else else
{ {
lines[j].Alpha = TRANSLUC66; lines[j].alpha = 2/3.;
} }
} }
if (walls[i].cstat & 1) if (walls[i].cstat & 1)

View file

@ -632,7 +632,7 @@ struct TrailSegment
void P_DrawRailTrail(AActor *source, TArray<SPortalHit> &portalhits, int color1, int color2, double maxdiff, int flags, PClassActor *spawnclass, DAngle angle, int duration, double sparsity, double drift, int SpiralOffset) void P_DrawRailTrail(AActor *source, TArray<SPortalHit> &portalhits, int color1, int color2, double maxdiff, int flags, PClassActor *spawnclass, DAngle angle, int duration, double sparsity, double drift, int SpiralOffset, DAngle pitch)
{ {
double length = 0; double length = 0;
int steps, i; int steps, i;
@ -889,7 +889,11 @@ void P_DrawRailTrail(AActor *source, TArray<SPortalHit> &portalhits, int color1,
} }
AActor *thing = Spawn (spawnclass, pos + diff, ALLOW_REPLACE); AActor *thing = Spawn (spawnclass, pos + diff, ALLOW_REPLACE);
if (thing) if (thing)
{
if (source) thing->target = source;
thing->Angles.Pitch = pitch;
thing->Angles.Yaw = angle; thing->Angles.Yaw = angle;
}
pos += trail[segment].dir * stepsize; pos += trail[segment].dir * stepsize;
lencount -= stepsize; lencount -= stepsize;
if (lencount <= 0) if (lencount <= 0)

View file

@ -97,7 +97,7 @@ struct SPortalHit
DVector3 OutDir; DVector3 OutDir;
}; };
void P_DrawRailTrail(AActor *source, TArray<SPortalHit> &portalhits, int color1, int color2, double maxdiff = 0, int flags = 0, PClassActor *spawnclass = NULL, DAngle angle = 0., int duration = 35, double sparsity = 1.0, double drift = 1.0, int SpiralOffset = 270); void P_DrawRailTrail(AActor *source, TArray<SPortalHit> &portalhits, int color1, int color2, double maxdiff = 0, int flags = 0, PClassActor *spawnclass = NULL, DAngle angle = 0., int duration = 35, double sparsity = 1.0, double drift = 1.0, int SpiralOffset = 270, DAngle pitch = 0.);
void P_DrawSplash (int count, const DVector3 &pos, DAngle angle, int kind); void P_DrawSplash (int count, const DVector3 &pos, DAngle angle, int kind);
void P_DrawSplash2 (int count, const DVector3 &pos, DAngle angle, int updown, int kind); void P_DrawSplash2 (int count, const DVector3 &pos, DAngle angle, int updown, int kind);
void P_DisconnectEffect (AActor *actor); void P_DisconnectEffect (AActor *actor);

View file

@ -263,7 +263,7 @@ static bool LoadGLVertexes(FileReader * lump)
for (i = firstglvertex; i < numvertexes; i++) for (i = firstglvertex; i < numvertexes; i++)
{ {
vertexes[i].set(LittleLong(mgl->x), LittleLong(mgl->y)); vertexes[i].set(LittleLong(mgl->x)/65536., LittleLong(mgl->y)/65536.);
mgl++; mgl++;
} }
delete[] gldata; delete[] gldata;

View file

@ -103,7 +103,7 @@ static bool MoveCeiling(sector_t *sector, int crush, double move)
// Don't let the ceiling go below the floor // Don't let the ceiling go below the floor
if (!sector->ceilingplane.isSlope() && !sector->floorplane.isSlope() && if (!sector->ceilingplane.isSlope() && !sector->floorplane.isSlope() &&
!sector->PortalIsLinked(sector_t::floor) && !sector->PortalIsLinked(sector_t::floor) &&
sector->GetPlaneTexZF(sector_t::floor) > sector->GetPlaneTexZF(sector_t::ceiling)) return false; sector->GetPlaneTexZ(sector_t::floor) > sector->GetPlaneTexZ(sector_t::ceiling)) return false;
return true; return true;
} }
@ -118,7 +118,7 @@ static bool MoveFloor(sector_t *sector, int crush, double move)
// Don't let the floor go above the ceiling // Don't let the floor go above the ceiling
if (!sector->ceilingplane.isSlope() && !sector->floorplane.isSlope() && if (!sector->ceilingplane.isSlope() && !sector->floorplane.isSlope() &&
!sector->PortalIsLinked(sector_t::ceiling) && !sector->PortalIsLinked(sector_t::ceiling) &&
sector->GetPlaneTexZF(sector_t::floor) > sector->GetPlaneTexZF(sector_t::ceiling)) return false; sector->GetPlaneTexZ(sector_t::floor) > sector->GetPlaneTexZ(sector_t::ceiling)) return false;
return true; return true;
} }

View file

@ -1057,10 +1057,25 @@ FUNC(LS_Teleport_NoFog)
// Teleport_NoFog (tid, useang, sectortag, keepheight) // Teleport_NoFog (tid, useang, sectortag, keepheight)
{ {
int flags = 0; int flags = 0;
if (!arg1) switch (arg1)
{ {
case 0:
flags |= TELF_KEEPORIENTATION; flags |= TELF_KEEPORIENTATION;
break;
default:
case 1:
break;
case 2:
flags |= TELF_KEEPORIENTATION | TELF_ROTATEBOOM; // adjust to exit thing like Boom (i.e. with incorrect reversed angle)
break;
case 3:
flags |= TELF_KEEPORIENTATION | TELF_ROTATEBOOMINVERSE; // adjust to exit thing correctly
break;
} }
if (arg3) if (arg3)
{ {
flags |= TELF_KEEPHEIGHT; flags |= TELF_KEEPHEIGHT;
@ -2976,7 +2991,7 @@ FUNC(LS_TranslucentLine)
int linenum; int linenum;
while ((linenum = itr.Next()) >= 0) while ((linenum = itr.Next()) >= 0)
{ {
lines[linenum].Alpha = Scale(clamp(arg1, 0, 255), OPAQUE, 255); lines[linenum].alpha = clamp(arg1, 0, 255) / 255.;
if (arg2 == 0) if (arg2 == 0)
{ {
lines[linenum].flags &= ~ML_ADDTRANS; lines[linenum].flags &= ~ML_ADDTRANS;

View file

@ -4704,7 +4704,7 @@ void P_RailAttack(FRailParams *p)
} }
// Draw the slug's trail. // Draw the slug's trail.
P_DrawRailTrail(source, rail_data.PortalHits, p->color1, p->color2, p->maxdiff, p->flags, p->spawnclass, angle, p->duration, p->sparsity, p->drift, p->SpiralOffset); P_DrawRailTrail(source, rail_data.PortalHits, p->color1, p->color2, p->maxdiff, p->flags, p->spawnclass, angle, p->duration, p->sparsity, p->drift, p->SpiralOffset, pitch);
} }
//========================================================================== //==========================================================================

View file

@ -399,7 +399,7 @@ void P_SerializeWorld (FArchive &arc)
arc << li->flags arc << li->flags
<< li->activation << li->activation
<< li->special << li->special
<< li->Alpha; << li->alpha;
if (P_IsACSSpecial(li->special)) if (P_IsACSSpecial(li->special))
{ {

View file

@ -73,7 +73,7 @@ double sector_t::FindLowestFloorSurrounding (vertex_t **v) const
double ofloor; double ofloor;
vertex_t *spot; vertex_t *spot;
if (linecount == 0) return GetPlaneTexZF(sector_t::floor); if (linecount == 0) return GetPlaneTexZ(sector_t::floor);
spot = lines[0]->v1; spot = lines[0]->v1;
floor = floorplane.ZatPoint(spot); floor = floorplane.ZatPoint(spot);
@ -117,7 +117,7 @@ double sector_t::FindHighestFloorSurrounding (vertex_t **v) const
double ofloor; double ofloor;
vertex_t *spot; vertex_t *spot;
if (linecount == 0) return GetPlaneTexZF(sector_t::floor); if (linecount == 0) return GetPlaneTexZ(sector_t::floor);
spot = lines[0]->v1; spot = lines[0]->v1;
floor = -FLT_MAX; floor = -FLT_MAX;
@ -168,7 +168,7 @@ double sector_t::FindNextHighestFloor (vertex_t **v) const
line_t *check; line_t *check;
int i; int i;
if (linecount == 0) return GetPlaneTexZF(sector_t::floor); if (linecount == 0) return GetPlaneTexZ(sector_t::floor);
spot = lines[0]->v1; spot = lines[0]->v1;
height = floorplane.ZatPoint(spot); height = floorplane.ZatPoint(spot);
@ -223,7 +223,7 @@ double sector_t::FindNextLowestFloor (vertex_t **v) const
line_t *check; line_t *check;
int i; int i;
if (linecount == 0) return GetPlaneTexZF(sector_t::floor); if (linecount == 0) return GetPlaneTexZ(sector_t::floor);
spot = lines[0]->v1; spot = lines[0]->v1;
height = floorplane.ZatPoint (spot); height = floorplane.ZatPoint (spot);
@ -278,7 +278,7 @@ double sector_t::FindNextLowestCeiling (vertex_t **v) const
int i; int i;
if (linecount == 0) return GetPlaneTexZF(sector_t::ceiling); if (linecount == 0) return GetPlaneTexZ(sector_t::ceiling);
spot = lines[0]->v1; spot = lines[0]->v1;
height = ceilingplane.ZatPoint(spot); height = ceilingplane.ZatPoint(spot);
@ -332,7 +332,7 @@ double sector_t::FindNextHighestCeiling (vertex_t **v) const
line_t *check; line_t *check;
int i; int i;
if (linecount == 0) return GetPlaneTexZF(sector_t::ceiling); if (linecount == 0) return GetPlaneTexZ(sector_t::ceiling);
spot = lines[0]->v1; spot = lines[0]->v1;
height = ceilingplane.ZatPoint(spot); height = ceilingplane.ZatPoint(spot);
@ -378,7 +378,7 @@ double sector_t::FindLowestCeilingSurrounding (vertex_t **v) const
line_t *check; line_t *check;
int i; int i;
if (linecount == 0) return GetPlaneTexZF(sector_t::ceiling); if (linecount == 0) return GetPlaneTexZ(sector_t::ceiling);
spot = lines[0]->v1; spot = lines[0]->v1;
height = FLT_MAX; height = FLT_MAX;
@ -420,7 +420,7 @@ double sector_t::FindHighestCeilingSurrounding (vertex_t **v) const
line_t *check; line_t *check;
int i; int i;
if (linecount == 0) return GetPlaneTexZF(sector_t::ceiling); if (linecount == 0) return GetPlaneTexZ(sector_t::ceiling);
spot = lines[0]->v1; spot = lines[0]->v1;
height = -FLT_MAX; height = -FLT_MAX;
@ -879,7 +879,7 @@ void sector_t::CheckPortalPlane(int plane)
if (GetPortalType(plane) == PORTS_LINKEDPORTAL) if (GetPortalType(plane) == PORTS_LINKEDPORTAL)
{ {
double portalh = GetPortalPlaneZ(plane); double portalh = GetPortalPlaneZ(plane);
double planeh = GetPlaneTexZF(plane); double planeh = GetPlaneTexZ(plane);
int obstructed = PLANEF_OBSTRUCTED * (plane == sector_t::floor ? planeh > portalh : planeh < portalh); int obstructed = PLANEF_OBSTRUCTED * (plane == sector_t::floor ? planeh > portalh : planeh < portalh);
planes[plane].Flags = (planes[plane].Flags & ~PLANEF_OBSTRUCTED) | obstructed; planes[plane].Flags = (planes[plane].Flags & ~PLANEF_OBSTRUCTED) | obstructed;
} }

View file

@ -862,7 +862,7 @@ void P_LoadVertexes (MapData * map)
SWORD x, y; SWORD x, y;
(*map->file) >> x >> y; (*map->file) >> x >> y;
vertexes[i].set(x << FRACBITS, y << FRACBITS); vertexes[i].set(double(x), double(y));
} }
} }
@ -1497,9 +1497,9 @@ void P_LoadSectors (MapData *map, FMissingTextureTracker &missingtex)
ss->e = &sectors[0].e[i]; ss->e = &sectors[0].e[i];
if (!map->HasBehavior) ss->Flags |= SECF_FLOORDROP; if (!map->HasBehavior) ss->Flags |= SECF_FLOORDROP;
ss->SetPlaneTexZ(sector_t::floor, (double)LittleShort(ms->floorheight)); ss->SetPlaneTexZ(sector_t::floor, (double)LittleShort(ms->floorheight));
ss->floorplane.set(0, 0, 1., -ss->GetPlaneTexZF(sector_t::floor)); ss->floorplane.set(0, 0, 1., -ss->GetPlaneTexZ(sector_t::floor));
ss->SetPlaneTexZ(sector_t::ceiling, (double)LittleShort(ms->ceilingheight)); ss->SetPlaneTexZ(sector_t::ceiling, (double)LittleShort(ms->ceilingheight));
ss->ceilingplane.set(0, 0, -1., ss->GetPlaneTexZF(sector_t::ceiling)); ss->ceilingplane.set(0, 0, -1., ss->GetPlaneTexZ(sector_t::ceiling));
SetTexture(ss, i, sector_t::floor, ms->floorpic, missingtex, true); SetTexture(ss, i, sector_t::floor, ms->floorpic, missingtex, true);
SetTexture(ss, i, sector_t::ceiling, ms->ceilingpic, missingtex, true); SetTexture(ss, i, sector_t::ceiling, ms->ceilingpic, missingtex, true);
ss->lightlevel = LittleShort(ms->lightlevel); ss->lightlevel = LittleShort(ms->lightlevel);
@ -2043,10 +2043,10 @@ void P_FinishLoadingLineDef(line_t *ld, int alpha)
additive = true; additive = true;
} }
alpha = Scale(alpha, OPAQUE, 255); double dalpha = alpha / 255.;
if (!ld->args[0]) if (!ld->args[0])
{ {
ld->Alpha = alpha; ld->alpha = dalpha;
if (additive) if (additive)
{ {
ld->flags |= ML_ADDTRANS; ld->flags |= ML_ADDTRANS;
@ -2058,7 +2058,7 @@ void P_FinishLoadingLineDef(line_t *ld, int alpha)
{ {
if (tagManager.LineHasID(j, ld->args[0])) if (tagManager.LineHasID(j, ld->args[0]))
{ {
lines[j].Alpha = alpha; lines[j].alpha = dalpha;
if (additive) if (additive)
{ {
lines[j].flags |= ML_ADDTRANS; lines[j].flags |= ML_ADDTRANS;
@ -2160,7 +2160,7 @@ void P_LoadLineDefs (MapData * map)
ld = lines; ld = lines;
for (i = 0; i < numlines; i++, mld++, ld++) for (i = 0; i < numlines; i++, mld++, ld++)
{ {
ld->Alpha = OPAQUE; // [RH] Opaque by default ld->alpha = 1.; // [RH] Opaque by default
ld->portalindex = UINT_MAX; ld->portalindex = UINT_MAX;
// [RH] Translate old linedef special and flags to be // [RH] Translate old linedef special and flags to be
@ -2264,7 +2264,7 @@ void P_LoadLineDefs2 (MapData * map)
ld->v1 = &vertexes[LittleShort(mld->v1)]; ld->v1 = &vertexes[LittleShort(mld->v1)];
ld->v2 = &vertexes[LittleShort(mld->v2)]; ld->v2 = &vertexes[LittleShort(mld->v2)];
ld->Alpha = OPAQUE; // [RH] Opaque by default ld->alpha = 1.; // [RH] Opaque by default
P_SetSideNum (&ld->sidedef[0], LittleShort(mld->sidenum[0])); P_SetSideNum (&ld->sidedef[0], LittleShort(mld->sidenum[0]));
P_SetSideNum (&ld->sidedef[1], LittleShort(mld->sidenum[1])); P_SetSideNum (&ld->sidedef[1], LittleShort(mld->sidenum[1]));

View file

@ -209,7 +209,7 @@ void P_VavoomSlope(sector_t * sec, int id, const DVector3 &pos, int which)
{ {
DVector3 v1, v2, cross; DVector3 v1, v2, cross;
secplane_t *srcplane = (which == 0) ? &sec->floorplane : &sec->ceilingplane; secplane_t *srcplane = (which == 0) ? &sec->floorplane : &sec->ceilingplane;
double srcheight = (which == 0) ? sec->GetPlaneTexZF(sector_t::floor) : sec->GetPlaneTexZF(sector_t::ceiling); double srcheight = (which == 0) ? sec->GetPlaneTexZ(sector_t::floor) : sec->GetPlaneTexZ(sector_t::ceiling);
v1[0] = pos.X - l->v2->fX(); v1[0] = pos.X - l->v2->fX();
v1[1] = pos.Y - l->v2->fY(); v1[1] = pos.Y - l->v2->fY();
@ -328,9 +328,9 @@ static void P_SetSlopesFromVertexHeights(FMapThing *firstmt, FMapThing *lastmt,
double *h3 = vt_heights[j].CheckKey(vi3); double *h3 = vt_heights[j].CheckKey(vi3);
if (h1 == NULL && h2 == NULL && h3 == NULL) continue; if (h1 == NULL && h2 == NULL && h3 == NULL) continue;
vt1.Z = h1? *h1 : j==0? sec->GetPlaneTexZF(sector_t::floor) : sec->GetPlaneTexZF(sector_t::ceiling); vt1.Z = h1? *h1 : j==0? sec->GetPlaneTexZ(sector_t::floor) : sec->GetPlaneTexZ(sector_t::ceiling);
vt2.Z = h2? *h2 : j==0? sec->GetPlaneTexZF(sector_t::floor) : sec->GetPlaneTexZF(sector_t::ceiling); vt2.Z = h2? *h2 : j==0? sec->GetPlaneTexZ(sector_t::floor) : sec->GetPlaneTexZ(sector_t::ceiling);
vt3.Z = h3? *h3 : j==0? sec->GetPlaneTexZF(sector_t::floor) : sec->GetPlaneTexZF(sector_t::ceiling); vt3.Z = h3? *h3 : j==0? sec->GetPlaneTexZ(sector_t::floor) : sec->GetPlaneTexZ(sector_t::ceiling);
if (P_PointOnLineSidePrecise(vertexes[vi3].fX(), vertexes[vi3].fY(), sec->lines[0]) == 0) if (P_PointOnLineSidePrecise(vertexes[vi3].fX(), vertexes[vi3].fY(), sec->lines[0]) == 0)
{ {
@ -488,8 +488,8 @@ static void P_AlignPlane(sector_t *sec, line_t *line, int which)
double srcheight, destheight; double srcheight, destheight;
srcplane = (which == 0) ? &sec->floorplane : &sec->ceilingplane; srcplane = (which == 0) ? &sec->floorplane : &sec->ceilingplane;
srcheight = (which == 0) ? sec->GetPlaneTexZF(sector_t::floor) : sec->GetPlaneTexZF(sector_t::ceiling); srcheight = (which == 0) ? sec->GetPlaneTexZ(sector_t::floor) : sec->GetPlaneTexZ(sector_t::ceiling);
destheight = (which == 0) ? refsec->GetPlaneTexZF(sector_t::floor) : refsec->GetPlaneTexZF(sector_t::ceiling); destheight = (which == 0) ? refsec->GetPlaneTexZ(sector_t::floor) : refsec->GetPlaneTexZ(sector_t::ceiling);
p[0] = line->v1->fX(); p[0] = line->v1->fX();
p[1] = line->v1->fY(); p[1] = line->v1->fY();

View file

@ -841,7 +841,7 @@ static void SetupFloorPortal (AStackPoint *point)
if (skyv != NULL) if (skyv != NULL)
{ {
skyv->target = point; skyv->target = point;
if (Sector->GetAlphaF(sector_t::floor) == 1.) if (Sector->GetAlpha(sector_t::floor) == 1.)
Sector->SetAlpha(sector_t::floor, clamp(point->args[0], 0, 255) / 255.); Sector->SetAlpha(sector_t::floor, clamp(point->args[0], 0, 255) / 255.);
Sector->Portals[sector_t::floor] = P_GetStackPortal(skyv, sector_t::floor); Sector->Portals[sector_t::floor] = P_GetStackPortal(skyv, sector_t::floor);
@ -856,7 +856,7 @@ static void SetupCeilingPortal (AStackPoint *point)
if (skyv != NULL) if (skyv != NULL)
{ {
skyv->target = point; skyv->target = point;
if (Sector->GetAlphaF(sector_t::ceiling) == 1.) if (Sector->GetAlpha(sector_t::ceiling) == 1.)
Sector->SetAlpha(sector_t::ceiling, clamp(point->args[0], 0, 255) / 255.); Sector->SetAlpha(sector_t::ceiling, clamp(point->args[0], 0, 255) / 255.);
Sector->Portals[sector_t::ceiling] = P_GetStackPortal(skyv, sector_t::ceiling); Sector->Portals[sector_t::ceiling] = P_GetStackPortal(skyv, sector_t::ceiling);
@ -917,7 +917,7 @@ static void SetPortal(sector_t *sector, int plane, unsigned pnum, double alpha)
if (sector->GetPortalType(sector_t::ceiling) == PORTS_SKYVIEWPOINT) if (sector->GetPortalType(sector_t::ceiling) == PORTS_SKYVIEWPOINT)
{ {
sector->Portals[sector_t::ceiling] = pnum; sector->Portals[sector_t::ceiling] = pnum;
if (sector->GetAlphaF(sector_t::ceiling) == 1.) if (sector->GetAlpha(sector_t::ceiling) == 1.)
sector->SetAlpha(sector_t::ceiling, alpha); sector->SetAlpha(sector_t::ceiling, alpha);
if (sectorPortals[pnum].mFlags & PORTSF_SKYFLATONLY) if (sectorPortals[pnum].mFlags & PORTSF_SKYFLATONLY)
@ -930,7 +930,7 @@ static void SetPortal(sector_t *sector, int plane, unsigned pnum, double alpha)
{ {
sector->Portals[sector_t::floor] = pnum; sector->Portals[sector_t::floor] = pnum;
} }
if (sector->GetAlphaF(sector_t::floor) == 1.) if (sector->GetAlpha(sector_t::floor) == 1.)
sector->SetAlpha(sector_t::floor, alpha); sector->SetAlpha(sector_t::floor, alpha);
if (sectorPortals[pnum].mFlags & PORTSF_SKYFLATONLY) if (sectorPortals[pnum].mFlags & PORTSF_SKYFLATONLY)

View file

@ -666,6 +666,8 @@ enum
TELF_KEEPORIENTATION = 4, TELF_KEEPORIENTATION = 4,
TELF_KEEPVELOCITY = 8, TELF_KEEPVELOCITY = 8,
TELF_KEEPHEIGHT = 16, TELF_KEEPHEIGHT = 16,
TELF_ROTATEBOOM = 32,
TELF_ROTATEBOOMINVERSE = 64,
}; };
//Spawns teleport fog. Pass the actor to pluck TeleFogFromType and TeleFogToType. 'from' determines if this is the fog to spawn at the old position (true) or new (false). //Spawns teleport fog. Pass the actor to pluck TeleFogFromType and TeleFogToType. 'from' determines if this is the fog to spawn at the old position (true) or new (false).

View file

@ -349,13 +349,14 @@ bool EV_Teleport (int tid, int tag, line_t *line, int side, AActor *thing, int f
return false; return false;
} }
// [RH] Lee Killough's changes for silent teleporters from BOOM // [RH] Lee Killough's changes for silent teleporters from BOOM
if ((flags & TELF_KEEPORIENTATION) && line) if ((flags & (TELF_ROTATEBOOM|TELF_ROTATEBOOMINVERSE)) && line)
{ {
// Get the angle between the exit thing and source linedef. // Get the angle between the exit thing and source linedef.
// Rotate 90 degrees, so that walking perpendicularly across // Rotate 90 degrees, so that walking perpendicularly across
// teleporter linedef causes thing to exit in the direction // teleporter linedef causes thing to exit in the direction
// indicated by the exit thing. // indicated by the exit thing.
angle = line->Delta().Angle() - searcher->Angles.Yaw + 90.; angle = line->Delta().Angle() - searcher->Angles.Yaw + 90.;
if (flags & TELF_ROTATEBOOMINVERSE) angle = -angle;
// Sine, cosine of angle adjustment // Sine, cosine of angle adjustment
s = angle.Sin(); s = angle.Sin();
@ -382,14 +383,17 @@ bool EV_Teleport (int tid, int tag, line_t *line, int side, AActor *thing, int f
if (P_Teleport (thing, DVector3(searcher->Pos(), z), searcher->Angles.Yaw + badangle, flags)) if (P_Teleport (thing, DVector3(searcher->Pos(), z), searcher->Angles.Yaw + badangle, flags))
{ {
// [RH] Lee Killough's changes for silent teleporters from BOOM // [RH] Lee Killough's changes for silent teleporters from BOOM
if (!(flags & TELF_DESTFOG) && line && (flags & TELF_KEEPORIENTATION)) if (line)
{ {
// Rotate thing according to difference in angles if (flags & (TELF_ROTATEBOOM| TELF_ROTATEBOOMINVERSE))
thing->Angles.Yaw += angle; {
// Rotate thing according to difference in angles (or not - Boom got the direction wrong here.)
thing->Angles.Yaw += angle;
// Rotate thing's velocity to come out of exit just like it entered // Rotate thing's velocity to come out of exit just like it entered
thing->Vel.X = vx*c - vy*s; thing->Vel.X = vx*c - vy*s;
thing->Vel.Y = vy*c + vx*s; thing->Vel.Y = vy*c + vx*s;
}
} }
if (vx == 0 && vy == 0 && thing->player != NULL && thing->player->mo == thing && !predicting) if (vx == 0 && vy == 0 && thing->player != NULL && thing->player->mo == thing && !predicting)
{ {

View file

@ -785,7 +785,7 @@ public:
FString tagstring; FString tagstring;
memset(ld, 0, sizeof(*ld)); memset(ld, 0, sizeof(*ld));
ld->Alpha = OPAQUE; ld->alpha = 1.;
ld->portalindex = UINT_MAX; ld->portalindex = UINT_MAX;
ld->sidedef[0] = ld->sidedef[1] = NULL; ld->sidedef[0] = ld->sidedef[1] = NULL;
if (level.flags2 & LEVEL2_CLIPMIDTEX) ld->flags |= ML_CLIP_MIDTEX; if (level.flags2 & LEVEL2_CLIPMIDTEX) ld->flags |= ML_CLIP_MIDTEX;
@ -1087,13 +1087,13 @@ public:
{ {
ld->activation = (ld->activation & ~SPAC_Use) | SPAC_UseThrough; ld->activation = (ld->activation & ~SPAC_Use) | SPAC_UseThrough;
} }
if (strifetrans && ld->Alpha == OPAQUE) if (strifetrans && ld->alpha == 1.)
{ {
ld->Alpha = TRANSLUC75; ld->alpha = 0.75;
} }
if (strifetrans2 && ld->Alpha == OPAQUE) if (strifetrans2 && ld->alpha == OPAQUE)
{ {
ld->Alpha = TRANSLUC25; ld->alpha = 0.25;
} }
if (ld->sidedef[0] == NULL) if (ld->sidedef[0] == NULL)
{ {
@ -1596,7 +1596,7 @@ public:
// Reset the planes to their defaults if not all of the plane equation's parameters were found. // Reset the planes to their defaults if not all of the plane equation's parameters were found.
if (fplaneflags != 15) if (fplaneflags != 15)
{ {
sec->floorplane.SetAtHeight(sec->GetPlaneTexZF(sector_t::floor), sector_t::floor); sec->floorplane.SetAtHeight(sec->GetPlaneTexZ(sector_t::floor), sector_t::floor);
} }
else else
{ {
@ -1606,7 +1606,7 @@ public:
} }
if (cplaneflags != 15) if (cplaneflags != 15)
{ {
sec->ceilingplane.SetAtHeight(sec->GetPlaneTexZF(sector_t::ceiling), sector_t::ceiling); sec->ceilingplane.SetAtHeight(sec->GetPlaneTexZ(sector_t::ceiling), sector_t::ceiling);
} }
else else
{ {

View file

@ -196,8 +196,8 @@ static int WriteSECTORS (FILE *file)
for (int i = 0; i < numsectors; ++i) for (int i = 0; i < numsectors; ++i)
{ {
ms.floorheight = LittleShort(short(sectors[i].GetPlaneTexZF(sector_t::floor))); ms.floorheight = LittleShort(short(sectors[i].GetPlaneTexZ(sector_t::floor)));
ms.ceilingheight = LittleShort(short(sectors[i].GetPlaneTexZF(sector_t::ceiling))); ms.ceilingheight = LittleShort(short(sectors[i].GetPlaneTexZ(sector_t::ceiling)));
uppercopy (ms.floorpic, GetTextureName (sectors[i].GetTexture(sector_t::floor))); uppercopy (ms.floorpic, GetTextureName (sectors[i].GetTexture(sector_t::floor)));
uppercopy (ms.ceilingpic, GetTextureName (sectors[i].GetTexture(sector_t::ceiling))); uppercopy (ms.ceilingpic, GetTextureName (sectors[i].GetTexture(sector_t::ceiling)));
ms.lightlevel = LittleShort((short)sectors[i].lightlevel); ms.lightlevel = LittleShort((short)sectors[i].lightlevel);

View file

@ -87,10 +87,10 @@ void P_TranslateLineDef (line_t *ld, maplinedef_t *mld, int lineindexforid)
passthrough = true; passthrough = true;
break; break;
case -2: case -2:
ld->Alpha = TRANSLUC75; ld->alpha = 0.75;
break; break;
case -3: case -3:
ld->Alpha = TRANSLUC25; ld->alpha = 0.25;
break; break;
default: default:
newflags |= LineFlagTranslations[i].newvalue; newflags |= LineFlagTranslations[i].newvalue;

View file

@ -708,7 +708,7 @@ unsigned P_GetPortal(int type, int plane, sector_t *from, sector_t *to, const DV
sectorPortals[i].mOrigin = from; sectorPortals[i].mOrigin = from;
sectorPortals[i].mDestination = to; sectorPortals[i].mDestination = to;
sectorPortals[i].mDisplacement = displacement; sectorPortals[i].mDisplacement = displacement;
sectorPortals[i].mPlaneZ = type == PORTS_LINKEDPORTAL? from->GetPlaneTexZF(plane) : FLT_MAX; sectorPortals[i].mPlaneZ = type == PORTS_LINKEDPORTAL? from->GetPlaneTexZ(plane) : FLT_MAX;
return i; return i;
} }

View file

@ -441,12 +441,12 @@ void DSectorPlaneInterpolation::UpdateInterpolation()
if (!ceiling) if (!ceiling)
{ {
oldheight = sector->floorplane.fD(); oldheight = sector->floorplane.fD();
oldtexz = sector->GetPlaneTexZF(sector_t::floor); oldtexz = sector->GetPlaneTexZ(sector_t::floor);
} }
else else
{ {
oldheight = sector->ceilingplane.fD(); oldheight = sector->ceilingplane.fD();
oldtexz = sector->GetPlaneTexZF(sector_t::ceiling); oldtexz = sector->GetPlaneTexZ(sector_t::ceiling);
} }
} }
@ -495,7 +495,7 @@ void DSectorPlaneInterpolation::Interpolate(double smoothratio)
} }
bakheight = pplane->fD(); bakheight = pplane->fD();
baktexz = sector->GetPlaneTexZF(pos); baktexz = sector->GetPlaneTexZ(pos);
if (refcount == 0 && oldheight == bakheight) if (refcount == 0 && oldheight == bakheight)
{ {

View file

@ -689,9 +689,9 @@ public:
FTransform xform; FTransform xform;
int Flags; int Flags;
int Light; int Light;
fixed_t alpha; double alpha;
FTextureID Texture; FTextureID Texture;
fixed_t TexZ; double TexZ;
}; };
@ -779,19 +779,14 @@ public:
void SetAlpha(int pos, double o) void SetAlpha(int pos, double o)
{ {
planes[pos].alpha = FLOAT2FIXED(o); planes[pos].alpha = o;
} }
fixed_t GetAlpha(int pos) const double GetAlpha(int pos) const
{ {
return planes[pos].alpha; return planes[pos].alpha;
} }
double GetAlphaF(int pos) const
{
return FIXED2DBL(planes[pos].alpha);
}
int GetFlags(int pos) const int GetFlags(int pos) const
{ {
return planes[pos].Flags; return planes[pos].Flags;
@ -831,25 +826,20 @@ public:
if (floorclip && pos == floor && tex != old) AdjustFloorClip(); if (floorclip && pos == floor && tex != old) AdjustFloorClip();
} }
fixed_t GetPlaneTexZ(int pos) const double GetPlaneTexZ(int pos) const
{ {
return planes[pos].TexZ; return planes[pos].TexZ;
} }
double GetPlaneTexZF(int pos) const
{
return FIXED2DBL(planes[pos].TexZ);
}
void SetPlaneTexZ(int pos, double val, bool dirtify = false) // This mainly gets used by init code. The only place where it must set the vertex to dirty is the interpolation code. void SetPlaneTexZ(int pos, double val, bool dirtify = false) // This mainly gets used by init code. The only place where it must set the vertex to dirty is the interpolation code.
{ {
planes[pos].TexZ = FLOAT2FIXED(val); planes[pos].TexZ = val;
if (dirtify) SetAllVerticesDirty(); if (dirtify) SetAllVerticesDirty();
} }
void ChangePlaneTexZ(int pos, double val) void ChangePlaneTexZ(int pos, double val)
{ {
planes[pos].TexZ += FLOAT2FIXED(val); planes[pos].TexZ += val;
} }
static inline short ClampLight(int level) static inline short ClampLight(int level)
@ -1302,8 +1292,8 @@ public:
DWORD flags; DWORD flags;
DWORD activation; // activation type DWORD activation; // activation type
int special; int special;
fixed_t Alpha; // <--- translucency (0=invisibile, FRACUNIT=opaque)
int args[5]; // <--- hexen-style arguments (expanded to ZDoom's full width) int args[5]; // <--- hexen-style arguments (expanded to ZDoom's full width)
double alpha; // <--- translucency (0=invisibile, FRACUNIT=opaque)
side_t *sidedef[2]; side_t *sidedef[2];
double bbox[4]; // bounding box, for the extent of the LineDef. double bbox[4]; // bounding box, for the extent of the LineDef.
sector_t *frontsector, *backsector; sector_t *frontsector, *backsector;
@ -1324,7 +1314,7 @@ public:
void setAlpha(double a) void setAlpha(double a)
{ {
Alpha = FLOAT2FIXED(a); alpha = a;
} }
FSectorPortal *GetTransferredPortal() FSectorPortal *GetTransferredPortal()

View file

@ -726,11 +726,9 @@ void R_EnterPortal (PortalDrawseg* pds, int depth)
} }
else else
{ {
DVector3 view(ViewPos); P_TranslatePortalXY(pds->src, ViewPos.X, ViewPos.Y);
DAngle va = ViewAngle; P_TranslatePortalZ(pds->src, ViewPos.Z);
P_TranslatePortalXY(pds->src, view.X, view.Y); P_TranslatePortalAngle(pds->src, ViewAngle);
P_TranslatePortalZ(pds->src, view.Z);
P_TranslatePortalAngle(pds->src, va);
P_TranslatePortalXY(pds->src, ViewPath[0].X, ViewPath[0].Y); P_TranslatePortalXY(pds->src, ViewPath[0].X, ViewPath[0].Y);
P_TranslatePortalXY(pds->src, ViewPath[1].X, ViewPath[1].Y); P_TranslatePortalXY(pds->src, ViewPath[1].X, ViewPath[1].Y);
@ -739,8 +737,8 @@ void R_EnterPortal (PortalDrawseg* pds, int depth)
double distp = (ViewPath[0] - ViewPath[1]).Length(); double distp = (ViewPath[0] - ViewPath[1]).Length();
if (distp > EQUAL_EPSILON) if (distp > EQUAL_EPSILON)
{ {
double dist1 = (view - ViewPath[0]).Length(); double dist1 = (ViewPos - ViewPath[0]).Length();
double dist2 = (view - ViewPath[1]).Length(); double dist2 = (ViewPos - ViewPath[1]).Length();
if (dist1 + dist2 < distp + 1) if (dist1 + dist2 < distp + 1)
{ {
@ -748,8 +746,6 @@ void R_EnterPortal (PortalDrawseg* pds, int depth)
} }
} }
} }
ViewPos = view;
ViewAngle = va;
} }
ViewSin = ViewAngle.Sin(); ViewSin = ViewAngle.Sin();

View file

@ -581,7 +581,7 @@ static visplane_t *new_visplane (unsigned hash)
// killough 2/28/98: Add offsets // killough 2/28/98: Add offsets
//========================================================================== //==========================================================================
visplane_t *R_FindPlane (const secplane_t &height, FTextureID picnum, int lightlevel, fixed_t alpha, bool additive, visplane_t *R_FindPlane (const secplane_t &height, FTextureID picnum, int lightlevel, double Alpha, bool additive,
const FTransform &xform, const FTransform &xform,
int sky, FSectorPortal *portal) int sky, FSectorPortal *portal)
{ {
@ -593,6 +593,7 @@ visplane_t *R_FindPlane (const secplane_t &height, FTextureID picnum, int lightl
fixed_t yoffs = FLOAT2FIXED(xform.yOffs + xform.baseyOffs); fixed_t yoffs = FLOAT2FIXED(xform.yOffs + xform.baseyOffs);
fixed_t xscale = FLOAT2FIXED(xform.xScale); fixed_t xscale = FLOAT2FIXED(xform.xScale);
fixed_t yscale = FLOAT2FIXED(xform.yScale); fixed_t yscale = FLOAT2FIXED(xform.yScale);
fixed_t alpha = FLOAT2FIXED(Alpha);
angle_t angle = (xform.Angle + xform.baseAngle).BAMs(); angle_t angle = (xform.Angle + xform.baseAngle).BAMs();
if (picnum == skyflatnum) // killough 10/98 if (picnum == skyflatnum) // killough 10/98

View file

@ -98,7 +98,7 @@ visplane_t *R_FindPlane
( const secplane_t &height, ( const secplane_t &height,
FTextureID picnum, FTextureID picnum,
int lightlevel, int lightlevel,
fixed_t alpha, double alpha,
bool additive, bool additive,
const FTransform &xform, const FTransform &xform,
int sky, int sky,

View file

@ -243,7 +243,7 @@ void R_RenderMaskedSegRange (drawseg_t *ds, int x1, int x2)
ESPSResult drawmode; ESPSResult drawmode;
drawmode = R_SetPatchStyle (LegacyRenderStyles[curline->linedef->flags & ML_ADDTRANS ? STYLE_Add : STYLE_Translucent], drawmode = R_SetPatchStyle (LegacyRenderStyles[curline->linedef->flags & ML_ADDTRANS ? STYLE_Add : STYLE_Translucent],
MIN<fixed_t>(curline->linedef->Alpha, OPAQUE), 0, 0); (float)MIN(curline->linedef->alpha, 1.), 0, 0);
if ((drawmode == DontDraw && !ds->bFogBoundary && !ds->bFakeBoundary)) if ((drawmode == DontDraw && !ds->bFogBoundary && !ds->bFakeBoundary))
{ {
@ -325,11 +325,11 @@ void R_RenderMaskedSegRange (drawseg_t *ds, int x1, int x2)
} }
if (curline->linedef->flags & ML_DONTPEGBOTTOM) if (curline->linedef->flags & ML_DONTPEGBOTTOM)
{ {
dc_texturemid = MAX(frontsector->GetPlaneTexZF(sector_t::floor), backsector->GetPlaneTexZF(sector_t::floor)) + texheight; dc_texturemid = MAX(frontsector->GetPlaneTexZ(sector_t::floor), backsector->GetPlaneTexZ(sector_t::floor)) + texheight;
} }
else else
{ {
dc_texturemid = MIN(frontsector->GetPlaneTexZF(sector_t::ceiling), backsector->GetPlaneTexZF(sector_t::ceiling)); dc_texturemid = MIN(frontsector->GetPlaneTexZ(sector_t::ceiling), backsector->GetPlaneTexZ(sector_t::ceiling));
} }
rowoffset = curline->sidedef->GetTextureYOffset(side_t::mid); rowoffset = curline->sidedef->GetTextureYOffset(side_t::mid);
@ -603,7 +603,7 @@ void R_RenderFakeWall(drawseg_t *ds, int x1, int x2, F3DFloor *rover)
yscale = rw_pic->Scale.Y * scaledside->GetTextureYScale(scaledpart); yscale = rw_pic->Scale.Y * scaledside->GetTextureYScale(scaledpart);
double rowoffset = curline->sidedef->GetTextureYOffset(side_t::mid) + rover->master->sidedef[0]->GetTextureYOffset(side_t::mid); double rowoffset = curline->sidedef->GetTextureYOffset(side_t::mid) + rover->master->sidedef[0]->GetTextureYOffset(side_t::mid);
double planez = rover->model->GetPlaneTexZF(sector_t::ceiling); double planez = rover->model->GetPlaneTexZ(sector_t::ceiling);
rw_offset = FLOAT2FIXED(curline->sidedef->GetTextureXOffset(side_t::mid) + rover->master->sidedef[0]->GetTextureXOffset(side_t::mid)); rw_offset = FLOAT2FIXED(curline->sidedef->GetTextureXOffset(side_t::mid) + rover->master->sidedef[0]->GetTextureXOffset(side_t::mid));
if (rowoffset < 0) if (rowoffset < 0)
{ {
@ -2035,11 +2035,11 @@ void R_NewWall (bool needlights)
{ // normal orientation { // normal orientation
if (linedef->flags & ML_DONTPEGBOTTOM) if (linedef->flags & ML_DONTPEGBOTTOM)
{ // bottom of texture at bottom { // bottom of texture at bottom
rw_midtexturemid = (frontsector->GetPlaneTexZF(sector_t::floor) - ViewPos.Z) * yrepeat + midtexture->GetHeight(); rw_midtexturemid = (frontsector->GetPlaneTexZ(sector_t::floor) - ViewPos.Z) * yrepeat + midtexture->GetHeight();
} }
else else
{ // top of texture at top { // top of texture at top
rw_midtexturemid = (frontsector->GetPlaneTexZF(sector_t::ceiling) - ViewPos.Z) * yrepeat; rw_midtexturemid = (frontsector->GetPlaneTexZ(sector_t::ceiling) - ViewPos.Z) * yrepeat;
if (rowoffset < 0 && midtexture != NULL) if (rowoffset < 0 && midtexture != NULL)
{ {
rowoffset += midtexture->GetHeight(); rowoffset += midtexture->GetHeight();
@ -2051,7 +2051,7 @@ void R_NewWall (bool needlights)
rowoffset = -rowoffset; rowoffset = -rowoffset;
if (linedef->flags & ML_DONTPEGBOTTOM) if (linedef->flags & ML_DONTPEGBOTTOM)
{ // top of texture at bottom { // top of texture at bottom
rw_midtexturemid = (frontsector->GetPlaneTexZF(sector_t::floor) - ViewPos.Z) * yrepeat; rw_midtexturemid = (frontsector->GetPlaneTexZ(sector_t::floor) - ViewPos.Z) * yrepeat;
} }
else else
{ // bottom of texture at top { // bottom of texture at top
@ -2074,7 +2074,7 @@ void R_NewWall (bool needlights)
{ // two-sided line { // two-sided line
// hack to allow height changes in outdoor areas // hack to allow height changes in outdoor areas
rw_frontlowertop = frontsector->GetPlaneTexZF(sector_t::ceiling); rw_frontlowertop = frontsector->GetPlaneTexZ(sector_t::ceiling);
if (frontsector->GetTexture(sector_t::ceiling) == skyflatnum && if (frontsector->GetTexture(sector_t::ceiling) == skyflatnum &&
backsector->GetTexture(sector_t::ceiling) == skyflatnum) backsector->GetTexture(sector_t::ceiling) == skyflatnum)
@ -2095,7 +2095,7 @@ void R_NewWall (bool needlights)
} }
// Putting sky ceilings on the front and back of a line alters the way unpegged // Putting sky ceilings on the front and back of a line alters the way unpegged
// positioning works. // positioning works.
rw_frontlowertop = backsector->GetPlaneTexZF(sector_t::ceiling); rw_frontlowertop = backsector->GetPlaneTexZ(sector_t::ceiling);
} }
if ((rw_backcz1 <= rw_frontfz1 && rw_backcz2 <= rw_frontfz2) || if ((rw_backcz1 <= rw_frontfz1 && rw_backcz2 <= rw_frontfz2) ||
@ -2179,7 +2179,7 @@ void R_NewWall (bool needlights)
{ // normal orientation { // normal orientation
if (linedef->flags & ML_DONTPEGTOP) if (linedef->flags & ML_DONTPEGTOP)
{ // top of texture at top { // top of texture at top
rw_toptexturemid = (frontsector->GetPlaneTexZF(sector_t::ceiling) - ViewPos.Z) * yrepeat; rw_toptexturemid = (frontsector->GetPlaneTexZ(sector_t::ceiling) - ViewPos.Z) * yrepeat;
if (rowoffset < 0 && toptexture != NULL) if (rowoffset < 0 && toptexture != NULL)
{ {
rowoffset += toptexture->GetHeight(); rowoffset += toptexture->GetHeight();
@ -2187,7 +2187,7 @@ void R_NewWall (bool needlights)
} }
else else
{ // bottom of texture at bottom { // bottom of texture at bottom
rw_toptexturemid = (backsector->GetPlaneTexZF(sector_t::ceiling) - ViewPos.Z) * yrepeat + toptexture->GetHeight(); rw_toptexturemid = (backsector->GetPlaneTexZ(sector_t::ceiling) - ViewPos.Z) * yrepeat + toptexture->GetHeight();
} }
} }
else else
@ -2195,11 +2195,11 @@ void R_NewWall (bool needlights)
rowoffset = -rowoffset; rowoffset = -rowoffset;
if (linedef->flags & ML_DONTPEGTOP) if (linedef->flags & ML_DONTPEGTOP)
{ // bottom of texture at top { // bottom of texture at top
rw_toptexturemid = (frontsector->GetPlaneTexZF(sector_t::ceiling) - ViewPos.Z) * yrepeat + toptexture->GetHeight(); rw_toptexturemid = (frontsector->GetPlaneTexZ(sector_t::ceiling) - ViewPos.Z) * yrepeat + toptexture->GetHeight();
} }
else else
{ // top of texture at bottom { // top of texture at bottom
rw_toptexturemid = (backsector->GetPlaneTexZF(sector_t::ceiling) - ViewPos.Z) * yrepeat; rw_toptexturemid = (backsector->GetPlaneTexZ(sector_t::ceiling) - ViewPos.Z) * yrepeat;
} }
} }
if (toptexture->bWorldPanning) if (toptexture->bWorldPanning)
@ -2228,7 +2228,7 @@ void R_NewWall (bool needlights)
} }
else else
{ // top of texture at top { // top of texture at top
rw_bottomtexturemid = (backsector->GetPlaneTexZF(sector_t::floor) - ViewPos.Z) * yrepeat; rw_bottomtexturemid = (backsector->GetPlaneTexZ(sector_t::floor) - ViewPos.Z) * yrepeat;
if (rowoffset < 0 && bottomtexture != NULL) if (rowoffset < 0 && bottomtexture != NULL)
{ {
rowoffset += bottomtexture->GetHeight(); rowoffset += bottomtexture->GetHeight();
@ -3047,31 +3047,31 @@ static void R_RenderDecal (side_t *wall, DBaseDecal *decal, drawseg_t *clipper,
case RF_RELUPPER: case RF_RELUPPER:
if (curline->linedef->flags & ML_DONTPEGTOP) if (curline->linedef->flags & ML_DONTPEGTOP)
{ {
zpos = decal->Z + front->GetPlaneTexZF(sector_t::ceiling); zpos = decal->Z + front->GetPlaneTexZ(sector_t::ceiling);
} }
else else
{ {
zpos = decal->Z + back->GetPlaneTexZF(sector_t::ceiling); zpos = decal->Z + back->GetPlaneTexZ(sector_t::ceiling);
} }
break; break;
case RF_RELLOWER: case RF_RELLOWER:
if (curline->linedef->flags & ML_DONTPEGBOTTOM) if (curline->linedef->flags & ML_DONTPEGBOTTOM)
{ {
zpos = decal->Z + front->GetPlaneTexZF(sector_t::ceiling); zpos = decal->Z + front->GetPlaneTexZ(sector_t::ceiling);
} }
else else
{ {
zpos = decal->Z + back->GetPlaneTexZF(sector_t::floor); zpos = decal->Z + back->GetPlaneTexZ(sector_t::floor);
} }
break; break;
case RF_RELMID: case RF_RELMID:
if (curline->linedef->flags & ML_DONTPEGBOTTOM) if (curline->linedef->flags & ML_DONTPEGBOTTOM)
{ {
zpos = decal->Z + front->GetPlaneTexZF(sector_t::floor); zpos = decal->Z + front->GetPlaneTexZ(sector_t::floor);
} }
else else
{ {
zpos = decal->Z + front->GetPlaneTexZF(sector_t::ceiling); zpos = decal->Z + front->GetPlaneTexZ(sector_t::ceiling);
} }
} }

View file

@ -678,7 +678,7 @@ void R_DrawVisVoxel(vissprite_t *spr, int minslabz, int maxslabz, short *cliptop
} }
// Render the voxel, either directly to the screen or offscreen. // Render the voxel, either directly to the screen or offscreen.
R_DrawVoxel(spr->vpos, spr->vang, spr->gpos, spr->angle, R_DrawVoxel(spr->pa.vpos, spr->pa.vang, spr->gpos, spr->angle,
spr->xscale, FLOAT2FIXED(spr->yscale), spr->voxel, spr->Style.colormap, cliptop, clipbot, spr->xscale, FLOAT2FIXED(spr->yscale), spr->voxel, spr->Style.colormap, cliptop, clipbot,
minslabz, maxslabz, flags); minslabz, maxslabz, flags);
@ -1033,8 +1033,8 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor
vis->angle -= ang.BAMs(); vis->angle -= ang.BAMs();
} }
vis->vpos = { (float)ViewPos.X, (float)ViewPos.Y, (float)ViewPos.Z }; vis->pa.vpos = { (float)ViewPos.X, (float)ViewPos.Y, (float)ViewPos.Z };
vis->vang = FAngle((float)ViewAngle.Degrees); vis->pa.vang = FAngle((float)ViewAngle.Degrees);
} }
// killough 3/27/98: save sector for special clipping later // killough 3/27/98: save sector for special clipping later
@ -1284,12 +1284,20 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, double sx, double
WORD flip; WORD flip;
FTexture* tex; FTexture* tex;
vissprite_t* vis; vissprite_t* vis;
static vissprite_t avis[NUMPSPRITES]; static vissprite_t avis[NUMPSPRITES + 1];
vissprite_t tempvis; static vissprite_t *avisp[countof(avis)];
bool noaccel; bool noaccel;
assert(pspnum >= 0 && pspnum < NUMPSPRITES); assert(pspnum >= 0 && pspnum < NUMPSPRITES);
if (avisp[0] == NULL)
{
for (unsigned i = 0; i < countof(avis); ++i)
{
avisp[i] = &avis[i];
}
}
// decide which patch to use // decide which patch to use
if ( (unsigned)psp->sprite >= (unsigned)sprites.Size ()) if ( (unsigned)psp->sprite >= (unsigned)sprites.Size ())
{ {
@ -1329,7 +1337,7 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, double sx, double
return; return;
// store information in a vissprite // store information in a vissprite
vis = &tempvis; vis = avisp[NUMPSPRITES];
vis->renderflags = owner->renderflags; vis->renderflags = owner->renderflags;
vis->floorclip = 0; vis->floorclip = 0;
@ -1499,8 +1507,8 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, double sx, double
{ {
VisPSpritesX1[pspnum] = x1; VisPSpritesX1[pspnum] = x1;
VisPSpritesBaseColormap[pspnum] = colormap_to_use; VisPSpritesBaseColormap[pspnum] = colormap_to_use;
VisPSprites[pspnum] = &avis[pspnum]; VisPSprites[pspnum] = vis;
avis[pspnum] = *vis; swapvalues(avisp[pspnum], avisp[NUMPSPRITES]);
return; return;
} }
} }

View file

@ -31,6 +31,12 @@
struct vissprite_t struct vissprite_t
{ {
struct posang
{
FVector3 vpos; // view origin
FAngle vang; // view angle
};
short x1, x2; short x1, x2;
FVector3 gpos; // origin in world coordinates FVector3 gpos; // origin in world coordinates
union union
@ -61,16 +67,9 @@ struct vissprite_t
fixed_t xiscale; // negative if flipped fixed_t xiscale; // negative if flipped
}; };
// Used by wall sprites // Used by wall sprites
struct FWallCoords wallc;
{
FWallCoords wallc;
};
// Used by voxels // Used by voxels
struct posang pa;
{
FVector3 vpos; // view origin
FAngle vang; // view angle
};
}; };
sector_t *heightsec; // killough 3/27/98: height sector for underwater/fake ceiling sector_t *heightsec; // killough 3/27/98: height sector for underwater/fake ceiling
sector_t *sector; // [RH] sector this sprite is in sector_t *sector; // [RH] sector this sprite is in
@ -88,7 +87,6 @@ struct vissprite_t
int CurrentPortalUniq; // [ZZ] to identify the portal that this thing is in. used for clipping. int CurrentPortalUniq; // [ZZ] to identify the portal that this thing is in. used for clipping.
vissprite_t() {} vissprite_t() {}
vissprite_t &vissprite_t::operator= (const vissprite_t &o) { memcpy(this, &o, sizeof *this); return *this; }
}; };
struct particle_t; struct particle_t;

View file

@ -3137,7 +3137,7 @@ ExpEmit FxArrayElement::Emit(VMFunctionBuilder *build)
{ {
shiftbits++; shiftbits++;
} }
assert(1 << shiftbits == arraytype->ElementSize && "Element sizes other than power of 2 are not implemented"); assert(1u << shiftbits == arraytype->ElementSize && "Element sizes other than power of 2 are not implemented");
build->Emit(OP_BOUND, indexv.RegNum, arraytype->ElementCount); build->Emit(OP_BOUND, indexv.RegNum, arraytype->ElementCount);
if (shiftbits > 0) if (shiftbits > 0)
{ {

View file

@ -204,8 +204,7 @@ void DCanvas::DrawTextureParms(FTexture *img, DrawParms &parms)
// There is not enough precision in the drawing routines to keep the full // There is not enough precision in the drawing routines to keep the full
// precision for y0. :( // precision for y0. :(
double dummy; modf(y0, &sprtopscreen);
sprtopscreen = modf(y0, &dummy);
double yscale = parms.destheight / img->GetHeight(); double yscale = parms.destheight / img->GetHeight();
double iyscale = 1 / yscale; double iyscale = 1 / yscale;

View file

@ -781,16 +781,13 @@ Outside comments: A faster version with only 10 (not 24) multiplies.
} }
}; };
#define BAM_FACTOR (90. / 0x40000000)
template<class vec_t> template<class vec_t>
struct TAngle struct TAngle
{ {
vec_t Degrees; vec_t Degrees;
private:
const double BAM_FACTOR = (90. / 0x40000000);
public:
// This is to catch any accidental attempt to assign an angle_t to this type. Any explicit exception will require a type cast. // This is to catch any accidental attempt to assign an angle_t to this type. Any explicit exception will require a type cast.
TAngle(int) = delete; TAngle(int) = delete;
TAngle(unsigned int) = delete; TAngle(unsigned int) = delete;

View file

@ -72,11 +72,11 @@ const char *GetVersionString();
// SAVESIG should match SAVEVER. // SAVESIG should match SAVEVER.
// MINSAVEVER is the minimum level snapshot version that can be loaded. // MINSAVEVER is the minimum level snapshot version that can be loaded.
#define MINSAVEVER 4542 #define MINSAVEVER 4543
// Use 4500 as the base git save version, since it's higher than the // Use 4500 as the base git save version, since it's higher than the
// SVN revision ever got. // SVN revision ever got.
#define SAVEVER 4542 #define SAVEVER 4543
#define SAVEVERSTRINGIFY2(x) #x #define SAVEVERSTRINGIFY2(x) #x
#define SAVEVERSTRINGIFY(x) SAVEVERSTRINGIFY2(x) #define SAVEVERSTRINGIFY(x) SAVEVERSTRINGIFY2(x)

View file

@ -1527,9 +1527,9 @@ OptionValue MidiDevices
OptionMenu SoundOptions OptionMenu SoundOptions
{ {
Title "$SNDMNU_TITLE" Title "$SNDMNU_TITLE"
Slider "$SNDMNU_SFXVOLUME", "snd_sfxvolume", 0, 1, 0.05 Slider "$SNDMNU_SFXVOLUME", "snd_sfxvolume", 0, 1, 0.05, 2
Slider "$SNDMNU_MENUVOLUME", "snd_menuvolume", 0, 1, 0.05 Slider "$SNDMNU_MENUVOLUME", "snd_menuvolume", 0, 1, 0.05, 2
Slider "$SNDMNU_MUSICVOLUME", "snd_musicvolume", 0, 1, 0.05 Slider "$SNDMNU_MUSICVOLUME", "snd_musicvolume", 0, 1, 0.05, 2
Option "$SNDMNU_MIDIDEVICE", "snd_mididevice", "MidiDevices" Option "$SNDMNU_MIDIDEVICE", "snd_mididevice", "MidiDevices"
StaticText " " StaticText " "
Option "$SNDMNU_UNDERWATERREVERB", "snd_waterreverb", "OnOff" Option "$SNDMNU_UNDERWATERREVERB", "snd_waterreverb", "OnOff"

View file

@ -209,10 +209,10 @@ include "xlat/defines.i"
204 = USE, Ceiling_LowerToHighestFloor (tag, C_SLOW) 204 = USE, Ceiling_LowerToHighestFloor (tag, C_SLOW)
205 = USE|REP, Ceiling_LowerToLowest (tag, C_SLOW) 205 = USE|REP, Ceiling_LowerToLowest (tag, C_SLOW)
206 = USE|REP, Ceiling_LowerToHighestFloor (tag, C_SLOW) 206 = USE|REP, Ceiling_LowerToHighestFloor (tag, C_SLOW)
207 = WALK|MONST, Teleport_NoFog (0, 0, tag, 1) 207 = WALK|MONST, Teleport_NoFog (0, 2, tag, 1)
208 = WALK|REP|MONST, Teleport_NoFog (0, 0, tag, 1) 208 = WALK|REP|MONST, Teleport_NoFog (0, 2, tag, 1)
209 = USE|MONST, Teleport_NoFog (0, 0, tag, 1) 209 = USE|MONST, Teleport_NoFog (0, 2, tag, 1)
210 = USE|REP|MONST, Teleport_NoFog (0, 0, tag, 1) 210 = USE|REP|MONST, Teleport_NoFog (0, 2, tag, 1)
211 = USE|REP, Plat_ToggleCeiling (tag) 211 = USE|REP, Plat_ToggleCeiling (tag)
212 = WALK|REP, Plat_ToggleCeiling (tag) 212 = WALK|REP, Plat_ToggleCeiling (tag)
213 = 0, Transfer_FloorLight (tag) 213 = 0, Transfer_FloorLight (tag)
@ -270,8 +270,8 @@ include "xlat/defines.i"
265 = MONWALK|REP, Teleport_Line (tag, tag, 1) 265 = MONWALK|REP, Teleport_Line (tag, tag, 1)
266 = MONWALK, Teleport_Line (tag, tag, 0) 266 = MONWALK, Teleport_Line (tag, tag, 0)
267 = MONWALK|REP, Teleport_Line (tag, tag, 0) 267 = MONWALK|REP, Teleport_Line (tag, tag, 0)
268 = MONWALK, Teleport_NoFog (0, 0, tag, 1) 268 = MONWALK, Teleport_NoFog (0, 2, tag, 1)
269 = MONWALK|REP, Teleport_NoFog (0, 0, tag, 1) 269 = MONWALK|REP, Teleport_NoFog (0, 2, tag, 1)
/****** MBF linetypes ******/ /****** MBF linetypes ******/