Merge remote-tracking branch 'gz/master' into thereisnospoon

This commit is contained in:
ZZYZX 2017-01-30 05:39:01 +02:00
commit 3e44109ad1
19 changed files with 119 additions and 79 deletions

View file

@ -1318,6 +1318,14 @@ public:
{
return Prev + (ticFrac * (Pos() - Prev));
}
DRotator InterpolatedAngles(double ticFrac) const
{
DRotator result;
result.Yaw = PrevAngles.Yaw + deltaangle(PrevAngles.Yaw, Angles.Yaw) * ticFrac;
result.Pitch = PrevAngles.Pitch + deltaangle(PrevAngles.Pitch, Angles.Pitch) * ticFrac;
result.Roll = PrevAngles.Roll + deltaangle(PrevAngles.Roll, Angles.Roll) * ticFrac;
return result;
}
DVector3 PosPlusZ(double zadd) const
{
return { X(), Y(), Z() + zadd };

View file

@ -404,9 +404,9 @@ CCMD (give)
Net_WriteByte (DEM_GIVECHEAT);
Net_WriteString (argv[1]);
if (argv.argc() > 2)
Net_WriteWord (clamp (atoi (argv[2]), 1, 32767));
Net_WriteLong(atoi(argv[2]));
else
Net_WriteWord (0);
Net_WriteLong(0);
}
CCMD (take)
@ -417,9 +417,9 @@ CCMD (take)
Net_WriteByte (DEM_TAKECHEAT);
Net_WriteString (argv[1]);
if (argv.argc() > 2)
Net_WriteWord (clamp (atoi (argv[2]), 1, 32767));
Net_WriteLong(atoi (argv[2]));
else
Net_WriteWord (0);
Net_WriteLong (0);
}
CCMD (gameversion)

View file

@ -2198,12 +2198,12 @@ void Net_DoCommand (int type, BYTE **stream, int player)
case DEM_GIVECHEAT:
s = ReadString (stream);
cht_Give (&players[player], s, ReadWord (stream));
cht_Give (&players[player], s, ReadLong (stream));
break;
case DEM_TAKECHEAT:
s = ReadString (stream);
cht_Take (&players[player], s, ReadWord (stream));
cht_Take (&players[player], s, ReadLong (stream));
break;
case DEM_WARPCHEAT:
@ -2721,7 +2721,7 @@ void Net_SkipCommand (int type, BYTE **stream)
case DEM_GIVECHEAT:
case DEM_TAKECHEAT:
skip = strlen ((char *)(*stream)) + 3;
skip = strlen ((char *)(*stream)) + 5;
break;
case DEM_SUMMON2:

View file

@ -3194,6 +3194,8 @@ void PClass::Derive(PClass *newclass, FName name)
void PClass::InitializeDefaults()
{
if (IsKindOf(RUNTIME_CLASS(PClassActor)))
{
assert(Defaults == NULL);
Defaults = (BYTE *)M_Malloc(Size);
@ -3223,6 +3225,7 @@ void PClass::InitializeDefaults()
{
memset(Defaults + sizeof(DObject), 0, Size - sizeof(DObject));
}
}
if (bRuntimeClass)
{

View file

@ -710,8 +710,12 @@ class DThinkerIterator : public DObject, public FThinkerIterator
{
DECLARE_CLASS(DThinkerIterator, DObject)
DThinkerIterator()
{
}
public:
DThinkerIterator(PClass *cls = nullptr, int statnum = MAX_STATNUM + 1)
DThinkerIterator(PClass *cls, int statnum = MAX_STATNUM + 1)
: FThinkerIterator(cls, statnum)
{
}

View file

@ -125,6 +125,9 @@ public:
FThinkerIterator (const PClass *type, int statnum, DThinker *prev);
DThinker *Next (bool exact = false);
void Reinit ();
protected:
FThinkerIterator() {}
};
template <class T> class TThinkerIterator : public FThinkerIterator

View file

@ -1597,7 +1597,7 @@ void DSBarInfoWrapper::OnDestroy()
void DSBarInfoWrapper::SetScaled(bool scale, bool force)
{
Super::SetScaled(scale, force);
core->_SetScaled(scale);
core->_SetScaled(Scaled);
}
void DSBarInfoWrapper::AttachToPlayer(player_t *player)

View file

@ -209,7 +209,7 @@ void ADynamicLight::Activate(AActor *activator)
m_cycler.SetCycleType(CYCLE_Sin);
m_currentRadius = m_cycler.GetVal();
}
assert(m_currentRadius > 0);
if (m_currentRadius <= 0) m_currentRadius = 1;
}
@ -334,6 +334,7 @@ void ADynamicLight::Tick()
m_currentRadius = float(args[LIGHT_INTENSITY]);
break;
}
if (m_currentRadius <= 0) m_currentRadius = 1;
UpdateLocation();
}

View file

@ -194,6 +194,7 @@ void FLightDefaults::ApplyProperties(ADynamicLight * light) const
light->m_cycler.ShouldCycle(true);
light->m_cycler.SetCycleType(CYCLE_Sin);
light->m_currentRadius = light->m_cycler.GetVal();
if (light->m_currentRadius <= 0) light->m_currentRadius = 1;
}
switch (m_attenuate)
@ -369,7 +370,7 @@ void gl_ParsePointLight(FScanner &sc)
defaults->SetOffset(floatTriple);
break;
case LIGHTTAG_SIZE:
intVal = clamp<int>(gl_ParseInt(sc), 0, 255);
intVal = clamp<int>(gl_ParseInt(sc), 1, 1024);
defaults->SetArg(LIGHT_INTENSITY, intVal);
break;
case LIGHTTAG_SUBTRACTIVE:
@ -446,11 +447,11 @@ void gl_ParsePulseLight(FScanner &sc)
defaults->SetOffset(floatTriple);
break;
case LIGHTTAG_SIZE:
intVal = clamp<int>(gl_ParseInt(sc), 0, 1024);
intVal = clamp<int>(gl_ParseInt(sc), 1, 1024);
defaults->SetArg(LIGHT_INTENSITY, intVal);
break;
case LIGHTTAG_SECSIZE:
intVal = clamp<int>(gl_ParseInt(sc), 0, 1024);
intVal = clamp<int>(gl_ParseInt(sc), 1, 1024);
defaults->SetArg(LIGHT_SECONDARY_INTENSITY, intVal);
break;
case LIGHTTAG_INTERVAL:
@ -536,11 +537,11 @@ void gl_ParseFlickerLight(FScanner &sc)
defaults->SetOffset(floatTriple);
break;
case LIGHTTAG_SIZE:
intVal = clamp<int>(gl_ParseInt(sc), 0, 255);
intVal = clamp<int>(gl_ParseInt(sc), 1, 1024);
defaults->SetArg(LIGHT_INTENSITY, intVal);
break;
case LIGHTTAG_SECSIZE:
intVal = clamp<int>(gl_ParseInt(sc), 0, 255);
intVal = clamp<int>(gl_ParseInt(sc), 1, 1024);
defaults->SetArg(LIGHT_SECONDARY_INTENSITY, intVal);
break;
case LIGHTTAG_CHANCE:
@ -618,11 +619,11 @@ void gl_ParseFlickerLight2(FScanner &sc)
defaults->SetOffset(floatTriple);
break;
case LIGHTTAG_SIZE:
intVal = clamp<int>(gl_ParseInt(sc), 0, 255);
intVal = clamp<int>(gl_ParseInt(sc), 1, 1024);
defaults->SetArg(LIGHT_INTENSITY, intVal);
break;
case LIGHTTAG_SECSIZE:
intVal = clamp<int>(gl_ParseInt(sc), 0, 255);
intVal = clamp<int>(gl_ParseInt(sc), 1, 1024);
defaults->SetArg(LIGHT_SECONDARY_INTENSITY, intVal);
break;
case LIGHTTAG_INTERVAL:
@ -707,7 +708,7 @@ void gl_ParseSectorLight(FScanner &sc)
break;
case LIGHTTAG_SCALE:
floatVal = gl_ParseFloat(sc);
defaults->SetArg(LIGHT_SCALE, (BYTE)(floatVal * 255));
defaults->SetArg(LIGHT_SCALE, clamp((int)(floatVal * 255), 1, 1024));
break;
case LIGHTTAG_SUBTRACTIVE:
defaults->SetSubtractive(gl_ParseInt(sc) != 0);

View file

@ -306,12 +306,12 @@ float gl_GetFogDensity(int lightlevel, PalEntry fogcolor, int sectorfogdensity)
}
else if (sectorfogdensity != 0)
{
// case 2: Sector has an explicit fog density set.
// case 1: Sector has an explicit fog density set.
density = sectorfogdensity;
}
else if ((fogcolor.d & 0xffffff) == 0)
{
// case 1: black fog
// case 2: black fog
if (glset.lightmode != 8)
{
density = distfogtable[glset.lightmode != 0][gl_ClampLight(lightlevel)];

View file

@ -379,6 +379,7 @@ void GLFlat::Draw(int pass, bool trans) // trans only has meaning for GLPASS_LIG
case GLPASS_ALL: // Same, but also creates the dynlight data.
gl_SetColor(lightlevel, rel, Colormap,1.0f);
gl_SetFog(lightlevel, rel, &Colormap, false);
if (!gltexture->tex->isFullbright())
gl_RenderState.SetObjectColor(FlatColor | 0xff000000);
if (sector->special != GLSector_Skybox)
{
@ -406,6 +407,7 @@ void GLFlat::Draw(int pass, bool trans) // trans only has meaning for GLPASS_LIG
if (renderstyle==STYLE_Add) gl_RenderState.BlendFunc(GL_SRC_ALPHA, GL_ONE);
gl_SetColor(lightlevel, rel, Colormap, alpha);
gl_SetFog(lightlevel, rel, &Colormap, false);
if (!gltexture || !gltexture->tex->isFullbright())
gl_RenderState.SetObjectColor(FlatColor | 0xff000000);
if (!gltexture)
{

View file

@ -120,11 +120,11 @@ void GLSprite::CalculateVertices(FVector3 *v)
// Tilt the actor up or down based on pitch (increase 'somersaults' forward).
// Then counteract the roll and DO A BARREL ROLL.
FAngle pitch = (float)-actor->Angles.Pitch.Degrees;
FAngle pitch = (float)-Angles.Pitch.Degrees;
pitch.Normalized180();
mat.Translate(x, z, y);
mat.Rotate(0, 1, 0, 270. - actor->Angles.Yaw.Degrees);
mat.Rotate(0, 1, 0, 270. - Angles.Yaw.Degrees);
mat.Rotate(1, 0, 0, pitch.Degrees);
if (actor->renderflags & RF_ROLLCENTER)
@ -133,12 +133,12 @@ void GLSprite::CalculateVertices(FVector3 *v)
float cy = (y1 + y2) * 0.5;
mat.Translate(cx - x, 0, cy - y);
mat.Rotate(0, 1, 0, - actor->Angles.Roll.Degrees);
mat.Rotate(0, 1, 0, - Angles.Roll.Degrees);
mat.Translate(-cx, -z, -cy);
}
else
{
mat.Rotate(0, 1, 0, - actor->Angles.Roll.Degrees);
mat.Rotate(0, 1, 0, - Angles.Roll.Degrees);
mat.Translate(-x, -z, -y);
}
v[0] = mat * FVector3(x2, z, y2);
@ -200,11 +200,11 @@ void GLSprite::CalculateVertices(FVector3 *v)
// [fgsfds] calculate yaw vectors
float yawvecX = 0, yawvecY = 0, rollDegrees = 0;
float angleRad = (270. - GLRenderer->mAngles.Yaw).Radians();
if (actor) rollDegrees = actor->Angles.Roll.Degrees;
if (actor) rollDegrees = Angles.Roll.Degrees;
if (isFlatSprite)
{
yawvecX = actor->Angles.Yaw.Cos();
yawvecY = actor->Angles.Yaw.Sin();
yawvecX = Angles.Yaw.Cos();
yawvecY = Angles.Yaw.Sin();
}
// [fgsfds] Rotate the sprite about the sight vector (roll)
@ -327,12 +327,16 @@ void GLSprite::Draw(int pass)
{
gl_SetDynSpriteLight(gl_light_sprites ? actor : NULL, gl_light_particles ? particle : NULL);
}
sector_t *cursec = actor ? actor->Sector : particle ? particle->subsector->sector : nullptr;
if (cursec != nullptr)
{
PalEntry finalcol(ThingColor.a,
ThingColor.r * actor->Sector->SpecialColors[sector_t::sprites].r / 255,
ThingColor.g * actor->Sector->SpecialColors[sector_t::sprites].g / 255,
ThingColor.b * actor->Sector->SpecialColors[sector_t::sprites].b / 255);
ThingColor.r * cursec->SpecialColors[sector_t::sprites].r / 255,
ThingColor.g * cursec->SpecialColors[sector_t::sprites].g / 255,
ThingColor.b * cursec->SpecialColors[sector_t::sprites].b / 255);
gl_RenderState.SetObjectColor(finalcol);
}
gl_SetColor(lightlevel, rel, Colormap, trans);
}
@ -713,10 +717,6 @@ void GLSprite::Process(AActor* thing, sector_t * sector, int thruportal)
}
}
}
if (thing == camera)
{
int a = 0;
}
// don't draw first frame of a player missile
if (thing->flags&MF_MISSILE)
@ -738,6 +738,7 @@ void GLSprite::Process(AActor* thing, sector_t * sector, int thruportal)
int clipres = GLRenderer->mClipPortal->ClipPoint(thingpos);
if (clipres == GLPortal::PClip_InFront) return;
}
Angles = thing->InterpolatedAngles(r_TicFracF);
player_t *player = &players[consoleplayer];
FloatRect r;
@ -784,7 +785,7 @@ void GLSprite::Process(AActor* thing, sector_t * sector, int thruportal)
}
else if (!(thing->renderflags & RF_FLATSPRITE))
{
patch = gl_GetSpriteFrame(spritenum, thing->frame, -1, (ang - (thing->Angles.Yaw + thing->SpriteRotation)).BAMs(), &mirror);
patch = gl_GetSpriteFrame(spritenum, thing->frame, -1, (ang - (Angles.Yaw + thing->SpriteRotation)).BAMs(), &mirror);
}
else
{
@ -855,8 +856,8 @@ void GLSprite::Process(AActor* thing, sector_t * sector, int thruportal)
}
break;
case RF_WALLSPRITE:
viewvecX = thing->Angles.Yaw.Cos();
viewvecY = thing->Angles.Yaw.Sin();
viewvecX = Angles.Yaw.Cos();
viewvecY = Angles.Yaw.Sin();
x1 = x + viewvecY*leftfac;
x2 = x + viewvecY*rightfac;

View file

@ -376,6 +376,7 @@ public:
AActor * actor;
particle_t * particle;
TArray<lightlist_t> *lightlist;
DRotator Angles;
void SplitSprite(sector_t * frontsector, bool translucent);
void SetLowerParam();

View file

@ -1177,6 +1177,11 @@ class DBlockThingsIterator : public DObject, public FMultiBlockThingsIterator
{
DECLARE_CLASS(DBlockThingsIterator, DObject);
FPortalGroupArray check;
protected:
DBlockThingsIterator()
:FMultiBlockThingsIterator(check)
{
}
public:
FMultiBlockThingsIterator::CheckResult cres;
@ -1186,7 +1191,7 @@ public:
return FMultiBlockThingsIterator::Next(&cres);
}
DBlockThingsIterator(AActor *origin = nullptr, double checkradius = -1, bool ignorerestricted = false)
DBlockThingsIterator(AActor *origin, double checkradius = -1, bool ignorerestricted = false)
: FMultiBlockThingsIterator(check, origin, checkradius, ignorerestricted)
{
cres.thing = nullptr;

View file

@ -327,6 +327,8 @@ class FMultiBlockThingsIterator
void startIteratorForGroup(int group);
protected:
FMultiBlockThingsIterator(FPortalGroupArray &check) : checklist(check) {}
public:
struct CheckResult

View file

@ -4602,8 +4602,10 @@ bool AActor::UpdateWaterLevel (bool dosplash)
for(auto rover : Sector->e->XFloor.ffloors)
{
if (!(rover->flags & FF_EXISTS)) continue;
if(!(rover->flags & FF_SWIMMABLE) || rover->flags & FF_SOLID) continue;
if (rover->flags & FF_SOLID) continue;
reset = !(rover->flags & FF_SWIMMABLE);
if (reset && rover->alpha == 0) continue;
double ff_bottom=rover->bottom.plane->ZatPoint(this);
double ff_top=rover->top.plane->ZatPoint(this);
@ -6251,7 +6253,7 @@ bool P_HitWater (AActor * thing, sector_t * sec, const DVector3 &pos, bool check
double planez = rover->top.plane->ZatPoint(pos);
if (pos.Z > planez - 0.5 && pos.Z < planez + 0.5) // allow minor imprecisions
{
if (rover->flags & (FF_SOLID | FF_SWIMMABLE))
if ((rover->flags & (FF_SOLID | FF_SWIMMABLE)) || rover->alpha > 0)
{
terrainnum = rover->model->GetTerrain(rover->top.isceiling);
goto foundone;

View file

@ -2093,9 +2093,7 @@ void P_LoadLineDefs (MapData * map)
maplinedef_t *mld;
int numlines = lumplen / sizeof(maplinedef_t);
level.lines.Alloc(numlines);
linemap.Resize(numlines);
memset (&level.lines[0], 0, numlines*sizeof(line_t));
mldf = new char[lumplen];
map->Read(ML_LINEDEFS, mldf);
@ -2140,6 +2138,8 @@ void P_LoadLineDefs (MapData * map)
i++;
}
}
level.lines.Alloc(numlines);
memset(&level.lines[0], 0, numlines * sizeof(line_t));
P_AllocateSideDefs (map, sidecount);
@ -2192,9 +2192,7 @@ void P_LoadLineDefs2 (MapData * map)
maplinedef2_t *mld;
int numlines = lumplen / sizeof(maplinedef2_t);
level.lines.Alloc(numlines);
linemap.Resize(numlines);
memset (&level.lines[0], 0, numlines*sizeof(line_t));
mldf = new char[lumplen];
map->Read(ML_LINEDEFS, mldf);
@ -2233,6 +2231,8 @@ void P_LoadLineDefs2 (MapData * map)
{
ForceNodeBuild = true;
}
level.lines.Alloc(numlines);
memset(&level.lines[0], 0, numlines * sizeof(line_t));
P_AllocateSideDefs (map, sidecount);

View file

@ -1461,23 +1461,23 @@ public:
continue;
case NAME_Color_Floor:
sec->SpecialColors[sector_t::floor] = CheckInt(key) || 0xff000000;
sec->SpecialColors[sector_t::floor] = CheckInt(key) | 0xff000000;
break;
case NAME_Color_Ceiling:
sec->SpecialColors[sector_t::ceiling] = CheckInt(key) || 0xff000000;
sec->SpecialColors[sector_t::ceiling] = CheckInt(key) | 0xff000000;
break;
case NAME_Color_Walltop:
sec->SpecialColors[sector_t::walltop] = CheckInt(key) || 0xff000000;
sec->SpecialColors[sector_t::walltop] = CheckInt(key) | 0xff000000;
break;
case NAME_Color_Wallbottom:
sec->SpecialColors[sector_t::wallbottom] = CheckInt(key) || 0xff000000;
sec->SpecialColors[sector_t::wallbottom] = CheckInt(key) | 0xff000000;
break;
case NAME_Color_Sprites:
sec->SpecialColors[sector_t::sprites] = CheckInt(key) || 0xff000000;
sec->SpecialColors[sector_t::sprites] = CheckInt(key) | 0xff000000;
break;
case NAME_Desaturation:

View file

@ -1874,7 +1874,14 @@ void ZCCCompiler::InitDefaults()
if (!c->Type()->IsDescendantOf(RUNTIME_CLASS(AActor)))
{
if (c->Defaults.Size()) Error(c->cls, "%s: Non-actor classes may not have defaults", c->Type()->TypeName.GetChars());
if (c->Type()->ParentClass) c->Type()->ParentClass->DeriveData(c->Type());
if (c->Type()->ParentClass)
{
auto ti = static_cast<PClassActor *>(c->Type());
FString mename = ti->TypeName.GetChars();
ti->InitializeDefaults();
ti->ParentClass->DeriveData(ti);
}
}
else
{