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

@@ -163,6 +163,8 @@ Inventory Screen. Pressing these buttons does something with the item, such as s
identify it. When two of these nodes are used in a row, the buttons created by the second identify it. When two of these nodes are used in a row, the buttons created by the second
node replace the buttons created by the first.</p> node replace the buttons created by the first.</p>
<p><b>Node Type 12 - Recharge </b>The text in Text 1 is the response, and the party can
recharge all their items. A is the cost to recharge.</p>
<p><b>Node Type 13 - Sell Weapons</b>The text in Text 1 is the response, and the party can <p><b>Node Type 13 - Sell Weapons</b>The text in Text 1 is the response, and the party can
sell all their identified weapons.</p> sell all their identified weapons.</p>
<p><b>Node Type 14 - Sell Armor </b>The text in Text 1 is the response, and the party can <p><b>Node Type 14 - Sell Armor </b>The text in Text 1 is the response, and the party can

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View File

@@ -63,7 +63,7 @@ This command bring up a map of the area you're in. Generally, maps of dungeons a
Your health is a measure of how much punishment you can take before dying - the more the better. Whenever you get hit, you lose some health. Taking damage when your health is down to 0 will kill you. Your health is a measure of how much punishment you can take before dying - the more the better. Whenever you get hit, you lose some health. Taking damage when your health is down to 0 will kill you.
Your spell points are what you expend to cast spells. Each spell drains away some of your spell points. Time and rest restore them. When creating a character, you get 3 bonus spell points for every level of Mage and Priest Spells skill you buy. Your spell points are what you expend to cast spells. Each spell drains away some of your spell points. Time and rest restore them. When creating a character, you get 3 bonus spell points for every level of Mage and Priest Spells skill you buy.
Some doors can't be opened no matter what you try. For example, portcullises can almost never be opened by picking locks or bashing. Some doors can't be opened no matter what you try. For example, portcullises can almost never be opened by picking locks or bashing.
This character will, for a fee, recharge some of your items whose charges have been exhausted. Click on the 'Inc' button by the item to get it recharged.
A special node just triggered, and since you previously enabled it, you are now in step-through mode. Take a look at the transcript - it gives you the node that is about to execute, together with the type and number (useful if you need to locate it in the editor). A special node just triggered, and since you previously enabled it, you are now in step-through mode. Take a look at the transcript - it gives you the node that is about to execute, together with the type and number (useful if you need to locate it in the editor).
To execute that node, simply press any key (or click the mouse button). After the node has executed, if it calls another one, you will see it in the transcript. Keep pressing a key to step through the nodes. If you wish to exit step-through mode in the middle of a node sequence, simply press Escape. To execute that node, simply press any key (or click the mouse button). After the node has executed, if it calls another one, you will see it in the transcript. Keep pressing a key to step through the nodes. If you wish to exit step-through mode in the middle of a node sequence, simply press Escape.

View File

@@ -82,8 +82,8 @@ Unused
Unused Unused
Unused Unused
Unused Unused
Unused Node Type Recharge Items
Unused Cost to recharge
Unused Unused
Unused Unused
Unused Unused

View File

@@ -643,7 +643,7 @@ std::istream& operator>> (std::istream& in, eLighting& light) {
cEnumLookup talk_nodes = { cEnumLookup talk_nodes = {
"reg","if-sdf","set-sdf","inn","if-time","if-event","if-town","shop","train","jobs", "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", "buy-ship","buy-horse","buy-spec-item","quest","buy-town","end-force","end-fight","end-alarm","end-die","call-local",
"call-global", "call-global",
}; };

View File

@@ -965,6 +965,15 @@ void handle_item_shop_action(short item_hit) {
shopper.combine_things(); shopper.combine_things();
} }
break; 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: case MODE_SELL_WEAP: case MODE_SELL_ARMOR: case MODE_SELL_ANY:
play_sound(-39); play_sound(-39);
univ.party.gold += store_selling_values[i]; univ.party.gold += store_selling_values[i];

View File

@@ -56,6 +56,7 @@ enum eStatMode {
MODE_SELL_ARMOR = 4, MODE_SELL_ARMOR = 4,
MODE_SELL_ANY = 5, MODE_SELL_ANY = 5,
MODE_ENCHANT = 6, MODE_ENCHANT = 6,
MODE_RECHARGE = 7,
}; };
static const signed char dir_x_dif[9] = {0,1,1,1,0,-1,-1,-1,0}; 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); put_item_screen(stat_window);
give_help(42,43); give_help(42,43);
break; 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; can_save_talk = false;
stat_screen_mode = (ttype == eTalkNode::IDENTIFY) ? MODE_IDENTIFY : MODE_ENCHANT;
shop_identify_cost = a; shop_identify_cost = a;
put_item_screen(stat_window); put_item_screen(stat_window);
give_help(ttype == eTalkNode::IDENTIFY ? 44 : 45,0);
break; break;
case eTalkNode::BUY_INFO: case eTalkNode::BUY_INFO:
if(univ.party.gold < a) { 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 // 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 // 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) { 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)); from_rect.offset(9 * (dir % 4), 9 * (dir / 4));
rectangle ter_view_rect = win_to_rects[WINRECT_TERVIEW]; 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) { void place_buy_button(short position,short pc_num,short item_num) {
rectangle dest_rect,source_rect; 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; short val_to_place;
const cPlayer& pc = univ.party[pc_num]; 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; val_to_place = shop_identify_cost;
} }
break; 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: case MODE_SELL_WEAP:
if((*item.variety).is_weapon && !pc.equip[item_num] && item.ident && val_to_place > 0 && !item.unsellable) { 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; item_area_button_active[position][ITEMBTN_SPEC] = true;

View File

@@ -42,6 +42,7 @@ enum class eTalkNode {
SHOP = 7, SHOP = 7,
TRAINING = 8, TRAINING = 8,
JOB_BANK = 9, JOB_BANK = 9,
RECHARGE = 12,
SELL_WEAPONS = 13, SELL_WEAPONS = 13,
SELL_ARMOR = 14, SELL_ARMOR = 14,
SELL_ITEMS = 15, 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::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::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::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; break;
} }