diff --git a/src/common/2d/v_2ddrawer.h b/src/common/2d/v_2ddrawer.h index 7203ca3c1..fc2970b15 100644 --- a/src/common/2d/v_2ddrawer.h +++ b/src/common/2d/v_2ddrawer.h @@ -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); diff --git a/src/common/2d/v_draw.cpp b/src/common/2d/v_draw.cpp index 7c1beb0c8..85ed31517 100644 --- a/src/common/2d/v_draw.cpp +++ b/src/common/2d/v_draw.cpp @@ -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 { diff --git a/src/common/audio/sound/i_soundinternal.h b/src/common/audio/sound/i_soundinternal.h index 1ef4178d4..4787aa12a 100644 --- a/src/common/audio/sound/i_soundinternal.h +++ b/src/common/audio/sound/i_soundinternal.h @@ -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 EChanFlags; diff --git a/src/common/audio/sound/s_sound.cpp b/src/common/audio/sound/s_sound.cpp index f3b0fb412..2544d1f87 100644 --- a/src/common/audio/sound/s_sound.cpp +++ b/src/common/audio/sound/s_sound.cpp @@ -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; } diff --git a/src/common/audio/sound/s_soundinternal.h b/src/common/audio/sound/s_soundinternal.h index dae8a0ee2..782fbe325 100644 --- a/src/common/audio/sound/s_soundinternal.h +++ b/src/common/audio/sound/s_soundinternal.h @@ -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 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 UserData; FRolloffInfo Rolloff{}; - float Attenuation = 1.f; // Multiplies the attenuation passed to S_Sound. }; diff --git a/src/common/cutscenes/playmve.cpp b/src/common/cutscenes/playmve.cpp index 70b56b43a..3c49e9610 100644 --- a/src/common/cutscenes/playmve.cpp +++ b/src/common/cutscenes/playmve.cpp @@ -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) { diff --git a/src/common/engine/namedef.h b/src/common/engine/namedef.h index 92fa6fa34..2571cb315 100644 --- a/src/common/engine/namedef.h +++ b/src/common/engine/namedef.h @@ -270,3 +270,4 @@ xx(BuiltinNameToClass) xx(BuiltinClassCast) xx(ScreenJobRunner) +xx(Action) diff --git a/src/common/engine/sc_man_scanner.re b/src/common/engine/sc_man_scanner.re index 59c3c7712..b5cce6d09 100644 --- a/src/common/engine/sc_man_scanner.re +++ b/src/common/engine/sc_man_scanner.re @@ -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); } diff --git a/src/common/fonts/singlepicfont.cpp b/src/common/fonts/singlepicfont.cpp index 687602876..30fdf8711 100644 --- a/src/common/fonts/singlepicfont.cpp +++ b/src/common/fonts/singlepicfont.cpp @@ -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; } //========================================================================== diff --git a/src/common/fonts/v_font.cpp b/src/common/fonts/v_font.cpp index f51813aeb..cb206a4ec 100644 --- a/src/common/fonts/v_font.cpp +++ b/src/common/fonts/v_font.cpp @@ -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); diff --git a/src/common/rendering/gl/gl_framebuffer.cpp b/src/common/rendering/gl/gl_framebuffer.cpp index 6ea31e5bd..4b20db68f 100644 --- a/src/common/rendering/gl/gl_framebuffer.cpp +++ b/src/common/rendering/gl/gl_framebuffer.cpp @@ -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); diff --git a/src/common/rendering/gles/gles_framebuffer.cpp b/src/common/rendering/gles/gles_framebuffer.cpp index 0d0a459c0..bbade7896 100644 --- a/src/common/rendering/gles/gles_framebuffer.cpp +++ b/src/common/rendering/gles/gles_framebuffer.cpp @@ -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); diff --git a/src/common/rendering/vulkan/system/vk_renderdevice.cpp b/src/common/rendering/vulkan/system/vk_renderdevice.cpp index 8f4f1b737..7ef3e5531 100644 --- a/src/common/rendering/vulkan/system/vk_renderdevice.cpp +++ b/src/common/rendering/vulkan/system/vk_renderdevice.cpp @@ -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) diff --git a/src/common/scripting/frontend/zcc-parse.lemon b/src/common/scripting/frontend/zcc-parse.lemon index 1a9146f37..71385c582 100644 --- a/src/common/scripting/frontend/zcc-parse.lemon +++ b/src/common/scripting/frontend/zcc-parse.lemon @@ -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); diff --git a/src/common/scripting/vm/vm.h b/src/common/scripting/vm/vm.h index 3766e9d31..01e98fb61 100644 --- a/src/common/scripting/vm/vm.h +++ b/src/common/scripting/vm/vm.h @@ -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) diff --git a/src/common/textures/textureid.h b/src/common/textures/textureid.h index e30b4e86a..c441cb9d5 100644 --- a/src/common/textures/textureid.h +++ b/src/common/textures/textureid.h @@ -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) {} }; diff --git a/src/common/textures/texturemanager.cpp b/src/common/textures/texturemanager.cpp index 94aa40de1..988498408 100644 --- a/src/common/textures/texturemanager.cpp +++ b/src/common/textures/texturemanager.cpp @@ -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; diff --git a/src/common/textures/texturemanager.h b/src/common/textures/texturemanager.h index 575e838ea..3f80514f3 100644 --- a/src/common/textures/texturemanager.h +++ b/src/common/textures/texturemanager.h @@ -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(); } diff --git a/src/common/textures/v_collection.cpp b/src/common/textures/v_collection.cpp index 2b51885bf..975287680 100644 --- a/src/common/textures/v_collection.cpp +++ b/src/common/textures/v_collection.cpp @@ -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; } } diff --git a/src/common/utility/files.h b/src/common/utility/files.h index 66fa9a354..24d66e1d7 100644 --- a/src/common/utility/files.h +++ b/src/common/utility/files.h @@ -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); } diff --git a/src/common/utility/tarray.h b/src/common/utility/tarray.h index 29d62289c..a21226095 100644 --- a/src/common/utility/tarray.h +++ b/src/common/utility/tarray.h @@ -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