From 694acef9fe491ff2a34e685d587f7b2977fa69d9 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Sun, 25 Mar 2012 22:00:27 +0000 Subject: [PATCH] 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 --- polymer/eduke32/source/game.c | 1 + polymer/eduke32/source/gamedef.c | 13 ++++++++++--- polymer/eduke32/source/global.c | 2 +- polymer/eduke32/source/global.h | 4 +++- polymer/eduke32/source/menus.c | 14 +++++++++----- 5 files changed, 24 insertions(+), 10 deletions(-) diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 7e699d955..b53a7cfdb 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -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] diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index 0e7f1e7ac..31c1e06ae 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -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 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>1,24,0,0,"RENDERER SETUP");