From b08fcbf6b3ce306e851227b57b314e1b157e8537 Mon Sep 17 00:00:00 2001 From: Edward Richardson Date: Mon, 10 Nov 2014 18:37:14 +1300 Subject: [PATCH 1/6] Added compat profile for TNT MAP31 --- src/compatibility.cpp | 19 +++++++++++++++++++ wadsrc/static/compatibility.txt | 5 +++++ 2 files changed, 24 insertions(+) diff --git a/src/compatibility.cpp b/src/compatibility.cpp index 7bd28e5d94..8a4341b764 100644 --- a/src/compatibility.cpp +++ b/src/compatibility.cpp @@ -82,6 +82,7 @@ enum CP_SETWALLYSCALE, CP_SETTHINGZ, CP_SETTAG, + CP_SETTHINGFLAGS, }; // EXTERNAL FUNCTION PROTOTYPES -------------------------------------------- @@ -318,6 +319,15 @@ void ParseCompatibility() sc.MustGetNumber(); CompatParams.Push(sc.Number); } + else if (sc.Compare("setthingflags")) + { + if (flags.ExtCommandIndex == ~0u) flags.ExtCommandIndex = CompatParams.Size(); + CompatParams.Push(CP_SETTHINGFLAGS); + sc.MustGetNumber(); + CompatParams.Push(sc.Number); + sc.MustGetNumber(); + CompatParams.Push(sc.Number); + } else { sc.UnGet(); @@ -540,6 +550,15 @@ void SetCompatibilityParams() i += 3; break; } + case CP_SETTHINGFLAGS: + { + if ((unsigned)CompatParams[i + 1] < MapThingsConverted.Size()) + { + MapThingsConverted[CompatParams[i + 1]].flags = CompatParams[i + 2]; + } + i += 3; + break; + } } } } diff --git a/wadsrc/static/compatibility.txt b/wadsrc/static/compatibility.txt index 30c54c5563..d2bb85fd2c 100644 --- a/wadsrc/static/compatibility.txt +++ b/wadsrc/static/compatibility.txt @@ -389,3 +389,8 @@ B9DFF13207EACAC675C71D82624D0007 // XtheaterIII map01 { DisablePushWindowCheck } + +A53AE580A4AF2B5D0B0893F86914781E // TNT: Evilution map31 +{ + setthingflags 470 2016 +} \ No newline at end of file From 16e0f79fd7c31ab5a3b942c2899adaa2827e7fe3 Mon Sep 17 00:00:00 2001 From: Edward Richardson Date: Tue, 11 Nov 2014 02:18:52 +1300 Subject: [PATCH 2/6] Fix alt-tabbed desync with demos - Fixed: Stop the game timer if the window looses focus --- src/d_net.cpp | 2 +- src/doomstat.h | 1 + src/g_game.cpp | 5 +++-- src/s_sound.cpp | 26 +++++++++----------------- 4 files changed, 14 insertions(+), 20 deletions(-) diff --git a/src/d_net.cpp b/src/d_net.cpp index 4fcd66bd4b..02ca8c0c4d 100644 --- a/src/d_net.cpp +++ b/src/d_net.cpp @@ -939,7 +939,7 @@ void NetUpdate (void) newtics = nowtime - gametime; gametime = nowtime; - if (newtics <= 0) // nothing new to update + if (newtics <= 0 || pauseext) // nothing new to update or window paused { GetPackets (); return; diff --git a/src/doomstat.h b/src/doomstat.h index 1559609f11..565d15bd61 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -109,6 +109,7 @@ enum EMenuState extern bool automapactive; // In AutoMap mode? extern EMenuState menuactive; // Menu overlayed? extern int paused; // Game Pause? +extern bool pauseext; extern bool viewactive; diff --git a/src/g_game.cpp b/src/g_game.cpp index af4a5411e2..e419e09fc5 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -141,6 +141,7 @@ gameaction_t gameaction; gamestate_t gamestate = GS_STARTUP; int paused; +bool pauseext; bool sendpause; // send a pause event next tic bool sendsave; // send a save event next tic bool sendturn180; // [RH] send a 180 degree turn next tic @@ -1152,13 +1153,13 @@ void G_Ticker () // If the user alt-tabbed away, paused gets set to -1. In this case, // we do not want to read more demo commands until paused is no // longer negative. - if (demoplayback && paused >= 0) + if (demoplayback) { G_ReadDemoTiccmd (cmd, i); } else { - memcpy (cmd, newcmd, sizeof(ticcmd_t)); + memcpy(cmd, newcmd, sizeof(ticcmd_t)); } // check for turbo cheats diff --git a/src/s_sound.cpp b/src/s_sound.cpp index 75bd33d471..ccaebf6102 100644 --- a/src/s_sound.cpp +++ b/src/s_sound.cpp @@ -1783,21 +1783,13 @@ void S_SetSoundPaused (int state) { if (state) { - if (paused <= 0) + if (paused == 0) { S_ResumeSound(true); if (GSnd != NULL) { GSnd->SetInactive(SoundRenderer::INACTIVE_Active); } - if (!netgame -#ifdef _DEBUG - && !demoplayback -#endif - ) - { - paused = 0; - } } } else @@ -1811,16 +1803,16 @@ void S_SetSoundPaused (int state) SoundRenderer::INACTIVE_Complete : SoundRenderer::INACTIVE_Mute); } - if (!netgame -#ifdef _DEBUG - && !demoplayback -#endif - ) - { - paused = -1; - } } } + if (!netgame +#ifdef _DEBUG + && !demoplayback +#endif + ) + { + pauseext = !state; + } } //========================================================================== From ad33afb8c1c65053c8c8abecf91b3af50a1388dc Mon Sep 17 00:00:00 2001 From: Edward Richardson Date: Tue, 11 Nov 2014 02:19:24 +1300 Subject: [PATCH 3/6] Added text showing who paused a game in multiplayer --- src/d_main.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/d_main.cpp b/src/d_main.cpp index 7eb09c4e4d..4fea35301f 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -833,15 +833,23 @@ void D_Display () } } // draw pause pic - if (paused && menuactive == MENU_Off) + if ((paused || pauseext) && menuactive == MENU_Off) { FTexture *tex; int x; + FString pstring = "By "; tex = TexMan(gameinfo.PauseSign); x = (SCREENWIDTH - tex->GetScaledWidth() * CleanXfac)/2 + tex->GetScaledLeftOffset() * CleanXfac; screen->DrawTexture (tex, x, 4, DTA_CleanNoMove, true, TAG_DONE); + if (paused && multiplayer) + { + pstring += players[paused - 1].userinfo.GetName(); + screen->DrawText(SmallFont, CR_RED, + (screen->GetWidth() - SmallFont->StringWidth(pstring)*CleanXfac) / 2, + (tex->GetScaledHeight() * CleanYfac) + 4, pstring, DTA_CleanNoMove, true, TAG_DONE); + } } // [RH] Draw icon, if any From e0eca1e0f5fc0f34a97e5a41c31e325e62202547 Mon Sep 17 00:00:00 2001 From: darealshinji Date: Tue, 11 Nov 2014 06:26:38 +0100 Subject: [PATCH 4/6] link output_sdl.so against SDL --- output_sdl/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/output_sdl/CMakeLists.txt b/output_sdl/CMakeLists.txt index b959a68730..289f6f48dc 100644 --- a/output_sdl/CMakeLists.txt +++ b/output_sdl/CMakeLists.txt @@ -1,6 +1,7 @@ cmake_minimum_required( VERSION 2.4 ) add_library( output_sdl MODULE output_sdl.c ) include_directories( ${FMOD_INCLUDE_DIR} ${SDL_INCLUDE_DIR} ) +target_link_libraries( output_sdl SDL ) FILE( WRITE ${CMAKE_CURRENT_BINARY_DIR}/link-make "if [ ! -e ${ZDOOM_OUTPUT_DIR}/liboutput_sdl.so ]; then ln -sf output_sdl/liboutput_sdl.so ${ZDOOM_OUTPUT_DIR}/liboutput_sdl.so; fi" ) add_custom_command( TARGET output_sdl POST_BUILD From b54b18c8c581a05a2bf60b74bafe992f6865123c Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Wed, 12 Nov 2014 14:08:26 -0600 Subject: [PATCH 5/6] -Added: CAUSEPAIN. Actors which deal damage (even if 0) while having this flag can cause other actors to trigger pain chances. -Fixed: ALLOWPAIN should not trigger pain states if the damage is 0, but still allow for infighting to occur. -Fixed: an unneeded logic call was processing damage modification when it was 0 to begin with. --- src/actor.h | 1 + src/p_interaction.cpp | 57 ++++++++++++++++++++-------------- src/p_map.cpp | 2 +- src/thingdef/thingdef_data.cpp | 1 + 4 files changed, 36 insertions(+), 25 deletions(-) diff --git a/src/actor.h b/src/actor.h index 22f4cb7767..52a50b04ed 100644 --- a/src/actor.h +++ b/src/actor.h @@ -346,6 +346,7 @@ enum MF7_FOILBUDDHA = 0x00000080, // Similar to FOILINVUL, foils buddha mode. MF7_DONTTHRUST = 0x00000100, // Thrusting functions do not take, and do not give thrust (damage) to actors with this flag. MF7_ALLOWPAIN = 0x00000200, // Invulnerable or immune (via damagefactors) actors can still react to taking damage even if they don't. + MF7_CAUSEPAIN = 0x00000400, // Damage sources with this flag can cause similar effects like ALLOWPAIN. // --- mobj.renderflags --- diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index 88d95b25ea..5ae456f53f 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -970,13 +970,13 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, } return -1; } - if ((target->flags2 & MF2_INVULNERABLE) && damage < TELEFRAG_DAMAGE && !(flags & DMG_FORCED)) + if ((target->flags2 & MF2_INVULNERABLE) && (damage < TELEFRAG_DAMAGE) && (!(flags & DMG_FORCED))) { // actor is invulnerable if (target->player == NULL) { if (inflictor == NULL || (!(inflictor->flags3 & MF3_FOILINVUL) && !(flags & DMG_FOILINVUL))) { - if (target->flags7 & MF7_ALLOWPAIN) + if ((target->flags7 & MF7_ALLOWPAIN) || (inflictor->flags7 & MF7_CAUSEPAIN)) { invulpain = true; //This returns -1 later. fakeDamage = damage; @@ -991,7 +991,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, // Players are optionally excluded from getting thrust by damage. if (static_cast(target)->PlayerFlags & PPF_NOTHRUSTWHENINVUL) { - if (target->flags7 & MF7_ALLOWPAIN) + if ((target->flags7 & MF7_ALLOWPAIN) || (inflictor->flags7 & MF7_CAUSEPAIN)) plrDontThrust = 1; else return -1; @@ -999,7 +999,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, } } - if ((target->flags7 & MF7_ALLOWPAIN) && (damage < TELEFRAG_DAMAGE)) + if (((target->flags7 & MF7_ALLOWPAIN) || (inflictor->flags7 & MF7_CAUSEPAIN)) && (damage < TELEFRAG_DAMAGE)) { //Intentionally do not jump to fakepain because the damage hasn't been dished out yet. //Once it's dished out, THEN we can disregard damage factors affecting pain chances. @@ -1059,7 +1059,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, if (damage == -1) { - if (target->flags7 & MF7_ALLOWPAIN) //Hold off ending the function before we can deal the pain chances. + if ((target->flags7 & MF7_ALLOWPAIN) || (inflictor->flags7 & MF7_CAUSEPAIN)) //Hold off ending the function before we can deal the pain chances. goto fakepain; return -1; } @@ -1089,7 +1089,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, { goto dopain; } - else if (target->flags7 & MF7_ALLOWPAIN) + else if ((target->flags7 & MF7_ALLOWPAIN) || (inflictor->flags7 & MF7_CAUSEPAIN)) goto fakepain; return -1; @@ -1099,7 +1099,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, if (!(flags & DMG_NO_FACTOR)) { damage = FixedMul(damage, target->DamageFactor); - if (damage >= 0) + if (damage > 0) { damage = DamageTypeDefinition::ApplyMobjDamageFactor(damage, mod, target->GetClass()->ActorInfo->DamageFactors); } @@ -1109,7 +1109,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, { goto dopain; } - else if (target->flags7 & MF7_ALLOWPAIN) + else if ((target->flags7 & MF7_ALLOWPAIN) || (inflictor->flags7 & MF7_CAUSEPAIN)) goto fakepain; return -1; @@ -1120,7 +1120,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, } if (damage == -1) { - if (target->flags7 & MF7_ALLOWPAIN) + if ((target->flags7 & MF7_ALLOWPAIN) || (inflictor->flags7 & MF7_CAUSEPAIN)) goto fakepain; return -1; @@ -1243,12 +1243,16 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, { // check the real player, not a voodoo doll here for invulnerability effects if ((damage < TELEFRAG_DAMAGE && ((player->mo->flags2 & MF2_INVULNERABLE) || - (player->cheats & CF_GODMODE))) || - (player->cheats & CF_GODMODE2) || (player->mo->flags5 & MF5_NODAMAGE)) + (player->cheats & CF_GODMODE))) || + (player->cheats & CF_GODMODE2) || (player->mo->flags5 & MF5_NODAMAGE)) //Absolutely no hurting if NODAMAGE is involved. Same for GODMODE2. { // player is invulnerable, so don't hurt him - if (player->mo->flags7 & MF7_ALLOWPAIN) - { + + if (((!(player->cheats & CF_GODMODE)) && (!(player->cheats & CF_GODMODE2)) && (!(player->mo->flags5 & MF5_NOPAIN))) && + (((player->mo->flags7 & MF7_ALLOWPAIN) || (player->mo->flags5 & MF5_NODAMAGE)) || (inflictor->flags7 & MF7_CAUSEPAIN))) + //Make sure no godmodes and NOPAIN flags are found first. + //Then, check to see if the player has NODAMAGE or ALLOWPAIN, or inflictor has CAUSEPAIN. + { invulpain = true; fakeDamage = damage; goto fakepain; @@ -1270,8 +1274,8 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, { // If MF6_FORCEPAIN is set, make the player enter the pain state. if (!(target->flags5 & MF5_NOPAIN) && inflictor != NULL && - (inflictor->flags6 & MF6_FORCEPAIN) && !(inflictor->flags5 & MF5_PAINLESS) && - (!(player->mo->flags2 & MF2_INVULNERABLE))) + (inflictor->flags6 & MF6_FORCEPAIN) && !(inflictor->flags5 & MF5_PAINLESS) + && (!(player->mo->flags2 & MF2_INVULNERABLE)) && (!(player->cheats & CF_GODMODE)) && (!(player->cheats & CF_GODMODE2))) { goto dopain; } @@ -1302,7 +1306,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, // telefrag him right? ;) (Unfortunately the damage is "absorbed" by armor, // but telefragging should still do enough damage to kill the player) // Ignore players that are already dead. - if (((player->cheats & CF_BUDDHA2) || ((player->cheats & CF_BUDDHA) || (player->mo->flags7 & MF7_BUDDHA) && damage < TELEFRAG_DAMAGE)) && player->playerstate != PST_DEAD) + if ((player->cheats & CF_BUDDHA2) || (((player->cheats & CF_BUDDHA) || (player->mo->flags7 & MF7_BUDDHA)) && (damage < TELEFRAG_DAMAGE)) && (player->playerstate != PST_DEAD)) { // If this is a voodoo doll we need to handle the real player as well. player->mo->health = target->health = player->health = 1; @@ -1335,7 +1339,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, damage = newdam; if (damage <= 0) { - if (target->flags7 & MF7_ALLOWPAIN) + if ((target->flags7 & MF7_ALLOWPAIN) || (inflictor->flags7 & MF7_CAUSEPAIN)) goto fakepain; else return damage; @@ -1426,10 +1430,14 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, } fakepain: //Needed so we can skip the rest of the above, but still obey the original rules. - if (target->flags7 & MF7_ALLOWPAIN && (fakeDamage != damage)) + + //CAUSEPAIN can always attempt to trigger the chances of pain. + //ALLOWPAIN can do the same, only if the (unfiltered aka fake) damage is greater than 0. + if ((((target->flags7 & MF7_ALLOWPAIN) && (fakeDamage > 0)) + || (inflictor->flags7 & MF7_CAUSEPAIN)) && (fakeDamage != damage)) { - holdDamage = damage; - damage = fakeDamage; + holdDamage = damage; //Store the modified damage away after factors are taken into account. + damage = fakeDamage; //Retrieve the original damage. } if (!(target->flags5 & MF5_NOPAIN) && (inflictor == NULL || !(inflictor->flags5 & MF5_PAINLESS)) && @@ -1446,8 +1454,8 @@ fakepain: //Needed so we can skip the rest of the above, but still obey the orig } } - if ((damage >= target->PainThreshold && pr_damagemobj() < painchance) || - (inflictor != NULL && (inflictor->flags6 & MF6_FORCEPAIN))) + if ((((damage >= target->PainThreshold)) && (pr_damagemobj() < painchance)) + || (inflictor != NULL && (inflictor->flags6 & MF6_FORCEPAIN))) { dopain: if (mod == NAME_Electric) @@ -1484,6 +1492,7 @@ dopain: } } } + //ALLOWPAIN and CAUSEPAIN can still trigger infighting, even if no pain state is worked out. target->reactiontime = 0; // we're awake now... if (source) { @@ -1526,9 +1535,9 @@ dopain: { return -1; //NOW we return -1! } - else if (target->flags7 & MF7_ALLOWPAIN) + else if ((target->flags7 & MF7_ALLOWPAIN) || (inflictor->flags7 & MF7_CAUSEPAIN)) { - return holdDamage; + return holdDamage; //This is the calculated damage after all is said and done. } return damage; } diff --git a/src/p_map.cpp b/src/p_map.cpp index 44db5f4d88..066805d3f2 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -3695,7 +3695,7 @@ AActor *P_LineAttack(AActor *t1, angle_t angle, fixed_t distance, // [GZ] If MF6_FORCEPAIN is set, we need to call P_DamageMobj even if damage is 0! // Note: The puff may not yet be spawned here so we must check the class defaults, not the actor. int newdam = damage; - if (damage || (puffDefaults != NULL && puffDefaults->flags6 & MF6_FORCEPAIN)) + if (damage || (puffDefaults != NULL && ((puffDefaults->flags6 & MF6_FORCEPAIN) || (puffDefaults->flags7 & MF7_CAUSEPAIN)))) { int dmgflags = DMG_INFLICTOR_IS_PUFF | pflag; // Allow MF5_PIERCEARMOR on a weapon as well. diff --git a/src/thingdef/thingdef_data.cpp b/src/thingdef/thingdef_data.cpp index 347b2e01a3..e8cb91239b 100644 --- a/src/thingdef/thingdef_data.cpp +++ b/src/thingdef/thingdef_data.cpp @@ -246,6 +246,7 @@ static FFlagDef ActorFlags[]= DEFINE_FLAG(MF7, FOILBUDDHA, AActor, flags7), DEFINE_FLAG(MF7, DONTTHRUST, AActor, flags7), DEFINE_FLAG(MF7, ALLOWPAIN, AActor, flags7), + DEFINE_FLAG(MF7, CAUSEPAIN, AActor, flags7), // Effect flags DEFINE_FLAG(FX, VISIBILITYPULSE, AActor, effects), From fd354dbe9a9059ef539738f3abc0c5c9a5f47770 Mon Sep 17 00:00:00 2001 From: Edoardo Prezioso Date: Fri, 14 Nov 2014 12:18:46 +0100 Subject: [PATCH 6/6] - Added CPF_NOTURN flag for A_CustomPunch. --- src/thingdef/thingdef_codeptr.cpp | 14 +++++++++----- wadsrc/static/actors/constants.txt | 1 + 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index a34a2f8d68..a668e589b6 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -1384,6 +1384,7 @@ enum CPF_DAGGER = 2, CPF_PULLIN = 4, CPF_NORANDOMPUFFZ = 8, + CPF_NOTURN = 16, }; DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomPunch) @@ -1424,7 +1425,6 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomPunch) P_LineAttack (self, angle, Range, pitch, Damage, NAME_Melee, PuffType, puffFlags, &linetarget, &actualdamage); - // turn to face target if (linetarget) { if (LifeSteal && !(linetarget->flags5 & MF5_DONTDRAIN)) @@ -1435,10 +1435,14 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomPunch) S_Sound (self, CHAN_WEAPON, weapon->AttackSound, 1, ATTN_NORM); } - self->angle = R_PointToAngle2 (self->x, - self->y, - linetarget->x, - linetarget->y); + if (!(flags & CPF_NOTURN)) + { + // turn to face target + self->angle = R_PointToAngle2 (self->x, + self->y, + linetarget->x, + linetarget->y); + } if (flags & CPF_PULLIN) self->flags |= MF_JUSTATTACKED; if (flags & CPF_DAGGER) P_DaggerAlert (self, linetarget); diff --git a/wadsrc/static/actors/constants.txt b/wadsrc/static/actors/constants.txt index 8baf2e65c7..d9da11b2dd 100644 --- a/wadsrc/static/actors/constants.txt +++ b/wadsrc/static/actors/constants.txt @@ -175,6 +175,7 @@ const int CPF_USEAMMO = 1; const int CPF_DAGGER = 2; const int CPF_PULLIN = 4; const int CPF_NORANDOMPUFFZ = 8; +const int CPF_NOTURN = 16; // Flags for A_CustomMissile const int FPF_AIMATANGLE = 1;