mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-02-17 01:31:25 +00:00
- Backend update from Raze.
This commit is contained in:
parent
677b084064
commit
acfe82b9a8
21 changed files with 45 additions and 30 deletions
|
@ -217,7 +217,7 @@ public:
|
||||||
double originx, double originy, double scalex, double scaley,
|
double originx, double originy, double scalex, double scaley,
|
||||||
DAngle rotation, const FColormap &colormap, PalEntry flatcolor, double lightlevel, uint32_t *indices, size_t indexcount);
|
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 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);
|
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);
|
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;
|
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
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -32,6 +32,7 @@ enum EChanFlag
|
||||||
CHANF_LOCAL = 16384, // only plays locally for the calling actor
|
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_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_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;
|
typedef TFlags<EChanFlag> EChanFlags;
|
||||||
|
|
|
@ -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 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;
|
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.
|
float DefPitchMax = 0.f; // Randomized range with stronger control over pitch itself.
|
||||||
|
|
||||||
int16_t NearLimit = 4; // 0 means unlimited.
|
int16_t NearLimit = 4; // 0 means unlimited.
|
||||||
|
int16_t UserVal = 0; // repurpose this gap for something useful
|
||||||
uint8_t PitchMask = 0;
|
uint8_t PitchMask = 0;
|
||||||
bool bRandomHeader = false;
|
bool bRandomHeader = false;
|
||||||
bool bLoadRAW = false;
|
bool bLoadRAW = false;
|
||||||
|
@ -99,17 +100,16 @@ constexpr FSoundID INVALID_SOUND = FSoundID::fromInt(-1);
|
||||||
bool bTentative = true;
|
bool bTentative = true;
|
||||||
bool bExternal = false;
|
bool bExternal = false;
|
||||||
|
|
||||||
TArray<int> UserData;
|
|
||||||
|
|
||||||
int RawRate = 0; // Sample rate to use when bLoadRAW is true
|
int RawRate = 0; // Sample rate to use when bLoadRAW is true
|
||||||
int LoopStart = -1; // -1 means no specific loop defined
|
int LoopStart = -1; // -1 means no specific loop defined
|
||||||
int LoopEnd = -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;
|
FSoundID link = NO_LINK;
|
||||||
constexpr static FSoundID NO_LINK = FSoundID::fromInt(-1);
|
constexpr static FSoundID NO_LINK = FSoundID::fromInt(-1);
|
||||||
|
|
||||||
|
TArray<int> UserData;
|
||||||
FRolloffInfo Rolloff{};
|
FRolloffInfo Rolloff{};
|
||||||
float Attenuation = 1.f; // Multiplies the attenuation passed to S_Sound.
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -546,7 +546,7 @@ bool InterplayDecoder::Open(FileReader &fr_)
|
||||||
int chunkType = LE_16(&chunkPreamble[2]);
|
int chunkType = LE_16(&chunkPreamble[2]);
|
||||||
if (chunkType == CHUNK_VIDEO)
|
if (chunkType == CHUNK_VIDEO)
|
||||||
bAudioEnabled = false;
|
bAudioEnabled = false;
|
||||||
else
|
else if (bAudioEnabled)
|
||||||
{
|
{
|
||||||
if (ProcessNextChunk() != CHUNK_INIT_AUDIO)
|
if (ProcessNextChunk() != CHUNK_INIT_AUDIO)
|
||||||
{
|
{
|
||||||
|
|
|
@ -270,3 +270,4 @@ xx(BuiltinNameToClass)
|
||||||
xx(BuiltinClassCast)
|
xx(BuiltinClassCast)
|
||||||
|
|
||||||
xx(ScreenJobRunner)
|
xx(ScreenJobRunner)
|
||||||
|
xx(Action)
|
||||||
|
|
|
@ -220,6 +220,7 @@ std2:
|
||||||
'bright' { RET(StateOptions ? TK_Bright : TK_Identifier); }
|
'bright' { RET(StateOptions ? TK_Bright : TK_Identifier); }
|
||||||
'fast' { RET(StateOptions ? TK_Fast : TK_Identifier); }
|
'fast' { RET(StateOptions ? TK_Fast : TK_Identifier); }
|
||||||
'slow' { RET(StateOptions ? TK_Slow : TK_Identifier); }
|
'slow' { RET(StateOptions ? TK_Slow : TK_Identifier); }
|
||||||
|
'ticadjust' { RET(StateOptions ? TK_NoDelay : TK_Identifier); }
|
||||||
'nodelay' { RET(StateOptions ? TK_NoDelay : TK_Identifier); }
|
'nodelay' { RET(StateOptions ? TK_NoDelay : TK_Identifier); }
|
||||||
'canraise' { RET(StateOptions ? TK_CanRaise : TK_Identifier); }
|
'canraise' { RET(StateOptions ? TK_CanRaise : TK_Identifier); }
|
||||||
'offset' { RET(StateOptions ? TK_Offset : TK_Identifier); }
|
'offset' { RET(StateOptions ? TK_Offset : TK_Identifier); }
|
||||||
|
|
|
@ -65,21 +65,21 @@ protected:
|
||||||
FSinglePicFont::FSinglePicFont(const char *picname) :
|
FSinglePicFont::FSinglePicFont(const char *picname) :
|
||||||
FFont(-1) // Since lump is only needed for priority information we don't need to worry about this here.
|
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);
|
I_FatalError ("%s is not a font or texture", picname);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto pic = TexMan.GetGameTexture(picnum);
|
auto pic = TexMan.GetGameTexture(texid);
|
||||||
|
|
||||||
FontName = picname;
|
FontName = picname;
|
||||||
FontHeight = (int)pic->GetDisplayHeight();
|
FontHeight = (int)pic->GetDisplayHeight();
|
||||||
SpaceWidth = (int)pic->GetDisplayWidth();
|
SpaceWidth = (int)pic->GetDisplayWidth();
|
||||||
GlobalKerning = 0;
|
GlobalKerning = 0;
|
||||||
FirstChar = LastChar = 'A';
|
FirstChar = LastChar = 'A';
|
||||||
PicNum = picnum;
|
PicNum = texid;
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
|
@ -138,10 +138,10 @@ FFont *V_GetFont(const char *name, const char *fontlumpname)
|
||||||
return font;
|
return font;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FTextureID picnum = TexMan.CheckForTexture (name, ETextureType::Any);
|
FTextureID texid = TexMan.CheckForTexture (name, ETextureType::Any);
|
||||||
if (picnum.isValid())
|
if (texid.isValid())
|
||||||
{
|
{
|
||||||
auto tex = TexMan.GetGameTexture(picnum);
|
auto tex = TexMan.GetGameTexture(texid);
|
||||||
if (tex && tex->GetSourceLump() >= folderfile)
|
if (tex && tex->GetSourceLump() >= folderfile)
|
||||||
{
|
{
|
||||||
FFont *CreateSinglePicFont(const char *name);
|
FFont *CreateSinglePicFont(const char *name);
|
||||||
|
|
|
@ -63,7 +63,6 @@
|
||||||
#include "hw_cvars.h"
|
#include "hw_cvars.h"
|
||||||
|
|
||||||
EXTERN_CVAR (Bool, vid_vsync)
|
EXTERN_CVAR (Bool, vid_vsync)
|
||||||
EXTERN_CVAR(Bool, r_drawvoxels)
|
|
||||||
EXTERN_CVAR(Int, gl_tonemap)
|
EXTERN_CVAR(Int, gl_tonemap)
|
||||||
EXTERN_CVAR(Bool, cl_capfps)
|
EXTERN_CVAR(Bool, cl_capfps)
|
||||||
EXTERN_CVAR(Int, gl_pipeline_depth);
|
EXTERN_CVAR(Int, gl_pipeline_depth);
|
||||||
|
|
|
@ -61,7 +61,6 @@
|
||||||
#include "hw_cvars.h"
|
#include "hw_cvars.h"
|
||||||
|
|
||||||
EXTERN_CVAR (Bool, vid_vsync)
|
EXTERN_CVAR (Bool, vid_vsync)
|
||||||
EXTERN_CVAR(Bool, r_drawvoxels)
|
|
||||||
EXTERN_CVAR(Int, gl_tonemap)
|
EXTERN_CVAR(Int, gl_tonemap)
|
||||||
EXTERN_CVAR(Bool, cl_capfps)
|
EXTERN_CVAR(Bool, cl_capfps)
|
||||||
EXTERN_CVAR(Int, gl_pipeline_depth);
|
EXTERN_CVAR(Int, gl_pipeline_depth);
|
||||||
|
|
|
@ -68,7 +68,6 @@
|
||||||
|
|
||||||
FString JitCaptureStackTrace(int framesToSkip, bool includeNativeFrames, int maxFrames = -1);
|
FString JitCaptureStackTrace(int framesToSkip, bool includeNativeFrames, int maxFrames = -1);
|
||||||
|
|
||||||
EXTERN_CVAR(Bool, r_drawvoxels)
|
|
||||||
EXTERN_CVAR(Int, gl_tonemap)
|
EXTERN_CVAR(Int, gl_tonemap)
|
||||||
EXTERN_CVAR(Int, screenblocks)
|
EXTERN_CVAR(Int, screenblocks)
|
||||||
EXTERN_CVAR(Bool, cl_capfps)
|
EXTERN_CVAR(Bool, cl_capfps)
|
||||||
|
|
|
@ -272,6 +272,13 @@ dottable_id(X) ::= IDENTIFIER(A).
|
||||||
id->Id = A.Name();
|
id->Id = A.Name();
|
||||||
X = id;
|
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).
|
dottable_id(X) ::= dottable_id(A) DOT IDENTIFIER(B).
|
||||||
{
|
{
|
||||||
NEW_AST_NODE(Identifier,id2,A);
|
NEW_AST_NODE(Identifier,id2,A);
|
||||||
|
|
|
@ -194,6 +194,12 @@ struct VMReturn
|
||||||
*(void **)Location = val;
|
*(void **)Location = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetConstPointer(const void *val)
|
||||||
|
{
|
||||||
|
assert(RegType == REGT_POINTER);
|
||||||
|
*(const void **)Location = val;
|
||||||
|
}
|
||||||
|
|
||||||
void SetObject(DObject *val)
|
void SetObject(DObject *val)
|
||||||
{
|
{
|
||||||
assert(RegType == REGT_POINTER);
|
assert(RegType == REGT_POINTER);
|
||||||
|
@ -759,6 +765,7 @@ struct AFuncDesc
|
||||||
class AActor;
|
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_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_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_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)
|
#define ACTION_RETURN_FLOAT(v) do { double u = v; if (numret > 0) { assert(ret != nullptr); ret->SetFloat(u); return 1; } return 0; } while(0)
|
||||||
|
|
|
@ -45,7 +45,7 @@ public:
|
||||||
bool operator > (FTextureID other) const { return texnum > other.texnum; }
|
bool operator > (FTextureID other) const { return texnum > other.texnum; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
FTextureID(int num) { texnum = num; }
|
constexpr FTextureID(int num) : texnum(num) { }
|
||||||
private:
|
private:
|
||||||
int texnum;
|
int texnum;
|
||||||
};
|
};
|
||||||
|
@ -53,13 +53,13 @@ private:
|
||||||
class FNullTextureID : public FTextureID
|
class FNullTextureID : public FTextureID
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FNullTextureID() : FTextureID(0) {}
|
constexpr FNullTextureID() : FTextureID(0) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
// This is for the script interface which needs to do casts from int to texture.
|
// This is for the script interface which needs to do casts from int to texture.
|
||||||
class FSetTextureID : public FTextureID
|
class FSetTextureID : public FTextureID
|
||||||
{
|
{
|
||||||
public:
|
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())
|
if (unsigned(index) >= Textures.Size())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -137,7 +137,7 @@ public:
|
||||||
void AddTextures(void (*progressFunc_)(), void (*checkForHacks)(BuildInfo&), void (*customtexturehandler)() = nullptr);
|
void AddTextures(void (*progressFunc_)(), void (*checkForHacks)(BuildInfo&), void (*customtexturehandler)() = nullptr);
|
||||||
void DeleteAll();
|
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(); }
|
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)
|
for (int i = 0; i < numPatches; ++i)
|
||||||
{
|
{
|
||||||
FTextureID picnum = TexMan.CheckForTexture(patchNames[i], namespc);
|
FTextureID texid = TexMan.CheckForTexture(patchNames[i], namespc);
|
||||||
ImageMap[OldCount + i] = picnum;
|
ImageMap[OldCount + i] = texid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -184,7 +184,7 @@ public:
|
||||||
return mReader->Seek((long)offset, origin);
|
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);
|
return mReader->Read(buffer, (long)len);
|
||||||
}
|
}
|
||||||
|
|
|
@ -327,9 +327,10 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns address of first element
|
// 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
|
unsigned IndexOf(const T& elem) const
|
||||||
|
|
Loading…
Reference in a new issue