- Fixed: Redefining an existing skill would set that skills ACSReturn to be

the same as the next new skill defined, if neither definition explicitly set
  the value for ACSReturn.
- Added a DefaultSkill property. Adding it to a skill will cause that skill
  to be the default one selected in the menu. If none is specified as the
  default, then the middle skill is the default.


SVN r1731 (trunk)
This commit is contained in:
Randy Heit 2009-07-23 04:33:07 +00:00
parent dba34d0761
commit 8a2e03c9cb
10 changed files with 64 additions and 12 deletions

View file

@ -1,4 +1,10 @@
July 22, 2009
- Fixed: Redefining an existing skill would set that skills ACSReturn to be
the same as the next new skill defined, if neither definition explicitly set
the value for ACSReturn.
- Added a DefaultSkill property. Adding it to a skill will cause that skill
to be the default one selected in the menu. If none is specified as the
default, then the middle skill is the default.
- Slider controls in the options menu now display their values
numerically next to the slider.
- The minimum value for m_yaw, m_pitch, m_forward, and m_side from the

View file

@ -580,6 +580,7 @@ struct FSkillInfo
};
extern TArray<FSkillInfo> AllSkills;
extern int DefaultSkill;

View file

@ -1851,6 +1851,7 @@ void FMapInfoParser::ParseMapInfo (int lump, level_info_t &gamedefaults, level_i
else if (sc.Compare("clearskills"))
{
AllSkills.Clear();
DefaultSkill = -1;
}
else if (sc.Compare("gameinfo"))
{

View file

@ -42,6 +42,7 @@
#include "v_font.h"
TArray<FSkillInfo> AllSkills;
int DefaultSkill = -1;
//==========================================================================
//
@ -52,6 +53,8 @@ TArray<FSkillInfo> AllSkills;
void FMapInfoParser::ParseSkill ()
{
FSkillInfo skill;
bool thisisdefault = false;
bool acsreturnisset = false;
skill.AmmoFactor = FRACUNIT;
skill.DoubleAmmoFactor = 2*FRACUNIT;
@ -65,7 +68,7 @@ void FMapInfoParser::ParseSkill ()
skill.RespawnLimit = 0;
skill.Aggressiveness = FRACUNIT;
skill.SpawnFilter = 0;
skill.ACSReturn = AllSkills.Size();
skill.ACSReturn = 0;
skill.MenuNameIsLump = false;
skill.MustConfirm = false;
skill.Shortcut = 0;
@ -163,6 +166,7 @@ void FMapInfoParser::ParseSkill ()
ParseAssign();
sc.MustGetNumber ();
skill.ACSReturn = sc.Number;
acsreturnisset = true;
}
else if (sc.Compare("ReplaceActor"))
{
@ -245,6 +249,14 @@ void FMapInfoParser::ParseSkill ()
{
skill.NoPain = true;
}
else if (sc.Compare("DefaultSkill"))
{
if (DefaultSkill >= 0)
{
sc.ScriptError("%s is already the default skill\n", AllSkills[DefaultSkill].Name.GetChars());
}
thisisdefault = true;
}
else if (!ParseCloseBrace())
{
// Unknown
@ -261,10 +273,26 @@ void FMapInfoParser::ParseSkill ()
{
if (AllSkills[i].Name == skill.Name)
{
if (!acsreturnisset)
{ // Use the ACS return for the skill we are overwriting.
skill.ACSReturn = AllSkills[i].ACSReturn;
}
AllSkills[i] = skill;
if (thisisdefault)
{
DefaultSkill = i;
}
return;
}
}
if (!acsreturnisset)
{
skill.ACSReturn = AllSkills.Size();
}
if (thisisdefault)
{
DefaultSkill = AllSkills.Size();
}
AllSkills.Push(skill);
}

View file

@ -52,8 +52,6 @@
extern void LoadActors ();
extern TArray<FSkillInfo> AllSkills;
//==========================================================================
//

View file

@ -421,16 +421,16 @@ static oldmenu_t SkillDef =
SkillSelectMenu, // oldmenuitem_t ->
M_DrawNewGame, // drawing routine ->
48,63, // x,y
2 // lastOn
-1 // lastOn
};
static oldmenu_t HexenSkillMenu =
{
0,
SkillSelectMenu, // oldmenuitem_t ->
SkillSelectMenu,
DrawHexenSkillMenu,
120, 44,
2
-1
};
@ -477,13 +477,30 @@ void M_StartupSkillMenu(const char *playerclass)
SkillDef.numitems++;
HexenSkillMenu.numitems++;
}
int defskill = DefaultSkill;
if ((unsigned int)defskill >= AllSkills.Size())
{
defskill = (AllSkills.Size() - 1) / 2;
}
// The default skill is only set the first time the menu is opened.
// After that, it opens on whichever skill you last selected.
if (SkillDef.lastOn < 0)
{
SkillDef.lastOn = defskill;
}
if (HexenSkillMenu.lastOn < 0)
{
HexenSkillMenu.lastOn = defskill;
}
// Hexen needs some manual coordinate adjustments based on player class
if (gameinfo.gametype == GAME_Hexen)
{
M_SetupNextMenu(&HexenSkillMenu);
}
else
{
M_SetupNextMenu(&SkillDef);
}
}
@ -1629,7 +1646,6 @@ void M_NewGame(int choice)
{
M_StartupSkillMenu(NULL);
}
}
else
{

View file

@ -1,4 +1,3 @@
gameinfo
{
titlepage = "TITLEPIC"
@ -59,6 +58,7 @@ skill normal
SpawnFilter = Normal
PicName = "M_HURT"
Key = "h"
DefaultSkill
}
skill hard
@ -79,4 +79,3 @@ skill nightmare
MustConfirm
Key = "n"
}

View file

@ -58,6 +58,7 @@ skill normal
DoubleAmmoFactor = 1.5
SpawnFilter = Normal
Name = "$MNU_BRINGEST"
DefaultSkill
}
skill hard

View file

@ -67,6 +67,7 @@ skill normal
playerclassname = "fighter", "$MNU_WARRIOR"
playerclassname = "cleric", "$MNU_PRIEST"
playerclassname = "mage", "$MNU_SORCERER"
DefaultSkill
}
skill hard

View file

@ -59,6 +59,7 @@ skill normal
SpawnFilter = Normal
PicName = "M_HURT"
Key = "v"
DefaultSkill
}
skill hard