- Extended ACS's 'n' print format specifier to allow printing some other info than the player's name.

It will use negative indices for this. Currently supported strings are level name, level lump name and
  skill name.
- Extended skill definitions so that printable name and image lump name are separate fields so that a 
  printable name can be specified for Doom, too.


SVN r2294 (trunk)
This commit is contained in:
Christoph Oelckers 2010-04-20 11:03:31 +00:00
parent d719671579
commit 14fc5516a8
8 changed files with 105 additions and 10 deletions

View file

@ -538,6 +538,7 @@ enum ESkillProperty
SKILLP_NoPain SKILLP_NoPain
}; };
int G_SkillProperty(ESkillProperty prop); int G_SkillProperty(ESkillProperty prop);
const char * G_SkillName();
typedef TMap<FName, FString> SkillMenuNames; typedef TMap<FName, FString> SkillMenuNames;
@ -558,8 +559,8 @@ struct FSkillInfo
int SpawnFilter; int SpawnFilter;
int ACSReturn; int ACSReturn;
FString MenuName; FString MenuName;
FString PicName;
SkillMenuNames MenuNamesForPlayerClass; SkillMenuNames MenuNamesForPlayerClass;
bool MenuNameIsLump;
bool MustConfirm; bool MustConfirm;
FString MustConfirmText; FString MustConfirmText;
char Shortcut; char Shortcut;

View file

@ -35,12 +35,14 @@
#include <ctype.h> #include <ctype.h>
#include "doomstat.h" #include "doomstat.h"
#include "d_player.h"
#include "g_level.h" #include "g_level.h"
#include "g_game.h" #include "g_game.h"
#include "gi.h" #include "gi.h"
#include "templates.h" #include "templates.h"
#include "v_font.h" #include "v_font.h"
#include "m_fixed.h" #include "m_fixed.h"
#include "gstrings.h"
TArray<FSkillInfo> AllSkills; TArray<FSkillInfo> AllSkills;
int DefaultSkill = -1; int DefaultSkill = -1;
@ -70,7 +72,6 @@ void FMapInfoParser::ParseSkill ()
skill.Aggressiveness = FRACUNIT; skill.Aggressiveness = FRACUNIT;
skill.SpawnFilter = 0; skill.SpawnFilter = 0;
skill.ACSReturn = 0; skill.ACSReturn = 0;
skill.MenuNameIsLump = false;
skill.MustConfirm = false; skill.MustConfirm = false;
skill.Shortcut = 0; skill.Shortcut = 0;
skill.TextColor = ""; skill.TextColor = "";
@ -185,7 +186,6 @@ void FMapInfoParser::ParseSkill ()
ParseAssign(); ParseAssign();
sc.MustGetString (); sc.MustGetString ();
skill.MenuName = sc.String; skill.MenuName = sc.String;
skill.MenuNameIsLump = false;
} }
else if (sc.Compare("PlayerClassName")) else if (sc.Compare("PlayerClassName"))
{ {
@ -200,8 +200,7 @@ void FMapInfoParser::ParseSkill ()
{ {
ParseAssign(); ParseAssign();
sc.MustGetString (); sc.MustGetString ();
skill.MenuName = sc.String; skill.PicName = sc.String;
skill.MenuNameIsLump = true;
} }
else if (sc.Compare("MustConfirm")) else if (sc.Compare("MustConfirm"))
{ {
@ -364,6 +363,29 @@ int G_SkillProperty(ESkillProperty prop)
return 0; return 0;
} }
//==========================================================================
//
//
//
//==========================================================================
const char * G_SkillName()
{
const char *name = AllSkills[gameskill].MenuName;
player_t *player = &players[consoleplayer];
const char *playerclass = player->mo->GetClass()->Meta.GetMetaString(APMETA_DisplayName);
if (playerclass != NULL)
{
FString * pmnm = AllSkills[gameskill].MenuNamesForPlayerClass.CheckKey(playerclass);
if (pmnm != NULL) name = *pmnm;
}
if (*name == '$') name = GStrings(name+1);
return name;
}
//========================================================================== //==========================================================================
// //
@ -402,8 +424,8 @@ FSkillInfo &FSkillInfo::operator=(const FSkillInfo &other)
SpawnFilter = other.SpawnFilter; SpawnFilter = other.SpawnFilter;
ACSReturn = other.ACSReturn; ACSReturn = other.ACSReturn;
MenuName = other.MenuName; MenuName = other.MenuName;
PicName = other.PicName;
MenuNamesForPlayerClass = other.MenuNamesForPlayerClass; MenuNamesForPlayerClass = other.MenuNamesForPlayerClass;
MenuNameIsLump = other.MenuNameIsLump;
MustConfirm = other.MustConfirm; MustConfirm = other.MustConfirm;
MustConfirmText = other.MustConfirmText; MustConfirmText = other.MustConfirmText;
Shortcut = other.Shortcut; Shortcut = other.Shortcut;

View file

@ -477,9 +477,16 @@ void M_StartupSkillMenu(const char *playerclass)
{ {
FSkillInfo &skill = AllSkills[i]; FSkillInfo &skill = AllSkills[i];
if (skill.PicName.Len() != 0)
{
SkillSelectMenu[i].name = skill.PicName;
SkillSelectMenu[i].fulltext = false;
}
else
{
SkillSelectMenu[i].name = skill.MenuName; SkillSelectMenu[i].name = skill.MenuName;
SkillSelectMenu[i].fulltext = !skill.MenuNameIsLump; SkillSelectMenu[i].fulltext = true;
SkillSelectMenu[i].alphaKey = skill.MenuNameIsLump? skill.Shortcut : tolower(SkillSelectMenu[i].name[0]); }
SkillSelectMenu[i].textcolor = skill.GetTextColor(); SkillSelectMenu[i].textcolor = skill.GetTextColor();
SkillSelectMenu[i].alphaKey = skill.Shortcut; SkillSelectMenu[i].alphaKey = skill.Shortcut;

View file

@ -3351,6 +3351,13 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, SDWORD *args)
return 0; return 0;
} }
enum
{
PRINTNAME_LEVELNAME = -1,
PRINTNAME_LEVEL = -2,
PRINTNAME_SKILL = -3,
};
#define NEXTWORD (LittleLong(*pc++)) #define NEXTWORD (LittleLong(*pc++))
#define NEXTBYTE (fmt==ACS_LittleEnhanced?getbyte(pc):NEXTWORD) #define NEXTBYTE (fmt==ACS_LittleEnhanced?getbyte(pc):NEXTWORD)
@ -4804,7 +4811,31 @@ int DLevelScript::RunScript ()
{ {
player_t *player = NULL; player_t *player = NULL;
if (STACK(1) == 0 || (unsigned)STACK(1) > MAXPLAYERS) if (STACK(1) < 0)
{
switch (STACK(1))
{
case PRINTNAME_LEVELNAME:
work += level.LevelName;
break;
case PRINTNAME_LEVEL:
work += level.mapname;
break;
case PRINTNAME_SKILL:
work += G_SkillName();
break;
default:
work += ' ';
break;
}
sp--;
break;
}
else if (STACK(1) == 0 || (unsigned)STACK(1) > MAXPLAYERS)
{ {
if (activator) if (activator)
{ {

View file

@ -1232,6 +1232,25 @@ TXT_RANDOMGOODBYE_1 = "Bye!";
TXT_RANDOMGOODBYE_2 = "Thanks, bye!"; TXT_RANDOMGOODBYE_2 = "Thanks, bye!";
TXT_RANDOMGOODBYE_3 = "See you later!"; TXT_RANDOMGOODBYE_3 = "See you later!";
// Skills:
SKILL_BABY = "I'm too young to die";
SKILL_EASY = "Hey, not too rough";
SKILL_NORMAL = "Hurt me plenty";
SKILL_HARD = "Ultra-Violence";
SKILL_NIGHTMARE = "NIGHTMARE!";
CSKILL_BABY = "Easy does it";
CSKILL_EASY = "Not so sticky";
CSKILL_NORMAL = "Gobs of goo";
CSKILL_HARD = "Extreme Ooze";
CSKILL_NIGHTMARE = "Super Slimey!";
SSKILL_BABY = "Training";
SSKILL_EASY = "Rookie";
SSKILL_NORMAL = "Veteran";
SSKILL_HARD = "Elite";
SSKILL_NIGHTMARE = "Bloodbath";
// Menu // Menu
MNU_NEWGAME = "NEW GAME"; MNU_NEWGAME = "NEW GAME";

View file

@ -51,6 +51,7 @@ skill baby
EasyBossBrain EasyBossBrain
SpawnFilter = Baby SpawnFilter = Baby
PicName = "M_JKILL" PicName = "M_JKILL"
Name = "$CSKILL_BABY"
Key = "i" Key = "i"
} }
@ -59,6 +60,7 @@ skill easy
EasyBossBrain EasyBossBrain
SpawnFilter = Easy SpawnFilter = Easy
PicName = "M_ROUGH" PicName = "M_ROUGH"
Name = "$CSKILL_EASY"
Key = "h" Key = "h"
} }
@ -66,6 +68,7 @@ skill normal
{ {
SpawnFilter = Normal SpawnFilter = Normal
PicName = "M_HURT" PicName = "M_HURT"
Name = "$CSKILL_NORMAL"
Key = "h" Key = "h"
} }
@ -73,6 +76,7 @@ skill hard
{ {
SpawnFilter = Hard SpawnFilter = Hard
PicName = "M_ULTRA" PicName = "M_ULTRA"
Name = "$CSKILL_HARD"
Key = "u" Key = "u"
} }
@ -85,6 +89,7 @@ skill nightmare
SpawnFilter = Nightmare SpawnFilter = Nightmare
PicName = "M_NMARE" PicName = "M_NMARE"
MustConfirm = "$CNIGHTMARE" MustConfirm = "$CNIGHTMARE"
Name = "$CSKILL_NIGHTMARE"
Key = "n" Key = "n"
} }

View file

@ -50,6 +50,7 @@ skill baby
EasyBossBrain EasyBossBrain
SpawnFilter = Baby SpawnFilter = Baby
PicName = "M_JKILL" PicName = "M_JKILL"
Name = "$SKILL_BABY"
Key = "i" Key = "i"
} }
@ -58,6 +59,7 @@ skill easy
EasyBossBrain EasyBossBrain
SpawnFilter = Easy SpawnFilter = Easy
PicName = "M_ROUGH" PicName = "M_ROUGH"
Name = "$SKILL_EASY"
Key = "h" Key = "h"
} }
@ -66,6 +68,7 @@ skill normal
SpawnFilter = Normal SpawnFilter = Normal
PicName = "M_HURT" PicName = "M_HURT"
Key = "h" Key = "h"
Name = "$SKILL_NORMAL"
DefaultSkill DefaultSkill
} }
@ -73,6 +76,7 @@ skill hard
{ {
SpawnFilter = Hard SpawnFilter = Hard
PicName = "M_ULTRA" PicName = "M_ULTRA"
Name = "$SKILL_HARD"
Key = "u" Key = "u"
} }
@ -84,6 +88,7 @@ skill nightmare
RespawnTime = 12 RespawnTime = 12
SpawnFilter = Nightmare SpawnFilter = Nightmare
PicName = "M_NMARE" PicName = "M_NMARE"
Name = "$SKILL_NIGHTMARE"
MustConfirm MustConfirm
Key = "n" Key = "n"
} }

View file

@ -52,6 +52,7 @@ skill baby
EasyBossBrain EasyBossBrain
SpawnFilter = Baby SpawnFilter = Baby
PicName = "M_JKILL" PicName = "M_JKILL"
Name = "$SSKILL_BABY"
Key = "t" Key = "t"
} }
@ -59,6 +60,7 @@ skill easy
{ {
SpawnFilter = Easy SpawnFilter = Easy
PicName = "M_ROUGH" PicName = "M_ROUGH"
Name = "$SSKILL_EASY"
Key = "r" Key = "r"
} }
@ -66,6 +68,7 @@ skill normal
{ {
SpawnFilter = Normal SpawnFilter = Normal
PicName = "M_HURT" PicName = "M_HURT"
Name = "$SSKILL_NORMAL"
Key = "v" Key = "v"
DefaultSkill DefaultSkill
} }
@ -74,6 +77,7 @@ skill hard
{ {
SpawnFilter = Hard SpawnFilter = Hard
PicName = "M_ULTRA" PicName = "M_ULTRA"
Name = "$SSKILL_HARD"
Key = "e" Key = "e"
} }
@ -85,6 +89,7 @@ skill nightmare
RespawnTime = 16 RespawnTime = 16
SpawnFilter = Nightmare SpawnFilter = Nightmare
PicName = "M_NMARE" PicName = "M_NMARE"
Name = "$SSKILL_NIGHTMARE"
Key = "b" Key = "b"
} }