Merge branch 'master' of https://github.com/ZDoom/gzdoom into GZDoomUpdate-12-07-2023
This commit is contained in:
commit
07f722b6f3
74 changed files with 773 additions and 294 deletions
|
|
@ -217,7 +217,7 @@ public:
|
|||
double originx, double originy, double scalex, double scaley,
|
||||
DAngle rotation, const FColormap &colormap, PalEntry flatcolor, double lightlevel, uint32_t *indices, size_t indexcount);
|
||||
void AddPoly(FGameTexture* img, FVector4 *vt, size_t vtcount, const unsigned int *ind, size_t idxcount, int translation, PalEntry color, FRenderStyle style, const IntRect* clip);
|
||||
void FillPolygon(int* rx1, int* ry1, int* xb1, int32_t npoints, int picnum, int palette, int shade, int props, const FVector2& xtex, const FVector2& ytex, const FVector2& otex,
|
||||
void FillPolygon(int* rx1, int* ry1, int* xb1, int32_t npoints, int pic, int palette, int shade, int props, const FVector2& xtex, const FVector2& ytex, const FVector2& otex,
|
||||
int clipx1, int clipy1, int clipx2, int clipy2);
|
||||
void AddFlatFill(int left, int top, int right, int bottom, FGameTexture *src, int local_origin = false, double flatscale = 1.0, PalEntry color = 0xffffffff, ERenderStyle rs = STYLE_Normal);
|
||||
|
||||
|
|
|
|||
|
|
@ -1786,12 +1786,12 @@ DEFINE_ACTION_FUNCTION(FCanvas, Dim)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void DrawBorder (F2DDrawer *drawer, FTextureID picnum, int x1, int y1, int x2, int y2)
|
||||
void DrawBorder (F2DDrawer *drawer, FTextureID texid, int x1, int y1, int x2, int y2)
|
||||
{
|
||||
int filltype = (ui_screenborder_classic_scaling) ? -1 : 0;
|
||||
if (picnum.isValid())
|
||||
if (texid.isValid())
|
||||
{
|
||||
drawer->AddFlatFill (x1, y1, x2, y2, TexMan.GetGameTexture(picnum, false), filltype);
|
||||
drawer->AddFlatFill (x1, y1, x2, y2, TexMan.GetGameTexture(texid, false), filltype);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -32,13 +31,12 @@ enum EChanFlag
|
|||
CHANF_LOCAL = 16384, // only plays locally for the calling actor
|
||||
CHANF_TRANSIENT = 32768, // Do not record in savegames - used for sounds that get restarted outside the sound system (e.g. ambients in SW and Blood)
|
||||
CHANF_FORCE = 65536, // Start, even if sound is paused.
|
||||
CHANF_SINGULAR = 0x20000, // Only start if no sound of this name is already playing.
|
||||
};
|
||||
|
||||
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.
|
||||
|
|
@ -77,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
|
||||
{
|
||||
|
|
@ -143,8 +144,6 @@ struct FISoundChannel
|
|||
EChanFlags ChanFlags;
|
||||
};
|
||||
|
||||
class SoundStream;
|
||||
|
||||
void S_SetSoundPaused(int state);
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -488,7 +488,7 @@ FSoundChan *SoundEngine::StartSound(int type, const void *source,
|
|||
}
|
||||
|
||||
// If this is a singular sound, don't play it if it's already playing.
|
||||
if (sfx->bSingular && CheckSingular(sound_id))
|
||||
if ((sfx->bSingular || (flags & CHANF_SINGULAR)) && CheckSingular(sound_id))
|
||||
{
|
||||
chanflags |= CHANF_EVICTED;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,6 +90,7 @@ constexpr FSoundID INVALID_SOUND = FSoundID::fromInt(-1);
|
|||
float DefPitchMax = 0.f; // Randomized range with stronger control over pitch itself.
|
||||
|
||||
int16_t NearLimit = 4; // 0 means unlimited.
|
||||
int16_t UserVal = 0; // repurpose this gap for something useful
|
||||
uint8_t PitchMask = 0;
|
||||
bool bRandomHeader = false;
|
||||
bool bLoadRAW = false;
|
||||
|
|
@ -99,17 +100,16 @@ constexpr FSoundID INVALID_SOUND = FSoundID::fromInt(-1);
|
|||
bool bTentative = true;
|
||||
bool bExternal = false;
|
||||
|
||||
TArray<int> UserData;
|
||||
|
||||
int RawRate = 0; // Sample rate to use when bLoadRAW is true
|
||||
int LoopStart = -1; // -1 means no specific loop defined
|
||||
int LoopEnd = -1; // -1 means no specific loop defined
|
||||
float Attenuation = 1.f; // Multiplies the attenuation passed to S_Sound.
|
||||
|
||||
FSoundID link = NO_LINK;
|
||||
constexpr static FSoundID NO_LINK = FSoundID::fromInt(-1);
|
||||
|
||||
TArray<int> UserData;
|
||||
FRolloffInfo Rolloff{};
|
||||
float Attenuation = 1.f; // Multiplies the attenuation passed to S_Sound.
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
#pragma once
|
||||
#include <string>
|
||||
#include "zstring.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@
|
|||
**---------------------------------------------------------------------------
|
||||
**
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
|
|
|
|||
|
|
@ -546,7 +546,7 @@ bool InterplayDecoder::Open(FileReader &fr_)
|
|||
int chunkType = LE_16(&chunkPreamble[2]);
|
||||
if (chunkType == CHUNK_VIDEO)
|
||||
bAudioEnabled = false;
|
||||
else
|
||||
else if (bAudioEnabled)
|
||||
{
|
||||
if (ProcessNextChunk() != CHUNK_INIT_AUDIO)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -268,3 +268,4 @@ xx(BuiltinNameToClass)
|
|||
xx(BuiltinClassCast)
|
||||
|
||||
xx(ScreenJobRunner)
|
||||
xx(Action)
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -220,6 +220,7 @@ std2:
|
|||
'bright' { RET(StateOptions ? TK_Bright : TK_Identifier); }
|
||||
'fast' { RET(StateOptions ? TK_Fast : TK_Identifier); }
|
||||
'slow' { RET(StateOptions ? TK_Slow : TK_Identifier); }
|
||||
'ticadjust' { RET(StateOptions ? TK_NoDelay : TK_Identifier); }
|
||||
'nodelay' { RET(StateOptions ? TK_NoDelay : TK_Identifier); }
|
||||
'canraise' { RET(StateOptions ? TK_CanRaise : TK_Identifier); }
|
||||
'offset' { RET(StateOptions ? TK_Offset : TK_Identifier); }
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
||||
|
|
|
|||
|
|
@ -65,21 +65,21 @@ protected:
|
|||
FSinglePicFont::FSinglePicFont(const char *picname) :
|
||||
FFont(-1) // Since lump is only needed for priority information we don't need to worry about this here.
|
||||
{
|
||||
FTextureID picnum = TexMan.CheckForTexture (picname, ETextureType::Any);
|
||||
FTextureID texid = TexMan.CheckForTexture (picname, ETextureType::Any);
|
||||
|
||||
if (!picnum.isValid())
|
||||
if (!texid.isValid())
|
||||
{
|
||||
I_FatalError ("%s is not a font or texture", picname);
|
||||
}
|
||||
|
||||
auto pic = TexMan.GetGameTexture(picnum);
|
||||
auto pic = TexMan.GetGameTexture(texid);
|
||||
|
||||
FontName = picname;
|
||||
FontHeight = (int)pic->GetDisplayHeight();
|
||||
SpaceWidth = (int)pic->GetDisplayWidth();
|
||||
GlobalKerning = 0;
|
||||
FirstChar = LastChar = 'A';
|
||||
PicNum = picnum;
|
||||
PicNum = texid;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
|||
|
|
@ -138,10 +138,10 @@ FFont *V_GetFont(const char *name, const char *fontlumpname)
|
|||
return font;
|
||||
}
|
||||
}
|
||||
FTextureID picnum = TexMan.CheckForTexture (name, ETextureType::Any);
|
||||
if (picnum.isValid())
|
||||
FTextureID texid = TexMan.CheckForTexture (name, ETextureType::Any);
|
||||
if (texid.isValid())
|
||||
{
|
||||
auto tex = TexMan.GetGameTexture(picnum);
|
||||
auto tex = TexMan.GetGameTexture(texid);
|
||||
if (tex && tex->GetSourceLump() >= folderfile)
|
||||
{
|
||||
FFont *CreateSinglePicFont(const char *name);
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,6 @@
|
|||
#include <asm/unistd.h>
|
||||
#include <linux/perf_event.h>
|
||||
#include <sys/mman.h>
|
||||
#include "printf.h"
|
||||
#endif
|
||||
|
||||
#include <SDL.h>
|
||||
|
|
@ -65,6 +64,7 @@
|
|||
#include "c_cvars.h"
|
||||
#include "palutil.h"
|
||||
#include "st_start.h"
|
||||
#include "printf.h"
|
||||
|
||||
|
||||
#ifndef NO_GTK
|
||||
|
|
@ -408,7 +408,7 @@ FString I_GetFromClipboard (bool use_primary_selection)
|
|||
|
||||
FString I_GetCWD()
|
||||
{
|
||||
char* curdir = get_current_dir_name();
|
||||
char* curdir = getcwd(NULL,0);
|
||||
if (!curdir)
|
||||
{
|
||||
return "";
|
||||
|
|
@ -447,7 +447,7 @@ unsigned int I_MakeRNGSeed()
|
|||
|
||||
void I_OpenShellFolder(const char* infolder)
|
||||
{
|
||||
char* curdir = get_current_dir_name();
|
||||
char* curdir = getcwd(NULL,0);
|
||||
|
||||
if (!chdir(infolder))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -189,6 +189,8 @@ CUSTOM_CVAR (Int, in_mouse, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOINITCALL)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
static bool mouse_shown = true;
|
||||
|
||||
static void SetCursorState(bool visible)
|
||||
{
|
||||
CursorState = visible || !m_hidepointer;
|
||||
|
|
@ -196,13 +198,19 @@ static void SetCursorState(bool visible)
|
|||
{
|
||||
if (CursorState)
|
||||
{
|
||||
ShowCursor(1);
|
||||
SetCursor((HCURSOR)(intptr_t)GetClassLongPtr(mainwindow.GetHandle(), GCLP_HCURSOR));
|
||||
if(!mouse_shown)
|
||||
{
|
||||
ShowCursor(true);
|
||||
mouse_shown = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowCursor(0);
|
||||
SetCursor(NULL);
|
||||
if(mouse_shown)
|
||||
{
|
||||
ShowCursor(false);
|
||||
mouse_shown = 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)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
|
||||
#include "hw_mesh.h"
|
||||
#include "v_video.h"
|
||||
#include "cmdlib.h"
|
||||
|
||||
#define USE_MESH_VERTEX_BUFFER
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
#include "vulkan/buffers/vk_buffer.h"
|
||||
#include <zvulkan/vulkanbuilders.h>
|
||||
#include "flatvertices.h"
|
||||
#include "cmdlib.h"
|
||||
|
||||
VkRSBuffers::VkRSBuffers(VulkanRenderDevice* fb)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -64,7 +64,6 @@
|
|||
|
||||
FString JitCaptureStackTrace(int framesToSkip, bool includeNativeFrames, int maxFrames = -1);
|
||||
|
||||
EXTERN_CVAR(Bool, r_drawvoxels)
|
||||
EXTERN_CVAR(Int, gl_tonemap)
|
||||
EXTERN_CVAR(Int, screenblocks)
|
||||
EXTERN_CVAR(Bool, cl_capfps)
|
||||
|
|
|
|||
|
|
@ -272,6 +272,13 @@ dottable_id(X) ::= IDENTIFIER(A).
|
|||
id->Id = A.Name();
|
||||
X = id;
|
||||
}
|
||||
// this is needed for defining properties named 'action'.
|
||||
dottable_id(X) ::= ACTION(A).
|
||||
{
|
||||
NEW_AST_NODE(Identifier,id,A);
|
||||
id->Id = NAME_Action;
|
||||
X = id;
|
||||
}
|
||||
dottable_id(X) ::= dottable_id(A) DOT IDENTIFIER(B).
|
||||
{
|
||||
NEW_AST_NODE(Identifier,id2,A);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
@ -194,6 +195,12 @@ struct VMReturn
|
|||
*(void **)Location = val;
|
||||
}
|
||||
|
||||
void SetConstPointer(const void *val)
|
||||
{
|
||||
assert(RegType == REGT_POINTER);
|
||||
*(const void **)Location = val;
|
||||
}
|
||||
|
||||
void SetObject(DObject *val)
|
||||
{
|
||||
assert(RegType == REGT_POINTER);
|
||||
|
|
@ -611,6 +618,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!
|
||||
|
|
@ -621,26 +630,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"); }
|
||||
|
|
@ -759,6 +749,7 @@ struct AFuncDesc
|
|||
class AActor;
|
||||
|
||||
#define ACTION_RETURN_STATE(v) do { FState *state = v; if (numret > 0) { assert(ret != NULL); ret->SetPointer(state); return 1; } return 0; } while(0)
|
||||
#define ACTION_RETURN_CONST_POINTER(v) do { const void *state = v; if (numret > 0) { assert(ret != NULL); ret->SetConstPointer(state); return 1; } return 0; } while(0)
|
||||
#define ACTION_RETURN_POINTER(v) do { void *state = v; if (numret > 0) { assert(ret != NULL); ret->SetPointer(state); return 1; } return 0; } while(0)
|
||||
#define ACTION_RETURN_OBJECT(v) do { auto state = v; if (numret > 0) { assert(ret != NULL); ret->SetObject(state); return 1; } return 0; } while(0)
|
||||
#define ACTION_RETURN_FLOAT(v) do { double u = v; if (numret > 0) { assert(ret != nullptr); ret->SetFloat(u); return 1; } return 0; } while(0)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ public:
|
|||
bool operator > (FTextureID other) const { return texnum > other.texnum; }
|
||||
|
||||
protected:
|
||||
FTextureID(int num) { texnum = num; }
|
||||
constexpr FTextureID(int num) : texnum(num) { }
|
||||
private:
|
||||
int texnum;
|
||||
};
|
||||
|
|
@ -53,13 +53,13 @@ private:
|
|||
class FNullTextureID : public FTextureID
|
||||
{
|
||||
public:
|
||||
FNullTextureID() : FTextureID(0) {}
|
||||
constexpr FNullTextureID() : FTextureID(0) {}
|
||||
};
|
||||
|
||||
// This is for the script interface which needs to do casts from int to texture.
|
||||
class FSetTextureID : public FTextureID
|
||||
{
|
||||
public:
|
||||
FSetTextureID(int v) : FTextureID(v) {}
|
||||
constexpr FSetTextureID(int v) : FTextureID(v) {}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -498,9 +498,9 @@ FTextureID FTextureManager::CreateTexture (int lumpnum, ETextureType usetype)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void FTextureManager::ReplaceTexture (FTextureID picnum, FGameTexture *newtexture, bool free)
|
||||
void FTextureManager::ReplaceTexture (FTextureID texid, FGameTexture *newtexture, bool free)
|
||||
{
|
||||
int index = picnum.GetIndex();
|
||||
int index = texid.GetIndex();
|
||||
if (unsigned(index) >= Textures.Size())
|
||||
return;
|
||||
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ public:
|
|||
void AddTextures(void (*progressFunc_)(), void (*checkForHacks)(BuildInfo&), void (*customtexturehandler)() = nullptr);
|
||||
void DeleteAll();
|
||||
|
||||
void ReplaceTexture (FTextureID picnum, FGameTexture *newtexture, bool free);
|
||||
void ReplaceTexture (FTextureID texid, FGameTexture *newtexture, bool free);
|
||||
|
||||
int NumTextures () const { return (int)Textures.Size(); }
|
||||
|
||||
|
|
|
|||
|
|
@ -62,8 +62,8 @@ void FImageCollection::Add (const char **patchNames, int numPatches, ETextureTyp
|
|||
|
||||
for (int i = 0; i < numPatches; ++i)
|
||||
{
|
||||
FTextureID picnum = TexMan.CheckForTexture(patchNames[i], namespc);
|
||||
ImageMap[OldCount + i] = picnum;
|
||||
FTextureID texid = TexMan.CheckForTexture(patchNames[i], namespc);
|
||||
ImageMap[OldCount + i] = texid;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -184,7 +184,7 @@ public:
|
|||
return mReader->Seek((long)offset, origin);
|
||||
}
|
||||
|
||||
Size Read(void *buffer, Size len)
|
||||
Size Read(void *buffer, Size len) const
|
||||
{
|
||||
return mReader->Read(buffer, (long)len);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@
|
|||
#include <new>
|
||||
#include <utility>
|
||||
#include <iterator>
|
||||
#include <algorithm>
|
||||
|
||||
#if !defined(_WIN32)
|
||||
#include <inttypes.h> // for intptr_t
|
||||
|
|
@ -327,9 +328,10 @@ public:
|
|||
}
|
||||
|
||||
// returns address of first element
|
||||
T *Data() const
|
||||
T *Data(size_t index = 0) const
|
||||
{
|
||||
return &Array[0];
|
||||
assert(index <= Count);
|
||||
return &Array[index];
|
||||
}
|
||||
|
||||
unsigned IndexOf(const T& elem) const
|
||||
|
|
@ -419,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;
|
||||
|
|
@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
**---------------------------------------------------------------------------
|
||||
**
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue