- Fixed: MAPINFO is parsed before the text colors are read, so the TextColor

option for skills wouldn't work.


SVN r587 (trunk)
This commit is contained in:
Randy Heit 2007-12-08 22:57:55 +00:00
parent 351ed8dcd1
commit 282e9f5f01
4 changed files with 59 additions and 45 deletions

View File

@ -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.

View File

@ -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<AllSkills.Size();i++)
for(int i = 0; i < AllSkills.Size(); i++)
{
if (AllSkills[i].name == skill.name)
if (AllSkills[i].Name == skill.Name)
{
AllSkills[i] = skill;
return;
@ -3235,4 +3228,43 @@ void G_VerifySkill()
gameskill = AllSkills.Size()-1;
else if (gameskill < 0)
gameskill = 0;
}
}
FSkillInfo &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;
}
int FSkillInfo::GetTextColor() const
{
if (TextColor.IsEmpty())
{
return CR_UNTRANSLATED;
}
const BYTE *cp = (const BYTE *)TextColor.GetChars();
int color = V_ParseFontColor(cp, 0, 0);
if (color == CR_UNDEFINED)
{
Printf("Undefined color '%s' in definition of skill %s\n", TextColor.GetChars(), Name.GetChars());
color = CR_UNTRANSLATED;
}
return color;
}

View File

@ -379,7 +379,7 @@ typedef TMap<FName, FString> 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<FSkillInfo> AllSkills;

View File

@ -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]);
}
}