Merge remote-tracking branch 'remotes/ZDoom/gzdoom/staging' into gzd_staging

This commit is contained in:
nashmuhandes 2023-08-22 09:09:51 +08:00
commit 9e0bf90be6
177 changed files with 4290 additions and 12626 deletions

View file

@ -120,6 +120,11 @@ bool M_LoadJoystickConfig(IJoystickConfig *joy)
{
return false;
}
value = GameConfig->GetValueForKey("Enabled");
if (value != NULL)
{
joy->SetEnabled((bool)atoi(value));
}
value = GameConfig->GetValueForKey("Sensitivity");
if (value != NULL)
{
@ -176,6 +181,10 @@ void M_SaveJoystickConfig(IJoystickConfig *joy)
if (GameConfig != NULL && M_SetJoystickConfigSection(joy, true, GameConfig))
{
GameConfig->ClearCurrentSection();
if (!joy->GetEnabled())
{
GameConfig->SetValueForKey("Enabled", "0");
}
if (!joy->IsSensitivityDefault())
{
mysnprintf(value, countof(value), "%g", joy->GetSensitivity());

View file

@ -18,7 +18,7 @@ enum EJoyAxis
};
// Generic configuration interface for a controller.
struct NOVTABLE IJoystickConfig
struct IJoystickConfig
{
virtual ~IJoystickConfig() = 0;
@ -36,6 +36,9 @@ struct NOVTABLE IJoystickConfig
virtual void SetAxisMap(int axis, EJoyAxis gameaxis) = 0;
virtual void SetAxisScale(int axis, float scale) = 0;
virtual bool GetEnabled() = 0;
virtual void SetEnabled(bool enabled) = 0;
// Used by the saver to not save properties that are at their defaults.
virtual bool IsSensitivityDefault() = 0;
virtual bool IsAxisDeadZoneDefault(int axis) = 0;

View file

@ -7,8 +7,9 @@
# define ATTRIBUTE(attrlist)
#endif
// This header collects all things printf, so that this doesn't need to pull in other, far more dirty headers, just for outputting some text.
#include "stb_sprintf.h"
// This header collects all things printf, so that this doesn't need to pull in other, far more dirty headers, just for outputting some text.
extern "C" int mysnprintf(char* buffer, size_t count, const char* format, ...) ATTRIBUTE((format(printf, 3, 4)));
extern "C" int myvsnprintf(char* buffer, size_t count, const char* format, va_list argptr) ATTRIBUTE((format(printf, 3, 0)));

View file

@ -55,6 +55,7 @@
#include "textures.h"
#include "texturemanager.h"
#include "base64.h"
#include "vm.h"
extern DObject *WP_NOCHANGE;
bool save_full = false; // for testing. Should be removed afterward.
@ -1567,6 +1568,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

@ -310,6 +310,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)
{