From cbc0b70e7ccd5afa6e3417d3034fa3cb54308d3c Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 24 Jul 2013 20:15:17 +0200 Subject: [PATCH 1/7] - TransferStencilColor A_SpawnItemEx patch / by Ryan Cordell. --- src/thingdef/thingdef_codeptr.cpp | 5 +++++ wadsrc/static/actors/constants.txt | 1 + 2 files changed, 6 insertions(+) diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 7b571b0c52..476c29eafe 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -1747,6 +1747,7 @@ enum SIX_Flags SIXF_TRANSFERSCALE = 1 << 14, SIXF_TRANSFERSPECIAL = 1 << 15, SIXF_CLEARCALLERSPECIAL = 1 << 16, + SIXF_TRANSFERSTENCILCOL = 1 << 17, }; static bool InitSpawnedItem(AActor *self, AActor *mo, int flags) @@ -1859,6 +1860,10 @@ static bool InitSpawnedItem(AActor *self, AActor *mo, int flags) self->special = 0; memset(self->args, 0, sizeof(self->args)); } + if (flags & SIXF_TRANSFERSTENCILCOL) + { + mo->fillcolor = self->fillcolor; + } return true; } diff --git a/wadsrc/static/actors/constants.txt b/wadsrc/static/actors/constants.txt index 24736eb3dd..18f991e435 100644 --- a/wadsrc/static/actors/constants.txt +++ b/wadsrc/static/actors/constants.txt @@ -59,6 +59,7 @@ const int SXF_MULTIPLYSPEED = 8192; const int SXF_TRANSFERSCALE = 16384; const int SXF_TRANSFERSPECIAL = 32768; const int SXF_CLEARCALLERSPECIAL = 65536; +const int SXF_TRANSFERSTENCILCOL = 131072; // Flags for A_Chase const int CHF_FASTCHASE = 1; From 6dd956c0dce32b9d7cab94048fbe498c113d08c3 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 25 Jul 2013 15:58:47 +0200 Subject: [PATCH 2/7] - fixed: Speaker names in dialogues were not able to use the string table. --- src/p_conversation.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/p_conversation.cpp b/src/p_conversation.cpp index 380b72de4e..d567f98666 100644 --- a/src/p_conversation.cpp +++ b/src/p_conversation.cpp @@ -958,6 +958,7 @@ public: if (CurNode->SpeakerName != NULL) { speakerName = CurNode->SpeakerName; + if (speakerName[0] == '$') speakerName = GStrings(speakerName+1); } else { From 76e1e8745607a6a8c819067863a5f39482bcb3b0 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Thu, 25 Jul 2013 17:01:07 +0300 Subject: [PATCH 3/7] + things as sprites on map, controlled with am_showthingsprites CVAR drawing of sprites instead of things/players markers with am_cheat >= 2 possible am_showthingsprites values are: 0 - sprites disabled 1 - static front sprites 2 - animated front sprites 3 - animated sprites with actual things angles --- src/am_map.cpp | 147 ++++++++++++++++++++++++++++++------------------- 1 file changed, 90 insertions(+), 57 deletions(-) diff --git a/src/am_map.cpp b/src/am_map.cpp index aa66341270..2d281a95f3 100644 --- a/src/am_map.cpp +++ b/src/am_map.cpp @@ -204,6 +204,7 @@ CVAR (Color, am_ovthingcolor_friend, 0xe88800, CVAR_ARCHIVE); CVAR (Color, am_ovthingcolor_monster, 0xe88800, CVAR_ARCHIVE); CVAR (Color, am_ovthingcolor_item, 0xe88800, CVAR_ARCHIVE); CVAR (Color, am_ovthingcolor_citem, 0xe88800, CVAR_ARCHIVE); +CVAR (Int, am_showthingsprites, 0, CVAR_ARCHIVE); static int bigstate = 0; @@ -412,6 +413,9 @@ static bool stopped = true; static void AM_calcMinMaxMtoF(); +static void DrawMarker (FTexture *tex, fixed_t x, fixed_t y, int yadjust, + INTBOOL flip, fixed_t xscale, fixed_t yscale, int translation, fixed_t alpha, DWORD fillcolor, FRenderStyle renderstyle); + void AM_rotatePoint (fixed_t *x, fixed_t *y); void AM_rotate (fixed_t *x, fixed_t *y, angle_t an); void AM_doFollowPlayer (); @@ -2193,6 +2197,12 @@ AM_drawLineCharacter void AM_drawPlayers () { + if (am_cheat >= 2 && am_showthingsprites > 0) + { + // Player sprites are drawn with the others + return; + } + mpoint_t pt; angle_t angle; int i; @@ -2344,74 +2354,97 @@ void AM_drawThings () { p.x = t->x >> FRACTOMAPBITS; p.y = t->y >> FRACTOMAPBITS; - angle = t->angle; - if (am_rotate == 1 || (am_rotate == 2 && viewactive)) + if (am_showthingsprites > 0) { - AM_rotatePoint (&p.x, &p.y); - angle += ANG90 - players[consoleplayer].camera->angle; + const spritedef_t& sprite = sprites[t->sprite]; + const size_t spriteIndex = sprite.spriteframes + (am_showthingsprites > 1 ? t->frame : 0); + + const spriteframe_t& frame = SpriteFrames[spriteIndex]; + const angle_t rotation = (frame.Texture[0] == frame.Texture[1]) + ? (t->angle + (angle_t)(ANGLE_45 / 2) * 9) >> 28 + : (t->angle + (angle_t)(ANGLE_45 / 2) * 9 - (angle_t)(ANGLE_180 / 16)) >> 28; + + const FTextureID textureID = frame.Texture[am_showthingsprites > 2 ? rotation : 0]; + FTexture* texture = TexMan(textureID); + + const fixed_t spriteScale = 10 * scale_mtof; + + DrawMarker (texture, p.x, p.y, 0, 0, + spriteScale, spriteScale, 0, FRACUNIT, 0, LegacyRenderStyles[STYLE_Normal]); } - - color = ThingColor; - - // use separate colors for special thing types - if (t->flags3&MF3_ISMONSTER && !(t->flags&MF_CORPSE)) + else { - 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))) + angle = t->angle; + + if (am_rotate == 1 || (am_rotate == 2 && viewactive)) { - 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; - } - else - { - color = ThingColor_Item; - } + AM_rotatePoint (&p.x, &p.y); + angle += ANG90 - players[consoleplayer].camera->angle; } - 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] = + // use separate colors for special thing types + if (t->flags3&MF3_ISMONSTER && !(t->flags&MF_CORPSE)) { - { { -MAPUNIT, -MAPUNIT }, { MAPUNIT, -MAPUNIT } }, - { { MAPUNIT, -MAPUNIT }, { MAPUNIT, MAPUNIT } }, - { { MAPUNIT, MAPUNIT }, { -MAPUNIT, MAPUNIT } }, - { { -MAPUNIT, MAPUNIT }, { -MAPUNIT, -MAPUNIT } }, - }; + 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))) + { + 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)); - AM_drawLineCharacter (box, 4, t->radius >> FRACTOMAPBITS, angle - t->angle, color, p.x, p.y); + 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; + } + + if (color.Index != -1) + { + AM_drawLineCharacter + (thintriangle_guy, NUMTHINTRIANGLEGUYLINES, + 16<= 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; } } From 7006df8d968c8d47286326c3cdf36e2823fb8f62 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 25 Jul 2013 17:19:36 +0200 Subject: [PATCH 4/7] - fixed sprite rotation in automap submission --- src/am_map.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/am_map.cpp b/src/am_map.cpp index 2d281a95f3..220c472e44 100644 --- a/src/am_map.cpp +++ b/src/am_map.cpp @@ -2361,16 +2361,20 @@ void AM_drawThings () const size_t spriteIndex = sprite.spriteframes + (am_showthingsprites > 1 ? t->frame : 0); const spriteframe_t& frame = SpriteFrames[spriteIndex]; - const angle_t rotation = (frame.Texture[0] == frame.Texture[1]) - ? (t->angle + (angle_t)(ANGLE_45 / 2) * 9) >> 28 - : (t->angle + (angle_t)(ANGLE_45 / 2) * 9 - (angle_t)(ANGLE_180 / 16)) >> 28; + 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; + } + const angle_t rotation = angle >> 28; const FTextureID textureID = frame.Texture[am_showthingsprites > 2 ? rotation : 0]; FTexture* texture = TexMan(textureID); const fixed_t spriteScale = 10 * scale_mtof; - DrawMarker (texture, p.x, p.y, 0, 0, + DrawMarker (texture, p.x, p.y, 0, !!(frame.Flip & (1 << rotation)), spriteScale, spriteScale, 0, FRACUNIT, 0, LegacyRenderStyles[STYLE_Normal]); } else From 897a17309bf895b480fc58916d0c84c3deed2557 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 25 Jul 2013 17:22:45 +0200 Subject: [PATCH 5/7] - added menu option for sprite display on automap. --- wadsrc/static/menudef.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/wadsrc/static/menudef.txt b/wadsrc/static/menudef.txt index f50f21a690..21f19c1068 100644 --- a/wadsrc/static/menudef.txt +++ b/wadsrc/static/menudef.txt @@ -912,6 +912,14 @@ OptionValue MaplabelTypes 2, "Not for hubs" } +OptionValue STSTypes +{ + 0, "Off" + 1, "Front" + 2, "Animated" + 3, "Rotated" +} + OptionMenu AutomapOptions { Title "AUTOMAP OPTIONS" @@ -934,6 +942,7 @@ OptionMenu AutomapOptions Option "Draw map background", "am_drawmapback", "OnOff" Option "Show keys (cheat)", "am_showkeys", "OnOff" Option "Show trigger lines", "am_showtriggerlines", "OnOff" + Option "Show things as sprites", "am_showthingsprites", "STSTypes" } //------------------------------------------------------------------------------------------- From 992ba0bbf48bc797ed891c128ddbcc3d46cdc38a Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 26 Jul 2013 00:52:12 +0200 Subject: [PATCH 6/7] - added handling of MF3_FOILINVUL for A_BFGSpray. This function needs special treatment because the shooting player is considered the inflictor of the spray damage. --- src/g_doom/a_doomweaps.cpp | 3 ++- src/p_interaction.cpp | 2 +- src/p_local.h | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/g_doom/a_doomweaps.cpp b/src/g_doom/a_doomweaps.cpp index 5c5bb7eba1..9dd0557118 100644 --- a/src/g_doom/a_doomweaps.cpp +++ b/src/g_doom/a_doomweaps.cpp @@ -589,7 +589,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BFGSpray) damage += (pr_bfgspray() & 7) + 1; thingToHit = linetarget; - int newdam = P_DamageMobj (thingToHit, self->target, self->target, damage, spray != NULL? FName(spray->DamageType) : FName(NAME_BFGSplash)); + int newdam = P_DamageMobj (thingToHit, self->target, self->target, damage, spray != NULL? FName(spray->DamageType) : FName(NAME_BFGSplash), + spray != NULL && (spray->flags3 & MF3_FOILINVUL)? DMG_FOILINVUL : 0); P_TraceBleed (newdam > 0 ? newdam : damage, thingToHit, self->target); } } diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index 43499d3533..919bd86545 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -965,7 +965,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, { // actor is invulnerable if (target->player == NULL) { - if (inflictor == NULL || !(inflictor->flags3 & MF3_FOILINVUL)) + if (inflictor == NULL || (!(inflictor->flags3 & MF3_FOILINVUL) && !(flags & DMG_FOILINVUL))) { return -1; } diff --git a/src/p_local.h b/src/p_local.h index a4da0a04b7..e7fb2cb7d5 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -554,6 +554,7 @@ enum EDmgFlags DMG_FORCED = 8, DMG_NO_FACTOR = 16, DMG_PLAYERATTACK = 32, + DMG_FOILINVUL = 64, }; From 775ecdeebb6dcce21e1511120cc51b260dbb4982 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 28 Jul 2013 10:14:46 +0200 Subject: [PATCH 7/7] - fall back to drawing triangles on automap when encountering actors with non-displayable sprites --- src/am_map.cpp | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/src/am_map.cpp b/src/am_map.cpp index 220c472e44..0c8293ebe5 100644 --- a/src/am_map.cpp +++ b/src/am_map.cpp @@ -2338,7 +2338,6 @@ void AM_drawKeys () // // //============================================================================= - void AM_drawThings () { AMColor color; @@ -2355,30 +2354,41 @@ void AM_drawThings () p.x = t->x >> FRACTOMAPBITS; p.y = t->y >> FRACTOMAPBITS; - if (am_showthingsprites > 0) + if (am_showthingsprites > 0 && t->sprite > 0) { - const spritedef_t& sprite = sprites[t->sprite]; - const size_t spriteIndex = sprite.spriteframes + (am_showthingsprites > 1 ? t->frame : 0); + FTexture *texture = NULL; + spriteframe_t *frame; + angle_t rotation = 0; - const spriteframe_t& 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)) + // try all modes backwards until a valid texture has been found. + for(int show = am_showthingsprites; show > 0 && texture == NULL; show--) { - angle += players[consoleplayer].camera->angle - ANGLE_90; - } - const angle_t rotation = angle >> 28; + const spritedef_t& sprite = sprites[t->sprite]; + const size_t spriteIndex = sprite.spriteframes + (show > 1 ? t->frame : 0); - const FTextureID textureID = frame.Texture[am_showthingsprites > 2 ? rotation : 0]; - FTexture* texture = TexMan(textureID); + 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)), + 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))