From f4dcfad331a8678b7c70274a8ec8d37299371a71 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 20 May 2007 11:08:36 +0000 Subject: [PATCH] - Copied railgun sound fix from Skulltag. - Made infighting a level flag. The old method still exists but the level flags will take precedence if set. SVN r532 (trunk) --- docs/rh-log.txt | 7 +++++++ src/g_level.cpp | 8 +++++++- src/g_level.h | 2 ++ src/m_options.cpp | 8 +++++--- src/p_effect.cpp | 3 ++- src/p_floor.cpp | 21 +++++++++++++++++++-- src/p_interaction.cpp | 11 ++++++++--- src/p_map.cpp | 12 +++++++++--- wadsrc/mapinfo/strife.txt | 1 + 9 files changed, 60 insertions(+), 13 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 50ec6b718e..05e6f846ab 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,10 @@ +May 20, 2007 (Changes by Graf Zahl) +- Copied railgun sound fix from Skulltag. + +May 19, 2007 (Changes by Graf Zahl) +- Made infighting a level flag. The old method still exists but the level flags + will take precedence if set. + May 13, 2007 (Changes by Graf Zahl) - fixed: meleethreshold only has meaning when the attacking monster actually has a melee attack. diff --git a/src/g_level.cpp b/src/g_level.cpp index 75fd8ccc45..516f4c0f89 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -284,6 +284,9 @@ static const char *MapInfoMapLevel[] = "compat_invisibility", "bordertexture", "f1", // [RC] F1 help + "noinfighting", + "normalinfighting", + "totalinfighting", NULL }; @@ -419,6 +422,9 @@ MapHandlers[] = { MITYPE_COMPATFLAG, COMPATF_INVISIBILITY}, { MITYPE_LUMPNAME, lioffset(bordertexture), 0 }, { MITYPE_F1, lioffset(f1), 0, }, + { MITYPE_SCFLAGS, LEVEL_NOINFIGHTING, ~LEVEL_TOTALINFIGHTING }, + { MITYPE_SCFLAGS, 0, ~(LEVEL_NOINFIGHTING|LEVEL_TOTALINFIGHTING)}, + { MITYPE_SCFLAGS, LEVEL_TOTALINFIGHTING, ~LEVEL_NOINFIGHTING }, }; static const char *MapInfoClusterLevel[] = @@ -2220,7 +2226,7 @@ void G_InitLevelLocals () BaseBlendA = 0.0f; // Remove underwater blend effect, if any NormalLight.Maps = realcolormaps; - //NormalLight.Color = PalEntry (255, 255, 255); + // [BB] Instead of just setting the color, we also have reset Desaturate and build the lights. NormalLight.ChangeColor (PalEntry (255, 255, 255), 0); diff --git a/src/g_level.h b/src/g_level.h index 205303206a..3ede23b7ff 100644 --- a/src/g_level.h +++ b/src/g_level.h @@ -107,6 +107,8 @@ #define LEVEL_CROUCH_YES UCONST64(0x100000000000) #define LEVEL_PAUSE_MUSIC_IN_MENUS UCONST64(0x200000000000) +#define LEVEL_TOTALINFIGHTING UCONST64(0x400000000000) +#define LEVEL_NOINFIGHTING UCONST64(0x800000000000) struct acsdefered_s; diff --git a/src/m_options.cpp b/src/m_options.cpp index 62fa6c622e..c9decfefa4 100644 --- a/src/m_options.cpp +++ b/src/m_options.cpp @@ -1225,12 +1225,13 @@ void M_OptInit (void) void M_InitVideoModesMenu () { - int dummy1, dummy2; - size_t currval = 0; - char name[24]; + //int dummy1, dummy2; + //size_t currval = 0; + //char name[24]; M_RefreshModesList(); + /* for (unsigned int i = 1; i < 32 && currval < countof(Depths); i++) { Video->StartModeIterator (i, screen->IsFullscreen()); @@ -1243,6 +1244,7 @@ void M_InitVideoModesMenu () currval++; } } + */ //ModesItems[VM_DEPTHITEM].b.min = (float)currval; diff --git a/src/p_effect.cpp b/src/p_effect.cpp index c66d198c5c..67a6270c2e 100644 --- a/src/p_effect.cpp +++ b/src/p_effect.cpp @@ -462,8 +462,9 @@ void P_DrawRailTrail (AActor *source, const FVector3 &start, const FVector3 &end else { // Only consider sound in 2D (for now, anyway) + // [BB] You have to devide by lengthsquared here, not multiply with it. r = ((start.Y - FIXED2FLOAT(mo->y)) * (-dir.Y) - - (start.X - FIXED2FLOAT(mo->x)) * (dir.X)) * length * length; + (start.X - FIXED2FLOAT(mo->x)) * (dir.X)) / lengthsquared; dirz = dir.Z; dir.Z = 0; diff --git a/src/p_floor.cpp b/src/p_floor.cpp index 294f74b723..33d1d22185 100644 --- a/src/p_floor.cpp +++ b/src/p_floor.cpp @@ -230,17 +230,34 @@ void DElevator::Tick () { EResult res; + fixed_t oldfloor, oldceiling; + + oldfloor = m_Sector->floorplane.d; + oldceiling = m_Sector->ceilingplane.d; + if (m_Direction < 0) // moving down { res = MoveCeiling (m_Speed, m_CeilingDestDist, m_Direction); if (res == ok || res == pastdest) - MoveFloor (m_Speed, m_FloorDestDist, m_Direction); + { + res = MoveFloor (m_Speed, m_FloorDestDist, m_Direction); + if (res == crushed) + { + MoveCeiling (m_Speed, oldceiling, -m_Direction); + } + } } else // up { res = MoveFloor (m_Speed, m_FloorDestDist, m_Direction); if (res == ok || res == pastdest) - MoveCeiling (m_Speed, m_CeilingDestDist, m_Direction); + { + res = MoveCeiling (m_Speed, m_CeilingDestDist, m_Direction); + if (res == crushed) + { + MoveFloor (m_Speed, oldfloor, -m_Direction); + } + } } if (res == pastdest) // if destination height acheived diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index fd53f62827..6a7cbe6552 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -1241,10 +1241,15 @@ bool AActor::OkayToSwitchTarget (AActor *other) { // [RH] Friendlies don't target other friendlies return false; } - if ((gameinfo.gametype == GAME_Strife || infighting < 0) && - other->player == NULL && !IsHostile (other)) + + int infight; + if (level.flags & LEVEL_TOTALINFIGHTING) infight=1; + else if (level.flags & LEVEL_NOINFIGHTING) infight=-1; + else infight = infighting; + + if (infight < 0 && other->player == NULL && !IsHostile (other)) { - return false; // Strife & infighting off: Non-friendlies don't target other non-friendlies + return false; // infighting off: Non-friendlies don't target other non-friendlies } if (TIDtoHate != 0 && TIDtoHate == other->TIDtoHate) return false; // [RH] Don't target "teammates" diff --git a/src/p_map.cpp b/src/p_map.cpp index 4a94ca73f2..17838c999b 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -938,6 +938,7 @@ bool PIT_CheckThing (AActor *thing) // [Graf Zahl] Why do I have the feeling that this didn't really work anymore now // that ZDoom supports friendly monsters? + if (tmthing->target != NULL) { @@ -950,7 +951,12 @@ bool PIT_CheckThing (AActor *thing) // to harm / be harmed by anything. if (!thing->player && !tmthing->target->player) { - if (infighting < 0) + int infight; + if (level.flags & LEVEL_TOTALINFIGHTING) infight=1; + else if (level.flags & LEVEL_NOINFIGHTING) infight=-1; + else infight = infighting; + + if (infight < 0) { // -1: Monsters cannot hurt each other, but make exceptions for // friendliness and hate status. @@ -973,7 +979,7 @@ bool PIT_CheckThing (AActor *thing) } } } - else if (infighting == 0) + else if (infight == 0) { // 0: Monsters cannot hurt same species except // cases where they are clearly supposed to do that @@ -1001,7 +1007,7 @@ bool PIT_CheckThing (AActor *thing) } } } - // else if (infighting==1) any shot hurts anything - no further tests + // else if (infight==1) any shot hurts anything - no further tests } } if (!(thing->flags & MF_SHOOTABLE)) diff --git a/wadsrc/mapinfo/strife.txt b/wadsrc/mapinfo/strife.txt index 9fede0d2e6..ce02ac6b96 100644 --- a/wadsrc/mapinfo/strife.txt +++ b/wadsrc/mapinfo/strife.txt @@ -5,6 +5,7 @@ forcenoskystretch strifefallingdamage nointermission clipmidtextures +noinfighting map MAP01 "AREA 1: sanctuary" next MAP02