Merge branch 'master' of https://github.com/coelckers/gzdoom into lightmaps2

This commit is contained in:
nashmuhandes 2021-10-05 12:53:05 +08:00
commit d35cd9549f
21 changed files with 80 additions and 86 deletions

View file

@ -11,26 +11,17 @@ body:
## Please fill out forms as cleanly as possible. ## Please fill out forms as cleanly as possible.
#### Make sure that you have #### Make sure that you have
* properly edited & filled in the title of this bug report * properly edited & filled in the title of this bug report
- type: dropdown - type: input
id: version id: version
attributes: attributes:
label: GZDoom version label: GZDoom version
description: | description: |
What version are you using? What version are you using?
Run `gzdoom --version` Run `gzdoom --version` or check in the console in game.
Make sure to update to latest [release](https://github.com/coelckers/gzdoom/releases) version and test again before continuing. Make sure to update to latest [release](https://github.com/coelckers/gzdoom/releases) version and test again before continuing.
multiple: false placeholder: "ex: GZDoom 4.0.0, Git version, Branch, other"
options:
- 4.6.1
- 4.6.0
- 4.5.0
- 4.4.2
- 4.4.1
- 4.4.0
- Git
- Other
validations: validations:
required: true required: false
- type: dropdown - type: dropdown
id: gameid id: gameid
attributes: attributes:

View file

@ -11,26 +11,17 @@ body:
## Please fill out forms as cleanly as possible. ## Please fill out forms as cleanly as possible.
#### Make sure that you have #### Make sure that you have
* properly edited & filled in the title of this bug report * properly edited & filled in the title of this bug report
- type: dropdown - type: input
id: version id: version
attributes: attributes:
label: GZDoom version label: GZDoom version
description: | description: |
What version are you using? What version are you using?
Run `gzdoom --version` Run `gzdoom --version` or check in the console in game.
Make sure to update to latest [release](https://github.com/coelckers/gzdoom/releases) version and test again before continuing. Make sure to update to latest [release](https://github.com/coelckers/gzdoom/releases) version and test again before continuing.
multiple: false placeholder: "ex: GZDoom 4.0.0, Git version, Branch, other"
options:
- 4.6.1
- 4.6.0
- 4.5.0
- 4.4.2
- 4.4.1
- 4.4.0
- Git
- Other
validations: validations:
required: true required: false
- type: dropdown - type: dropdown
id: gameid id: gameid
attributes: attributes:

View file

@ -243,7 +243,7 @@ public:
bool mIsFirstPass = true; bool mIsFirstPass = true;
}; };
struct DShape2DBufferInfo : NoVirtualRefCountedBase struct DShape2DBufferInfo : RefCountedBase
{ {
TArray<F2DVertexBuffer> buffers; TArray<F2DVertexBuffer> buffers;
bool needsVertexUpload = true; bool needsVertexUpload = true;

View file

@ -94,6 +94,7 @@ FFont *V_GetFont(const char *name, const char *fontlumpname)
{ {
if (!stricmp(name, "DBIGFONT")) name = "BigFont"; if (!stricmp(name, "DBIGFONT")) name = "BigFont";
else if (!stricmp(name, "CONFONT")) name = "ConsoleFont"; // several mods have used the name CONFONT directly and effectively duplicated the font. else if (!stricmp(name, "CONFONT")) name = "ConsoleFont"; // several mods have used the name CONFONT directly and effectively duplicated the font.
else if (!stricmp(name, "INDEXFON")) name = "IndexFont"; // Same here - for whatever reason some people had to use its 8 character name...
FFont *font = FFont::FindFont (name); FFont *font = FFont::FindFont (name);
if (font == nullptr) if (font == nullptr)
{ {
@ -873,6 +874,7 @@ void V_InitFonts()
NewSmallFont = CreateHexLumpFont2("NewSmallFont", lump); NewSmallFont = CreateHexLumpFont2("NewSmallFont", lump);
CurrentConsoleFont = NewConsoleFont; CurrentConsoleFont = NewConsoleFont;
ConFont = V_GetFont("ConsoleFont", "CONFONT"); ConFont = V_GetFont("ConsoleFont", "CONFONT");
V_GetFont("IndexFont", "INDEXFON"); // detect potential replacements for this one.
} }
void V_LoadTranslations() void V_LoadTranslations()

View file

@ -910,7 +910,7 @@ static void ParseOptionSettings(FScanner &sc)
else if (sc.Compare("Linespacing")) else if (sc.Compare("Linespacing"))
{ {
sc.MustGetNumber(); sc.MustGetNumber();
OptionSettings.mLinespacing = sc.Number; // ignored
} }
else if (sc.Compare("LabelOffset")) else if (sc.Compare("LabelOffset"))
{ {
@ -1402,6 +1402,7 @@ void M_ParseMenuDefs()
DefaultOptionMenuSettings = Create<DOptionMenuDescriptor>(); DefaultOptionMenuSettings = Create<DOptionMenuDescriptor>();
DefaultListMenuSettings->Reset(); DefaultListMenuSettings->Reset();
DefaultOptionMenuSettings->Reset(); DefaultOptionMenuSettings->Reset();
OptionSettings.mLinespacing = 17;
int IWADMenu = fileSystem.CheckNumForName("MENUDEF", ns_global, fileSystem.GetIwadNum()); int IWADMenu = fileSystem.CheckNumForName("MENUDEF", ns_global, fileSystem.GetIwadNum());

View file

@ -229,6 +229,7 @@ DObject::DObject ()
ObjNext = GC::Root; ObjNext = GC::Root;
GCNext = nullptr; GCNext = nullptr;
GC::Root = this; GC::Root = this;
GC::AllocCount++;
} }
DObject::DObject (PClass *inClass) DObject::DObject (PClass *inClass)
@ -238,6 +239,7 @@ DObject::DObject (PClass *inClass)
ObjNext = GC::Root; ObjNext = GC::Root;
GCNext = nullptr; GCNext = nullptr;
GC::Root = this; GC::Root = this;
GC::AllocCount++;
} }
//========================================================================== //==========================================================================
@ -275,6 +277,7 @@ DObject::~DObject ()
void DObject::Release() void DObject::Release()
{ {
if (GC::AllocCount > 0) GC::AllocCount--;
DObject **probe; DObject **probe;
// Unlink this object from the GC list. // Unlink this object from the GC list.

View file

@ -108,6 +108,7 @@ namespace GC
size_t AllocBytes; size_t AllocBytes;
size_t Threshold; size_t Threshold;
size_t Estimate; size_t Estimate;
size_t AllocCount;
DObject *Gray; DObject *Gray;
DObject *Root; DObject *Root;
DObject *SoftRoots; DObject *SoftRoots;

View file

@ -43,6 +43,9 @@ namespace GC
// Number of bytes currently allocated through M_Malloc/M_Realloc. // Number of bytes currently allocated through M_Malloc/M_Realloc.
extern size_t AllocBytes; extern size_t AllocBytes;
// Number of allocated objects since last CheckGC call.
extern size_t AllocCount;
// Amount of memory to allocate before triggering a collection. // Amount of memory to allocate before triggering a collection.
extern size_t Threshold; extern size_t Threshold;
@ -105,10 +108,15 @@ namespace GC
} }
// Check if it's time to collect, and do a collection step if it is. // Check if it's time to collect, and do a collection step if it is.
static inline void CheckGC() static inline bool CheckGC()
{ {
AllocCount = 0;
if (AllocBytes >= Threshold) if (AllocBytes >= Threshold)
{
Step(); Step();
return true;
}
return false;
} }
// Forces a collection to start now. // Forces a collection to start now.

View file

@ -294,11 +294,11 @@ void EventManager::WorldLoaded()
} }
} }
void EventManager::WorldUnloaded() void EventManager::WorldUnloaded(const FString& nextmap)
{ {
for (DStaticEventHandler* handler = LastEventHandler; handler; handler = handler->prev) for (DStaticEventHandler* handler = LastEventHandler; handler; handler = handler->prev)
{ {
handler->WorldUnloaded(); handler->WorldUnloaded(nextmap);
} }
} }
@ -629,6 +629,7 @@ DEFINE_FIELD_X(RenderEvent, FRenderEvent, Camera);
DEFINE_FIELD_X(WorldEvent, FWorldEvent, IsSaveGame); DEFINE_FIELD_X(WorldEvent, FWorldEvent, IsSaveGame);
DEFINE_FIELD_X(WorldEvent, FWorldEvent, IsReopen); DEFINE_FIELD_X(WorldEvent, FWorldEvent, IsReopen);
DEFINE_FIELD_X(WorldEvent, FWorldEvent, NextMap);
DEFINE_FIELD_X(WorldEvent, FWorldEvent, Thing); DEFINE_FIELD_X(WorldEvent, FWorldEvent, Thing);
DEFINE_FIELD_X(WorldEvent, FWorldEvent, Inflictor); DEFINE_FIELD_X(WorldEvent, FWorldEvent, Inflictor);
DEFINE_FIELD_X(WorldEvent, FWorldEvent, Damage); DEFINE_FIELD_X(WorldEvent, FWorldEvent, Damage);
@ -769,13 +770,14 @@ void DStaticEventHandler::WorldLoaded()
} }
} }
void DStaticEventHandler::WorldUnloaded() void DStaticEventHandler::WorldUnloaded(const FString& nextmap)
{ {
IFVIRTUAL(DStaticEventHandler, WorldUnloaded) IFVIRTUAL(DStaticEventHandler, WorldUnloaded)
{ {
// don't create excessive DObjects if not going to be processed anyway // don't create excessive DObjects if not going to be processed anyway
if (isEmpty(func)) return; if (isEmpty(func)) return;
FWorldEvent e = owner->SetupWorldEvent(); FWorldEvent e = owner->SetupWorldEvent();
e.NextMap = nextmap;
VMValue params[2] = { (DStaticEventHandler*)this, &e }; VMValue params[2] = { (DStaticEventHandler*)this, &e };
VMCall(func, params, 2, nullptr, 0); VMCall(func, params, 2, nullptr, 0);
} }

View file

@ -78,7 +78,7 @@ public:
// //
void WorldLoaded(); void WorldLoaded();
void WorldUnloaded(); void WorldUnloaded(const FString& nextmap);
void WorldThingSpawned(AActor* actor); void WorldThingSpawned(AActor* actor);
void WorldThingDied(AActor* actor, AActor* inflictor); void WorldThingDied(AActor* actor, AActor* inflictor);
void WorldThingGround(AActor* actor, FState* st); void WorldThingGround(AActor* actor, FState* st);
@ -144,6 +144,7 @@ struct FWorldEvent
// for loaded/unloaded // for loaded/unloaded
bool IsSaveGame = false; bool IsSaveGame = false;
bool IsReopen = false; bool IsReopen = false;
FString NextMap;
// for thingspawned, thingdied, thingdestroyed // for thingspawned, thingdied, thingdestroyed
AActor* Thing = nullptr; // for thingdied AActor* Thing = nullptr; // for thingdied
AActor* Inflictor = nullptr; // can be null - for damagemobj AActor* Inflictor = nullptr; // can be null - for damagemobj
@ -232,7 +233,7 @@ struct EventManager
// called right after the map has loaded (approximately same time as OPEN ACS scripts) // called right after the map has loaded (approximately same time as OPEN ACS scripts)
void WorldLoaded(); void WorldLoaded();
// called when the map is about to unload (approximately same time as UNLOADING ACS scripts) // called when the map is about to unload (approximately same time as UNLOADING ACS scripts)
void WorldUnloaded(); void WorldUnloaded(const FString& nextmap);
// called around PostBeginPlay of each actor. // called around PostBeginPlay of each actor.
void WorldThingSpawned(AActor* actor); void WorldThingSpawned(AActor* actor);
// called after AActor::Die of each actor. // called after AActor::Die of each actor.

View file

@ -1316,6 +1316,15 @@ void G_Ticker ()
default: default:
break; break;
} }
// Do some more aggressive GC maintenance when the game ticker is inactive.
if ((gamestate != GS_LEVEL && gamestate != GS_TITLELEVEL) || paused || P_CheckTickerPaused())
{
size_t ac = std::max<size_t>(10, GC::AllocCount);
for (size_t i = 0; i < ac; i++)
{
if (!GC::CheckGC()) break;
}
}
// [MK] Additional ticker for UI events right after all others // [MK] Additional ticker for UI events right after all others
primaryLevel->localEventManager->PostUiTick(); primaryLevel->localEventManager->PostUiTick();

View file

@ -468,7 +468,7 @@ void G_InitNew (const char *mapname, bool bTitleLevel)
// did we have any level before? // did we have any level before?
if (primaryLevel->info != nullptr) if (primaryLevel->info != nullptr)
staticEventManager.WorldUnloaded(); staticEventManager.WorldUnloaded(FString()); // [MK] don't pass the new map, as it's not a level transition
if (!savegamerestore) if (!savegamerestore)
{ {
@ -701,10 +701,10 @@ void FLevelLocals::ChangeLevel(const char *levelname, int position, int inflags,
for (auto Level : AllLevels()) for (auto Level : AllLevels())
{ {
// Todo: This must be exolicitly sandboxed! // Todo: This must be exolicitly sandboxed!
Level->localEventManager->WorldUnloaded(); Level->localEventManager->WorldUnloaded(nextlevel);
} }
// [ZZ] unsafe world unload (changemap != map) // [ZZ] unsafe world unload (changemap != map)
staticEventManager.WorldUnloaded(); staticEventManager.WorldUnloaded(nextlevel);
unloading = false; unloading = false;
STAT_ChangeLevel(nextlevel, this); STAT_ChangeLevel(nextlevel, this);

View file

@ -764,22 +764,6 @@ static void CreateLineEffectFunc(FunctionCallEmitter &emitters, int value1, int
emitters.AddParameterIntConst(value2); // tag emitters.AddParameterIntConst(value2); // tag
} }
// No misc, but it's basically A_Explode with an added effect
static void CreateNailBombFunc(FunctionCallEmitter &emitters, int value1, int value2, MBFParamState* state)
{ // A_Explode
// This one does not actually have MBF-style parameters. But since
// we're aliasing it to an extension of A_Explode...
emitters.AddParameterIntConst(-1); // damage
emitters.AddParameterIntConst(-1); // distance
emitters.AddParameterIntConst(1); // flags (1=XF_HURTSOURCE)
emitters.AddParameterIntConst(0); // alert
emitters.AddParameterIntConst(0); // fulldamagedistance
emitters.AddParameterIntConst(30); // nails
emitters.AddParameterIntConst(10); // naildamage
emitters.AddParameterPointerConst(PClass::FindClass(NAME_BulletPuff)); // itemtype
emitters.AddParameterIntConst(NAME_None); // damage type
}
static void CreateSpawnObjectFunc(FunctionCallEmitter& emitters, int value1, int value2, MBFParamState* state) static void CreateSpawnObjectFunc(FunctionCallEmitter& emitters, int value1, int value2, MBFParamState* state)
{ {
state->ValidateArgCount(8, "A_SpawnObject"); state->ValidateArgCount(8, "A_SpawnObject");
@ -936,7 +920,6 @@ static void (*MBFCodePointerFactories[])(FunctionCallEmitter&, int, int, MBFPara
{ {
// Die and Detonate are not in this list because these codepointers have // Die and Detonate are not in this list because these codepointers have
// no dehacked arguments and therefore do not need special handling. // no dehacked arguments and therefore do not need special handling.
// NailBomb has no argument but is implemented as new parameters for A_Explode.
CreateMushroomFunc, CreateMushroomFunc,
CreateSpawnFunc, CreateSpawnFunc,
CreateTurnFunc, CreateTurnFunc,
@ -945,7 +928,6 @@ static void (*MBFCodePointerFactories[])(FunctionCallEmitter&, int, int, MBFPara
CreatePlaySoundFunc, CreatePlaySoundFunc,
CreateRandomJumpFunc, CreateRandomJumpFunc,
CreateLineEffectFunc, CreateLineEffectFunc,
CreateNailBombFunc,
CreateSpawnObjectFunc, CreateSpawnObjectFunc,
CreateMonsterProjectileFunc, CreateMonsterProjectileFunc,
CreateMonsterBulletAttackFunc, CreateMonsterBulletAttackFunc,

View file

@ -109,21 +109,22 @@ static inline bool P_IsThingSpecial(int specnum)
return (specnum >= Thing_Projectile && specnum <= Thing_SpawnNoFog) || return (specnum >= Thing_Projectile && specnum <= Thing_SpawnNoFog) ||
specnum == Thing_SpawnFacing || specnum == Thing_ProjectileIntercept || specnum == Thing_ProjectileAimed; specnum == Thing_SpawnFacing || specnum == Thing_ProjectileIntercept || specnum == Thing_ProjectileAimed;
} }
namespace
enum
{ {
Dm=1, enum
Ht=2, {
Hx=4, Dm=1, // Doom
St=8, Ht=2, // Heretic
Zd=16, Hx=4, // Hexen
Zdt=32, St=8, // Strife
Va=64, Zd=16, // ZDoom
Zdt=32, // ZDoom Translated
// will be extended later. Unknown namespaces will always be treated like the base Va=64, // Vavoom
// namespace for each game
};
// will be extended later. Unknown namespaces will always be treated like the base
// namespace for each game
};
}
#define CHECK_N(f) if (!(namespace_bits&(f))) break; #define CHECK_N(f) if (!(namespace_bits&(f))) break;
//=========================================================================== //===========================================================================

View file

@ -584,7 +584,7 @@ bool AActor::SetState (FState *newstate, bool nofunction)
newstate = newstate->GetNextState(); newstate = newstate->GetNextState();
} while (tics == 0); } while (tics == 0);
if (GetInfo()->LightAssociations.Size() || (newstate && newstate->Light > 0)) if (GetInfo()->LightAssociations.Size() || (state && state->Light > 0))
{ {
flags8 |= MF8_RECREATELIGHTS; flags8 |= MF8_RECREATELIGHTS;
Level->flags3 |= LEVEL3_LIGHTCREATED; Level->flags3 |= LEVEL3_LIGHTCREATED;

View file

@ -1193,12 +1193,11 @@ Aliases
A_PlaySound, A_PlaySound, A_PlaySound, A_PlaySound,
A_RandomJump, A_Jump, A_RandomJump, A_Jump,
A_LineEffect, A_LineEffect, A_LineEffect, A_LineEffect,
A_NailBomb, A_Explode,
A_SpawnObject, MBF21_SpawnObject, A_SpawnObject, MBF21_SpawnObject,
A_MonsterProjectile, MBF21_MonsterProjectile, A_MonsterProjectile, MBF21_MonsterProjectile,
A_MonsterBulletAttack, MBF21_MonsterBulletAttack, A_MonsterBulletAttack, MBF21_MonsterBulletAttack,
A_MonsterMeleeAttack, MBF21_MonsterMeleeAttack, A_MonsterMeleeAttack, MBF21_MonsterMeleeAttack,
A_RadiusDamage, A_Explode, A_RadiusDamage, A_RadiusDamage,
A_HealChase, MBF21_HealChase, A_HealChase, MBF21_HealChase,
A_SeekTracer, A_SeekerMissile, A_SeekTracer, A_SeekerMissile,
A_FindTracer, A_FindTracer, A_FindTracer, A_FindTracer,

View file

@ -344,18 +344,6 @@ OptionValue AutoOffOn
1, "$OPTVAL_ON" 1, "$OPTVAL_ON"
} }
OptionMenuSettings
{
// These can be overridden if a different menu fonts requires it.
Linespacing 17
/*
IfGame(Heretic, Hexen)
{
Linespacing 9
}
*/
}
DefaultOptionMenu DefaultOptionMenu
{ {
Position -15 Position -15

View file

@ -616,6 +616,18 @@ extend class Actor
return count; return count;
} }
deprecated("2.3", "For Dehacked use only")
void A_NailBomb()
{
A_Explode(nails:30);
}
deprecated("2.3", "For Dehacked use only")
void A_RadiusDamage(int dam, int dist)
{
A_Explode(dam, dist);
}
//========================================================================== //==========================================================================
// //
// A_RadiusThrust // A_RadiusThrust

View file

@ -66,9 +66,10 @@ extend class Actor
damage *= 10; damage *= 10;
double ang = angle + Random2[Punch]() * (5.625 / 256); double ang = angle + Random2[Punch]() * (5.625 / 256);
double pitch = AimLineAttack (ang, MeleeRange + MELEEDELTA, null, 0., ALF_CHECK3D); double range = MeleeRange + MELEEDELTA;
double pitch = AimLineAttack (ang, range, null, 0., ALF_CHECK3D);
LineAttack (ang, MeleeRange, pitch, damage, 'Melee', "BulletPuff", LAF_ISMELEEATTACK, t); LineAttack (ang, range, pitch, damage, 'Melee', "BulletPuff", LAF_ISMELEEATTACK, t);
// turn to face target // turn to face target
if (t.linetarget) if (t.linetarget)

View file

@ -2084,7 +2084,7 @@ class PlayerPawn : Actor
me.GiveDefaultInventory(); me.GiveDefaultInventory();
} }
} }
//=========================================================================== //===========================================================================
// //
// FWeaponSlot :: PickWeapon // FWeaponSlot :: PickWeapon

View file

@ -15,6 +15,8 @@ struct WorldEvent native play version("2.4")
native readonly bool IsSaveGame; native readonly bool IsSaveGame;
// this will be true if we are re-entering the hub level. // this will be true if we are re-entering the hub level.
native readonly bool IsReopen; native readonly bool IsReopen;
// for unloaded, name of next map (if any)
native readonly String NextMap;
// for thingspawned/thingdied/thingdestroyed/thingground // for thingspawned/thingdied/thingdestroyed/thingground
native readonly Actor Thing; native readonly Actor Thing;
// for thingdied. can be null // for thingdied. can be null