From 4fb48b332b8faab1ab731653a84c941abed27609 Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Sat, 28 Nov 2015 10:53:34 -0600 Subject: [PATCH 01/37] Added A_CheckProximity. - Checks to see if a certain actor class, in numbers, is close to the actor/pointer via distance, based upon count. Can check for ancestry, disable Z searching, perform less than or equal to instead of greater or equal to, exact counts, check a pointer instead of itself and differentiate between live monsters and dead. --- src/thingdef/thingdef_codeptr.cpp | 99 +++++++++++++++++++++++++++++- wadsrc/static/actors/actor.txt | 1 + wadsrc/static/actors/constants.txt | 11 ++++ 3 files changed, 110 insertions(+), 1 deletion(-) diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 14440d884..c01ff687e 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -5886,6 +5886,103 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetRipMax) self->RipLevelMax = max; } +//========================================================================== +// +// A_CheckProximity(jump, classname, distance, count, flags, ptr) +// +// Checks to see if a certain actor class is close to the +// actor/pointer within distance, in numbers. +//========================================================================== +enum CPXFflags +{ + CPXF_ANCESTOR = 1, + CPXF_LESSOREQUAL = 1 << 1, + CPXF_NOZ = 1 << 2, + CPXF_COUNTDEAD = 1 << 3, + CPXF_DEADONLY = 1 << 4, + CPXF_EXACT = 1 << 5, +}; +DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckProximity) +{ + ACTION_PARAM_START(6); + ACTION_PARAM_STATE(jump, 0); + ACTION_PARAM_CLASS(classname, 1); + ACTION_PARAM_FIXED(distance, 2); + ACTION_PARAM_INT(count, 3); + ACTION_PARAM_INT(flags, 4); + ACTION_PARAM_INT(ptr, 5); + + ACTION_SET_RESULT(false); //No inventory chain results please. + AActor *ref = COPY_AAPTR(self, ptr); + + //We need these to check out. + if (!ref || !jump || !classname || distance <= 0) + return; + + int counter = 0; + bool result = false; + + TThinkerIterator it; + AActor * mo; + + //[MC] Process of elimination, I think, will get through this as quickly and + //efficiently as possible. + while ((mo = it.Next())) + { + if (mo == ref) //Don't count self. + continue; + + //Check inheritance for the classname. Taken partly from CheckClass DECORATE function. + if (flags & CPXF_ANCESTOR) + { + if (!(mo->GetClass()->IsAncestorOf(classname))) + continue; + } + //Otherwise, just check for the regular class name. + else if (classname != mo->GetClass()) + continue; + + //Make sure it's in range and respect the desire for Z or not. + if (P_AproxDistance(ref->x - mo->x, ref->y - mo->y) < distance && + ((flags & CPXF_NOZ) || + ((ref->z > mo->z && ref->z - (mo->z + mo->height) < distance) || + (ref->z <= mo->z && mo->z - (ref->z + ref->height) < distance)))) + { + if (mo->flags6 & MF6_KILLED) + { + if (!(flags & (CPXF_COUNTDEAD | CPXF_DEADONLY))) + continue; + counter++; + } + else + { + if (flags & CPXF_DEADONLY) + continue; + counter++; + } + + //Abort if the number of matching classes nearby is greater, we have obviously succeeded in our goal. + if (counter > count) + { + result = (flags & (CPXF_LESSOREQUAL | CPXF_EXACT)) ? false : true; + break; + } + } + } + + if (counter == count) + result = true; + else if (counter < count) + result = !!((flags & CPXF_LESSOREQUAL) && !(flags & CPXF_EXACT)); + + + + if (result) + { + ACTION_JUMP(jump); + } +} + /*=========================================================================== A_CheckBlock (state block, int flags, int ptr) @@ -5944,4 +6041,4 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckBlock) { ACTION_JUMP(block); } -} \ No newline at end of file +} diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index be4b8b416..5158aa7b5 100644 --- a/wadsrc/static/actors/actor.txt +++ b/wadsrc/static/actors/actor.txt @@ -337,6 +337,7 @@ ACTOR Actor native //: Thinker action native A_SetRipperLevel(int level); action native A_SetRipMin(int min); action native A_SetRipMax(int max); + action native A_CheckProximity(state jump, class classname, float distance, int count = 1, int flags = 0, int ptr = AAPTR_DEFAULT); action native A_CheckBlock(state block, int flags = 0, int ptr = AAPTR_DEFAULT); action native A_CheckSightOrRange(float distance, state label, bool two_dimension = false); action native A_CheckRange(float distance, state label, bool two_dimension = false); diff --git a/wadsrc/static/actors/constants.txt b/wadsrc/static/actors/constants.txt index 7f8fbc09e..956ed119f 100644 --- a/wadsrc/static/actors/constants.txt +++ b/wadsrc/static/actors/constants.txt @@ -484,6 +484,17 @@ enum QF_WAVE = 1 << 5, }; +// A_CheckProximity flags +enum +{ + CPXF_ANCESTOR = 1, + CPXF_LESSOREQUAL = 1 << 1, + CPXF_NOZ = 1 << 2, + CPXF_COUNTDEAD = 1 << 3, + CPXF_DEADONLY = 1 << 4, + CPXF_EXACT = 1 << 5, +}; + // Flags for A_CheckBlock // These flags only affect the calling actor('s pointer), not the ones being searched. enum From 9bfd67678330da477c3bf996536b6eaa2e33ff66 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 29 Nov 2015 11:28:26 +0100 Subject: [PATCH 02/37] - allow setting the FloatbobPhase through UDMF. --- specs/udmf_zdoom.txt | 1 + src/doomdata.h | 1 + src/namedef.h | 1 + src/p_buildmap.cpp | 1 + src/p_mobj.cpp | 1 + src/p_setup.cpp | 2 ++ src/p_udmf.cpp | 6 ++++++ 7 files changed, 13 insertions(+) diff --git a/specs/udmf_zdoom.txt b/specs/udmf_zdoom.txt index 6541e9a02..d501cb884 100644 --- a/specs/udmf_zdoom.txt +++ b/specs/udmf_zdoom.txt @@ -237,6 +237,7 @@ Note: All fields default to false unless mentioned otherwise. scalex = ; // Vertical scaling on thing. Default = 0 (ignored). scaley = ; // Horizontal scaling on thing. Default = 0 (ignored). scale = ; // Vertical and horizontal scaling on thing. Default = 0 (ignored). + floatbobphase = ; // Sets the thing's floatbobphase. Valid phase values are 0-63. Default = -1 (use actor class default). * Note about arg0str diff --git a/src/doomdata.h b/src/doomdata.h index 71e581e26..0877aee90 100644 --- a/src/doomdata.h +++ b/src/doomdata.h @@ -365,6 +365,7 @@ struct FMapThing short pitch; short roll; DWORD RenderStyle; + int FloatbobPhase; }; diff --git a/src/namedef.h b/src/namedef.h index 0d49bba76..22dbe1b51 100644 --- a/src/namedef.h +++ b/src/namedef.h @@ -396,6 +396,7 @@ xx(Roll) xx(Scale) xx(ScaleX) xx(ScaleY) +xx(Floatbobphase) xx(Blocking) xx(Blockmonsters) diff --git a/src/p_buildmap.cpp b/src/p_buildmap.cpp index 46c2b9f4c..670f53751 100644 --- a/src/p_buildmap.cpp +++ b/src/p_buildmap.cpp @@ -707,6 +707,7 @@ static int LoadSprites (spritetype *sprites, Xsprite *xsprites, int numsprites, mapthings[count].RenderStyle = STYLE_Count; mapthings[count].alpha = -1; mapthings[count].health = -1; + mapthings[count].FloatbobPhase = -1; if (xsprites != NULL && sprites[i].lotag == 710) { // Blood ambient sound diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index d5c5eb5d9..ab89ae04c 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -4917,6 +4917,7 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position) mobj->SpawnPoint[2] = mthing->z; mobj->SpawnAngle = mthing->angle; mobj->SpawnFlags = mthing->flags; + if (mthing->FloatbobPhase >= 0 && mthing->FloatbobPhase < 64) mobj->FloatBobPhase = mthing->FloatbobPhase; if (mthing->gravity < 0) mobj->gravity = -mthing->gravity; else if (mthing->gravity > 0) mobj->gravity = FixedMul(mobj->gravity, mthing->gravity); else mobj->flags &= ~MF_NOGRAVITY; diff --git a/src/p_setup.cpp b/src/p_setup.cpp index 311bf8fc4..50e7f41d6 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -1758,6 +1758,7 @@ void P_LoadThings (MapData * map) mti[i].RenderStyle = STYLE_Count; mti[i].alpha = -1; mti[i].health = 1; + mti[i].FloatbobPhase = -1; flags &= ~MTF_SKILLMASK; mti[i].flags = (short)((flags & 0xf) | 0x7e0); if (gameinfo.gametype == GAME_Strife) @@ -1842,6 +1843,7 @@ void P_LoadThings2 (MapData * map) mti[i].RenderStyle = STYLE_Count; mti[i].alpha = -1; mti[i].health = 1; + mti[i].FloatbobPhase = -1; } delete[] mtp; } diff --git a/src/p_udmf.cpp b/src/p_udmf.cpp index 0434d8bce..269ce7e3d 100644 --- a/src/p_udmf.cpp +++ b/src/p_udmf.cpp @@ -474,6 +474,7 @@ public: th->RenderStyle = STYLE_Count; th->alpha = -1; th->health = 1; + th->FloatbobPhase = -1; sc.MustGetToken('{'); while (!sc.CheckToken('}')) { @@ -631,6 +632,11 @@ public: Flag(th->flags, MTF_SECRET, key); break; + case NAME_Floatbobphase: + CHECK_N(Zd | Zdt) + th->FloatbobPhase = CheckInt(key); + break; + case NAME_Renderstyle: { FName style = CheckString(key); From 5515cb02a6059155ce4c075d02aa69d785879b2d Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 29 Nov 2015 11:35:12 +0100 Subject: [PATCH 03/37] - fixed incorrect error method call in decal parser. --- src/decallib.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/decallib.cpp b/src/decallib.cpp index 0ea3423c4..08b4dfda2 100644 --- a/src/decallib.cpp +++ b/src/decallib.cpp @@ -432,7 +432,7 @@ WORD FDecalLib::GetDecalID (FScanner &sc) unsigned long num = strtoul (sc.String, NULL, 10); if (num < 1 || num > 65535) { - sc.MustGetStringName ("Decal ID must be between 1 and 65535"); + sc.ScriptError ("Decal ID must be between 1 and 65535"); } return (WORD)num; } From 1a0faf47619c15575109fd315e5770cd3862e89f Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 29 Nov 2015 11:41:14 +0100 Subject: [PATCH 04/37] - allow optional decal generator definitions. --- src/decallib.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/decallib.cpp b/src/decallib.cpp index 08b4dfda2..14b824a7b 100644 --- a/src/decallib.cpp +++ b/src/decallib.cpp @@ -603,16 +603,17 @@ void FDecalLib::ParseGenerator (FScanner &sc) { const PClass *type; FDecalBase *decal; - AActor *actor; + bool optional = false; // Get name of generator (actor) sc.MustGetString (); + optional = sc.Compare("optional"); + type = PClass::FindClass (sc.String); if (type == NULL || type->ActorInfo == NULL) { - sc.ScriptError ("%s is not an actor.", sc.String); + if (!optional) sc.ScriptError ("%s is not an actor.", sc.String); } - actor = (AActor *)type->Defaults; // Get name of generated decal sc.MustGetString (); @@ -628,11 +629,14 @@ void FDecalLib::ParseGenerator (FScanner &sc) sc.ScriptError ("%s has not been defined.", sc.String); } } - - actor->DecalGenerator = decal; - if (decal != NULL) + if (type != NULL) { - decal->Users.Push (type); + AActor *actor = (AActor *)type->Defaults; + actor->DecalGenerator = decal; + if (decal != NULL) + { + decal->Users.Push(type); + } } } From 1ad02a6ce8503341e57be1d4601f51cb45b17207 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 29 Nov 2015 12:10:12 +0100 Subject: [PATCH 05/37] - allow specifying infighting through skills. --- src/g_level.h | 2 ++ src/g_skill.cpp | 17 +++++++++++++++++ src/p_interaction.cpp | 6 ++---- src/p_map.cpp | 5 +---- 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/src/g_level.h b/src/g_level.h index 496c5c0f4..60b371ba0 100644 --- a/src/g_level.h +++ b/src/g_level.h @@ -565,6 +565,7 @@ enum ESkillProperty SKILLP_ArmorFactor, SKILLP_EasyKey, SKILLP_SlowMonsters, + SKILLP_Infight, }; int G_SkillProperty(ESkillProperty prop); const char * G_SkillName(); @@ -602,6 +603,7 @@ struct FSkillInfo fixed_t MonsterHealth; fixed_t FriendlyHealth; bool NoPain; + int Infighting; fixed_t ArmorFactor; FSkillInfo() {} diff --git a/src/g_skill.cpp b/src/g_skill.cpp index ddfdbb4cc..718f1cd00 100644 --- a/src/g_skill.cpp +++ b/src/g_skill.cpp @@ -83,6 +83,7 @@ void FMapInfoParser::ParseSkill () skill.FriendlyHealth = FRACUNIT; skill.NoPain = false; skill.ArmorFactor = FRACUNIT; + skill.Infighting = 0; sc.MustGetString(); skill.Name = sc.String; @@ -266,6 +267,14 @@ void FMapInfoParser::ParseSkill () sc.MustGetFloat(); skill.ArmorFactor = FLOAT2FIXED(sc.Float); } + else if (sc.Compare("NoInfighting")) + { + skill.Infighting = LEVEL2_NOINFIGHTING; + } + else if (sc.Compare("TotalInfighting")) + { + skill.Infighting = LEVEL2_TOTALINFIGHTING; + } else if (sc.Compare("DefaultSkill")) { if (DefaultSkill >= 0) @@ -384,6 +393,14 @@ int G_SkillProperty(ESkillProperty prop) case SKILLP_ArmorFactor: return AllSkills[gameskill].ArmorFactor; + + case SKILLP_Infight: + // This property also needs to consider the level flags for the same info. + if (level.flags2 & LEVEL2_TOTALINFIGHTING) return 1; + if (level.flags2 & LEVEL2_NOINFIGHTING) return -1; + if (AllSkills[gameskill].Infighting == LEVEL2_TOTALINFIGHTING) return 1; + if (AllSkills[gameskill].Infighting == LEVEL2_NOINFIGHTING) return -1; + return infighting; } } return 0; diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index 25724172c..203d1688d 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -1639,10 +1639,8 @@ bool AActor::OkayToSwitchTarget (AActor *other) int infight; if (flags5 & MF5_NOINFIGHTING) infight=-1; - else if (level.flags2 & LEVEL2_TOTALINFIGHTING) infight=1; - else if (level.flags2 & LEVEL2_NOINFIGHTING) infight=-1; - else infight = infighting; - + else infight = G_SkillProperty(SKILLP_Infight); + if (infight < 0 && other->player == NULL && !IsHostile (other)) { return false; // infighting off: Non-friendlies don't target other non-friendlies diff --git a/src/p_map.cpp b/src/p_map.cpp index e8e5d6c84..5dd0967b9 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -938,10 +938,7 @@ static bool CanAttackHurt(AActor *victim, AActor *shooter) // to harm / be harmed by anything. if (!victim->player && !shooter->player) { - int infight; - if (level.flags2 & LEVEL2_TOTALINFIGHTING) infight = 1; - else if (level.flags2 & LEVEL2_NOINFIGHTING) infight = -1; - else infight = infighting; + int infight = G_SkillProperty(SKILLP_Infight); if (infight < 0) { From 106886a9bb995e6975163c60df20e4eb1429a0d5 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 29 Nov 2015 12:30:50 +0100 Subject: [PATCH 06/37] - allow setting the ice translation with Thing_SetTranslation. This requires passing a magic value because this translation is defined differently than all the rest which can be used in ACS. --- src/p_lnspec.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/p_lnspec.cpp b/src/p_lnspec.cpp index 26e736cb5..9c93ca15c 100644 --- a/src/p_lnspec.cpp +++ b/src/p_lnspec.cpp @@ -1600,6 +1600,11 @@ FUNC(LS_Thing_Move) // [BC] return P_Thing_Move (arg0, it, arg1, arg2 ? false : true); } +enum +{ + TRANSLATION_ICE = 0x100007 +}; + FUNC(LS_Thing_SetTranslation) // Thing_SetTranslation (tid, range) { @@ -1616,6 +1621,10 @@ FUNC(LS_Thing_SetTranslation) { range = TRANSLATION(TRANSLATION_LevelScripted, (arg1-1)); } + else if (arg1 == TRANSLATION_ICE) + { + range = TRANSLATION(TRANSLATION_Standard, 7); + } else { range = 0; From f7cdb28eaccc4ece9869f400b0e710420852bc37 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 29 Nov 2015 12:58:17 +0100 Subject: [PATCH 07/37] - added a HealthFactor skill property. --- src/g_level.h | 2 ++ src/g_shared/a_pickups.cpp | 4 +++- src/g_skill.cpp | 7 +++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/g_level.h b/src/g_level.h index 60b371ba0..018737f09 100644 --- a/src/g_level.h +++ b/src/g_level.h @@ -563,6 +563,7 @@ enum ESkillProperty SKILLP_FriendlyHealth, SKILLP_NoPain, SKILLP_ArmorFactor, + SKILLP_HealthFactor, SKILLP_EasyKey, SKILLP_SlowMonsters, SKILLP_Infight, @@ -605,6 +606,7 @@ struct FSkillInfo bool NoPain; int Infighting; fixed_t ArmorFactor; + fixed_t HealthFactor; FSkillInfo() {} FSkillInfo(const FSkillInfo &other) diff --git a/src/g_shared/a_pickups.cpp b/src/g_shared/a_pickups.cpp index e87929677..eb2831024 100644 --- a/src/g_shared/a_pickups.cpp +++ b/src/g_shared/a_pickups.cpp @@ -236,10 +236,12 @@ bool P_GiveBody (AActor *actor, int num, int max) return true; } } - else + else if (num > 0) { if (player->health < max) { + num = FixedMul(num, G_SkillProperty(SKILLP_HealthFactor)); + if (num < 1) num = 1; player->health += num; if (player->health > max) { diff --git a/src/g_skill.cpp b/src/g_skill.cpp index 718f1cd00..bbee4ea11 100644 --- a/src/g_skill.cpp +++ b/src/g_skill.cpp @@ -84,6 +84,7 @@ void FMapInfoParser::ParseSkill () skill.NoPain = false; skill.ArmorFactor = FRACUNIT; skill.Infighting = 0; + skill.HealthFactor = FRACUNIT; sc.MustGetString(); skill.Name = sc.String; @@ -267,6 +268,12 @@ void FMapInfoParser::ParseSkill () sc.MustGetFloat(); skill.ArmorFactor = FLOAT2FIXED(sc.Float); } + else if (sc.Compare("HealthFactor")) + { + ParseAssign(); + sc.MustGetFloat(); + skill.HealthFactor = FLOAT2FIXED(sc.Float); + } else if (sc.Compare("NoInfighting")) { skill.Infighting = LEVEL2_NOINFIGHTING; From c9e4f120e721604939db490e1d3a91e6ef4657dc Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 29 Nov 2015 15:27:20 +0100 Subject: [PATCH 08/37] - forgot to save this before committing. --- src/g_skill.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/g_skill.cpp b/src/g_skill.cpp index bbee4ea11..8f2cdc9f0 100644 --- a/src/g_skill.cpp +++ b/src/g_skill.cpp @@ -401,6 +401,9 @@ int G_SkillProperty(ESkillProperty prop) case SKILLP_ArmorFactor: return AllSkills[gameskill].ArmorFactor; + case SKILLP_HealthFactor: + return AllSkills[gameskill].HealthFactor; + case SKILLP_Infight: // This property also needs to consider the level flags for the same info. if (level.flags2 & LEVEL2_TOTALINFIGHTING) return 1; From f4a60f29f354e18d73f61dd53ca9eeee86a13d8e Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 30 Nov 2015 09:21:45 +0100 Subject: [PATCH 09/37] - added missing sc.MustGetString() to 'optional' case of decal parser. --- src/decallib.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/decallib.cpp b/src/decallib.cpp index 14b824a7b..784998977 100644 --- a/src/decallib.cpp +++ b/src/decallib.cpp @@ -608,6 +608,7 @@ void FDecalLib::ParseGenerator (FScanner &sc) // Get name of generator (actor) sc.MustGetString (); optional = sc.Compare("optional"); + if (optional) sc.MustGetString(); type = PClass::FindClass (sc.String); if (type == NULL || type->ActorInfo == NULL) @@ -626,7 +627,7 @@ void FDecalLib::ParseGenerator (FScanner &sc) decal = ScanTreeForName (sc.String, Root); if (decal == NULL) { - sc.ScriptError ("%s has not been defined.", sc.String); + if (!optional) sc.ScriptError ("%s has not been defined.", sc.String); } } if (type != NULL) From 8594bfaa8ba5e6a5834ce41576a7394e8990fc82 Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Mon, 30 Nov 2015 11:42:08 -0600 Subject: [PATCH 10/37] A_CustomPunch Extension - Added Melee/Miss parameters just like A_CustomMeleeAttack. --- src/thingdef/thingdef_codeptr.cpp | 11 +++++++++-- wadsrc/static/actors/shared/inventory.txt | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 14440d884..9fd631d16 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -1414,6 +1414,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomPunch) ACTION_PARAM_FIXED(LifeSteal, 5); ACTION_PARAM_INT(lifestealmax, 6); ACTION_PARAM_CLASS(armorbonustype, 7); + ACTION_PARAM_SOUND(MeleeSound, 8); + ACTION_PARAM_SOUND(MissSound, 9); if (!self->player) return; @@ -1443,7 +1445,11 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomPunch) P_LineAttack (self, angle, Range, pitch, Damage, NAME_Melee, PuffType, puffFlags, &linetarget, &actualdamage); - if (linetarget) + if (!linetarget) + { + if (MissSound) S_Sound(self, CHAN_WEAPON, MissSound, 1, ATTN_NORM); + } + else { if (LifeSteal && !(linetarget->flags5 & MF5_DONTDRAIN)) { @@ -1474,7 +1480,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomPunch) if (weapon != NULL) { - S_Sound (self, CHAN_WEAPON, weapon->AttackSound, 1, ATTN_NORM); + if (MeleeSound) S_Sound(self, CHAN_WEAPON, MeleeSound, 1, ATTN_NORM); + else S_Sound (self, CHAN_WEAPON, weapon->AttackSound, 1, ATTN_NORM); } if (!(flags & CPF_NOTURN)) diff --git a/wadsrc/static/actors/shared/inventory.txt b/wadsrc/static/actors/shared/inventory.txt index 13ae00936..a44515efb 100644 --- a/wadsrc/static/actors/shared/inventory.txt +++ b/wadsrc/static/actors/shared/inventory.txt @@ -8,7 +8,7 @@ ACTOR Inventory native Inventory.PickupMessage "$TXT_DEFAULTPICKUPMSG" action native A_JumpIfNoAmmo(state label); - action native A_CustomPunch(int damage, bool norandom = false, int flags = CPF_USEAMMO, class pufftype = "BulletPuff", float range = 0, float lifesteal = 0, int lifestealmax = 0, class armorbonustype = "ArmorBonus"); + action native A_CustomPunch(int damage, bool norandom = false, int flags = CPF_USEAMMO, class pufftype = "BulletPuff", float range = 0, float lifesteal = 0, int lifestealmax = 0, class armorbonustype = "ArmorBonus", sound MeleeSound = "", sound MissSound = ""); action native A_FireBullets(float spread_xy, float spread_z, int numbullets, int damageperbullet, class pufftype = "BulletPuff", int flags = 1, float range = 0); action native A_FireCustomMissile(class missiletype, float angle = 0, bool useammo = true, int spawnofs_xy = 0, float spawnheight = 0, int flags = 0, float pitch = 0); action native A_RailAttack(int damage, int spawnofs_xy = 0, int useammo = true, color color1 = "", color color2 = "", int flags = 0, float maxdiff = 0, class pufftype = "BulletPuff", float spread_xy = 0, float spread_z = 0, float range = 0, int duration = 0, float sparsity = 1.0, float driftspeed = 1.0, class spawnclass = "none", float spawnofs_z = 0, int spiraloffset = 270); From 4adf421513ba7ebbeb81a2cb9ee9f149bf4446b8 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Tue, 1 Dec 2015 14:30:57 +0200 Subject: [PATCH 11/37] Fix incomplete assignment operator of FSkillInfo See http://forum.zdoom.org/viewtopic.php?t=50026 --- src/g_skill.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/g_skill.cpp b/src/g_skill.cpp index 8f2cdc9f0..f4cb63ea5 100644 --- a/src/g_skill.cpp +++ b/src/g_skill.cpp @@ -490,7 +490,9 @@ FSkillInfo &FSkillInfo::operator=(const FSkillInfo &other) MonsterHealth = other.MonsterHealth; FriendlyHealth = other.FriendlyHealth; NoPain = other.NoPain; + Infighting = other.Infighting; ArmorFactor = other.ArmorFactor; + HealthFactor = other.HealthFactor; return *this; } From 81f521fe562bd5e562ce08bf2dce33007dd6d9c6 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 2 Dec 2015 22:31:27 +0100 Subject: [PATCH 12/37] - fixed: Texture precaching from MAPINFO was broken The code assumed that it had access to the texture manager but that gets initialized after MAPINFO, which means that MAPINFO can only store the texture names and let the precaching code resolve the actual textures. --- src/g_level.h | 2 +- src/g_mapinfo.cpp | 11 ++--------- src/textures/texturemanager.cpp | 3 ++- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/g_level.h b/src/g_level.h index 018737f09..2e8e8e4c5 100644 --- a/src/g_level.h +++ b/src/g_level.h @@ -339,7 +339,7 @@ struct level_info_t TArray specialactions; TArray PrecacheSounds; - TArray PrecacheTextures; + TArray PrecacheTextures; level_info_t() { diff --git a/src/g_mapinfo.cpp b/src/g_mapinfo.cpp index ac938797d..9dace3e23 100644 --- a/src/g_mapinfo.cpp +++ b/src/g_mapinfo.cpp @@ -1077,15 +1077,8 @@ DEFINE_MAP_OPTION(PrecacheTextures, true) do { parse.sc.MustGetString(); - FTextureID tex = TexMan.CheckForTexture(parse.sc.String, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_TryAny|FTextureManager::TEXMAN_ReturnFirst); - if (!tex.isValid()) - { - parse.sc.ScriptMessage("Unknown texture \"%s\"", parse.sc.String); - } - else - { - info->PrecacheTextures.Push(tex); - } + //the texture manager is not initialized here so all we can do is store the texture's name. + info->PrecacheTextures.Push(parse.sc.String); } while (parse.sc.CheckString(",")); } diff --git a/src/textures/texturemanager.cpp b/src/textures/texturemanager.cpp index 2944e4200..4fc82ac0d 100644 --- a/src/textures/texturemanager.cpp +++ b/src/textures/texturemanager.cpp @@ -1246,7 +1246,8 @@ void FTextureManager::PrecacheLevel (void) for (unsigned i = 0; i < level.info->PrecacheTextures.Size(); i++) { - hitlist[level.info->PrecacheTextures[i].GetIndex()] |= FTextureManager::HIT_Wall; + FTextureID tex = TexMan.CheckForTexture(level.info->PrecacheTextures[i], FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_TryAny|FTextureManager::TEXMAN_ReturnFirst); + if (tex.Exists()) hitlist[tex.GetIndex()] |= FTextureManager::HIT_Wall; } for (int i = cnt - 1; i >= 0; i--) From f90ce1308e0764ea8c8b3c9f3ca700942b592062 Mon Sep 17 00:00:00 2001 From: Edward Richardson Date: Thu, 3 Dec 2015 16:40:47 +1300 Subject: [PATCH 13/37] Fix lost focus loosing network data - Prevented focus loss from dropping network data during level transitions - Fixed delay counter underflows --- src/d_net.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/d_net.cpp b/src/d_net.cpp index e6b5713f2..780b89382 100644 --- a/src/d_net.cpp +++ b/src/d_net.cpp @@ -973,7 +973,7 @@ void NetUpdate (void) { I_StartTic (); D_ProcessEvents (); - if ((maketic - gametic) / ticdup >= BACKUPTICS/2-1) + if (pauseext || (maketic - gametic) / ticdup >= BACKUPTICS/2-1) break; // can't hold any more //Printf ("mk:%i ",maketic); @@ -1204,7 +1204,7 @@ void NetUpdate (void) // Send current network delay // The number of tics we just made should be removed from the count. - netbuffer[k++] = ((maketic - newtics - gametic) / ticdup); + netbuffer[k++] = ((maketic - numtics - gametic) / ticdup); if (numtics > 0) { @@ -1810,7 +1810,8 @@ void TryRunTics (void) // If paused, do not eat more CPU time than we need, because it // will all be wasted anyway. - if (pauseext) r_NoInterpolate = true; + if (pauseext) + r_NoInterpolate = true; bool doWait = cl_capfps || r_NoInterpolate /*|| netgame*/; // get real tics @@ -1828,6 +1829,9 @@ void TryRunTics (void) // get available tics NetUpdate (); + if (pauseext) + return; + lowtic = INT_MAX; numplaying = 0; for (i = 0; i < doomcom.numnodes; i++) @@ -1935,7 +1939,7 @@ void TryRunTics (void) C_Ticker (); M_Ticker (); I_GetTime (true); - if (!pauseext) G_Ticker(); + G_Ticker(); gametic++; NetUpdate (); // check for new console commands From 542a1089145f426ac6a5af74961ec3d98ec036dc Mon Sep 17 00:00:00 2001 From: Gaerzi Date: Sat, 5 Dec 2015 00:26:39 +0100 Subject: [PATCH 14/37] 3D floor support for check switch range --- src/p_switch.cpp | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/src/p_switch.cpp b/src/p_switch.cpp index 1ca4654b5..984794c8a 100644 --- a/src/p_switch.cpp +++ b/src/p_switch.cpp @@ -177,10 +177,47 @@ bool P_CheckSwitchRange(AActor *user, line_t *line, int sideno) if ((TexMan.FindSwitch(side->GetTexture(side_t::top))) != NULL) { + + // Check 3D floors on back side + { + sector_t * back = line->sidedef[1 - sideno]->sector; + for (unsigned i = 0; i < back->e->XFloor.ffloors.Size(); i++) + { + F3DFloor *rover = back->e->XFloor.ffloors[i]; + if (!(rover->flags & FF_EXISTS)) continue; + if (!(rover->flags & FF_UPPERTEXTURE)) continue; + + if (user->z > rover->top.plane->ZatPoint(checkx, checky) || + user->z + user->height < rover->bottom.plane->ZatPoint(checkx, checky)) + continue; + + // This 3D floor depicts a switch texture in front of the player's eyes + return true; + } + } + return (user->z + user->height > open.top); } else if ((TexMan.FindSwitch(side->GetTexture(side_t::bottom))) != NULL) { + // Check 3D floors on back side + { + sector_t * back = line->sidedef[1 - sideno]->sector; + for (unsigned i = 0; i < back->e->XFloor.ffloors.Size(); i++) + { + F3DFloor *rover = back->e->XFloor.ffloors[i]; + if (!(rover->flags & FF_EXISTS)) continue; + if (!(rover->flags & FF_LOWERTEXTURE)) continue; + + if (user->z > rover->top.plane->ZatPoint(checkx, checky) || + user->z + user->height < rover->bottom.plane->ZatPoint(checkx, checky)) + continue; + + // This 3D floor depicts a switch texture in front of the player's eyes + return true; + } + } + return (user->z < open.bottom); } else if ((flags & ML_3DMIDTEX) || (TexMan.FindSwitch(side->GetTexture(side_t::mid))) != NULL) From ad0e71942d15dc79f81e9c3d48ea78a9d8e89534 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 6 Dec 2015 09:59:02 +0100 Subject: [PATCH 15/37] - added GetAspectRatio function to ACS. - added a sixth parameter for SetHUDClipRect so that the forced aspect ratio fudging this function performs can be disabled. --- src/g_shared/hudmessages.cpp | 11 ++++++++++- src/g_shared/sbar.h | 4 +++- src/p_acs.cpp | 9 ++++++++- src/p_acs.h | 1 + src/version.h | 2 +- 5 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/g_shared/hudmessages.cpp b/src/g_shared/hudmessages.cpp index f60c8a84e..997021c5f 100644 --- a/src/g_shared/hudmessages.cpp +++ b/src/g_shared/hudmessages.cpp @@ -134,6 +134,7 @@ DHUDMessage::DHUDMessage (FFont *font, const char *text, float x, float y, int h NoWrap = false; ClipX = ClipY = ClipWidth = ClipHeight = 0; WrapWidth = 0; + HandleAspect = true; Top = y; Next = NULL; Lines = NULL; @@ -196,6 +197,14 @@ void DHUDMessage::Serialize (FArchive &arc) NoWrap = false; ClipX = ClipY = ClipWidth = ClipHeight = WrapWidth = 0; } + if (SaveVersion >= 4525) + { + arc << HandleAspect; + } + else + { + HandleAspect = true; + } if (arc.IsLoading ()) { Lines = NULL; @@ -257,7 +266,7 @@ void DHUDMessage::CalcClipCoords(int hudheight) else { screen->VirtualToRealCoordsInt(x, y, w, h, - HUDWidth, hudheight, false, true); + HUDWidth, hudheight, false, HandleAspect); ClipLeft = x; ClipTop = y; ClipRight = x + w; diff --git a/src/g_shared/sbar.h b/src/g_shared/sbar.h index b8dde5850..b8416dd5d 100644 --- a/src/g_shared/sbar.h +++ b/src/g_shared/sbar.h @@ -94,12 +94,13 @@ public: NoWrap = nowrap; ResetText(SourceText); } - void SetClipRect(int x, int y, int width, int height) + void SetClipRect(int x, int y, int width, int height, bool aspect) { ClipX = x; ClipY = y; ClipWidth = width; ClipHeight = height; + HandleAspect = aspect; } void SetWrapWidth(int wrap) { @@ -119,6 +120,7 @@ protected: int HUDWidth, HUDHeight; int ClipX, ClipY, ClipWidth, ClipHeight, WrapWidth; // in HUD coords int ClipLeft, ClipTop, ClipRight, ClipBot; // in screen coords + bool HandleAspect; EColorRange TextColor; FFont *Font; FRenderStyle Style; diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 4f8a0c6c3..4f9e8fd2e 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -4442,6 +4442,7 @@ enum EACSFunctions ACSF_GetActorRoll, ACSF_QuakeEx, ACSF_Warp, // 92 + ACSF_GetAspectRatio, /* Zandronum's - these must be skipped when we reach 99! -100:ResetMap(0), @@ -5315,6 +5316,7 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, SDWORD *args, const ClipRectWidth = argCount > 2 ? args[2] : 0; ClipRectHeight = argCount > 3 ? args[3] : 0; WrapWidth = argCount > 4 ? args[4] : 0; + HandleAspect = argCount > 5 ? !!args[5] : true; break; case ACSF_SetHUDWrapWidth: @@ -5915,10 +5917,14 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound) return false; } + case ACSF_GetAspectRatio: + return CheckRatio(screen->GetWidth(), screen->GetHeight()); + default: break; } + return 0; } @@ -7854,7 +7860,7 @@ scriptwait: } break; } - msg->SetClipRect(ClipRectLeft, ClipRectTop, ClipRectWidth, ClipRectHeight); + msg->SetClipRect(ClipRectLeft, ClipRectTop, ClipRectWidth, ClipRectHeight, HandleAspect); if (WrapWidth != 0) { msg->SetWrapWidth(WrapWidth); @@ -9466,6 +9472,7 @@ DLevelScript::DLevelScript (AActor *who, line_t *where, int num, const ScriptPtr activefont = SmallFont; hudwidth = hudheight = 0; ClipRectLeft = ClipRectTop = ClipRectWidth = ClipRectHeight = WrapWidth = 0; + HandleAspect = true; state = SCRIPT_Running; // Hexen waited one second before executing any open scripts. I didn't realize diff --git a/src/p_acs.h b/src/p_acs.h index d5971e349..3188e46aa 100644 --- a/src/p_acs.h +++ b/src/p_acs.h @@ -891,6 +891,7 @@ protected: int hudwidth, hudheight; int ClipRectLeft, ClipRectTop, ClipRectWidth, ClipRectHeight; int WrapWidth; + bool HandleAspect; FBehavior *activeBehavior; int InModuleScriptNumber; diff --git a/src/version.h b/src/version.h index 913c9bd18..168cb7519 100644 --- a/src/version.h +++ b/src/version.h @@ -76,7 +76,7 @@ const char *GetVersionString(); // Use 4500 as the base git save version, since it's higher than the // SVN revision ever got. -#define SAVEVER 4524 +#define SAVEVER 4525 #define SAVEVERSTRINGIFY2(x) #x #define SAVEVERSTRINGIFY(x) SAVEVERSTRINGIFY2(x) From 0cb64dd4647603defa71b1e890eb686c662cb09f Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 6 Dec 2015 20:55:05 +0100 Subject: [PATCH 16/37] - made character encoding for UFMF/ZDoom namespaces explicit. --- specs/udmf_zdoom.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/specs/udmf_zdoom.txt b/specs/udmf_zdoom.txt index d501cb884..e79ae196b 100644 --- a/specs/udmf_zdoom.txt +++ b/specs/udmf_zdoom.txt @@ -27,7 +27,8 @@ II. Implementation Semantics II.A : Storage and Retrieval of Data ------------------------------------ -No changes. +Any TEXTMAP lump in the described namespaces must be encoded in ISO 8859-1 which +as of this writing is the only character encoding supported by ZDoom. ----------------------------------- II.B : Storage Within Archive Files From 72d4c3345302a1a02459005c7f510c5aa1edec55 Mon Sep 17 00:00:00 2001 From: Braden Obrzut Date: Mon, 7 Dec 2015 01:18:56 -0500 Subject: [PATCH 17/37] - Removed GetAspectRatio as the implementation was highly fragile. Even if converted to giving the ratio, I have strong concerns about having this function built in without ZDoom supporting arbitrary aspect ratios as the odds of people checking against the hard coded constants seems high. The existing ACS version of this function returns fixed point ratios (because why not) and I fully expected people to use a switch statement when writing it. --- src/p_acs.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 4f9e8fd2e..30733eac8 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -4442,7 +4442,6 @@ enum EACSFunctions ACSF_GetActorRoll, ACSF_QuakeEx, ACSF_Warp, // 92 - ACSF_GetAspectRatio, /* Zandronum's - these must be skipped when we reach 99! -100:ResetMap(0), @@ -5917,9 +5916,6 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound) return false; } - case ACSF_GetAspectRatio: - return CheckRatio(screen->GetWidth(), screen->GetHeight()); - default: break; } From 964ee6bb23b5b2cb722275cfdee9dd1a625f15cd Mon Sep 17 00:00:00 2001 From: Braden Obrzut Date: Mon, 7 Dec 2015 04:49:40 -0500 Subject: [PATCH 18/37] - Worked around issue where stat doesn't work in v140_xp. Even though the bug was supposedly fixed for awhile now it didn't make it into Update 1. --- src/CMakeLists.txt | 5 +++++ src/win32/i_system.cpp | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 782e4bac0..bd353a2ed 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -496,6 +496,11 @@ if( NOT MSVC ) add_definitions( -D__forceinline=inline ) endif( NOT MSVC ) +# Fix stat in v140_xp (broken in RTM and Update 1 so far) +if( MSVC AND MSVC_VERSION EQUAL 1900 AND CMAKE_GENERATOR_TOOLSET STREQUAL "v140_xp" ) + add_definitions( -D_stat64i32=VS14Stat ) +endif( MSVC AND MSVC_VERSION EQUAL 1900 AND CMAKE_GENERATOR_TOOLSET STREQUAL "v140_xp" ) + if( UNIX ) CHECK_LIBRARY_EXISTS( rt clock_gettime "" CLOCK_GETTIME_IN_RT ) if( NOT CLOCK_GETTIME_IN_RT ) diff --git a/src/win32/i_system.cpp b/src/win32/i_system.cpp index ef56c7050..133337af5 100644 --- a/src/win32/i_system.cpp +++ b/src/win32/i_system.cpp @@ -1726,3 +1726,36 @@ FString I_GetLongPathName(FString shortpath) delete[] buff; return longpath; } + +#if _MSC_VER == 1900 && defined(_USING_V110_SDK71_) +//========================================================================== +// +// VS14Stat +// +// Work around an issue where stat doesn't work with v140_xp. This was +// supposedly fixed, but as of Update 1 continues to not function on XP. +// +//========================================================================== + +#include + +int VS14Stat(const char *path, struct _stat64i32 *buffer) +{ + WIN32_FILE_ATTRIBUTE_DATA data; + if(!GetFileAttributesEx(path, GetFileExInfoStandard, &data)) + return -1; + + buffer->st_ino = 0; + buffer->st_mode = ((data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? S_IFDIR : S_IFREG)| + ((data.dwFileAttributes & FILE_ATTRIBUTE_READONLY) ? S_IREAD : S_IREAD|S_IWRITE); + buffer->st_dev = buffer->st_rdev = 0; + buffer->st_nlink = 1; + buffer->st_uid = 0; + buffer->st_gid = 0; + buffer->st_size = data.nFileSizeLow; + buffer->st_atime = (*(QWORD*)&data.ftLastAccessTime) / 10000000 - 11644473600LL; + buffer->st_mtime = (*(QWORD*)&data.ftLastWriteTime) / 10000000 - 11644473600LL; + buffer->st_ctime = (*(QWORD*)&data.ftCreationTime) / 10000000 - 11644473600LL; + return 0; +} +#endif From 18de376edf8bb4e1d90f8b74c70f4f1080157669 Mon Sep 17 00:00:00 2001 From: Edoardo Prezioso Date: Mon, 7 Dec 2015 11:19:42 +0100 Subject: [PATCH 19/37] - Fixed lemon trying to free non-allocated memory. This is a regression from commit 24a096fb27eb0959366c605499c7819352cc501c . It happened only the input files were present in the same directory as the executable. --- tools/lemon/lemon.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/lemon/lemon.c b/tools/lemon/lemon.c index 5e8f03a8b..651e43f20 100644 --- a/tools/lemon/lemon.c +++ b/tools/lemon/lemon.c @@ -3061,6 +3061,7 @@ struct lemon *lemp; FILE *in; char *tpltname; char *cp; + Boolean tpltnameinbuf; cp = strrchr(lemp->filename,'.'); if( cp ){ @@ -3070,10 +3071,13 @@ struct lemon *lemp; } if( access(buf,004)==0 ){ tpltname = buf; + tpltnameinbuf = LEMON_TRUE; }else if( access(templatename,004)==0 ){ tpltname = templatename; + tpltnameinbuf = LEMON_TRUE; }else{ tpltname = pathsearch(lemp->argv0,templatename,0); + tpltnameinbuf = LEMON_FALSE; } if( tpltname==0 ){ fprintf(stderr,"Can't find the parser driver template file \"%s\".\n", @@ -3084,11 +3088,11 @@ struct lemon *lemp; in = fopen(tpltname,"rb"); if( in==0 ){ fprintf(stderr,"Can't open the template file \"%s\".\n",templatename); - free(tpltname); + if (tpltnameinbuf == LEMON_FALSE) free(tpltname); lemp->errorcnt++; return 0; } - free(tpltname); + if (tpltnameinbuf == LEMON_FALSE) free(tpltname); return in; } From 7c6237e1343915f26c84010bf668e1133e7a8395 Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Thu, 10 Dec 2015 21:24:37 -0600 Subject: [PATCH 20/37] has replaced on FreeBSD as well --- src/sound/fmodsound.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sound/fmodsound.cpp b/src/sound/fmodsound.cpp index 33ca0495d..4042ca421 100644 --- a/src/sound/fmodsound.cpp +++ b/src/sound/fmodsound.cpp @@ -44,7 +44,7 @@ extern HWND Window; #define FALSE 0 #define TRUE 1 #endif -#ifdef __APPLE__ +#if defined(__FreeBSD__) || defined(__APPLE__) #include #elif __sun #include From af2ce6ef427d2d175bd5c19403f7bc26dcb5ad02 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 14 Dec 2015 09:06:13 +0100 Subject: [PATCH 21/37] - fixed: The 'mindefaults' game configuration must define the player starts 5-8. --- wadsrc/static/mapinfo/mindefaults.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/wadsrc/static/mapinfo/mindefaults.txt b/wadsrc/static/mapinfo/mindefaults.txt index cbb3fa06b..0d7b16209 100644 --- a/wadsrc/static/mapinfo/mindefaults.txt +++ b/wadsrc/static/mapinfo/mindefaults.txt @@ -56,4 +56,12 @@ gameinfo statscreen_enteringpatch = "WIENTER" } +DoomEdNums +{ + 4001 = "$Player5Start" + 4002 = "$Player6Start" + 4003 = "$Player7Start" + 4004 = "$Player8Start" +} + include "mapinfo/common.txt" From 9176d75580d10a7d9ad4f8ab77ef18d6ffbe247e Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Mon, 14 Dec 2015 11:47:46 +0200 Subject: [PATCH 22/37] Fix incorrect small font rendering with Hexen Mac IWAD Unused high resolution font lumps broke composite font logic Small font had doubled height because of that, at least alternate HUD and inter-hub text messages had noticeable visual issues --- src/w_wad.cpp | 36 ++++++++++++++++++++++++++++++++++++ src/w_wad.h | 1 + 2 files changed, 37 insertions(+) diff --git a/src/w_wad.cpp b/src/w_wad.cpp index efeb38571..552228557 100644 --- a/src/w_wad.cpp +++ b/src/w_wad.cpp @@ -184,6 +184,7 @@ void FWadCollection::InitMultipleFiles (TArray &filenames) } RenameNerve(); RenameSprites(); + FixMacHexen(); // [RH] Set up hash table FirstLumpIndex = new DWORD[NumLumps]; @@ -956,6 +957,41 @@ void FWadCollection::RenameNerve () } } +//========================================================================== +// +// FixMacHexen +// +// Rename unused high resolution font lumps because they are incorrectly +// treated as extended characters +// +//========================================================================== + +void FWadCollection::FixMacHexen() +{ + if (GAME_Hexen != gameinfo.gametype) + { + return; + } + + for (int i = GetFirstLump(IWAD_FILENUM), last = GetLastLump(IWAD_FILENUM); i <= last; ++i) + { + assert(IWAD_FILENUM == LumpInfo[i].wadnum); + + FResourceLump* const lump = LumpInfo[i].lump; + char* const name = lump->Name; + + // Unwanted lumps are named like FONTA??1 + + if (8 == strlen(name) + && MAKE_ID('F', 'O', 'N', 'T') == lump->dwName + && 'A' == name[4] && '1' == name[7] + && isdigit(name[5]) && isdigit(name[6])) + { + name[0] = '\0'; + } + } +} + //========================================================================== // // W_FindLump diff --git a/src/w_wad.h b/src/w_wad.h index 323f12df2..dcac6a1b2 100644 --- a/src/w_wad.h +++ b/src/w_wad.h @@ -238,6 +238,7 @@ protected: private: void RenameSprites(); void RenameNerve(); + void FixMacHexen(); void DeleteAll(); }; From 06bb75576c45ae315c2ab37745503eb08b65ab0a Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Tue, 15 Dec 2015 14:13:54 -0600 Subject: [PATCH 23/37] Revert "Fixed timekeeping when starting a sigrenderer with a time offset" This reverts commit cf2577d4bc284fb5c5b71377413a47c72a1362dc. --- dumb/src/it/itrender.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/dumb/src/it/itrender.c b/dumb/src/it/itrender.c index 0491e7e59..fd8ccae13 100644 --- a/dumb/src/it/itrender.c +++ b/dumb/src/it/itrender.c @@ -5482,10 +5482,6 @@ static sigrenderer_t *it_start_sigrenderer(DUH *duh, sigdata_t *vsigdata, int n_ while (pos > 0 && pos >= sigrenderer->time_left) { render(sigrenderer, 0, 1.0f, 0, sigrenderer->time_left, NULL); -#ifdef BIT_ARRAY_BULLSHIT - sigrenderer->time_played += (LONG_LONG)sigrenderer->time_left << 16; -#endif - pos -= sigrenderer->time_left; sigrenderer->time_left = 0; @@ -5498,10 +5494,6 @@ static sigrenderer_t *it_start_sigrenderer(DUH *duh, sigdata_t *vsigdata, int n_ render(sigrenderer, 0, 1.0f, 0, pos, NULL); sigrenderer->time_left -= pos; -#ifdef BIT_ARRAY_BULLSHIT - sigrenderer->time_played += (LONG_LONG)pos << 16; -#endif - return sigrenderer; } From d3000fd838495bc1eb5a72def26172e374d1c3c9 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Tue, 15 Dec 2015 14:16:34 -0600 Subject: [PATCH 24/37] Revert "Fixed timekeeping" This reverts commit 68f8a3aa8fb53b98625232d99cc5bd040e67dd96. Conflicts: dumb/src/it/itrender.c --- dumb/src/it/itrender.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/dumb/src/it/itrender.c b/dumb/src/it/itrender.c index fd8ccae13..a82649268 100644 --- a/dumb/src/it/itrender.c +++ b/dumb/src/it/itrender.c @@ -4244,6 +4244,10 @@ static int process_tick(DUMB_IT_SIGRENDERER *sigrenderer) */ #endif bit_array_set(sigrenderer->played, sigrenderer->order * 256 + sigrenderer->row); + if (sigrenderer->looped == 0) { + timekeeping_array_push(sigrenderer->row_timekeeper, sigrenderer->order * 256 + sigrenderer->row, sigrenderer->time_played); + } + timekeeping_array_bump(sigrenderer->row_timekeeper, sigrenderer->order * 256 + sigrenderer->row); { int n; for (n = 0; n < DUMB_IT_N_CHANNELS; n++) @@ -4413,13 +4417,6 @@ static int process_tick(DUMB_IT_SIGRENDERER *sigrenderer) } } -#ifdef BIT_ARRAY_BULLSHIT - if (sigrenderer->looped == 0) { - timekeeping_array_push(sigrenderer->row_timekeeper, sigrenderer->order * 256 + sigrenderer->row, sigrenderer->time_played); - } - timekeeping_array_bump(sigrenderer->row_timekeeper, sigrenderer->order * 256 + sigrenderer->row); -#endif - if (!(sigdata->flags & IT_WAS_A_669)) reset_effects(sigrenderer); @@ -5510,7 +5507,7 @@ static int32 it_sigrenderer_get_samples( int dt; int32 todo; int ret; - LONG_LONG t; + LONG_LONG time_left, t; if (sigrenderer->order < 0) return 0; // problematic @@ -5523,7 +5520,8 @@ static int32 it_sigrenderer_get_samples( if (!samples) volume = 0; for (;;) { - todo = (int32)((((LONG_LONG)sigrenderer->time_left << 16) | sigrenderer->sub_time_left) / dt); + time_left = ((LONG_LONG)sigrenderer->time_left << 16) | sigrenderer->sub_time_left; + todo = (long)(time_left / dt); if (todo >= size) break; @@ -5538,7 +5536,7 @@ static int32 it_sigrenderer_get_samples( sigrenderer->time_left += (int32)(t >> 16); #ifdef BIT_ARRAY_BULLSHIT - sigrenderer->time_played += (LONG_LONG)todo * dt; + sigrenderer->time_played += time_left; #endif ret = process_tick(sigrenderer); From d0f1df113223182b2ad75accfbb0dc3511cb996d Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Tue, 15 Dec 2015 14:17:02 -0600 Subject: [PATCH 25/37] Revert "Fixed duplicating some timekeeping state variables" This reverts commit 381ce8ea4237a64d63ac447d1e42463edde356da. --- dumb/src/it/itrender.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/dumb/src/it/itrender.c b/dumb/src/it/itrender.c index a82649268..99f8bdc13 100644 --- a/dumb/src/it/itrender.c +++ b/dumb/src/it/itrender.c @@ -353,8 +353,6 @@ static DUMB_IT_SIGRENDERER *dup_sigrenderer(DUMB_IT_SIGRENDERER *src, int n_chan #ifdef BIT_ARRAY_BULLSHIT dst->played = bit_array_dup(src->played); - dst->looped = src->looped; - dst->time_played = src->time_played; dst->row_timekeeper = timekeeping_array_dup(src->row_timekeeper); #endif From 8a6dfabedb104e7ae37e0c4f03c7c3b44397b048 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Tue, 15 Dec 2015 14:29:51 -0600 Subject: [PATCH 26/37] Revert "- Implemented loop-accurate time position reporting into DUMB" This reverts commit 153721b1c9f4cde62fa17d6aef56f782b37384bf. Conflicts: dumb/include/dumb.h dumb/include/internal/tarray.h dumb/src/helpers/tarray.c dumb/src/it/itrender.c --- dumb/CMakeLists.txt | 1 - dumb/include/dumb.h | 5 - dumb/include/internal/it.h | 16 --- dumb/include/internal/tarray.h | 31 ----- dumb/prj/dumb/dumb.pro | 2 - dumb/src/core/rendsig.c | 10 +- dumb/src/helpers/tarray.c | 175 ----------------------------- dumb/src/it/itrender.c | 76 ++----------- dumb/vc6/dumb/dumb.vcxproj | 2 - dumb/vc6/dumb/dumb.vcxproj.filters | 6 - 10 files changed, 8 insertions(+), 316 deletions(-) delete mode 100644 dumb/include/internal/tarray.h delete mode 100644 dumb/src/helpers/tarray.c diff --git a/dumb/CMakeLists.txt b/dumb/CMakeLists.txt index e95c69154..b590aa165 100644 --- a/dumb/CMakeLists.txt +++ b/dumb/CMakeLists.txt @@ -39,7 +39,6 @@ add_library( dumb src/helpers/memfile.c src/helpers/clickrem.c src/helpers/barray.c - src/helpers/tarray.c src/it/xmeffect.c src/it/readxm2.c src/it/readxm.c diff --git a/dumb/include/dumb.h b/dumb/include/dumb.h index c2c0aaa32..2b6ac4879 100644 --- a/dumb/include/dumb.h +++ b/dumb/include/dumb.h @@ -606,10 +606,6 @@ typedef void (*DUH_SIGRENDERER_GET_CURRENT_SAMPLE)( sample_t *samples ); -typedef int32 (*DUH_SIGRENDERER_GET_POSITION)( - sigrenderer_t *sigrenderer -); - typedef void (*DUH_END_SIGRENDERER)(sigrenderer_t *sigrenderer); typedef void (*DUH_UNLOAD_SIGDATA)(sigdata_t *sigdata); @@ -625,7 +621,6 @@ typedef struct DUH_SIGTYPE_DESC DUH_SIGRENDERER_SET_SIGPARAM sigrenderer_set_sigparam; DUH_SIGRENDERER_GENERATE_SAMPLES sigrenderer_generate_samples; DUH_SIGRENDERER_GET_CURRENT_SAMPLE sigrenderer_get_current_sample; - DUH_SIGRENDERER_GET_POSITION sigrenderer_get_position; DUH_END_SIGRENDERER end_sigrenderer; DUH_UNLOAD_SIGDATA unload_sigdata; } diff --git a/dumb/include/internal/it.h b/dumb/include/internal/it.h index 6defa759a..a9196b316 100644 --- a/dumb/include/internal/it.h +++ b/dumb/include/internal/it.h @@ -33,7 +33,6 @@ #include #include "barray.h" -#include "tarray.h" /** TO DO: THINK ABOUT THE FOLLOWING: @@ -724,21 +723,6 @@ struct DUMB_IT_SIGRENDERER #ifdef BIT_ARRAY_BULLSHIT /* bit array, which rows are played, only checked by pattern break or loop commands */ void * played; - - /* - Loop indicator for internal processes, may also be useful for external processes - 0 - Not looped - 1 - Looped - -1 - Continued past loop - */ - int looped; - - /* - Kept until looped - */ - LONG_LONG time_played; - - void * row_timekeeper; #endif int32 gvz_time; diff --git a/dumb/include/internal/tarray.h b/dumb/include/internal/tarray.h deleted file mode 100644 index 7eb3af7c6..000000000 --- a/dumb/include/internal/tarray.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef _T_ARRAY_H_ -#define _T_ARRAY_H_ - -#include - -#ifndef LONG_LONG -#if defined __GNUC__ || defined __INTEL_COMPILER || defined __MWERKS__ -#define LONG_LONG long long -#elif defined _MSC_VER || defined __WATCOMC__ -#define LONG_LONG __int64 -#elif defined __sgi -#define LONG_LONG long long -#else -#error 64-bit integer type unknown -#endif -#endif - -void * timekeeping_array_create(size_t size); -void timekeeping_array_destroy(void * array); -void * timekeeping_array_dup(void * array); - -void timekeeping_array_reset(void * array, size_t loop_start); - -void timekeeping_array_push(void * array, size_t index, LONG_LONG time); -void timekeeping_array_bump(void * array, size_t index); - -unsigned int timekeeping_array_get_count(void * array, size_t index); - -LONG_LONG timekeeping_array_get_item(void * array, size_t index); - -#endif diff --git a/dumb/prj/dumb/dumb.pro b/dumb/prj/dumb/dumb.pro index 629a9294a..9244ce4bd 100644 --- a/dumb/prj/dumb/dumb.pro +++ b/dumb/prj/dumb/dumb.pro @@ -37,7 +37,6 @@ SOURCES += \ ../../src/helpers/memfile.c \ ../../src/helpers/clickrem.c \ ../../src/helpers/barray.c \ - ../../src/helpers/tarray.c \ ../../src/it/xmeffect.c \ ../../src/it/readxm2.c \ ../../src/it/readxm.c \ @@ -109,7 +108,6 @@ HEADERS += \ ../../include/internal/it.h \ ../../include/internal/dumb.h \ ../../include/internal/barray.h \ - ../../include/internal/tarray.h \ ../../include/internal/aldumb.h \ ../../include/internal/sinc_resampler.h \ ../../include/internal/stack_alloc.h \ diff --git a/dumb/src/core/rendsig.c b/dumb/src/core/rendsig.c index 053011a11..72da173c5 100644 --- a/dumb/src/core/rendsig.c +++ b/dumb/src/core/rendsig.c @@ -147,15 +147,7 @@ int DUMBEXPORT duh_sigrenderer_get_n_channels(DUH_SIGRENDERER *sigrenderer) int32 DUMBEXPORT duh_sigrenderer_get_position(DUH_SIGRENDERER *sigrenderer) { - DUH_SIGRENDERER_GET_POSITION proc; - - if (!sigrenderer) return -1; - - proc = sigrenderer->desc->sigrenderer_get_position; - if (proc) - return (*proc)(sigrenderer->sigrenderer); - else - return sigrenderer->pos; + return sigrenderer ? sigrenderer->pos : -1; } diff --git a/dumb/src/helpers/tarray.c b/dumb/src/helpers/tarray.c deleted file mode 100644 index f3ba422d8..000000000 --- a/dumb/src/helpers/tarray.c +++ /dev/null @@ -1,175 +0,0 @@ -#include "internal/tarray.h" - -#include - - /* - Structures which contain the play times of each pattern and row combination in the song, - not guaranteed to be valid for the whole song until the loop status is no longer zero. - The initial count and restart count will both be zero on song start, then both will be - incremented until the song loops. Restart count will be reset to zero on loop for all - rows which have a time equal to or greater than the loop start point, so time keeping - functions will know which timestamp the song is currently located at. - - Timestamp lists are guaranteed to be allocated in blocks of 16 timestamps at a time. - */ - - /* - We don't need full timekeeping because the player loop only wants the first play time - of the loop start order/row. We also don't really want full timekeeping because it - involves a lot of memory allocations, which is also slow. - */ - -#undef FULL_TIMEKEEPING - -typedef struct DUMB_IT_ROW_TIME -{ - unsigned int count, restart_count; -#ifndef FULL_TIMEKEEPING - LONG_LONG first_time; -#else - LONG_LONG * times; -#endif -} DUMB_IT_ROW_TIME; - -void * timekeeping_array_create(size_t size) -{ - size_t * _size = (size_t *) calloc( 1, sizeof(size_t) + sizeof(DUMB_IT_ROW_TIME) * size ); - if ( _size ) { - *_size = size; - } - return _size; -} - -void timekeeping_array_destroy(void * array) -{ -#ifdef FULL_TIMEKEEPING - size_t i; - size_t * size = (size_t *) array; - DUMB_IT_ROW_TIME * s = (DUMB_IT_ROW_TIME *)(size + 1); - - for (i = 0; i < *size; i++) { - if (s[i].times) free(s[i].times); - } -#endif - - free(array); -} - -void * timekeeping_array_dup(void * array) -{ - size_t i; - size_t * size = (size_t *) array; - DUMB_IT_ROW_TIME * s = (DUMB_IT_ROW_TIME *)(size + 1); - size_t * new_size = (size_t *) calloc( 1, sizeof(size_t) + sizeof(DUMB_IT_ROW_TIME) * *size ); - if ( new_size ) { - DUMB_IT_ROW_TIME * new_s = (DUMB_IT_ROW_TIME *)(new_size + 1); - - *new_size = *size; - - for (i = 0; i < *size; i++) { - new_s[i].count = s[i].count; - new_s[i].restart_count = s[i].restart_count; - -#ifndef FULL_TIMEKEEPING - new_s[i].first_time = s[i].first_time; -#else - if ( s[i].times ) { - size_t time_count = ( s[i].count + 15 ) & ~15; - new_s[i].times = (LONG_LONG *) malloc( sizeof(LONG_LONG) * time_count ); - if ( new_s[i].times == (void *)0 ) { - timekeeping_array_destroy( new_size ); - return (void *) 0; - } - memcpy( new_s[i].times, s[i].times, sizeof(LONG_LONG) * s[i].count ); - } -#endif - } - } - - return new_size; -} - -void timekeeping_array_reset(void * array, size_t loop_start) -{ - size_t i; - size_t * size = (size_t *) array; - DUMB_IT_ROW_TIME * s = (DUMB_IT_ROW_TIME *)(size + 1); - - DUMB_IT_ROW_TIME * s_loop_start = s + loop_start; - LONG_LONG loop_start_time; - - if ( loop_start >= *size || s_loop_start->count < 1 ) return; - -#ifndef FULL_TIMEKEEPING - loop_start_time = s_loop_start->first_time; -#else - loop_start_time = s_loop_start->times[0]; -#endif - - for ( i = 0; i < *size; i++ ) { -#ifndef FULL_TIMEKEEPING - if ( s[i].count && s[i].first_time >= loop_start_time ) { -#else - if ( s[i].count && s[i].times[0] >= loop_start_time ) { -#endif - s[i].restart_count = 0; - } - } -} - -void timekeeping_array_push(void * array, size_t index, LONG_LONG time) -{ -#ifdef FULL_TIMEKEEPING - size_t i; - size_t time_count; -#endif - size_t * size = (size_t *) array; - DUMB_IT_ROW_TIME * s = (DUMB_IT_ROW_TIME *)(size + 1); - - if (index >= *size) return; - -#ifndef FULL_TIMEKEEPING - if ( !s[index].count++ ) - s[index].first_time = time; -#else - time_count = ( s[index].count + 16 ) & ~15; - - s[index].times = (LONG_LONG *) realloc( s[index].times, sizeof(LONG_LONG) * time_count ); - - s[index].times[s[index].count++] = time; -#endif -} - -void timekeeping_array_bump(void * array, size_t index) -{ - size_t * size = (size_t *) array; - DUMB_IT_ROW_TIME * s = (DUMB_IT_ROW_TIME *)(size + 1); - - if (index >= *size) return; - - s[index].restart_count++; -} - -unsigned int timekeeping_array_get_count(void * array, size_t index) -{ - size_t * size = (size_t *) array; - DUMB_IT_ROW_TIME * s = (DUMB_IT_ROW_TIME *)(size + 1); - - if (index >= *size) return 0; - - return s[index].count; -} - -LONG_LONG timekeeping_array_get_item(void * array, size_t index) -{ - size_t * size = (size_t *) array; - DUMB_IT_ROW_TIME * s = (DUMB_IT_ROW_TIME *)(size + 1); - - if (index >= *size || s[index].restart_count >= s[index].count) return 0; - -#ifndef FULL_TIMEKEEPING - return s[index].first_time; -#else - return s[index].times[s[index].restart_count]; -#endif -} diff --git a/dumb/src/it/itrender.c b/dumb/src/it/itrender.c index 99f8bdc13..0a7feae3c 100644 --- a/dumb/src/it/itrender.c +++ b/dumb/src/it/itrender.c @@ -352,8 +352,6 @@ static DUMB_IT_SIGRENDERER *dup_sigrenderer(DUMB_IT_SIGRENDERER *src, int n_chan #ifdef BIT_ARRAY_BULLSHIT dst->played = bit_array_dup(src->played); - - dst->row_timekeeper = timekeeping_array_dup(src->row_timekeeper); #endif dst->gvz_time = src->gvz_time; @@ -2219,9 +2217,6 @@ Yxy This uses a table 4 times larger (hence 4 times slower) than bit_array_set(sigrenderer->played, sigrenderer->order * 256 + sigrenderer->row); #endif sigrenderer->speed = 0; -#ifdef BIT_ARRAY_BULLSHIT - sigrenderer->looped = 1; -#endif if (sigrenderer->callbacks->xm_speed_zero && (*sigrenderer->callbacks->xm_speed_zero)(sigrenderer->callbacks->xm_speed_zero_data)) return 1; } @@ -4242,10 +4237,6 @@ static int process_tick(DUMB_IT_SIGRENDERER *sigrenderer) */ #endif bit_array_set(sigrenderer->played, sigrenderer->order * 256 + sigrenderer->row); - if (sigrenderer->looped == 0) { - timekeeping_array_push(sigrenderer->row_timekeeper, sigrenderer->order * 256 + sigrenderer->row, sigrenderer->time_played); - } - timekeeping_array_bump(sigrenderer->row_timekeeper, sigrenderer->order * 256 + sigrenderer->row); { int n; for (n = 0; n < DUMB_IT_N_CHANNELS; n++) @@ -4343,8 +4334,6 @@ static int process_tick(DUMB_IT_SIGRENDERER *sigrenderer) /* Fix play tracking and timekeeping for orders containing skip commands */ for (n = 0; n < 256; n++) { bit_array_set(sigrenderer->played, sigrenderer->processorder * 256 + n); - timekeeping_array_push(sigrenderer->row_timekeeper, sigrenderer->processorder * 256 + n, sigrenderer->time_played); - timekeeping_array_bump(sigrenderer->row_timekeeper, sigrenderer->processorder * 256 + n); } #endif } @@ -4369,9 +4358,6 @@ static int process_tick(DUMB_IT_SIGRENDERER *sigrenderer) && bit_array_test(sigrenderer->played, sigrenderer->processorder * 256 + sigrenderer->processrow) #endif ) { -#ifdef BIT_ARRAY_BULLSHIT - sigrenderer->looped = 1; -#endif if (sigrenderer->callbacks->loop) { if ((*sigrenderer->callbacks->loop)(sigrenderer->callbacks->loop_data)) return 1; @@ -4466,9 +4452,6 @@ static int process_tick(DUMB_IT_SIGRENDERER *sigrenderer) sigrenderer->gvz_time += (int)(t >> 16); sigrenderer->gvz_sub_time = (int)t & 65535; if (sigrenderer->gvz_time >= 65536 * 12) { -#ifdef BIT_ARRAY_BULLSHIT - sigrenderer->looped = 1; -#endif if ((*sigrenderer->callbacks->global_volume_zero)(sigrenderer->callbacks->global_volume_zero_data)) return 1; } @@ -5283,10 +5266,6 @@ static DUMB_IT_SIGRENDERER *init_sigrenderer(DUMB_IT_SIGDATA *sigdata, int n_cha #ifdef BIT_ARRAY_BULLSHIT sigrenderer->played = bit_array_create(sigdata->n_orders * 256); - - sigrenderer->looped = 0; - sigrenderer->time_played = 0; - sigrenderer->row_timekeeper = timekeeping_array_create(sigdata->n_orders * 256); #endif { @@ -5305,8 +5284,6 @@ static DUMB_IT_SIGRENDERER *init_sigrenderer(DUMB_IT_SIGDATA *sigdata, int n_cha /* Fix for played order detection for songs which have skips at the start of the orders list */ for (n = 0; n < 256; n++) { bit_array_set(sigrenderer->played, order * 256 + n); - timekeeping_array_push(sigrenderer->row_timekeeper, order * 256 + n, 0); - timekeeping_array_bump(sigrenderer->row_timekeeper, order * 256 + n); } #endif } @@ -5319,6 +5296,10 @@ static DUMB_IT_SIGRENDERER *init_sigrenderer(DUMB_IT_SIGDATA *sigdata, int n_cha sigrenderer->time_left = 0; sigrenderer->sub_time_left = 0; +#ifdef BIT_ARRAY_BULLSHIT + sigrenderer->played = bit_array_create(sigdata->n_orders * 256); +#endif + sigrenderer->gvz_time = 0; sigrenderer->gvz_sub_time = 0; @@ -5504,8 +5485,7 @@ static int32 it_sigrenderer_get_samples( int32 pos; int dt; int32 todo; - int ret; - LONG_LONG time_left, t; + LONG_LONG t; if (sigrenderer->order < 0) return 0; // problematic @@ -5518,8 +5498,7 @@ static int32 it_sigrenderer_get_samples( if (!samples) volume = 0; for (;;) { - time_left = ((LONG_LONG)sigrenderer->time_left << 16) | sigrenderer->sub_time_left; - todo = (long)(time_left / dt); + todo = (long)((((LONG_LONG)sigrenderer->time_left << 16) | sigrenderer->sub_time_left) / dt); if (todo >= size) break; @@ -5533,28 +5512,9 @@ static int32 it_sigrenderer_get_samples( sigrenderer->sub_time_left = (int32)t & 65535; sigrenderer->time_left += (int32)(t >> 16); -#ifdef BIT_ARRAY_BULLSHIT - sigrenderer->time_played += time_left; -#endif - - ret = process_tick(sigrenderer); - - if (ret) { + if (process_tick(sigrenderer)) { sigrenderer->order = -1; sigrenderer->row = -1; - } - -#ifdef BIT_ARRAY_BULLSHIT - if (sigrenderer->looped == 1) { - sigrenderer->looped = -1; - size = 0; - timekeeping_array_reset(sigrenderer->row_timekeeper, sigrenderer->order * 256 + sigrenderer->row); - sigrenderer->time_played = timekeeping_array_get_item(sigrenderer->row_timekeeper, sigrenderer->order * 256 + sigrenderer->row); - break; - } -#endif - - if (ret) { return pos; } } @@ -5567,10 +5527,6 @@ static int32 it_sigrenderer_get_samples( sigrenderer->sub_time_left = (int32)t & 65535; sigrenderer->time_left += (int32)(t >> 16); -#ifdef BIT_ARRAY_BULLSHIT - sigrenderer->time_played += (LONG_LONG)size * dt; -#endif - if (samples) dumb_remove_clicks_array(sigrenderer->n_channels, sigrenderer->click_remover, samples, pos, 512.0f / delta); @@ -5622,8 +5578,6 @@ void _dumb_it_end_sigrenderer(sigrenderer_t *vsigrenderer) #ifdef BIT_ARRAY_BULLSHIT bit_array_destroy(sigrenderer->played); - - timekeeping_array_destroy(sigrenderer->row_timekeeper); #endif free(vsigrenderer); @@ -5632,17 +5586,6 @@ void _dumb_it_end_sigrenderer(sigrenderer_t *vsigrenderer) -#ifdef BIT_ARRAY_BULLSHIT -static int32 it_sigrenderer_get_position(sigrenderer_t *vsigrenderer) -{ - DUMB_IT_SIGRENDERER *sigrenderer = vsigrenderer; - - return (int32)(sigrenderer->time_played >> 16); -} -#endif - - - DUH_SIGTYPE_DESC _dumb_sigtype_it = { SIGTYPE_IT, NULL, @@ -5650,11 +5593,6 @@ DUH_SIGTYPE_DESC _dumb_sigtype_it = { NULL, &it_sigrenderer_get_samples, &it_sigrenderer_get_current_sample, -#ifdef BIT_ARRAY_BULLSHIT - &it_sigrenderer_get_position, -#else - NULL, -#endif &_dumb_it_end_sigrenderer, &_dumb_it_unload_sigdata }; diff --git a/dumb/vc6/dumb/dumb.vcxproj b/dumb/vc6/dumb/dumb.vcxproj index 6e49557cf..ae8ebdb0b 100644 --- a/dumb/vc6/dumb/dumb.vcxproj +++ b/dumb/vc6/dumb/dumb.vcxproj @@ -118,7 +118,6 @@ - @@ -210,7 +209,6 @@ - diff --git a/dumb/vc6/dumb/dumb.vcxproj.filters b/dumb/vc6/dumb/dumb.vcxproj.filters index 167393748..422556dc2 100644 --- a/dumb/vc6/dumb/dumb.vcxproj.filters +++ b/dumb/vc6/dumb/dumb.vcxproj.filters @@ -279,9 +279,6 @@ src\helpers - - src\helpers - @@ -314,9 +311,6 @@ include\internal - - include\internal - From 3d83ed2ee5d7ff219a8f8895c148fe5ae2a040e0 Mon Sep 17 00:00:00 2001 From: Tuomas Virtanen Date: Thu, 25 Jun 2015 16:00:13 +0300 Subject: [PATCH 27/37] Change dumb.h version information to match release version Conflicts: dumb/include/dumb.h --- dumb/include/dumb.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/dumb/include/dumb.h b/dumb/include/dumb.h index 2b6ac4879..385335da7 100644 --- a/dumb/include/dumb.h +++ b/dumb/include/dumb.h @@ -36,24 +36,24 @@ #endif -#define DUMB_MAJOR_VERSION 0 -#define DUMB_MINOR_VERSION 9 -#define DUMB_REVISION_VERSION 3 +#define DUMB_MAJOR_VERSION 1 +#define DUMB_MINOR_VERSION 0 +#define DUMB_REVISION_VERSION 0 #define DUMB_VERSION (DUMB_MAJOR_VERSION*10000 + DUMB_MINOR_VERSION*100 + DUMB_REVISION_VERSION) -#define DUMB_VERSION_STR "0.9.3" +#define DUMB_VERSION_STR "1.0.0" #define DUMB_NAME "DUMB v" DUMB_VERSION_STR -#define DUMB_YEAR 2005 -#define DUMB_MONTH 8 -#define DUMB_DAY 7 +#define DUMB_YEAR 2015 +#define DUMB_MONTH 1 +#define DUMB_DAY 17 -#define DUMB_YEAR_STR2 "05" -#define DUMB_YEAR_STR4 "2005" -#define DUMB_MONTH_STR1 "8" -#define DUMB_DAY_STR1 "7" +#define DUMB_YEAR_STR2 "15" +#define DUMB_YEAR_STR4 "2015" +#define DUMB_MONTH_STR1 "1" +#define DUMB_DAY_STR1 "17" #if DUMB_MONTH < 10 #define DUMB_MONTH_STR2 "0" DUMB_MONTH_STR1 From 865f083128744bbc02cb9b1164dae0d3a91f9fa7 Mon Sep 17 00:00:00 2001 From: Chris Spiegel Date: Mon, 10 Aug 2015 21:07:17 -0700 Subject: [PATCH 28/37] Fix memory leaks. --- dumb/src/it/readptm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dumb/src/it/readptm.c b/dumb/src/it/readptm.c index 885929e42..9b34861db 100644 --- a/dumb/src/it/readptm.c +++ b/dumb/src/it/readptm.c @@ -439,6 +439,7 @@ static DUMB_IT_SIGDATA *it_ptm_load_sigdata(DUMBFILE *f) } if (dumbfile_seek(f, 352, DFS_SEEK_SET)) { + free(component); _dumb_it_unload_sigdata(sigdata); return NULL; } @@ -451,12 +452,14 @@ static DUMB_IT_SIGDATA *it_ptm_load_sigdata(DUMBFILE *f) } if (dumbfile_seek(f, 608, DFS_SEEK_SET)) { + free(component); _dumb_it_unload_sigdata(sigdata); return NULL; } for (n = 0; n < sigdata->n_samples; n++) { if (it_ptm_read_sample_header(&sigdata->sample[n], &component[n_components].offset, f)) { + free(component); _dumb_it_unload_sigdata(sigdata); return NULL; } From 45e031170e55cd06ecd4ed657a3f458151669a48 Mon Sep 17 00:00:00 2001 From: Chris Moeller Date: Sat, 8 Aug 2015 21:26:05 -0700 Subject: [PATCH 29/37] Implement missing n_pchannels for AMF format reader --- dumb/src/it/readamf.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dumb/src/it/readamf.c b/dumb/src/it/readamf.c index 83f6075e7..820709e9d 100644 --- a/dumb/src/it/readamf.c +++ b/dumb/src/it/readamf.c @@ -320,6 +320,8 @@ static DUMB_IT_SIGDATA *it_amf_load_sigdata(DUMBFILE *f, int * version) free( sigdata ); return NULL; } + + sigdata->n_pchannels = nchannels; memset( sigdata->channel_volume, 64, DUMB_IT_N_CHANNELS ); From e5a4031a7010ac42559bfbcab5ffb71d1440e805 Mon Sep 17 00:00:00 2001 From: Chris Moeller Date: Fri, 14 Aug 2015 20:07:02 -0700 Subject: [PATCH 30/37] Fixed another memory leak in an error handler --- dumb/src/it/readxm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dumb/src/it/readxm.c b/dumb/src/it/readxm.c index a06fd1e99..0c838ade8 100644 --- a/dumb/src/it/readxm.c +++ b/dumb/src/it/readxm.c @@ -1197,6 +1197,7 @@ static DUMB_IT_SIGDATA *it_xm_load_sigdata(DUMBFILE *f, int * version) sigdata->instrument = malloc(sigdata->n_instruments * sizeof(*sigdata->instrument)); if (!sigdata->instrument) { + free(roguebytes); _dumb_it_unload_sigdata(sigdata); return NULL; } From 17a216c832f1584355a777343b60202cff2342fa Mon Sep 17 00:00:00 2001 From: Chris Moeller Date: Fri, 9 Oct 2015 17:59:30 -0700 Subject: [PATCH 31/37] Fix issue #15 / CVE-2006-3668 --- dumb/src/it/itread.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dumb/src/it/itread.c b/dumb/src/it/itread.c index e8661807e..ca1dde55d 100644 --- a/dumb/src/it/itread.c +++ b/dumb/src/it/itread.c @@ -290,12 +290,15 @@ static int it_read_envelope(IT_ENVELOPE *envelope, DUMBFILE *f) envelope->flags = dumbfile_getc(f); envelope->n_nodes = dumbfile_getc(f); + if(envelope->n_nodes > 25) { + TRACE("IT error: wrong number of envelope nodes (%d)\n", envelope->n_nodes); + envelope->n_nodes = 0; + return -1; + } envelope->loop_start = dumbfile_getc(f); envelope->loop_end = dumbfile_getc(f); envelope->sus_loop_start = dumbfile_getc(f); envelope->sus_loop_end = dumbfile_getc(f); - if (envelope->n_nodes > 25) - envelope->n_nodes = 25; for (n = 0; n < envelope->n_nodes; n++) { envelope->node_y[n] = dumbfile_getc(f); envelope->node_t[n] = dumbfile_igetw(f); From 792d3906fd2be890a2f17c8a90f097981cdbc143 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 19 Dec 2015 20:32:41 +0100 Subject: [PATCH 32/37] - fixed: line activation checks for monster activation could be skipped if the lines also were flagged for player activation. --- src/p_spec.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/p_spec.cpp b/src/p_spec.cpp index 9bc0d4a9b..e2cc0025b 100644 --- a/src/p_spec.cpp +++ b/src/p_spec.cpp @@ -288,16 +288,16 @@ bool P_TestActivateLine (line_t *line, AActor *mo, int side, int activationType) } } + if (activationType == SPAC_Use && (lineActivation & SPAC_MUse) && !mo->player && mo->flags4 & MF4_CANUSEWALLS) + { + return true; + } + if (activationType == SPAC_Push && (lineActivation & SPAC_MPush) && !mo->player && mo->flags2 & MF2_PUSHWALL) + { + return true; + } if ((lineActivation & activationType) == 0) { - if (activationType == SPAC_Use && (lineActivation & SPAC_MUse) && !mo->player && mo->flags4 & MF4_CANUSEWALLS) - { - return true; - } - if (activationType == SPAC_Push && (lineActivation & SPAC_MPush) && !mo->player && mo->flags2 & MF2_PUSHWALL) - { - return true; - } if (activationType != SPAC_MCross || lineActivation != SPAC_Cross) { return false; From 03ccf03b8f3161a601cd223a3abfcf345da79f16 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 21 Dec 2015 01:13:21 +0100 Subject: [PATCH 33/37] - fixed: UDMF with Doom format specials used the line's ID, not the first arg as the tag parameter for its special. --- src/p_udmf.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_udmf.cpp b/src/p_udmf.cpp index 269ce7e3d..db0c952cf 100644 --- a/src/p_udmf.cpp +++ b/src/p_udmf.cpp @@ -785,7 +785,7 @@ public: bool strifetrans = false; bool strifetrans2 = false; FString arg0str, arg1str; - int lineid; // forZDoomTranslated namespace + int lineid = -1; // forZDoomTranslated namespace FString tagstring; memset(ld, 0, sizeof(*ld)); @@ -1082,7 +1082,7 @@ public: maplinedef_t mld; memset(&mld, 0, sizeof(mld)); mld.special = ld->special; - mld.tag = lineid; + mld.tag = ld->args[0]; P_TranslateLineDef(ld, &mld); ld->flags = saved | (ld->flags&(ML_MONSTERSCANACTIVATE|ML_REPEAT_SPECIAL|ML_FIRSTSIDEONLY)); } From c51abb01610fc6eb399da8139eca83856fd3a5b5 Mon Sep 17 00:00:00 2001 From: Blue-Shadow Date: Tue, 22 Dec 2015 19:01:09 +0300 Subject: [PATCH 34/37] Added GetMaxInventory ACS function --- src/p_acs.cpp | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 30733eac8..b94d63b79 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -1264,7 +1264,7 @@ static int UseInventory (AActor *activator, const char *type) // //============================================================================ -static int CheckInventory (AActor *activator, const char *type) +static int CheckInventory (AActor *activator, const char *type, bool max) { if (activator == NULL || type == NULL) return 0; @@ -1275,11 +1275,26 @@ static int CheckInventory (AActor *activator, const char *type) } else if (stricmp (type, "Health") == 0) { + if (max) + { + if (activator->IsKindOf (RUNTIME_CLASS (APlayerPawn))) + return static_cast(activator)->MaxHealth; + else + return activator->SpawnHealth(); + } return activator->health; } const PClass *info = PClass::FindClass (type); AInventory *item = activator->FindInventory (info); + + if (max) + { + if (item) + return item->MaxAmount; + else + return ((AInventory *)GetDefaultByType (info))->MaxAmount; + } return item ? item->Amount : 0; } @@ -4442,6 +4457,7 @@ enum EACSFunctions ACSF_GetActorRoll, ACSF_QuakeEx, ACSF_Warp, // 92 + ACSF_GetMaxInventory, /* Zandronum's - these must be skipped when we reach 99! -100:ResetMap(0), @@ -5915,6 +5931,13 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound) } return false; } + case ACSF_GetMaxInventory: + actor = SingleActorFromTID(args[0], activator); + if (actor != NULL) + { + return CheckInventory(actor, FBehavior::StaticLookupString(args[1]), true); + } + break; default: break; @@ -8339,17 +8362,17 @@ scriptwait: break; case PCD_CHECKINVENTORY: - STACK(1) = CheckInventory (activator, FBehavior::StaticLookupString (STACK(1))); + STACK(1) = CheckInventory (activator, FBehavior::StaticLookupString (STACK(1)), false); break; case PCD_CHECKACTORINVENTORY: STACK(2) = CheckInventory (SingleActorFromTID(STACK(2), NULL), - FBehavior::StaticLookupString (STACK(1))); + FBehavior::StaticLookupString (STACK(1)), false); sp--; break; case PCD_CHECKINVENTORYDIRECT: - PushToStack (CheckInventory (activator, FBehavior::StaticLookupString (TAGSTR(uallong(pc[0]))))); + PushToStack (CheckInventory (activator, FBehavior::StaticLookupString (TAGSTR(uallong(pc[0]))), false)); pc += 1; break; From beb7a8e4a2ace28fda777d59f5fcbda785713e65 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 22 Dec 2015 22:21:59 +0100 Subject: [PATCH 35/37] - added /LARGEADDRESSAWARE linker flag to CMake project. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dd2c7730f..3e375a2df 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -123,7 +123,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS( GME if( MSVC ) # Eliminate unreferenced functions and data # Perform identical COMDAT folding - set( REL_LINKER_FLAGS "/opt:ref /opt:icf /nodefaultlib:msvcrt /TSAWARE" ) + set( REL_LINKER_FLAGS "/opt:ref /opt:icf /nodefaultlib:msvcrt /TSAWARE /LARGEADDRESSAWARE" ) # String pooling # Function-level linking From 400038643cab557e828881c716d0f08820accd69 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 26 Dec 2015 15:31:59 +0100 Subject: [PATCH 36/37] - fixed: Strife dialogues could crash on invalid links. --- src/p_conversation.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/p_conversation.cpp b/src/p_conversation.cpp index 069fca6e1..85edc53ab 100644 --- a/src/p_conversation.cpp +++ b/src/p_conversation.cpp @@ -1347,9 +1347,10 @@ static void HandleReply(player_t *player, bool isconsole, int nodenum, int reply int rootnode = npc->ConversationRoot; if (reply->NextNode < 0) { - npc->Conversation = StrifeDialogues[rootnode - reply->NextNode - 1]; - if (gameaction != ga_slideshow) + unsigned next = (unsigned)(rootnode - reply->NextNode - 1); + if (gameaction != ga_slideshow && next < StrifeDialogues.Size()) { + npc->Conversation = StrifeDialogues[next]; P_StartConversation (npc, player->mo, player->ConversationFaceTalker, false); return; } From 1070bd9beb9e17de359486fbed201dd330b29a6f Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 26 Dec 2015 16:17:56 +0100 Subject: [PATCH 37/37] - fixed: APlayerPawn::ViewHeight wasn't stored in savegames. --- src/p_user.cpp | 4 ++++ src/version.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/p_user.cpp b/src/p_user.cpp index 0d5cdce20..331a978b7 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -566,6 +566,10 @@ void APlayerPawn::Serialize (FArchive &arc) { arc << AirCapacity; } + if (SaveVersion >= 4526) + { + arc << ViewHeight; + } } //=========================================================================== diff --git a/src/version.h b/src/version.h index 168cb7519..c1288f02f 100644 --- a/src/version.h +++ b/src/version.h @@ -76,7 +76,7 @@ const char *GetVersionString(); // Use 4500 as the base git save version, since it's higher than the // SVN revision ever got. -#define SAVEVER 4525 +#define SAVEVER 4526 #define SAVEVERSTRINGIFY2(x) #x #define SAVEVERSTRINGIFY(x) SAVEVERSTRINGIFY2(x)