Allow up to 7 skills, coded by M210 and taken over with modifications.

Skill names are defined via 'defineskillname' as before, but the index
of the last non-empty skill name (plus one) is taken as the skill count.
So, if you only define the 6th, there will be no effect.
Note that currently, there is no way to specify less than four skills
because the CON parser doesn't allow the empty string for the name (it'll
go beyond the line) and because the default skill names are initialized in
EDuke32 too, in addition to the CONs.

git-svn-id: https://svn.eduke32.com/eduke32@2530 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2012-03-25 22:00:27 +00:00
parent e706258c43
commit 694acef9fe
5 changed files with 24 additions and 10 deletions

View File

@ -9886,6 +9886,7 @@ int32_t app_main(int32_t argc,const char **argv)
addsearchpath("/Library/Application Support/EDuke32");
#endif
g_numSkills = 4;
ud.multimode = 1;
// this needs to happen before G_CheckCommandLine because G_GameExit accesses g_player[0]

View File

@ -4928,10 +4928,10 @@ repeatcase:
j = *g_scriptPtr;
C_SkipComments();
if (j < 0 || j > 4)
if (j < 0 || j >= MAXSKILLS)
{
initprintf("%s:%d: error: skill number exceeds maximum skill count.\n",
g_szScriptFileName,g_lineNumber);
initprintf("%s:%d: error: skill number exceeds maximum skill count %d.\n",
g_szScriptFileName,g_lineNumber, MAXSKILLS);
g_numCompilerErrors++;
C_NextLine();
continue;
@ -4952,7 +4952,14 @@ repeatcase:
break;
}
}
SkillNames[j][i] = '\0';
for (i=0; i<MAXSKILLS; i++)
if (SkillNames[i][0] == 0)
break;
g_numSkills = i;
continue;
case CON_SETGAMENAME:

View File

@ -61,7 +61,7 @@ sound_t g_sounds[ MAXSOUNDS ];
volatile char g_soundlocks[MAXSOUNDS];
char EpisodeNames[MAXVOLUMES][33] = { "L.A. MELTDOWN", "LUNAR APOCALYPSE", "SHRAPNEL CITY" };
char SkillNames[5][33] = { "PIECE OF CAKE", "LET'S ROCK", "COME GET SOME", "DAMN I'M GOOD" };
char SkillNames[MAXSKILLS][33] = { "PIECE OF CAKE", "LET'S ROCK", "COME GET SOME", "DAMN I'M GOOD" };
char GametypeNames[MAXGAMETYPES][33] = { "DUKEMATCH (SPAWN)","COOPERATIVE PLAY","DUKEMATCH (NO SPAWN)","TEAM DM (SPAWN)","TEAM DM (NO SPAWN)"};

View File

@ -35,6 +35,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// duke3d global soup :(
#define MAXINTERPOLATIONS MAXSPRITES
#define MAXSKILLS 7
G_EXTERN int32_t myconnectindex, numplayers;
G_EXTERN int32_t connectpoint2[MAXPLAYERS];
@ -50,12 +51,13 @@ G_EXTERN char CheatKeys[2];
G_EXTERN char EnvMusicFilename[MAXVOLUMES+1][BMAX_PATH];
G_EXTERN char EpisodeNames[MAXVOLUMES][33];
G_EXTERN char GametypeNames[MAXGAMETYPES][33];
G_EXTERN char SkillNames[5][33];
G_EXTERN char SkillNames[MAXSKILLS][33];
G_EXTERN char g_RTSPlaying;
G_EXTERN char g_musicIndex;
G_EXTERN char g_numGametypes;
G_EXTERN char g_numPlayerSprites,g_loadFromGroupOnly;
G_EXTERN char g_numVolumes;
G_EXTERN char g_numSkills;
G_EXTERN char myjumpingtoggle,myonground,myhardlanding,myreturntocenter;
G_EXTERN char pus,pub;
G_EXTERN char ready2send;

View File

@ -2401,10 +2401,14 @@ cheat_for_port_credits:
break;
case 110:
{
// 4 skills (orig) --> 70
const int32_t ybase = 70 + (4-g_numSkills)*6;
c = (320>>1);
rotatesprite_fs(c<<16,19<<16,65536L,0,MENUBAR,16,0,10);
menutext(c,24,0,0,"SELECT SKILL");
x = M_Probe(c,70,19,4);
x = M_Probe(c,ybase,19,g_numSkills);
if (x >= 0)
{
switch (x)
@ -2453,11 +2457,11 @@ cheat_for_port_credits:
KB_FlushKeyboardQueue();
}
menutext(c,70,MENUHIGHLIGHT(0),PHX(-2),SkillNames[0]);
menutext(c,70+19,MENUHIGHLIGHT(1),PHX(-3),SkillNames[1]);
menutext(c,70+19+19,MENUHIGHLIGHT(2),PHX(-4),SkillNames[2]);
menutext(c,70+19+19+19,MENUHIGHLIGHT(3),PHX(-5),SkillNames[3]);
for (i=0; i<g_numSkills; i++)
menutext(c,ybase+i*19,MENUHIGHLIGHT(i),PHX(-2-i),SkillNames[i]);
break;
}
case 230:
rotatesprite_fs(320<<15,19<<16,65536L,0,MENUBAR,16,0,10);
menutext(320>>1,24,0,0,"RENDERER SETUP");