From 92bbaa7531fc04858c8e6abfdf7a080b868c42bd Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 19 Oct 2023 22:35:54 +0200 Subject: [PATCH] fix a few minor issues. * make Corona a fully scripted class so that AActor can be made final again. * add global vkversion variable for use by the survey code. * move progress bar on generic start screen to the bottom and made it longer. * revert BulletPuff to its GZDoom version because the changes are not compatible with Dehacked. --- src/CMakeLists.txt | 1 - .../rendering/vulkan/vk_renderdevice.cpp | 2 + .../startscreen/startscreen_generic.cpp | 4 +- src/playsim/a_corona.cpp | 32 ---------------- src/playsim/a_corona.h | 38 ------------------- src/playsim/actor.h | 2 +- .../hwrenderer/scene/hw_drawinfo.cpp | 17 +++++---- src/rendering/hwrenderer/scene/hw_drawinfo.h | 4 +- src/rendering/hwrenderer/scene/hw_sprites.cpp | 3 +- wadsrc/static/zscript/actors/doom/doommisc.zs | 5 ++- wadsrc/static/zscript/actors/shared/corona.zs | 2 +- 11 files changed, 21 insertions(+), 89 deletions(-) delete mode 100644 src/playsim/a_corona.cpp delete mode 100644 src/playsim/a_corona.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0bf553c922..c9835df23d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -861,7 +861,6 @@ set (PCH_SOURCES playsim/mapthinkers/dsectoreffect.cpp playsim/a_pickups.cpp playsim/a_action.cpp - playsim/a_corona.cpp playsim/a_decals.cpp playsim/a_dynlight.cpp playsim/a_flashfader.cpp diff --git a/src/common/rendering/vulkan/vk_renderdevice.cpp b/src/common/rendering/vulkan/vk_renderdevice.cpp index dcb88c9213..8e0b39558f 100644 --- a/src/common/rendering/vulkan/vk_renderdevice.cpp +++ b/src/common/rendering/vulkan/vk_renderdevice.cpp @@ -73,6 +73,7 @@ EXTERN_CVAR(Bool, cl_capfps) // Physical device info static std::vector SupportedDevices; +int vkversion; CUSTOM_CVAR(Bool, vk_debug, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL) { @@ -524,6 +525,7 @@ void VulkanRenderDevice::PrintStartupLog() FString apiVersion, driverVersion; apiVersion.Format("%d.%d.%d", VK_VERSION_MAJOR(props.apiVersion), VK_VERSION_MINOR(props.apiVersion), VK_VERSION_PATCH(props.apiVersion)); driverVersion.Format("%d.%d.%d", VK_VERSION_MAJOR(props.driverVersion), VK_VERSION_MINOR(props.driverVersion), VK_VERSION_PATCH(props.driverVersion)); + vkversion = VK_API_VERSION_MAJOR(props.apiVersion) * 100 + VK_API_VERSION_MINOR(props.apiVersion); Printf("Vulkan device: " TEXTCOLOR_ORANGE "%s\n", props.deviceName); Printf("Vulkan device type: %s\n", deviceType.GetChars()); diff --git a/src/common/startscreen/startscreen_generic.cpp b/src/common/startscreen/startscreen_generic.cpp index 5093dd848f..ca6f121283 100644 --- a/src/common/startscreen/startscreen_generic.cpp +++ b/src/common/startscreen/startscreen_generic.cpp @@ -107,11 +107,11 @@ bool FGenericStartScreen::DoProgress(int advance) if (CurPos < MaxPos) { RgbQuad bcolor = { 2, 25, 87, 255 }; // todo: make configurable - int numnotches = 100 * 2; + int numnotches = 200 * 2; notch_pos = ((CurPos + 1) * numnotches) / MaxPos; if (notch_pos != NotchPos) { // Time to draw another notch. - ClearBlock(StartupBitmap, bcolor, (320 - 50) * 2, 250 * 2, notch_pos, 4 * 2); + ClearBlock(StartupBitmap, bcolor, (320 - 100) * 2, 480 * 2 - 30, notch_pos, 4 * 2); NotchPos = notch_pos; StartupTexture->CleanHardwareData(true); } diff --git a/src/playsim/a_corona.cpp b/src/playsim/a_corona.cpp deleted file mode 100644 index 0e0cb4a980..0000000000 --- a/src/playsim/a_corona.cpp +++ /dev/null @@ -1,32 +0,0 @@ -/* -** Light Coronas -** Copyright (c) 2022 Nash Muhandes, Magnus Norddahl -** -** This software is provided 'as-is', without any express or implied -** warranty. In no event will the authors be held liable for any damages -** arising from the use of this software. -** -** Permission is granted to anyone to use this software for any purpose, -** including commercial applications, and to alter it and redistribute it -** freely, subject to the following restrictions: -** -** 1. The origin of this software must not be misrepresented; you must not -** claim that you wrote the original software. If you use this software -** in a product, an acknowledgment in the product documentation would be -** appreciated but is not required. -** 2. Altered source versions must be plainly marked as such, and must not be -** misrepresented as being the original software. -** 3. This notice may not be removed or altered from any source distribution. -*/ - - -#include "actor.h" -#include "a_corona.h" -#include "a_dynlight.h" - -IMPLEMENT_CLASS(ACorona, false, false) - -void ACorona::Tick() -{ - Super::Tick(); -} diff --git a/src/playsim/a_corona.h b/src/playsim/a_corona.h deleted file mode 100644 index 2c66f0a204..0000000000 --- a/src/playsim/a_corona.h +++ /dev/null @@ -1,38 +0,0 @@ -/* -** Light Coronas -** Copyright (c) 2022 Nash Muhandes, Magnus Norddahl -** -** This software is provided 'as-is', without any express or implied -** warranty. In no event will the authors be held liable for any damages -** arising from the use of this software. -** -** Permission is granted to anyone to use this software for any purpose, -** including commercial applications, and to alter it and redistribute it -** freely, subject to the following restrictions: -** -** 1. The origin of this software must not be misrepresented; you must not -** claim that you wrote the original software. If you use this software -** in a product, an acknowledgment in the product documentation would be -** appreciated but is not required. -** 2. Altered source versions must be plainly marked as such, and must not be -** misrepresented as being the original software. -** 3. This notice may not be removed or altered from any source distribution. -*/ - -#pragma once - -#include "actor.h" - -EXTERN_CVAR(Bool, gl_coronas) - -class AActor; - -class ACorona : public AActor -{ - DECLARE_CLASS(ACorona, AActor) - -public: - void Tick(); - - float CoronaFade = 0.0f; -}; diff --git a/src/playsim/actor.h b/src/playsim/actor.h index 0ebe2cc181..0520030292 100644 --- a/src/playsim/actor.h +++ b/src/playsim/actor.h @@ -744,7 +744,7 @@ public: const double MinVel = EQUAL_EPSILON; // Map Object definition. -class AActor : public DThinker +class AActor final : public DThinker { DECLARE_CLASS_WITH_META (AActor, DThinker, PClassActor) HAS_OBJECT_POINTERS diff --git a/src/rendering/hwrenderer/scene/hw_drawinfo.cpp b/src/rendering/hwrenderer/scene/hw_drawinfo.cpp index 40e6232ba9..d88c7c757d 100644 --- a/src/rendering/hwrenderer/scene/hw_drawinfo.cpp +++ b/src/rendering/hwrenderer/scene/hw_drawinfo.cpp @@ -44,7 +44,6 @@ #include "hw_clipper.h" #include "hw_meshcache.h" #include "v_draw.h" -#include "a_corona.h" #include "texturemanager.h" #include "actorinlines.h" #include "g_levellocals.h" @@ -565,7 +564,7 @@ void HWDrawInfo::RenderPortal(HWPortal *p, FRenderState &state, bool usestencil) } -void HWDrawInfo::DrawCorona(FRenderState& state, ACorona* corona, double dist) +void HWDrawInfo::DrawCorona(FRenderState& state, AActor* corona, float coronaFade, double dist) { spriteframe_t* sprframe = &SpriteFrames[sprites[corona->sprite].spriteframes + (size_t)corona->SpawnState->GetFrame()]; FTextureID patch = sprframe->Texture[0]; @@ -585,7 +584,7 @@ void HWDrawInfo::DrawCorona(FRenderState& state, ACorona* corona, double dist) float screenX = halfViewportWidth + clipPos.X * invW * halfViewportWidth; float screenY = halfViewportHeight - clipPos.Y * invW * halfViewportHeight; - float alpha = corona->CoronaFade * float(corona->Alpha); + float alpha = coronaFade * float(corona->Alpha); // distance-based fade - looks better IMO float distNearFadeStart = float(corona->RenderRadius()) * 0.1f; @@ -655,8 +654,10 @@ void HWDrawInfo::DrawCoronas(FRenderState& state) float timeElapsed = (screen->FrameTime - LastFrameTime) / 1000.0f; LastFrameTime = screen->FrameTime; - for (ACorona* corona : Coronas) + for (auto& coronap : Coronas) { + auto corona = coronap.first; + auto& coronaFade = coronap.second; auto cPos = corona->Vec3Offset(0., 0., corona->Height * 0.5); DVector3 direction = Viewpoint.Pos - cPos; double dist = direction.Length(); @@ -671,15 +672,15 @@ void HWDrawInfo::DrawCoronas(FRenderState& state) FTraceResults results; if (!Trace(cPos, corona->Sector, direction, dist, MF_SOLID, ML_BLOCKEVERYTHING, corona, results, 0, CheckForViewpointActor, &Viewpoint)) { - corona->CoronaFade = std::min(corona->CoronaFade + timeElapsed * fadeSpeed, 1.0f); + coronaFade = std::min(coronaFade + timeElapsed * fadeSpeed, 1.0f); } else { - corona->CoronaFade = std::max(corona->CoronaFade - timeElapsed * fadeSpeed, 0.0f); + coronaFade = std::max(coronaFade - timeElapsed * fadeSpeed, 0.0f); } - if (corona->CoronaFade > 0.0f) - DrawCorona(state, corona, dist); + if (coronaFade > 0.0f) + DrawCorona(state, corona, coronaFade, dist); } state.SetTextureMode(TM_NORMAL); diff --git a/src/rendering/hwrenderer/scene/hw_drawinfo.h b/src/rendering/hwrenderer/scene/hw_drawinfo.h index 27c7090427..1574d8c864 100644 --- a/src/rendering/hwrenderer/scene/hw_drawinfo.h +++ b/src/rendering/hwrenderer/scene/hw_drawinfo.h @@ -150,7 +150,7 @@ struct HWDrawInfo TArray Portals; TArray Decals[2]; // the second slot is for mirrors which get rendered in a separate pass. TArray hudsprites; // These may just be stored by value. - TArray Coronas; + TArray> Coronas; TArray VisibleSurfaces; uint64_t LastFrameTime = 0; @@ -316,7 +316,7 @@ public: void DrawDecals(FRenderState &state, TArray &decals); void DrawPlayerSprites(bool hudModelStep, FRenderState &state); void DrawCoronas(FRenderState& state); - void DrawCorona(FRenderState& state, ACorona* corona, double dist); + void DrawCorona(FRenderState& state, AActor* corona, float coronaFade, double dist); void ProcessLowerMinisegs(TArray &lowersegs, FRenderState& state); void AddSubsectorToPortal(FSectorPortalGroup *portal, subsector_t *sub); diff --git a/src/rendering/hwrenderer/scene/hw_sprites.cpp b/src/rendering/hwrenderer/scene/hw_sprites.cpp index c17795c5d4..70baef14b3 100644 --- a/src/rendering/hwrenderer/scene/hw_sprites.cpp +++ b/src/rendering/hwrenderer/scene/hw_sprites.cpp @@ -33,7 +33,6 @@ #include "r_sky.h" #include "r_utility.h" #include "a_pickups.h" -#include "a_corona.h" #include "d_player.h" #include "g_levellocals.h" #include "events.h" @@ -756,7 +755,7 @@ void HWSprite::Process(HWDrawInfo *di, FRenderState& state, AActor* thing, secto if (thing->IsKindOf(NAME_Corona)) { - di->Coronas.Push(static_cast(thing)); + di->Coronas.Push(std::make_pair(thing, 0)); return; } diff --git a/wadsrc/static/zscript/actors/doom/doommisc.zs b/wadsrc/static/zscript/actors/doom/doommisc.zs index c4e800eba9..a761f94e07 100644 --- a/wadsrc/static/zscript/actors/doom/doommisc.zs +++ b/wadsrc/static/zscript/actors/doom/doommisc.zs @@ -62,7 +62,8 @@ class BulletPuff : Actor +ALLOWPARTICLES +RANDOMIZE +ZDOOMTRANS - +FORCEXYBILLBOARD + RenderStyle "Translucent"; + Alpha 0.5; VSpeed 1; Mass 5; } @@ -72,7 +73,7 @@ class BulletPuff : Actor PUFF A 4 Bright; PUFF B 4; Melee: - PUFF CD 4 A_SetRenderStyle(0.7, STYLE_Translucent); + PUFF CD 4; Stop; } } diff --git a/wadsrc/static/zscript/actors/shared/corona.zs b/wadsrc/static/zscript/actors/shared/corona.zs index b0912b8feb..7310312f28 100644 --- a/wadsrc/static/zscript/actors/shared/corona.zs +++ b/wadsrc/static/zscript/actors/shared/corona.zs @@ -26,7 +26,7 @@ * *****************************************************************************/ -class Corona : Actor abstract native +class Corona : Actor abstract { Default {