Added the "qgetsysstr" command that copies game strings to quotes so they can be displayed.

qgetsysstr <quoteID> <strID>

<strID> can be:
STR_MAPNAME
STR_MAPFILENAME
STR_PLAYERNAME
STR_VERSION

The list of strings may need some additions and renaming.

onevent EVENT_DISPLAYMENU
  qgetsysstr 2 STR_MAPNAME
  minitext 10 10 2 0 0

  qgetsysstr 2 STR_MAPFILENAME
  minitext 10 20 2 0 0

  qgetsysstr 2 STR_PLAYERNAME // it shouldn't work in this event, though
  minitext 10 30 2 0 0

  qgetsysstr 2 STR_VERSION
  minitext 10 40 2 0 0
endevent

git-svn-id: https://svn.eduke32.com/eduke32@781 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hnt_ts 2008-06-09 10:39:32 +00:00
parent b3ac01c04d
commit 5edc3d6096
4 changed files with 37 additions and 0 deletions

View file

@ -803,6 +803,13 @@ enum events {
EVENT_DISPLAYLOADINGSCREEN
};
enum sysstrs {
STR_MAPNAME,
STR_MAPFILENAME,
STR_PLAYERNAME,
STR_VERSION
};
// store global game definitions

View file

@ -451,6 +451,7 @@ static const char *keyw[] =
"writearraytofile", // 319
"readarrayfromfile", // 320
"starttrackvar", // 321
"qgetsysstr", // 322
"<null>"
};
@ -4061,6 +4062,7 @@ repeatcase:
case CON_QSTRCAT:
case CON_QSTRCPY:
case CON_QSTRLEN:
case CON_QGETSYSSTR:
case CON_HEADSPRITESTAT:
case CON_PREVSPRITESTAT:
case CON_NEXTSPRITESTAT:
@ -4963,6 +4965,11 @@ static void AddDefaultDefinitions(void)
AddDefinition("EVENT_KILLIT",EVENT_KILLIT,LABEL_DEFINE);
AddDefinition("EVENT_LOADACTOR",EVENT_LOADACTOR,LABEL_DEFINE);
AddDefinition("STR_MAPNAME",STR_MAPNAME,LABEL_DEFINE);
AddDefinition("STR_MAPFILENAME",STR_MAPFILENAME,LABEL_DEFINE);
AddDefinition("STR_PLAYERNAME",STR_PLAYERNAME,LABEL_DEFINE);
AddDefinition("STR_VERSION",STR_VERSION,LABEL_DEFINE);
AddDefinition("NO",0,LABEL_DEFINE|LABEL_ACTION|LABEL_AI|LABEL_MOVE);
AddDefinition("PROJ_BOUNCES",PROJ_BOUNCES,LABEL_DEFINE);

View file

@ -811,4 +811,5 @@ enum keywords
CON_WRITEARRAYTOFILE, // 319
CON_READARRAYFROMFILE, // 320
CON_STARTTRACKVAR, // 321
CON_QGETSYSSTR, // 322
};

View file

@ -5106,6 +5106,7 @@ static int parse(void)
case CON_GETPNAME:
case CON_QSTRCAT:
case CON_QSTRCPY:
case CON_QGETSYSSTR:
case CON_CHANGESPRITESTAT:
case CON_CHANGESPRITESECT:
insptr++;
@ -5129,6 +5130,27 @@ static int parse(void)
}
else OSD_Printf("%s %d null quote %d\n",__FILE__,__LINE__,i);
break;
case CON_QGETSYSSTR:
if (fta_quotes[i] != NULL)
switch(j)
{
case STR_MAPNAME:
Bstrcpy(fta_quotes[i],map[ud.volume_number*MAXLEVELS + ud.level_number].name);
break;
case STR_MAPFILENAME:
Bstrcpy(fta_quotes[i],map[ud.volume_number*MAXLEVELS + ud.level_number].filename);
break;
case STR_PLAYERNAME:
Bstrcpy(fta_quotes[i],g_player[g_p].user_name);
break;
case STR_VERSION:
Bstrcpy(fta_quotes[i],HEAD2);
break;
default:
OSD_Printf("%s %d unknown str ID %d %d\n",__FILE__,__LINE__,i,j);
}
else OSD_Printf("%s %d null quote %d %d\n",__FILE__,__LINE__,i,j);
break;
case CON_QSTRCAT:
if (fta_quotes[i] != NULL && fta_quotes[j] != NULL)
Bstrncat(fta_quotes[i],fta_quotes[j],(MAXQUOTELEN-1)-Bstrlen(fta_quotes[i]));