This commit is contained in:
Rachael Alexanderson 2017-12-29 08:40:19 -05:00
commit 9957864b64
17 changed files with 77 additions and 45 deletions

View file

@ -234,6 +234,12 @@ else()
if( APPLE AND "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" )
set( ALL_C_FLAGS "-static-libgcc" )
endif()
if( NOT APPLE )
# Generic GCC/Clang requires position independent executable to be enabled explicitly
set( ALL_C_FLAGS "${ALL_C_FLAGS} -fPIE" )
set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie" )
endif()
endif()
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${REL_LINKER_FLAGS}" )

View file

@ -1481,6 +1481,8 @@ void G_InitLevelLocals ()
level.outsidefogdensity = info->outsidefogdensity;
level.skyfog = info->skyfog;
level.pixelstretch = info->pixelstretch;
compatflags.Callback();
compatflags2.Callback();
@ -1952,23 +1954,6 @@ DEFINE_ACTION_FUNCTION(FLevelLocals, SetInterMusic)
return 0;
}
//==========================================================================
//
//
//
//==========================================================================
float FLevelLocals::PixelStretch()
{
return level.info->pixelstretch;
}
DEFINE_ACTION_FUNCTION(FLevelLocals, GetPixelStretch)
{
PARAM_SELF_STRUCT_PROLOGUE(FLevelLocals);
ACTION_RETURN_FLOAT(self->PixelStretch());
}
//==========================================================================
//
//
@ -2011,6 +1996,7 @@ DEFINE_FIELD(FLevelLocals, teamdamage)
DEFINE_FIELD(FLevelLocals, fogdensity)
DEFINE_FIELD(FLevelLocals, outsidefogdensity)
DEFINE_FIELD(FLevelLocals, skyfog)
DEFINE_FIELD(FLevelLocals, pixelstretch)
DEFINE_FIELD_BIT(FLevelLocals, flags, noinventorybar, LEVEL_NOINVENTORYBAR)
DEFINE_FIELD_BIT(FLevelLocals, flags, monsterstelefrag, LEVEL_MONSTERSTELEFRAG)
DEFINE_FIELD_BIT(FLevelLocals, flags, actownspecial, LEVEL_ACTOWNSPECIAL)

View file

@ -46,7 +46,6 @@ struct FLevelLocals
void Tick ();
void AddScroller (int secnum);
void SetInterMusic(const char *nextmap);
float PixelStretch();
uint8_t md5[16]; // for savegame validation. If the MD5 does not match the savegame won't be loaded.
int time; // time in the hub
@ -149,6 +148,7 @@ struct FLevelLocals
int outsidefogdensity;
int skyfog;
float pixelstretch;
bool IsJumpingAllowed() const;
bool IsCrouchingAllowed() const;

View file

@ -1180,6 +1180,7 @@ void GLHorizonPortal::DrawContents()
gl_RenderState.SetMaterial(gltexture, CLAMP_NONE, 0, -1, false);
gl_RenderState.SetObjectColor(origin->specialcolor);
gl_SetPlaneTextureRotation(sp, gltexture);
gl_RenderState.AlphaFunc(GL_GEQUAL, 0.f);
@ -1237,6 +1238,7 @@ void GLEEHorizonPortal::DrawContents()
horz.plane.GetFromSector(sector, sector_t::ceiling);
horz.lightlevel = gl_ClampLight(sector->GetCeilingLight());
horz.colormap = sector->Colormap;
horz.specialcolor = 0xffffffff;
if (portal->mType == PORTS_PLANE)
{
horz.plane.Texheight = r_viewpoint.Pos.Z + fabs(horz.plane.Texheight);
@ -1250,6 +1252,7 @@ void GLEEHorizonPortal::DrawContents()
horz.plane.GetFromSector(sector, sector_t::floor);
horz.lightlevel = gl_ClampLight(sector->GetFloorLight());
horz.colormap = sector->Colormap;
horz.specialcolor = 0xffffffff;
if (portal->mType == PORTS_PLANE)
{
horz.plane.Texheight = r_viewpoint.Pos.Z - fabs(horz.plane.Texheight);

View file

@ -48,6 +48,7 @@ struct GLHorizonInfo
GLSectorPlane plane;
int lightlevel;
FColormap colormap;
PalEntry specialcolor;
};
struct GLSkyInfo

View file

@ -40,6 +40,7 @@
#include "events.h"
#include "actorinlines.h"
#include "r_data/r_vanillatrans.h"
#include "i_time.h"
#include "gl/system/gl_interface.h"
#include "gl/system/gl_framebuffer.h"
@ -1209,9 +1210,16 @@ void GLSprite::ProcessParticle (particle_t *particle, sector_t *sector)//, int s
}
}
x = particle->Pos.X;
y = particle->Pos.Y;
z = particle->Pos.Z;
double timefrac = r_viewpoint.TicFrac;
if (paused || bglobal.freeze)
timefrac = 0.;
float xvf = (particle->Vel.X) * timefrac;
float yvf = (particle->Vel.Y) * timefrac;
float zvf = (particle->Vel.Z) * timefrac;
x = float(particle->Pos.X) + xvf;
y = float(particle->Pos.Y) + yvf;
z = float(particle->Pos.Z) + zvf;
float factor;
if (gl_particles_style == 1) factor = 1.3f / 7.f;

View file

@ -441,6 +441,7 @@ bool GLWall::DoHorizon(seg_t * seg,sector_t * fs, vertex_t * v1,vertex_t * v2)
hi.plane.GetFromSector(fs, sector_t::ceiling);
hi.lightlevel = gl_ClampLight(fs->GetCeilingLight());
hi.colormap = fs->Colormap;
hi.specialcolor = fs->SpecialColors[sector_t::ceiling];
if (fs->e->XFloor.ffloors.Size())
{
@ -469,6 +470,7 @@ bool GLWall::DoHorizon(seg_t * seg,sector_t * fs, vertex_t * v1,vertex_t * v2)
hi.plane.GetFromSector(fs, sector_t::floor);
hi.lightlevel = gl_ClampLight(fs->GetFloorLight());
hi.colormap = fs->Colormap;
hi.specialcolor = fs->SpecialColors[sector_t::floor];
if (fs->e->XFloor.ffloors.Size())
{
@ -826,7 +828,7 @@ void GLWall::DoMidTexture(seg_t * seg, bool drawfogboundary,
back->GetTexture(sector_t::ceiling) == skyflatnum)
{
// intra-sky lines do not clip the texture at all if there's no upper texture
topleft = topright = texturetop;
topleft = topright = wrap ? 1e16f : texturetop;
}
else
{

View file

@ -7,7 +7,7 @@
// Unfortunately, the Scale function still gets badly handled on 32 bit x86 platforms so it's the last remaining piece of inline assembly
// GCC inlines
#if defined(__GNUC__) && defined(__i386__) && !defined(__clang__)
#if defined(__GNUC__) && defined(__i386__) && !defined(__clang__) && !defined(__PIC__)
#ifndef alloca
// MinGW does not seem to come with alloca defined.
#define alloca __builtin_alloca

View file

@ -711,9 +711,13 @@ DAnimatedDoor::DAnimatedDoor (sector_t *sec, line_t *line, int speed, int delay,
}
picnum = m_Line1->sidedef[0]->GetTexture(side_t::top);
m_Line1->sidedef[0]->SetTexture(side_t::mid, picnum);
m_Line2->sidedef[0]->SetTexture(side_t::mid, picnum);
auto &tex1 = m_Line1->sidedef[0]->textures;
tex1[side_t::mid].InitFrom(tex1[side_t::top]);
auto &tex2 = m_Line2->sidedef[0]->textures;
tex2[side_t::mid].InitFrom(tex2[side_t::top]);
picnum = tex1[side_t::top].texture;
// don't forget texture scaling here!
FTexture *tex = TexMan[picnum];

View file

@ -333,7 +333,7 @@ void PolyTriangleDrawer::draw_shaded_triangle(const ShadedTriVertex *vert, bool
args->v1 = &clippedvert[numclipvert - 1];
args->v2 = &clippedvert[i - 1];
args->v3 = &clippedvert[i - 2];
if (is_frontfacing(args) && args->CalculateGradients())
if (is_frontfacing(args) == ccw && args->CalculateGradients())
ScreenTriangle::Draw(args, thread);
}
}
@ -344,7 +344,7 @@ void PolyTriangleDrawer::draw_shaded_triangle(const ShadedTriVertex *vert, bool
args->v1 = &clippedvert[0];
args->v2 = &clippedvert[i - 1];
args->v3 = &clippedvert[i];
if (!is_frontfacing(args) && args->CalculateGradients())
if (is_frontfacing(args) != ccw && args->CalculateGradients())
ScreenTriangle::Draw(args, thread);
}
}

View file

@ -34,7 +34,10 @@ EXTERN_CVAR(Int, gl_particles_style)
void RenderPolyParticle::Render(PolyRenderThread *thread, const TriMatrix &worldToClip, const PolyClipPlane &clipPlane, particle_t *particle, subsector_t *sub, uint32_t stencilValue)
{
DVector3 pos = particle->Pos;
double timefrac = r_viewpoint.TicFrac;
if (paused || bglobal.freeze)
timefrac = 0.;
DVector3 pos = particle->Pos + (particle->Vel * timefrac);
double psize = particle->size / 8.0;
double zpos = pos.Z;

View file

@ -1139,7 +1139,15 @@ struct side_t
double yScale;
TObjPtr<DInterpolation*> interpolation;
FTextureID texture;
//int Light;
void InitFrom(const part &other)
{
if (texture.isNull()) texture = other.texture;
if (0.0 == xOffset) xOffset = other.xOffset;
if (0.0 == yOffset) yOffset = other.yOffset;
if (1.0 == xScale && 0.0 != other.xScale) xScale = other.xScale;
if (1.0 == yScale && 0.0 != other.yScale) yScale = other.yScale;
}
};
sector_t* sector; // Sector the SideDef is facing.

View file

@ -77,7 +77,15 @@ namespace swrenderer
double xscale, yscale;
int x1, x2, y1, y2;
sector_t* heightsec = NULL;
double timefrac = r_viewpoint.TicFrac;
if (paused || bglobal.freeze)
timefrac = 0.;
double ippx = particle->Pos.X + particle->Vel.X * timefrac;
double ippy = particle->Pos.Y + particle->Vel.Y * timefrac;
double ippz = particle->Pos.Z + particle->Vel.Z * timefrac;
RenderPortal *renderportal = thread->Portal.get();
// [ZZ] Particle not visible through the portal plane
@ -85,8 +93,8 @@ namespace swrenderer
return;
// transform the origin point
tr_x = particle->Pos.X - thread->Viewport->viewpoint.Pos.X;
tr_y = particle->Pos.Y - thread->Viewport->viewpoint.Pos.Y;
tr_x = ippx - thread->Viewport->viewpoint.Pos.X;
tr_y = ippy - thread->Viewport->viewpoint.Pos.Y;
tz = tr_x * thread->Viewport->viewpoint.TanCos + tr_y * thread->Viewport->viewpoint.TanSin;
@ -121,7 +129,7 @@ namespace swrenderer
auto viewport = thread->Viewport.get();
yscale = xscale; // YaspectMul is not needed for particles as they should always be square
ty = (particle->Pos.Z - viewport->viewpoint.Pos.Z) * thread->Viewport->YaspectMul;
ty = (ippz - viewport->viewpoint.Pos.Z) * thread->Viewport->YaspectMul;
y1 = xs_RoundToInt(viewport->CenterY - (ty + psize) * yscale);
y2 = xs_RoundToInt(viewport->CenterY - (ty - psize) * yscale);
@ -184,9 +192,9 @@ namespace swrenderer
map = GetColorTable(sector->Colormap, sector->SpecialColors[sector_t::sprites], true);
}
if (botpic != skyflatnum && particle->Pos.Z < botplane->ZatPoint(particle->Pos))
if (botpic != skyflatnum && ippz < botplane->ZatPoint(particle->Pos))
return;
if (toppic != skyflatnum && particle->Pos.Z >= topplane->ZatPoint(particle->Pos))
if (toppic != skyflatnum && ippz >= topplane->ZatPoint(particle->Pos))
return;
// store information in a vissprite
@ -199,7 +207,7 @@ namespace swrenderer
// vis->yscale *= InvZtoScale;
vis->depth = (float)tz;
vis->idepth = float(1 / tz);
vis->gpos = { (float)particle->Pos.X, (float)particle->Pos.Y, (float)particle->Pos.Z };
vis->gpos = { (float)ippx, (float)ippy, (float)ippz };
vis->y1 = y1;
vis->y2 = y2;
vis->x1 = x1;

View file

@ -1795,6 +1795,9 @@ PLYRMNU_PLAYERGENDER = "Gender";
PLYRMNU_AUTOAIM = "Autoaim";
PLYRMNU_SWITCHONPICKUP = "Switch on pickup";
PLYRMNU_ALWAYSRUN = "Always Run";
PLYRMNU_PRESSSPACE = "PRESS \cjSPACE";
PLYRMNU_SEEFRONT = "TO SEE FRONT";
PLYRMNU_SEEBACK = "TO SEE BACK";
// Display Options
DSPLYMNU_TITLE = "DISPLAY OPTIONS";
@ -2162,11 +2165,10 @@ ADVSNDMNU_FLUIDSYNTH = "FluidSynth";
ADVSNDMNU_FLUIDPATCHSET = "Patch set";
ADVSNDMNU_FLUIDGAIN = "Gain";
ADVSNDMNU_REVERB = "Reverb";
ADVSNDMNU_FLUIDVOICES = "MIDI voices";
ADVSNDMNU_CHORUS = "Chorus";
ADVSNDMNU_TIMIDITY = "Timidity++";
ADVSNDMNU_TIMIDITYEXE = "Path for executable";
ADVSNDMNU_TIMIDITYCONFIG = "Timidity config file";
ADVSNDMNU_TIMIDITYCHORUS = "Chorus";
ADVSNDMNU_TIMIDITYVOLUME = "Relative volume";
ADVSNDMNU_WILDMIDI = "WildMidi";
ADVSNDMNU_WILDMIDICONFIG = "WildMidi config file";

View file

@ -1678,7 +1678,8 @@ OptionMenu AdvSoundOptions protected
SubMenu "$ADVSNDMNU_SELCONFIG", "FluidPatchsetMenu"
Slider "$ADVSNDMNU_FLUIDGAIN", "fluid_gain", 0, 10, 0.5, 1
Option "$ADVSNDMNU_REVERB", "fluid_reverb", "OnOff"
Slider "$ADVSNDMNU_FLUIDVOICES", "fluid_voices", 16, 4096, 16, 1
Option "$ADVSNDMNU_CHORUS", "fluid_chorus", "OnOff"
Slider "$ADVSNDMNU_MIDIVOICES", "fluid_voices", 16, 4096, 16, 0
// Leaving out the more advanced stuff for now.
StaticText " "
StaticText "$ADVSNDMNU_TIMIDITY", 1
@ -1690,7 +1691,7 @@ OptionMenu AdvSoundOptions protected
TextField "$ADVSNDMNU_TIMIDITYCONFIG", "timidity_config"
SubMenu "$ADVSNDMNU_SELCONFIG", "TimidityConfigMenu"
Option "$ADVSNDMNU_REVERB", "timidity_reverb", "OnOff"
Option "$ADVSNDMNU_TIMIDITYCHORUS", "timidity_chorus", "OnOff"
Option "$ADVSNDMNU_CHORUS", "timidity_chorus", "OnOff"
Slider "$ADVSNDMNU_TIMIDITYVOLUME", "timidity_mastervolume", 0, 4, 0.2, 1
StaticText " "
StaticText "$ADVSNDMNU_WILDMIDI", 1

View file

@ -536,6 +536,7 @@ struct LevelLocals native
native readonly int fogdensity;
native readonly int outsidefogdensity;
native readonly int skyfog;
native readonly float pixelstretch;
// level_info_t *info cannot be done yet.
native String GetUDMFString(int type, int index, Name key);
@ -547,7 +548,6 @@ struct LevelLocals native
native static void WorldDone();
native static void RemoveAllBots(bool fromlist);
native void SetInterMusic(String nextmap);
native double GetPixelStretch();
native String FormatMapName(int mapnamecolor);
native bool IsJumpingAllowed() const;
native bool IsCrouchingAllowed() const;

View file

@ -585,11 +585,11 @@ class PlayerMenu : ListMenu
override void Drawer ()
{
Super.Drawer();
String str = "PRESS " .. TEXTCOLOR_WHITE .. "SPACE";
String str = Stringtable.Localize("$PLYRMNU_PRESSSPACE");
screen.DrawText (SmallFont, Font.CR_GOLD, 320 - 32 - 32 - SmallFont.StringWidth (str)/2, 50 + 48 + 70, str, DTA_Clean, true);
str = mRotation ? "TO SEE FRONT" : "TO SEE BACK";
str = Stringtable.Localize(mRotation ? "$PLYRMNU_SEEFRONT" : "$PLYRMNU_SEEBACK");
screen.DrawText (SmallFont, Font.CR_GOLD, 320 - 32 - 32 - SmallFont.StringWidth (str)/2, 50 + 48 + 70 + SmallFont.GetHeight (), str, DTA_Clean, true);
}
}
}