From ff0b87932356181232e9912c512d98288e91596d Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 2 Oct 2016 00:31:25 +0200 Subject: [PATCH 1/3] - added UDMF portal flags. Names are identical with Eternity for compatibility reasons. --- specs/udmf_zdoom.txt | 13 +++++++++++ src/namedef.h | 15 ++++++++++++ src/p_udmf.cpp | 54 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 82 insertions(+) diff --git a/specs/udmf_zdoom.txt b/specs/udmf_zdoom.txt index 611a667af..9662af1bb 100644 --- a/specs/udmf_zdoom.txt +++ b/specs/udmf_zdoom.txt @@ -214,6 +214,19 @@ Note: All fields default to false unless mentioned otherwise. damagehazard = ; // Changes damage model to Strife's delayed damage for the given sector. Default = false. floorterrain = ; // Sets the terrain for the sector's floor. Default = 'use the flat texture's terrain definition.' ceilingterrain = ; // Sets the terrain for the sector's ceiling. Default = 'use the flat texture's terrain definition.' + + portal_ceil_alpha = // translucency of ceiling portal (default is 0 (not visible)) + portal_ceil_blocksound = // ceiling portal blocks sound. + portal_ceil_disabled = // ceiling portal disabled. + portal_ceil_nopass = // ceiling portal blocks movement if true. + portal_ceil_norender = // ceiling portal not rendered. + portal_ceil_overlaytype = // defines translucency style, can either be "translucent" or "additive". Default is "translucent". + portal_floor_alpha = // translucency of floor portal (default is 0 (not visible)) + portal_floor_blocksound = // floor portal blocks sound. + portal_floor_disabled = // floor portal disabled. + portal_floor_nopass = // ceiling portal blocks movement if true. + portal_floor_norender = // ceiling portal not rendered. + portal_floor_overlaytype = // defines translucency style, can either be "translucent" or "additive". Default is "translucent". * Note about dropactors diff --git a/src/namedef.h b/src/namedef.h index c8b0d1524..36953e385 100644 --- a/src/namedef.h +++ b/src/namedef.h @@ -507,6 +507,21 @@ xx(Alphaceiling) xx(Renderstylefloor) xx(Renderstyleceiling) xx(Waterzone) +xx(portal_ceil_alpha) +xx(portal_ceil_blocksound) +xx(portal_ceil_disabled) +xx(portal_ceil_nopass) +xx(portal_ceil_norender) +xx(portal_ceil_overlaytype) +xx(portal_ceil_useglobaltex) +xx(portal_floor_alpha) +xx(portal_floor_blocksound) +xx(portal_floor_disabled) +xx(portal_floor_nopass) +xx(portal_floor_norender) +xx(portal_floor_overlaytype) +xx(portal_floor_useglobaltex) + xx(offsetx_top) xx(offsety_top) diff --git a/src/p_udmf.cpp b/src/p_udmf.cpp index c09debc51..c1a64f84b 100644 --- a/src/p_udmf.cpp +++ b/src/p_udmf.cpp @@ -1568,6 +1568,60 @@ public: tagstring = CheckString(key); break; + case NAME_portal_ceil_alpha: + sec->planes[sector_t::ceiling].alpha = CheckFloat(key); + break; + + case NAME_portal_ceil_blocksound: + Flag(sec->planes[sector_t::ceiling].Flags, PLANEF_BLOCKSOUND, key); + break; + + case NAME_portal_ceil_disabled: + Flag(sec->planes[sector_t::ceiling].Flags, PLANEF_DISABLED, key); + break; + + case NAME_portal_ceil_nopass: + Flag(sec->planes[sector_t::ceiling].Flags, PLANEF_NOPASS, key); + break; + + case NAME_portal_ceil_norender: + Flag(sec->planes[sector_t::ceiling].Flags, PLANEF_NORENDER, key); + break; + + case NAME_portal_ceil_overlaytype: + if (!stricmp(CheckString(key), "translucent")) sec->planes[sector_t::ceiling].Flags &= ~PLANEF_ADDITIVE; + else if (!stricmp(CheckString(key), "additive")) sec->planes[sector_t::ceiling].Flags |= PLANEF_ADDITIVE; + break; + + case NAME_portal_floor_alpha: + sec->planes[sector_t::floor].alpha = CheckFloat(key); + break; + + case NAME_portal_floor_blocksound: + Flag(sec->planes[sector_t::floor].Flags, PLANEF_BLOCKSOUND, key); + break; + + case NAME_portal_floor_disabled: + Flag(sec->planes[sector_t::floor].Flags, PLANEF_DISABLED, key); + break; + + case NAME_portal_floor_nopass: + Flag(sec->planes[sector_t::floor].Flags, PLANEF_NOPASS, key); + break; + + case NAME_portal_floor_norender: + Flag(sec->planes[sector_t::floor].Flags, PLANEF_NORENDER, key); + break; + + case NAME_portal_floor_overlaytype: + if (!stricmp(CheckString(key), "translucent")) sec->planes[sector_t::floor].Flags &= ~PLANEF_ADDITIVE; + else if (!stricmp(CheckString(key), "additive")) sec->planes[sector_t::floor].Flags |= PLANEF_ADDITIVE; + break; + + // These two are used by Eternity for something I do not understand. + //case NAME_portal_ceil_useglobaltex: + //case NAME_portal_floor_useglobaltex: + default: break; } From 80f2f5829f50a6ae7094c6b8989d680dee59375e Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 2 Oct 2016 00:43:05 +0200 Subject: [PATCH 2/3] - added A_SetRenderStyle function which replaces A_SetTranslucent. A_SetTranslucent had to be deprecated due to obsolete semantics of the renderstyle argument. --- src/thingdef/thingdef_codeptr.cpp | 16 ++++++++++++++++ wadsrc/static/actors/actor.txt | 1 + wadsrc/static/actors/constants.txt | 20 +++++++++++++++++++- 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 153c3b597..ee64df4d0 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -3322,6 +3322,22 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetTranslucent) return 0; } +//=========================================================================== +// +// A_SetRenderStyle +// +//=========================================================================== +DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetRenderStyle) +{ + PARAM_SELF_PROLOGUE(AActor); + PARAM_FLOAT(alpha); + PARAM_INT_OPT(mode) { mode = 0; } + + self->Alpha = clamp(alpha, 0., 1.); + self->RenderStyle = ERenderStyle(mode); + return 0; +} + //=========================================================================== // // A_FadeIn diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index 3354b91d6..fc73b02f3 100644 --- a/wadsrc/static/actors/actor.txt +++ b/wadsrc/static/actors/actor.txt @@ -218,6 +218,7 @@ ACTOR Actor native //: Thinker native void A_LogInt(int whattoprint); native void A_LogFloat(float whattoprint); native void A_SetTranslucent(float alpha, int style = 0); + native void A_SetRenderStyle(float alpha, int style = 0); action native A_FadeIn(float reduce = 0.1, int flags = 0); action native A_FadeOut(float reduce = 0.1, int flags = 1); //bool remove == true native void A_FadeTo(float target, float amount = 0.1, int flags = 0); diff --git a/wadsrc/static/actors/constants.txt b/wadsrc/static/actors/constants.txt index bd6d65643..dce2488c2 100644 --- a/wadsrc/static/actors/constants.txt +++ b/wadsrc/static/actors/constants.txt @@ -689,4 +689,22 @@ enum VRF_NOANGLE = VRF_NOANGLESTART|VRF_NOANGLEEND, VRF_NOPITCH = VRF_NOPITCHSTART|VRF_NOPITCHEND, -}; \ No newline at end of file +}; + +enum +{ + STYLE_None, + STYLE_Normal, + STYLE_Fuzzy, + STYLE_SoulTrans, + STYLE_OptFuzzy, + STYLE_Stencil, + STYLE_Translucent, + STYLE_Add, + STYLE_Shaded, + STYLE_TranslucentStencil, + STYLE_Shadow, + STYLE_Subtract, + STYLE_AddStencil, + STYLE_AddShaded, +}; From 51ffd6d9c64eb2ae5fdf572c32087337ab1042c8 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 2 Oct 2016 01:00:07 +0200 Subject: [PATCH 3/3] - fixed some warnings. - A_SetRenderStyle should not default to STYLE_None. --- src/p_mobj.cpp | 2 +- src/serializer.cpp | 1 - wadsrc/static/actors/actor.txt | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 90a800fa7..e39a07b2d 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -3526,7 +3526,7 @@ void AActor::Tick () sector_t *sec = node->m_sector; DVector2 scrollv; - if (level.Scrolls.Size() > (sec-sectors)) + if (level.Scrolls.Size() > unsigned(sec-sectors)) { scrollv = level.Scrolls[sec - sectors]; } diff --git a/src/serializer.cpp b/src/serializer.cpp index 47e096b7b..a4714292a 100644 --- a/src/serializer.cpp +++ b/src/serializer.cpp @@ -821,7 +821,6 @@ void FSerializer::WriteObjects() for (unsigned i = 0; i < w->mDObjects.Size(); i++) { auto obj = w->mDObjects[i]; - player_t *player; BeginObject(nullptr); w->Key("classtype"); diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index fc73b02f3..713e1497f 100644 --- a/wadsrc/static/actors/actor.txt +++ b/wadsrc/static/actors/actor.txt @@ -218,7 +218,7 @@ ACTOR Actor native //: Thinker native void A_LogInt(int whattoprint); native void A_LogFloat(float whattoprint); native void A_SetTranslucent(float alpha, int style = 0); - native void A_SetRenderStyle(float alpha, int style = 0); + native void A_SetRenderStyle(float alpha, int style); action native A_FadeIn(float reduce = 0.1, int flags = 0); action native A_FadeOut(float reduce = 0.1, int flags = 1); //bool remove == true native void A_FadeTo(float target, float amount = 0.1, int flags = 0);