From 6e44de32ed92d31968e1490c7d10ba27e98ee392 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Tue, 8 Jul 2008 12:33:36 +0000 Subject: Apply Abyss unlinked item fix and the changes to the starting equipment to 0.4. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/branches/stone_soup-0.4@6456 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/abyss.cc | 25 ++++++++++++---- crawl-ref/source/items.cc | 14 +++++++-- crawl-ref/source/misc.cc | 4 +-- crawl-ref/source/newgame.cc | 71 +++++++++++++++++++++++++++++++++----------- crawl-ref/source/tutorial.cc | 17 ++++++++++- 5 files changed, 104 insertions(+), 27 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/abyss.cc b/crawl-ref/source/abyss.cc index e3e850af08..2ded18e8a7 100644 --- a/crawl-ref/source/abyss.cc +++ b/crawl-ref/source/abyss.cc @@ -74,13 +74,15 @@ static bool _place_feature_near( const coord_def ¢re, return (false); } +//#define DEBUG_ABYSS + // Public for abyss generation. void generate_abyss() { int i, j; // loop variables int temp_rand; // probability determination {dlb} -#if DEBUG_ABYSS +#ifdef DEBUG_ABYSS mprf(MSGCH_DIAGNOSTICS, "generate_abyss(); turn_on_level: %d", env.turns_on_level); #endif @@ -157,7 +159,7 @@ static void _generate_area(int gx1, int gy1, int gx2, int gy2, bool placed_abyssal_rune = find_floor_item(OBJ_MISCELLANY, MISC_RUNE_OF_ZOT); -#if DEBUG_ABYSS +#ifdef DEBUG_ABYSS mprf(MSGCH_DIAGNOSTICS, "_generate_area(). turns_on_level: %d, rune_on_floor: %s", env.turns_on_level, placed_abyssal_rune? "yes" : "no"); @@ -403,7 +405,8 @@ static void _abyss_lose_monster(monsters &mons) void area_shift(void) { #ifdef DEBUG_ABYSS - mpr("area_shift().", MSGCH_DIAGNOSTICS); + mprf(MSGCH_DIAGNOSTICS, "area_shift() - player at pos (%d, %d)", + you.x_pos, you.y_pos); #endif // Preserve floor props around the player, primarily so that @@ -469,6 +472,10 @@ void area_shift(void) grd[i][j] = DNGN_UNSEEN; // Nuke items. +#ifdef DEBUG_ABYSS + if (igrd[i][j] != NON_ITEM) + mprf(MSGCH_DIAGNOSTICS, "Nuke item stack at (%d, %d)", i, j); +#endif lose_item_stack( i, j ); if (mgrd[i][j] != NON_MONSTER) @@ -476,12 +483,12 @@ void area_shift(void) } // Shift all monsters & items to new area. - for (int i = you.x_pos - 10; i < you.x_pos + 11; i++) + for (int i = you.x_pos - 10; i <= you.x_pos + 10; i++) { if (i < 0 || i >= GXM) continue; - for (int j = you.y_pos - 10; j < you.y_pos + 11; j++) + for (int j = you.y_pos - 10; j <= you.y_pos + 10; j++) { if (j < 0 || j >= GYM) continue; @@ -493,6 +500,14 @@ void area_shift(void) grd[ipos][jpos] = grd[i][j]; // Move item. +#ifdef DEBUG_ABYSS + if (igrd[i][j] != NON_ITEM) + { + mprf(MSGCH_DIAGNOSTICS, + "Move item stack from (%d, %d) to (%d, %d)", + i, j, ipos, jpos); + } +#endif move_item_stack_to_grid( i, j, ipos, jpos ); // Move monster. diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc index e373e6f93b..ccce30d015 100644 --- a/crawl-ref/source/items.cc +++ b/crawl-ref/source/items.cc @@ -1686,11 +1686,11 @@ bool move_item_to_grid( int *const obj, int x, int y ) // Need to actually move object, so first unlink from old position. unlink_item( *obj ); - // move item to coord: + // Move item to coord. mitm[*obj].x = x; mitm[*obj].y = y; - // link item to top of list. + // Link item to top of list. mitm[*obj].link = igrd[x][y]; igrd[x][y] = *obj; @@ -1710,11 +1710,21 @@ bool move_item_to_grid( int *const obj, int x, int y ) void move_item_stack_to_grid( int x, int y, int targ_x, int targ_y ) { + if (igrd[x][y] == NON_ITEM) + return; + // Tell all items in stack what the new coordinate is. for (int o = igrd[x][y]; o != NON_ITEM; o = mitm[o].link) { mitm[o].x = targ_x; mitm[o].y = targ_y; + + // Link last of the stack to the top of the old stack. + if (mitm[o].link == NON_ITEM && igrd[targ_x][targ_y] != NON_ITEM) + { + mitm[o].link = igrd[targ_x][targ_y]; + break; + } } igrd[targ_x][targ_y] = igrd[x][y]; diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc index 2ebe2153f9..7e23bd12e7 100644 --- a/crawl-ref/source/misc.cc +++ b/crawl-ref/source/misc.cc @@ -2730,8 +2730,8 @@ bool stop_attack_prompt(const monsters *mon, bool beam_attack, else if (inSanctuary || wontAttack || (isNeutral || isHoly) && is_good_god(you.religion) || isUnchivalric - && you.religion == GOD_SHINING_ONE - && !tso_unchivalric_attack_safe_monster(mon)) + && you.religion == GOD_SHINING_ONE + && !tso_unchivalric_attack_safe_monster(mon)) { // "Really fire through the helpless neutral holy Daeva?" // was: "Really fire through this helpless neutral holy creature?" diff --git a/crawl-ref/source/newgame.cc b/crawl-ref/source/newgame.cc index b1611fa5c9..7a966c159f 100644 --- a/crawl-ref/source/newgame.cc +++ b/crawl-ref/source/newgame.cc @@ -1437,7 +1437,6 @@ static char_choice_restriction _class_allowed( species_type speci, case SP_KOBOLD: case SP_SPRIGGAN: case SP_NAGA: - case SP_CENTAUR: case SP_OGRE: case SP_OGRE_MAGE: case SP_TROLL: @@ -4015,6 +4014,24 @@ job_query: return (you.char_class != JOB_UNKNOWN && you.species != SP_UNKNOWN); } +bool _needs_butchering_tool() +{ + // Mummies/Vampires don't eat. + // Ghouls have claws (see below). + if (you.is_undead) + return (false); + + // Trolls have claws. + if (you.has_claws()) + return (false); + + // Spriggans don't eat meat. + if (you.mutation[MUT_HERBIVOROUS] == 3) + return (false); + + return (true); +} + bool _give_items_skills() { char keyn; @@ -4626,8 +4643,9 @@ bool _give_items_skills() break; case JOB_WIZARD: - if (!you.is_undead && !you.has_claws()) - _newgame_make_item(0, EQ_WEAPON, OBJ_WEAPONS, WPN_KNIFE); + // The knife is a tool, not a weapon, so don't start wielding it. + if (_needs_butchering_tool()) + _newgame_make_item(0, EQ_NONE, OBJ_WEAPONS, WPN_KNIFE); _newgame_make_item(1, EQ_BODY_ARMOUR, OBJ_ARMOUR, ARM_ROBE); _newgame_make_item(2, EQ_HELMET, OBJ_ARMOUR, ARM_WIZARD_HAT); @@ -4660,8 +4678,9 @@ bool _give_items_skills() break; case JOB_CONJURER: - if (!you.is_undead && !you.has_claws()) - _newgame_make_item(0, EQ_WEAPON, OBJ_WEAPONS, WPN_KNIFE); + // The knife is a tool, not a weapon, so don't start wielding it. + if (_needs_butchering_tool()) + _newgame_make_item(0, EQ_NONE, OBJ_WEAPONS, WPN_KNIFE); _newgame_make_item(1, EQ_BODY_ARMOUR, OBJ_ARMOUR, ARM_ROBE); @@ -4703,8 +4722,9 @@ bool _give_items_skills() break; case JOB_SUMMONER: - if (!you.is_undead && !you.has_claws()) - _newgame_make_item(0, EQ_WEAPON, OBJ_WEAPONS, WPN_KNIFE); + // The knife is a tool, not a weapon, so don't start wielding it. + if (_needs_butchering_tool()) + _newgame_make_item(0, EQ_NONE, OBJ_WEAPONS, WPN_KNIFE); _newgame_make_item(1, EQ_BODY_ARMOUR, OBJ_ARMOUR, ARM_ROBE); _newgame_make_item(2, EQ_NONE, OBJ_BOOKS, BOOK_CALLINGS); @@ -4716,8 +4736,9 @@ bool _give_items_skills() break; case JOB_NECROMANCER: - if (!you.is_undead && !you.has_claws()) - _newgame_make_item(0, EQ_WEAPON, OBJ_WEAPONS, WPN_KNIFE); + // The knife is a tool, not a weapon, so don't start wielding it. + if (_needs_butchering_tool()) + _newgame_make_item(0, EQ_NONE, OBJ_WEAPONS, WPN_KNIFE); _newgame_make_item(1, EQ_BODY_ARMOUR, OBJ_ARMOUR, ARM_ROBE); _newgame_make_item(2, EQ_NONE, OBJ_BOOKS, BOOK_NECROMANCY); @@ -4785,8 +4806,9 @@ bool _give_items_skills() break; case JOB_FIRE_ELEMENTALIST: - if (!you.is_undead && !you.has_claws()) - _newgame_make_item(0, EQ_WEAPON, OBJ_WEAPONS, WPN_KNIFE); + // The knife is a tool, not a weapon, so don't start wielding it. + if (_needs_butchering_tool()) + _newgame_make_item(0, EQ_NONE, OBJ_WEAPONS, WPN_KNIFE); _newgame_make_item(1, EQ_BODY_ARMOUR, OBJ_ARMOUR, ARM_ROBE); _newgame_make_item(2, EQ_NONE, OBJ_BOOKS, BOOK_FLAMES); @@ -4799,8 +4821,9 @@ bool _give_items_skills() break; case JOB_ICE_ELEMENTALIST: - if (!you.is_undead && !you.has_claws()) - _newgame_make_item(0, EQ_WEAPON, OBJ_WEAPONS, WPN_KNIFE); + // The knife is a tool, not a weapon, so don't start wielding it. + if (_needs_butchering_tool()) + _newgame_make_item(0, EQ_NONE, OBJ_WEAPONS, WPN_KNIFE); _newgame_make_item(1, EQ_BODY_ARMOUR, OBJ_ARMOUR, ARM_ROBE); _newgame_make_item(2, EQ_NONE, OBJ_BOOKS, BOOK_FROST); @@ -4813,7 +4836,10 @@ bool _give_items_skills() break; case JOB_AIR_ELEMENTALIST: - _newgame_make_item(0, EQ_WEAPON, OBJ_WEAPONS, WPN_KNIFE); + // The knife is a tool, not a weapon, so don't start wielding it. + if (_needs_butchering_tool()) + _newgame_make_item(0, EQ_NONE, OBJ_WEAPONS, WPN_KNIFE); + _newgame_make_item(1, EQ_BODY_ARMOUR, OBJ_ARMOUR, ARM_ROBE); _newgame_make_item(2, EQ_NONE, OBJ_BOOKS, BOOK_AIR); @@ -4825,8 +4851,9 @@ bool _give_items_skills() break; case JOB_EARTH_ELEMENTALIST: - if (!you.is_undead && !you.has_claws()) - _newgame_make_item(0, EQ_WEAPON, OBJ_WEAPONS, WPN_KNIFE); + // The knife is a tool, not a weapon, so don't start wielding it. + if (_needs_butchering_tool()) + _newgame_make_item(0, EQ_NONE, OBJ_WEAPONS, WPN_KNIFE); _newgame_make_item(1, EQ_BODY_ARMOUR, OBJ_ARMOUR, ARM_ROBE); _newgame_make_item(2, EQ_NONE, OBJ_BOOKS, BOOK_GEOMANCY); @@ -4932,7 +4959,8 @@ bool _give_items_skills() _newgame_make_item(0, EQ_WEAPON, OBJ_WEAPONS, WPN_DAGGER); switch (you.species) - { case SP_MOUNTAIN_DWARF: + { + case SP_MOUNTAIN_DWARF: case SP_HILL_ORC: case SP_CENTAUR: case SP_OGRE: @@ -4969,18 +4997,27 @@ bool _give_items_skills() _newgame_make_item(1, EQ_NONE, OBJ_WEAPONS, WPN_SLING); _newgame_make_item(2, EQ_NONE, OBJ_MISSILES, MI_SLING_BULLET, -1, 15 + random2avg(21, 5) + random2avg(15, 2)); + + // Wield the sling instead. + you.equip[EQ_WEAPON] = 1; break; case SP_MOUNTAIN_DWARF: _newgame_make_item(1, EQ_NONE, OBJ_WEAPONS, WPN_CROSSBOW); _newgame_make_item(2, EQ_NONE, OBJ_MISSILES, MI_BOLT, -1, 15 + random2avg(21, 5)); + + // Wield the crossbow instead. + you.equip[EQ_WEAPON] = 1; break; default: _newgame_make_item(1, EQ_NONE, OBJ_WEAPONS, WPN_BOW); _newgame_make_item(2, EQ_NONE, OBJ_MISSILES, MI_ARROW, -1, 15 + random2avg(21, 5)); + + // Wield the bow instead. + you.equip[EQ_WEAPON] = 1; break; } diff --git a/crawl-ref/source/tutorial.cc b/crawl-ref/source/tutorial.cc index d817947e01..66beec0fa4 100644 --- a/crawl-ref/source/tutorial.cc +++ b/crawl-ref/source/tutorial.cc @@ -1239,13 +1239,28 @@ void tutorial_first_monster(const monsters &mon) text = "However, as a hunter you will want to deal with it using your " "bow. If you have a look at your bow from your " "inventory, you'll find an explanation of how to do " - "this. First wield it, then follow the instructions."; + "this. "; + + if (you.equip[EQ_WEAPON] == -1 + || you.inv[you.equip[EQ_WEAPON]].base_type != OBJ_WEAPONS + || you.inv[you.equip[EQ_WEAPON]].sub_type != WPN_BOW) + { + text += "First wield it, then follow the instructions."; #ifdef USE_TILE text += EOL "As a short-cut you can also right-click on your " "bow to read its description, and left-click to wield " "it."; #endif + } +#ifdef USE_TILE + else + { + text += "Clicking with your right mouse button on your bow " + "will also let you read its description."; + } +#endif + formatted_message_history(text, MSGCH_TUTORIAL, 0, _get_tutorial_cols()); -- cgit v1.2.3-54-g00ecf