From b1e2b2addf38bbb53af81ac03de08aaa09f12df2 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 18 Dec 2022 16:31:50 +0100 Subject: [PATCH] - backend cleanup from GZDoom. --- source/common/engine/d_event.cpp | 2 +- source/common/engine/namedef.h | 1 + source/common/scripting/backend/codegen.h | 3 +-- source/common/scripting/vm/vm.h | 6 +++++ source/common/textures/gametexture.h | 27 ++++++++++++++++++++++- source/common/textures/image.cpp | 6 ----- source/g_pch.h | 6 +++++ source/games/exhumed/src/movie.cpp | 1 - 8 files changed, 41 insertions(+), 11 deletions(-) diff --git a/source/common/engine/d_event.cpp b/source/common/engine/d_event.cpp index 130c65622..f10ff0b19 100644 --- a/source/common/engine/d_event.cpp +++ b/source/common/engine/d_event.cpp @@ -85,7 +85,7 @@ void D_ProcessEvents (void) UpdateJoystickMenu(I_UpdateDeviceList()); // allow the game to intercept Escape before dispatching it. - if (ev->type != EV_KeyDown || ev->data1 != KEY_ESCAPE || !sysCallbacks.WantEscape()) + if (ev->type != EV_KeyDown || ev->data1 != KEY_ESCAPE || !sysCallbacks.WantEscape || !sysCallbacks.WantEscape()) { if (gamestate != GS_INTRO) // GS_INTRO blocks the UI. { diff --git a/source/common/engine/namedef.h b/source/common/engine/namedef.h index 0f4fb6340..411db2bda 100644 --- a/source/common/engine/namedef.h +++ b/source/common/engine/namedef.h @@ -79,6 +79,7 @@ xx(__decorate_internal_float__) // Per-actor sound channels (for deprecated PlaySoundEx function) Do not separate this block!!! xx(Auto) xx(Weapon) +xx(BobPivot3D) xx(Voice) xx(Item) xx(Body) diff --git a/source/common/scripting/backend/codegen.h b/source/common/scripting/backend/codegen.h index e26cea84d..8a156a529 100644 --- a/source/common/scripting/backend/codegen.h +++ b/source/common/scripting/backend/codegen.h @@ -560,11 +560,10 @@ public: class FxVectorValue : public FxExpression { constexpr static int maxVectorDimensions = 4; - - FxExpression *xyzw[maxVectorDimensions]; bool isConst; // gets set to true if all element are const (used by function defaults parser) public: + FxExpression *xyzw[maxVectorDimensions]; friend class ZCCCompiler; diff --git a/source/common/scripting/vm/vm.h b/source/common/scripting/vm/vm.h index 4870f0048..3766e9d31 100644 --- a/source/common/scripting/vm/vm.h +++ b/source/common/scripting/vm/vm.h @@ -215,6 +215,11 @@ struct VMReturn Location = loc; RegType = REGT_FLOAT | REGT_MULTIREG2; } + void Vec3At(DVector3 *loc) + { + Location = loc; + RegType = REGT_FLOAT | REGT_MULTIREG3; + } void StringAt(FString *loc) { Location = loc; @@ -229,6 +234,7 @@ struct VMReturn VMReturn(int *loc) { IntAt(loc); } VMReturn(double *loc) { FloatAt(loc); } VMReturn(DVector2 *loc) { Vec2At(loc); } + VMReturn(DVector3 *loc) { Vec3At(loc); } VMReturn(FString *loc) { StringAt(loc); } VMReturn(void **loc) { PointerAt(loc); } }; diff --git a/source/common/textures/gametexture.h b/source/common/textures/gametexture.h index 814d14702..3eb3740a9 100644 --- a/source/common/textures/gametexture.h +++ b/source/common/textures/gametexture.h @@ -61,7 +61,7 @@ enum EGameTexFlags GTexf_AutoMaterialsAdded = 256, // AddAutoMaterials has been called on this texture. GTexf_OffsetsNotForFont = 512, // The offsets must be ignored when using this texture in a font. GTexf_NoTrim = 1024, // Don't perform trimming on this texture. - GTexf_Seen = 2024, // Set to true when the texture is being used for rendering. Must be cleared manually if the check is needed. + GTexf_Seen = 2048, // Set to true when the texture is being used for rendering. Must be cleared manually if the check is needed. }; struct FMaterialLayers @@ -375,6 +375,31 @@ public: if (!Layers) return nullptr; return Layers->Detailmap.get(); } + FTexture* GetNormalmap() + { + if (!Layers) return nullptr; + return Layers->Normal.get(); + } + FTexture* GetSpecularmap() + { + if (!Layers) return nullptr; + return Layers->Specular.get(); + } + FTexture* GetMetallic() + { + if (!Layers) return nullptr; + return Layers->Metallic.get(); + } + FTexture* GetRoughness() + { + if (!Layers) return nullptr; + return Layers->Roughness.get(); + } + FTexture* GetAmbientOcclusion() + { + if (!Layers) return nullptr; + return Layers->AmbientOcclusion.get(); + } void SetGlowmap(FTexture *T) { diff --git a/source/common/textures/image.cpp b/source/common/textures/image.cpp index aefab6488..c7b42ab60 100644 --- a/source/common/textures/image.cpp +++ b/source/common/textures/image.cpp @@ -82,9 +82,6 @@ PalettedPixels FImageSource::GetCachedPalettedPixels(int conversion) { PalettedPixels ret; - //FString name; - //fileSystem.GetFileShortName(name, SourceLump); - auto imageID = ImageID; // Do we have this image in the cache? @@ -196,9 +193,6 @@ FBitmap FImageSource::GetCachedBitmap(const PalEntry *remap, int conversion, int { FBitmap ret; - //FString name; - //fileSystem.GetFileShortName(name, SourceLump); - int trans = -1; auto imageID = ImageID; diff --git a/source/g_pch.h b/source/g_pch.h index efda66562..35803d9b6 100644 --- a/source/g_pch.h +++ b/source/g_pch.h @@ -4,10 +4,12 @@ #include #include #include +#include #include #include #include #include +#include #include #include #include @@ -15,6 +17,10 @@ #include #include #include +#ifdef _MSC_VER +#include +#include +#endif // _MSC_VER #include #include #include diff --git a/source/games/exhumed/src/movie.cpp b/source/games/exhumed/src/movie.cpp index 0248c92be..f581ebb13 100644 --- a/source/games/exhumed/src/movie.cpp +++ b/source/games/exhumed/src/movie.cpp @@ -139,7 +139,6 @@ public: } case kFrameSound: { - auto sfxx = soundEngine->GetSounds(); auto buffer = fp.Read(nSize); assert(buffer.Size() == kSampleSize); auto wbuffer = audio.samples + audio.nWrite * kSampleSize;