summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2006-11-08 15:52:29 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2006-11-08 15:52:29 +0000
commitd228486000345846de576e74711dc2c3cf4712da (patch)
tree30b47e53e42a49a9b678e7cd4f9c7c0e4ae7a7d3
parentbb202a3f30286d2a5b9c6536bf3ce9a06ce61645 (diff)
downloadcrawl-ref-d228486000345846de576e74711dc2c3cf4712da.tar.gz
crawl-ref-d228486000345846de576e74711dc2c3cf4712da.zip
[1584965] Display unarmed combat after the other melee skills.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/branches/stone_soup@367 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/enum.h5
-rw-r--r--crawl-ref/source/skills2.cc92
2 files changed, 61 insertions, 36 deletions
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h
index 0346a327af..2b4ef5daec 100644
--- a/crawl-ref/source/enum.h
+++ b/crawl-ref/source/enum.h
@@ -2923,6 +2923,11 @@ enum size_type
SIZE_CHARACTER // transformations that don't change size
};
+// [dshaligram] If you add a new skill, update skills2.cc, specifically
+// the skills[] array and skill_display_order[]. New skills must go at the
+// end of the list or in the unused skill numbers. NEVER rearrange this enum or
+// move existing skills to new numbers; save file compatibility depends on this
+// order.
enum skill_type
{
SK_FIGHTING, // 0
diff --git a/crawl-ref/source/skills2.cc b/crawl-ref/source/skills2.cc
index 55a123f76d..a1cf62a435 100644
--- a/crawl-ref/source/skills2.cc
+++ b/crawl-ref/source/skills2.cc
@@ -31,6 +31,7 @@
#include "externs.h"
#include "fight.h"
#include "itemprop.h"
+#include "menu.h"
#include "player.h"
#include "randart.h"
#include "religion.h"
@@ -1787,11 +1788,37 @@ JOB_PALADIN:
************************************************************* */
+static const int skill_display_order[] = {
+ SK_FIGHTING, SK_SHORT_BLADES, SK_LONG_SWORDS, SK_AXES,
+ SK_MACES_FLAILS, SK_POLEARMS, SK_STAVES, SK_UNARMED_COMBAT,
+
+ SK_BLANK_LINE,
+
+ SK_SLINGS, SK_BOWS, SK_CROSSBOWS, SK_DARTS, SK_RANGED_COMBAT,
+
+ SK_BLANK_LINE,
+
+ SK_ARMOUR, SK_DODGING, SK_STEALTH, SK_STABBING, SK_SHIELDS, SK_TRAPS_DOORS,
+
+ SK_BLANK_LINE,
+
+ SK_SPELLCASTING, SK_CONJURATIONS, SK_ENCHANTMENTS, SK_SUMMONINGS,
+ SK_NECROMANCY, SK_TRANSLOCATIONS, SK_TRANSMIGRATION, SK_DIVINATIONS,
+ SK_FIRE_MAGIC, SK_ICE_MAGIC, SK_AIR_MAGIC, SK_EARTH_MAGIC, SK_POISON_MAGIC,
+
+ SK_BLANK_LINE,
+
+ SK_INVOCATIONS, SK_EVOCATIONS,
+};
+
+static const int ndisplayed_skills =
+ sizeof(skill_display_order) / sizeof(*skill_display_order);
+
void show_skills(void)
{
int i;
int x;
- char lcount;
+ menu_letter lcount;
const int num_lines = get_number_of_lines();
@@ -1823,21 +1850,30 @@ void show_skills(void)
// Don't want the help line to appear too far down a big window.
int bottom_line = ((num_lines > 30) ? 30 : num_lines);
- for (x = 0; x < NUM_SKILLS; x++)
+ for (i = 0; i < ndisplayed_skills; ++i)
{
- /* spells in second column */
- if ((x == SK_SPELLCASTING && scrcol != 40) || scrln > bottom_line - 3)
+ x = skill_display_order[i];
+
+ if (scrln > bottom_line - 3 || x == SK_COLUMN_BREAK)
+ {
+ if (scrcol != 40)
+ {
+ scrln = 3;
+ scrcol = 40;
+ }
+ if (x == SK_COLUMN_BREAK)
+ continue;
+ }
+
+ if (x == SK_BLANK_LINE)
{
- scrln = 3;
- scrcol = 40;
+ scrln++;
+ continue;
}
gotoxy(scrcol, scrln);
-#if DEBUG_DIAGNOSTICS
- // In diagnostic mode we show skills at 0, but only real skills
- if (x != SK_UNUSED_1 && (x <= SK_UNARMED_COMBAT || x >= SK_SPELLCASTING))
-#else
+#ifndef DEBUG_DIAGNOSTICS
if (you.skills[x] > 0)
#endif
{
@@ -1853,19 +1889,9 @@ void show_skills(void)
if (you.skills[x] == 0)
putch(' ');
else
- {
- putch(lcount);
- if (lcount == 'z')
- lcount = 'A';
- else
- lcount++;
- }
+ putch(lcount++);
#else
- putch(lcount);
- if (lcount == 'z')
- lcount = 'A';
- else
- lcount++;
+ putch(lcount++);
#endif
cprintf( " %c %-14s Skill %2d",
@@ -1900,13 +1926,6 @@ void show_skills(void)
scrln++;
}
-
- /* Extra CR between classes of weapons and such things */
- if (x == SK_STAVES || x == SK_RANGED_COMBAT || x == SK_TRAPS_DOORS
- || x == SK_UNARMED_COMBAT || x == SK_POISON_MAGIC)
- {
- scrln++;
- }
}
// if any more skills added, must adapt letters to go into caps
@@ -1927,21 +1946,22 @@ void show_skills(void)
{
lcount = 'a'; // toggle skill practise
- for (i = 0; i < 50; i++)
+ for (i = 0; i < ndisplayed_skills; i++)
{
- if (you.skills[i] == 0)
+ x = skill_display_order[i];
+ if (x == SK_BLANK_LINE || x == SK_COLUMN_BREAK)
+ continue;
+
+ if (you.skills[x] == 0)
continue;
if (get_thing == lcount)
{
- you.practise_skill[i] = (you.practise_skill[i]) ? 0 : 1;
+ you.practise_skill[x] = !you.practise_skill[x];
break;
}
- if (lcount == 'z')
- lcount = 'A';
- else
- lcount++;
+ ++lcount;
}
goto reprint_stuff;