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.
This commit is contained in:
Christoph Oelckers 2023-10-19 22:35:54 +02:00 committed by Magnus Norddahl
parent 3cff0de273
commit 92bbaa7531
11 changed files with 21 additions and 89 deletions

View file

@ -861,7 +861,6 @@ set (PCH_SOURCES
playsim/mapthinkers/dsectoreffect.cpp playsim/mapthinkers/dsectoreffect.cpp
playsim/a_pickups.cpp playsim/a_pickups.cpp
playsim/a_action.cpp playsim/a_action.cpp
playsim/a_corona.cpp
playsim/a_decals.cpp playsim/a_decals.cpp
playsim/a_dynlight.cpp playsim/a_dynlight.cpp
playsim/a_flashfader.cpp playsim/a_flashfader.cpp

View file

@ -73,6 +73,7 @@ EXTERN_CVAR(Bool, cl_capfps)
// Physical device info // Physical device info
static std::vector<VulkanCompatibleDevice> SupportedDevices; static std::vector<VulkanCompatibleDevice> SupportedDevices;
int vkversion;
CUSTOM_CVAR(Bool, vk_debug, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL) CUSTOM_CVAR(Bool, vk_debug, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
{ {
@ -524,6 +525,7 @@ void VulkanRenderDevice::PrintStartupLog()
FString apiVersion, driverVersion; FString apiVersion, driverVersion;
apiVersion.Format("%d.%d.%d", VK_VERSION_MAJOR(props.apiVersion), VK_VERSION_MINOR(props.apiVersion), VK_VERSION_PATCH(props.apiVersion)); 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)); 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: " TEXTCOLOR_ORANGE "%s\n", props.deviceName);
Printf("Vulkan device type: %s\n", deviceType.GetChars()); Printf("Vulkan device type: %s\n", deviceType.GetChars());

View file

@ -107,11 +107,11 @@ bool FGenericStartScreen::DoProgress(int advance)
if (CurPos < MaxPos) if (CurPos < MaxPos)
{ {
RgbQuad bcolor = { 2, 25, 87, 255 }; // todo: make configurable RgbQuad bcolor = { 2, 25, 87, 255 }; // todo: make configurable
int numnotches = 100 * 2; int numnotches = 200 * 2;
notch_pos = ((CurPos + 1) * numnotches) / MaxPos; notch_pos = ((CurPos + 1) * numnotches) / MaxPos;
if (notch_pos != NotchPos) if (notch_pos != NotchPos)
{ // Time to draw another notch. { // 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; NotchPos = notch_pos;
StartupTexture->CleanHardwareData(true); StartupTexture->CleanHardwareData(true);
} }

View file

@ -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();
}

View file

@ -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;
};

View file

@ -744,7 +744,7 @@ public:
const double MinVel = EQUAL_EPSILON; const double MinVel = EQUAL_EPSILON;
// Map Object definition. // Map Object definition.
class AActor : public DThinker class AActor final : public DThinker
{ {
DECLARE_CLASS_WITH_META (AActor, DThinker, PClassActor) DECLARE_CLASS_WITH_META (AActor, DThinker, PClassActor)
HAS_OBJECT_POINTERS HAS_OBJECT_POINTERS

View file

@ -44,7 +44,6 @@
#include "hw_clipper.h" #include "hw_clipper.h"
#include "hw_meshcache.h" #include "hw_meshcache.h"
#include "v_draw.h" #include "v_draw.h"
#include "a_corona.h"
#include "texturemanager.h" #include "texturemanager.h"
#include "actorinlines.h" #include "actorinlines.h"
#include "g_levellocals.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()]; spriteframe_t* sprframe = &SpriteFrames[sprites[corona->sprite].spriteframes + (size_t)corona->SpawnState->GetFrame()];
FTextureID patch = sprframe->Texture[0]; 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 screenX = halfViewportWidth + clipPos.X * invW * halfViewportWidth;
float screenY = halfViewportHeight - clipPos.Y * invW * halfViewportHeight; 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 // distance-based fade - looks better IMO
float distNearFadeStart = float(corona->RenderRadius()) * 0.1f; float distNearFadeStart = float(corona->RenderRadius()) * 0.1f;
@ -655,8 +654,10 @@ void HWDrawInfo::DrawCoronas(FRenderState& state)
float timeElapsed = (screen->FrameTime - LastFrameTime) / 1000.0f; float timeElapsed = (screen->FrameTime - LastFrameTime) / 1000.0f;
LastFrameTime = screen->FrameTime; 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); auto cPos = corona->Vec3Offset(0., 0., corona->Height * 0.5);
DVector3 direction = Viewpoint.Pos - cPos; DVector3 direction = Viewpoint.Pos - cPos;
double dist = direction.Length(); double dist = direction.Length();
@ -671,15 +672,15 @@ void HWDrawInfo::DrawCoronas(FRenderState& state)
FTraceResults results; FTraceResults results;
if (!Trace(cPos, corona->Sector, direction, dist, MF_SOLID, ML_BLOCKEVERYTHING, corona, results, 0, CheckForViewpointActor, &Viewpoint)) 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 else
{ {
corona->CoronaFade = std::max(corona->CoronaFade - timeElapsed * fadeSpeed, 0.0f); coronaFade = std::max(coronaFade - timeElapsed * fadeSpeed, 0.0f);
} }
if (corona->CoronaFade > 0.0f) if (coronaFade > 0.0f)
DrawCorona(state, corona, dist); DrawCorona(state, corona, coronaFade, dist);
} }
state.SetTextureMode(TM_NORMAL); state.SetTextureMode(TM_NORMAL);

View file

@ -150,7 +150,7 @@ struct HWDrawInfo
TArray<HWPortal *> Portals; TArray<HWPortal *> Portals;
TArray<HWDecal *> Decals[2]; // the second slot is for mirrors which get rendered in a separate pass. TArray<HWDecal *> Decals[2]; // the second slot is for mirrors which get rendered in a separate pass.
TArray<HUDSprite> hudsprites; // These may just be stored by value. TArray<HUDSprite> hudsprites; // These may just be stored by value.
TArray<ACorona*> Coronas; TArray<std::pair<AActor*, float>> Coronas;
TArray<LevelMeshSurface*> VisibleSurfaces; TArray<LevelMeshSurface*> VisibleSurfaces;
uint64_t LastFrameTime = 0; uint64_t LastFrameTime = 0;
@ -316,7 +316,7 @@ public:
void DrawDecals(FRenderState &state, TArray<HWDecal *> &decals); void DrawDecals(FRenderState &state, TArray<HWDecal *> &decals);
void DrawPlayerSprites(bool hudModelStep, FRenderState &state); void DrawPlayerSprites(bool hudModelStep, FRenderState &state);
void DrawCoronas(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<seg_t *> &lowersegs, FRenderState& state); void ProcessLowerMinisegs(TArray<seg_t *> &lowersegs, FRenderState& state);
void AddSubsectorToPortal(FSectorPortalGroup *portal, subsector_t *sub); void AddSubsectorToPortal(FSectorPortalGroup *portal, subsector_t *sub);

View file

@ -33,7 +33,6 @@
#include "r_sky.h" #include "r_sky.h"
#include "r_utility.h" #include "r_utility.h"
#include "a_pickups.h" #include "a_pickups.h"
#include "a_corona.h"
#include "d_player.h" #include "d_player.h"
#include "g_levellocals.h" #include "g_levellocals.h"
#include "events.h" #include "events.h"
@ -756,7 +755,7 @@ void HWSprite::Process(HWDrawInfo *di, FRenderState& state, AActor* thing, secto
if (thing->IsKindOf(NAME_Corona)) if (thing->IsKindOf(NAME_Corona))
{ {
di->Coronas.Push(static_cast<ACorona*>(thing)); di->Coronas.Push(std::make_pair(thing, 0));
return; return;
} }

View file

@ -62,7 +62,8 @@ class BulletPuff : Actor
+ALLOWPARTICLES +ALLOWPARTICLES
+RANDOMIZE +RANDOMIZE
+ZDOOMTRANS +ZDOOMTRANS
+FORCEXYBILLBOARD RenderStyle "Translucent";
Alpha 0.5;
VSpeed 1; VSpeed 1;
Mass 5; Mass 5;
} }
@ -72,7 +73,7 @@ class BulletPuff : Actor
PUFF A 4 Bright; PUFF A 4 Bright;
PUFF B 4; PUFF B 4;
Melee: Melee:
PUFF CD 4 A_SetRenderStyle(0.7, STYLE_Translucent); PUFF CD 4;
Stop; Stop;
} }
} }

View file

@ -26,7 +26,7 @@
* *
*****************************************************************************/ *****************************************************************************/
class Corona : Actor abstract native class Corona : Actor abstract
{ {
Default Default
{ {