From df0f06a5cefe7a3979c126ba5bc75862362d2137 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 14 Aug 2016 23:33:31 +0200 Subject: [PATCH 01/11] - fixed: FraggleScript's SetCamera function must call SetOrigin to set the camera's z. This needs updating of floorz and ceilingz, in case the camera is moved past a 3D floor. --- src/fragglescript/t_func.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/fragglescript/t_func.cpp b/src/fragglescript/t_func.cpp index f02843c89..deb4907a3 100644 --- a/src/fragglescript/t_func.cpp +++ b/src/fragglescript/t_func.cpp @@ -1452,7 +1452,8 @@ void FParser::SF_SetCamera(void) newcamera->specialf1 = newcamera->Angles.Yaw.Degrees; newcamera->specialf2 = newcamera->Z(); - newcamera->SetZ(t_argc < 3 ? newcamera->Z() + 41 : floatvalue(t_argv[2])); + double z = t_argc < 3 ? newcamera->Sector->floorplane.ZatPoint(newcamera) + 41 : floatvalue(t_argv[2]); + newcamera->SetOrigin(newcamera->PosAtZ(z), false); newcamera->Angles.Yaw = angle; if (t_argc < 4) newcamera->Angles.Pitch = 0.; else newcamera->Angles.Pitch = clamp(floatvalue(t_argv[3]), -50., 50.) * (20. / 32.); From c02960e2cf91f29aae2593d10eb2fb3d29dbf7fe Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 16 Aug 2016 08:58:29 +0200 Subject: [PATCH 02/11] - added error message highlighting for one overlooked DECORATE error. --- src/thingdef/thingdef.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/thingdef/thingdef.cpp b/src/thingdef/thingdef.cpp index 4878adfdf..dfc960627 100644 --- a/src/thingdef/thingdef.cpp +++ b/src/thingdef/thingdef.cpp @@ -343,7 +343,7 @@ static void FinishThingdef() if (!def) { - Printf("No ActorInfo defined for class '%s'\n", ti->TypeName.GetChars()); + Printf(TEXTCOLOR_RED "No ActorInfo defined for class '%s'\n", ti->TypeName.GetChars()); errorcount++; continue; } From aa2ca7741279efdb139c6a3a45bd6a271b9bdf63 Mon Sep 17 00:00:00 2001 From: Major Cooke Date: Fri, 12 Aug 2016 12:49:55 -0500 Subject: [PATCH 03/11] Added damagetype parameter and XF_NOACTORTYPE to A_Explode. - By default, A_Explode will refer to the actor's damagetype if using none. The flag forces the function's type if used regardless of type. --- src/thingdef/thingdef_codeptr.cpp | 12 ++++++++++-- wadsrc/static/actors/actor.txt | 2 +- wadsrc/static/actors/constants.txt | 1 + 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index b0cfbeba4..888e8db8e 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -1373,8 +1373,9 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfArmorType) enum { - XF_HURTSOURCE = 1, - XF_NOTMISSILE = 4, + XF_HURTSOURCE = 1, + XF_NOTMISSILE = 4, + XF_NOACTORTYPE = 1 << 3, }; DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Explode) @@ -1388,6 +1389,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Explode) PARAM_INT_OPT (nails) { nails = 0; } PARAM_INT_OPT (naildamage) { naildamage = 10; } PARAM_CLASS_OPT (pufftype, AActor) { pufftype = PClass::FindActor(NAME_BulletPuff); } + PARAM_NAME_OPT (damagetype) { damagetype = NAME_None; } if (damage < 0) // get parameters from metadata { @@ -1415,6 +1417,12 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Explode) } int count = P_RadiusAttack (self, self->target, damage, distance, self->DamageType, flags, fulldmgdistance); + if (!(flags & XF_NOACTORTYPE) && damagetype == NAME_None) + { + damagetype = self->DamageType; + } + + P_RadiusAttack (self, self->target, damage, distance, damagetype, flags, fulldmgdistance); P_CheckSplash(self, distance); if (alert && self->target != NULL && self->target->player != NULL) { diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index c80834fdc..b8bbcab14 100644 --- a/wadsrc/static/actors/actor.txt +++ b/wadsrc/static/actors/actor.txt @@ -253,7 +253,7 @@ ACTOR Actor native //: Thinker action native A_Blast(int flags = 0, float strength = 255, float radius = 255, float speed = 20, class blasteffect = "BlastEffect", sound blastsound = "BlastRadius"); action native A_RadiusThrust(int force = 128, int distance = -1, int flags = RTF_AFFECTSOURCE, int fullthrustdistance = 0); action native A_RadiusDamageSelf(int damage = 128, float distance = 128, int flags = 0, class flashtype = "None"); - action native int A_Explode(int damage = -1, int distance = -1, int flags = XF_HURTSOURCE, bool alert = false, int fulldamagedistance = 0, int nails = 0, int naildamage = 10, class pufftype = "BulletPuff"); + action native int A_Explode(int damage = -1, int distance = -1, int flags = XF_HURTSOURCE, bool alert = false, int fulldamagedistance = 0, int nails = 0, int naildamage = 10, class pufftype = "BulletPuff", name damagetype = "none"); action native A_Stop(); action native A_Respawn(int flags = 1); action native A_BarrelDestroy(); diff --git a/wadsrc/static/actors/constants.txt b/wadsrc/static/actors/constants.txt index 30afd1064..a3093a2c4 100644 --- a/wadsrc/static/actors/constants.txt +++ b/wadsrc/static/actors/constants.txt @@ -185,6 +185,7 @@ const int MSF_DontHurt = 2; // Flags for A_Explode const int XF_HURTSOURCE = 1; const int XF_NOTMISSILE = 4; +const int XF_NOACTORTYPE = 1 << 3; // Flags for A_RadiusThrust const int RTF_AFFECTSOURCE = 1; From e93b64f249c8e4139faa2144643f334fa35aaff7 Mon Sep 17 00:00:00 2001 From: Leonard2 Date: Sun, 14 Aug 2016 19:23:28 +0200 Subject: [PATCH 04/11] Fixed: a register from a return statement's value would not be freed --- src/thingdef/thingdef_expression.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/thingdef/thingdef_expression.cpp b/src/thingdef/thingdef_expression.cpp index 00c4b1e75..034c304c2 100644 --- a/src/thingdef/thingdef_expression.cpp +++ b/src/thingdef/thingdef_expression.cpp @@ -4757,6 +4757,8 @@ FxExpression *FxReturnStatement::Resolve(FCompileContext &ctx) ExpEmit FxReturnStatement::Emit(VMFunctionBuilder *build) { + ExpEmit out(0, REGT_NIL); + // If we return nothing, use a regular RET opcode. // Otherwise just return the value we're given. if (Value == nullptr) @@ -4765,11 +4767,11 @@ ExpEmit FxReturnStatement::Emit(VMFunctionBuilder *build) } else { - ExpEmit ret = Value->Emit(build); + out = Value->Emit(build); // Check if it is a function call that simplified itself // into a tail call in which case we don't emit anything. - if (!ret.Final) + if (!out.Final) { if (Value->ValueType == TypeVoid) { // Nothing is returned. @@ -4777,12 +4779,11 @@ ExpEmit FxReturnStatement::Emit(VMFunctionBuilder *build) } else { - build->Emit(OP_RET, RET_FINAL, ret.RegType | (ret.Konst ? REGT_KONST : 0), ret.RegNum); + build->Emit(OP_RET, RET_FINAL, out.RegType | (out.Konst ? REGT_KONST : 0), out.RegNum); } } } - ExpEmit out; out.Final = true; return out; } From 04c4147052bac594034463213dd06d4626ca13f2 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 16 Aug 2016 09:02:23 +0200 Subject: [PATCH 05/11] - renamed flag to be more descriptive. --- wadsrc/static/actors/constants.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wadsrc/static/actors/constants.txt b/wadsrc/static/actors/constants.txt index a3093a2c4..2a6f1c483 100644 --- a/wadsrc/static/actors/constants.txt +++ b/wadsrc/static/actors/constants.txt @@ -185,7 +185,7 @@ const int MSF_DontHurt = 2; // Flags for A_Explode const int XF_HURTSOURCE = 1; const int XF_NOTMISSILE = 4; -const int XF_NOACTORTYPE = 1 << 3; +const int XF_EXPLICITDAMAGETYPE = 1 << 3; // Flags for A_RadiusThrust const int RTF_AFFECTSOURCE = 1; From 314e89b84fe42c5dadce18a8833d3a03091115f6 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 16 Aug 2016 10:53:30 +0200 Subject: [PATCH 06/11] - fixed what looks like a copy/paste error in A_Explode. --- src/thingdef/thingdef_codeptr.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 888e8db8e..6c8b22301 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -1416,13 +1416,12 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Explode) } } - int count = P_RadiusAttack (self, self->target, damage, distance, self->DamageType, flags, fulldmgdistance); if (!(flags & XF_NOACTORTYPE) && damagetype == NAME_None) { damagetype = self->DamageType; } - P_RadiusAttack (self, self->target, damage, distance, damagetype, flags, fulldmgdistance); + int count = P_RadiusAttack (self, self->target, damage, distance, damagetype, flags, fulldmgdistance); P_CheckSplash(self, distance); if (alert && self->target != NULL && self->target->player != NULL) { From ca8ef7f3f37a1fe7f49f77d96eca0ac0dc8ceec6 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 16 Aug 2016 11:20:22 +0200 Subject: [PATCH 07/11] - moved bobbing menu strings into the correct file. --- wadsrc/static/language.eng | 2 -- wadsrc/static/language.enu | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wadsrc/static/language.eng b/wadsrc/static/language.eng index ed0f95a9a..ca27bf80a 100644 --- a/wadsrc/static/language.eng +++ b/wadsrc/static/language.eng @@ -108,5 +108,3 @@ CMPTMNU_SECTORSOUNDS = "Sector sounds use centre as source"; OPTVAL_MAPDEFINEDCOLORSONLY = "Map defined colours only"; C_GRAY = "\ccgrey"; C_DARKGRAY = "\cudark grey"; -DSPLYMNU_MOVEBOB = "View bob amount while moving"; -DSPLYMNU_STILLBOB = "View bob amount while not moving"; diff --git a/wadsrc/static/language.enu b/wadsrc/static/language.enu index 03212768e..d80c048b7 100644 --- a/wadsrc/static/language.enu +++ b/wadsrc/static/language.enu @@ -1800,6 +1800,8 @@ DSPLYMNU_QUAKEINTENSITY = "Earthquake shake intensity"; DSPLYMNU_NOMONSTERINTERPOLATION = "Interpolate monster movement"; DSPLYMNU_MENUDIM = "Menu dim"; DSPLYMNU_DIMCOLOR = "Dim color"; +DSPLYMNU_MOVEBOB = "View bob amount while moving"; +DSPLYMNU_STILLBOB = "View bob amount while not moving"; // HUD Options HUDMNU_TITLE = "HUD Options"; From 5ff0abe5681a519f05c1339c6d01e3e970178a81 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 20 Aug 2016 19:10:14 +0200 Subject: [PATCH 08/11] - removed STAT_INVENTORY. This was causing issues with sprite sorting. For this to work as intended, all actors in the world that display sprites need to remain in spawn order, including inventory items. The only thing this statnum was used for were some bot related search actions which are simply not worth breaking actual maps for some very minor performance gain. --- src/b_think.cpp | 2 +- src/g_level.cpp | 2 +- src/g_shared/a_pickups.cpp | 1 - src/statnums.h | 2 +- 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/b_think.cpp b/src/b_think.cpp index 0ff75722a..5a98b5c1a 100644 --- a/src/b_think.cpp +++ b/src/b_think.cpp @@ -259,7 +259,7 @@ void DBot::ThinkForMove (ticcmd_t *cmd) r = pr_botmove(); if (r < 128) { - TThinkerIterator it (STAT_INVENTORY, bglobal.firstthing); + TThinkerIterator it (MAX_STATNUM+1, bglobal.firstthing); AInventory *item = it.Next(); if (item != NULL || (item = it.Next()) != NULL) diff --git a/src/g_level.cpp b/src/g_level.cpp index e47cbb4a5..349d8f5a6 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -1280,7 +1280,7 @@ void G_FinishTravel () for (inv = pawn->Inventory; inv != NULL; inv = inv->Inventory) { - inv->ChangeStatNum (STAT_INVENTORY); + inv->ChangeStatNum (STAT_DEFAULT); inv->LinkToWorld (); inv->Travelled (); } diff --git a/src/g_shared/a_pickups.cpp b/src/g_shared/a_pickups.cpp index 6ad8e6e4a..e41a91d2f 100644 --- a/src/g_shared/a_pickups.cpp +++ b/src/g_shared/a_pickups.cpp @@ -572,7 +572,6 @@ bool AInventory::ShouldRespawn () void AInventory::BeginPlay () { Super::BeginPlay (); - ChangeStatNum (STAT_INVENTORY); flags |= MF_DROPPED; // [RH] Items are dropped by default } diff --git a/src/statnums.h b/src/statnums.h index 7f691e232..45bb53e65 100644 --- a/src/statnums.h +++ b/src/statnums.h @@ -53,7 +53,7 @@ enum STAT_BOSSTARGET, // A boss brain target STAT_LIGHTNING, // The lightning thinker STAT_DECALTHINKER, // An object that thinks for a decal - STAT_INVENTORY, // An inventory item + UNUSED_STAT_INVENTORY, // An inventory item (value kept for savegame compatibility.) STAT_LIGHT, // A sector light effect STAT_LIGHTTRANSFER, // A sector light transfer. These must be ticked after the light effects!!! STAT_EARTHQUAKE, // Earthquake actors From dde81b33ea39d0f6649794a94c1a12702511ff53 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 21 Aug 2016 08:45:21 +0200 Subject: [PATCH 09/11] - glEnable(GL_TEXTURE_2D) only makes sense if no shaders are being used. --- src/gl/system/gl_framebuffer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gl/system/gl_framebuffer.cpp b/src/gl/system/gl_framebuffer.cpp index c74009e1f..6d56c1b27 100644 --- a/src/gl/system/gl_framebuffer.cpp +++ b/src/gl/system/gl_framebuffer.cpp @@ -157,7 +157,7 @@ void OpenGLFrameBuffer::InitializeState() glEnable(GL_BLEND); glEnable(GL_DEPTH_CLAMP); glDisable(GL_DEPTH_TEST); - glEnable(GL_TEXTURE_2D); + if (gl.glslversion == 0) glEnable(GL_TEXTURE_2D); glDisable(GL_LINE_SMOOTH); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); From 3e01039bbb49dc4f80b92a418602ab5a947c7fce Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sun, 21 Aug 2016 15:47:56 +0300 Subject: [PATCH 10/11] Fixed missing #include for GCC/Clang --- src/gl/system/gl_debug.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gl/system/gl_debug.cpp b/src/gl/system/gl_debug.cpp index 9553345c9..52fbadf33 100644 --- a/src/gl/system/gl_debug.cpp +++ b/src/gl/system/gl_debug.cpp @@ -43,6 +43,7 @@ #include "gl/system/gl_interface.h" #include "gl/system/gl_debug.h" #include +#include #ifndef _MSC_VER #include From 302f59ea33f557da33ca9b4555b4ad4a150c4633 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Mon, 22 Aug 2016 01:52:51 +0200 Subject: [PATCH 11/11] Fix r_clearbuffer color not being used --- src/gl/renderer/gl_renderer.h | 2 ++ src/gl/scene/gl_scene.cpp | 10 +++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/gl/renderer/gl_renderer.h b/src/gl/renderer/gl_renderer.h index 1ce241da3..36654fad4 100644 --- a/src/gl/renderer/gl_renderer.h +++ b/src/gl/renderer/gl_renderer.h @@ -116,6 +116,8 @@ public: bool mDrawingScene2D = false; float mCameraExposure = 1.0f; + float mSceneClearColor[3]; + FGLRenderer(OpenGLFrameBuffer *fb); ~FGLRenderer() ; diff --git a/src/gl/scene/gl_scene.cpp b/src/gl/scene/gl_scene.cpp index b96b1d3b6..6e1f9a565 100644 --- a/src/gl/scene/gl_scene.cpp +++ b/src/gl/scene/gl_scene.cpp @@ -178,7 +178,7 @@ void FGLRenderer::Set3DViewport(bool mainview) // This is faster on newer hardware because it allows the GPU to skip // reading from slower memory where the full buffers are stored. glDisable(GL_SCISSOR_TEST); - glClearColor(0.0f, 0.0f, 0.0f, 0.0f); + glClearColor(mSceneClearColor[0], mSceneClearColor[1], mSceneClearColor[2], 1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); const auto &bounds = mSceneViewport; @@ -775,6 +775,9 @@ void FGLRenderer::SetFixedColormap (player_t *player) sector_t * FGLRenderer::RenderViewpoint (AActor * camera, GL_IRECT * bounds, float fov, float ratio, float fovratio, bool mainview, bool toscreen) { sector_t * retval; + mSceneClearColor[0] = 0.0f; + mSceneClearColor[1] = 0.0f; + mSceneClearColor[2] = 0.0f; R_SetupFrame (camera); SetViewArea(); @@ -1251,8 +1254,9 @@ int FGLInterface::GetMaxViewPitch(bool down) void FGLInterface::ClearBuffer(int color) { PalEntry pe = GPalette.BaseColors[color]; - glClearColor(pe.r/255.f, pe.g/255.f, pe.b/255.f, 1.f); - glClear(GL_COLOR_BUFFER_BIT); + GLRenderer->mSceneClearColor[0] = pe.r / 255.f; + GLRenderer->mSceneClearColor[1] = pe.g / 255.f; + GLRenderer->mSceneClearColor[2] = pe.b / 255.f; } //===========================================================================