From 282e9f5f018e2ad683044de4b9a293f2ca6acdc9 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sat, 8 Dec 2007 22:57:55 +0000 Subject: [PATCH] - Fixed: MAPINFO is parsed before the text colors are read, so the TextColor option for skills wouldn't work. SVN r587 (trunk) --- docs/rh-log.txt | 2 ++ src/g_level.cpp | 64 ++++++++++++++++++++++++++++++++++++------------- src/g_level.h | 30 ++++------------------- src/m_menu.cpp | 8 +++---- 4 files changed, 59 insertions(+), 45 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index c4e63ab68e..2edf84519f 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,6 @@ December 8, 2007 +- Fixed: MAPINFO is parsed before the text colors are read, so the TextColor + option for skills wouldn't work. - Changed the PowerTimeFreezer "blink" effect back to checking against EffectTics (now + 1), because I wasn't convinced of the correctness of using level.time. diff --git a/src/g_level.cpp b/src/g_level.cpp index c332a82201..afe3eb5a22 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -3065,11 +3065,11 @@ static void ParseSkill () skill.ACSReturn = AllSkills.Size(); skill.MenuNameIsLump = false; skill.MustConfirm = false; - skill.shortcut=0; - skill.textcolor = CR_UNTRANSLATED; + skill.Shortcut = 0; + skill.TextColor = ""; SC_MustGetString(); - skill.name = sc_String; + skill.Name = sc_String; while (SC_GetString ()) { @@ -3154,20 +3154,13 @@ static void ParseSkill () else if (SC_Compare("Key")) { SC_MustGetString(); - skill.shortcut = tolower(sc_String[0]); + skill.Shortcut = tolower(sc_String[0]); } else if (SC_Compare("TextColor")) { SC_MustGetString(); - FString c; - c.Format("[%s]", sc_String); - const BYTE * cp = (BYTE*)c.GetChars(); - skill.textcolor = V_ParseFontColor(cp, 0, 0); - if (skill.textcolor == CR_UNDEFINED) - { - Printf("Undefined color '%s' in definition of skill %s\n", sc_String, skill.name.GetChars()); - skill.textcolor = CR_UNTRANSLATED; - } + skill.TextColor = '['; + skill.TextColor << sc_String << ']'; } else { @@ -3175,9 +3168,9 @@ static void ParseSkill () break; } } - for(int i=0;i SkillMenuNames; struct FSkillInfo { - FName name; + FName Name; fixed_t AmmoFactor; fixed_t DamageFactor; bool FastMonsters; @@ -395,36 +395,16 @@ struct FSkillInfo bool MenuNameIsLump; bool MustConfirm; FString MustConfirmText; - char shortcut; - int textcolor; + char Shortcut; + FString TextColor; FSkillInfo() {} FSkillInfo(const FSkillInfo &other) { operator=(other); } - FSkillInfo &operator=(const FSkillInfo &other) - { - name = other.name; - AmmoFactor = other.AmmoFactor; - DamageFactor = other.DamageFactor; - FastMonsters = other.FastMonsters; - DisableCheats = other.DisableCheats; - AutoUseHealth = other.AutoUseHealth; - EasyBossBrain = other.EasyBossBrain; - RespawnCounter= other.RespawnCounter; - Aggressiveness= other.Aggressiveness; - SpawnFilter = other.SpawnFilter; - ACSReturn = other.ACSReturn; - MenuName = other.MenuName; - MenuNamesForPlayerClass = other.MenuNamesForPlayerClass; - MenuNameIsLump = other.MenuNameIsLump; - MustConfirm = other.MustConfirm; - MustConfirmText = other.MustConfirmText; - shortcut = other.shortcut; - textcolor = other.textcolor; - return *this; - } + FSkillInfo &operator=(const FSkillInfo &other); + int GetTextColor() const; }; extern TArray AllSkills; diff --git a/src/m_menu.cpp b/src/m_menu.cpp index 62e2359538..4083945179 100644 --- a/src/m_menu.cpp +++ b/src/m_menu.cpp @@ -432,9 +432,9 @@ void M_StartupSkillMenu(const char *playerclass) SkillSelectMenu[i].name = skill.MenuName; SkillSelectMenu[i].fulltext = !skill.MenuNameIsLump; - SkillSelectMenu[i].alphaKey = skill.MenuNameIsLump? skill.shortcut : tolower(SkillSelectMenu[i].name[0]); - SkillSelectMenu[i].textcolor = skill.textcolor; - SkillSelectMenu[i].alphaKey = skill.shortcut; + SkillSelectMenu[i].alphaKey = skill.MenuNameIsLump? skill.Shortcut : tolower(SkillSelectMenu[i].name[0]); + SkillSelectMenu[i].textcolor = skill.GetTextColor(); + SkillSelectMenu[i].alphaKey = skill.Shortcut; if (playerclass != NULL) { @@ -443,7 +443,7 @@ void M_StartupSkillMenu(const char *playerclass) { SkillSelectMenu[i].name = GStrings(*pmnm); SkillSelectMenu[i].fulltext = true; - if (skill.shortcut==0) + if (skill.Shortcut == 0) SkillSelectMenu[i].alphaKey = tolower(SkillSelectMenu[i].name[0]); } }