From 211d2930029d71921d1c6c0cc65f909908591aac Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 10 Aug 2013 08:53:37 +0200 Subject: [PATCH 1/3] - added MF6_NOTONAUTOMAP flag to exclude things from being shown with the scanner powerup. The IDDT cheat will not be affected by this. --- src/actor.h | 1 + src/am_map.cpp | 176 +++++++++++++++++---------------- src/thingdef/thingdef_data.cpp | 1 + 3 files changed, 91 insertions(+), 87 deletions(-) diff --git a/src/actor.h b/src/actor.h index 15a135b99c..7680081821 100644 --- a/src/actor.h +++ b/src/actor.h @@ -331,6 +331,7 @@ enum MF6_DOHARMSPECIES = 0x08000000, // Do hurt one's own species with projectiles. MF6_INTRYMOVE = 0x10000000, // Executing P_TryMove MF6_NOTAUTOAIMED = 0x20000000, // Do not subject actor to player autoaim. + MF6_NOTONAUTOMAP = 0x40000000, // will not be shown on automap with the 'scanner' powerup. // --- mobj.renderflags --- diff --git a/src/am_map.cpp b/src/am_map.cpp index 8a4d1cc366..610ba48253 100644 --- a/src/am_map.cpp +++ b/src/am_map.cpp @@ -2356,114 +2356,116 @@ void AM_drawThings () t = sectors[i].thinglist; while (t) { - p.x = t->x >> FRACTOMAPBITS; - p.y = t->y >> FRACTOMAPBITS; - - if (am_showthingsprites > 0 && t->sprite > 0) + if (am_cheat > 0 || !(t->flags6 & MF6_NOTONAUTOMAP)) { - FTexture *texture = NULL; - spriteframe_t *frame; - angle_t rotation = 0; + p.x = t->x >> FRACTOMAPBITS; + p.y = t->y >> FRACTOMAPBITS; - // try all modes backwards until a valid texture has been found. - for(int show = am_showthingsprites; show > 0 && texture == NULL; show--) + if (am_showthingsprites > 0 && t->sprite > 0) { - const spritedef_t& sprite = sprites[t->sprite]; - const size_t spriteIndex = sprite.spriteframes + (show > 1 ? t->frame : 0); + FTexture *texture = NULL; + spriteframe_t *frame; + angle_t rotation = 0; + + // try all modes backwards until a valid texture has been found. + for(int show = am_showthingsprites; show > 0 && texture == NULL; show--) + { + const spritedef_t& sprite = sprites[t->sprite]; + const size_t spriteIndex = sprite.spriteframes + (show > 1 ? t->frame : 0); + + frame = &SpriteFrames[spriteIndex]; + angle_t angle = ANGLE_270 - t->angle; + if (frame->Texture[0] != frame->Texture[1]) angle += (ANGLE_180 / 16); + if (am_rotate == 1 || (am_rotate == 2 && viewactive)) + { + angle += players[consoleplayer].camera->angle - ANGLE_90; + } + rotation = angle >> 28; + + const FTextureID textureID = frame->Texture[show > 2 ? rotation : 0]; + texture = TexMan(textureID); + } + + if (texture == NULL) goto drawTriangle; // fall back to standard display if no sprite can be found. + + const fixed_t spriteScale = 10 * scale_mtof; + + DrawMarker (texture, p.x, p.y, 0, !!(frame->Flip & (1 << rotation)), + spriteScale, spriteScale, 0, FRACUNIT, 0, LegacyRenderStyles[STYLE_Normal]); + } + else + { + drawTriangle: + angle = t->angle; - frame = &SpriteFrames[spriteIndex]; - angle_t angle = ANGLE_270 - t->angle; - if (frame->Texture[0] != frame->Texture[1]) angle += (ANGLE_180 / 16); if (am_rotate == 1 || (am_rotate == 2 && viewactive)) { - angle += players[consoleplayer].camera->angle - ANGLE_90; + AM_rotatePoint (&p.x, &p.y); + angle += ANG90 - players[consoleplayer].camera->angle; } - rotation = angle >> 28; - const FTextureID textureID = frame->Texture[show > 2 ? rotation : 0]; - texture = TexMan(textureID); - } + color = ThingColor; - if (texture == NULL) goto drawTriangle; // fall back to standard display if no sprite can be found. - - const fixed_t spriteScale = 10 * scale_mtof; - - DrawMarker (texture, p.x, p.y, 0, !!(frame->Flip & (1 << rotation)), - spriteScale, spriteScale, 0, FRACUNIT, 0, LegacyRenderStyles[STYLE_Normal]); - } - else - { - drawTriangle: - angle = t->angle; - - if (am_rotate == 1 || (am_rotate == 2 && viewactive)) - { - AM_rotatePoint (&p.x, &p.y); - angle += ANG90 - players[consoleplayer].camera->angle; - } - - color = ThingColor; - - // use separate colors for special thing types - if (t->flags3&MF3_ISMONSTER && !(t->flags&MF_CORPSE)) - { - if (t->flags & MF_FRIENDLY || !(t->flags & MF_COUNTKILL)) color = ThingColor_Friend; - else color = ThingColor_Monster; - } - else if (t->flags&MF_SPECIAL) - { - // Find the key's own color. - // Only works correctly if single-key locks have lower numbers than any-key locks. - // That is the case for all default keys, however. - if (t->IsKindOf(RUNTIME_CLASS(AKey))) + // use separate colors for special thing types + if (t->flags3&MF3_ISMONSTER && !(t->flags&MF_CORPSE)) { - if (G_SkillProperty(SKILLP_EasyKey)) + if (t->flags & MF_FRIENDLY || !(t->flags & MF_COUNTKILL)) color = ThingColor_Friend; + else color = ThingColor_Monster; + } + else if (t->flags&MF_SPECIAL) + { + // Find the key's own color. + // Only works correctly if single-key locks have lower numbers than any-key locks. + // That is the case for all default keys, however. + if (t->IsKindOf(RUNTIME_CLASS(AKey))) { - // Already drawn by AM_drawKeys(), so don't draw again - color.Index = -1; - } - else if (am_showkeys) - { - int P_GetMapColorForKey (AInventory * key); - int c = P_GetMapColorForKey(static_cast(t)); + if (G_SkillProperty(SKILLP_EasyKey)) + { + // Already drawn by AM_drawKeys(), so don't draw again + color.Index = -1; + } + else if (am_showkeys) + { + int P_GetMapColorForKey (AInventory * key); + int c = P_GetMapColorForKey(static_cast(t)); - if (c >= 0) color.FromRGB(RPART(c), GPART(c), BPART(c)); - else color = ThingColor_CountItem; - AM_drawLineCharacter(&CheatKey[0], CheatKey.Size(), 0, 0, color, p.x, p.y); - color.Index = -1; + if (c >= 0) color.FromRGB(RPART(c), GPART(c), BPART(c)); + else color = ThingColor_CountItem; + AM_drawLineCharacter(&CheatKey[0], CheatKey.Size(), 0, 0, color, p.x, p.y); + color.Index = -1; + } + else + { + color = ThingColor_Item; + } } + else if (t->flags&MF_COUNTITEM) + color = ThingColor_CountItem; else - { color = ThingColor_Item; - } } - else if (t->flags&MF_COUNTITEM) - color = ThingColor_CountItem; - else - color = ThingColor_Item; - } - if (color.Index != -1) - { - AM_drawLineCharacter - (thintriangle_guy, NUMTHINTRIANGLEGUYLINES, - 16<= 3) - { - static const mline_t box[4] = + if (color.Index != -1) { - { { -MAPUNIT, -MAPUNIT }, { MAPUNIT, -MAPUNIT } }, - { { MAPUNIT, -MAPUNIT }, { MAPUNIT, MAPUNIT } }, - { { MAPUNIT, MAPUNIT }, { -MAPUNIT, MAPUNIT } }, - { { -MAPUNIT, MAPUNIT }, { -MAPUNIT, -MAPUNIT } }, - }; + AM_drawLineCharacter + (thintriangle_guy, NUMTHINTRIANGLEGUYLINES, + 16<radius >> FRACTOMAPBITS, angle - t->angle, color, p.x, p.y); + if (am_cheat >= 3) + { + static const mline_t box[4] = + { + { { -MAPUNIT, -MAPUNIT }, { MAPUNIT, -MAPUNIT } }, + { { MAPUNIT, -MAPUNIT }, { MAPUNIT, MAPUNIT } }, + { { MAPUNIT, MAPUNIT }, { -MAPUNIT, MAPUNIT } }, + { { -MAPUNIT, MAPUNIT }, { -MAPUNIT, -MAPUNIT } }, + }; + + AM_drawLineCharacter (box, 4, t->radius >> FRACTOMAPBITS, angle - t->angle, color, p.x, p.y); + } } } - t = t->snext; } } diff --git a/src/thingdef/thingdef_data.cpp b/src/thingdef/thingdef_data.cpp index 455f700df0..ef0cf2fe18 100644 --- a/src/thingdef/thingdef_data.cpp +++ b/src/thingdef/thingdef_data.cpp @@ -234,6 +234,7 @@ static FFlagDef ActorFlags[]= DEFINE_FLAG(MF6, DOHARMSPECIES, AActor, flags6), DEFINE_FLAG(MF6, POISONALWAYS, AActor, flags6), DEFINE_FLAG(MF6, NOTAUTOAIMED, AActor, flags6), + DEFINE_FLAG(MF6, NOTONAUTOMAP, AActor, flags6), // Effect flags DEFINE_FLAG(FX, VISIBILITYPULSE, AActor, effects), From 25ec3fb8feeff395576808268254ef46f03de333 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 10 Aug 2013 09:32:55 +0200 Subject: [PATCH 2/3] - added MF6_RELATIVETOFLOOR flag. --- src/actor.h | 1 + src/p_map.cpp | 44 ++++++++++++++++++++++++---------- src/thingdef/thingdef_data.cpp | 1 + 3 files changed, 33 insertions(+), 13 deletions(-) diff --git a/src/actor.h b/src/actor.h index 7680081821..bf1b1cc60b 100644 --- a/src/actor.h +++ b/src/actor.h @@ -332,6 +332,7 @@ enum MF6_INTRYMOVE = 0x10000000, // Executing P_TryMove MF6_NOTAUTOAIMED = 0x20000000, // Do not subject actor to player autoaim. MF6_NOTONAUTOMAP = 0x40000000, // will not be shown on automap with the 'scanner' powerup. + MF6_RELATIVETOFLOOR = 0x80000000, // [RC] Make flying actors be affected by lifts. // --- mobj.renderflags --- diff --git a/src/p_map.cpp b/src/p_map.cpp index da87481d00..ee7c63263e 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -5047,6 +5047,15 @@ void PIT_FloorDrop (AActor *thing, FChangePosition *cpos) P_CheckFakeFloorTriggers (thing, oldz); } } + else if ((thing->z != oldfloorz && !(thing->flags & MF_NOLIFTDROP))) + { + fixed_t oldz = thing->z; + if ((thing->flags & MF_NOGRAVITY) && (thing->flags6 & MF6_RELATIVETOFLOOR)) + { + thing->z = thing->z - oldfloorz + thing->floorz; + P_CheckFakeFloorTriggers (thing, oldz); + } + } } //============================================================================= @@ -5058,6 +5067,7 @@ void PIT_FloorDrop (AActor *thing, FChangePosition *cpos) void PIT_FloorRaise (AActor *thing, FChangePosition *cpos) { fixed_t oldfloorz = thing->floorz; + fixed_t oldz = thing->z; P_AdjustFloorCeil (thing, cpos); @@ -5072,22 +5082,30 @@ void PIT_FloorRaise (AActor *thing, FChangePosition *cpos) return; // do not move bridge things } intersectors.Clear (); - fixed_t oldz = thing->z; thing->z = thing->floorz; - switch (P_PushUp (thing, cpos)) + } + else + { + if((thing->flags & MF_NOGRAVITY) && (thing->flags6 & MF6_RELATIVETOFLOOR)) { - default: - P_CheckFakeFloorTriggers (thing, oldz); - break; - case 1: - P_DoCrunch (thing, cpos); - P_CheckFakeFloorTriggers (thing, oldz); - break; - case 2: - P_DoCrunch (thing, cpos); - thing->z = oldz; - break; + intersectors.Clear (); + thing->z = thing->z - oldfloorz + thing->floorz; } + else return; + } + switch (P_PushUp (thing, cpos)) + { + default: + P_CheckFakeFloorTriggers (thing, oldz); + break; + case 1: + P_DoCrunch (thing, cpos); + P_CheckFakeFloorTriggers (thing, oldz); + break; + case 2: + P_DoCrunch (thing, cpos); + thing->z = oldz; + break; } } diff --git a/src/thingdef/thingdef_data.cpp b/src/thingdef/thingdef_data.cpp index ef0cf2fe18..c01855eecf 100644 --- a/src/thingdef/thingdef_data.cpp +++ b/src/thingdef/thingdef_data.cpp @@ -235,6 +235,7 @@ static FFlagDef ActorFlags[]= DEFINE_FLAG(MF6, POISONALWAYS, AActor, flags6), DEFINE_FLAG(MF6, NOTAUTOAIMED, AActor, flags6), DEFINE_FLAG(MF6, NOTONAUTOMAP, AActor, flags6), + DEFINE_FLAG(MF6, RELATIVETOFLOOR, AActor, flags6), // Effect flags DEFINE_FLAG(FX, VISIBILITYPULSE, AActor, effects), From 1c889dc9fa6cca04b7c4c491590bebaf5b77c971 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 10 Aug 2013 09:51:48 +0200 Subject: [PATCH 3/3] - let APowerRegeneration use the Strength property to define the amount of regeneration it gives. --- src/g_shared/a_artifacts.cpp | 2 +- wadsrc/static/actors/shared/inventory.txt | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/g_shared/a_artifacts.cpp b/src/g_shared/a_artifacts.cpp index 0de822f626..e05f6071a5 100644 --- a/src/g_shared/a_artifacts.cpp +++ b/src/g_shared/a_artifacts.cpp @@ -1697,7 +1697,7 @@ void APowerRegeneration::DoEffect() { if (Owner != NULL && Owner->health > 0 && (level.time & 31) == 0) { - if (P_GiveBody(Owner, 5)) + if (P_GiveBody(Owner, Strength)) { S_Sound(Owner, CHAN_ITEM, "*regenerate", 1, ATTN_NORM ); } diff --git a/wadsrc/static/actors/shared/inventory.txt b/wadsrc/static/actors/shared/inventory.txt index 5f5e20b502..ed113c4dfb 100644 --- a/wadsrc/static/actors/shared/inventory.txt +++ b/wadsrc/static/actors/shared/inventory.txt @@ -300,6 +300,7 @@ ACTOR PowerDrain : Powerup native ACTOR PowerRegeneration : Powerup native { Powerup.Duration -120 + Powerup.Strength 5 } ACTOR PowerHighJump : Powerup native {}