diff --git a/src/g_game.cpp b/src/g_game.cpp index 404484672..82bff3f73 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -1743,7 +1743,8 @@ static void G_QueueBody (AActor *body) EXTERN_CVAR(Bool, sv_singleplayerrespawn) void G_DoReborn (int playernum, bool freshbot) { - if (!multiplayer && !(level.flags2 & LEVEL2_ALLOWRESPAWN) && !sv_singleplayerrespawn) + if (!multiplayer && !(level.flags2 & LEVEL2_ALLOWRESPAWN) && !sv_singleplayerrespawn && + !G_SkillProperty(SKILLP_PlayerRespawn)) { if (BackupSaveName.Len() > 0 && FileExists (BackupSaveName.GetChars())) { // Load game from the last point it was saved diff --git a/src/g_level.cpp b/src/g_level.cpp index 0ee56d6c3..c333ba074 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -1952,6 +1952,23 @@ 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()); +} + //========================================================================== // // diff --git a/src/g_level.h b/src/g_level.h index 7fb38a046..78dcd55b1 100644 --- a/src/g_level.h +++ b/src/g_level.h @@ -538,6 +538,7 @@ enum ESkillProperty SKILLP_EasyKey, SKILLP_SlowMonsters, SKILLP_Infight, + SKILLP_PlayerRespawn, }; enum EFSkillProperty // floating point properties { @@ -595,6 +596,7 @@ struct FSkillInfo double FriendlyHealth; bool NoPain; int Infighting; + bool PlayerRespawn; FSkillInfo() {} FSkillInfo(const FSkillInfo &other) diff --git a/src/g_levellocals.h b/src/g_levellocals.h index 505d797b6..024e6302d 100644 --- a/src/g_levellocals.h +++ b/src/g_levellocals.h @@ -46,6 +46,7 @@ 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 diff --git a/src/g_shared/a_flashfader.cpp b/src/g_shared/a_flashfader.cpp index 64c4ff218..ed0e02202 100644 --- a/src/g_shared/a_flashfader.cpp +++ b/src/g_shared/a_flashfader.cpp @@ -50,15 +50,17 @@ DFlashFader::DFlashFader () DFlashFader::DFlashFader (float r1, float g1, float b1, float a1, float r2, float g2, float b2, float a2, - float time, AActor *who) + float time, AActor *who, bool terminate) : TotalTics ((int)(time*TICRATE)), StartTic (level.time), ForWho (who) { Blends[0][0]=r1; Blends[0][1]=g1; Blends[0][2]=b1; Blends[0][3]=a1; Blends[1][0]=r2; Blends[1][1]=g2; Blends[1][2]=b2; Blends[1][3]=a2; + Terminate = terminate; } void DFlashFader::OnDestroy () { + if (Terminate) Blends[1][3] = 0.f; // Needed in order to cancel out the secondary fade. SetBlend (1.f); Super::OnDestroy(); } diff --git a/src/g_shared/a_sharedglobal.h b/src/g_shared/a_sharedglobal.h index 626985f93..ce2376cec 100644 --- a/src/g_shared/a_sharedglobal.h +++ b/src/g_shared/a_sharedglobal.h @@ -84,19 +84,20 @@ class DFlashFader : public DThinker public: DFlashFader (float r1, float g1, float b1, float a1, float r2, float g2, float b2, float a2, - float time, AActor *who); + float time, AActor *who, bool terminate = false); void OnDestroy() override; void Serialize(FSerializer &arc); void Tick (); AActor *WhoFor() { return ForWho; } void Cancel (); + protected: float Blends[2][4]; int TotalTics; int StartTic; TObjPtr ForWho; - + bool Terminate; void SetBlend (float time); DFlashFader (); }; diff --git a/src/g_skill.cpp b/src/g_skill.cpp index 6e23c9523..90ed9f723 100644 --- a/src/g_skill.cpp +++ b/src/g_skill.cpp @@ -89,6 +89,7 @@ void FMapInfoParser::ParseSkill () skill.FriendlyHealth = 1.; skill.NoPain = false; skill.Infighting = 0; + skill.PlayerRespawn = false; sc.MustGetString(); skill.Name = sc.String; @@ -155,6 +156,10 @@ void FMapInfoParser::ParseSkill () { skill.NoMenu = true; } + else if (sc.Compare ("playerrespawn")) + { + skill.PlayerRespawn = true; + } else if (sc.Compare("respawntime")) { ParseAssign(); @@ -397,6 +402,9 @@ int G_SkillProperty(ESkillProperty prop) if (AllSkills[gameskill].Infighting == LEVEL2_TOTALINFIGHTING) return 1; if (AllSkills[gameskill].Infighting == LEVEL2_NOINFIGHTING) return -1; return infighting; + + case SKILLP_PlayerRespawn: + return AllSkills[gameskill].PlayerRespawn; } } return 0; @@ -550,6 +558,7 @@ FSkillInfo &FSkillInfo::operator=(const FSkillInfo &other) Infighting = other.Infighting; ArmorFactor = other.ArmorFactor; HealthFactor = other.HealthFactor; + PlayerRespawn = other.PlayerRespawn; return *this; } diff --git a/src/gl/stereo3d/gl_quadstereo.cpp b/src/gl/stereo3d/gl_quadstereo.cpp index b65c109c8..769f28906 100644 --- a/src/gl/stereo3d/gl_quadstereo.cpp +++ b/src/gl/stereo3d/gl_quadstereo.cpp @@ -50,19 +50,19 @@ void QuadStereo::checkInitialRenderContextState() { // Keep trying until we see at least one good OpenGL context to render to static bool bDecentContextWasFound = false; - if (!bDecentContextWasFound) { - // I'm using a "random" OpenGL call (glGetFramebufferAttachmentParameteriv) - // that appears to correlate with whether the context is ready - GLint attachmentType = GL_NONE; - glGetFramebufferAttachmentParameteriv(GL_DRAW_FRAMEBUFFER, GL_FRONT_LEFT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &attachmentType); - if (attachmentType != GL_NONE) // Finally, a useful OpenGL context + static int contextCheckCount = 0; + if ( (! bDecentContextWasFound) && (contextCheckCount < 200) ) + { + contextCheckCount += 1; + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); // This question is about the main screen display context + GLboolean supportsStereo, supportsBuffered; + glGetBooleanv(GL_DOUBLEBUFFER, &supportsBuffered); + if (supportsBuffered) // Finally, a useful OpenGL context { // This block will be executed exactly ONCE during a game run bDecentContextWasFound = true; // now we can stop checking every frame... // Now check whether this context supports hardware stereo - GLboolean supportsStereo, supportsBuffered; glGetBooleanv(GL_STEREO, &supportsStereo); - glGetBooleanv(GL_DOUBLEBUFFER, &supportsBuffered); bQuadStereoSupported = supportsStereo && supportsBuffered; leftEye.bQuadStereoSupported = bQuadStereoSupported; rightEye.bQuadStereoSupported = bQuadStereoSupported; diff --git a/src/p_actionfunctions.cpp b/src/p_actionfunctions.cpp index ea64c36d3..1abe2c939 100644 --- a/src/p_actionfunctions.cpp +++ b/src/p_actionfunctions.cpp @@ -3575,17 +3575,18 @@ DEFINE_ACTION_FUNCTION(AActor, A_SetBlend) PARAM_FLOAT (alpha); PARAM_INT (tics); PARAM_COLOR_DEF (color2); + PARAM_FLOAT_DEF (alpha2); if (color == MAKEARGB(255,255,255,255)) color = 0; if (color2 == MAKEARGB(255,255,255,255)) color2 = 0; - if (color2.a == 0) - color2 = color; +// if (color2.a == 0) +// color2 = color; Create(color.r/255.f, color.g/255.f, color.b/255.f, float(alpha), - color2.r/255.f, color2.g/255.f, color2.b/255.f, 0.f, - float(tics)/TICRATE, self); + color2.r/255.f, color2.g/255.f, color2.b/255.f, float(alpha2), + float(tics)/TICRATE, self, true); return 0; } diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 561334a52..dc0e76ad1 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -5648,7 +5648,8 @@ APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags) { // Give all cards in death match mode. p->mo->GiveDeathmatchInventory (); } - else if ((multiplayer || (level.flags2 & LEVEL2_ALLOWRESPAWN) || sv_singleplayerrespawn) && state == PST_REBORN && oldactor != NULL) + else if ((multiplayer || (level.flags2 & LEVEL2_ALLOWRESPAWN) || sv_singleplayerrespawn || + !!G_SkillProperty(SKILLP_PlayerRespawn)) && state == PST_REBORN && oldactor != NULL) { // Special inventory handling for respawning in coop p->mo->FilterCoopRespawnInventory (oldactor); } diff --git a/wadsrc/static/language.enu b/wadsrc/static/language.enu index 06af66307..b05981a5a 100644 --- a/wadsrc/static/language.enu +++ b/wadsrc/static/language.enu @@ -2725,7 +2725,7 @@ GLPREFMNU_AMBLIGHT = "Ambient light level"; GLPREFMNU_RENDERQUALITY = "Rendering quality"; GLPREFMNU_MENUBLUR = "Menu Blur"; GLPREFMNU_VRMODE = "Stereo 3D VR"; -GLPREFMNU_VRQUADSTEREO = "Enable Quad Stereo"; +GLPREFMNU_VRQUADSTEREO = "Enable Quad Stereo (Requires Restart)"; GLPREFMNU_MULTISAMPLE = "Multisample"; GLPREFMNU_TONEMAP = "Tonemap Mode"; GLPREFMNU_BLOOM = "Bloom effect"; diff --git a/wadsrc/static/zscript/actor.txt b/wadsrc/static/zscript/actor.txt index 13f5140c9..ee464a35b 100644 --- a/wadsrc/static/zscript/actor.txt +++ b/wadsrc/static/zscript/actor.txt @@ -1030,7 +1030,7 @@ class Actor : Thinker native native void A_SpawnParticle(color color1, int flags = 0, int lifetime = 35, double size = 1, double angle = 0, double xoff = 0, double yoff = 0, double zoff = 0, double velx = 0, double vely = 0, double velz = 0, double accelx = 0, double accely = 0, double accelz = 0, double startalphaf = 1, double fadestepf = -1, double sizestep = 0); native void A_ExtChase(bool usemelee, bool usemissile, bool playactive = true, bool nightmarefast = false); native void A_DropInventory(class itemtype, int amount = -1); - native void A_SetBlend(color color1, double alpha, int tics, color color2 = 0); + native void A_SetBlend(color color1, double alpha, int tics, color color2 = 0, double alpha2 = 0.); deprecated("2.3") native void A_ChangeFlag(string flagname, bool value); native void A_ChangeCountFlags(int kill = FLAG_NO_CHANGE, int item = FLAG_NO_CHANGE, int secret = FLAG_NO_CHANGE); native void A_RaiseMaster(int flags = 0); diff --git a/wadsrc/static/zscript/base.txt b/wadsrc/static/zscript/base.txt index c0373fab0..237f8a084 100644 --- a/wadsrc/static/zscript/base.txt +++ b/wadsrc/static/zscript/base.txt @@ -547,6 +547,7 @@ 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; diff --git a/wadsrc/static/zscript/constants.txt b/wadsrc/static/zscript/constants.txt index dc4483253..e35af3a80 100644 --- a/wadsrc/static/zscript/constants.txt +++ b/wadsrc/static/zscript/constants.txt @@ -962,6 +962,7 @@ enum ESkillProperty SKILLP_EasyKey, SKILLP_SlowMonsters, SKILLP_Infight, + SKILLP_PlayerRespawn, }; enum EFSkillProperty // floating point properties {