Add a new dialogue mode to recharge items

This is currently useless, as exhausting an item's charges currently deletes it, but it is part of a work in progress
This commit is contained in:
2024-08-29 00:23:53 -04:00
committed by Celtic Minstrel
parent 6965b822dc
commit 753dbbcc59
12 changed files with 38 additions and 10 deletions

View File

@@ -643,7 +643,7 @@ std::istream& operator>> (std::istream& in, eLighting& light) {
cEnumLookup talk_nodes = {
"reg","if-sdf","set-sdf","inn","if-time","if-event","if-town","shop","train","jobs",
"","","","sell-weap","sell-prot","sell-any","id","ench","buy-info","buy-sdf",
"","","recharge","sell-weap","sell-prot","sell-any","id","ench","buy-info","buy-sdf",
"buy-ship","buy-horse","buy-spec-item","quest","buy-town","end-force","end-fight","end-alarm","end-die","call-local",
"call-global",
};

View File

@@ -965,6 +965,15 @@ void handle_item_shop_action(short item_hit) {
shopper.combine_things();
}
break;
case MODE_RECHARGE:
if(!take_gold(shop_identify_cost,false))
ASB("Recharge: You don't have the gold.");
else {
play_sound(68);
ASB("Your item is recharged.");
target.charges += 5;
}
break;
case MODE_SELL_WEAP: case MODE_SELL_ARMOR: case MODE_SELL_ANY:
play_sound(-39);
univ.party.gold += store_selling_values[i];

View File

@@ -56,6 +56,7 @@ enum eStatMode {
MODE_SELL_ARMOR = 4,
MODE_SELL_ANY = 5,
MODE_ENCHANT = 6,
MODE_RECHARGE = 7,
};
static const signed char dir_x_dif[9] = {0,1,1,1,0,-1,-1,-1,0};

View File

@@ -918,12 +918,20 @@ void handle_talk_node(int which_talk_entry) {
put_item_screen(stat_window);
give_help(42,43);
break;
case eTalkNode::IDENTIFY: case eTalkNode::ENCHANT:
case eTalkNode::IDENTIFY:
stat_screen_mode = MODE_IDENTIFY,
give_help(44, 0);
if(false) // Skip first line of fallthrough
case eTalkNode::ENCHANT:
stat_screen_mode = MODE_ENCHANT,
give_help(45, 0);
if(false) // Skip first line of fallthrough
case eTalkNode::RECHARGE:
stat_screen_mode = MODE_RECHARGE,
give_help(66, 0);
can_save_talk = false;
stat_screen_mode = (ttype == eTalkNode::IDENTIFY) ? MODE_IDENTIFY : MODE_ENCHANT;
shop_identify_cost = a;
put_item_screen(stat_window);
give_help(ttype == eTalkNode::IDENTIFY ? 44 : 45,0);
break;
case eTalkNode::BUY_INFO:
if(univ.party.gold < a) {

View File

@@ -1437,7 +1437,7 @@ void boom_space(location where,short mode,short type,short damage,short sound) {
// dir = 0 - down, 1 - left, 2 - right, 3 - up, 4 - down/left, 5 - up/left, 6 - up/right, 7 - down/right
// pos = row or column to centre the arrow in, range 0..8, ignored for dir >= 4
static void draw_one_pointing_arrow(int dir, int pos) {
rectangle from_rect = {62, 1, 70, 9};
rectangle from_rect = {62, 61, 70, 69};
from_rect.offset(9 * (dir % 4), 9 * (dir / 4));
rectangle ter_view_rect = win_to_rects[WINRECT_TERVIEW];

View File

@@ -368,7 +368,7 @@ void put_item_screen(eItemWinMode screen_num) {
void place_buy_button(short position,short pc_num,short item_num) {
rectangle dest_rect,source_rect;
rectangle button_sources[3] = {{24,0,36,30},{36,0,48,30},{48,0,60,30}};
rectangle button_sources[4] = {{24,0,36,30},{36,0,48,30},{48,0,60,30},{60,0,72,30}};
short val_to_place;
const cPlayer& pc = univ.party[pc_num];
@@ -392,6 +392,13 @@ void place_buy_button(short position,short pc_num,short item_num) {
val_to_place = shop_identify_cost;
}
break;
case MODE_RECHARGE:
if(item.charges == 0 && item.can_use()) {
item_area_button_active[position][ITEMBTN_SPEC] = true;
source_rect = button_sources[3];
val_to_place = shop_identify_cost;
}
break;
case MODE_SELL_WEAP:
if((*item.variety).is_weapon && !pc.equip[item_num] && item.ident && val_to_place > 0 && !item.unsellable) {
item_area_button_active[position][ITEMBTN_SPEC] = true;

View File

@@ -42,6 +42,7 @@ enum class eTalkNode {
SHOP = 7,
TRAINING = 8,
JOB_BANK = 9,
RECHARGE = 12,
SELL_WEAPONS = 13,
SELL_ARMOR = 14,
SELL_ITEMS = 15,

View File

@@ -1064,7 +1064,7 @@ static bool check_talk_xtra(cDialog& me, std::stack<node_ref_t>& talk_edit_stack
case eTalkNode::BUY_INFO: case eTalkNode::DEP_ON_TIME: case eTalkNode::DEP_ON_TIME_AND_EVENT: case eTalkNode::REGULAR:
case eTalkNode::END_ALARM: case eTalkNode::END_DIE: case eTalkNode::END_FIGHT: case eTalkNode::END_FORCE:
case eTalkNode::IDENTIFY: case eTalkNode::SELL_ARMOR: case eTalkNode::SELL_ITEMS: case eTalkNode::SELL_WEAPONS:
case eTalkNode::TRAINING: case eTalkNode::JOB_BANK:
case eTalkNode::TRAINING: case eTalkNode::JOB_BANK: case eTalkNode::RECHARGE:
break;
}