From 9466d4967629c9b19db3cf0064f72432b8705fa9 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Wed, 19 Aug 2009 11:31:09 +0000 Subject: More doll changes: * Restrict BASE to species-fitting dolls after all. (We may want to add this once we've worked out a way to distinguish between species-dependent differences, and those the player wishes to apply to all characters. For now, it's just terribly confusing to have all characters look like Centaurs just because I prefer the brown tiles over the grey ones.) * Allow the old gnome tiles as alternative for Mountain Dwarf. * Using Enter in the doll menu confirms the current choice and automatically changes equip to the current index and mode to custom. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@10576 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/cmd-keys.h | 1 + crawl-ref/source/enum.h | 1 + crawl-ref/source/rltiles/dc-player.txt | 2 + crawl-ref/source/tilereg.cc | 75 ++++++++++++++++++++++++++++++++-- 4 files changed, 75 insertions(+), 4 deletions(-) (limited to 'crawl-ref/source') diff --git a/crawl-ref/source/cmd-keys.h b/crawl-ref/source/cmd-keys.h index 234f369ff3..a027781058 100644 --- a/crawl-ref/source/cmd-keys.h +++ b/crawl-ref/source/cmd-keys.h @@ -325,6 +325,7 @@ {1002, CMD_DOLL_SELECT_NEXT_PART}, {1004, CMD_DOLL_CHANGE_PART_PREV}, {1006, CMD_DOLL_CHANGE_PART_NEXT}, +{CK_ENTER, CMD_DOLL_CONFIRM_CHOICE}, {CONTROL('C'), CMD_DOLL_COPY}, {CONTROL('V'), CMD_DOLL_PASTE}, {'t', CMD_DOLL_TAKE_OFF}, diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h index dc22a50d6e..28629576cc 100644 --- a/crawl-ref/source/enum.h +++ b/crawl-ref/source/enum.h @@ -690,6 +690,7 @@ enum command_type CMD_DOLL_SELECT_PREV_PART, CMD_DOLL_CHANGE_PART_NEXT, CMD_DOLL_CHANGE_PART_PREV, + CMD_DOLL_CONFIRM_CHOICE, CMD_DOLL_COPY, CMD_DOLL_PASTE, CMD_DOLL_TAKE_OFF, diff --git a/crawl-ref/source/rltiles/dc-player.txt b/crawl-ref/source/rltiles/dc-player.txt index 25ffa02205..d452cbbf2e 100644 --- a/crawl-ref/source/rltiles/dc-player.txt +++ b/crawl-ref/source/rltiles/dc-player.txt @@ -22,6 +22,8 @@ deep_elf_f DEEP_ELF deep_elf_m dwarf_f DWARF dwarf_m +gnome_f +gnome_m halfling_f HALFLING halfling_m orc_f ORC diff --git a/crawl-ref/source/tilereg.cc b/crawl-ref/source/tilereg.cc index 70816def65..a22d1b6654 100644 --- a/crawl-ref/source/tilereg.cc +++ b/crawl-ref/source/tilereg.cc @@ -3264,6 +3264,60 @@ void DollEditRegion::clear() m_font_buf.clear(); } +// FIXME: Very hacky! +// Returns the starting tile for the next species in the tiles list, or the +// shadow tile if it's the last species. +static int _get_next_species_tile() +{ + switch (you.species) + { + case SP_HUMAN: + return TILEP_BASE_ELF; + case SP_HIGH_ELF: + case SP_SLUDGE_ELF: + return TILEP_BASE_DEEP_ELF; + case SP_DEEP_ELF: + return TILEP_BASE_DWARF; + case SP_MOUNTAIN_DWARF: + case SP_HALFLING: + case SP_HILL_ORC: + case SP_KOBOLD: + case SP_MUMMY: + case SP_NAGA: + case SP_OGRE: + return tilep_species_to_base_tile(you.species + 1); + case SP_TROLL: + return TILEP_BASE_DRACONIAN; + case SP_BASE_DRACONIAN: + return TILEP_BASE_DRACONIAN_RED; + case SP_RED_DRACONIAN: + case SP_WHITE_DRACONIAN: + case SP_GREEN_DRACONIAN: + case SP_YELLOW_DRACONIAN: + case SP_GREY_DRACONIAN: + case SP_BLACK_DRACONIAN: + case SP_PURPLE_DRACONIAN: + case SP_MOTTLED_DRACONIAN: + return tilep_species_to_base_tile(you.species + 1); + case SP_PALE_DRACONIAN: + return TILEP_BASE_CENTAUR; + case SP_CENTAUR: + case SP_DEMIGOD: + case SP_SPRIGGAN: + case SP_MINOTAUR: + case SP_DEMONSPAWN: + case SP_GHOUL: + case SP_KENKU: + case SP_MERFOLK: + case SP_VAMPIRE: + return tilep_species_to_base_tile(you.species + 1); + case SP_DEEP_DWARF: + return TILEP_SHADOW_SHADOW; + default: + return TILEP_BASE_HUMAN; + } +} + static int _get_next_part(int cat, int part, int inc) { // Can't increment or decrement on show equip. @@ -3272,9 +3326,14 @@ static int _get_next_part(int cat, int part, int inc) // Increment max_part by 1 to include the special value of "none". // (Except for the base, for which "none" is disallowed.) - const int bonus = (cat == TILEP_PART_BASE ? 0 : 1); - const int max_part = tile_player_part_count[cat] + bonus; - const int offset = tile_player_part_start[cat]; + int max_part = tile_player_part_count[cat] + 1; + int offset = tile_player_part_start[cat]; + + if (cat == TILEP_PART_BASE) + { + offset = tilep_species_to_base_tile(you.species); + max_part = _get_next_species_tile() - offset; + } ASSERT(inc > -max_part); @@ -3350,6 +3409,9 @@ void DollEditRegion::render() // Draw current category of parts. int max_part = tile_player_part_count[m_cat_idx]; + if (m_cat_idx == TILEP_PART_BASE) + max_part = _get_next_species_tile() - tilep_species_to_base_tile() - 1; + int show = std::min(max_show, max_part); int half_show = show / 2; for (int i = -half_show; i <= show - half_show; i++) @@ -3585,8 +3647,13 @@ void DollEditRegion::run() if (m_dolls[m_doll_idx].parts[m_cat_idx] != TILEP_SHOW_EQUIP) m_dolls[m_doll_idx].parts[m_cat_idx] = m_part_idx; break; + case CMD_DOLL_CONFIRM_CHOICE: + m_dolls[m_doll_idx].parts[m_cat_idx] = m_part_idx; + if (m_mode != TILEP_MODE_LOADING) + m_mode = TILEP_MODE_LOADING; + break; case CMD_DOLL_COPY: - m_doll_copy = m_dolls[m_doll_idx]; + m_doll_copy = m_dolls[m_doll_idx]; m_copy_valid = true; break; case CMD_DOLL_PASTE: -- cgit v1.2.3-54-g00ecf