Debian Codegraph @

src/borg/borg1.h

raw symbols ◀ ▶
Source reconstructed at patch state 0 of 2 — not the installed (fully patched) source.
2 Debian patches touch this file
1
2 /* File: borg1.h */
3 /* Purpose: Header file for "borg1.c" -BEN- */
4
5 #ifndef INCLUDED_BORG1_H
6 #define INCLUDED_BORG1_H
7
8 #include "angband.h"
9 #include "init.h"
10 #include "obj-tval.h"
11 #include "obj-util.h"
12 #include "cave.h"
13 #include "monster.h"
14 #include "player.h"
15 #include "player-timed.h"
16 #include "ui-menu.h"
17 #include "ui-term.h"
18
19
20 #ifdef ALLOW_BORG
21
22 /* Mega-Hack - indices of the player classes */
23 #define CLASS_WARRIOR 0
24 #define CLASS_MAGE 1
25 #define CLASS_DRUID 2
26 #define CLASS_PRIEST 3
27 #define CLASS_NECROMANCER 4
28 #define CLASS_PALADIN 5
29 #define CLASS_ROGUE 6
30 #define CLASS_RANGER 7
31 #define CLASS_BLACKGUARD 8
32
33 #define MAX_CLASSES 9 /* Max # of classes 0 = warrior, 5 = Paladin */
34
35 #include "../effects.h"
36
37 /*
38 * Indexes used for various "equipment" slots (hard-coded by savefiles, etc).
39 */
40 #define INVEN_WIELD z_info->pack_size
41 #define INVEN_BOW (z_info->pack_size+1)
42 #define INVEN_RIGHT (z_info->pack_size+2)
43 #define INVEN_LEFT (z_info->pack_size+3)
44 #define INVEN_NECK (z_info->pack_size+4)
45 #define INVEN_LIGHT (z_info->pack_size+5)
46 #define INVEN_BODY (z_info->pack_size+6)
47 #define INVEN_OUTER (z_info->pack_size+7)
48 #define INVEN_ARM (z_info->pack_size+8)
49 #define INVEN_HEAD (z_info->pack_size+9)
50 #define INVEN_HANDS (z_info->pack_size+10)
51 #define INVEN_FEET (z_info->pack_size+11)
52
53 /*
54 * Total number of inventory slots.
55 */
56 #define INVEN_TOTAL (z_info->pack_size+12)
57
58 /*
59 * Total number of pack slots available (not used by quiver)
60 */
61 #define PACK_SLOTS (z_info->pack_size - borg_skill[BI_QUIVER_SLOTS])
62
63 /* Quiver */
64 #define QUIVER_START INVEN_TOTAL
65 #define QUIVER_SIZE (z_info->quiver_size)
66 #define QUIVER_END (QUIVER_START+QUIVER_SIZE)
67
68
69 /* s_val's now dynamically loaded */
70 extern int sv_food_apple;
71 extern int sv_food_ration;
72 extern int sv_food_slime_mold;
73 extern int sv_food_draught;
74 extern int sv_food_pint;
75 extern int sv_food_sip;
76 extern int sv_food_waybread;
77 extern int sv_food_honey_cake;
78 extern int sv_food_slice;
79 extern int sv_food_handful;
80
81 extern int sv_mush_second_sight;
82 extern int sv_mush_fast_recovery;
83 extern int sv_mush_restoring;
84 extern int sv_mush_mana;
85 extern int sv_mush_emergency;
86 extern int sv_mush_terror;
87 extern int sv_mush_stoneskin;
88 extern int kv_mush_stoneskin;
89 extern int sv_mush_debility;
90 extern int sv_mush_sprinting;
91 extern int sv_mush_cure_mind;
92 extern int sv_mush_purging;
93
94 extern int sv_light_lantern;
95 extern int sv_light_torch;
96
97 extern int sv_flask_oil;
98 extern int kv_flask_oil;
99
100 extern int sv_potion_cure_critical;
101 extern int sv_potion_cure_serious;
102 extern int sv_potion_cure_light;
103 extern int sv_potion_healing;
104 extern int kv_potion_healing;
105 extern int sv_potion_star_healing;
106 extern int sv_potion_life;
107 extern int sv_potion_restore_mana;
108 extern int kv_potion_restore_mana;
109 extern int sv_potion_cure_poison;
110 extern int sv_potion_resist_heat;
111 extern int sv_potion_resist_cold;
112 extern int sv_potion_resist_pois;
113 extern int sv_potion_inc_str;
114 extern int sv_potion_inc_int;
115 extern int sv_potion_inc_wis;
116 extern int sv_potion_inc_dex;
117 extern int sv_potion_inc_con;
118 extern int sv_potion_inc_str2;
119 extern int sv_potion_inc_int2;
120 extern int sv_potion_inc_wis2;
121 extern int sv_potion_inc_dex2;
122 extern int sv_potion_inc_con2;
123 extern int sv_potion_inc_all;
124 extern int sv_potion_restore_life;
125 extern int sv_potion_speed;
126 extern int sv_potion_berserk;
127 extern int sv_potion_sleep;
128 extern int sv_potion_slowness;
129 extern int sv_potion_poison;
130 extern int sv_potion_blindness;
131 extern int sv_potion_confusion;
132 extern int sv_potion_heroism;
133 extern int sv_potion_boldness;
134 extern int sv_potion_detect_invis;
135 extern int sv_potion_enlightenment;
136 extern int sv_potion_slime_mold;
137 extern int sv_potion_berserk;
138 extern int sv_potion_infravision;
139 extern int sv_potion_inc_exp;
140
141 extern int sv_scroll_identify;
142 extern int sv_scroll_phase_door;
143 extern int sv_scroll_teleport;
144 extern int sv_scroll_word_of_recall;
145 extern int sv_scroll_enchant_armor;
146 extern int sv_scroll_enchant_weapon_to_hit;
147 extern int sv_scroll_enchant_weapon_to_dam;
148 extern int sv_scroll_star_enchant_weapon;
149 extern int sv_scroll_star_enchant_armor;
150 extern int sv_scroll_protection_from_evil;
151 extern int sv_scroll_rune_of_protection;
152 extern int sv_scroll_teleport_level;
153 extern int sv_scroll_recharging;
154 extern int sv_scroll_banishment;
155 extern int sv_scroll_mass_banishment;
156 extern int kv_scroll_mass_banishment;
157 extern int sv_scroll_blessing;
158 extern int sv_scroll_holy_chant;
159 extern int sv_scroll_holy_prayer;
160 extern int sv_scroll_detect_invis;
161 extern int sv_scroll_satisfy_hunger;
162 extern int sv_scroll_light;
163 extern int sv_scroll_mapping;
164 extern int sv_scroll_acquirement;
165 extern int sv_scroll_star_acquirement;
166 extern int sv_scroll_remove_curse;
167 extern int kv_scroll_remove_curse;
168 extern int sv_scroll_star_remove_curse;
169 extern int kv_scroll_star_remove_curse;
170 extern int sv_scroll_monster_confusion;
171 extern int sv_scroll_trap_door_destruction;
172 extern int sv_scroll_dispel_undead;
173
174 extern int sv_ring_flames;
175 extern int sv_ring_ice;
176 extern int sv_ring_acid;
177 extern int sv_ring_lightning;
178 extern int sv_ring_digging;
179 extern int sv_ring_speed;
180 extern int sv_ring_damage;
181 extern int sv_ring_dog;
182
183 extern int sv_amulet_teleportation;
184
185 extern int sv_rod_recall;
186 extern int kv_rod_recall;
187 extern int sv_rod_detection;
188 extern int sv_rod_illumination;
189 extern int sv_rod_speed;
190 extern int sv_rod_mapping;
191 extern int sv_rod_healing;
192 extern int kv_rod_healing;
193 extern int sv_rod_light;
194 extern int sv_rod_fire_bolt;
195 extern int sv_rod_elec_bolt;
196 extern int sv_rod_cold_bolt;
197 extern int sv_rod_acid_bolt;
198 extern int sv_rod_drain_life;
199 extern int sv_rod_fire_ball;
200 extern int sv_rod_elec_ball;
201 extern int sv_rod_cold_ball;
202 extern int sv_rod_acid_ball;
203 extern int sv_rod_teleport_other;
204 extern int sv_rod_slow_monster;
205 extern int sv_rod_sleep_monster;
206 extern int sv_rod_curing;
207
208 extern int sv_staff_teleportation;
209 extern int sv_staff_destruction;
210 extern int sv_staff_speed;
211 extern int sv_staff_healing;
212 extern int sv_staff_the_magi;
213 extern int sv_staff_power;
214 extern int sv_staff_curing;
215 extern int sv_staff_holiness;
216 extern int kv_staff_holiness;
217 extern int sv_staff_sleep_monsters;
218 extern int sv_staff_slow_monsters;
219 extern int sv_staff_detect_invis;
220 extern int sv_staff_detect_evil;
221 extern int sv_staff_dispel_evil;
222 extern int sv_staff_banishment;
223 extern int sv_staff_light;
224 extern int sv_staff_mapping;
225 extern int sv_staff_remove_curse;
226
227 extern int sv_wand_light;
228 extern int sv_wand_teleport_away;
229 extern int sv_wand_stinking_cloud;
230 extern int kv_wand_stinking_cloud;
231 extern int sv_wand_magic_missile;
232 extern int kv_wand_magic_missile;
233 extern int sv_wand_annihilation;
234 extern int kv_wand_annihilation;
235 extern int sv_wand_stone_to_mud;
236 extern int sv_wand_wonder;
237 extern int sv_wand_hold_monster;
238 extern int sv_wand_slow_monster;
239 extern int sv_wand_fear_monster;
240 extern int sv_wand_confuse_monster;
241 extern int sv_wand_fire_bolt;
242 extern int sv_wand_cold_bolt;
243 extern int sv_wand_acid_bolt;
244 extern int sv_wand_elec_bolt;
245 extern int sv_wand_fire_ball;
246 extern int sv_wand_cold_ball;
247 extern int sv_wand_acid_ball;
248 extern int sv_wand_elec_ball;
249 extern int sv_wand_dragon_cold;
250 extern int sv_wand_dragon_fire;
251 extern int sv_wand_drain_life;
252
253 extern int sv_dagger;
254
255 extern int sv_sling;
256 extern int sv_sling;
257 extern int sv_short_bow;
258 extern int sv_long_bow;
259 extern int sv_light_xbow;
260 extern int sv_heavy_xbow;
261
262 extern int sv_arrow_seeker;
263 extern int sv_arrow_mithril;
264
265 extern int sv_bolt_seeker;
266 extern int sv_bolt_mithril;
267
268 extern int sv_set_of_leather_gloves;
269
270 extern int sv_cloak;
271
272 extern int sv_robe;
273
274 extern int sv_iron_crown;
275
276 extern int sv_dragon_blue;
277 extern int sv_dragon_black;
278 extern int sv_dragon_white;
279 extern int sv_dragon_red;
280 extern int sv_dragon_green;
281 extern int sv_dragon_multihued;
282 extern int sv_dragon_shining;
283 extern int sv_dragon_law;
284 extern int sv_dragon_gold;
285 extern int sv_dragon_chaos;
286 extern int sv_dragon_balance;
287 extern int sv_dragon_power;
288
289 /* dynamically loaded activations */
290 extern int act_dragon_power;
291 extern int act_dragon_shining;
292 extern int act_dragon_balance;
293 extern int act_dragon_law;
294 extern int act_dragon_chaos;
295 extern int act_dragon_gold;
296 extern int act_dragon_multihued;
297 extern int act_dragon_red;
298 extern int act_dragon_green;
299 extern int act_dragon_blue;
300 extern int act_ring_lightning;
301 extern int act_ring_ice;
302 extern int act_ring_flames;
303 extern int act_ring_acid;
304 extern int act_shroom_purging;
305 extern int act_shroom_sprinting;
306 extern int act_shroom_debility;
307 extern int act_shroom_stone;
308 extern int act_shroom_terror;
309 extern int act_shroom_emergency;
310 extern int act_food_waybread;
311 extern int act_drink_breath;
312 extern int act_staff_holy;
313 extern int act_staff_magi;
314 extern int act_wand_breath;
315 extern int act_wonder;
316 extern int act_berserker;
317 extern int act_starlight2;
318 extern int act_starlight;
319 extern int act_polymorph;
320 extern int act_door_dest;
321 extern int act_disable_traps;
322 extern int act_light_line;
323 extern int act_mon_scare;
324 extern int act_sleep_all;
325 extern int act_mon_confuse;
326 extern int act_mon_slow;
327 extern int act_confuse2;
328 extern int act_tele_other;
329 extern int act_stone_to_mud;
330 extern int act_stinking_cloud;
331 extern int act_arrow;
332 extern int act_bizarre;
333 extern int act_mana_bolt;
334 extern int act_missile;
335 extern int act_drain_life4;
336 extern int act_drain_life3;
337 extern int act_drain_life2;
338 extern int act_drain_life1;
339 extern int act_elec_ball2;
340 extern int act_elec_ball;
341 extern int act_elec_bolt;
342 extern int act_acid_ball;
343 extern int act_acid_bolt3;
344 extern int act_acid_bolt2;
345 extern int act_acid_bolt;
346 extern int act_cold_ball160;
347 extern int act_cold_ball100;
348 extern int act_cold_ball50;
349 extern int act_cold_ball2;
350 extern int act_cold_bolt2;
351 extern int act_cold_bolt;
352 extern int act_fire_ball200;
353 extern int act_fire_ball2;
354 extern int act_fire_ball;
355 extern int act_fire_bolt72;
356 extern int act_fire_bolt3;
357 extern int act_fire_bolt2;
358 extern int act_fire_bolt;
359 extern int act_firebrand;
360 extern int act_rem_fear_pois;
361 extern int act_restore_life;
362 extern int act_rage_bless_resist;
363 extern int act_star_ball;
364 extern int act_sleepii;
365 extern int act_dispel_all;
366 extern int act_dispel_undead;
367 extern int act_dispel_evil60;
368 extern int act_dispel_evil;
369 extern int act_haste2;
370 extern int act_haste1;
371 extern int act_haste;
372 extern int act_probing;
373 extern int act_clairvoyance;
374 extern int act_illumination;
375 extern int act_loskill;
376 extern int act_losconf;
377 extern int act_lossleep;
378 extern int act_losslow;
379 extern int act_destruction2;
380 extern int act_earthquakes;
381 extern int act_deep_descent;
382 extern int act_recall;
383 extern int act_blessing3;
384 extern int act_blessing2;
385 extern int act_blessing;
386 extern int act_satisfy;
387 extern int act_protevil;
388 extern int act_banishment;
389 extern int act_recharge;
390 extern int act_destroy_doors;
391 extern int act_glyph;
392 extern int act_mapping;
393 extern int act_confusing;
394 extern int act_tele_level;
395 extern int act_tele_long;
396 extern int act_tele_phase;
397 extern int act_light;
398 extern int act_remove_curse2;
399 extern int act_remove_curse;
400 extern int act_enchant_armor2;
401 extern int act_enchant_armor;
402 extern int act_enchant_weapon;
403 extern int act_enchant_todam;
404 extern int act_enchant_tohit;
405 extern int act_detect_objects;
406 extern int act_detect_all;
407 extern int act_detect_evil;
408 extern int act_detect_invis;
409 extern int act_detect_treasure;
410 extern int act_resist_all;
411 extern int act_resist_pois;
412 extern int act_resist_cold;
413 extern int act_resist_fire;
414 extern int act_resist_elec;
415 extern int act_resist_acid;
416 extern int act_shero;
417 extern int act_hero;
418 extern int act_enlightenment;
419 extern int act_tmd_esp;
420 extern int act_tmd_sinvis;
421 extern int act_tmd_infra;
422 extern int act_tmd_free_act;
423 extern int act_restore_st_lev;
424 extern int act_restore_all;
425 extern int act_restore_con;
426 extern int act_restore_dex;
427 extern int act_restore_wis;
428 extern int act_restore_int;
429 extern int act_restore_str;
430 extern int act_nimbleness;
431 extern int act_toughness;
432 extern int act_contemplation;
433 extern int act_intellect;
434 extern int act_brawn;
435 extern int act_restore_mana;
436 extern int act_restore_exp;
437 extern int act_heal3;
438 extern int act_heal2;
439 extern int act_heal1;
440 extern int act_cure_temp;
441 extern int act_cure_nonorlybig;
442 extern int act_cure_full2;
443 extern int act_cure_full;
444 extern int act_cure_critical;
445 extern int act_cure_serious;
446 extern int act_cure_light;
447 extern int act_cure_body;
448 extern int act_cure_mind;
449 extern int act_cure_confusion;
450 extern int act_cure_paranoia;
451
452
453 /* WARNING: If you mess with the objects.txt or the monster.txt and change
454 * the locations of things, then you must make those changes in borg.txt
455 * as well as in this borg code. The borg is very concerned about item
456 * index locations. ie: borgs_has[POTION_HEAL] is looking for a Potion of Healing.
457 * The borg is concerned over several items, broken swords, and several
458 * monster locations (Tarresque, Sauron, Morgoth).
459 */
460
461 /*
462 * This file provides support for "borg1.c".
463 */
464
465 /*** Some constants ***/
466
467
468 /*
469 * Maximum possible dungeon size
470 */
471 /* NOTE: this corrisponds to z_info->dungeon_hgt/dungeon_wid */
472 /* a test is done at the start of borg to make sure the values are right */
473 #define DUNGEON_WID 198
474 #define DUNGEON_HGT 66
475
476 #define AUTO_MAX_X DUNGEON_WID
477 #define AUTO_MAX_Y DUNGEON_HGT
478
479 enum BORG_MONBLOW
480 {
481 MONBLOW_NONE,
482 MONBLOW_HURT,
483 MONBLOW_POISON,
484 MONBLOW_DISENCHANT,
485 MONBLOW_DRAIN_CHARGES,
486 MONBLOW_EAT_GOLD,
487 MONBLOW_EAT_ITEM,
488 MONBLOW_EAT_FOOD,
489 MONBLOW_EAT_LIGHT,
490 MONBLOW_ACID,
491 MONBLOW_ELEC,
492 MONBLOW_FIRE,
493 MONBLOW_COLD,
494 MONBLOW_BLIND,
495 MONBLOW_CONFUSE,
496 MONBLOW_TERRIFY,
497 MONBLOW_PARALYZE,
498 MONBLOW_LOSE_STR,
499 MONBLOW_LOSE_INT,
500 MONBLOW_LOSE_WIS,
501 MONBLOW_LOSE_DEX,
502 MONBLOW_LOSE_CON,
503 MONBLOW_LOSE_ALL,
504 MONBLOW_SHATTER,
505 MONBLOW_EXP_10,
506 MONBLOW_EXP_20,
507 MONBLOW_EXP_40,
508 MONBLOW_EXP_80,
509 MONBLOW_HALLU,
510 MONBLOW_BLACK_BREATH,
511 MONBLOW_UNDEFINED
512 };
513
514 /*
515 * Flags for the "info" field of grids
516 *
517 * Note that some of the flags below are not "perfect", in particular,
518 * several of the flags should be treated as "best guesses", see below.
519 *
520 * The "BORG_MARK" flag means that the grid has been "observed", though
521 * the terrain feature may or may not be memorized. Note the use of the
522 * "FEAT_NONE" and "FEAT_FLOOR" feature codes below.
523 *
524 * The "BORG_GLOW" flag means that a grid is probably "perma-lit", but
525 * sometimes it is really only "recently" perma-lit, but was then made
526 * dark with a darkness attack, and it is now torch-lit or off-screen.
527 *
528 * The "BORG_DARK" flag means that a grid is probably not "perma-lit",
529 * but sometimes it is really only "recently" dark, but was then made
530 * "lite" with a "call lite" spell, and it is now torch-lit or off-screen.
531 *
532 * The "BORG_LIGHT" flag means that a grid is probably lit by the player
533 * torch, but this may not be true if the nearby "BORG_VIEW" flags are
534 * not correct, or if the "lite radius" has changed recently.
535 *
536 * The "BORG_VIEW" flag means that a grid is probably in line of sight
537 * of the player, but this may not be true if some of the grids between
538 * the player and the grid contain previously unseen walls/doors/etc.
539 *
540 * The "BORG_TEMP" flag means that a grid has been added to the array
541 * "borg_temp_x"/"borg_temp_y", though normally we ignore this flag.
542 *
543 * The "BORG_XTRA" flag is used for various "extra" purposes, primarily
544 * to assist with the "update_view()" code.
545 */
546 #define BORG_MARK 0x01 /* observed grid */
547 #define BORG_GLOW 0x02 /* probably perma-lit */
548 #define BORG_DARK 0x04 /* probably not perma-lit */
549 #define BORG_OKAY 0x08 /* on the current panel */
550 #define BORG_LIGHT 0x10 /* lit by the torch */
551 #define BORG_VIEW 0x20 /* in line of sight */
552 #define BORG_TEMP 0x40 /* temporary flag */
553 #define BORG_XTRA 0x80 /* extra flag */
554
555
556 /*
557 * Maximum size of the "lite" array
558 */
559 #define AUTO_LIGHT_MAX 1536
560
561 /*
562 * All of the various attacks or projections the borg can do.
563 !FIX !TODO !AJG probably want to externalize this somehow.
564 */
565 enum
566 {
567 BORG_ATTACK_MISSILE,
568 BORG_ATTACK_ARROW,
569 BORG_ATTACK_MANA,
570 BORG_ATTACK_METEOR,
571 BORG_ATTACK_ACID,
572 BORG_ATTACK_ELEC,
573 BORG_ATTACK_FIRE,
574 BORG_ATTACK_COLD,
575 BORG_ATTACK_POIS,
576 BORG_ATTACK_ICE,
577 BORG_ATTACK_HOLY_ORB,
578 BORG_ATTACK_DISP_UNDEAD,
579 BORG_ATTACK_DISP_EVIL,
580 BORG_ATTACK_DISP_SPIRITS,
581 BORG_ATTACK_SLEEP_EVIL,
582 BORG_ATTACK_HOLY_WORD,
583 BORG_ATTACK_LIGHT_WEAK,
584 BORG_ATTACK_OLD_DRAIN,
585 BORG_ATTACK_KILL_WALL,
586 BORG_ATTACK_NETHER,
587 BORG_ATTACK_CHAOS,
588 BORG_ATTACK_GRAVITY,
589 BORG_ATTACK_SHARD,
590 BORG_ATTACK_SOUND,
591 BORG_ATTACK_PLASMA,
592 BORG_ATTACK_CONFU,
593 BORG_ATTACK_DISEN,
594 BORG_ATTACK_NEXUS,
595 BORG_ATTACK_FORCE,
596 BORG_ATTACK_INERTIA,
597 BORG_ATTACK_TIME,
598 BORG_ATTACK_LIGHT,
599 BORG_ATTACK_DARK,
600 BORG_ATTACK_WATER,
601 BORG_ATTACK_OLD_HEAL,
602 BORG_ATTACK_OLD_CLONE,
603 BORG_ATTACK_OLD_SPEED,
604 BORG_ATTACK_DARK_WEAK,
605 BORG_ATTACK_KILL_DOOR,
606 BORG_ATTACK_KILL_TRAP,
607 BORG_ATTACK_MAKE_WALL,
608 BORG_ATTACK_MAKE_DOOR,
609 BORG_ATTACK_MAKE_TRAP,
610 BORG_ATTACK_AWAY_UNDEAD,
611 BORG_ATTACK_TURN_EVIL,
612 BORG_ATTACK_AWAY_ALL,
613 BORG_ATTACK_AWAY_ALL_MORGOTH,
614 BORG_ATTACK_DISP_ALL,
615 BORG_ATTACK_OLD_CONF,
616 BORG_ATTACK_TURN_ALL,
617 BORG_ATTACK_OLD_SLOW,
618 BORG_ATTACK_OLD_SLEEP,
619 BORG_ATTACK_OLD_POLY,
620 BORG_ATTACK_TURN_UNDEAD,
621 BORG_ATTACK_AWAY_EVIL,
622 BORG_ATTACK_TAP_UNLIFE,
623 BORG_ATTACK_DRAIN_LIFE,
624 };
625
626 /*
627 * Player race constants (hard-coded by save-files, arrays, etc)
628 */
629 #define RACE_HUMAN 0
630 #define RACE_HALF_ELF 1
631 #define RACE_ELF 2
632 #define RACE_HOBBIT 3
633 #define RACE_GNOME 4
634 #define RACE_DWARF 5
635 #define RACE_HALF_ORC 6
636 #define RACE_HALF_TROLL 7
637 #define RACE_DUNADAN 8
638 #define RACE_HIGH_ELF 9
639 #define RACE_KOBOLD 10
640 #define MAX_RACES 11
641
642
643 /*
644 * Maximum size of the "view" array
645 */
646 /*#define AUTO_VIEW_MAX 1536*/
647 #define AUTO_VIEW_MAX 9000
648
649
650 /*
651 * Number of grids in the "temp" array
652 */
653 #define AUTO_TEMP_MAX 9000
654
655
656 /*
657 * Number of grids in the "flow" array
658 */
659 #define AUTO_FLOW_MAX 1536
660
661
662
663 /*
664 * Enable the "borg_note()" usage of the Recall Window
665 * Also specify the number of "rolling rows" to use
666 */
667 #define BORG_NOTE_ROWS 12
668
669 /*
670 * Threshold where the borg will attempt to dig things
671 */
672 #define BORG_DIG 13
673 #define BORG_DIG_HARD 40
674
675 /*
676 * Size of Keypress buffer
677 */
678 #define KEY_SIZE 8192
679
680
681
682
683 /*
684 * Object information
685 */
686
687 typedef struct borg_take borg_take;
688
689 struct borg_take
690 {
691 struct object_kind* kind; /* Kind */
692 bool known; /* Verified kind */
693 bool seen; /* Assigned motion */
694 bool extra; /* Unused */
695 bool orbed; /* Orb of Draining cast on it */
696 uint8_t x, y; /* Location */
697 int16_t when; /* When last seen */
698 int value; /* Estimated value of item */
699 int tval; /* Known tval */
700 };
701
702
703 /*
704 * Monster information
705 */
706
707 typedef struct borg_kill borg_kill;
708
709 struct borg_kill
710 {
711 unsigned int r_idx; /* Race index */
712
713 bool known; /* Verified race */
714 bool awake; /* Probably awake */
715
716 bool confused; /* Probably confused */
717 bool afraid; /* Probably afraid */
718 bool quiver; /* Probably quivering */
719 bool stunned;
720 bool poisoned; /* Probably poisoned */
721
722 bool seen; /* Assigned motion */
723 bool used; /* Assigned message */
724
725 uint8_t x, y; /* Location */
726
727 uint8_t ox, oy; /* Old location */
728
729 uint8_t speed; /* Estimated speed */
730 uint8_t moves; /* Estimates moves */
731 uint8_t ranged_attack; /* qty of ranged attacks */
732 uint8_t spell[RSF_MAX]; /* spell flag for monster spells */
733 int16_t power; /* Estimated hit-points */
734 int16_t injury; /* Percent wounded */
735 int16_t other; /* Estimated something */
736 int16_t level; /* Monsters Level */
737 uint32_t spell_flags[RF_MAX]; /* Monster race spell flags preloaded */
738 int16_t when; /* When last seen */
739 int16_t m_idx; /* Game's index */
740 };
741
742
743
744 /*
745 * Forward declare
746 */
747 typedef struct borg_grid borg_grid;
748
749 /*
750 * A grid in the dungeon. Several uint8_ts.
751 *
752 * There is a set of eight bit flags (see below) called "info".
753 *
754 * There is a terrain feature type, which may be incorrect. It is
755 * more or less based on the standard "feature" values, but some of
756 * the legal values are never used, such as "secret door", and others
757 * are used in bizarre ways, such as "invisible trap".
758 *
759 * There is an object index into the "object tracking" array.
760 *
761 * There is a monster index into the "monster tracking" array.
762 *
763 * There is a byte "hmmm" which is currently unused.
764 *
765 * There is a byte "xtra" which tracks how much "searching" has been done
766 * in the grid or in any grid next to the grid.
767 *
768 * To perform "navigation" from one place to another, the "flow" routines
769 * are used, which place "cost" information into the "cost" fields. Then,
770 * if the path is clear, the "cost" information is copied into the "flow"
771 * fields, which are used for the actual navigation. This allows multiple
772 * routines to check for "possible" flowing, without hurting the current
773 * flow, which may have taken a long time to construct. We also assume
774 * that the Borg never needs to follow a path longer than 250 grids long.
775 * Note that the "cost" fields have been moved into external arrays.
776 *
777 * Hack -- note that the "char" zero will often crash the system!
778 */
779 struct borg_grid
780 {
781 uint8_t feat; /* Grid type */
782 uint8_t info; /* Grid flags */
783 bool trap;
784 bool glyph;
785 uint8_t store;
786
787 uint8_t take; /* Object index */
788 uint8_t kill; /* Monster index */
789
790 uint8_t hmmm; /* Extra field (unused) */
791
792 uint8_t xtra; /* Extra field (search count) */
793 };
794
795
796 /*
797 * Forward declare
798 */
799 typedef struct borg_data borg_data;
800
801 /*
802 * Hack -- one byte of info per grid
803 *
804 * We use a structure to encapsulate the data into a "typed" form.
805 */
806 struct borg_data
807 {
808 uint8_t data[AUTO_MAX_Y][AUTO_MAX_X];
809 };
810
811
812
813
814 /*** Some macros ***/
815
816
817 /*
818 * Determine "twice" the distance between two points
819 * This results in "diagonals" being "correctly" ranged,
820 * that is, a diagonal appears "furthur" than an adjacent.
821 */
822 #define double_distance(Y1,X1,Y2,X2) \
823 (borg_distance(((int)(Y1))<<1,((int)(X1))<<1,((int)(Y2))<<1,((int)(X2))<<1))
824
825
826
827 /*** Some variables ***/
828
829
830 /*
831 * Some variables
832 */
833 extern bool borg_active; /* Actually active */
834 extern bool borg_resurrect; /* Continous play mode */
835 extern bool borg_cancel; /* Being cancelled */
836 extern bool borg_scumming_pots; /* Borg will quickly store pots in home */
837
838 extern char genocide_target; /* Identity of the poor unsuspecting soul */
839 extern int borg_zap_slot; /* to avoid a nasty game bug with amnesia */
840 extern bool borg_casted_glyph; /* we dont have a launch messages anymore */
841 extern bool borg_dont_react;
842 extern int successful_target;
843 extern int sold_item_tval[10];
844 extern int sold_item_sval[10];
845 extern int sold_item_pval[10];
846 extern int sold_item_store[10];
847 extern int sold_item_num;
848 extern int sold_item_nxt;
849 extern int bought_item_tval[10];
850 extern int bought_item_sval[10];
851 extern int bought_item_pval[10];
852 extern int bought_item_store[10];
853 extern int bought_item_num;
854 extern int bought_item_nxt;
855
856 extern const char * shop_menu_items;
857 extern uint8_t borg_nasties_num;
858 extern uint8_t borg_nasties_count[7];
859 extern char borg_nasties[7];
860 extern uint8_t borg_nasties_limit[7];
861
862 extern bool borg_init_failure;
863 extern bool borg_lunal_mode;
864 extern bool borg_munchkin_mode;
865
866 extern int borg_money_scum_who;
867 extern int borg_money_scum_ware;
868
869
870 /* options from the borg.txt file */
871 /* IMPORTANT keep these in sync with borg_settings in borg9.c */
872 enum
873 {
874 BORG_VERBOSE,
875 BORG_MUNCHKIN_START,
876 BORG_MUNCHKIN_LEVEL,
877 BORG_MUNCHKIN_DEPTH,
878 BORG_WORSHIPS_DAMAGE,
879 BORG_WORSHIPS_SPEED,
880 BORG_WORSHIPS_HP,
881 BORG_WORSHIPS_MANA,
882 BORG_WORSHIPS_AC,
883 BORG_WORSHIPS_GOLD,
884 BORG_PLAYS_RISKY,
885 BORG_KILLS_UNIQUES,
886 BORG_USES_SWAPS,
887 BORG_USES_DYNAMIC_CALCS,
888 BORG_SLOW_OPTIMIZEHOME,
889 BORG_STOP_DLEVEL,
890 BORG_STOP_CLEVEL,
891 BORG_NO_DEEPER,
892 BORG_STOP_KING,
893 BORG_RESPAWN_WINNERS,
894 BORG_RESPAWN_CLASS,
895 BORG_RESPAWN_RACE,
896 BORG_CHEST_FAIL_TOLERANCE,
897 BORG_DELAY_FACTOR,
898 BORG_MONEY_SCUM_AMOUNT,
899 BORG_SELF_SCUM,
900 BORG_LUNAL_MODE,
901 BORG_SELF_LUNAL,
902 BORG_ENCHANT_LIMIT,
903 BORG_DUMP_LEVEL,
904 BORG_SAVE_DEATH,
905 BORG_MAX_SETTINGS
906 };
907
908 extern int *borg_cfg;
909
910 /* dynamic required items */
911 /* dynamic required items */
912 typedef struct req_item
913 {
914 int depth;
915 int item;
916 int number;
917
918 } req_item;
919
920 extern req_item** borg_required_item;
921
922 extern int* n_req;
923 typedef struct power_item
924 {
925 int depth;
926 int cnd;
927 int item;
928 int from;
929 int to;
930 int power;
931 bool each;
932 } power_item;
933
934 extern power_item** borg_power_item;
935 extern int* n_pwr;
936 extern int* borg_has;
937 extern int* borg_skill;
938 extern int size_depth;
939 extern int size_obj;
940
941 enum borg_item_pos
942 {
943 BORG_INVEN = 1,
944 BORG_EQUIP = 2,
945 BORG_QUILL = 4
946 };
947
948 /* NOTE: This must exactly match the prefix_pref enums in BORG1.c */
949 enum
950 {
951 BI_STR,
952 BI_INT,
953 BI_WIS,
954 BI_DEX,
955 BI_CON,
956 BI_CSTR,
957 BI_CINT,
958 BI_CWIS,
959 BI_CDEX,
960 BI_CCON,
961 BI_SSTR,
962 BI_SINT,
963 BI_SWIS,
964 BI_SDEX,
965 BI_SCON,
966 BI_LIGHT,
967 BI_CURHP,
968 BI_MAXHP,
969 BI_CURSP,
970 BI_MAXSP,
971 BI_SP_ADJ,
972 BI_FAIL1,
973 BI_FAIL2,
974 BI_CLEVEL,
975 BI_MAXCLEVEL,
976 BI_ESP,
977 BI_CURLITE,
978 BI_RECALL,
979 BI_FOOD,
980 BI_SPEED,
981 BI_MOD_MOVES,
982 BI_DAM_RED,
983 BI_SDIG,
984 BI_FEATH,
985 BI_REG,
986 BI_SINV,
987 BI_INFRA,
988 BI_DISP,
989 BI_DISM,
990 BI_DEV,
991 BI_SAV,
992 BI_STL,
993 BI_SRCH,
994 BI_THN,
995 BI_THB,
996 BI_THT,
997 BI_DIG,
998 BI_IFIRE,
999 BI_IACID,
1000 BI_ICOLD,
1001 BI_IELEC,
1002 BI_IPOIS,
1003 BI_TRFIRE,
1004 BI_TRCOLD,
1005 BI_TRACID,
1006 BI_TRPOIS,
1007 BI_TRELEC,
1008 BI_RFIRE,
1009 BI_RCOLD,
1010 BI_RELEC,
1011 BI_RACID,
1012 BI_RPOIS,
1013 BI_RFEAR,
1014 BI_RLITE,
1015 BI_RDARK,
1016 BI_RBLIND,
1017 BI_RCONF,
1018 BI_RSND,
1019 BI_RSHRD,
1020 BI_RNXUS,
1021 BI_RNTHR,
1022 BI_RKAOS,
1023 BI_RDIS,
1024 BI_HLIFE,
1025 BI_FRACT,
1026 BI_SRFIRE,
1027 BI_SRCOLD,
1028 BI_SRELEC,
1029 BI_SRACID,
1030 BI_SRPOIS,
1031 BI_SRFEAR,
1032 BI_SRLITE,
1033 BI_SRDARK,
1034 BI_SRBLIND,
1035 BI_SRCONF,
1036 BI_SRSND,
1037 BI_SRSHRD,
1038 BI_SRNXUS,
1039 BI_SRNTHR,
1040 BI_SRKAOS,
1041 BI_SRDIS,
1042 BI_SHLIFE,
1043 BI_SFRACT,
1044
1045 BI_DEPTH,
1046 BI_CDEPTH,
1047 BI_MAXDEPTH,
1048 BI_KING,
1049
1050 BI_ISWEAK,
1051 BI_ISHUNGRY,
1052 BI_ISFULL,
1053 BI_ISGORGED,
1054 BI_ISBLIND,
1055 BI_ISAFRAID,
1056 BI_ISCONFUSED,
1057 BI_ISPOISONED,
1058 BI_ISCUT,
1059 BI_ISSTUN,
1060 BI_ISHEAVYSTUN,
1061 BI_ISPARALYZED,
1062 BI_ISIMAGE,
1063 BI_ISFORGET,
1064 BI_ISENCUMB,
1065 BI_ISSTUDY,
1066 BI_ISFIXLEV,
1067 BI_ISFIXEXP,
1068 BI_ISFIXSTR,
1069 BI_ISFIXINT,
1070 BI_ISFIXWIS,
1071 BI_ISFIXDEX,
1072 BI_ISFIXCON,
1073 BI_ISFIXALL,
1074
1075 BI_ARMOR,
1076 BI_TOHIT,
1077 BI_TODAM,
1078 BI_WTOHIT,
1079 BI_WTODAM,
1080 BI_BTOHIT,
1081 BI_BTODAM,
1082 BI_BLOWS,
1083 BI_SHOTS,
1084 BI_WMAXDAM,
1085 BI_WBASEDAM,
1086 BI_BMAXDAM,
1087 BI_HEAVYWEPON,
1088 BI_HEAVYBOW,
1089 BI_AMMO_COUNT,
1090 BI_AMMO_TVAL,
1091 BI_AMMO_SIDES,
1092 BI_AMMO_POWER,
1093 BI_AMISSILES,
1094 BI_AMISSILES_SPECIAL,
1095 BI_AMISSILES_CURSED,
1096 BI_QUIVER_SLOTS,
1097 BI_FIRST_CURSED,
1098 BI_WHERE_CURSED,
1099
1100 BI_CRSTELE,
1101 BI_CRSPOIS,
1102 BI_CRSSIREN,
1103 BI_CRSHALU,
1104 BI_CRSPARA,
1105 BI_CRSSDEM,
1106 BI_CRSSDRA,
1107 BI_CRSSUND,
1108 BI_CRSSTONE,
1109 BI_CRSNOTEL,
1110 BI_CRSTWEP,
1111 BI_CRSUNKNO,
1112 BI_CRSAGRV,
1113 BI_CRSHPIMP,
1114 BI_CRSMPIMP,
1115 BI_CRSFEAR,
1116 BI_CRSDRAIN_XP,
1117 BI_CRSFVULN,
1118 BI_CRSEVULN,
1119 BI_CRSCVULN,
1120 BI_CRSAVULN,
1121 BI_WS_ANIMAL,
1122 BI_WS_EVIL,
1123 BI_WS_UNDEAD,
1124 BI_WS_DEMON,
1125 BI_WS_ORC,
1126 BI_WS_TROLL,
1127 BI_WS_GIANT,
1128 BI_WS_DRAGON,
1129 BI_WK_UNDEAD,
1130 BI_WK_DEMON,
1131 BI_WK_DRAGON,
1132 BI_W_IMPACT,
1133 BI_WB_ACID,
1134 BI_WB_ELEC,
1135 BI_WB_FIRE,
1136 BI_WB_COLD,
1137 BI_WB_POIS,
1138 BI_APHASE,
1139 BI_ATELEPORT,
1140 BI_AESCAPE,
1141 BI_AFUEL,
1142 BI_AHEAL,
1143 BI_AEZHEAL,
1144 BI_ALIFE,
1145 BI_AID,
1146 BI_ASPEED,
1147 BI_ASTFMAGI,
1148 BI_ASTFDEST,
1149 BI_ATPORTOTHER,
1150 BI_ACUREPOIS,
1151 BI_ADETTRAP,
1152 BI_ADETDOOR,
1153 BI_ADETEVIL,
1154 BI_AMAGICMAP,
1155 BI_ARECHARGE,
1156 BI_ALITE,
1157 BI_APFE,
1158 BI_AGLYPH,
1159 BI_ACCW,
1160 BI_ACSW,
1161 BI_ACLW,
1162 BI_ARESHEAT,
1163 BI_ARESCOLD,
1164 BI_ARESPOIS,
1165 BI_ATELEPORTLVL, /* scroll of teleport level */
1166 BI_AHWORD, /* Holy Word prayer */
1167 BI_AMASSBAN, /* ?Mass Banishment */
1168 BI_ASHROOM,
1169 BI_AROD1, /* Attack rods */
1170 BI_AROD2, /* Attack rods */
1171 BI_DINV, /* See Inv Spell Legal */
1172 BI_WEIGHT, /* weight of all inventory and equipment */
1173 BI_EMPTY, /* number of empty slots */
1174
1175 BI_MAX
1176 };
1177
1178 #define MAX_FORMULA_ELEMENTS 60
1179 enum
1180 {
1181 BFO_DONE, /* just to make sure we end fast if there is no formula */
1182 BFO_NUMBER,
1183 BFO_VARIABLE,
1184 BFO_EQ,
1185 BFO_NEQ,
1186 BFO_NOT,
1187 BFO_LT,
1188 BFO_LTE,
1189 BFO_GT,
1190 BFO_GTE,
1191 BFO_AND,
1192 BFO_OR,
1193 BFO_PLUS,
1194 BFO_MINUS,
1195 BFO_DIVIDE,
1196 BFO_MULT
1197 };
1198
1199 extern int* formula[1000];
1200 extern const char* prefix_pref[];
1201
1202 /*
1203 * Hack -- optional cheating flags
1204 */
1205
1206 /*
1207 * Various silly flags
1208 */
1209
1210 extern bool borg_flag_save; /* Save savefile at each level */
1211
1212 extern bool borg_flag_dump; /* Save savefile at each death */
1213
1214 extern bool borg_save; /* do a save next time we get to press a key! */
1215
1216 extern bool borg_borg_message; /* List borg messages or not */
1217 extern bool borg_graphics; /* List borg messages or not */
1218 extern bool borg_confirm_target;
1219
1220 extern char borg_engine_date[]; /* last update */
1221
1222 /*
1223 * Use a simple internal random number generator
1224 */
1225
1226 extern bool borg_rand_quick; /* Save system setting */
1227
1228 extern uint32_t borg_rand_value; /* Save system setting */
1229
1230 extern uint32_t borg_rand_local; /* Save personal setting */
1231
1232
1233 /*
1234 * Hack -- time variables
1235 */
1236
1237 extern int16_t borg_t; /* Current "time" */
1238 extern int16_t borg_t_morgoth;
1239 extern unsigned int borg_morgoth_id;
1240 extern int16_t need_see_inviso; /* To tell me to cast it */
1241 extern int16_t borg_see_inv;
1242 extern bool need_shift_panel; /* to spot offscreeners */
1243 extern int16_t when_shift_panel;
1244 extern int16_t time_this_panel; /* Current "time" for current panel*/
1245 extern bool vault_on_level; /* borg will search for a vault */
1246 extern unsigned int unique_on_level;
1247 extern bool scaryguy_on_level;
1248 extern bool morgoth_on_level;
1249 extern bool borg_morgoth_position;
1250 extern int borg_t_antisummon; /* Timestamp when in a AS spot */
1251 extern bool borg_as_position; /* Sitting in an anti-summon corridor */
1252 extern bool borg_digging; /* used in Anti-summon corridor */
1253
1254 extern bool breeder_level; /* Borg will shut doors */
1255 extern int16_t old_depth;
1256 extern int16_t borg_respawning; /* to prevent certain crashes */
1257 extern int16_t borg_no_retreat;
1258
1259 /*
1260 * Hack -- Other time variables
1261 */
1262
1263 extern int16_t when_call_LIGHT; /* When we last did call light */
1264 extern int16_t when_wizard_LIGHT; /* When we last did wizard light */
1265
1266 extern int16_t when_detect_traps; /* When we last detected traps */
1267 extern int16_t when_detect_doors; /* When we last detected doors */
1268 extern int16_t when_detect_walls; /* When we last detected walls */
1269 extern int16_t when_detect_evil;
1270 extern int16_t when_detect_obj;
1271 extern int16_t when_last_kill_mult; /* When a multiplier was last killed */
1272
1273 extern bool my_need_alter; /* incase of walls/doors */
1274 extern bool my_no_alter; /* incase of walls/doors */
1275 extern bool my_need_redraw; /* incase of walls/doors */
1276 extern bool borg_attempting_refresh_resist; /* for the Resistance spell */
1277
1278 /*
1279 * Some information
1280 */
1281
1282 extern int16_t goal; /* Flowing (goal type) */
1283
1284 extern bool goal_rising; /* Currently returning to town */
1285 extern bool goal_leaving; /* Currently leaving the level */
1286 extern bool goal_fleeing; /* Currently fleeing the level */
1287 extern bool goal_fleeing_lunal; /* Currently fleeing the level in lunal*/
1288 extern bool goal_fleeing_munchkin; /* Fleeing level while in munchkin Mode */
1289 extern bool goal_fleeing_to_town; /* Currently fleeing the level to return to town */
1290 extern bool goal_ignoring; /* Currently ignoring monsters */
1291 extern int goal_recalling; /* Currently waiting for recall, guessing turns left */
1292 extern bool goal_less; /* return to, but dont use, the next up stairs */
1293
1294 extern int16_t borg_times_twitch; /* how often twitchy on this level */
1295 extern int16_t borg_escapes; /* how often teleported on this level */
1296
1297 extern bool stair_less; /* Use the next "up" staircase */
1298 extern bool stair_more; /* Use the next "down" staircase */
1299
1300 extern int32_t borg_began; /* When this level began */
1301 extern int32_t borg_time_town; /* how long it has been since I was in town */
1302
1303 extern int16_t avoidance; /* Current danger thresh-hold */
1304
1305 extern bool borg_failure; /* Notice failure */
1306
1307 extern bool borg_simulate; /* Simulation flag */
1308 extern bool borg_attacking; /* Are we attacking a monster? */
1309 extern bool borg_offsetting; /* Are we attacking a monster? with offsett balls*/
1310
1311 extern bool borg_completed; /* Completed the level */
1312 extern bool borg_on_upstairs; /* used when leaving a level */
1313 extern bool borg_on_dnstairs; /* used when leaving a level */
1314 extern bool borg_needs_searching; /* borg will search with each step */
1315 extern int16_t borg_oldchp; /* hit points last game turn */
1316 extern int16_t borg_oldcsp; /* mana points last game turn */
1317
1318 /* defence flags */
1319 extern bool borg_prot_from_evil;
1320 extern bool borg_speed;
1321 extern bool borg_bless;
1322 extern bool borg_hero;
1323 extern bool borg_berserk;
1324 extern bool borg_fastcast;
1325 extern bool borg_regen;
1326 extern bool borg_smite_evil;
1327 extern bool borg_venom;
1328 extern int16_t borg_game_ratio;
1329 extern int16_t borg_resistance;
1330 extern int16_t borg_no_rest_prep; /* borg wont rest for a few turns */
1331 extern bool borg_shield;
1332 extern bool borg_on_glyph; /* borg is standing on a glyph of warding */
1333 extern bool borg_create_door; /* borg is going to create doors */
1334 extern bool borg_sleep_spell;
1335 extern bool borg_sleep_spell_ii;
1336 extern bool borg_crush_spell;
1337 extern bool borg_slow_spell;
1338 extern bool borg_confuse_spell;
1339 extern bool borg_fear_mon_spell;
1340
1341
1342 /*
1343 * Shop goals
1344 */
1345 extern bool borg_in_shop;
1346 extern int16_t goal_shop; /* Next shop to visit */
1347 extern int16_t goal_ware; /* Next item to buy there */
1348 extern int16_t goal_item; /* Next item to sell there */
1349 extern int borg_food_onsale; /* Are shops selling food? */
1350 extern int borg_fuel_onsale; /* Are shops selling fuel? */
1351 extern bool borg_needs_quick_shopping; /* Needs to buy without browsing all shops */
1352 extern int16_t borg_best_fit_item; /* Item to be worn, not sold */
1353 extern int borg_best_item;
1354
1355 /*
1356 * Other variables
1357 */
1358
1359 extern int w_x; /* Current panel offset (X) */
1360 extern int w_y; /* Current panel offset (Y) */
1361 extern int morgy_panel_y;
1362 extern int morgy_panel_x;
1363
1364 extern int borg_target_y;
1365 extern int borg_target_x; /* Current targetted location */
1366
1367 extern int c_x; /* Current location (X) */
1368 extern int c_y; /* Current location (Y) */
1369
1370 extern int g_x; /* Goal location (X) */
1371 extern int g_y; /* Goal location (Y) */
1372
1373 /*
1374 * Some estimated state variables
1375 */
1376
1377 extern int16_t my_stat_max[STAT_MAX]; /* Current "maximal" stat values */
1378 extern int16_t my_stat_cur[STAT_MAX]; /* Current "natural" stat values */
1379 extern int16_t my_stat_ind[STAT_MAX]; /* Current "additions" to stat values */
1380 extern bool my_need_stat_check[STAT_MAX]; /* do I need to check my stats */
1381
1382 extern int16_t my_stat_add[STAT_MAX]; /* aditions to stats */
1383
1384 extern int16_t home_stat_add[STAT_MAX];
1385
1386 extern int weapon_swap; /* location of my swap weapon */
1387 extern int32_t weapon_swap_value; /* value of my swap weapon */
1388 extern int armour_swap; /* location of my swap weapon */
1389 extern int32_t armour_swap_value; /* value of my swap weapon */
1390
1391 extern bool decurse_weapon_swap; /* my swap is great, except its cursed */
1392 extern int enchant_weapon_swap_to_h; /* my swap is great, except its cursed */
1393 extern int enchant_weapon_swap_to_d; /* my swap is great, except its cursed */
1394 extern bool decurse_armour_swap; /* my swap is great, except its cursed */
1395 extern int enchant_armour_swap_to_a; /* my swap is great, except its cursed */
1396
1397
1398 extern int16_t weapon_swap_digger;
1399 extern uint8_t weapon_swap_slay_animal;
1400 extern uint8_t weapon_swap_slay_evil;
1401 extern uint8_t weapon_swap_slay_undead;
1402 extern uint8_t weapon_swap_slay_demon;
1403 extern uint8_t weapon_swap_slay_orc;
1404 extern uint8_t weapon_swap_slay_troll;
1405 extern uint8_t weapon_swap_slay_giant;
1406 extern uint8_t weapon_swap_slay_dragon;
1407 extern uint8_t weapon_swap_impact;
1408 extern uint8_t weapon_swap_brand_acid;
1409 extern uint8_t weapon_swap_brand_elec;
1410 extern uint8_t weapon_swap_brand_fire;
1411 extern uint8_t weapon_swap_brand_cold;
1412 extern uint8_t weapon_swap_brand_pois;
1413 extern uint8_t weapon_swap_see_infra;
1414 extern uint8_t weapon_swap_slow_digest;
1415 extern uint8_t weapon_swap_aggravate;
1416 extern uint8_t weapon_swap_bad_curse;
1417 extern uint8_t weapon_swap_regenerate;
1418 extern uint8_t weapon_swap_telepathy;
1419 extern uint8_t weapon_swap_light;
1420 extern uint8_t weapon_swap_see_invis;
1421 extern uint8_t weapon_swap_ffall;
1422 extern uint8_t weapon_swap_free_act;
1423 extern uint8_t weapon_swap_hold_life;
1424 extern uint8_t weapon_swap_immune_fire;
1425 extern uint8_t weapon_swap_immune_acid;
1426 extern uint8_t weapon_swap_immune_cold;
1427 extern uint8_t weapon_swap_immune_elec;
1428 extern uint8_t weapon_swap_resist_acid;
1429 extern uint8_t weapon_swap_resist_elec;
1430 extern uint8_t weapon_swap_resist_fire;
1431 extern uint8_t weapon_swap_resist_cold;
1432 extern uint8_t weapon_swap_resist_pois;
1433 extern uint8_t weapon_swap_resist_conf;
1434 extern uint8_t weapon_swap_resist_sound;
1435 extern uint8_t weapon_swap_resist_light;
1436 extern uint8_t weapon_swap_resist_dark;
1437 extern uint8_t weapon_swap_resist_chaos;
1438 extern uint8_t weapon_swap_resist_disen;
1439 extern uint8_t weapon_swap_resist_shard;
1440 extern uint8_t weapon_swap_resist_nexus;
1441 extern uint8_t weapon_swap_resist_blind;
1442 extern uint8_t weapon_swap_resist_neth;
1443 extern uint8_t weapon_swap_resist_fear;
1444 extern uint8_t armour_swap_slay_animal;
1445 extern uint8_t armour_swap_slay_evil;
1446 extern uint8_t armour_swap_slay_undead;
1447 extern uint8_t armour_swap_slay_demon;
1448 extern uint8_t armour_swap_slay_orc;
1449 extern uint8_t armour_swap_slay_troll;
1450 extern uint8_t armour_swap_slay_giant;
1451 extern uint8_t armour_swap_slay_dragon;
1452 extern uint8_t armour_swap_impact;
1453 extern uint8_t armour_swap_brand_acid;
1454 extern uint8_t armour_swap_brand_elec;
1455 extern uint8_t armour_swap_brand_fire;
1456 extern uint8_t armour_swap_brand_cold;
1457 extern uint8_t armour_swap_brand_pois;
1458 extern uint8_t armour_swap_see_infra;
1459 extern uint8_t armour_swap_slow_digest;
1460 extern uint8_t armour_swap_aggravate;
1461 extern uint8_t armour_swap_bad_curse;
1462 extern uint8_t armour_swap_regenerate;
1463 extern uint8_t armour_swap_telepathy;
1464 extern uint8_t armour_swap_light;
1465 extern uint8_t armour_swap_see_invis;
1466 extern uint8_t armour_swap_ffall;
1467 extern uint8_t armour_swap_free_act;
1468 extern uint8_t armour_swap_hold_life;
1469 extern uint8_t armour_swap_immune_fire;
1470 extern uint8_t armour_swap_immune_acid;
1471 extern uint8_t armour_swap_immune_cold;
1472 extern uint8_t armour_swap_immune_elec;
1473 extern uint8_t armour_swap_resist_acid;
1474 extern uint8_t armour_swap_resist_elec;
1475 extern uint8_t armour_swap_resist_fire;
1476 extern uint8_t armour_swap_resist_cold;
1477 extern uint8_t armour_swap_resist_pois;
1478 extern uint8_t armour_swap_resist_conf;
1479 extern uint8_t armour_swap_resist_sound;
1480 extern uint8_t armour_swap_resist_LIGHT;
1481 extern uint8_t armour_swap_resist_dark;
1482 extern uint8_t armour_swap_resist_chaos;
1483 extern uint8_t armour_swap_resist_disen;
1484 extern uint8_t armour_swap_resist_shard;
1485 extern uint8_t armour_swap_resist_nexus;
1486 extern uint8_t armour_swap_resist_blind;
1487 extern uint8_t armour_swap_resist_neth;
1488 extern uint8_t armour_swap_resist_fear;
1489
1490 extern int16_t my_need_enchant_to_a; /* Need some enchantment */
1491 extern int16_t my_need_enchant_to_h; /* Need some enchantment */
1492 extern int16_t my_need_enchant_to_d; /* Need some enchantment */
1493 extern int16_t my_need_brand_weapon; /* brand bolts */
1494 extern int16_t my_need_id; /* need to buy ID for an inventory item */
1495
1496
1497 /*
1498 * Hack -- basic "power"
1499 */
1500
1501 extern int32_t my_power;
1502
1503
1504 /*
1505 * Various "amounts" (for the player)
1506 */
1507
1508 extern int16_t amt_food_lowcal;
1509 extern int16_t amt_food_hical;
1510
1511 extern int16_t amt_slow_poison;
1512 extern int16_t amt_cure_confusion;
1513 extern int16_t amt_cure_blind;
1514
1515 extern int16_t amt_cool_staff; /* holiness-power staff */
1516 extern int16_t amt_cool_wand; /* # of charges */
1517 extern int16_t amt_book[9];
1518
1519 extern int16_t amt_add_stat[6];
1520 extern int16_t amt_inc_stat[6];
1521
1522 extern int16_t amt_fix_exp;
1523
1524 extern int16_t amt_enchant_to_a;
1525 extern int16_t amt_enchant_to_d;
1526 extern int16_t amt_enchant_to_h;
1527 extern int16_t amt_brand_weapon; /* cubragol and bolts */
1528 extern int16_t amt_enchant_weapon;
1529 extern int16_t amt_enchant_armor;
1530 extern int16_t amt_digger;
1531 extern int16_t amt_ego;
1532
1533 /*
1534 * Various "amounts" (for the home)
1535 */
1536
1537 extern int16_t num_food;
1538 extern int16_t num_fuel;
1539 extern int16_t num_mold;
1540 extern int16_t num_ident;
1541 extern int16_t num_recall;
1542 extern int16_t num_phase;
1543 extern int16_t num_escape;
1544 extern int16_t num_tele_staves;
1545 extern int16_t num_teleport;
1546 extern int16_t num_berserk;
1547 extern int16_t num_teleport_level;
1548 extern int16_t num_recharge;
1549
1550 extern int16_t num_cure_critical;
1551 extern int16_t num_cure_serious;
1552
1553 extern int16_t num_pot_rheat;
1554 extern int16_t num_pot_rcold;
1555
1556 extern int16_t num_missile;
1557
1558 extern int16_t num_book[9];
1559
1560 extern int16_t num_fix_stat[7];
1561
1562 extern int16_t num_fix_exp;
1563 extern int16_t num_mana;
1564 extern int16_t num_heal;
1565 extern int16_t num_heal_true;
1566 extern int16_t num_ezheal;
1567 extern int16_t num_ezheal_true;
1568 extern int16_t num_life;
1569 extern int16_t num_life_true;
1570 extern int16_t num_pfe;
1571 extern int16_t num_glyph;
1572
1573 extern int16_t num_enchant_to_a;
1574 extern int16_t num_enchant_to_d;
1575 extern int16_t num_enchant_to_h;
1576 extern int16_t num_brand_weapon; /* crubragol and bolts */
1577 extern int16_t num_genocide;
1578 extern int16_t num_mass_genocide;
1579
1580 extern int16_t num_artifact;
1581 extern int16_t num_ego;
1582
1583 extern int16_t home_slot_free;
1584 extern int16_t home_un_id;
1585 extern int16_t home_damage;
1586 extern int16_t num_duplicate_items;
1587 extern int16_t num_slow_digest;
1588 extern int16_t num_regenerate;
1589 extern int16_t num_telepathy;
1590 extern int16_t num_LIGHT;
1591 extern int16_t num_see_inv;
1592
1593 extern int16_t num_invisible; /**/
1594
1595 extern int16_t num_ffall;
1596 extern int16_t num_free_act;
1597 extern int16_t num_hold_life;
1598 extern int16_t num_immune_acid;
1599 extern int16_t num_immune_elec;
1600 extern int16_t num_immune_fire;
1601 extern int16_t num_immune_cold;
1602 extern int16_t num_resist_acid;
1603 extern int16_t num_resist_elec;
1604 extern int16_t num_resist_fire;
1605 extern int16_t num_resist_cold;
1606 extern int16_t num_resist_pois;
1607 extern int16_t num_resist_conf;
1608 extern int16_t num_resist_sound;
1609 extern int16_t num_resist_LIGHT;
1610 extern int16_t num_resist_dark;
1611 extern int16_t num_resist_chaos;
1612 extern int16_t num_resist_disen;
1613 extern int16_t num_resist_shard;
1614 extern int16_t num_resist_nexus;
1615 extern int16_t num_resist_blind;
1616 extern int16_t num_resist_neth;
1617 extern int16_t num_sustain_str;
1618 extern int16_t num_sustain_int;
1619 extern int16_t num_sustain_wis;
1620 extern int16_t num_sustain_dex;
1621 extern int16_t num_sustain_con;
1622 extern int16_t num_sustain_all;
1623
1624 extern int16_t num_speed;
1625 extern int16_t num_edged_weapon;
1626 extern int16_t num_bad_gloves;
1627 extern int16_t num_weapons;
1628 extern int16_t num_bow;
1629 extern int16_t num_rings;
1630 extern int16_t num_neck;
1631 extern int16_t num_armor;
1632 extern int16_t num_cloaks;
1633 extern int16_t num_shields;
1634 extern int16_t num_hats;
1635 extern int16_t num_gloves;
1636 extern int16_t num_boots;
1637
1638 /*
1639 * Deal with knowing which uniques are alive
1640 */
1641 extern int borg_numb_live_unique;
1642 extern unsigned int borg_living_unique_index;
1643 extern int borg_unique_depth;
1644
1645 /*
1646 * Hack -- extra state variables
1647 */
1648
1649 extern int borg_feeling_danger; /* Current level "feeling" */
1650 extern int borg_feeling_stuff; /* Current level "feeling" */
1651
1652 /*
1653 * Hack -- current shop index
1654 */
1655
1656 extern int16_t shop_num; /* Current shop index */
1657
1658
1659
1660 /*
1661 * State variables extracted from the screen
1662 */
1663
1664 extern int32_t borg_exp; /* Current experience */
1665 extern int32_t borg_gold; /* Current gold */
1666
1667 extern int borg_stat[6]; /* Current stats */
1668 extern int borg_book[9]; /* Current book slots */
1669
1670
1671 /*
1672 * State variables extracted from the inventory/equipment
1673 */
1674
1675 extern int borg_cur_wgt; /* Current weight */
1676
1677
1678 /*
1679 * Constant state variables
1680 */
1681
1682 extern int borg_race; /* Current race */
1683 extern int borg_class; /* Current class */
1684
1685
1686
1687 /*
1688 * Constant state structures
1689 */
1690
1691
1692 extern void mmove2(int* y, int* x, int y1, int x1, int y2, int x2);
1693
1694 /*
1695 * Number of turns to step for (zero means forever)
1696 */
1697 extern uint16_t borg_step; /* Step count (if any) */
1698
1699
1700 /*
1701 * Status message search string
1702 */
1703 extern char borg_match[128]; /* Search string */
1704
1705
1706 /*
1707 * Log file
1708 */
1709 extern FILE* borg_fff; /* Log file */
1710
1711
1712
1713 /*
1714 * Hack -- the detection arrays
1715 */
1716
1717 extern bool borg_detect_wall[6][18];
1718 extern bool borg_detect_trap[6][18];
1719 extern bool borg_detect_door[6][18];
1720 extern bool borg_detect_evil[6][18];
1721 extern bool borg_detect_obj[6][18];
1722
1723 /*
1724 * Locate the store doors
1725 */
1726
1727 extern int* track_shop_x;
1728 extern int* track_shop_y;
1729
1730 /*
1731 * track where some things are
1732 */
1733 struct borg_track
1734 {
1735 int16_t num;
1736 int16_t size;
1737 int* x;
1738 int* y;
1739
1740 };
1741
1742
1743 /*
1744 * Track "stairs up"
1745 */
1746 extern struct borg_track track_less;
1747 /*
1748 * Track "stairs down"
1749 */
1750 extern struct borg_track track_more;
1751
1752 /*
1753 * Track glyphs
1754 */
1755 extern struct borg_track track_glyph;
1756
1757 extern bool borg_needs_new_sea;
1758
1759 /*
1760 * Track the items worn to avoid loops
1761 */
1762 extern int16_t track_worn_num;
1763 extern int16_t track_worn_size;
1764 extern int16_t track_worn_time;
1765 extern uint8_t* track_worn_name1;
1766
1767 extern const int16_t borg_ddx_ddd[24];
1768 extern const int16_t borg_ddy_ddd[24];
1769
1770 /*
1771 * Track steps
1772 */
1773 extern struct borg_track track_step;
1774
1775 /*
1776 * Track closed doors
1777 */
1778 extern struct borg_track track_door;
1779
1780 /*
1781 * Track closed doors which started closed
1782 */
1783 extern struct borg_track track_closed;
1784
1785 /*
1786 * Track the mineral veins with treasure
1787 *
1788 */
1789 extern struct borg_track track_vein;
1790
1791 /*
1792 * The object list. This list is used to "track" objects.
1793 */
1794
1795 extern int16_t borg_takes_cnt;
1796 extern int16_t borg_takes_nxt;
1797 extern borg_take* borg_takes;
1798
1799
1800 /*
1801 * The monster list. This list is used to "track" monsters.
1802 */
1803
1804 extern int16_t borg_kills_cnt;
1805 extern int16_t borg_kills_summoner; /* index of a summoning guy */
1806 extern int16_t borg_kills_nxt;
1807 extern borg_kill* borg_kills;
1808
1809
1810 /*
1811 * Hack -- depth readiness
1812 */
1813 extern int borg_ready_morgoth;
1814
1815 /*
1816 * Hack -- extra fear per "region"
1817 */
1818
1819 extern uint16_t borg_fear_region[(AUTO_MAX_Y / 11) + 1][(AUTO_MAX_X / 11) + 1];
1820 extern uint16_t borg_fear_monsters[AUTO_MAX_Y + 1][AUTO_MAX_X + 1];
1821
1822
1823 /*
1824 * Hack -- count racial appearances per level
1825 */
1826
1827 extern int16_t* borg_race_count;
1828
1829
1830 /*
1831 * Hack -- count racial kills (for uniques)
1832 */
1833
1834 extern int16_t* borg_race_death;
1835
1836
1837 /*
1838 * Current "grid" list
1839 */
1840
1841 extern borg_grid* borg_grids[AUTO_MAX_Y]; /* Current "grid list" */
1842
1843 /*
1844 * Maintain a set of grids (liteable grids)
1845 */
1846
1847 extern int16_t borg_LIGHT_n;
1848 extern uint8_t borg_LIGHT_y[AUTO_LIGHT_MAX];
1849 extern uint8_t borg_LIGHT_x[AUTO_LIGHT_MAX];
1850
1851 /*
1852 * Maintain a set of glow grids (liteable grids)
1853 */
1854
1855 extern int16_t borg_glow_n;
1856 extern uint8_t borg_glow_y[AUTO_LIGHT_MAX];
1857 extern uint8_t borg_glow_x[AUTO_LIGHT_MAX];
1858
1859
1860 /*
1861 * Maintain a set of grids (viewable grids)
1862 */
1863
1864 extern int16_t borg_view_n;
1865 extern uint8_t borg_view_y[AUTO_VIEW_MAX];
1866 extern uint8_t borg_view_x[AUTO_VIEW_MAX];
1867
1868
1869 /*
1870 * Maintain a set of grids (scanning arrays)
1871 */
1872
1873 extern int16_t borg_temp_n;
1874 extern uint8_t borg_temp_y[AUTO_TEMP_MAX];
1875 extern uint8_t borg_temp_x[AUTO_TEMP_MAX];
1876
1877 /*
1878 * Maintain a temporary set of grids
1879 * Used to store lit grid info
1880 */
1881 extern int16_t borg_temp_lit_n;
1882 extern uint8_t borg_temp_lit_x[AUTO_TEMP_MAX];
1883 extern uint8_t borg_temp_lit_y[AUTO_TEMP_MAX];
1884
1885 /*
1886 * Maintain a set of special grids used for Teleport Other
1887 */
1888 extern int16_t borg_tp_other_n;
1889 extern uint8_t borg_tp_other_x[255];
1890 extern uint8_t borg_tp_other_y[255];
1891 extern int borg_tp_other_index[255];
1892
1893 extern uint8_t offset_y;
1894 extern uint8_t offset_x;
1895
1896
1897 /*
1898 * Maintain a set of grids (flow calculations)
1899 */
1900
1901 extern int16_t borg_flow_n;
1902 extern uint8_t borg_flow_y[AUTO_FLOW_MAX];
1903 extern uint8_t borg_flow_x[AUTO_FLOW_MAX];
1904
1905
1906 /*
1907 * Hack -- use "flow" array as a queue
1908 */
1909
1910 extern int flow_head;
1911 extern int flow_tail;
1912
1913
1914 /*
1915 * Some variables
1916 */
1917
1918 extern borg_data* borg_data_flow; /* Current "flow" data */
1919 extern borg_data* borg_data_cost; /* Current "cost" data */
1920 extern borg_data* borg_data_hard; /* Constant "hard" data */
1921 extern borg_data* borg_data_know; /* Current "know" flags */
1922 extern borg_data* borg_data_icky; /* Current "icky" flags */
1923
1924
1925 /*
1926 * Strategy flags -- recalculate things
1927 */
1928
1929 extern bool borg_danger_wipe; /* Recalculate danger */
1930
1931 extern bool borg_do_update_view; /* Recalculate view */
1932 extern bool borg_do_update_lite; /* Recalculate lite */
1933
1934 /*
1935 * Strategy flags -- examine the world
1936 */
1937
1938 extern bool borg_do_inven; /* Acquire "inven" info */
1939 extern bool borg_do_equip; /* Acquire "equip" info */
1940 extern bool borg_do_panel; /* Acquire "panel" info */
1941 extern bool borg_do_frame; /* Acquire "frame" info */
1942 extern bool borg_do_spell; /* Acquire "spell" info */
1943 extern uint8_t borg_do_spell_aux; /* Hack -- book for "borg_do_spell" */
1944 extern bool borg_do_browse; /* Acquire "store" info */
1945 extern uint8_t borg_do_browse_what; /* Hack -- store for "borg_do_browse" */
1946 extern uint8_t borg_do_browse_more; /* Hack -- pages for "borg_do_browse" */
1947
1948
1949 /*
1950 * Strategy flags -- run certain functions
1951 */
1952
1953 extern bool borg_do_crush_junk;
1954 extern bool borg_do_crush_hole;
1955 extern bool borg_do_crush_slow;
1956
1957 /* am I fighting a unique */
1958 extern int borg_fighting_unique;
1959 extern bool borg_fighting_evil_unique;
1960
1961 /* am I fighting a summoner */
1962 extern bool borg_fighting_summoner;
1963
1964
1965 extern const int borg_adj_mag_fail[STAT_RANGE];
1966 extern const int borg_adj_mag_stat[STAT_RANGE];
1967
1968 extern struct player *borg_p;
1969
1970
1971 /*** Some functions ***/
1972
1973 extern int borg_lookup_kind(int tval, int sval);
1974 extern bool borg_ego_has_random_power(struct ego_item* e_ptr);
1975
1976 /*
1977 * sort functions
1978 */
1979 extern void borg_sort(void* u, void* v, int n);
1980 extern bool borg_sort_comp_hook(void* u, void* v, int a, int b);
1981 extern void borg_sort_swap_hook(void* u, void* v, int a, int b);
1982 extern bool (*borg_sort_comp)(void* u, void* v, int a, int b);
1983 extern void (*borg_sort_swap)(void* u, void* v, int a, int b);
1984
1985
1986 /*
1987 * Queue a keypress
1988 */
1989 extern errr borg_keypress(keycode_t k);
1990
1991 /*
1992 * Queue several keypresses
1993 */
1994 extern errr borg_keypresses(const char* str);
1995
1996 /*
1997 * Dequeue a keypress
1998 */
1999 extern keycode_t borg_inkey(bool take);
2000
2001 /*
2002 * Flush the keypresses
2003 */
2004 extern void borg_flush(void);
2005
2006 /* save and retrieve direction when the */
2007 /* command may be ambiguous */
2008 extern void borg_queue_direction(keycode_t k);
2009 extern keycode_t borg_get_queued_direction(void);
2010
2011 /*
2012 * Obtain some text from the screen (single character)
2013 */
2014 extern errr borg_what_char(int x, int y, uint8_t* a, wchar_t* c);
2015
2016 /*
2017 * Obtain some text from the screen (multiple characters)
2018 */
2019 extern errr borg_what_text(int x, int y, int n, uint8_t* a, char* s);
2020
2021
2022 /*
2023 * Log a message to a file
2024 */
2025 extern void borg_info(const char* what);
2026
2027 /*
2028 * Log a message, Search it, and Show/Memorize it in pieces
2029 */
2030 extern void borg_note(const char* what);
2031
2032
2033 /*
2034 * Abort the Borg, noting the reason
2035 */
2036 extern void borg_oops(const char* what);
2037
2038
2039 /*
2040 * Take a "memory note"
2041 */
2042 extern bool borg_tell(char* what);
2043
2044 /*
2045 * Change the player name
2046 */
2047 extern bool borg_change_name(char* str);
2048
2049 /*
2050 * Dump a character description
2051 */
2052 extern bool borg_dump_character(char* str);
2053
2054 /*
2055 * Save the game (but do not quit)
2056 */
2057 extern bool borg_save_game(void);
2058
2059
2060 /*
2061 * Update the "frame" info from the screen
2062 */
2063 extern void borg_update_frame(void);
2064
2065 /*
2066 * Calc a formula out in RPN
2067 */
2068 extern int borg_calc_formula(int*);
2069 /*
2070 * check out a formula in RPN
2071 */
2072 extern int borg_check_formula(int*);
2073 /*
2074 * return a string for the formula
2075 */
2076 extern char* borg_prt_formula(int* formula);
2077
2078 /*
2079 * Print the string for an item
2080 */
2081 extern const char* borg_prt_item(int item);
2082
2083 /*
2084 * Helper that converts old distance to new distance
2085 */
2086 extern int borg_distance(int y, int x, int y2, int x2);
2087 extern char* borg_massage_special_chars(char* name, char* memory);
2088 extern bool borg_is_ammo(int tval);
2089 /*
2090 * Initialize this file
2091 */
2092 extern void borg_init_1(void);
2093
2094 #endif
2095
2096 #endif
2097