- 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 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 - Changed the PowerTimeFreezer "blink" effect back to checking against
EffectTics (now + 1), because I wasn't convinced of the correctness of EffectTics (now + 1), because I wasn't convinced of the correctness of
using level.time. using level.time.

View file

@ -3065,11 +3065,11 @@ static void ParseSkill ()
skill.ACSReturn = AllSkills.Size(); skill.ACSReturn = AllSkills.Size();
skill.MenuNameIsLump = false; skill.MenuNameIsLump = false;
skill.MustConfirm = false; skill.MustConfirm = false;
skill.shortcut=0; skill.Shortcut = 0;
skill.textcolor = CR_UNTRANSLATED; skill.TextColor = "";
SC_MustGetString(); SC_MustGetString();
skill.name = sc_String; skill.Name = sc_String;
while (SC_GetString ()) while (SC_GetString ())
{ {
@ -3154,20 +3154,13 @@ static void ParseSkill ()
else if (SC_Compare("Key")) else if (SC_Compare("Key"))
{ {
SC_MustGetString(); SC_MustGetString();
skill.shortcut = tolower(sc_String[0]); skill.Shortcut = tolower(sc_String[0]);
} }
else if (SC_Compare("TextColor")) else if (SC_Compare("TextColor"))
{ {
SC_MustGetString(); SC_MustGetString();
FString c; skill.TextColor = '[';
c.Format("[%s]", sc_String); skill.TextColor << 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;
}
} }
else else
{ {
@ -3175,9 +3168,9 @@ static void ParseSkill ()
break; 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; AllSkills[i] = skill;
return; return;
@ -3236,3 +3229,42 @@ void G_VerifySkill()
else if (gameskill < 0) else if (gameskill < 0)
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 struct FSkillInfo
{ {
FName name; FName Name;
fixed_t AmmoFactor; fixed_t AmmoFactor;
fixed_t DamageFactor; fixed_t DamageFactor;
bool FastMonsters; bool FastMonsters;
@ -395,36 +395,16 @@ struct FSkillInfo
bool MenuNameIsLump; bool MenuNameIsLump;
bool MustConfirm; bool MustConfirm;
FString MustConfirmText; FString MustConfirmText;
char shortcut; char Shortcut;
int textcolor; FString TextColor;
FSkillInfo() {} FSkillInfo() {}
FSkillInfo(const FSkillInfo &other) FSkillInfo(const FSkillInfo &other)
{ {
operator=(other); operator=(other);
} }
FSkillInfo &operator=(const FSkillInfo &other) FSkillInfo &operator=(const FSkillInfo &other);
{ int GetTextColor() const;
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;
}
}; };
extern TArray<FSkillInfo> AllSkills; extern TArray<FSkillInfo> AllSkills;

View file

@ -432,9 +432,9 @@ void M_StartupSkillMenu(const char *playerclass)
SkillSelectMenu[i].name = skill.MenuName; SkillSelectMenu[i].name = skill.MenuName;
SkillSelectMenu[i].fulltext = !skill.MenuNameIsLump; SkillSelectMenu[i].fulltext = !skill.MenuNameIsLump;
SkillSelectMenu[i].alphaKey = skill.MenuNameIsLump? skill.shortcut : tolower(SkillSelectMenu[i].name[0]); SkillSelectMenu[i].alphaKey = skill.MenuNameIsLump? skill.Shortcut : tolower(SkillSelectMenu[i].name[0]);
SkillSelectMenu[i].textcolor = skill.textcolor; SkillSelectMenu[i].textcolor = skill.GetTextColor();
SkillSelectMenu[i].alphaKey = skill.shortcut; SkillSelectMenu[i].alphaKey = skill.Shortcut;
if (playerclass != NULL) if (playerclass != NULL)
{ {
@ -443,7 +443,7 @@ void M_StartupSkillMenu(const char *playerclass)
{ {
SkillSelectMenu[i].name = GStrings(*pmnm); SkillSelectMenu[i].name = GStrings(*pmnm);
SkillSelectMenu[i].fulltext = true; SkillSelectMenu[i].fulltext = true;
if (skill.shortcut==0) if (skill.Shortcut == 0)
SkillSelectMenu[i].alphaKey = tolower(SkillSelectMenu[i].name[0]); SkillSelectMenu[i].alphaKey = tolower(SkillSelectMenu[i].name[0]);
} }
} }