- 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 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 - Slider controls in the options menu now display their values
numerically next to the slider. numerically next to the slider.
- The minimum value for m_yaw, m_pitch, m_forward, and m_side from the - 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 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")) else if (sc.Compare("clearskills"))
{ {
AllSkills.Clear(); AllSkills.Clear();
DefaultSkill = -1;
} }
else if (sc.Compare("gameinfo")) else if (sc.Compare("gameinfo"))
{ {
@ -1908,7 +1909,7 @@ void G_ParseMapInfo (const char *basemapinfo)
{ {
I_FatalError ("You cannot use clearepisodes in a MAPINFO if you do not define any new episodes after it."); I_FatalError ("You cannot use clearepisodes in a MAPINFO if you do not define any new episodes after it.");
} }
if (AllSkills.Size()==0) if (AllSkills.Size() == 0)
{ {
I_FatalError ("You cannot use clearskills in a MAPINFO if you do not define any new skills after it."); I_FatalError ("You cannot use clearskills in a MAPINFO if you do not define any new skills after it.");
} }

View file

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

View file

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

View file

@ -418,19 +418,19 @@ static oldmenuitem_t SkillSelectMenu[]={
static oldmenu_t SkillDef = static oldmenu_t SkillDef =
{ {
0, 0,
SkillSelectMenu, // oldmenuitem_t -> SkillSelectMenu, // oldmenuitem_t ->
M_DrawNewGame, // drawing routine -> M_DrawNewGame, // drawing routine ->
48,63, // x,y 48,63, // x,y
2 // lastOn -1 // lastOn
}; };
static oldmenu_t HexenSkillMenu = static oldmenu_t HexenSkillMenu =
{ {
0, 0,
SkillSelectMenu, // oldmenuitem_t -> SkillSelectMenu,
DrawHexenSkillMenu, DrawHexenSkillMenu,
120, 44, 120, 44,
2 -1
}; };
@ -453,7 +453,7 @@ void M_StartupSkillMenu(const char *playerclass)
} }
} }
SkillDef.numitems = HexenSkillMenu.numitems = 0; SkillDef.numitems = HexenSkillMenu.numitems = 0;
for(unsigned int i=0;i<AllSkills.Size() && i<8;i++) for(unsigned int i = 0; i < AllSkills.Size() && i < 8; i++)
{ {
FSkillInfo &skill = AllSkills[i]; FSkillInfo &skill = AllSkills[i];
@ -477,13 +477,30 @@ void M_StartupSkillMenu(const char *playerclass)
SkillDef.numitems++; SkillDef.numitems++;
HexenSkillMenu.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 // Hexen needs some manual coordinate adjustments based on player class
if (gameinfo.gametype == GAME_Hexen) if (gameinfo.gametype == GAME_Hexen)
{ {
M_SetupNextMenu(&HexenSkillMenu); M_SetupNextMenu(&HexenSkillMenu);
} }
else else
{
M_SetupNextMenu(&SkillDef); M_SetupNextMenu(&SkillDef);
}
} }
@ -1629,7 +1646,6 @@ void M_NewGame(int choice)
{ {
M_StartupSkillMenu(NULL); M_StartupSkillMenu(NULL);
} }
} }
else else
{ {

View file

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

View file

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

View file

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

View file

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