diff --git a/src/c_cvars.cpp b/src/c_cvars.cpp index 1a1b71647..36e3d576b 100644 --- a/src/c_cvars.cpp +++ b/src/c_cvars.cpp @@ -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) { DoSet (value, type); @@ -281,7 +286,9 @@ const char *FBaseCVar::ToString (UCVarValue value, ECVarType type) break; case CVAR_Float: - mysnprintf (cstrbuf, countof(cstrbuf), "%g", value.Float); + IGNORE_FORMAT_PRE + mysnprintf (cstrbuf, countof(cstrbuf), "%H", value.Float); + IGNORE_FORMAT_POST break; case CVAR_GUID: @@ -399,7 +406,9 @@ UCVarValue FBaseCVar::FromFloat (float value, ECVarType type) break; case CVAR_String: - mysnprintf (cstrbuf, countof(cstrbuf), "%g", value); + IGNORE_FORMAT_PRE + mysnprintf (cstrbuf, countof(cstrbuf), "%H", value); + IGNORE_FORMAT_POST ret.String = cstrbuf; break; @@ -746,6 +755,16 @@ ECVarType FFloatCVar::GetRealType () const 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 { return FromFloat (Value, type); @@ -1671,7 +1690,7 @@ void FBaseCVar::ListVars (const char *filter, bool plain) if (!(flags & CVAR_UNSETTABLE)) { ++count; - Printf ("%s : %s\n", var->GetName(), var->GetGenericRep(CVAR_String).String); + Printf ("%s : %s\n", var->GetName(), var->GetHumanString()); } } else @@ -1688,7 +1707,7 @@ void FBaseCVar::ListVars (const char *filter, bool plain) flags & CVAR_MOD ? 'M' : ' ', flags & CVAR_IGNORE ? 'X' : ' ', var->GetName(), - var->GetGenericRep(CVAR_String).String); + var->GetHumanString()); } } var = var->m_Next; diff --git a/src/c_cvars.h b/src/c_cvars.h index 9d000e3c0..59a3208d1 100644 --- a/src/c_cvars.h +++ b/src/c_cvars.h @@ -108,6 +108,7 @@ public: virtual ECVarType GetRealType () const = 0; + virtual const char *GetHumanString(int precision=-1) const; virtual UCVarValue GetGenericRep (ECVarType type) const = 0; virtual UCVarValue GetFavoriteRep (ECVarType *type) const = 0; @@ -268,6 +269,7 @@ public: virtual UCVarValue GetGenericRepDefault (ECVarType type) const; virtual UCVarValue GetFavoriteRepDefault (ECVarType *type) const; virtual void SetGenericRepDefault (UCVarValue value, ECVarType type); + const char *GetHumanString(int precision) const override; float operator= (float floatval) { UCVarValue val; val.Float = floatval; SetGenericRep (val, CVAR_Float); return floatval; } diff --git a/src/c_dispatch.cpp b/src/c_dispatch.cpp index bffdce15b..811052e1c 100644 --- a/src/c_dispatch.cpp +++ b/src/c_dispatch.cpp @@ -651,8 +651,7 @@ void C_DoCommand (const char *cmd, int keynum) } else { // Get the variable's value - UCVarValue val = var->GetGenericRep (CVAR_String); - Printf ("\"%s\" is \"%s\"\n", var->GetName(), val.String); + Printf ("\"%s\" is \"%s\"\n", var->GetName(), var->GetHumanString()); } } else diff --git a/src/d_netinfo.cpp b/src/d_netinfo.cpp index 7a366e2d4..0b99fd73d 100644 --- a/src/d_netinfo.cpp +++ b/src/d_netinfo.cpp @@ -993,8 +993,7 @@ CCMD (playerinfo) if (pair->Key != NAME_Name && pair->Key != NAME_Team && pair->Key != NAME_Skin && pair->Key != NAME_Gender && pair->Key != NAME_PlayerClass) { - UCVarValue val = pair->Value->GetGenericRep(CVAR_String); - Printf("%20s: %s\n", pair->Key.GetChars(), val.String); + Printf("%20s: %s\n", pair->Key.GetChars(), pair->Value->GetHumanString()); } } if (argv.argc() > 2) diff --git a/src/fragglescript/t_func.cpp b/src/fragglescript/t_func.cpp index 5d4320a4f..f8648808d 100644 --- a/src/fragglescript/t_func.cpp +++ b/src/fragglescript/t_func.cpp @@ -2185,7 +2185,7 @@ void FParser::SF_SetLineMonsterBlocking(void) { 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]); FLineIdIterator itr(tag); diff --git a/src/g_shared/a_decals.cpp b/src/g_shared/a_decals.cpp index cdf3c2b2e..c37c1065a 100644 --- a/src/g_shared/a_decals.cpp +++ b/src/g_shared/a_decals.cpp @@ -250,27 +250,27 @@ FTextureID DBaseDecal::StickToWall (side_t *wall, double x, double y, F3DFloor * { RenderFlags |= RF_RELMID; if (line->flags & ML_DONTPEGBOTTOM) - Z -= front->GetPlaneTexZF(sector_t::floor); + Z -= front->GetPlaneTexZ(sector_t::floor); else - Z -= front->GetPlaneTexZF(sector_t::ceiling); + Z -= front->GetPlaneTexZ(sector_t::ceiling); tex = wall->GetTexture(side_t::mid); } else if (back->floorplane.ZatPoint (x, y) >= Z) { RenderFlags |= RF_RELLOWER|RF_CLIPLOWER; if (line->flags & ML_DONTPEGBOTTOM) - Z -= front->GetPlaneTexZF(sector_t::ceiling); + Z -= front->GetPlaneTexZ(sector_t::ceiling); else - Z -= back->GetPlaneTexZF(sector_t::floor); + Z -= back->GetPlaneTexZ(sector_t::floor); tex = wall->GetTexture(side_t::bottom); } else if (back->ceilingplane.ZatPoint (x, y) <= Z) { RenderFlags |= RF_RELUPPER|RF_CLIPUPPER; if (line->flags & ML_DONTPEGTOP) - Z -= front->GetPlaneTexZF(sector_t::ceiling); + Z -= front->GetPlaneTexZ(sector_t::ceiling); else - Z -= back->GetPlaneTexZF(sector_t::ceiling); + Z -= back->GetPlaneTexZ(sector_t::ceiling); tex = wall->GetTexture(side_t::top); } 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; RenderFlags |= RF_RELMID|RF_CLIPMID; if (line->flags & ML_DONTPEGBOTTOM) - Z -= Sector->GetPlaneTexZF(sector_t::floor); + Z -= Sector->GetPlaneTexZ(sector_t::floor); else - Z -= Sector->GetPlaneTexZF(sector_t::ceiling); + Z -= Sector->GetPlaneTexZ(sector_t::ceiling); if (ffloor->flags & FF_UPPERTEXTURE) { @@ -335,29 +335,29 @@ double DBaseDecal::GetRealZ (const side_t *wall) const case RF_RELUPPER: if (line->flags & ML_DONTPEGTOP) { - return Z + front->GetPlaneTexZF(sector_t::ceiling); + return Z + front->GetPlaneTexZ(sector_t::ceiling); } else { - return Z + back->GetPlaneTexZF(sector_t::ceiling); + return Z + back->GetPlaneTexZ(sector_t::ceiling); } case RF_RELLOWER: if (line->flags & ML_DONTPEGBOTTOM) { - return Z + front->GetPlaneTexZF(sector_t::ceiling); + return Z + front->GetPlaneTexZ(sector_t::ceiling); } else { - return Z + back->GetPlaneTexZF(sector_t::floor); + return Z + back->GetPlaneTexZ(sector_t::floor); } case RF_RELMID: if (line->flags & ML_DONTPEGBOTTOM) { - return Z + front->GetPlaneTexZF(sector_t::floor); + return Z + front->GetPlaneTexZ(sector_t::floor); } else { - return Z + front->GetPlaneTexZF(sector_t::ceiling); + return Z + front->GetPlaneTexZ(sector_t::ceiling); } } } diff --git a/src/menu/optionmenuitems.h b/src/menu/optionmenuitems.h index f810f788b..8a1840027 100644 --- a/src/menu/optionmenuitems.h +++ b/src/menu/optionmenuitems.h @@ -295,10 +295,10 @@ public: } else { - UCVarValue cv = mCVar->GetGenericRep(CVAR_String); + const char *cv = mCVar->GetHumanString(); 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; break; @@ -995,7 +995,7 @@ public: if ( mCVar == NULL ) return ""; - return mCVar->GetGenericRep( CVAR_String ).String; + return mCVar->GetHumanString(); } virtual FString Represent() diff --git a/src/p_3dmidtex.cpp b/src/p_3dmidtex.cpp index 069a89e54..26e9cf58b 100644 --- a/src/p_3dmidtex.cpp +++ b/src/p_3dmidtex.cpp @@ -242,14 +242,14 @@ bool P_GetMidTexturePosition(const line_t *line, int sideno, double *ptextop, do if(line->flags & ML_DONTPEGBOTTOM) { *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; } else { *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; } diff --git a/src/p_buildmap.cpp b/src/p_buildmap.cpp index 428e5e367..7e65bf05d 100644 --- a/src/p_buildmap.cpp +++ b/src/p_buildmap.cpp @@ -593,11 +593,11 @@ static void LoadWalls (walltype *walls, int numwalls, sectortype *bsec) { if (walls[i].cstat & 512) { - lines[j].Alpha = TRANSLUC33; + lines[j].alpha = 1/3.; } else { - lines[j].Alpha = TRANSLUC66; + lines[j].alpha = 2/3.; } } if (walls[i].cstat & 1) diff --git a/src/p_effect.cpp b/src/p_effect.cpp index efa42d11a..25838459d 100644 --- a/src/p_effect.cpp +++ b/src/p_effect.cpp @@ -632,7 +632,7 @@ struct TrailSegment -void P_DrawRailTrail(AActor *source, TArray &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 &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; int steps, i; @@ -889,7 +889,11 @@ void P_DrawRailTrail(AActor *source, TArray &portalhits, int color1, } AActor *thing = Spawn (spawnclass, pos + diff, ALLOW_REPLACE); if (thing) + { + if (source) thing->target = source; + thing->Angles.Pitch = pitch; thing->Angles.Yaw = angle; + } pos += trail[segment].dir * stepsize; lencount -= stepsize; if (lencount <= 0) diff --git a/src/p_effect.h b/src/p_effect.h index 1e7750343..8ae272329 100644 --- a/src/p_effect.h +++ b/src/p_effect.h @@ -97,7 +97,7 @@ struct SPortalHit DVector3 OutDir; }; -void P_DrawRailTrail(AActor *source, TArray &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 &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_DrawSplash2 (int count, const DVector3 &pos, DAngle angle, int updown, int kind); void P_DisconnectEffect (AActor *actor); diff --git a/src/p_glnodes.cpp b/src/p_glnodes.cpp index bc96f14bd..739990692 100644 --- a/src/p_glnodes.cpp +++ b/src/p_glnodes.cpp @@ -263,7 +263,7 @@ static bool LoadGLVertexes(FileReader * lump) 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++; } delete[] gldata; diff --git a/src/p_linkedsectors.cpp b/src/p_linkedsectors.cpp index 583175def..37743455d 100644 --- a/src/p_linkedsectors.cpp +++ b/src/p_linkedsectors.cpp @@ -103,7 +103,7 @@ static bool MoveCeiling(sector_t *sector, int crush, double move) // Don't let the ceiling go below the floor if (!sector->ceilingplane.isSlope() && !sector->floorplane.isSlope() && !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; } @@ -118,7 +118,7 @@ static bool MoveFloor(sector_t *sector, int crush, double move) // Don't let the floor go above the ceiling if (!sector->ceilingplane.isSlope() && !sector->floorplane.isSlope() && !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; } diff --git a/src/p_lnspec.cpp b/src/p_lnspec.cpp index 8c9fe3c7e..8aeba4c8b 100644 --- a/src/p_lnspec.cpp +++ b/src/p_lnspec.cpp @@ -1057,10 +1057,25 @@ FUNC(LS_Teleport_NoFog) // Teleport_NoFog (tid, useang, sectortag, keepheight) { int flags = 0; - if (!arg1) + switch (arg1) { + case 0: 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) { flags |= TELF_KEEPHEIGHT; @@ -2976,7 +2991,7 @@ FUNC(LS_TranslucentLine) int linenum; 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) { lines[linenum].flags &= ~ML_ADDTRANS; diff --git a/src/p_map.cpp b/src/p_map.cpp index 72746f2fb..3d04c6889 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -4704,7 +4704,7 @@ void P_RailAttack(FRailParams *p) } // 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); } //========================================================================== diff --git a/src/p_saveg.cpp b/src/p_saveg.cpp index 26fba7e68..fdefa1987 100644 --- a/src/p_saveg.cpp +++ b/src/p_saveg.cpp @@ -399,7 +399,7 @@ void P_SerializeWorld (FArchive &arc) arc << li->flags << li->activation << li->special - << li->Alpha; + << li->alpha; if (P_IsACSSpecial(li->special)) { diff --git a/src/p_sectors.cpp b/src/p_sectors.cpp index 7db61dc67..9199f0812 100644 --- a/src/p_sectors.cpp +++ b/src/p_sectors.cpp @@ -73,7 +73,7 @@ double sector_t::FindLowestFloorSurrounding (vertex_t **v) const double ofloor; vertex_t *spot; - if (linecount == 0) return GetPlaneTexZF(sector_t::floor); + if (linecount == 0) return GetPlaneTexZ(sector_t::floor); spot = lines[0]->v1; floor = floorplane.ZatPoint(spot); @@ -117,7 +117,7 @@ double sector_t::FindHighestFloorSurrounding (vertex_t **v) const double ofloor; vertex_t *spot; - if (linecount == 0) return GetPlaneTexZF(sector_t::floor); + if (linecount == 0) return GetPlaneTexZ(sector_t::floor); spot = lines[0]->v1; floor = -FLT_MAX; @@ -168,7 +168,7 @@ double sector_t::FindNextHighestFloor (vertex_t **v) const line_t *check; int i; - if (linecount == 0) return GetPlaneTexZF(sector_t::floor); + if (linecount == 0) return GetPlaneTexZ(sector_t::floor); spot = lines[0]->v1; height = floorplane.ZatPoint(spot); @@ -223,7 +223,7 @@ double sector_t::FindNextLowestFloor (vertex_t **v) const line_t *check; int i; - if (linecount == 0) return GetPlaneTexZF(sector_t::floor); + if (linecount == 0) return GetPlaneTexZ(sector_t::floor); spot = lines[0]->v1; height = floorplane.ZatPoint (spot); @@ -278,7 +278,7 @@ double sector_t::FindNextLowestCeiling (vertex_t **v) const int i; - if (linecount == 0) return GetPlaneTexZF(sector_t::ceiling); + if (linecount == 0) return GetPlaneTexZ(sector_t::ceiling); spot = lines[0]->v1; height = ceilingplane.ZatPoint(spot); @@ -332,7 +332,7 @@ double sector_t::FindNextHighestCeiling (vertex_t **v) const line_t *check; int i; - if (linecount == 0) return GetPlaneTexZF(sector_t::ceiling); + if (linecount == 0) return GetPlaneTexZ(sector_t::ceiling); spot = lines[0]->v1; height = ceilingplane.ZatPoint(spot); @@ -378,7 +378,7 @@ double sector_t::FindLowestCeilingSurrounding (vertex_t **v) const line_t *check; int i; - if (linecount == 0) return GetPlaneTexZF(sector_t::ceiling); + if (linecount == 0) return GetPlaneTexZ(sector_t::ceiling); spot = lines[0]->v1; height = FLT_MAX; @@ -420,7 +420,7 @@ double sector_t::FindHighestCeilingSurrounding (vertex_t **v) const line_t *check; int i; - if (linecount == 0) return GetPlaneTexZF(sector_t::ceiling); + if (linecount == 0) return GetPlaneTexZ(sector_t::ceiling); spot = lines[0]->v1; height = -FLT_MAX; @@ -879,7 +879,7 @@ void sector_t::CheckPortalPlane(int plane) if (GetPortalType(plane) == PORTS_LINKEDPORTAL) { double portalh = GetPortalPlaneZ(plane); - double planeh = GetPlaneTexZF(plane); + double planeh = GetPlaneTexZ(plane); int obstructed = PLANEF_OBSTRUCTED * (plane == sector_t::floor ? planeh > portalh : planeh < portalh); planes[plane].Flags = (planes[plane].Flags & ~PLANEF_OBSTRUCTED) | obstructed; } diff --git a/src/p_setup.cpp b/src/p_setup.cpp index e1dff8762..ebd38ba9a 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -862,7 +862,7 @@ void P_LoadVertexes (MapData * map) SWORD 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 = §ors[0].e[i]; if (!map->HasBehavior) ss->Flags |= SECF_FLOORDROP; 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->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::ceiling, ms->ceilingpic, missingtex, true); ss->lightlevel = LittleShort(ms->lightlevel); @@ -2043,10 +2043,10 @@ void P_FinishLoadingLineDef(line_t *ld, int alpha) additive = true; } - alpha = Scale(alpha, OPAQUE, 255); + double dalpha = alpha / 255.; if (!ld->args[0]) { - ld->Alpha = alpha; + ld->alpha = dalpha; if (additive) { ld->flags |= ML_ADDTRANS; @@ -2058,7 +2058,7 @@ void P_FinishLoadingLineDef(line_t *ld, int alpha) { if (tagManager.LineHasID(j, ld->args[0])) { - lines[j].Alpha = alpha; + lines[j].alpha = dalpha; if (additive) { lines[j].flags |= ML_ADDTRANS; @@ -2160,7 +2160,7 @@ void P_LoadLineDefs (MapData * map) ld = lines; 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; // [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->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[1], LittleShort(mld->sidenum[1])); diff --git a/src/p_slopes.cpp b/src/p_slopes.cpp index 1ee992d5e..66b3d0747 100644 --- a/src/p_slopes.cpp +++ b/src/p_slopes.cpp @@ -209,7 +209,7 @@ void P_VavoomSlope(sector_t * sec, int id, const DVector3 &pos, int which) { DVector3 v1, v2, cross; 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[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); if (h1 == NULL && h2 == NULL && h3 == NULL) continue; - vt1.Z = h1? *h1 : j==0? sec->GetPlaneTexZF(sector_t::floor) : sec->GetPlaneTexZF(sector_t::ceiling); - vt2.Z = h2? *h2 : j==0? sec->GetPlaneTexZF(sector_t::floor) : sec->GetPlaneTexZF(sector_t::ceiling); - vt3.Z = h3? *h3 : 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->GetPlaneTexZ(sector_t::floor) : sec->GetPlaneTexZ(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) { @@ -488,8 +488,8 @@ static void P_AlignPlane(sector_t *sec, line_t *line, int which) double srcheight, destheight; srcplane = (which == 0) ? &sec->floorplane : &sec->ceilingplane; - srcheight = (which == 0) ? sec->GetPlaneTexZF(sector_t::floor) : sec->GetPlaneTexZF(sector_t::ceiling); - destheight = (which == 0) ? refsec->GetPlaneTexZF(sector_t::floor) : refsec->GetPlaneTexZF(sector_t::ceiling); + srcheight = (which == 0) ? sec->GetPlaneTexZ(sector_t::floor) : sec->GetPlaneTexZ(sector_t::ceiling); + destheight = (which == 0) ? refsec->GetPlaneTexZ(sector_t::floor) : refsec->GetPlaneTexZ(sector_t::ceiling); p[0] = line->v1->fX(); p[1] = line->v1->fY(); diff --git a/src/p_spec.cpp b/src/p_spec.cpp index 7eaf72210..93d002599 100644 --- a/src/p_spec.cpp +++ b/src/p_spec.cpp @@ -841,7 +841,7 @@ static void SetupFloorPortal (AStackPoint *point) if (skyv != NULL) { 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->Portals[sector_t::floor] = P_GetStackPortal(skyv, sector_t::floor); @@ -856,7 +856,7 @@ static void SetupCeilingPortal (AStackPoint *point) if (skyv != NULL) { 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->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) { 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); 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; } - if (sector->GetAlphaF(sector_t::floor) == 1.) + if (sector->GetAlpha(sector_t::floor) == 1.) sector->SetAlpha(sector_t::floor, alpha); if (sectorPortals[pnum].mFlags & PORTSF_SKYFLATONLY) diff --git a/src/p_spec.h b/src/p_spec.h index 0899c6268..7bd04f48c 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -666,6 +666,8 @@ enum TELF_KEEPORIENTATION = 4, TELF_KEEPVELOCITY = 8, 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). diff --git a/src/p_teleport.cpp b/src/p_teleport.cpp index 40ae4efed..a3dbd0899 100644 --- a/src/p_teleport.cpp +++ b/src/p_teleport.cpp @@ -349,13 +349,14 @@ bool EV_Teleport (int tid, int tag, line_t *line, int side, AActor *thing, int f return false; } // [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. // Rotate 90 degrees, so that walking perpendicularly across // teleporter linedef causes thing to exit in the direction // indicated by the exit thing. angle = line->Delta().Angle() - searcher->Angles.Yaw + 90.; + if (flags & TELF_ROTATEBOOMINVERSE) angle = -angle; // Sine, cosine of angle adjustment 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)) { // [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 - thing->Angles.Yaw += angle; + if (flags & (TELF_ROTATEBOOM| TELF_ROTATEBOOMINVERSE)) + { + // 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 - thing->Vel.X = vx*c - vy*s; - thing->Vel.Y = vy*c + vx*s; + // Rotate thing's velocity to come out of exit just like it entered + thing->Vel.X = vx*c - vy*s; + thing->Vel.Y = vy*c + vx*s; + } } if (vx == 0 && vy == 0 && thing->player != NULL && thing->player->mo == thing && !predicting) { diff --git a/src/p_udmf.cpp b/src/p_udmf.cpp index 20852a585..86116f881 100644 --- a/src/p_udmf.cpp +++ b/src/p_udmf.cpp @@ -785,7 +785,7 @@ public: FString tagstring; memset(ld, 0, sizeof(*ld)); - ld->Alpha = OPAQUE; + ld->alpha = 1.; ld->portalindex = UINT_MAX; ld->sidedef[0] = ld->sidedef[1] = NULL; if (level.flags2 & LEVEL2_CLIPMIDTEX) ld->flags |= ML_CLIP_MIDTEX; @@ -1087,13 +1087,13 @@ public: { 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) { @@ -1596,7 +1596,7 @@ public: // Reset the planes to their defaults if not all of the plane equation's parameters were found. 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 { @@ -1606,7 +1606,7 @@ public: } 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 { diff --git a/src/p_writemap.cpp b/src/p_writemap.cpp index 20848712a..e26e3cf53 100644 --- a/src/p_writemap.cpp +++ b/src/p_writemap.cpp @@ -196,8 +196,8 @@ static int WriteSECTORS (FILE *file) for (int i = 0; i < numsectors; ++i) { - ms.floorheight = LittleShort(short(sectors[i].GetPlaneTexZF(sector_t::floor))); - ms.ceilingheight = LittleShort(short(sectors[i].GetPlaneTexZF(sector_t::ceiling))); + ms.floorheight = LittleShort(short(sectors[i].GetPlaneTexZ(sector_t::floor))); + ms.ceilingheight = LittleShort(short(sectors[i].GetPlaneTexZ(sector_t::ceiling))); uppercopy (ms.floorpic, GetTextureName (sectors[i].GetTexture(sector_t::floor))); uppercopy (ms.ceilingpic, GetTextureName (sectors[i].GetTexture(sector_t::ceiling))); ms.lightlevel = LittleShort((short)sectors[i].lightlevel); diff --git a/src/p_xlat.cpp b/src/p_xlat.cpp index 2e30925bb..424b93a52 100644 --- a/src/p_xlat.cpp +++ b/src/p_xlat.cpp @@ -87,10 +87,10 @@ void P_TranslateLineDef (line_t *ld, maplinedef_t *mld, int lineindexforid) passthrough = true; break; case -2: - ld->Alpha = TRANSLUC75; + ld->alpha = 0.75; break; case -3: - ld->Alpha = TRANSLUC25; + ld->alpha = 0.25; break; default: newflags |= LineFlagTranslations[i].newvalue; diff --git a/src/portal.cpp b/src/portal.cpp index 6abd4e8da..964f742c7 100644 --- a/src/portal.cpp +++ b/src/portal.cpp @@ -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].mDestination = to; 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; } diff --git a/src/r_data/r_interpolate.cpp b/src/r_data/r_interpolate.cpp index 4ae29fc1d..8a88abed2 100644 --- a/src/r_data/r_interpolate.cpp +++ b/src/r_data/r_interpolate.cpp @@ -441,12 +441,12 @@ void DSectorPlaneInterpolation::UpdateInterpolation() if (!ceiling) { oldheight = sector->floorplane.fD(); - oldtexz = sector->GetPlaneTexZF(sector_t::floor); + oldtexz = sector->GetPlaneTexZ(sector_t::floor); } else { 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(); - baktexz = sector->GetPlaneTexZF(pos); + baktexz = sector->GetPlaneTexZ(pos); if (refcount == 0 && oldheight == bakheight) { diff --git a/src/r_defs.h b/src/r_defs.h index 32d9952a7..52654b45f 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -689,9 +689,9 @@ public: FTransform xform; int Flags; int Light; - fixed_t alpha; + double alpha; FTextureID Texture; - fixed_t TexZ; + double TexZ; }; @@ -779,19 +779,14 @@ public: 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; } - double GetAlphaF(int pos) const - { - return FIXED2DBL(planes[pos].alpha); - } - int GetFlags(int pos) const { return planes[pos].Flags; @@ -831,25 +826,20 @@ public: if (floorclip && pos == floor && tex != old) AdjustFloorClip(); } - fixed_t GetPlaneTexZ(int pos) const + double GetPlaneTexZ(int pos) const { 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. { - planes[pos].TexZ = FLOAT2FIXED(val); + planes[pos].TexZ = val; if (dirtify) SetAllVerticesDirty(); } void ChangePlaneTexZ(int pos, double val) { - planes[pos].TexZ += FLOAT2FIXED(val); + planes[pos].TexZ += val; } static inline short ClampLight(int level) @@ -1302,8 +1292,8 @@ public: DWORD flags; DWORD activation; // activation type int special; - fixed_t Alpha; // <--- translucency (0=invisibile, FRACUNIT=opaque) int args[5]; // <--- hexen-style arguments (expanded to ZDoom's full width) + double alpha; // <--- translucency (0=invisibile, FRACUNIT=opaque) side_t *sidedef[2]; double bbox[4]; // bounding box, for the extent of the LineDef. sector_t *frontsector, *backsector; @@ -1324,7 +1314,7 @@ public: void setAlpha(double a) { - Alpha = FLOAT2FIXED(a); + alpha = a; } FSectorPortal *GetTransferredPortal() diff --git a/src/r_main.cpp b/src/r_main.cpp index 62360f647..b87119b88 100644 --- a/src/r_main.cpp +++ b/src/r_main.cpp @@ -726,11 +726,9 @@ void R_EnterPortal (PortalDrawseg* pds, int depth) } else { - DVector3 view(ViewPos); - DAngle va = ViewAngle; - P_TranslatePortalXY(pds->src, view.X, view.Y); - P_TranslatePortalZ(pds->src, view.Z); - P_TranslatePortalAngle(pds->src, va); + P_TranslatePortalXY(pds->src, ViewPos.X, ViewPos.Y); + P_TranslatePortalZ(pds->src, ViewPos.Z); + P_TranslatePortalAngle(pds->src, ViewAngle); P_TranslatePortalXY(pds->src, ViewPath[0].X, ViewPath[0].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(); if (distp > EQUAL_EPSILON) { - double dist1 = (view - ViewPath[0]).Length(); - double dist2 = (view - ViewPath[1]).Length(); + double dist1 = (ViewPos - ViewPath[0]).Length(); + double dist2 = (ViewPos - ViewPath[1]).Length(); if (dist1 + dist2 < distp + 1) { @@ -748,8 +746,6 @@ void R_EnterPortal (PortalDrawseg* pds, int depth) } } } - ViewPos = view; - ViewAngle = va; } ViewSin = ViewAngle.Sin(); diff --git a/src/r_plane.cpp b/src/r_plane.cpp index b24148f3f..790bb9309 100644 --- a/src/r_plane.cpp +++ b/src/r_plane.cpp @@ -581,7 +581,7 @@ static visplane_t *new_visplane (unsigned hash) // 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, 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 xscale = FLOAT2FIXED(xform.xScale); fixed_t yscale = FLOAT2FIXED(xform.yScale); + fixed_t alpha = FLOAT2FIXED(Alpha); angle_t angle = (xform.Angle + xform.baseAngle).BAMs(); if (picnum == skyflatnum) // killough 10/98 diff --git a/src/r_plane.h b/src/r_plane.h index 4e14d79c8..25e46de98 100644 --- a/src/r_plane.h +++ b/src/r_plane.h @@ -98,7 +98,7 @@ visplane_t *R_FindPlane ( const secplane_t &height, FTextureID picnum, int lightlevel, - fixed_t alpha, + double alpha, bool additive, const FTransform &xform, int sky, diff --git a/src/r_segs.cpp b/src/r_segs.cpp index eadf66db2..696e30b7c 100644 --- a/src/r_segs.cpp +++ b/src/r_segs.cpp @@ -243,7 +243,7 @@ void R_RenderMaskedSegRange (drawseg_t *ds, int x1, int x2) ESPSResult drawmode; drawmode = R_SetPatchStyle (LegacyRenderStyles[curline->linedef->flags & ML_ADDTRANS ? STYLE_Add : STYLE_Translucent], - MIN(curline->linedef->Alpha, OPAQUE), 0, 0); + (float)MIN(curline->linedef->alpha, 1.), 0, 0); 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) { - 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 { - 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); @@ -603,7 +603,7 @@ void R_RenderFakeWall(drawseg_t *ds, int x1, int x2, F3DFloor *rover) 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 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)); if (rowoffset < 0) { @@ -2035,11 +2035,11 @@ void R_NewWall (bool needlights) { // normal orientation if (linedef->flags & ML_DONTPEGBOTTOM) { // 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 { // 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) { rowoffset += midtexture->GetHeight(); @@ -2051,7 +2051,7 @@ void R_NewWall (bool needlights) rowoffset = -rowoffset; if (linedef->flags & ML_DONTPEGBOTTOM) { // 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 { // bottom of texture at top @@ -2074,7 +2074,7 @@ void R_NewWall (bool needlights) { // two-sided line // 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 && 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 // 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) || @@ -2179,7 +2179,7 @@ void R_NewWall (bool needlights) { // normal orientation if (linedef->flags & ML_DONTPEGTOP) { // 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) { rowoffset += toptexture->GetHeight(); @@ -2187,7 +2187,7 @@ void R_NewWall (bool needlights) } else { // 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 @@ -2195,11 +2195,11 @@ void R_NewWall (bool needlights) rowoffset = -rowoffset; if (linedef->flags & ML_DONTPEGTOP) { // 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 { // 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) @@ -2228,7 +2228,7 @@ void R_NewWall (bool needlights) } else { // 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) { rowoffset += bottomtexture->GetHeight(); @@ -3047,31 +3047,31 @@ static void R_RenderDecal (side_t *wall, DBaseDecal *decal, drawseg_t *clipper, case RF_RELUPPER: if (curline->linedef->flags & ML_DONTPEGTOP) { - zpos = decal->Z + front->GetPlaneTexZF(sector_t::ceiling); + zpos = decal->Z + front->GetPlaneTexZ(sector_t::ceiling); } else { - zpos = decal->Z + back->GetPlaneTexZF(sector_t::ceiling); + zpos = decal->Z + back->GetPlaneTexZ(sector_t::ceiling); } break; case RF_RELLOWER: if (curline->linedef->flags & ML_DONTPEGBOTTOM) { - zpos = decal->Z + front->GetPlaneTexZF(sector_t::ceiling); + zpos = decal->Z + front->GetPlaneTexZ(sector_t::ceiling); } else { - zpos = decal->Z + back->GetPlaneTexZF(sector_t::floor); + zpos = decal->Z + back->GetPlaneTexZ(sector_t::floor); } break; case RF_RELMID: if (curline->linedef->flags & ML_DONTPEGBOTTOM) { - zpos = decal->Z + front->GetPlaneTexZF(sector_t::floor); + zpos = decal->Z + front->GetPlaneTexZ(sector_t::floor); } else { - zpos = decal->Z + front->GetPlaneTexZF(sector_t::ceiling); + zpos = decal->Z + front->GetPlaneTexZ(sector_t::ceiling); } } diff --git a/src/r_things.cpp b/src/r_things.cpp index ed77170fd..b930a1e92 100644 --- a/src/r_things.cpp +++ b/src/r_things.cpp @@ -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. - 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, minslabz, maxslabz, flags); @@ -1033,8 +1033,8 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor vis->angle -= ang.BAMs(); } - vis->vpos = { (float)ViewPos.X, (float)ViewPos.Y, (float)ViewPos.Z }; - vis->vang = FAngle((float)ViewAngle.Degrees); + vis->pa.vpos = { (float)ViewPos.X, (float)ViewPos.Y, (float)ViewPos.Z }; + vis->pa.vang = FAngle((float)ViewAngle.Degrees); } // 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; FTexture* tex; vissprite_t* vis; - static vissprite_t avis[NUMPSPRITES]; - vissprite_t tempvis; + static vissprite_t avis[NUMPSPRITES + 1]; + static vissprite_t *avisp[countof(avis)]; bool noaccel; 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 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; // store information in a vissprite - vis = &tempvis; + vis = avisp[NUMPSPRITES]; vis->renderflags = owner->renderflags; vis->floorclip = 0; @@ -1499,8 +1507,8 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, double sx, double { VisPSpritesX1[pspnum] = x1; VisPSpritesBaseColormap[pspnum] = colormap_to_use; - VisPSprites[pspnum] = &avis[pspnum]; - avis[pspnum] = *vis; + VisPSprites[pspnum] = vis; + swapvalues(avisp[pspnum], avisp[NUMPSPRITES]); return; } } diff --git a/src/r_things.h b/src/r_things.h index 64dcb82b8..97010713a 100644 --- a/src/r_things.h +++ b/src/r_things.h @@ -31,6 +31,12 @@ struct vissprite_t { + struct posang + { + FVector3 vpos; // view origin + FAngle vang; // view angle + }; + short x1, x2; FVector3 gpos; // origin in world coordinates union @@ -61,16 +67,9 @@ struct vissprite_t fixed_t xiscale; // negative if flipped }; // Used by wall sprites - struct - { - FWallCoords wallc; - }; + FWallCoords wallc; // Used by voxels - struct - { - FVector3 vpos; // view origin - FAngle vang; // view angle - }; + posang pa; }; sector_t *heightsec; // killough 3/27/98: height sector for underwater/fake ceiling 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. vissprite_t() {} - vissprite_t &vissprite_t::operator= (const vissprite_t &o) { memcpy(this, &o, sizeof *this); return *this; } }; struct particle_t; diff --git a/src/thingdef/thingdef_expression.cpp b/src/thingdef/thingdef_expression.cpp index 8ca02b422..c888f97d5 100644 --- a/src/thingdef/thingdef_expression.cpp +++ b/src/thingdef/thingdef_expression.cpp @@ -3137,7 +3137,7 @@ ExpEmit FxArrayElement::Emit(VMFunctionBuilder *build) { 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); if (shiftbits > 0) { diff --git a/src/v_draw.cpp b/src/v_draw.cpp index dccbfdc93..c7b62b0a6 100644 --- a/src/v_draw.cpp +++ b/src/v_draw.cpp @@ -204,8 +204,7 @@ void DCanvas::DrawTextureParms(FTexture *img, DrawParms &parms) // There is not enough precision in the drawing routines to keep the full // precision for y0. :( - double dummy; - sprtopscreen = modf(y0, &dummy); + modf(y0, &sprtopscreen); double yscale = parms.destheight / img->GetHeight(); double iyscale = 1 / yscale; diff --git a/src/vectors.h b/src/vectors.h index 91cf1e962..8b81d05b2 100644 --- a/src/vectors.h +++ b/src/vectors.h @@ -781,16 +781,13 @@ Outside comments: A faster version with only 10 (not 24) multiplies. } }; +#define BAM_FACTOR (90. / 0x40000000) + template struct TAngle { 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. TAngle(int) = delete; TAngle(unsigned int) = delete; diff --git a/src/version.h b/src/version.h index c45613b3f..fba8d0786 100644 --- a/src/version.h +++ b/src/version.h @@ -72,11 +72,11 @@ const char *GetVersionString(); // SAVESIG should match SAVEVER. // 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 // SVN revision ever got. -#define SAVEVER 4542 +#define SAVEVER 4543 #define SAVEVERSTRINGIFY2(x) #x #define SAVEVERSTRINGIFY(x) SAVEVERSTRINGIFY2(x) diff --git a/wadsrc/static/menudef.txt b/wadsrc/static/menudef.txt index cf01173e6..0820b4d69 100644 --- a/wadsrc/static/menudef.txt +++ b/wadsrc/static/menudef.txt @@ -1527,9 +1527,9 @@ OptionValue MidiDevices OptionMenu SoundOptions { Title "$SNDMNU_TITLE" - Slider "$SNDMNU_SFXVOLUME", "snd_sfxvolume", 0, 1, 0.05 - Slider "$SNDMNU_MENUVOLUME", "snd_menuvolume", 0, 1, 0.05 - Slider "$SNDMNU_MUSICVOLUME", "snd_musicvolume", 0, 1, 0.05 + Slider "$SNDMNU_SFXVOLUME", "snd_sfxvolume", 0, 1, 0.05, 2 + Slider "$SNDMNU_MENUVOLUME", "snd_menuvolume", 0, 1, 0.05, 2 + Slider "$SNDMNU_MUSICVOLUME", "snd_musicvolume", 0, 1, 0.05, 2 Option "$SNDMNU_MIDIDEVICE", "snd_mididevice", "MidiDevices" StaticText " " Option "$SNDMNU_UNDERWATERREVERB", "snd_waterreverb", "OnOff" diff --git a/wadsrc/static/xlat/base.txt b/wadsrc/static/xlat/base.txt index d125c4903..8a99ba318 100644 --- a/wadsrc/static/xlat/base.txt +++ b/wadsrc/static/xlat/base.txt @@ -209,10 +209,10 @@ include "xlat/defines.i" 204 = USE, Ceiling_LowerToHighestFloor (tag, C_SLOW) 205 = USE|REP, Ceiling_LowerToLowest (tag, C_SLOW) 206 = USE|REP, Ceiling_LowerToHighestFloor (tag, C_SLOW) -207 = WALK|MONST, Teleport_NoFog (0, 0, tag, 1) -208 = WALK|REP|MONST, Teleport_NoFog (0, 0, tag, 1) -209 = USE|MONST, Teleport_NoFog (0, 0, tag, 1) -210 = USE|REP|MONST, Teleport_NoFog (0, 0, tag, 1) +207 = WALK|MONST, Teleport_NoFog (0, 2, tag, 1) +208 = WALK|REP|MONST, Teleport_NoFog (0, 2, tag, 1) +209 = USE|MONST, Teleport_NoFog (0, 2, tag, 1) +210 = USE|REP|MONST, Teleport_NoFog (0, 2, tag, 1) 211 = USE|REP, Plat_ToggleCeiling (tag) 212 = WALK|REP, Plat_ToggleCeiling (tag) 213 = 0, Transfer_FloorLight (tag) @@ -270,8 +270,8 @@ include "xlat/defines.i" 265 = MONWALK|REP, Teleport_Line (tag, tag, 1) 266 = MONWALK, Teleport_Line (tag, tag, 0) 267 = MONWALK|REP, Teleport_Line (tag, tag, 0) -268 = MONWALK, Teleport_NoFog (0, 0, tag, 1) -269 = MONWALK|REP, Teleport_NoFog (0, 0, tag, 1) +268 = MONWALK, Teleport_NoFog (0, 2, tag, 1) +269 = MONWALK|REP, Teleport_NoFog (0, 2, tag, 1) /****** MBF linetypes ******/