mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-10 23:01:59 +00:00
- 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:
parent
d719671579
commit
14fc5516a8
8 changed files with 105 additions and 10 deletions
|
@ -538,6 +538,7 @@ enum ESkillProperty
|
|||
SKILLP_NoPain
|
||||
};
|
||||
int G_SkillProperty(ESkillProperty prop);
|
||||
const char * G_SkillName();
|
||||
|
||||
typedef TMap<FName, FString> SkillMenuNames;
|
||||
|
||||
|
@ -558,8 +559,8 @@ struct FSkillInfo
|
|||
int SpawnFilter;
|
||||
int ACSReturn;
|
||||
FString MenuName;
|
||||
FString PicName;
|
||||
SkillMenuNames MenuNamesForPlayerClass;
|
||||
bool MenuNameIsLump;
|
||||
bool MustConfirm;
|
||||
FString MustConfirmText;
|
||||
char Shortcut;
|
||||
|
|
|
@ -35,12 +35,14 @@
|
|||
|
||||
#include <ctype.h>
|
||||
#include "doomstat.h"
|
||||
#include "d_player.h"
|
||||
#include "g_level.h"
|
||||
#include "g_game.h"
|
||||
#include "gi.h"
|
||||
#include "templates.h"
|
||||
#include "v_font.h"
|
||||
#include "m_fixed.h"
|
||||
#include "gstrings.h"
|
||||
|
||||
TArray<FSkillInfo> AllSkills;
|
||||
int DefaultSkill = -1;
|
||||
|
@ -70,7 +72,6 @@ void FMapInfoParser::ParseSkill ()
|
|||
skill.Aggressiveness = FRACUNIT;
|
||||
skill.SpawnFilter = 0;
|
||||
skill.ACSReturn = 0;
|
||||
skill.MenuNameIsLump = false;
|
||||
skill.MustConfirm = false;
|
||||
skill.Shortcut = 0;
|
||||
skill.TextColor = "";
|
||||
|
@ -185,7 +186,6 @@ void FMapInfoParser::ParseSkill ()
|
|||
ParseAssign();
|
||||
sc.MustGetString ();
|
||||
skill.MenuName = sc.String;
|
||||
skill.MenuNameIsLump = false;
|
||||
}
|
||||
else if (sc.Compare("PlayerClassName"))
|
||||
{
|
||||
|
@ -200,8 +200,7 @@ void FMapInfoParser::ParseSkill ()
|
|||
{
|
||||
ParseAssign();
|
||||
sc.MustGetString ();
|
||||
skill.MenuName = sc.String;
|
||||
skill.MenuNameIsLump = true;
|
||||
skill.PicName = sc.String;
|
||||
}
|
||||
else if (sc.Compare("MustConfirm"))
|
||||
{
|
||||
|
@ -364,6 +363,29 @@ int G_SkillProperty(ESkillProperty prop)
|
|||
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;
|
||||
ACSReturn = other.ACSReturn;
|
||||
MenuName = other.MenuName;
|
||||
PicName = other.PicName;
|
||||
MenuNamesForPlayerClass = other.MenuNamesForPlayerClass;
|
||||
MenuNameIsLump = other.MenuNameIsLump;
|
||||
MustConfirm = other.MustConfirm;
|
||||
MustConfirmText = other.MustConfirmText;
|
||||
Shortcut = other.Shortcut;
|
||||
|
|
|
@ -477,9 +477,16 @@ void M_StartupSkillMenu(const char *playerclass)
|
|||
{
|
||||
FSkillInfo &skill = AllSkills[i];
|
||||
|
||||
SkillSelectMenu[i].name = skill.MenuName;
|
||||
SkillSelectMenu[i].fulltext = !skill.MenuNameIsLump;
|
||||
SkillSelectMenu[i].alphaKey = skill.MenuNameIsLump? skill.Shortcut : tolower(SkillSelectMenu[i].name[0]);
|
||||
if (skill.PicName.Len() != 0)
|
||||
{
|
||||
SkillSelectMenu[i].name = skill.PicName;
|
||||
SkillSelectMenu[i].fulltext = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
SkillSelectMenu[i].name = skill.MenuName;
|
||||
SkillSelectMenu[i].fulltext = true;
|
||||
}
|
||||
SkillSelectMenu[i].textcolor = skill.GetTextColor();
|
||||
SkillSelectMenu[i].alphaKey = skill.Shortcut;
|
||||
|
||||
|
|
|
@ -3351,6 +3351,13 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, SDWORD *args)
|
|||
return 0;
|
||||
}
|
||||
|
||||
enum
|
||||
{
|
||||
PRINTNAME_LEVELNAME = -1,
|
||||
PRINTNAME_LEVEL = -2,
|
||||
PRINTNAME_SKILL = -3,
|
||||
};
|
||||
|
||||
|
||||
#define NEXTWORD (LittleLong(*pc++))
|
||||
#define NEXTBYTE (fmt==ACS_LittleEnhanced?getbyte(pc):NEXTWORD)
|
||||
|
@ -4804,7 +4811,31 @@ int DLevelScript::RunScript ()
|
|||
{
|
||||
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)
|
||||
{
|
||||
|
|
|
@ -1232,6 +1232,25 @@ TXT_RANDOMGOODBYE_1 = "Bye!";
|
|||
TXT_RANDOMGOODBYE_2 = "Thanks, bye!";
|
||||
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
|
||||
MNU_NEWGAME = "NEW GAME";
|
||||
|
|
|
@ -51,6 +51,7 @@ skill baby
|
|||
EasyBossBrain
|
||||
SpawnFilter = Baby
|
||||
PicName = "M_JKILL"
|
||||
Name = "$CSKILL_BABY"
|
||||
Key = "i"
|
||||
}
|
||||
|
||||
|
@ -59,6 +60,7 @@ skill easy
|
|||
EasyBossBrain
|
||||
SpawnFilter = Easy
|
||||
PicName = "M_ROUGH"
|
||||
Name = "$CSKILL_EASY"
|
||||
Key = "h"
|
||||
}
|
||||
|
||||
|
@ -66,6 +68,7 @@ skill normal
|
|||
{
|
||||
SpawnFilter = Normal
|
||||
PicName = "M_HURT"
|
||||
Name = "$CSKILL_NORMAL"
|
||||
Key = "h"
|
||||
}
|
||||
|
||||
|
@ -73,6 +76,7 @@ skill hard
|
|||
{
|
||||
SpawnFilter = Hard
|
||||
PicName = "M_ULTRA"
|
||||
Name = "$CSKILL_HARD"
|
||||
Key = "u"
|
||||
}
|
||||
|
||||
|
@ -85,6 +89,7 @@ skill nightmare
|
|||
SpawnFilter = Nightmare
|
||||
PicName = "M_NMARE"
|
||||
MustConfirm = "$CNIGHTMARE"
|
||||
Name = "$CSKILL_NIGHTMARE"
|
||||
Key = "n"
|
||||
|
||||
}
|
||||
|
|
|
@ -50,6 +50,7 @@ skill baby
|
|||
EasyBossBrain
|
||||
SpawnFilter = Baby
|
||||
PicName = "M_JKILL"
|
||||
Name = "$SKILL_BABY"
|
||||
Key = "i"
|
||||
}
|
||||
|
||||
|
@ -58,6 +59,7 @@ skill easy
|
|||
EasyBossBrain
|
||||
SpawnFilter = Easy
|
||||
PicName = "M_ROUGH"
|
||||
Name = "$SKILL_EASY"
|
||||
Key = "h"
|
||||
}
|
||||
|
||||
|
@ -66,6 +68,7 @@ skill normal
|
|||
SpawnFilter = Normal
|
||||
PicName = "M_HURT"
|
||||
Key = "h"
|
||||
Name = "$SKILL_NORMAL"
|
||||
DefaultSkill
|
||||
}
|
||||
|
||||
|
@ -73,6 +76,7 @@ skill hard
|
|||
{
|
||||
SpawnFilter = Hard
|
||||
PicName = "M_ULTRA"
|
||||
Name = "$SKILL_HARD"
|
||||
Key = "u"
|
||||
}
|
||||
|
||||
|
@ -84,6 +88,7 @@ skill nightmare
|
|||
RespawnTime = 12
|
||||
SpawnFilter = Nightmare
|
||||
PicName = "M_NMARE"
|
||||
Name = "$SKILL_NIGHTMARE"
|
||||
MustConfirm
|
||||
Key = "n"
|
||||
}
|
||||
|
|
|
@ -52,6 +52,7 @@ skill baby
|
|||
EasyBossBrain
|
||||
SpawnFilter = Baby
|
||||
PicName = "M_JKILL"
|
||||
Name = "$SSKILL_BABY"
|
||||
Key = "t"
|
||||
}
|
||||
|
||||
|
@ -59,6 +60,7 @@ skill easy
|
|||
{
|
||||
SpawnFilter = Easy
|
||||
PicName = "M_ROUGH"
|
||||
Name = "$SSKILL_EASY"
|
||||
Key = "r"
|
||||
}
|
||||
|
||||
|
@ -66,6 +68,7 @@ skill normal
|
|||
{
|
||||
SpawnFilter = Normal
|
||||
PicName = "M_HURT"
|
||||
Name = "$SSKILL_NORMAL"
|
||||
Key = "v"
|
||||
DefaultSkill
|
||||
}
|
||||
|
@ -74,6 +77,7 @@ skill hard
|
|||
{
|
||||
SpawnFilter = Hard
|
||||
PicName = "M_ULTRA"
|
||||
Name = "$SSKILL_HARD"
|
||||
Key = "e"
|
||||
}
|
||||
|
||||
|
@ -85,6 +89,7 @@ skill nightmare
|
|||
RespawnTime = 16
|
||||
SpawnFilter = Nightmare
|
||||
PicName = "M_NMARE"
|
||||
Name = "$SSKILL_NIGHTMARE"
|
||||
Key = "b"
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue