diff --git a/src/d_dehacked.cpp b/src/d_dehacked.cpp index cd6525304..92d574d69 100644 --- a/src/d_dehacked.cpp +++ b/src/d_dehacked.cpp @@ -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]) diff --git a/src/gl/compatibility/gl_20.cpp b/src/gl/compatibility/gl_20.cpp index d714d3e46..3321f9561 100644 --- a/src/gl/compatibility/gl_20.cpp +++ b/src/gl/compatibility/gl_20.cpp @@ -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; } diff --git a/src/gl/renderer/gl_renderer.cpp b/src/gl/renderer/gl_renderer.cpp index 74bd81c17..212fc704c 100644 --- a/src/gl/renderer/gl_renderer.cpp +++ b/src/gl/renderer/gl_renderer.cpp @@ -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 diff --git a/src/gl/renderer/gl_renderer.h b/src/gl/renderer/gl_renderer.h index eb71cd4be..1f68fe57e 100644 --- a/src/gl/renderer/gl_renderer.h +++ b/src/gl/renderer/gl_renderer.h @@ -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(); diff --git a/src/gl/scene/gl_sprite.cpp b/src/gl/scene/gl_sprite.cpp index a1816acd2..0fb7945ce 100644 --- a/src/gl/scene/gl_sprite.cpp +++ b/src/gl/scene/gl_sprite.cpp @@ -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(); diff --git a/src/gl/scene/gl_walls_draw.cpp b/src/gl/scene/gl_walls_draw.cpp index d69ceeb4d..beeb103a0 100644 --- a/src/gl/scene/gl_walls_draw.cpp +++ b/src/gl/scene/gl_walls_draw.cpp @@ -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; diff --git a/src/gl/system/gl_framebuffer.cpp b/src/gl/system/gl_framebuffer.cpp index d6eb142d8..8549abb7e 100644 --- a/src/gl/system/gl_framebuffer.cpp +++ b/src/gl/system/gl_framebuffer.cpp @@ -551,6 +551,7 @@ void OpenGLFrameBuffer::GameRestart() UpdatePalette (); ScreenshotBuffer = NULL; gl_GenerateGlobalBrightmapFromColormap(); + GLRenderer->GetSpecialTextures(); } diff --git a/src/p_map.cpp b/src/p_map.cpp index 8fb25acfa..138a62595 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -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; } diff --git a/src/scripting/backend/codegen.cpp b/src/scripting/backend/codegen.cpp index a9c7e4fcc..96393ad4c 100644 --- a/src/scripting/backend/codegen.cpp +++ b/src/scripting/backend/codegen.cpp @@ -5945,7 +5945,7 @@ FxRandomSeed::~FxRandomSeed() FxExpression *FxRandomSeed::Resolve(FCompileContext &ctx) { CHECKRESOLVED(); - RESOLVE(seed, ctx); + SAFE_RESOLVE(seed, ctx); return this; }; diff --git a/src/sound/musicformats/music_libsndfile.cpp b/src/sound/musicformats/music_libsndfile.cpp index 15b158d60..af53ac37f 100644 --- a/src/sound/musicformats/music_libsndfile.cpp +++ b/src/sound/musicformats/music_libsndfile.cpp @@ -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) { diff --git a/wadsrc/static/zscript/constants.txt b/wadsrc/static/zscript/constants.txt index 47cf4accd..ef20e2310 100644 --- a/wadsrc/static/zscript/constants.txt +++ b/wadsrc/static/zscript/constants.txt @@ -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