- Backend update from Raze.

This commit is contained in:
Christoph Oelckers 2023-05-27 09:31:17 +02:00
parent 677b084064
commit acfe82b9a8
21 changed files with 45 additions and 30 deletions

View file

@ -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);

View file

@ -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
{

View file

@ -32,6 +32,7 @@ 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;

View file

@ -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;
}

View file

@ -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.
};

View file

@ -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)
{

View file

@ -270,3 +270,4 @@ xx(BuiltinNameToClass)
xx(BuiltinClassCast)
xx(ScreenJobRunner)
xx(Action)

View file

@ -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); }

View file

@ -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;
}
//==========================================================================

View file

@ -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);

View file

@ -63,7 +63,6 @@
#include "hw_cvars.h"
EXTERN_CVAR (Bool, vid_vsync)
EXTERN_CVAR(Bool, r_drawvoxels)
EXTERN_CVAR(Int, gl_tonemap)
EXTERN_CVAR(Bool, cl_capfps)
EXTERN_CVAR(Int, gl_pipeline_depth);

View file

@ -61,7 +61,6 @@
#include "hw_cvars.h"
EXTERN_CVAR (Bool, vid_vsync)
EXTERN_CVAR(Bool, r_drawvoxels)
EXTERN_CVAR(Int, gl_tonemap)
EXTERN_CVAR(Bool, cl_capfps)
EXTERN_CVAR(Int, gl_pipeline_depth);

View file

@ -68,7 +68,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)

View file

@ -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);

View file

@ -194,6 +194,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);
@ -759,6 +765,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)

View file

@ -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) {}
};

View file

@ -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;

View file

@ -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(); }

View file

@ -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;
}
}

View file

@ -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);
}

View file

@ -327,9 +327,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