From be6ce43045daf69f0d3d5ac38d5b5d7837059454 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Wed, 13 Feb 2019 13:05:31 +0200 Subject: [PATCH 1/4] - added ability to customize font of automap marks Set am_markfont CVAR to a desired font name Use am_markcolor to select a text color, has no effect with the default font, AMMNUMx --- src/am_map.cpp | 29 ++++++++++++++++++++++++++--- wadsrc/static/language.enu | 5 +++++ wadsrc/static/menudef.txt | 11 +++++++++++ 3 files changed, 42 insertions(+), 3 deletions(-) diff --git a/src/am_map.cpp b/src/am_map.cpp index a317c1190..c3d04320f 100644 --- a/src/am_map.cpp +++ b/src/am_map.cpp @@ -189,6 +189,10 @@ CVAR(Bool, am_portaloverlay, true, CVAR_ARCHIVE) CVAR(Bool, am_showgrid, false, CVAR_ARCHIVE) CVAR(Float, am_zoomdir, 0, CVAR_ARCHIVE) +static const char *const DEFAULT_FONT_NAME = "AMMNUMx"; +CVAR(String, am_markfont, DEFAULT_FONT_NAME, CVAR_ARCHIVE) +CVAR(Int, am_markcolor, CR_GREY, CVAR_ARCHIVE) + CCMD(am_togglefollow) { am_followplayer = !am_followplayer; @@ -1128,7 +1132,9 @@ void DAutomap::restoreScaleAndLoc () int DAutomap::addMark () { - if (marknums[0].isValid()) + // Add a mark when default font is selected and its textures (AMMNUM?) + // are loaded. Mark is always added when custom font is selected + if (stricmp(*am_markfont, DEFAULT_FONT_NAME) != 0 || marknums[0].isValid()) { auto m = markpointnum; markpoints[markpointnum].x = m_x + m_w/2; @@ -3032,12 +3038,29 @@ void DAutomap::DrawMarker (FTexture *tex, double x, double y, int yadjust, void DAutomap::drawMarks () { + FFont* font; + bool fontloaded = false; + for (int i = 0; i < AM_NUMMARKPOINTS; i++) { if (markpoints[i].x != -1) { - DrawMarker (TexMan.GetTexture(marknums[i], true), markpoints[i].x, markpoints[i].y, -3, 0, - 1, 1, 0, 1, 0, LegacyRenderStyles[STYLE_Normal]); + if (!fontloaded) + { + font = stricmp(*am_markfont, DEFAULT_FONT_NAME) == 0 ? nullptr : V_GetFont(am_markfont); + fontloaded = true; + } + + if (font == nullptr) + { + DrawMarker(TexMan.GetTexture(marknums[i], true), markpoints[i].x, markpoints[i].y, -3, 0, + 1, 1, 0, 1, 0, LegacyRenderStyles[STYLE_Normal]); + } + else + { + char numstr[2] = { char('0' + i), 0 }; + screen->DrawText(font, am_markcolor, CXMTOF(markpoints[i].x), CYMTOF(markpoints[i].y), numstr, TAG_DONE); + } } } } diff --git a/wadsrc/static/language.enu b/wadsrc/static/language.enu index e49759b6a..14f7aa74b 100644 --- a/wadsrc/static/language.enu +++ b/wadsrc/static/language.enu @@ -2003,6 +2003,8 @@ AUTOMAPMNU_SHOWTRIGGERLINES = "Show trigger lines"; AUTOMAPMNU_SHOWTHINGSPRITES = "Show things as sprites"; AUTOMAPMNU_PTOVERLAY = "Overlay portals"; AUTOMAPMNU_EMPTYSPACEMARGIN = "Empty space margin"; +AUTOMAPMNU_MARKFONT = "Mark font"; +AUTOMAPMNU_MARKCOLOR = "Mark color"; // Automap Controls MAPCNTRLMNU_TITLE = "CUSTOMIZE MAP CONTROLS"; @@ -2503,6 +2505,9 @@ OPTVAL_VTAVANILLA = "Auto (Vanilla Preferred)"; OPTVAL_SCALENEAREST = "Scaled (Nearest)"; OPTVAL_SCALELINEAR = "Scaled (Linear)"; OPTVAL_LETTERBOX = "Letterbox"; +OPTVAL_SMALL = "Small"; +OPTVAL_LARGE = "Large"; +OPTVAL_CONSOLE = "Console"; // Colors C_BRICK = "\cabrick"; diff --git a/wadsrc/static/menudef.txt b/wadsrc/static/menudef.txt index 2a6fe6a65..d90160f92 100644 --- a/wadsrc/static/menudef.txt +++ b/wadsrc/static/menudef.txt @@ -1077,6 +1077,14 @@ OptionValue MapTriggers 2, "$OPTVAL_ON" } +OptionString MapMarkFont +{ + "AMMNUMx", "$OPTVAL_DEFAULT" + "SmallFont", "$OPTVAL_SMALL" + "BigFont", "$OPTVAL_LARGE" + "ConsoleFont", "$OPTVAL_CONSOLE" +} + OptionMenu AutomapOptions protected { Title "$AUTOMAPMNU_TITLE" @@ -1103,6 +1111,9 @@ OptionMenu AutomapOptions protected Option "$AUTOMAPMNU_SHOWKEYS", "am_showkeys", "OnOff" Option "$AUTOMAPMNU_SHOWTRIGGERLINES", "am_showtriggerlines", "MapTriggers" Option "$AUTOMAPMNU_SHOWTHINGSPRITES", "am_showthingsprites", "STSTypes" + StaticText " " + Option "$AUTOMAPMNU_MARKFONT", "am_markfont", "MapMarkFont" + Option "$AUTOMAPMNU_MARKCOLOR", "am_markcolor", "TextColors" } //------------------------------------------------------------------------------------------- From 0d2a24876b8b9ccfc1ab05396e75b52d8bab2e78 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Wed, 13 Feb 2019 21:34:44 -0500 Subject: [PATCH 2/4] - Remove "gitversion.h" from "version.h" - should result in faster compiles after a commit in Windows - Fix zdoom.rc to show the actual git commit tag and id for the Product Version - Made zdoom.rc "codepage 1252" compliant as dictated by the #pragma (if this needs changed the pragma should be updated, this was messing up the version strings in the final compile) --- src/version.h | 8 -------- src/win32/zdoom.rc | 12 ++++++------ 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/src/version.h b/src/version.h index 1336b47c6..6ce143b1f 100644 --- a/src/version.h +++ b/src/version.h @@ -34,10 +34,6 @@ #ifndef __VERSION_H__ #define __VERSION_H__ -#ifdef _WIN32 -#include "gitinfo.h" -#endif // _WIN32 - const char *GetGitDescription(); const char *GetGitHash(); const char *GetGitTime(); @@ -45,11 +41,7 @@ const char *GetVersionString(); /** Lots of different version numbers **/ -#ifdef GIT_DESCRIPTION -#define VERSIONSTR GIT_DESCRIPTION -#else #define VERSIONSTR "3.8pre" -#endif // The version as seen in the Windows resource #define RC_FILEVERSION 3,7,9999,0 diff --git a/src/win32/zdoom.rc b/src/win32/zdoom.rc index 325c1d064..74e019de8 100644 --- a/src/win32/zdoom.rc +++ b/src/win32/zdoom.rc @@ -75,11 +75,11 @@ BEGIN " VALUE ""FileDescription"", ""GZDoom""\r\n" " VALUE ""FileVersion"", RC_FILEVERSION2\r\n" " VALUE ""InternalName"", ""GZDoom""\r\n" - " VALUE ""LegalCopyright"", ""Copyright © 1993-1996 id Software, 1998-2010 Randy Heit, 2002-2010 Christoph Oelckers, et al.""\r\n" + " VALUE ""LegalCopyright"", ""Copyright © 1993-1996 id Software, 1998-2010 Randy Heit, 2002-2010 Christoph Oelckers, et al.""\r\n" " VALUE ""LegalTrademarks"", ""DoomR is a Registered Trademark of id Software, Inc.""\r\n" " VALUE ""OriginalFilename"", ""gzdoom.exe""\r\n" " VALUE ""ProductName"", ""GZDoom""\r\n" - " VALUE ""ProductVersion"", RC_PRODUCTVERSION2\r\n" + " VALUE ""ProductVersion"", GIT_VERSION\r\n" " END\r\n" " END\r\n" " BLOCK ""VarFileInfo""\r\n" @@ -523,14 +523,14 @@ BEGIN BEGIN VALUE "Comments", "Thanks to id Software for creating DOOM and then releasing the source code. Thanks also to TeamTNT for creating BOOM, which ZDoom is partially based on. Includes code based on the Cajun Bot 0.97 by Martin Collberg." VALUE "CompanyName", " " - VALUE "FileDescription", "GZDoom" + VALUE "FileDescription", "GZDoom " GIT_DESCRIPTION VALUE "FileVersion", RC_FILEVERSION2 VALUE "InternalName", "GZDoom" - VALUE "LegalCopyright", "Copyright © 1993-1996 id Software, 1998-2010 Randy Heit, 2002-2010 Christoph Oelckers, et al." - VALUE "LegalTrademarks", "DoomR is a Registered Trademark of id Software, Inc." + VALUE "LegalCopyright", "Copyright © 1993-1996 id Software, 1998-2010 Randy Heit, 2002-2010 Christoph Oelckers, et al." + VALUE "LegalTrademarks", "Doom® is a Registered Trademark of id Software, Inc." VALUE "OriginalFilename", "gzdoom.exe" VALUE "ProductName", "GZDoom" - VALUE "ProductVersion", RC_PRODUCTVERSION2 + VALUE "ProductVersion", GIT_DESCRIPTION END END BLOCK "VarFileInfo" From 769be00483c3e544eac2cd6885aeb44cb4a62047 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Fri, 15 Feb 2019 17:21:59 +0200 Subject: [PATCH 3/4] - fixed automap marks placement with custom fonts Automap rotation wasn't taken into account when drawing marks https://forum.zdoom.org/viewtopic.php?t=63693 --- src/am_map.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/am_map.cpp b/src/am_map.cpp index c3d04320f..e7708ae23 100644 --- a/src/am_map.cpp +++ b/src/am_map.cpp @@ -3059,7 +3059,15 @@ void DAutomap::drawMarks () else { char numstr[2] = { char('0' + i), 0 }; - screen->DrawText(font, am_markcolor, CXMTOF(markpoints[i].x), CYMTOF(markpoints[i].y), numstr, TAG_DONE); + double x = markpoints[i].x; + double y = markpoints[i].y; + + if (am_rotate == 1 || (am_rotate == 2 && viewactive)) + { + rotatePoint (&x, &y); + } + + screen->DrawText(font, am_markcolor, CXMTOF(x), CYMTOF(y), numstr, TAG_DONE); } } } From 823eb90af840ecc9b7db078c5704f5e38feb10ef Mon Sep 17 00:00:00 2001 From: Major Cooke Date: Fri, 15 Feb 2019 10:02:59 -0600 Subject: [PATCH 4/4] - Fixed monsters waking up even if all the damage was absorbed without pain causing flags - Fixed FORCEPAIN not overriding PainThreshold property --- src/p_interaction.cpp | 41 +++++++++++++++++------------------------ 1 file changed, 17 insertions(+), 24 deletions(-) diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index 1bb74c620..75e18fa37 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -810,6 +810,7 @@ static void ReactToDamage(AActor *target, AActor *inflictor, AActor *source, int bool fakedPain = false; bool forcedPain = false; bool noPain = false; + bool wakeup = false; // Dead or non-existent entity, do not react. Especially if the damage is cancelled. if (target == nullptr || target->health < 1 || damage < 0) @@ -822,23 +823,9 @@ static void ReactToDamage(AActor *target, AActor *inflictor, AActor *source, int ((player->cheats & CF_GODMODE) && damage < TELEFRAG_DAMAGE)) return; } - - noPain = (flags & DMG_NO_PAIN) || (target->flags5 & MF5_NOPAIN) || (inflictor && (inflictor->flags5 & MF5_PAINLESS)); - - // Are we attempting to cause pain? - if (!noPain) - { - fakedPain = (isFakePain(target, inflictor, originaldamage)); - forcedPain = (MustForcePain(target, inflictor)); - } - - // [MC] No forced or faked pain so skip it. - // However the rest of the function must carry on. - if (!noPain && damage < 1 && !fakedPain && !forcedPain) - noPain = true; - + woundstate = target->FindState(NAME_Wound, mod); - if (woundstate != NULL) + if (woundstate != nullptr) { int woundhealth = target->WoundHealth; @@ -848,10 +835,16 @@ static void ReactToDamage(AActor *target, AActor *inflictor, AActor *source, int return; } } + // [MC] NOPAIN will not stop the actor from waking up if damaged. + // ALLOW/CAUSEPAIN will enable infighting, even if painless. + noPain = (flags & DMG_NO_PAIN) || (target->flags5 & MF5_NOPAIN) || (inflictor && (inflictor->flags5 & MF5_PAINLESS)); + fakedPain = (isFakePain(target, inflictor, originaldamage)); + forcedPain = (MustForcePain(target, inflictor)); + wakeup = (damage > 0 || fakedPain || forcedPain); - if (!noPain && + if (!noPain && wakeup && ((target->player != nullptr || !G_SkillProperty(SKILLP_NoPain)) && !(target->flags & MF_SKULLFLY)) - && damage >= target->PainThreshold) + && (forcedPain || damage >= target->PainThreshold)) { if (inflictor && inflictor->PainType != NAME_None) mod = inflictor->PainType; @@ -860,13 +853,13 @@ static void ReactToDamage(AActor *target, AActor *inflictor, AActor *source, int justhit = TriggerPainChance(target, mod, forcedPain, false); } - if (target->player == nullptr) target->reactiontime = 0; // we're awake now... - if (source) + if (wakeup && target->player == nullptr) target->reactiontime = 0; // we're awake now... + if (wakeup && source) { if (source == target->target) { target->threshold = target->DefThreshold; - if (target->state == target->SpawnState && target->SeeState != NULL) + if (target->state == target->SpawnState && target->SeeState != nullptr) { target->SetState(target->SeeState); } @@ -879,15 +872,15 @@ static void ReactToDamage(AActor *target, AActor *inflictor, AActor *source, int // killough 2/15/98: remember last enemy, to prevent // sleeping early; 2/21/98: Place priority on players - if (target->lastenemy == NULL || - (target->lastenemy->player == NULL && target->TIDtoHate == 0) || + if (target->lastenemy == nullptr || + (target->lastenemy->player == nullptr && target->TIDtoHate == 0) || target->lastenemy->health <= 0) { target->lastenemy = target->target; // remember last enemy - killough } target->target = source; target->threshold = target->DefThreshold; - if (target->state == target->SpawnState && target->SeeState != NULL) + if (target->state == target->SpawnState && target->SeeState != nullptr) { target->SetState(target->SeeState); }