diff options
-rw-r--r-- | crawl-ref/source/acr.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/player.cc | 29 | ||||
-rw-r--r-- | crawl-ref/source/tilepick.cc | 54 | ||||
-rw-r--r-- | crawl-ref/source/tilereg.cc | 94 | ||||
-rw-r--r-- | crawl-ref/source/tilereg.h | 1 |
5 files changed, 144 insertions, 36 deletions
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc index f7364fa457..853c16a791 100644 --- a/crawl-ref/source/acr.cc +++ b/crawl-ref/source/acr.cc @@ -3435,6 +3435,8 @@ static bool _initialise(void) if (Options.tile_menu_icons && Options.show_inventory_weights) Options.show_inventory_weights = false; + init_player_doll(); + tiles.resize(); #endif diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index c1f4e21a71..0a7f16c50e 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -3088,10 +3088,6 @@ void level_change(bool skip_attribute_increase) break; case SP_MOUNTAIN_DWARF: - // lowered because of HD raise -- bwr - // if (you.experience_level < 14) - // hp_adjust++; - if (!(you.experience_level % 2)) hp_adjust++; @@ -3202,10 +3198,6 @@ void level_change(bool skip_attribute_increase) break; case SP_NAGA: - // lower because of HD raise -- bwr - // if (you.experience_level < 14) - // hp_adjust++; - hp_adjust++; if (!(you.experience_level % 4)) @@ -3249,6 +3241,9 @@ void level_change(bool skip_attribute_increase) case SP_BASE_DRACONIAN: if (you.experience_level == 7) { +#ifdef USE_TILE + init_player_doll(); +#endif switch (you.species) { case SP_RED_DRACONIAN: @@ -3267,19 +3262,24 @@ void level_change(bool skip_attribute_increase) break; case SP_YELLOW_DRACONIAN: - mpr("Your scales start taking on a golden yellow colour.", MSGCH_INTRINSIC_GAIN); + mpr("Your scales start taking on a golden yellow colour.", + MSGCH_INTRINSIC_GAIN); break; case SP_BLACK_DRACONIAN: - mpr("Your scales start turning black.", MSGCH_INTRINSIC_GAIN); + mpr("Your scales start turning black.", + MSGCH_INTRINSIC_GAIN); break; case SP_PURPLE_DRACONIAN: - mpr("Your scales start taking on a rich purple colour.", MSGCH_INTRINSIC_GAIN); + mpr("Your scales start taking on a rich purple colour.", + MSGCH_INTRINSIC_GAIN); break; case SP_MOTTLED_DRACONIAN: - mpr("Your scales start taking on a weird mottled pattern.", MSGCH_INTRINSIC_GAIN); + mpr("Your scales start taking on a weird mottled pattern.", + MSGCH_INTRINSIC_GAIN); break; case SP_PALE_DRACONIAN: - mpr("Your scales start fading to a pale grey colour.", MSGCH_INTRINSIC_GAIN); + mpr("Your scales start fading to a pale grey colour.", + MSGCH_INTRINSIC_GAIN); break; case SP_BASE_DRACONIAN: mpr(""); @@ -3326,6 +3326,9 @@ void level_change(bool skip_attribute_increase) case SP_GREY_DRACONIAN: if (you.experience_level == 7) { +#ifdef USE_TILE + init_player_doll(); +#endif mpr("Your scales start turning grey.", MSGCH_INTRINSIC_GAIN); more(); diff --git a/crawl-ref/source/tilepick.cc b/crawl-ref/source/tilepick.cc index 1a79526ac8..e736c2f5da 100644 --- a/crawl-ref/source/tilepick.cc +++ b/crawl-ref/source/tilepick.cc @@ -2716,9 +2716,7 @@ static inline void _finalize_tile(unsigned int *tile, void tilep_calc_flags(const int parts[], int flag[]) { - int i; - - for (i = 0; i < TILEP_PART_MAX; i++) + for (unsigned i = 0; i < TILEP_PART_MAX; i++) flag[i] = TILEP_FLAG_NORMAL; if (parts[TILEP_PART_HELM] - 1 >= TILEP_HELM_HELM_OFS) @@ -2865,16 +2863,20 @@ void tilep_race_default(int race, int gender, int level, int *parts) case SP_PURPLE_DRACONIAN: case SP_MOTTLED_DRACONIAN: case SP_PALE_DRACONIAN: + { + const int colour_offset = _draconian_colour(race, level); + result = TILEP_BASE_DRACONIAN + colour_offset * 2; hair = 0; + int st = tile_player_part_start[TILEP_PART_DRCHEAD]; + parts[TILEP_PART_DRCHEAD] = st + colour_offset; + if (player_mutation_level(MUT_BIG_WINGS)) { - int st = tile_player_part_start[TILEP_PART_DRCWING]; - parts[TILEP_PART_DRCWING] = st + _draconian_colour(race, level); + st = tile_player_part_start[TILEP_PART_DRCWING]; + parts[TILEP_PART_DRCWING] = st + colour_offset; } - - result = TILEP_BASE_DRACONIAN + _draconian_colour(race, level) * 2; break; - + } case SP_CENTAUR: result = TILEP_BASE_CENTAUR; break; @@ -2930,6 +2932,7 @@ void tilep_race_default(int race, int gender, int level, int *parts) if (gender == TILEP_GENDER_MALE) result++; + parts[TILEP_PART_BASE] = result; parts[TILEP_PART_HAIR] = hair; parts[TILEP_PART_BEARD] = beard; @@ -3251,7 +3254,6 @@ void tilep_scan_parts(char *fbuf, int *parts) int ccount = 0; for (int i = 0; parts_saved[i] != -1; i++) { - int idx; ccount = 0; int p = parts_saved[i]; @@ -3264,7 +3266,24 @@ void tilep_scan_parts(char *fbuf, int *parts) ibuf[ccount] = '\0'; gcount++; - idx = tilep_str_to_part(ibuf); + int idx = tilep_str_to_part(ibuf); + if (p == TILEP_PART_BASE) + parts[p] += idx % 2; + else if (idx == 0) + parts[p] = 0; + else if (idx == TILEP_SHOW_EQUIP) + continue; + else if (idx > tile_player_part_count[p]) + parts[p] = tile_player_part_start[p]; + else + { + int idx2 = tile_player_part_start[p] + idx - 1; + if (idx2 < TILE_MAIN_MAX || idx2 >= TILEP_PLAYER_MAX) + parts[p] = TILEP_SHOW_EQUIP; + else + parts[p] = idx2; + } +/* if (p == TILEP_PART_BASE) { int p0 = (parts[p]-1) & (0xfe); @@ -3274,13 +3293,24 @@ void tilep_scan_parts(char *fbuf, int *parts) } else if (idx == TILEP_SHOW_EQUIP) parts[p] = TILEP_SHOW_EQUIP; + else + parts[p] = 0; +*/ +/* + else if (idx < TILE_MAIN_MAX) + parts[p] = TILE_MAIN_MAX; + else if (idx >= TILEP_PLAYER_MAX) + parts[p] = TILEP_PLAYER_MAX - 1; else if (idx < 0) parts[p] = 0; // TODO enne - is this right? did the old count end at idx not just subtotal? - else if (idx > tile_player_part_count[p]) - parts[p] = tile_player_part_count[p]; + else if (idx >= tile_player_part_count[p]) + parts[p] = tile_player_part_count[p] - 1; +// else if (idx > tilep_parts_total[p]) // bound it +// parts[p] = tilep_parts_total[p]; else parts[p] = idx; +*/ } } diff --git a/crawl-ref/source/tilereg.cc b/crawl-ref/source/tilereg.cc index b7ee5377c7..32231aafec 100644 --- a/crawl-ref/source/tilereg.cc +++ b/crawl-ref/source/tilereg.cc @@ -14,6 +14,7 @@ REVISION("$Rev$"); #include "cio.h" #include "debug.h" #include "describe.h" +#include "files.h" #include "food.h" #include "itemname.h" #include "it_use2.h" @@ -289,25 +290,98 @@ void DungeonRegion::pack_background(unsigned int bg, int x, int y) m_buf_dngn.add(TILE_RAY_OUT_OF_RANGE, x, y); } -void DungeonRegion::pack_player(int x, int y) +// static void _load_doll_data(const char *fn, dolls_data *dolls, int max, +// int *mode, int *cur) +static void _load_doll_data(const char *fn, dolls_data *doll) +{ + char fbuf[1024]; + FILE *fp = NULL; + + std::string dollsTxtString = datafile_path(fn, false, true); + const char *dollsTxt = (dollsTxtString.c_str()[0] == 0) ? + "dolls.txt" : dollsTxtString.c_str(); + + if ( (fp = fopen(dollsTxt, "r")) == NULL ) + { + mpr("File not found."); + // File doesn't exist. By default, use equipment defaults. + // This will be saved out (if possible). + + // Don't take gender too seriously. -- Enne + tilep_race_default(you.species, coinflip() ? 1 : 0, + you.experience_level, doll->parts); + + doll->parts[TILEP_PART_SHADOW] = TILEP_SHADOW_SHADOW; + +#if 0 + // For some reason I can't reset this although it's used identically + // elsewhere. (jpeg) + for (unsigned int j = 0; j < TILEP_PART_MAX; ++j) + doll->parts[j] = TILEP_SHOW_EQUIP; +#endif + } + else + { + memset(fbuf, 0, sizeof(fbuf)); + int cur = 0; + if (fscanf(fp, "%s", fbuf) != EOF) + { +#if 0 + mpr("Read MODE."); + if (strcmp(fbuf, "MODE=LOADING") == 0) + mode0 = TILEP_M_LOADING; +#endif + } + if (fscanf(fp, "%s", fbuf) != EOF) + { + if (strncmp(fbuf, "NUM=", 4) == 0) + { + sscanf(fbuf, "NUM=%d", &cur); + if (cur < 0 || cur > 10) + cur = 0; + } + } + + int count = 0; + while (fscanf(fp, "%s", fbuf) != EOF) + { + if (cur == count++) + { + tilep_scan_parts(fbuf, doll->parts); + break; + } + } + if (cur >= count) + { + mprf(MSGCH_WARN, "Doll %d could not be found in '%s'.", + cur, dollsTxt); + } + + fclose(fp); + } +} + +static dolls_data player_doll; + +void init_player_doll() { dolls_data default_doll; - dolls_data player_doll; - dolls_data result; - for (int i = 0; i < TILEP_PART_MAX; i++) + for (unsigned int i = 0; i < TILEP_PART_MAX; ++i) default_doll.parts[i] = TILEP_SHOW_EQUIP; - int gender = you.your_name[0] % 2; + int gender = coinflip(); tilep_race_default(you.species, gender, you.experience_level, default_doll.parts); - result = default_doll; + _load_doll_data("dolls.txt", &default_doll); + player_doll = default_doll; +} - result.parts[TILEP_PART_BASE] = default_doll.parts[TILEP_PART_BASE]; - result.parts[TILEP_PART_DRCHEAD] = default_doll.parts[TILEP_PART_DRCHEAD]; - result.parts[TILEP_PART_DRCWING] = default_doll.parts[TILEP_PART_DRCWING]; +void DungeonRegion::pack_player(int x, int y) +{ + dolls_data result = player_doll; const bool halo = inside_halo(you.pos()); result.parts[TILEP_PART_HALO] = halo ? TILEP_HALO_TSO : 0; @@ -740,7 +814,6 @@ void DungeonRegion::render() // Draw text tags. // TODO enne - be more intelligent about not covering stuff up for (int y = 0; y < ENV_SHOW_DIAMETER; y++) - { for (int x = 0; x < ENV_SHOW_DIAMETER; x++) { coord_def ep(x, y); @@ -760,7 +833,6 @@ void DungeonRegion::render() m_tag_font->render_string(pc.x, pc.y, def.text, min_pos, max_pos, WHITE, false); } - } } void DungeonRegion::clear() diff --git a/crawl-ref/source/tilereg.h b/crawl-ref/source/tilereg.h index 17bd2d56b3..da8d36f8b0 100644 --- a/crawl-ref/source/tilereg.h +++ b/crawl-ref/source/tilereg.h @@ -440,5 +440,6 @@ protected: VertBuffer<PTVert> m_buf; }; +void init_player_doll(); #endif #endif |