Backend update from GZDoom.

Mostly missing headers
This commit is contained in:
Christoph Oelckers 2024-02-24 10:38:23 +01:00
parent c769de1828
commit b383a99065
14 changed files with 49 additions and 21 deletions

View file

@ -32,6 +32,7 @@
**
*/
#include <cmath>
#include "palutil.h"
#include "sc_man.h"
#include "m_crc32.h"

View file

@ -55,6 +55,7 @@
#include "textures.h"
#include "texturemanager.h"
#include "base64.h"
#include "vm.h"
#include "i_interface.h"
using namespace FileSys;
@ -1591,6 +1592,35 @@ template<> FSerializer &Serialize(FSerializer &arc, const char *key, Dictionary
}
}
template<> FSerializer& Serialize(FSerializer& arc, const char* key, VMFunction*& func, VMFunction**)
{
if (arc.isWriting())
{
arc.WriteKey(key);
if (func) arc.w->String(func->QualifiedName);
else arc.w->Null();
}
else
{
func = nullptr;
auto val = arc.r->FindKey(key);
if (val != nullptr && val->IsString())
{
auto qname = val->GetString();
size_t p = strcspn(qname, ".");
if (p != 0)
{
FName clsname(qname, p, true);
FName funcname(qname + p + 1, true);
func = PClass::FindFunction(clsname, funcname);
}
}
}
return arc;
}
//==========================================================================
//
// Handler to retrieve a numeric value of any kind.

View file

@ -324,6 +324,7 @@ inline FSerializer& Serialize(FSerializer& arc, const char* key, BitArray& value
template<> FSerializer& Serialize(FSerializer& arc, const char* key, PClass*& clst, PClass** def);
template<> FSerializer& Serialize(FSerializer& arc, const char* key, FFont*& font, FFont** def);
template<> FSerializer &Serialize(FSerializer &arc, const char *key, Dictionary *&dict, Dictionary **def);
template<> FSerializer& Serialize(FSerializer& arc, const char* key, VMFunction*& dict, VMFunction** def);
inline FSerializer &Serialize(FSerializer &arc, const char *key, DVector3 &p, DVector3 *def)
{

View file

@ -42,6 +42,7 @@
** compile with something other than Visual C++ or GCC.
*/
#include <cassert>
#include "autosegs.h"
#ifdef _WIN32

View file

@ -36,6 +36,7 @@
#define AUTOSEGS_H
#include <type_traits>
#include <cstdint>
#if defined(__clang__)
#if defined(__has_feature) && __has_feature(address_sanitizer)

View file

@ -268,7 +268,9 @@ protected:
friend class SDLInputJoystickManager;
};
const EJoyAxis SDLInputJoystick::DefaultAxes[5] = {JOYAXIS_Side, JOYAXIS_Forward, JOYAXIS_Pitch, JOYAXIS_Yaw, JOYAXIS_Up};
// [Nash 4 Feb 2024] seems like on Linux, the third axis is actually the Left Trigger, resulting in the player uncontrollably looking upwards.
const EJoyAxis SDLInputJoystick::DefaultAxes[5] = {JOYAXIS_Side, JOYAXIS_Forward, JOYAXIS_None, JOYAXIS_Yaw, JOYAXIS_Pitch};
class SDLInputJoystickManager
{

View file

@ -146,27 +146,11 @@ float VREyeInfo::getShift() const
return vr_swap_eyes ? -res : res;
}
VSMatrix VREyeInfo::GetProjection(float fov, float aspectRatio, float fovRatio, bool iso_ortho) const
VSMatrix VREyeInfo::GetProjection(float fov, float aspectRatio, float fovRatio) const
{
VSMatrix result;
if (iso_ortho) // Orthographic projection for isometric viewpoint
{
double zNear = -1.0; // screen->GetZNear();
double zFar = screen->GetZFar();
double fH = tan(DEG2RAD(fov) / 2) / fovRatio;
double fW = fH * aspectRatio * mScaleFactor;
double left = -fW;
double right = fW;
double bottom = -fH;
double top = fH;
VSMatrix fmat(1);
fmat.ortho((float)left, (float)right, (float)bottom, (float)top, (float)zNear, (float)zFar);
return fmat;
}
else if (mShiftFactor == 0)
if (mShiftFactor == 0)
{
float fovy = (float)(2 * RAD2DEG(atan(tan(DEG2RAD(fov) / 2) / fovRatio)));
result.perspective(fovy, aspectRatio, screen->GetZNear(), screen->GetZFar());

View file

@ -27,7 +27,7 @@ struct VREyeInfo
float mShiftFactor;
float mScaleFactor;
VSMatrix GetProjection(float fov, float aspectRatio, float fovRatio, bool iso_ortho) const;
VSMatrix GetProjection(float fov, float aspectRatio, float fovRatio) const;
DVector3 GetViewShift(float yaw) const;
private:
float getShift() const;

View file

@ -36,6 +36,7 @@
#ifndef __BITMAP_H__
#define __BITMAP_H__
#include <cstring>
#include "palentry.h"
struct FCopyInfo;

View file

@ -18,6 +18,8 @@
#ifndef MD5_H
#define MD5_H
#include <cstdint>
struct MD5Context
{
MD5Context() { Init(); }

View file

@ -35,8 +35,9 @@
bool gameisdead;
#ifdef _WIN32
#include <cstdarg>
#ifdef _WIN32
#include <windows.h>
#include "zstring.h"
void I_DebugPrint(const char *cp)

View file

@ -33,6 +33,8 @@
*/
#include <algorithm>
#include <cfloat>
#include <cmath>
#include "palutil.h"
#include "palentry.h"
#include "sc_man.h"

View file

@ -39,6 +39,7 @@
#include "files.h"
#include "m_swap.h"
#include "w_zip.h"
#include "fs_decompress.h"
using FileSys::FCompressedBuffer;

View file

@ -2,6 +2,7 @@
#include "netstartwindow.h"
#include "version.h"
#include "engineerrors.h"
#include "gstrings.h"
#include <zwidget/core/timer.h>
#include <zwidget/widgets/textlabel/textlabel.h>
#include <zwidget/widgets/pushbutton/pushbutton.h>