From af3cd3ff34ef5da884b2c673afe1321f0cf372e7 Mon Sep 17 00:00:00 2001 From: ennewalker Date: Tue, 15 Jul 2008 04:07:07 +0000 Subject: Large tiles-related changes. Platform-specific rendering removed and replaced with SDL/OpenGL. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6550 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/item_use.cc | 126 +++++++++++++++++++------------------------ 1 file changed, 56 insertions(+), 70 deletions(-) (limited to 'crawl-ref/source/item_use.cc') diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index cf2efd52d2..f77688b29e 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -1364,11 +1364,6 @@ void fire_target_behaviour::message_ammo_prompt(const std::string* pre_text) colour_length = (selected_from_inventory ? 11 : 3); } -#ifdef USE_TILE - if (selected_from_inventory) - tile_draw_inv(REGION_INV1); -#endif - formatted_message_history(msg.str() .substr(0, crawl_view.msgsz.x + colour_length), MSGCH_PROMPT); @@ -4053,10 +4048,6 @@ bool enchant_armour( int &ac_change, bool quiet, item_def &arm ) if (is_cursed) do_uncurse_item( arm ); -#ifdef USE_TILE - TilePlayerRefresh(); -#endif - // No additional enchantment. return (true); } @@ -4771,77 +4762,75 @@ bool wearing_slot(int inv_slot) #ifdef USE_TILE // Interactive menu for item drop/use. -void tile_use_item(int idx, InvAction act) + +void tile_item_use_floor(int idx) { - if (act == INV_PICKUP) + if (mitm[idx].base_type == OBJ_CORPSES + && mitm[idx].sub_type != CORPSE_SKELETON + && !food_is_rotten(mitm[idx])) { - pickup_single_item(idx, mitm[idx].quantity); - return; + butchery(idx); } - else if (act == INV_DROP) +} + +void tile_item_pickup(int idx) +{ + pickup_single_item(idx, mitm[idx].quantity); +} + +void tile_item_drop(int idx) +{ + drop_item(idx, you.inv[idx].quantity); +} + +void tile_item_eat_floor(int idx) +{ + if (mitm[idx].base_type == OBJ_CORPSES + && you.species == SP_VAMPIRE + || mitm[idx].base_type == OBJ_FOOD + && you.is_undead != US_UNDEAD && you.species != SP_VAMPIRE) { - TileMoveInvCursor(-1); - drop_item(idx, you.inv[idx].quantity); - return; + if (can_ingest(mitm[idx].base_type, mitm[idx].sub_type, false)) + eat_floor_item(idx); } - else if (act == INV_USE_FLOOR) +} + +void tile_item_use_secondary(int idx) +{ + const item_def item = you.inv[idx]; + + if (item.base_type == OBJ_WEAPONS + && is_throwable(item, player_size(PSIZE_BODY))) { - if (mitm[idx].base_type == OBJ_CORPSES - && mitm[idx].sub_type != CORPSE_SKELETON - && !food_is_rotten(mitm[idx])) - { - butchery(idx); - } - return; + if (check_warning_inscriptions(item, OPER_FIRE)) + fire_thing(idx); // fire weapons } - else if (act == INV_EAT_FLOOR) + else if (item.base_type == OBJ_MISCELLANY + || item.base_type == OBJ_STAVES + && item_is_rod(item)) // unwield rods/misc. items { - if (mitm[idx].base_type == OBJ_CORPSES - && you.species == SP_VAMPIRE - || mitm[idx].base_type == OBJ_FOOD - && you.is_undead != US_UNDEAD && you.species != SP_VAMPIRE) + if (you.equip[EQ_WEAPON] == idx + && check_warning_inscriptions(item, OPER_WIELD)) { - if (can_ingest(mitm[idx].base_type, mitm[idx].sub_type, false)) - eat_floor_item(idx); + wield_weapon(true, PROMPT_GOT_SPECIAL); // unwield } - return; } - else if (act == INV_USE2) // secondary item use + else if (you.equip[EQ_WEAPON] == idx + && check_warning_inscriptions(item, OPER_WIELD)) { - const item_def item = you.inv[idx]; - - if (item.base_type == OBJ_WEAPONS - && is_throwable(item, player_size(PSIZE_BODY))) - { - if (check_warning_inscriptions(item, OPER_FIRE)) - fire_thing(idx); // fire weapons - } - else if (item.base_type == OBJ_MISCELLANY - || item.base_type == OBJ_STAVES - && item_is_rod(item)) // unwield rods/misc. items - { - if (you.equip[EQ_WEAPON] == idx - && check_warning_inscriptions(item, OPER_WIELD)) - { - wield_weapon(true, PROMPT_GOT_SPECIAL); // unwield - } - } - else if (you.equip[EQ_WEAPON] == idx - && check_warning_inscriptions(item, OPER_WIELD)) - { - wield_weapon(true, PROMPT_GOT_SPECIAL); // unwield - } - else if (_valid_weapon_swap(item) - && check_warning_inscriptions(item, OPER_WIELD)) - { - // secondary wield for several spells and such - wield_weapon(true, idx); // wield - } - - return; + wield_weapon(true, PROMPT_GOT_SPECIAL); // unwield } - else if (act != INV_USE) - return; + else if (_valid_weapon_swap(item) + && check_warning_inscriptions(item, OPER_WIELD)) + { + // secondary wield for several spells and such + wield_weapon(true, idx); // wield + } +} + +void tile_item_use(int idx) +{ + const item_def item = you.inv[idx]; // Equipped? bool equipped = false; @@ -4857,9 +4846,6 @@ void tile_use_item(int idx, InvAction act) } } - TileMoveInvCursor(-1); - const item_def item = you.inv[idx]; - // Special case for folks who are wielding something // that they shouldn't be wielding. // Note that this is only a problem for equipables -- cgit v1.2.3-54-g00ecf