mirror of
https://github.com/ZDoom/Raze.git
synced 2025-03-23 01:11:30 +00:00
- backend update from GZDoom.
* cleanup on the sound init code. * added #pragma once in several headers. * macOS version detection overhaul.
This commit is contained in:
parent
706c784965
commit
6aa61e72b5
32 changed files with 135 additions and 91 deletions
|
@ -40,7 +40,6 @@
|
|||
#include <zlib.h>
|
||||
|
||||
#include <zmusic.h>
|
||||
#include "m_argv.h"
|
||||
#include "filesystem.h"
|
||||
#include "c_dispatch.h"
|
||||
|
||||
|
@ -218,13 +217,13 @@ static void SetupDMXGUS()
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void I_InitMusic(void)
|
||||
void I_InitMusic(int musicstate)
|
||||
{
|
||||
I_InitSoundFonts();
|
||||
|
||||
snd_musicvolume->Callback ();
|
||||
|
||||
nomusic = !!Args->CheckParm("-nomusic") || !!Args->CheckParm("-nosound");
|
||||
nomusic = musicstate;
|
||||
|
||||
snd_mididevice->Callback();
|
||||
|
||||
|
|
|
@ -34,27 +34,16 @@
|
|||
#ifndef __I_MUSIC_H__
|
||||
#define __I_MUSIC_H__
|
||||
|
||||
#include "c_cvars.h"
|
||||
|
||||
class FileReader;
|
||||
struct FOptionValues;
|
||||
|
||||
//
|
||||
// MUSIC I/O
|
||||
//
|
||||
void I_InitMusic ();
|
||||
void I_BuildMIDIMenuList (FOptionValues *);
|
||||
void I_InitMusic (int);
|
||||
|
||||
// Volume.
|
||||
void I_SetRelativeVolume(float);
|
||||
void I_SetMusicVolume (double volume);
|
||||
|
||||
|
||||
extern int nomusic;
|
||||
|
||||
EXTERN_CVAR(Bool, mus_enabled)
|
||||
EXTERN_CVAR(Float, snd_musicvolume)
|
||||
|
||||
|
||||
inline float AmplitudeTodB(float amplitude)
|
||||
{
|
||||
|
|
|
@ -53,9 +53,11 @@
|
|||
#include "gain_analysis.h"
|
||||
#include "i_specialpaths.h"
|
||||
#include "configfile.h"
|
||||
#include "c_cvars.h"
|
||||
|
||||
// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
|
||||
|
||||
extern int nomusic;
|
||||
extern float S_GetMusicVolume (const char *music);
|
||||
|
||||
static void S_ActivatePlayList(bool goBack);
|
||||
|
@ -81,6 +83,8 @@ static MusicCallbacks mus_cb = { nullptr, DefaultOpenMusic };
|
|||
|
||||
|
||||
// PUBLIC DATA DEFINITIONS -------------------------------------------------
|
||||
EXTERN_CVAR(Bool, mus_enabled)
|
||||
EXTERN_CVAR(Float, snd_musicvolume)
|
||||
EXTERN_CVAR(Int, snd_mididevice)
|
||||
EXTERN_CVAR(Float, mod_dumb_mastervolume)
|
||||
EXTERN_CVAR(Float, fluid_gain)
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
#include <stdint.h>
|
||||
|
||||
#include "vectors.h"
|
||||
#include "tarray.h"
|
||||
#include "tflags.h"
|
||||
|
||||
enum EChanFlag
|
||||
|
@ -38,8 +37,6 @@ enum EChanFlag
|
|||
typedef TFlags<EChanFlag> EChanFlags;
|
||||
DEFINE_TFLAGS_OPERATORS(EChanFlags)
|
||||
|
||||
class FileReader;
|
||||
|
||||
// For convenience, this structure matches FMOD_REVERB_PROPERTIES.
|
||||
// Since I can't very well #include system-specific stuff in the
|
||||
// main game files, I duplicate it here.
|
||||
|
@ -78,14 +75,17 @@ struct REVERB_PROPERTIES
|
|||
unsigned int Flags;
|
||||
};
|
||||
|
||||
#define REVERB_FLAGS_DECAYTIMESCALE 0x00000001
|
||||
#define REVERB_FLAGS_REFLECTIONSSCALE 0x00000002
|
||||
#define REVERB_FLAGS_REFLECTIONSDELAYSCALE 0x00000004
|
||||
#define REVERB_FLAGS_REVERBSCALE 0x00000008
|
||||
#define REVERB_FLAGS_REVERBDELAYSCALE 0x00000010
|
||||
#define REVERB_FLAGS_DECAYHFLIMIT 0x00000020
|
||||
#define REVERB_FLAGS_ECHOTIMESCALE 0x00000040
|
||||
#define REVERB_FLAGS_MODULATIONTIMESCALE 0x00000080
|
||||
enum EReverbFlags
|
||||
{
|
||||
REVERB_FLAGS_DECAYTIMESCALE = 0x00000001,
|
||||
REVERB_FLAGS_REFLECTIONSSCALE = 0x00000002,
|
||||
REVERB_FLAGS_REFLECTIONSDELAYSCALE = 0x00000004,
|
||||
REVERB_FLAGS_REVERBSCALE = 0x00000008,
|
||||
REVERB_FLAGS_REVERBDELAYSCALE = 0x00000010,
|
||||
REVERB_FLAGS_DECAYHFLIMIT = 0x00000020,
|
||||
REVERB_FLAGS_ECHOTIMESCALE = 0x00000040,
|
||||
REVERB_FLAGS_MODULATIONTIMESCALE = 0x00000080,
|
||||
};
|
||||
|
||||
struct ReverbContainer
|
||||
{
|
||||
|
@ -144,8 +144,6 @@ struct FISoundChannel
|
|||
EChanFlags ChanFlags;
|
||||
};
|
||||
|
||||
class SoundStream;
|
||||
|
||||
void S_SetSoundPaused(int state);
|
||||
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#pragma once
|
||||
#include <string>
|
||||
#include "zstring.h"
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
**---------------------------------------------------------------------------
|
||||
**
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
|
|
|
@ -367,7 +367,7 @@ static bool IndexOutOfRange(const int start1, const int end1, const int start2,
|
|||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
bool FRemapTable::operator==(const FRemapTable& o)
|
||||
bool FRemapTable::operator==(const FRemapTable& o) const
|
||||
{
|
||||
// Two translations are identical when they have the same amount of colors
|
||||
// and the palette values for both are identical.
|
||||
|
|
|
@ -19,7 +19,7 @@ struct FRemapTable
|
|||
FRemapTable(const FRemapTable& o) = default;
|
||||
FRemapTable& operator=(const FRemapTable& o) = default;
|
||||
|
||||
bool operator==(const FRemapTable& o);
|
||||
bool operator==(const FRemapTable& o) const;
|
||||
void MakeIdentity();
|
||||
bool IsIdentity() const;
|
||||
bool AddIndexRange(int start, int end, int pal1, int pal2);
|
||||
|
|
|
@ -234,6 +234,7 @@ FSerializer &Serialize(FSerializer &arc, const char *key, FName &value, FName *d
|
|||
FSerializer &Serialize(FSerializer &arc, const char *key, FSoundID &sid, FSoundID *def);
|
||||
FSerializer &Serialize(FSerializer &arc, const char *key, FString &sid, FString *def);
|
||||
FSerializer &Serialize(FSerializer &arc, const char *key, NumericValue &sid, NumericValue *def);
|
||||
FSerializer &Serialize(FSerializer &arc, const char *key, struct ModelOverride &sid, struct ModelOverride *def);
|
||||
|
||||
template <typename T/*, typename = std::enable_if_t<std::is_base_of_v<DObject, T>>*/>
|
||||
FSerializer &Serialize(FSerializer &arc, const char *key, T *&value, T **)
|
||||
|
@ -244,7 +245,6 @@ FSerializer &Serialize(FSerializer &arc, const char *key, T *&value, T **)
|
|||
return arc;
|
||||
}
|
||||
|
||||
|
||||
template<class T, class TT>
|
||||
FSerializer &Serialize(FSerializer &arc, const char *key, TArray<T, TT> &value, TArray<T, TT> *def)
|
||||
{
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#pragma once
|
||||
const char* UnicodeToString(const char* cc);
|
||||
const char* StringToUnicode(const char* cc, int size = -1);
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#pragma once
|
||||
#include "files.h"
|
||||
#include "engineerrors.h"
|
||||
|
||||
|
|
|
@ -1662,6 +1662,7 @@ static void InitMusicMenus()
|
|||
// Special menus will be created once all engine data is loaded
|
||||
//
|
||||
//=============================================================================
|
||||
void I_BuildMIDIMenuList(FOptionValues*);
|
||||
|
||||
void M_CreateMenus()
|
||||
{
|
||||
|
|
|
@ -231,6 +231,8 @@ void PClass::StaticInit ()
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void ClearServices();
|
||||
|
||||
void PClass::StaticShutdown ()
|
||||
{
|
||||
if (WP_NOCHANGE != nullptr)
|
||||
|
@ -238,6 +240,7 @@ void PClass::StaticShutdown ()
|
|||
delete WP_NOCHANGE;
|
||||
}
|
||||
|
||||
ClearServices();
|
||||
// delete all variables containing pointers to script functions.
|
||||
for (auto p : FunctionPtrList)
|
||||
{
|
||||
|
|
|
@ -1202,7 +1202,10 @@ void I_GetJoysticks(TArray<IJoystickConfig*>& sticks)
|
|||
|
||||
void I_GetAxes(float axes[NUM_JOYAXIS])
|
||||
{
|
||||
memset(axes, 0, sizeof(float) * NUM_JOYAXIS);
|
||||
for (size_t i = 0; i < NUM_JOYAXIS; ++i)
|
||||
{
|
||||
axes[i] = 0.0f;
|
||||
}
|
||||
|
||||
if (use_joystick && NULL != s_joystickManager)
|
||||
{
|
||||
|
|
|
@ -151,21 +151,24 @@ void I_DetectOS()
|
|||
case 10:
|
||||
switch (version.minorVersion)
|
||||
{
|
||||
case 12: name = "macOS Sierra"; break;
|
||||
case 13: name = "macOS High Sierra"; break;
|
||||
case 14: name = "macOS Mojave"; break;
|
||||
case 15: name = "macOS Catalina"; break;
|
||||
case 16: name = "macOS Big Sur"; break;
|
||||
case 12: name = "Sierra"; break;
|
||||
case 13: name = "High Sierra"; break;
|
||||
case 14: name = "Mojave"; break;
|
||||
case 15: name = "Catalina"; break;
|
||||
case 16: name = "Big Sur"; break;
|
||||
}
|
||||
break;
|
||||
case 11:
|
||||
name = "macOS Big Sur";
|
||||
name = "Big Sur";
|
||||
break;
|
||||
case 12:
|
||||
name = "macOS Monterey";
|
||||
name = "Monterey";
|
||||
break;
|
||||
case 13:
|
||||
name = "macOS Ventura";
|
||||
name = "Ventura";
|
||||
break;
|
||||
case 14:
|
||||
name = "Sonoma";
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -186,7 +189,7 @@ void I_DetectOS()
|
|||
"Unknown";
|
||||
#endif
|
||||
|
||||
Printf("%s running %s %d.%d.%d (%s) %s\n", model, name,
|
||||
Printf("%s running macOS %s %d.%d.%d (%s) %s\n", model, name,
|
||||
int(version.majorVersion), int(version.minorVersion), int(version.patchVersion),
|
||||
release, architecture);
|
||||
}
|
||||
|
|
|
@ -324,8 +324,10 @@ void I_GetJoysticks(TArray<IJoystickConfig *> &sticks)
|
|||
|
||||
void I_GetAxes(float axes[NUM_JOYAXIS])
|
||||
{
|
||||
memset(axes, 0, sizeof(float) * NUM_JOYAXIS);
|
||||
|
||||
for (int i = 0; i < NUM_JOYAXIS; ++i)
|
||||
{
|
||||
axes[i] = 0;
|
||||
}
|
||||
if (use_joystick && JoystickManager)
|
||||
{
|
||||
JoystickManager->AddAxes(axes);
|
||||
|
|
|
@ -257,6 +257,7 @@ bool FTTYStartupScreen::NetLoop(bool (*timer_callback)(void *), void *userdata)
|
|||
struct timeval tv;
|
||||
int retval;
|
||||
char k;
|
||||
bool stdin_eof = false;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
|
@ -265,7 +266,10 @@ bool FTTYStartupScreen::NetLoop(bool (*timer_callback)(void *), void *userdata)
|
|||
tv.tv_usec = 500000;
|
||||
|
||||
FD_ZERO (&rfds);
|
||||
FD_SET (STDIN_FILENO, &rfds);
|
||||
if (!stdin_eof)
|
||||
{
|
||||
FD_SET (STDIN_FILENO, &rfds);
|
||||
}
|
||||
|
||||
retval = select (1, &rfds, NULL, NULL, &tv);
|
||||
|
||||
|
@ -281,13 +285,21 @@ bool FTTYStartupScreen::NetLoop(bool (*timer_callback)(void *), void *userdata)
|
|||
return true;
|
||||
}
|
||||
}
|
||||
else if (read (STDIN_FILENO, &k, 1) == 1)
|
||||
else
|
||||
{
|
||||
// Check input on stdin
|
||||
if (k == 'q' || k == 'Q')
|
||||
ssize_t amt = read (STDIN_FILENO, &k, 1); // Check input on stdin
|
||||
if (amt == 0)
|
||||
{
|
||||
fprintf (stderr, "\nNetwork game synchronization aborted.");
|
||||
return false;
|
||||
// EOF. Stop reading
|
||||
stdin_eof = true;
|
||||
}
|
||||
else if (amt == 1)
|
||||
{
|
||||
if (k == 'q' || k == 'Q')
|
||||
{
|
||||
fprintf (stderr, "\nNetwork game synchronization aborted.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
// winres.h - Windows resource definitions
|
||||
// extracted from WINUSER.H and COMMCTRL.H
|
||||
#pragma once
|
||||
|
||||
#ifdef _AFX_MINREBUILD
|
||||
#pragma component(minrebuild, off)
|
||||
|
|
|
@ -18,7 +18,6 @@ EXTERN_CVAR (Bool, gl_light_shadowmap);
|
|||
EXTERN_CVAR (Int, gl_shadowmap_quality);
|
||||
|
||||
EXTERN_CVAR(Int, gl_fogmode)
|
||||
EXTERN_CVAR(Int, gl_lightmode)
|
||||
EXTERN_CVAR(Bool,gl_mirror_envmap)
|
||||
|
||||
EXTERN_CVAR(Bool,gl_mirrors)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
#pragma once
|
||||
#include "tarray.h"
|
||||
#include "hwrenderer/data/buffers.h"
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "hw_viewpointuniforms.h"
|
||||
#include "v_2ddrawer.h"
|
||||
#include "i_specialpaths.h"
|
||||
#include "cmdlib.h"
|
||||
|
||||
VkRenderPassManager::VkRenderPassManager(VulkanRenderDevice* fb) : fb(fb)
|
||||
{
|
||||
|
|
|
@ -57,8 +57,8 @@
|
|||
|
||||
static ZSMap<FName, DObject*> AllServices;
|
||||
|
||||
static void MarkServices() {
|
||||
|
||||
static void MarkServices()
|
||||
{
|
||||
ZSMap<FName, DObject*>::Iterator it(AllServices);
|
||||
ZSMap<FName, DObject*>::Pair* pair;
|
||||
while (it.NextPair(pair))
|
||||
|
@ -82,6 +82,11 @@ void InitServices()
|
|||
GC::AddMarkerFunc(&MarkServices);
|
||||
}
|
||||
|
||||
void ClearServices()
|
||||
{
|
||||
AllServices.Clear();
|
||||
}
|
||||
|
||||
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
#pragma once
|
||||
#include "jit.h"
|
||||
|
||||
#include "types.h"
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include "memarena.h"
|
||||
#include "name.h"
|
||||
#include "scopebarrier.h"
|
||||
#include <type_traits>
|
||||
|
||||
class DObject;
|
||||
union VMOP;
|
||||
|
@ -618,6 +619,8 @@ namespace
|
|||
template<typename T> struct native_is_valid<T&> { static const bool value = true; static const bool retval = true; };
|
||||
template<> struct native_is_valid<void> { static const bool value = true; static const bool retval = true; };
|
||||
template<> struct native_is_valid<int> { static const bool value = true; static const bool retval = true; };
|
||||
// [RL0] this is disabled for now due to graf's concerns
|
||||
// template<> struct native_is_valid<FName> { static const bool value = true; static const bool retval = true; static_assert(sizeof(FName) == sizeof(int)); static_assert(std::is_pod_v<FName>);};
|
||||
template<> struct native_is_valid<unsigned int> { static const bool value = true; static const bool retval = true; };
|
||||
template<> struct native_is_valid<double> { static const bool value = true; static const bool retval = true; };
|
||||
template<> struct native_is_valid<bool> { static const bool value = true; static const bool retval = false;}; // Bool as return does not work!
|
||||
|
@ -628,26 +631,7 @@ struct DirectNativeDesc
|
|||
{
|
||||
DirectNativeDesc() = default;
|
||||
|
||||
#define TP(n) typename P##n
|
||||
#define VP(n) ValidateType<P##n>()
|
||||
template<typename Ret> DirectNativeDesc(Ret(*func)()) : Ptr(reinterpret_cast<void*>(func)) { ValidateRet<Ret>(); }
|
||||
template<typename Ret, TP(1)> DirectNativeDesc(Ret(*func)(P1)) : Ptr(reinterpret_cast<void*>(func)) { ValidateRet<Ret>(); VP(1); }
|
||||
template<typename Ret, TP(1), TP(2)> DirectNativeDesc(Ret(*func)(P1,P2)) : Ptr(reinterpret_cast<void*>(func)) { ValidateRet<Ret>(); VP(1); VP(2); }
|
||||
template<typename Ret, TP(1), TP(2), TP(3)> DirectNativeDesc(Ret(*func)(P1,P2,P3)) : Ptr(reinterpret_cast<void*>(func)) { ValidateRet<Ret>(); VP(1); VP(2); VP(3); }
|
||||
template<typename Ret, TP(1), TP(2), TP(3), TP(4)> DirectNativeDesc(Ret(*func)(P1, P2, P3, P4)) : Ptr(reinterpret_cast<void*>(func)) { ValidateRet<Ret>(); VP(1); VP(2); VP(3); VP(4); }
|
||||
template<typename Ret, TP(1), TP(2), TP(3), TP(4), TP(5)> DirectNativeDesc(Ret(*func)(P1, P2, P3, P4, P5)) : Ptr(reinterpret_cast<void*>(func)) { ValidateRet<Ret>(); VP(1); VP(2); VP(3); VP(4); VP(5); }
|
||||
template<typename Ret, TP(1), TP(2), TP(3), TP(4), TP(5), TP(6)> DirectNativeDesc(Ret(*func)(P1, P2, P3, P4, P5, P6)) : Ptr(reinterpret_cast<void*>(func)) { ValidateRet<Ret>(); VP(1); VP(2); VP(3); VP(4); VP(5); VP(6); }
|
||||
template<typename Ret, TP(1), TP(2), TP(3), TP(4), TP(5), TP(6), TP(7)> DirectNativeDesc(Ret(*func)(P1, P2, P3, P4, P5, P6, P7)) : Ptr(reinterpret_cast<void*>(func)) { ValidateRet<Ret>(); VP(1); VP(2); VP(3); VP(4); VP(5); VP(6); VP(7); }
|
||||
template<typename Ret, TP(1), TP(2), TP(3), TP(4), TP(5), TP(6), TP(7), TP(8)> DirectNativeDesc(Ret(*func)(P1, P2, P3, P4, P5, P6, P7, P8)) : Ptr(reinterpret_cast<void*>(func)) { ValidateRet<Ret>(); VP(1); VP(2); VP(3); VP(4); VP(5); VP(6); VP(7); VP(8); }
|
||||
template<typename Ret, TP(1), TP(2), TP(3), TP(4), TP(5), TP(6), TP(7), TP(8), TP(9)> DirectNativeDesc(Ret(*func)(P1, P2, P3, P4, P5, P6, P7, P8, P9)) : Ptr(reinterpret_cast<void*>(func)) { ValidateRet<Ret>(); VP(1); VP(2); VP(3); VP(4); VP(5); VP(6); VP(7); VP(8); VP(9); }
|
||||
template<typename Ret, TP(1), TP(2), TP(3), TP(4), TP(5), TP(6), TP(7), TP(8), TP(9), TP(10)> DirectNativeDesc(Ret(*func)(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10)) : Ptr(reinterpret_cast<void*>(func)) { ValidateRet<Ret>(); VP(1); VP(2); VP(3); VP(4); VP(5); VP(6); VP(7); VP(8); VP(9); VP(10); }
|
||||
template<typename Ret, TP(1), TP(2), TP(3), TP(4), TP(5), TP(6), TP(7), TP(8), TP(9), TP(10), TP(11)> DirectNativeDesc(Ret(*func)(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11)) : Ptr(reinterpret_cast<void*>(func)) { ValidateRet<Ret>(); VP(1); VP(2); VP(3); VP(4); VP(5); VP(6); VP(7); VP(8); VP(9); VP(10); VP(11); }
|
||||
template<typename Ret, TP(1), TP(2), TP(3), TP(4), TP(5), TP(6), TP(7), TP(8), TP(9), TP(10), TP(11), TP(12)> DirectNativeDesc(Ret(*func)(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12)) : Ptr(reinterpret_cast<void*>(func)) { ValidateRet<Ret>(); VP(1); VP(2); VP(3); VP(4); VP(5); VP(6); VP(7); VP(8); VP(9); VP(10); VP(11); VP(12); }
|
||||
template<typename Ret, TP(1), TP(2), TP(3), TP(4), TP(5), TP(6), TP(7), TP(8), TP(9), TP(10), TP(11), TP(12), TP(13)> DirectNativeDesc(Ret(*func)(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13)) : Ptr(reinterpret_cast<void*>(func)) { ValidateRet<Ret>(); VP(1); VP(2); VP(3); VP(4); VP(5); VP(6); VP(7); VP(8); VP(9); VP(10); VP(11); VP(12); VP(13); }
|
||||
template<typename Ret, TP(1), TP(2), TP(3), TP(4), TP(5), TP(6), TP(7), TP(8), TP(9), TP(10), TP(11), TP(12), TP(13), TP(14)> DirectNativeDesc(Ret(*func)(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14)) : Ptr(reinterpret_cast<void*>(func)) { ValidateRet<Ret>(); VP(1); VP(2); VP(3); VP(4); VP(5); VP(6); VP(7); VP(8); VP(9); VP(10); VP(11); VP(12); VP(13), VP(14); }
|
||||
template<typename Ret, TP(1), TP(2), TP(3), TP(4), TP(5), TP(6), TP(7), TP(8), TP(9), TP(10), TP(11), TP(12), TP(13), TP(14), TP(15)> DirectNativeDesc(Ret(*func)(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14)) : Ptr(reinterpret_cast<void*>(func)) { ValidateRet<Ret>(); VP(1); VP(2); VP(3); VP(4); VP(5); VP(6); VP(7); VP(8); VP(9); VP(10); VP(11); VP(12); VP(13), VP(14), VP(15); }
|
||||
#undef TP
|
||||
#undef VP
|
||||
template<typename Ret, typename... Params> DirectNativeDesc(Ret(*func)(Params...)) : Ptr(reinterpret_cast<void*>(func)) { ValidateRet<Ret>(); (ValidateType<Params>(), ...); }
|
||||
|
||||
template<typename T> void ValidateType() { static_assert(native_is_valid<T>::value, "Argument type is not valid as a direct native parameter or return type"); }
|
||||
template<typename T> void ValidateRet() { static_assert(native_is_valid<T>::retval, "Return type is not valid as a direct native parameter or return type"); }
|
||||
|
|
|
@ -24,6 +24,7 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
|
|||
Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au)
|
||||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
//#ifdef WIN32
|
||||
//#define DLL __declspec(dllexport)
|
||||
//#else
|
||||
#pragma once
|
||||
#define DLL
|
||||
//#endif
|
||||
|
||||
|
|
|
@ -54,6 +54,7 @@
|
|||
#include <new>
|
||||
#include <utility>
|
||||
#include <iterator>
|
||||
#include <algorithm>
|
||||
|
||||
#if !defined(_WIN32)
|
||||
#include <inttypes.h> // for intptr_t
|
||||
|
@ -420,6 +421,26 @@ public:
|
|||
return start;
|
||||
}
|
||||
|
||||
unsigned AppendFill(const T& val, unsigned append_count)
|
||||
{
|
||||
unsigned start = Count;
|
||||
|
||||
Grow(append_count);
|
||||
Count += append_count;
|
||||
if constexpr (std::is_trivially_copyable<T>::value)
|
||||
{
|
||||
std::fill(Array + start, Array + Count, val);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (unsigned i = 0; i < append_count; i++)
|
||||
{
|
||||
new(&Array[start + i]) T(val);
|
||||
}
|
||||
}
|
||||
return start;
|
||||
}
|
||||
|
||||
bool Pop ()
|
||||
{
|
||||
if (Count > 0)
|
||||
|
|
|
@ -44,23 +44,32 @@
|
|||
#include <math.h>
|
||||
#include <float.h>
|
||||
#include <string.h>
|
||||
|
||||
// this is needed to properly normalize angles. We cannot do that with compiler provided conversions because they differ too much
|
||||
#include "xs_Float.h"
|
||||
#include "math/cmath.h"
|
||||
#include "basics.h"
|
||||
#include "cmdlib.h"
|
||||
|
||||
|
||||
#define EQUAL_EPSILON (1/65536.)
|
||||
|
||||
// make this a local inline function to avoid any dependencies on other headers and not pollute the global namespace
|
||||
namespace pi
|
||||
{
|
||||
inline constexpr double pi() { return 3.14159265358979323846; }
|
||||
inline constexpr double pif() { return 3.14159265358979323846f; }
|
||||
inline constexpr float pif() { return 3.14159265358979323846f; }
|
||||
}
|
||||
|
||||
// optionally use reliable math routines if reproducability across hardware is important, but let this still compile without them.
|
||||
#if __has_include("math/cmath.h")
|
||||
#include "math/cmath.h"
|
||||
#else
|
||||
double g_cosdeg(double v) { return cos(v * (pi::pi() / 180.)); }
|
||||
double g_sindeg(double v) { return sin(v * (pi::pi() / 180.)); }
|
||||
double g_cos(double v) { return cos(v); }
|
||||
double g_sin(double v) { return sin(v); }
|
||||
double g_sqrt(double v) { return sqrt(v); }
|
||||
double g_atan2(double v, double w) { return atan2(v, w); }
|
||||
#endif
|
||||
|
||||
|
||||
#define EQUAL_EPSILON (1/65536.)
|
||||
|
||||
template<class vec_t> struct TVector3;
|
||||
template<class vec_t> struct TRotator;
|
||||
template<class vec_t> struct TAngle;
|
||||
|
@ -561,7 +570,7 @@ struct TVector3
|
|||
void GetRightUp(TVector3 &right, TVector3 &up)
|
||||
{
|
||||
TVector3 n(X, Y, Z);
|
||||
TVector3 fn(fabs(n.X), fabs(n.Y), fabs(n.Z));
|
||||
TVector3 fn((vec_t)fabs(n.X), (vec_t)fabs(n.Y), (vec_t)fabs(n.Z));
|
||||
int major = 0;
|
||||
|
||||
if (fn[1] > fn[major]) major = 1;
|
||||
|
@ -1450,8 +1459,13 @@ public:
|
|||
|
||||
double Tan() const
|
||||
{
|
||||
// use an optimized approach if we have a sine table. If not just call the CRT's tan function.
|
||||
#if __has_include("math/cmath.h")
|
||||
const auto bam = BAMs();
|
||||
return g_sinbam(bam) / g_cosbam(bam);
|
||||
#else
|
||||
return vec_t(tan(Radians()));
|
||||
#endif
|
||||
}
|
||||
|
||||
// This is for calculating vertical velocity. For high pitches the tangent will become too large to be useful.
|
||||
|
@ -1460,9 +1474,11 @@ public:
|
|||
return clamp(Tan(), -max, max);
|
||||
}
|
||||
|
||||
// returns sign of the NORMALIZED angle.
|
||||
int Sgn() const
|
||||
{
|
||||
return ::Sgn(int(BAMs()));
|
||||
auto val = int(BAMs());
|
||||
return (val > 0) - (val < 0);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1490,12 +1506,6 @@ inline TAngle<T> absangle(const TAngle<T> &a1, const TAngle<T> &a2)
|
|||
return fabs(deltaangle(a2, a1));
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline TAngle<T> clamp(const TAngle<T> &angle, const TAngle<T> &min, const TAngle<T> &max)
|
||||
{
|
||||
return TAngle<T>::fromDeg(clamp(angle.Degrees(), min.Degrees(), max.Degrees()));
|
||||
}
|
||||
|
||||
inline TAngle<double> VecToAngle(double x, double y)
|
||||
{
|
||||
return TAngle<double>::fromRad(g_atan2(y, x));
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
**---------------------------------------------------------------------------
|
||||
**
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
*/
|
||||
|
||||
|
||||
#include "vectors.h"
|
||||
#include "actorinfo.h"
|
||||
#include "c_dispatch.h"
|
||||
#include "d_net.h"
|
||||
|
|
|
@ -472,7 +472,7 @@ inline DAngle GetMaxPitch()
|
|||
return !cl_clampedpitch ? (minAngle - DAngle90) : gi->playerPitchMax();
|
||||
}
|
||||
|
||||
inline DAngle ClampViewPitch(const DAngle pitch)
|
||||
inline DAngle ClampViewPitch(const DAngle& pitch)
|
||||
{
|
||||
return clamp(pitch, GetMaxPitch(), GetMinPitch());
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include "filesystem.h"
|
||||
#include "files.h"
|
||||
#include "i_music.h"
|
||||
#include "m_argv.h"
|
||||
|
||||
#include "gamecontrol.h"
|
||||
#include "serializer.h"
|
||||
|
@ -249,7 +250,7 @@ void Mus_UpdateMusic()
|
|||
|
||||
void Mus_InitMusic()
|
||||
{
|
||||
I_InitMusic();
|
||||
I_InitMusic(Args->CheckParm("-nomusic") || Args->CheckParm("-nosound"));
|
||||
static MusicCallbacks mus_cb =
|
||||
{
|
||||
LookupMusicCB,
|
||||
|
|
Loading…
Reference in a new issue