This commit is contained in:
Rachael Alexanderson 2018-02-20 05:11:08 -05:00
commit 329ccd3b59
11 changed files with 44 additions and 29 deletions

View file

@ -1196,6 +1196,10 @@ static int PatchThing (int thingy)
// triggering line effects and can teleport when the missile flag is removed.
info->flags2 &= ~MF2_NOTELEPORT;
}
if (thingy == 1) // [SP] special handling for players - always be friendly!
{
value[0] |= MF_FRIENDLY;
}
info->flags = ActorFlags::FromInt (value[0]);
}
if (vchanged[1])

View file

@ -459,8 +459,8 @@ bool gl_SetupLight(int group, Plane & p, ADynamicLight * light, FVector3 & nearP
bool gl_SetupLightTexture()
{
if (GLRenderer->gllight == nullptr) return false;
FMaterial * pat = FMaterial::ValidateTexture(GLRenderer->gllight, false);
if (!GLRenderer->glLight.isValid()) return false;
FMaterial * pat = FMaterial::ValidateTexture(GLRenderer->glLight, false, false);
gl_RenderState.SetMaterial(pat, CLAMP_XY_NOMIP, 0, -1, false);
return true;
}

View file

@ -104,7 +104,6 @@ FGLRenderer::FGLRenderer(OpenGLFrameBuffer *fb)
mSkyVBO = nullptr;
gl_spriteindex = 0;
mShaderManager = nullptr;
gllight = glpart2 = glpart = mirrortexture = nullptr;
mLights = nullptr;
m2DDrawer = nullptr;
mTonemapPalette = nullptr;
@ -163,6 +162,8 @@ void FGLRenderer::Initialize(int width, int height)
mCustomPostProcessShaders = new FCustomPostProcessShaders();
m2DDrawer = new F2DDrawer;
GetSpecialTextures();
// needed for the core profile, because someone decided it was a good idea to remove the default VAO.
if (!gl.legacyMode)
{
@ -172,11 +173,6 @@ void FGLRenderer::Initialize(int width, int height)
}
else mVAOID = 0;
if (gl.legacyMode) gllight = FTexture::CreateTexture(Wads.GetNumForFullName("glstuff/gllight.png"), FTexture::TEX_MiscPatch);
glpart2 = FTexture::CreateTexture(Wads.GetNumForFullName("glstuff/glpart2.png"), FTexture::TEX_MiscPatch);
glpart = FTexture::CreateTexture(Wads.GetNumForFullName("glstuff/glpart.png"), FTexture::TEX_MiscPatch);
mirrortexture = FTexture::CreateTexture(Wads.GetNumForFullName("glstuff/mirror.png"), FTexture::TEX_MiscPatch);
mVBO = new FFlatVertexBuffer(width, height);
mSkyVBO = new FSkyVertexBuffer;
if (!gl.legacyMode) mLights = new FLightBuffer();
@ -206,10 +202,6 @@ FGLRenderer::~FGLRenderer()
if (mVBO != NULL) delete mVBO;
if (mSkyVBO != NULL) delete mSkyVBO;
if (mLights != NULL) delete mLights;
if (glpart2) delete glpart2;
if (glpart) delete glpart;
if (gllight) delete gllight;
if (mirrortexture) delete mirrortexture;
if (mFBID != 0) glDeleteFramebuffers(1, &mFBID);
if (mVAOID != 0)
{
@ -241,6 +233,16 @@ FGLRenderer::~FGLRenderer()
delete mFXAALumaShader;
}
void FGLRenderer::GetSpecialTextures()
{
if (gl.legacyMode) glLight = TexMan.CheckForTexture("glstuff/gllight.png", FTexture::TEX_MiscPatch);
glPart2 = TexMan.CheckForTexture("glstuff/glpart2.png", FTexture::TEX_MiscPatch);
glPart = TexMan.CheckForTexture("glstuff/glpart.png", FTexture::TEX_MiscPatch);
mirrorTexture = TexMan.CheckForTexture("glstuff/mirror.png", FTexture::TEX_MiscPatch);
}
//==========================================================================
//
// Calculates the viewport values needed for 2D and 3D operations

View file

@ -133,10 +133,10 @@ public:
FShadowMap mShadowMap;
FTexture *gllight;
FTexture *glpart2;
FTexture *glpart;
FTexture *mirrortexture;
FTextureID glLight;
FTextureID glPart2;
FTextureID glPart;
FTextureID mirrorTexture;
float mSky1Pos, mSky2Pos;
@ -190,6 +190,7 @@ public:
void CopyToBackbuffer(const GL_IRECT *bounds, bool applyGamma);
void DrawPresentTexture(const GL_IRECT &box, bool applyGamma);
void Flush();
void GetSpecialTextures();
bool StartOffscreen();

View file

@ -1185,19 +1185,20 @@ void GLSprite::ProcessParticle (particle_t *particle, sector_t *sector)//, int s
// [BB] Load the texture for round or smooth particles
if (gl_particles_style)
{
FTexture *lump = NULL;
FTextureID lump;
if (gl_particles_style == 1)
{
lump = GLRenderer->glpart2;
lump = GLRenderer->glPart2;
}
else if (gl_particles_style == 2)
{
lump = GLRenderer->glpart;
lump = GLRenderer->glPart;
}
else lump.SetNull();
if (lump != NULL)
if (lump.isValid())
{
gltexture = FMaterial::ValidateTexture(lump, true);
gltexture = FMaterial::ValidateTexture(lump, true, false);
translation = 0;
ul = gltexture->GetUL();

View file

@ -260,7 +260,7 @@ void GLWall::RenderFogBoundary()
//==========================================================================
void GLWall::RenderMirrorSurface()
{
if (GLRenderer->mirrortexture == NULL) return;
if (!GLRenderer->mirrorTexture.isValid()) return;
// For the sphere map effect we need a normal of the mirror surface,
FVector3 v = glseg.Normal();
@ -288,7 +288,7 @@ void GLWall::RenderMirrorSurface()
gl_RenderState.AlphaFunc(GL_GREATER,0);
glDepthFunc(GL_LEQUAL);
FMaterial * pat=FMaterial::ValidateTexture(GLRenderer->mirrortexture, false);
FMaterial * pat=FMaterial::ValidateTexture(GLRenderer->mirrorTexture, false, false);
gl_RenderState.SetMaterial(pat, CLAMP_NONE, 0, -1, false);
flags &= ~GLWF_GLOW;

View file

@ -551,6 +551,7 @@ void OpenGLFrameBuffer::GameRestart()
UpdatePalette ();
ScreenshotBuffer = NULL;
gl_GenerateGlobalBrightmapFromColormap();
GLRenderer->GetSpecialTextures();
}

View file

@ -6372,6 +6372,11 @@ void P_DoCrunch(AActor *thing, FChangePosition *cpos)
mo->Translation = thing->BloodTranslation;
}
if (mo->flags5 & MF5_PUFFGETSOWNER)
{
mo->target = thing;
}
if (!(cl_bloodtype <= 1)) mo->renderflags |= RF_INVISIBLE;
}

View file

@ -5945,7 +5945,7 @@ FxRandomSeed::~FxRandomSeed()
FxExpression *FxRandomSeed::Resolve(FCompileContext &ctx)
{
CHECKRESOLVED();
RESOLVE(seed, ctx);
SAFE_RESOLVE(seed, ctx);
return this;
};

View file

@ -113,7 +113,7 @@ static void ParseVorbisComments(FileReader *fr, uint32_t *start, bool *startass,
// followed by the vendor string
if(fr->Read(vc_data, 4) != 4)
return;
size_t vndr_len = vc_data[0] | (vc_data[1]<<8) | (vc_data[2]<<16) | (vc_data[3]<<24);
uint32_t vndr_len = vc_data[0] | (vc_data[1]<<8) | (vc_data[2]<<16) | (vc_data[3]<<24);
// Skip vendor string
if(fr->Seek(vndr_len, SEEK_CUR) == -1)
@ -131,7 +131,7 @@ static void ParseVorbisComments(FileReader *fr, uint32_t *start, bool *startass,
// the comment text (not null terminated!)
if(fr->Read(vc_data, 4) != 4)
return;
size_t length = vc_data[0] | (vc_data[1]<<8) | (vc_data[2]<<16) | (vc_data[3]<<24);
uint32_t length = vc_data[0] | (vc_data[1]<<8) | (vc_data[2]<<16) | (vc_data[3]<<24);
if(length >= 128)
{
@ -164,9 +164,9 @@ static void FindFlacComments(FileReader *fr, uint32_t *loop_start, bool *startas
// The first byte of the block header contains the type and a flag
// indicating the last metadata block
char blocktype = header[0]&0x7f;
lastblock = header[0]&0x80;
lastblock = !!(header[0]&0x80);
// Following the type is a 24BE integer for the size of the block
size_t blocksize = (header[1]<<16) | (header[2]<<8) | header[3];
uint32_t blocksize = (header[1]<<16) | (header[2]<<8) | header[3];
// FLAC__METADATA_TYPE_VORBIS_COMMENT is 4
if(blocktype == 4)
@ -205,7 +205,7 @@ static void FindOggComments(FileReader *fr, uint32_t *loop_start, bool *startass
// Find the segment with the Vorbis Comment packet (type 3)
for(int i = 0; i < ogg_segments; ++i)
{
size_t segsize = segsizes[i];
uint8_t segsize = segsizes[i];
if(segsize > 16)
{

View file

@ -416,6 +416,7 @@ enum ESoundFlags
CHAN_MAYBE_LOCAL = 16,
CHAN_UI = 32,
CHAN_NOPAUSE = 64,
CHAN_LOOP = 256,
CHAN_PICKUP = (CHAN_ITEM|CHAN_MAYBE_LOCAL),
CHAN_NOSTOP = 4096