From 3fc0d0d794cc7e019bdc2c3895f0b59e776e37d1 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 7 Jun 2020 15:09:10 +0200 Subject: [PATCH] - backend changes from Raze, mainly to properly load keyboard presets. --- src/common/2d/v_2ddrawer.cpp | 2 +- src/common/2d/v_2ddrawer.h | 2 ++ src/common/2d/v_draw.cpp | 1 - src/common/console/c_bind.cpp | 24 ++++++++----------- .../hwrenderer/data/hw_viewpointbuffer.cpp | 4 ++-- .../hwrenderer/data/hw_viewpointbuffer.h | 2 +- 6 files changed, 16 insertions(+), 19 deletions(-) diff --git a/src/common/2d/v_2ddrawer.cpp b/src/common/2d/v_2ddrawer.cpp index b397cc88d..a7f6b2d7b 100644 --- a/src/common/2d/v_2ddrawer.cpp +++ b/src/common/2d/v_2ddrawer.cpp @@ -636,7 +636,7 @@ void F2DDrawer::AddPoly(FGameTexture *texture, FVector2 *points, int npoints, void F2DDrawer::AddPoly(FGameTexture* img, FVector4* vt, size_t vtcount, unsigned int* ind, size_t idxcount, int translation, PalEntry color, FRenderStyle style, int clipx1, int clipy1, int clipx2, int clipy2) { - RenderCommand dg = {}; + RenderCommand dg; int method = 0; dg.mType = DrawTypeTriangles; diff --git a/src/common/2d/v_2ddrawer.h b/src/common/2d/v_2ddrawer.h index bd8797d4c..00c0fcba1 100644 --- a/src/common/2d/v_2ddrawer.h +++ b/src/common/2d/v_2ddrawer.h @@ -132,6 +132,7 @@ public: FRenderStyle mRenderStyle; PalEntry mColor1; // Overlay color ETexMode mDrawMode; + uint8_t mLightLevel; uint8_t mFlags; RenderCommand() @@ -152,6 +153,7 @@ public: mRenderStyle == other.mRenderStyle && mDrawMode == other.mDrawMode && mFlags == other.mFlags && + mLightLevel == other.mLightLevel && mColor1.d == other.mColor1.d; } diff --git a/src/common/2d/v_draw.cpp b/src/common/2d/v_draw.cpp index dfb604c22..e05fe4f9f 100644 --- a/src/common/2d/v_draw.cpp +++ b/src/common/2d/v_draw.cpp @@ -40,7 +40,6 @@ #include "texturemanager.h" #include "r_videoscale.h" #include "c_cvars.h" -#include "intrect.h" EXTERN_CVAR(Int, vid_aspect) EXTERN_CVAR(Int, uiscale) diff --git a/src/common/console/c_bind.cpp b/src/common/console/c_bind.cpp index 7dcabf96c..5e82f5bd0 100644 --- a/src/common/console/c_bind.cpp +++ b/src/common/console/c_bind.cpp @@ -716,13 +716,8 @@ void C_SetDefaultKeys(const char* baseconfig) while ((lump = fileSystem.FindLumpFullName(baseconfig, &lastlump)) != -1) { - if (fileSystem.GetFileContainer(lump) > 0) break; - // [SW] - We need to check to see the origin of the DEFBINDS... if it - // Comes from an IWAD/IPK3/IPK7 allow it to override the users settings... - // If it comes from a user mod however, don't. - if (fileSystem.GetFileContainer(lump) > fileSystem.GetMaxIwadNum()) - ReadBindings(lump, false); - else + // Read this only from the main game resources. + if (fileSystem.GetFileContainer(lump) <= fileSystem.GetMaxIwadNum()) ReadBindings(lump, true); } @@ -752,6 +747,13 @@ void C_BindDefaults() C_SetDefaultKeys(cl_defaultconfiguration == 1 ? "engine/origbinds.txt" : cl_defaultconfiguration == 2 ? "engine/leftbinds.txt" : "engine/defbinds.txt"); } +void C_SetDefaultBindings() +{ + C_UnbindAll(); + C_BindDefaults(); +} + + CCMD(controlpreset) { if (argv.argc() < 2) @@ -762,7 +764,7 @@ CCMD(controlpreset) int v = atoi(argv[1]); if (v < 0 || v > 2) return; cl_defaultconfiguration = v; - C_BindDefaults(); + C_SetDefaultBindings(); } CCMD(binddefaults) @@ -770,12 +772,6 @@ CCMD(binddefaults) C_BindDefaults(); } -void C_SetDefaultBindings() -{ - C_UnbindAll(); - C_BindDefaults(); -} - //============================================================================= // // diff --git a/src/common/rendering/hwrenderer/data/hw_viewpointbuffer.cpp b/src/common/rendering/hwrenderer/data/hw_viewpointbuffer.cpp index d11284228..a265e7d11 100644 --- a/src/common/rendering/hwrenderer/data/hw_viewpointbuffer.cpp +++ b/src/common/rendering/hwrenderer/data/hw_viewpointbuffer.cpp @@ -73,7 +73,7 @@ int HWViewpointBuffer::Bind(FRenderState &di, unsigned int index) return index; } -void HWViewpointBuffer::Set2D(FRenderState &di, int width, int height) +void HWViewpointBuffer::Set2D(FRenderState &di, int width, int height, int pll) { if (width != m2DWidth || height != m2DHeight) { @@ -83,7 +83,7 @@ void HWViewpointBuffer::Set2D(FRenderState &di, int width, int height) matrices.mNormalViewMatrix.loadIdentity(); matrices.mViewHeight = 0; matrices.mGlobVis = 1.f; - matrices.mPalLightLevels = 0; + matrices.mPalLightLevels = pll; matrices.mClipLine.X = -10000000.0f; matrices.mShadowmapFilter = gl_shadowmap_filter; diff --git a/src/common/rendering/hwrenderer/data/hw_viewpointbuffer.h b/src/common/rendering/hwrenderer/data/hw_viewpointbuffer.h index 01389e01a..42c096704 100644 --- a/src/common/rendering/hwrenderer/data/hw_viewpointbuffer.h +++ b/src/common/rendering/hwrenderer/data/hw_viewpointbuffer.h @@ -28,7 +28,7 @@ public: ~HWViewpointBuffer(); void Clear(); int Bind(FRenderState &di, unsigned int index); - void Set2D(FRenderState &di, int width, int height); + void Set2D(FRenderState &di, int width, int height, int pll = 0); int SetViewpoint(FRenderState &di, HWViewpointUniforms *vp); unsigned int GetBlockSize() const { return mBlockSize; } };