Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/ZDoom/gzdoom into gzdoom_…
Browse files Browse the repository at this point in the history
…unstable
  • Loading branch information
nashmuhandes committed Jan 30, 2025
2 parents 8946aba + 987a07b commit 9c79016
Show file tree
Hide file tree
Showing 21 changed files with 467 additions and 44 deletions.
19 changes: 12 additions & 7 deletions src/common/scripting/backend/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6783,11 +6783,8 @@ FxExpression *FxIdentifier::Resolve(FCompileContext& ctx)
{
if (sym->mVersion <= ctx.Version)
{
// Allow use of deprecated symbols in deprecated functions of the internal code. This is meant to allow deprecated code to remain as it was,
// even if it depends on some deprecated symbol.
// The main motivation here is to keep the deprecated static functions accessing the global level variable as they were.
// Print these only if debug output is active and at the highest verbosity level.
const bool internal = (ctx.Function->Variants[0].Flags & VARF_Deprecated) && fileSystem.GetFileContainer(ctx.Lump) == 0;
// Allow use of deprecated symbols in the internal code.
const bool internal = fileSystem.GetFileContainer(ctx.Lump) == 0;
const FString &deprecationMessage = vsym->DeprecationMessage;

ScriptPosition.Message(internal ? MSG_DEBUGMSG : MSG_WARNING,
Expand Down Expand Up @@ -6877,8 +6874,12 @@ FxExpression *FxIdentifier::ResolveMember(FCompileContext &ctx, PContainerType *
{
if (sym->mVersion <= ctx.Version)
{
// Allow use of deprecated symbols in internal code.
const bool internal = fileSystem.GetFileContainer(ctx.Lump) == 0;
const FString &deprecationMessage = vsym->DeprecationMessage;
ScriptPosition.Message(MSG_WARNING, "Accessing deprecated member variable %s - deprecated since %d.%d.%d%s%s", sym->SymbolName.GetChars(), vsym->mVersion.major, vsym->mVersion.minor, vsym->mVersion.revision,

ScriptPosition.Message(internal ? MSG_DEBUGMSG : MSG_WARNING,
"Accessing deprecated member variable %s - deprecated since %d.%d.%d%s%s", sym->SymbolName.GetChars(), vsym->mVersion.major, vsym->mVersion.minor, vsym->mVersion.revision,
deprecationMessage.IsEmpty() ? "" : ", ", deprecationMessage.GetChars());
}
}
Expand Down Expand Up @@ -9661,8 +9662,12 @@ bool FxVMFunctionCall::CheckAccessibility(const VersionInfo &ver)
{
if (Function->mVersion <= ver)
{
// Allow use of deprecated symbols in internal code.
const bool internal = fileSystem.GetFileContainer(Function->OwningClass->mDefFileNo) == 0;
const FString &deprecationMessage = Function->Variants[0].DeprecationMessage;
ScriptPosition.Message(MSG_WARNING, "Accessing deprecated function %s - deprecated since %d.%d.%d%s%s", Function->SymbolName.GetChars(), Function->mVersion.major, Function->mVersion.minor, Function->mVersion.revision,

ScriptPosition.Message(internal ? MSG_DEBUGMSG : MSG_WARNING,
"Accessing deprecated function %s - deprecated since %d.%d.%d%s%s", Function->SymbolName.GetChars(), Function->mVersion.major, Function->mVersion.minor, Function->mVersion.revision,
deprecationMessage.IsEmpty() ? "" : ", ", deprecationMessage.GetChars());
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/common/scripting/core/types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3231,12 +3231,11 @@ PFunctionPointer * NewFunctionPointer(PPrototype * proto, TArray<uint32_t> && ar
//==========================================================================

PStruct::PStruct(FName name, PTypeBase *outer, bool isnative, int fileno)
: PContainerType(name, outer)
: PContainerType(name, outer, fileno)
{
mDescriptiveName.Format("%sStruct<%s>", isnative? "Native" : "", name.GetChars());
Size = 0;
isNative = isnative;
mDefFileNo = fileno;
}

//==========================================================================
Expand Down
5 changes: 2 additions & 3 deletions src/common/scripting/core/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -253,13 +253,14 @@ class PContainerType : public PCompoundType
public:
PTypeBase *Outer = nullptr; // object this type is contained within
FName TypeName = NAME_None; // this type's name
int mDefFileNo = 0;

PContainerType()
{
mDescriptiveName = "ContainerType";
Flags |= TYPE_Container;
}
PContainerType(FName name, PTypeBase *outer) : Outer(outer), TypeName(name)
PContainerType(FName name, PTypeBase *outer, int fileno) : Outer(outer), TypeName(name), mDefFileNo(fileno)
{
mDescriptiveName = name.GetChars();
Flags |= TYPE_Container;
Expand Down Expand Up @@ -648,7 +649,6 @@ class PStruct : public PContainerType
// Some internal structs require explicit construction and destruction of fields the VM cannot handle directly so use these two functions for it.
VMFunction *mConstructor = nullptr;
VMFunction *mDestructor = nullptr;
int mDefFileNo;

PField *AddField(FName name, PType *type, uint32_t flags=0) override;
PField *AddNativeField(FName name, PType *type, size_t address, uint32_t flags = 0, int bitvalue = 0) override;
Expand Down Expand Up @@ -681,7 +681,6 @@ class PClassType : public PContainerType
public:
PClass *Descriptor;
PClassType *ParentType;
int mDefFileNo;

PClassType(PClass *cls = nullptr, int fileno = 0);
PField *AddField(FName name, PType *type, uint32_t flags = 0) override;
Expand Down
7 changes: 5 additions & 2 deletions src/gamedata/decallib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ static const char *DecalKeywords[] =
"colors",
"animator",
"lowerdecal",
"opaqueblood",
"opaqueblood", // Deprecated - use translatable instead!
"translatable",
NULL
};

Expand All @@ -198,6 +199,7 @@ enum
DECAL_ANIMATOR,
DECAL_LOWERDECAL,
DECAL_OPAQUEBLOOD,
DECAL_TRANSLATABLE,
};

const FDecalTemplate *FDecalBase::GetDecal () const
Expand Down Expand Up @@ -483,8 +485,9 @@ void FDecalLib::ParseDecal (FScanner &sc)
break;

case DECAL_OPAQUEBLOOD:
case DECAL_TRANSLATABLE:
newdecal.RenderStyle = STYLE_Normal;
newdecal.opaqueBlood = true;
newdecal.translatable = true;
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/gamedata/decallib.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class FDecalTemplate : public FDecalBase
FRenderStyle RenderStyle;
FTextureID PicNum;
uint16_t RenderFlags;
bool opaqueBlood;
bool translatable;
double Alpha; // same as actor->alpha
const FDecalAnimator *Animator;
const FDecalBase *LowerDecal;
Expand Down
24 changes: 12 additions & 12 deletions src/playsim/a_decals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -692,15 +692,15 @@ void DImpactDecal::Expired()
//
//----------------------------------------------------------------------------

DBaseDecal* DImpactDecal::StaticCreate (FLevelLocals *Level, const char *name, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color, FTranslationID bloodTranslation)
DBaseDecal* DImpactDecal::StaticCreate (FLevelLocals *Level, const char *name, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color, FTranslationID translation)
{
if (cl_maxdecals > 0)
{
const FDecalTemplate *tpl = DecalLibrary.GetDecalByName (name);

if (tpl != NULL && (tpl = tpl->GetDecal()) != NULL)
{
return StaticCreate (Level, tpl, pos, wall, ffloor, color, bloodTranslation);
return StaticCreate (Level, tpl, pos, wall, ffloor, color, translation);
}
}
return nullptr;
Expand All @@ -712,7 +712,7 @@ DBaseDecal* DImpactDecal::StaticCreate (FLevelLocals *Level, const char *name, c
//
//----------------------------------------------------------------------------

DBaseDecal* DImpactDecal::StaticCreate (FLevelLocals *Level, const FDecalTemplate *tpl, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color, FTranslationID bloodTranslation, bool permanent)
DBaseDecal* DImpactDecal::StaticCreate (FLevelLocals *Level, const FDecalTemplate *tpl, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color, FTranslationID translation, bool permanent)
{
DBaseDecal *decal = NULL;
if (tpl != NULL && ((cl_maxdecals > 0 && !(wall->Flags & WALLF_NOAUTODECALS)) || permanent))
Expand All @@ -727,7 +727,7 @@ DBaseDecal* DImpactDecal::StaticCreate (FLevelLocals *Level, const FDecalTemplat
if (tpl->ShadeColor != tpl_low->ShadeColor) lowercolor=0;
else lowercolor = color;

StaticCreate (Level, tpl_low, pos, wall, ffloor, lowercolor, bloodTranslation, permanent);
StaticCreate (Level, tpl_low, pos, wall, ffloor, lowercolor, translation, permanent);
}
if (!permanent) decal = Level->CreateThinker<DImpactDecal>(pos.Z);
else decal = Level->CreateThinker<DBaseDecal>(pos.Z);
Expand All @@ -749,10 +749,10 @@ DBaseDecal* DImpactDecal::StaticCreate (FLevelLocals *Level, const FDecalTemplat
decal->SetShade (color.r, color.g, color.b);
}

// [Nash] opaque blood
if (bloodTranslation != NO_TRANSLATION && tpl->ShadeColor == 0 && tpl->opaqueBlood)
// [Nash] Translatable opaque decal. Note that the decal must be unshaded for this to work.
if (translation != NO_TRANSLATION && tpl->ShadeColor == 0 && tpl->translatable)
{
decal->SetTranslation(bloodTranslation);
decal->SetTranslation(translation);
decal->RenderStyle = STYLE_Normal;
}

Expand Down Expand Up @@ -789,8 +789,8 @@ DBaseDecal *DImpactDecal::CloneSelf (const FDecalTemplate *tpl, double ix, doubl
tpl->ApplyToDecal (decal, wall);
decal->AlphaColor = AlphaColor;

// [Nash] opaque blood
if (tpl->ShadeColor == 0 && tpl->opaqueBlood)
// [Nash] Translatable opaque decal
if (tpl->ShadeColor == 0 && tpl->translatable)
{
decal->SetTranslation(Translation);
decal->RenderStyle = STYLE_Normal;
Expand All @@ -814,7 +814,7 @@ DBaseDecal *DImpactDecal::CloneSelf (const FDecalTemplate *tpl, double ix, doubl
//
//----------------------------------------------------------------------------

void SprayDecal(AActor *shooter, const char *name, double distance, DVector3 offset, DVector3 direction, bool useBloodColor, uint32_t decalColor)
void SprayDecal(AActor *shooter, const char *name, double distance, DVector3 offset, DVector3 direction, bool useBloodColor, uint32_t decalColor, FTranslationID translation)
{
//just in case
if (!shooter)
Expand Down Expand Up @@ -842,14 +842,14 @@ void SprayDecal(AActor *shooter, const char *name, double distance, DVector3 off
else
dir = direction;

auto bloodTrans = useBloodColor ? shooter->BloodTranslation : NO_TRANSLATION;
auto trans = useBloodColor ? shooter->BloodTranslation : translation;
PalEntry entry = !useBloodColor ? (PalEntry)decalColor : shooter->BloodColor;

if (Trace(off, shooter->Sector, dir, distance, 0, ML_BLOCKEVERYTHING, shooter, trace, TRACE_NoSky))
{
if (trace.HitType == TRACE_HitWall)
{
DImpactDecal::StaticCreate(shooter->Level, name, trace.HitPos, trace.Line->sidedef[trace.Side], trace.ffloor, entry, bloodTrans);
DImpactDecal::StaticCreate(shooter->Level, name, trace.HitPos, trace.Line->sidedef[trace.Side], trace.ffloor, entry, trans);
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/playsim/a_sharedglobal.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class DBaseDecal;
struct SpreadInfo;

DBaseDecal *ShootDecal(FLevelLocals *Level, const FDecalTemplate *tpl, sector_t *sec, double x, double y, double z, DAngle angle, double tracedist, bool permanent);
void SprayDecal(AActor *shooter, const char *name,double distance = 172., DVector3 offset = DVector3(0., 0., 0.), DVector3 direction = DVector3(0., 0., 0.), bool useBloodColor = false, uint32_t decalColor = 0);
void SprayDecal(AActor *shooter, const char *name,double distance = 172., DVector3 offset = DVector3(0., 0., 0.), DVector3 direction = DVector3(0., 0., 0.), bool useBloodColor = false, uint32_t decalColor = 0, FTranslationID translation = NO_TRANSLATION);

class DBaseDecal : public DThinker
{
Expand Down Expand Up @@ -73,8 +73,8 @@ class DImpactDecal : public DBaseDecal
}
void Construct(side_t *wall, const FDecalTemplate *templ);

static DBaseDecal *StaticCreate(FLevelLocals *Level, const char *name, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color = 0, FTranslationID bloodTranslation = NO_TRANSLATION);
static DBaseDecal *StaticCreate(FLevelLocals *Level, const FDecalTemplate *tpl, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color = 0, FTranslationID bloodTranslation = NO_TRANSLATION, bool permanent = false);
static DBaseDecal *StaticCreate(FLevelLocals *Level, const char *name, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color = 0, FTranslationID translation = NO_TRANSLATION);
static DBaseDecal *StaticCreate(FLevelLocals *Level, const FDecalTemplate *tpl, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color = 0, FTranslationID translation = NO_TRANSLATION, bool permanent = false);

void BeginPlay ();
void Expired() override;
Expand Down
1 change: 1 addition & 0 deletions src/playsim/actor.h
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,7 @@ enum ActorFlag9
MF9_NOSECTORDAMAGE = 0x00000020, // [inkoalawetrust] Actor ignores any sector-based damage (i.e damaging floors, NOT crushers)
MF9_ISPUFF = 0x00000040, // [AA] Set on actors by P_SpawnPuff
MF9_FORCESECTORDAMAGE = 0x00000080, // [inkoalawetrust] Actor ALWAYS takes hurt floor damage if there's any. Even if the floor doesn't have SECMF_HURTMONSTERS.
MF9_NOAUTOOFFSKULLFLY = 0x00000100, // Don't automatically disable MF_SKULLFLY if velocity is 0.
};

// --- mobj.renderflags ---
Expand Down
3 changes: 2 additions & 1 deletion src/playsim/p_actionfunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5070,7 +5070,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_SprayDecal)
PARAM_FLOAT(direction_z);
PARAM_BOOL(useBloodColor);
PARAM_COLOR(decalColor);
SprayDecal(self, name.GetChars(), dist, DVector3(offset_x, offset_y, offset_z), DVector3(direction_x, direction_y, direction_z), useBloodColor, decalColor);
PARAM_INT(translation);
SprayDecal(self, name.GetChars(), dist, DVector3(offset_x, offset_y, offset_z), DVector3(direction_x, direction_y, direction_z), useBloodColor, decalColor, FTranslationID::fromInt(translation));
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion src/playsim/p_mobj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2105,7 +2105,7 @@ static double P_XYMovement (AActor *mo, DVector2 scroll)

if (move.isZero())
{
if (mo->flags & MF_SKULLFLY)
if ((mo->flags & MF_SKULLFLY) && !(mo->flags9 & MF9_NOAUTOOFFSKULLFLY))
{
// the skull slammed into something
mo->flags &= ~MF_SKULLFLY;
Expand Down
1 change: 1 addition & 0 deletions src/scripting/thingdef_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ static FFlagDef ActorFlagDefs[]=
DEFINE_FLAG(MF9, NOSECTORDAMAGE, AActor, flags9),
DEFINE_PROTECTED_FLAG(MF9, ISPUFF, AActor, flags9), //[AA] was spawned by SpawnPuff
DEFINE_FLAG(MF9, FORCESECTORDAMAGE, AActor, flags9),
DEFINE_FLAG(MF9, NOAUTOOFFSKULLFLY, AActor, flags9),

// Effect flags
DEFINE_FLAG(FX, VISIBILITYPULSE, AActor, effects),
Expand Down
14 changes: 14 additions & 0 deletions wadsrc/static/filter/game-doomchex/sndinfo.txt
Original file line number Diff line number Diff line change
Expand Up @@ -456,3 +456,17 @@ $alias intermission/nextstage weapons/rocklx
$alias intermission/paststats weapons/shotgr
$alias intermission/pastcoopstats weapons/shotgr
$alias intermission/pastdmstats *gibbed


// id24 sounds

weapons/incinerator/fire1 DSINCFI1
weapons/incinerator/fire2 DSINCFI2
weapons/incinerator/burn DSINCBRN
weapons/incinerator/hot1 DSINCHT1
weapons/incinerator/hot2 DSINCHT2
weapons/incinerator/hot3 DSINCHT3

weapons/calamityblade/charge DSHETCHG
weapons/calamityblade/shoot DSHETSHT
weapons/calamityblade/explode DSHETXPL
4 changes: 4 additions & 0 deletions wadsrc/static/mapinfo/doomitems.txt
Original file line number Diff line number Diff line change
Expand Up @@ -149,4 +149,8 @@ DoomEdNums
9109 = MarinePlasma
9110 = MarineRailgun
9111 = MarineBFG
-28622 = ID24Fuel
-28621 = ID24FuelTank
-28620 = ID24CalamityBlade
-28619 = ID24Incinerator
}
4 changes: 4 additions & 0 deletions wadsrc/static/zscript.txt
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ version "4.12"
#include "zscript/actors/doom/weaponbfg.zs"
#include "zscript/actors/doom/dehacked.zs"

#include "zscript/actors/doom/id24/id24ammo.zs"
#include "zscript/actors/doom/id24/id24incinerator.zs"
#include "zscript/actors/doom/id24/id24calamityblade.zs"

#include "zscript/actors/doom/deadthings.zs"
#include "zscript/actors/doom/doomammo.zs"
#include "zscript/actors/doom/doomarmor.zs"
Expand Down
2 changes: 1 addition & 1 deletion wadsrc/static/zscript/actors/actor.zs
Original file line number Diff line number Diff line change
Expand Up @@ -1300,7 +1300,7 @@ class Actor : Thinker native
native bool A_SetVisibleRotation(double anglestart = 0, double angleend = 0, double pitchstart = 0, double pitchend = 0, int flags = 0, int ptr = AAPTR_DEFAULT);
native void A_SetTranslation(name transname);
native bool A_SetSize(double newradius = -1, double newheight = -1, bool testpos = false);
native void A_SprayDecal(String name, double dist = 172, vector3 offset = (0, 0, 0), vector3 direction = (0, 0, 0), bool useBloodColor = false, color decalColor = 0);
native void A_SprayDecal(String name, double dist = 172, vector3 offset = (0, 0, 0), vector3 direction = (0, 0, 0), bool useBloodColor = false, color decalColor = 0, TranslationID translation = 0);
native void A_SetMugshotState(String name);
native void CopyBloodColor(Actor other);

Expand Down
4 changes: 2 additions & 2 deletions wadsrc/static/zscript/actors/doom/doomplayer.zs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ class DoomPlayer : PlayerPawn
Player.WeaponSlot 3, "Shotgun", "SuperShotgun";
Player.WeaponSlot 4, "Chaingun";
Player.WeaponSlot 5, "RocketLauncher";
Player.WeaponSlot 6, "PlasmaRifle";
Player.WeaponSlot 7, "BFG9000";
Player.WeaponSlot 6, "ID24Incinerator", "PlasmaRifle";
Player.WeaponSlot 7, "ID24CalamityBlade", "BFG9000";

Player.ColorRange 112, 127;
Player.Colorset 0, "$TXT_COLOR_GREEN", 0x70, 0x7F, 0x72;
Expand Down
57 changes: 57 additions & 0 deletions wadsrc/static/zscript/actors/doom/id24/id24ammo.zs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*****************************************************************************
* Copyright (C) 1993-2024 id Software LLC, a ZeniMax Media company.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
****************************************************************************/

/*****************************************************************************
* id1 - decohack - ammo
****************************************************************************/

//converted from DECOHACK and from id24data.cpp

class ID24Fuel : Ammo
{
Default
{
Inventory.PickupMessage "$ID24_GOTFUELCAN";
Inventory.Amount 10;
Inventory.MaxAmount 150;
Ammo.BackpackAmount 10;
Ammo.BackpackMaxAmount 300;
Inventory.Icon "FTNKA0";
Tag "$AMMO_ID24FUEL";
}
States
{
Spawn:
FCPU A -1;
Stop;
}
}

class ID24FuelTank : ID24Fuel
{
Default
{
Inventory.PickupMessage "$ID24_GOTFUELTANK";
Inventory.Amount 50;
Ammo.DropAmmoFactorMultiplier 0.8; // tank has 20 drop amount, not 25, so multiply the factor by a further 0.8
// -- for custom dehacked ammo this can be calculated based on the drop amount and the default factor
Tag "$AMMO_ID24FUELTANK";
}
States
{
Spawn:
FTNK A -1;
Stop;
}
}
Loading

0 comments on commit 9c79016

Please sign in to comment.