From 1e9eaa16a3e3094313a712145d44a7d8763bf5ef Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Thu, 18 Jun 2009 07:27:45 +0000 Subject: Allow tile players to toggle their avatar between job default, equipment, or predefined. Also, remove a stupid debugging statement. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9997 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/acr.cc | 1 - crawl-ref/source/tilepick.cc | 6 +++--- crawl-ref/source/tilereg.cc | 36 ++++++++++++++++++++++++++++++++++-- 3 files changed, 37 insertions(+), 6 deletions(-) (limited to 'crawl-ref/source') diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc index aa1934a2dd..f35eb1586e 100644 --- a/crawl-ref/source/acr.cc +++ b/crawl-ref/source/acr.cc @@ -1328,7 +1328,6 @@ static void _print_friendly_pickup_setting(bool was_changed) void process_command( command_type cmd ) { apply_berserk_penalty = true; - mprf("cmd: %d", cmd); switch (cmd) { #ifdef USE_TILE diff --git a/crawl-ref/source/tilepick.cc b/crawl-ref/source/tilepick.cc index 344193e21e..f290df51f6 100644 --- a/crawl-ref/source/tilepick.cc +++ b/crawl-ref/source/tilepick.cc @@ -2934,7 +2934,7 @@ void tilep_race_default(int race, int gender, int level, int *parts) result++; parts[TILEP_PART_BASE] = result; - //Don't overwrite doll parts defined elsewhere. + // Don't overwrite doll parts defined elsewhere. if (parts[TILEP_PART_HAIR] == TILEP_SHOW_EQUIP) parts[TILEP_PART_HAIR] = hair; if (parts[TILEP_PART_BEARD] == TILEP_SHOW_EQUIP) @@ -3296,12 +3296,12 @@ void tilep_print_parts(char *fbuf, int *parts) { int i; char *ptr = fbuf; - for (i = 0; parts_saved[i] != -1; i++) + for (i = 0; parts_saved[i] != -1; ++i) { int p = parts_saved[i]; if (p == TILEP_PART_BASE) // 0:female 1:male { - sprintf(ptr, "%03d", parts[p]%2); + sprintf(ptr, "%03d", parts[p] % 2); ptr += 3; } else diff --git a/crawl-ref/source/tilereg.cc b/crawl-ref/source/tilereg.cc index e1a0c7cd32..538bc31256 100644 --- a/crawl-ref/source/tilereg.cc +++ b/crawl-ref/source/tilereg.cc @@ -20,6 +20,7 @@ REVISION("$Rev$"); #include "it_use2.h" #include "item_use.h" #include "items.h" +#include "macro.h" #include "message.h" #include "misc.h" #include "menu.h" @@ -342,7 +343,7 @@ static void _load_doll_data(const char *fn, dolls_data *doll) if (strncmp(fbuf, "NUM=", 4) == 0) { sscanf(fbuf, "NUM=%d", &cur); - if (cur < 0 || cur >= 10) + if (cur < 0 || cur > 10) cur = 0; } } @@ -374,6 +375,7 @@ void init_player_doll() for (unsigned int i = 0; i < TILEP_PART_MAX; ++i) default_doll.parts[i] = TILEP_SHOW_EQUIP; + mpr("loaded equipment"); _load_doll_data("dolls.txt", &default_doll); if (gender == -1) @@ -397,7 +399,37 @@ void TilePlayerEdit() // * If dolls.txt missing, possibly (C)reate the file with // dummy values (MODE=DEFAULT, 10 variable dolls). - mpr("Sorry, this command has not yet been implemented."); + mpr("Pick (d)efault doll for job, use (e)quipment settings, or (l)oad " + "from file?"); + + char ch = (char) getchm(KMC_DEFAULT); + ch = tolower(ch); + + dolls_data default_doll; + + for (unsigned int i = 0; i < TILEP_PART_MAX; ++i) + default_doll.parts[i] = TILEP_SHOW_EQUIP; + + tilep_race_default(you.species, gender, + you.experience_level, default_doll.parts); + + mpr("loaded equipment"); + if (ch == 'd') + { + tilep_job_default(you.char_class, gender, default_doll.parts); + } + else if (ch == 'e') + { + // nothing to be done + } + else if (ch == 'l') + { + _load_doll_data("dolls.txt", &default_doll); + } + else + return; + + player_doll = default_doll; // TODO 2: Allow saving back of customized dolls. // * Use pack_player (split into 2 methods) to fill the (C)urrent equipment. -- cgit v1.2.3-54-g00ecf