From 389ff4fc98b6ad354418d9370a97b52dc9f49e0b Mon Sep 17 00:00:00 2001 From: Edward Richardson Date: Sun, 30 Aug 2015 22:02:36 +1200 Subject: [PATCH 1/6] Shift self-clip to first check for performance --- src/p_map.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/p_map.cpp b/src/p_map.cpp index fca43c120..c9b2f14cf 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -1013,6 +1013,10 @@ bool PIT_CheckThing(AActor *thing, FCheckPosition &tm) bool solid; int damage; + // don't clip against self + if (thing == tm.thing) + return true; + if (!((thing->flags & (MF_SOLID | MF_SPECIAL | MF_SHOOTABLE)) || thing->flags6 & MF6_TOUCHY)) return true; // can't hit thing @@ -1020,10 +1024,6 @@ bool PIT_CheckThing(AActor *thing, FCheckPosition &tm) if (abs(thing->x - tm.x) >= blockdist || abs(thing->y - tm.y) >= blockdist) return true; - // don't clip against self - if (thing == tm.thing) - return true; - if ((thing->flags2 | tm.thing->flags2) & MF2_THRUACTORS) return true; From b87435ac9d931d3bd053fd9084cb23d7d5457426 Mon Sep 17 00:00:00 2001 From: Edward Richardson Date: Sun, 30 Aug 2015 22:56:34 +1200 Subject: [PATCH 2/6] Remove unnecessary FriendlyFire global --- src/p_interaction.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index 276a88c75..2947bf9c0 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -74,7 +74,6 @@ EXTERN_CVAR (Bool, show_obituaries) FName MeansOfDeath; -bool FriendlyFire; // // GET STUFF @@ -198,10 +197,8 @@ void ClientObituary (AActor *self, AActor *inflictor, AActor *attacker, int dmgf if (inflictor && inflictor->player && inflictor->player->mo != inflictor) MeansOfDeath = NAME_None; - if (multiplayer && !deathmatch) - FriendlyFire = true; + friendly = (self->player != attacker->player && self->IsTeammate(attacker)); - friendly = FriendlyFire; mod = MeansOfDeath; message = NULL; messagename = NULL; @@ -1024,7 +1021,6 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, } MeansOfDeath = mod; - FriendlyFire = false; // [RH] Andy Baker's Stealth monsters if (target->flags & MF_STEALTH) { @@ -1221,8 +1217,6 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, ((player && player != source->player) || (!player && target != source)) && target->IsTeammate (source)) { - if (player) - FriendlyFire = true; if (rawdamage < TELEFRAG_DAMAGE) //Use the original damage to check for telefrag amount. Don't let the now-amplified damagetypes do it. { // Still allow telefragging :-( damage = (int)((float)damage * level.teamdamage); From 02c562518ddf9657c0a353bd03a4caab424a214e Mon Sep 17 00:00:00 2001 From: Edward Richardson Date: Sun, 30 Aug 2015 23:36:00 +1200 Subject: [PATCH 3/6] Fixed possible sync issue with frag counts --- src/p_interaction.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index 2947bf9c0..a0b1ddbc1 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -268,8 +268,6 @@ void ClientObituary (AActor *self, AActor *inflictor, AActor *attacker, int dmgf { if (friendly) { - attacker->player->fragcount -= 2; - attacker->player->frags[attacker->player - players]++; self = attacker; gender = self->player->userinfo.GetGender(); mysnprintf (gendermessage, countof(gendermessage), "OB_FRIENDLY%c", '1' + (pr_obituary() & 3)); @@ -467,12 +465,21 @@ void AActor::Die (AActor *source, AActor *inflictor, int dmgflags) if ((dmflags2 & DF2_YES_LOSEFRAG) && deathmatch) player->fragcount--; - ++source->player->fragcount; - ++source->player->spreecount; + if (this->IsTeammate(source)) + { + source->player->fragcount--; + } + else + { + ++source->player->fragcount; + ++source->player->spreecount; + } + if (source->player->morphTics) { // Make a super chicken source->GiveInventoryType (RUNTIME_CLASS(APowerWeaponLevel2)); } + if (deathmatch && cl_showsprees) { const char *spreemsg; From 8ec4d431cfcba1479d5631613a6c8b4ea20bf2a7 Mon Sep 17 00:00:00 2001 From: Edward Richardson Date: Sat, 5 Sep 2015 14:12:52 +1200 Subject: [PATCH 4/6] Fixed memory leak in joystick menu --- src/menu/joystickmenu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/menu/joystickmenu.cpp b/src/menu/joystickmenu.cpp index a7d950ed5..676bc1767 100644 --- a/src/menu/joystickmenu.cpp +++ b/src/menu/joystickmenu.cpp @@ -345,8 +345,8 @@ void UpdateJoystickMenu(IJoystickConfig *selected) for(unsigned i=0;imItems.Size();i++) { delete opt->mItems[i]; - opt->mItems.Clear(); } + opt->mItems.Clear(); int i; int itemnum = -1; From abb033d400eed5a5d3c2577b86764695c6d80cf6 Mon Sep 17 00:00:00 2001 From: Edward Richardson Date: Sat, 5 Sep 2015 14:18:48 +1200 Subject: [PATCH 5/6] Fix deallocation of controllers with no axes --- src/win32/i_dijoy.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/win32/i_dijoy.cpp b/src/win32/i_dijoy.cpp index ccbc7ecdc..439e0fda7 100644 --- a/src/win32/i_dijoy.cpp +++ b/src/win32/i_dijoy.cpp @@ -309,7 +309,7 @@ FDInputJoystick::~FDInputJoystick() { Joy_GenerateButtonEvents(Axes[0].ButtonValue, 0, 2, KEY_JOYAXIS1PLUS); } - else + else if (Axes.Size() > 1) { Joy_GenerateButtonEvents(Axes[1].ButtonValue, 0, 4, KEY_JOYAXIS1PLUS); for (i = 2; i < Axes.Size(); ++i) From 9aabc852816921ed1c95e6bba094961fc8dbcaab Mon Sep 17 00:00:00 2001 From: Edward Richardson Date: Sat, 5 Sep 2015 17:13:54 +1200 Subject: [PATCH 6/6] Fixed loading default map saves - Just like normal maps, default map stores an FString as a map name. --- src/g_level.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/g_level.cpp b/src/g_level.cpp index 899f96d4f..15d88ccaf 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -1791,8 +1791,14 @@ void G_ReadSnapshots (PNGHandle *png) DWORD snapver; arc << snapver; - arc << namelen; - arc.Read (mapname, namelen); + if (SaveVersion < 4508) + { + arc << namelen; + arc.Read(mapname, namelen); + mapname[namelen] = 0; + MapName = mapname; + } + else arc << MapName; TheDefaultLevelInfo.snapshotVer = snapver; TheDefaultLevelInfo.snapshot = new FCompressedMemFile; TheDefaultLevelInfo.snapshot->Serialize (arc);