- fixed a few oversights.

- switched p_buildmap to use the floating point variants of the linedef/sector init methods.
This commit is contained in:
Christoph Oelckers 2016-03-30 11:25:02 +02:00
parent c2e2910399
commit ced30e7bbb
7 changed files with 77 additions and 89 deletions

View file

@ -878,33 +878,6 @@ void D_ReadUserInfoStrings (int pnum, BYTE **stream, bool update)
*stream += strlen (*((char **)stream)) + 1;
}
void ReadCompatibleUserInfo(FArchive &arc, userinfo_t &info)
{
char netname[MAXPLAYERNAME + 1];
BYTE team;
int aimdist, color, colorset, skin, gender;
bool neverswitch;
//fxed_t movebob, stillbob; These were never serialized!
//int playerclass; "
info.Reset();
arc.Read(&netname, sizeof(netname));
arc << team << aimdist << color << skin << gender << neverswitch << colorset;
*static_cast<FStringCVar *>(info[NAME_Name]) = netname;
*static_cast<FIntCVar *>(info[NAME_Team]) = team;
*static_cast<FFloatCVar *>(info[NAME_Autoaim]) = ANGLE2FLOAT(aimdist);
*static_cast<FIntCVar *>(info[NAME_Skin]) = skin;
*static_cast<FIntCVar *>(info[NAME_Gender]) = gender;
*static_cast<FBoolCVar *>(info[NAME_NeverSwitchOnPickup]) = neverswitch;
*static_cast<FIntCVar *>(info[NAME_ColorSet]) = colorset;
UCVarValue val;
val.Int = color;
static_cast<FColorCVar *>(info[NAME_Color])->SetGenericRep(val, CVAR_Int);
}
void WriteUserInfo(FArchive &arc, userinfo_t &info)
{
TMapIterator<FName, FBaseCVar *> it(info);
@ -945,12 +918,6 @@ void ReadUserInfo(FArchive &arc, userinfo_t &info, FString &skin)
char *str = NULL;
UCVarValue val;
if (SaveVersion < 4253)
{
ReadCompatibleUserInfo(arc, info);
return;
}
info.Reset();
skin = NULL;
for (arc << name; name != NAME_None; arc << name)

View file

@ -37,23 +37,6 @@ protected:
void Serialize (FArchive &arc);
void Destroy();
void StopInterpolation(bool force = false);
inline EResult MoveFloor(fixed_t speed, fixed_t dest, int crush, int direction, bool hexencrush)
{
return MovePlane(FIXED2DBL(speed), FIXED2DBL(dest), crush, 0, direction, hexencrush);
}
inline EResult MoveFloor(fixed_t speed, fixed_t dest, int direction)
{
return MovePlane(FIXED2DBL(speed), FIXED2DBL(dest), -1, 0, direction, false);
}
inline EResult MoveCeiling(fixed_t speed, fixed_t dest, int crush, int direction, bool hexencrush)
{
return MovePlane(FIXED2DBL(speed), FIXED2DBL(dest), crush, 1, direction, hexencrush);
}
inline EResult MoveCeiling(fixed_t speed, fixed_t dest, int direction)
{
return MovePlane(FIXED2DBL(speed), FIXED2DBL(dest), -1, 1, direction, false);
}
inline EResult MoveFloor (double speed, double dest, int crush, int direction, bool hexencrush)
{
return MovePlane (speed, dest, crush, 0, direction, hexencrush);

View file

@ -4620,7 +4620,7 @@ static void SetUserVariable(AActor *self, FName varname, int index, int value)
}
else
{
type->SetValue(addr, FIXED2DBL(value));
type->SetValue(addr, ACSToDouble(value));
}
}
}
@ -4634,7 +4634,7 @@ static int GetUserVariable(AActor *self, FName varname, int index)
{
if (type->IsKindOf(RUNTIME_CLASS(PFloat)))
{
return FLOAT2FIXED(type->GetValueFloat(addr));
return DoubleToACS(type->GetValueFloat(addr));
}
else if (type->IsA(RUNTIME_CLASS(PName)))
{

View file

@ -402,19 +402,21 @@ static void LoadSectors (sectortype *bsec)
bsec->floorstat = WORD(bsec->floorstat);
sec->e = &sectors[0].e[i];
sec->SetPlaneTexZ(sector_t::floor, -(LittleLong(bsec->floorZ) << 8));
sec->floorplane.set(0, 0, -FRACUNIT, -sec->GetPlaneTexZ(sector_t::floor));
double floorheight = -LittleLong(bsec->floorZ) / 256.;
sec->SetPlaneTexZ(sector_t::floor, floorheight);
sec->floorplane.SetAtHeight(floorheight, sector_t::floor);
mysnprintf (tnam, countof(tnam), "BTIL%04d", LittleShort(bsec->floorpicnum));
sec->SetTexture(sector_t::floor, TexMan.GetTexture (tnam, FTexture::TEX_Build));
sec->SetXScale(sector_t::floor, (bsec->floorstat & 8) ? FRACUNIT*2 : FRACUNIT);
sec->SetYScale(sector_t::floor, (bsec->floorstat & 8) ? FRACUNIT*2 : FRACUNIT);
sec->SetXOffset(sector_t::floor, (bsec->floorxpanning << FRACBITS) + (32 << FRACBITS));
sec->SetYOffset(sector_t::floor, bsec->floorypanning << FRACBITS);
sec->SetXScale(sector_t::floor, (bsec->floorstat & 8) ? 2. : 1.);
sec->SetYScale(sector_t::floor, (bsec->floorstat & 8) ? 2. : 1.);
sec->SetXOffset(sector_t::floor, bsec->floorxpanning + 32.);
sec->SetYOffset(sector_t::floor, bsec->floorypanning + 0.);
sec->SetPlaneLight(sector_t::floor, SHADE2LIGHT (bsec->floorshade));
sec->ChangeFlags(sector_t::floor, 0, PLANEF_ABSLIGHTING);
sec->SetPlaneTexZ(sector_t::ceiling, -(LittleLong(bsec->ceilingZ) << 8));
sec->ceilingplane.set(0, 0, -FRACUNIT, sec->GetPlaneTexZ(sector_t::ceiling));
double ceilingheight = -LittleLong(bsec->ceilingZ) / 256.;
sec->SetPlaneTexZ(sector_t::ceiling, ceilingheight);
sec->ceilingplane.SetAtHeight(ceilingheight, sector_t::ceiling);
mysnprintf (tnam, countof(tnam), "BTIL%04d", LittleShort(bsec->ceilingpicnum));
sec->SetTexture(sector_t::ceiling, TexMan.GetTexture (tnam, FTexture::TEX_Build));
if (bsec->ceilingstat & 1)
@ -422,10 +424,10 @@ static void LoadSectors (sectortype *bsec)
sky1texture = sky2texture = sec->GetTexture(sector_t::ceiling);
sec->SetTexture(sector_t::ceiling, skyflatnum);
}
sec->SetXScale(sector_t::ceiling, (bsec->ceilingstat & 8) ? FRACUNIT*2 : FRACUNIT);
sec->SetYScale(sector_t::ceiling, (bsec->ceilingstat & 8) ? FRACUNIT*2 : FRACUNIT);
sec->SetXOffset(sector_t::ceiling, (bsec->ceilingxpanning << FRACBITS) + (32 << FRACBITS));
sec->SetYOffset(sector_t::ceiling, bsec->ceilingypanning << FRACBITS);
sec->SetXScale(sector_t::ceiling, (bsec->ceilingstat & 8) ? 2. : 1.);
sec->SetYScale(sector_t::ceiling, (bsec->ceilingstat & 8) ? 2. : 1.);
sec->SetXOffset(sector_t::ceiling, bsec->ceilingxpanning + 32.);
sec->SetYOffset(sector_t::ceiling, bsec->ceilingypanning + 0.);
sec->SetPlaneLight(sector_t::ceiling, SHADE2LIGHT (bsec->ceilingshade));
sec->ChangeFlags(sector_t::ceiling, 0, PLANEF_ABSLIGHTING);
@ -444,30 +446,30 @@ static void LoadSectors (sectortype *bsec)
if (bsec->floorstat & 4)
{
sec->SetAngle(sector_t::floor, ANGLE_90);
sec->SetXScale(sector_t::floor, -sec->GetXScale(sector_t::floor));
sec->SetAngle(sector_t::floor, DAngle(90.));
sec->SetXScale(sector_t::floor, -sec->GetXScaleF(sector_t::floor));
}
if (bsec->floorstat & 16)
{
sec->SetXScale(sector_t::floor, -sec->GetXScale(sector_t::floor));
sec->SetXScale(sector_t::floor, -sec->GetXScaleF(sector_t::floor));
}
if (bsec->floorstat & 32)
{
sec->SetYScale(sector_t::floor, -sec->GetYScale(sector_t::floor));
sec->SetYScale(sector_t::floor, -sec->GetYScaleF(sector_t::floor));
}
if (bsec->ceilingstat & 4)
{
sec->SetAngle(sector_t::ceiling, ANGLE_90);
sec->SetYScale(sector_t::ceiling, -sec->GetYScale(sector_t::ceiling));
sec->SetAngle(sector_t::ceiling, DAngle(90.));
sec->SetYScale(sector_t::ceiling, -sec->GetYScaleF(sector_t::ceiling));
}
if (bsec->ceilingstat & 16)
{
sec->SetXScale(sector_t::ceiling, -sec->GetXScale(sector_t::ceiling));
sec->SetXScale(sector_t::ceiling, -sec->GetXScaleF(sector_t::ceiling));
}
if (bsec->ceilingstat & 32)
{
sec->SetYScale(sector_t::ceiling, -sec->GetYScale(sector_t::ceiling));
sec->SetYScale(sector_t::ceiling, -sec->GetYScaleF(sector_t::ceiling));
}
}
}
@ -523,8 +525,8 @@ static void LoadWalls (walltype *walls, int numwalls, sectortype *bsec)
walls[i].nextwall = LittleShort(walls[i].nextwall);
walls[i].nextsector = LittleShort(walls[i].nextsector);
sides[i].SetTextureXOffset(walls[i].xpanning << FRACBITS);
sides[i].SetTextureYOffset(walls[i].ypanning << FRACBITS);
sides[i].SetTextureXOffset((double)walls[i].xpanning);
sides[i].SetTextureYOffset((double)walls[i].ypanning);
sides[i].SetTexture(side_t::top, pic);
sides[i].SetTexture(side_t::bottom, pic);
@ -542,8 +544,8 @@ static void LoadWalls (walltype *walls, int numwalls, sectortype *bsec)
}
sides[i].TexelLength = walls[i].xrepeat * 8;
sides[i].SetTextureYScale(walls[i].yrepeat << (FRACBITS - 3));
sides[i].SetTextureXScale(FRACUNIT);
sides[i].SetTextureYScale(walls[i].yrepeat / 8.);
sides[i].SetTextureXScale(1.);
sides[i].SetLight(SHADE2LIGHT(walls[i].shade));
sides[i].Flags = WALLF_ABSLIGHTING;
sides[i].RightSide = walls[i].point2;
@ -751,16 +753,16 @@ static int LoadSprites (spritetype *sprites, Xsprite *xsprites, int numsprites,
//
//==========================================================================
vertex_t *FindVertex (SDWORD x, SDWORD y)
vertex_t *FindVertex (SDWORD xx, SDWORD yy)
{
int i;
x <<= 12;
y = -(y << 12);
double x = xx / 64.;
double y = -yy / 64.;
for (i = 0; i < numvertexes; ++i)
{
if (vertexes[i].fixX() == x && vertexes[i].fixY() == y)
if (vertexes[i].fX() == x && vertexes[i].fY() == y)
{
return &vertexes[i];
}
@ -814,8 +816,7 @@ static void CalcPlane (SlopeWork &slope, secplane_t &plane)
slope.x[2] = slope.x[0];
slope.y[2] = slope.y[0] + 64;
}
j = DMulScale3 (slope.dx, slope.y[2]-slope.wal->y,
-slope.dy, slope.x[2]-slope.wal->x);
j = DMulScale3 (slope.dx, slope.y[2]-slope.wal->y, -slope.dy, slope.x[2]-slope.wal->x);
slope.z[2] += Scale (slope.heinum, j, slope.i);
pt[0] = DVector3(slope.dx, -slope.dy, 0);
@ -827,9 +828,8 @@ static void CalcPlane (SlopeWork &slope, secplane_t &plane)
pt[2] = -pt[2];
}
plane.set(pt[2][0], pt[2][1], pt[2][2], 0.);
plane.setD(-TMulScale8
(plane.fixA(), slope.x[0]<<4, plane.fixB(), (-slope.y[0])<<4, plane.fixC(), slope.z[0]));
double dist = -pt[2][0] * slope.x[0] * 16 + pt[2][1] * slope.y[0] * 16 - pt[2][2] * slope.z[0];
plane.set(pt[2][0], pt[2][1], pt[2][2], dist);
}
//==========================================================================

View file

@ -435,7 +435,7 @@ bool EV_DoFloor (DFloor::EFloor floortype, line_t *line, int tag,
case DFloor::floorRaiseAndChange:
floor->m_Direction = 1;
newheight = sec->_f_CenterFloor() + height;
newheight = sec->CenterFloor() + height;
floor->m_FloorDestDist = sec->floorplane.PointToDist (sec->centerspot, newheight);
if (line != NULL)
{

View file

@ -2122,12 +2122,12 @@ bool P_TryMove(AActor *thing, const DVector2 &pos,
// it slopes or the player's eyes are bobbing in and out.
bool oldAboveFakeFloor, oldAboveFakeCeiling;
double _viewheight = thing->player ? thing->player->viewheight : thing->Height / 2;
double viewheight = thing->player ? thing->player->viewheight : thing->Height / 2;
oldAboveFakeFloor = oldAboveFakeCeiling = false; // pacify GCC
if (oldsec->heightsec)
{
double eyez = oldz + FIXED2DBL(viewheight);
double eyez = oldz + viewheight;
oldAboveFakeFloor = eyez > oldsec->heightsec->floorplane.ZatPoint(thing);
oldAboveFakeCeiling = eyez > oldsec->heightsec->ceilingplane.ZatPoint(thing);
@ -2333,7 +2333,7 @@ bool P_TryMove(AActor *thing, const DVector2 &pos,
if (newsec->heightsec && oldsec->heightsec && newsec->SecActTarget)
{
const sector_t *hs = newsec->heightsec;
double eyez = thing->Z() + FIXED2DBL(viewheight);
double eyez = thing->Z() + viewheight;
double fakez = hs->floorplane.ZatPoint(pos);
if (!oldAboveFakeFloor && eyez > fakez)

View file

@ -810,6 +810,11 @@ struct sector_t
planes[pos].xform.xscale = o;
}
void SetXScale(int pos, double o)
{
planes[pos].xform.xscale = FLOAT2FIXED(o);
}
fixed_t GetXScale(int pos) const
{
return planes[pos].xform.xscale;
@ -825,6 +830,11 @@ struct sector_t
planes[pos].xform.yscale = o;
}
void SetYScale(int pos, double o)
{
planes[pos].xform.yscale = FLOAT2FIXED(o);
}
fixed_t GetYScale(int pos) const
{
return planes[pos].xform.yscale;
@ -1267,6 +1277,16 @@ struct side_t
textures[mid].xoffset =
textures[bottom].xoffset = offset;
}
void SetTextureXOffset(int which, double offset)
{
textures[which].xoffset = FLOAT2FIXED(offset);
}
void SetTextureXOffset(double offset)
{
textures[top].xoffset =
textures[mid].xoffset =
textures[bottom].xoffset = FLOAT2FIXED(offset);
}
fixed_t GetTextureXOffset(int which) const
{
return textures[which].xoffset;
@ -1294,6 +1314,16 @@ struct side_t
textures[mid].yoffset =
textures[bottom].yoffset = offset;
}
void SetTextureYOffset(int which, double offset)
{
textures[which].yoffset = FLOAT2FIXED(offset);
}
void SetTextureYOffset(double offset)
{
textures[top].yoffset =
textures[mid].yoffset =
textures[bottom].yoffset = FLOAT2FIXED(offset);
}
fixed_t GetTextureYOffset(int which) const
{
return textures[which].yoffset;
@ -1319,6 +1349,10 @@ struct side_t
{
textures[top].xscale = textures[mid].xscale = textures[bottom].xscale = scale == 0 ? FRACUNIT : scale;
}
void SetTextureXScale(double scale)
{
textures[top].xscale = textures[mid].xscale = textures[bottom].xscale = scale == 0 ? FRACUNIT : FLOAT2FIXED(scale);
}
fixed_t GetTextureXScale(int which) const
{
return textures[which].xscale;
@ -1343,6 +1377,10 @@ struct side_t
{
textures[top].yscale = textures[mid].yscale = textures[bottom].yscale = scale == 0 ? FRACUNIT : scale;
}
void SetTextureYScale(double scale)
{
textures[top].yscale = textures[mid].yscale = textures[bottom].yscale = scale == 0 ? FRACUNIT : FLOAT2FIXED(scale);
}
fixed_t GetTextureYScale(int which) const
{
return textures[which].yscale;