This commit is contained in:
Rachael Alexanderson 2017-12-31 18:43:14 -05:00
commit d412835536
7 changed files with 129 additions and 76 deletions

View file

@ -2950,7 +2950,7 @@ void AM_drawThings ()
const size_t spriteIndex = sprite.spriteframes + (show > 1 ? t->frame : 0);
frame = &SpriteFrames[spriteIndex];
DAngle angle = 270. -t->Angles.Yaw;
DAngle angle = 270. + 22.5 - t->Angles.Yaw;
if (frame->Texture[0] != frame->Texture[1]) angle += 180. / 16;
if (am_rotate == 1 || (am_rotate == 2 && viewactive))
{

View file

@ -2233,7 +2233,7 @@ void G_ParseMapInfo (FString basemapinfo)
}
if (nindex != 2)
{
CommitUMapinfo(&gamedefaults); // UMPAINFOs are collected until a regular MAPINFO is found so that they properly use the base settings.
CommitUMapinfo(&gamedefaults); // UMAPINFOs are collected until a regular MAPINFO is found so that they properly use the base settings.
FMapInfoParser parse(nindex == 1 ? FMapInfoParser::FMT_New : FMapInfoParser::FMT_Unknown);
level_info_t defaultinfo;
parse.ParseMapInfo(lump, gamedefaults, defaultinfo);

View file

@ -96,6 +96,7 @@ CVAR (Int, hud_armor_yellow, 50, CVAR_ARCHIVE) // armor amount less than whic
CVAR (Int, hud_armor_green, 100, CVAR_ARCHIVE) // armor amount above is blue, below is green
CVAR (Bool, hud_berserk_health, true, CVAR_ARCHIVE); // when found berserk pack instead of health box
CVAR (Bool, hud_showangles, false, CVAR_ARCHIVE) // show player's pitch, yaw, roll
CVAR (Int, hudcolor_titl, CR_YELLOW, CVAR_ARCHIVE) // color of automap title
CVAR (Int, hudcolor_time, CR_RED, CVAR_ARCHIVE) // color of level/hub time
@ -907,20 +908,44 @@ static void DrawCoordinates(player_t * CPlayer)
DTA_KeepRatio, true,
DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, TAG_DONE);
mysnprintf(coordstr, countof(coordstr), "X: %d", int(pos.X));
screen->DrawText(SmallFont, hudcolor_xyco, xpos, ypos+2*h, coordstr,
DTA_KeepRatio, true,
DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, TAG_DONE);
int linenum = 3;
mysnprintf(coordstr, countof(coordstr), "Y: %d", int(pos.Y));
screen->DrawText(SmallFont, hudcolor_xyco, xpos, ypos+3*h, coordstr,
DTA_KeepRatio, true,
DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, TAG_DONE);
typedef struct CoordEntry
{
const char* const format;
double value;
}
CoordEntryList[3];
mysnprintf(coordstr, countof(coordstr), "Z: %d", int(pos.Z));
screen->DrawText(SmallFont, hudcolor_xyco, xpos, ypos+4*h, coordstr,
DTA_KeepRatio, true,
DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, TAG_DONE);
const auto drawentries = [&](CoordEntryList&& entries)
{
for (const auto& entry : entries)
{
mysnprintf(coordstr, countof(coordstr), entry.format, entry.value);
screen->DrawText(SmallFont, hudcolor_xyco, xpos, ypos + linenum * h, coordstr,
DTA_KeepRatio, true,
DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, TAG_DONE);
++linenum;
}
};
drawentries({
{ "X: %.0f", pos.X },
{ "Y: %.0f", pos.Y },
{ "Z: %.0f", pos.Z }
});
if (hud_showangles)
{
const DRotator& angles = CPlayer->mo->Angles;
++linenum;
drawentries({
{ "P: %.1f", angles.Pitch.Degrees },
{ "Y: %.1f", (90.0 - angles.Yaw).Normalized360().Degrees },
{ "R: %.1f", angles.Roll.Degrees },
});
}
}
//---------------------------------------------------------------------------

View file

@ -69,7 +69,7 @@ void GLSkyInfo::init(int sky1, PalEntry FadeColor)
if (!texture[0] || texture[0]->tex->UseType == FTexture::TEX_Null) goto normalsky;
skytexno1 = texno;
x_offset[0] = s->GetTextureXOffset(pos) * (360.f/65536.f);
y_offset = s->GetTextureYOffset(pos);
y_offset = s->GetTextureYOffset(pos) - 28.0;
mirrored = !l->args[2];
}
else

View file

@ -856,7 +856,7 @@ static int LineIsBelow(line_t *line, AActor *actor)
//==========================================================================
static // killough 3/26/98: make static
bool PIT_CheckLine(FMultiBlockLinesIterator &mit, FMultiBlockLinesIterator::CheckResult &cres, const FBoundingBox &box, FCheckPosition &tm)
bool PIT_CheckLine(FMultiBlockLinesIterator &mit, FMultiBlockLinesIterator::CheckResult &cres, const FBoundingBox &box, FCheckPosition &tm, const bool wasfit)
{
line_t *ld = cres.line;
bool rail = false;
@ -902,12 +902,15 @@ bool PIT_CheckLine(FMultiBlockLinesIterator &mit, FMultiBlockLinesIterator::Chec
double portz = cres.line->frontsector->GetPortalPlaneZ(sector_t::ceiling);
if (tm.thing->Z() < portz && tm.thing->Z() + tm.thing->MaxStepHeight >= portz && tm.floorz < portz)
{
tm.floorz = portz;
tm.floorsector = cres.line->frontsector;
tm.floorpic = cres.line->sidedef[0]->GetTexture(side_t::mid);
tm.floorterrain = 0;
tm.portalstep = true;
tm.portalgroup = cres.line->frontsector->GetOppositePortalGroup(sector_t::ceiling);
if (wasfit)
{
tm.floorz = portz;
tm.floorsector = cres.line->frontsector;
tm.floorpic = cres.line->sidedef[0]->GetTexture(side_t::mid);
tm.floorterrain = 0;
tm.portalstep = true;
tm.portalgroup = cres.line->frontsector->GetOppositePortalGroup(sector_t::ceiling);
}
return true;
}
}
@ -916,7 +919,10 @@ bool PIT_CheckLine(FMultiBlockLinesIterator &mit, FMultiBlockLinesIterator::Chec
{
P_DamageMobj(tm.thing, NULL, NULL, tm.thing->Mass >> 5, NAME_Melee);
}
tm.thing->BlockingLine = ld;
if (wasfit)
{
tm.thing->BlockingLine = ld;
}
CheckForPushSpecial(ld, 0, tm.thing);
return false;
}
@ -948,12 +954,15 @@ bool PIT_CheckLine(FMultiBlockLinesIterator &mit, FMultiBlockLinesIterator::Chec
if (state == -1) return true;
if (state == 1)
{
// the line should not block but we should set the ceilingz to the portal boundary so that we can't float up into that line.
double portalz = cres.line->frontsector->GetPortalPlaneZ(sector_t::floor);
if (portalz < tm.ceilingz)
if (wasfit)
{
tm.ceilingz = portalz;
tm.ceilingsector = cres.line->frontsector;
// the line should not block but we should set the ceilingz to the portal boundary so that we can't float up into that line.
double portalz = cres.line->frontsector->GetPortalPlaneZ(sector_t::floor);
if (portalz < tm.ceilingz)
{
tm.ceilingz = portalz;
tm.ceilingsector = cres.line->frontsector;
}
}
return true;
}
@ -965,12 +974,15 @@ bool PIT_CheckLine(FMultiBlockLinesIterator &mit, FMultiBlockLinesIterator::Chec
if (state == -1) return true;
if (state == 1)
{
double portalz = cres.line->frontsector->GetPortalPlaneZ(sector_t::ceiling);
if (portalz > tm.floorz)
if (wasfit)
{
tm.floorz = portalz;
tm.floorsector = cres.line->frontsector;
tm.floorterrain = 0;
double portalz = cres.line->frontsector->GetPortalPlaneZ(sector_t::ceiling);
if (portalz > tm.floorz)
{
tm.floorz = portalz;
tm.floorsector = cres.line->frontsector;
tm.floorterrain = 0;
}
}
return true;
}
@ -981,7 +993,10 @@ bool PIT_CheckLine(FMultiBlockLinesIterator &mit, FMultiBlockLinesIterator::Chec
{
P_DamageMobj(tm.thing, NULL, NULL, tm.thing->Mass >> 5, NAME_Melee);
}
tm.thing->BlockingLine = ld;
if (wasfit)
{
tm.thing->BlockingLine = ld;
}
// Calculate line side based on the actor's original position, not the new one.
CheckForPushSpecial(ld, P_PointOnLineSide(cres.Position, ld), tm.thing);
return false;
@ -1000,9 +1015,12 @@ bool PIT_CheckLine(FMultiBlockLinesIterator &mit, FMultiBlockLinesIterator::Chec
double portz = tm.thing->Sector->GetPortalPlaneZ(sector_t::ceiling);
if (tm.thing->Z() < portz && tm.thing->Z() + tm.thing->MaxStepHeight >= portz && tm.floorz < portz)
{
// Actor is stepping through a portal.
tm.portalstep = true;
tm.portalgroup = tm.thing->Sector->GetOppositePortalGroup(sector_t::ceiling);
if (wasfit)
{
// Actor is stepping through a portal.
tm.portalstep = true;
tm.portalgroup = tm.thing->Sector->GetOppositePortalGroup(sector_t::ceiling);
}
return true;
}
}
@ -1042,41 +1060,44 @@ bool PIT_CheckLine(FMultiBlockLinesIterator &mit, FMultiBlockLinesIterator::Chec
open.bottom += 32;
}
// adjust floor / ceiling heights
if (!(cres.portalflags & FFCF_NOCEILING))
if (wasfit)
{
if (open.top < tm.ceilingz)
// adjust floor / ceiling heights
if (!(cres.portalflags & FFCF_NOCEILING))
{
tm.ceilingz = open.top;
tm.ceilingsector = open.topsec;
tm.ceilingpic = open.ceilingpic;
tm.ceilingline = ld;
tm.thing->BlockingLine = ld;
}
}
// If we are stepping through a portal the line's opening must be checked, regardless of the NOFLOOR flag
if (!(cres.portalflags & FFCF_NOFLOOR) || (tm.portalstep && open.bottomsec->PortalGroup == tm.portalgroup))
{
if (open.bottom > tm.floorz)
{
tm.floorz = open.bottom;
tm.floorsector = open.bottomsec;
tm.floorpic = open.floorpic;
tm.floorterrain = open.floorterrain;
tm.touchmidtex = open.touchmidtex;
tm.abovemidtex = open.abovemidtex;
tm.thing->BlockingLine = ld;
}
else if (open.bottom == tm.floorz)
{
tm.touchmidtex |= open.touchmidtex;
tm.abovemidtex |= open.abovemidtex;
if (open.top < tm.ceilingz)
{
tm.ceilingz = open.top;
tm.ceilingsector = open.topsec;
tm.ceilingpic = open.ceilingpic;
tm.ceilingline = ld;
tm.thing->BlockingLine = ld;
}
}
if (open.lowfloor < tm.dropoffz)
// If we are stepping through a portal the line's opening must be checked, regardless of the NOFLOOR flag
if (!(cres.portalflags & FFCF_NOFLOOR) || (tm.portalstep && open.bottomsec->PortalGroup == tm.portalgroup))
{
tm.dropoffz = open.lowfloor;
if (open.bottom > tm.floorz)
{
tm.floorz = open.bottom;
tm.floorsector = open.bottomsec;
tm.floorpic = open.floorpic;
tm.floorterrain = open.floorterrain;
tm.touchmidtex = open.touchmidtex;
tm.abovemidtex = open.abovemidtex;
tm.thing->BlockingLine = ld;
}
else if (open.bottom == tm.floorz)
{
tm.touchmidtex |= open.touchmidtex;
tm.abovemidtex |= open.abovemidtex;
}
if (open.lowfloor < tm.dropoffz)
{
tm.dropoffz = open.lowfloor;
}
}
}
@ -1881,7 +1902,7 @@ bool P_CheckPosition(AActor *thing, const DVector2 &pos, FCheckPosition &tm, boo
while (it.Next(&lcres))
{
bool thisresult = PIT_CheckLine(it, lcres, it.Box(), tm);
bool thisresult = PIT_CheckLine(it, lcres, it.Box(), tm, good);
good &= thisresult;
if (thisresult)
{
@ -5920,10 +5941,7 @@ bool P_AdjustFloorCeil(AActor *thing, FChangePosition *cpos)
}
bool isgood = P_CheckPosition(thing, thing->Pos(), tm);
// This is essentially utterly broken because it even uses the return from a failed P_CheckPosition but the entire logic will break down if that isn't done.
// However, if tm.floorz is greater than tm.ceilingz we have a real problem that needs to be dealt with exolicitly.
if (!(thing->flags4 & MF4_ACTLIKEBRIDGE) && tm.floorz <= tm.ceilingz)
if (!(thing->flags4 & MF4_ACTLIKEBRIDGE))
{
thing->floorz = tm.floorz;
thing->ceilingz = tm.ceilingz;

View file

@ -823,16 +823,24 @@ bool AActor::GiveInventory(PClassActor *type, int amount, bool givecheat)
item->ClearCounters();
if (!givecheat || amount > 0)
{
if (type->IsDescendantOf (PClass::FindActor(NAME_BasicArmorPickup)) || type->IsDescendantOf(PClass::FindActor(NAME_BasicArmorBonus)))
if (type->IsDescendantOf(NAME_BasicArmorPickup) || type->IsDescendantOf(NAME_BasicArmorBonus))
{
item->IntVar(NAME_SaveAmount) *= amount;
}
else
{
if (!givecheat)
item->Amount = amount;
if (givecheat)
{
const AInventory *const haveitem = FindInventory(type);
item->Amount = MIN(amount, nullptr == haveitem
? static_cast<AInventory*>(GetDefaultByType(type))->MaxAmount
: haveitem->MaxAmount);
}
else
item->Amount = MIN (amount, item->MaxAmount);
{
item->Amount = amount;
}
}
}
if (!item->CallTryPickup (this))

View file

@ -332,6 +332,8 @@ static int ParseMapEntry(FScanner &scanner, UMapEntry *val)
int ParseUMapInfo(int lumpnum)
{
P_LoadTranslator(gameinfo.translator);
FScanner scanner(lumpnum);
unsigned int i;