| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
#include "angband.h" |
|---|
| 19 |
#include "tvalsval.h" |
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 |
void do_cmd_inven(void) |
|---|
| 26 |
{ |
|---|
| 27 |
|
|---|
| 28 |
p_ptr->command_wrk = (USE_INVEN); |
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 |
screen_save(); |
|---|
| 32 |
|
|---|
| 33 |
|
|---|
| 34 |
item_tester_full = TRUE; |
|---|
| 35 |
|
|---|
| 36 |
|
|---|
| 37 |
show_inven(); |
|---|
| 38 |
|
|---|
| 39 |
|
|---|
| 40 |
item_tester_full = FALSE; |
|---|
| 41 |
|
|---|
| 42 |
|
|---|
| 43 |
prt(format("(Inventory) Burden %d.%dlb (%d%% capacity). Command: ", |
|---|
| 44 |
p_ptr->total_weight / 10, p_ptr->total_weight % 10, |
|---|
| 45 |
(10 * p_ptr->total_weight) / (6 * adj_str_wgt[p_ptr->stat_ind[A_STR]])), 0, 0); |
|---|
| 46 |
|
|---|
| 47 |
|
|---|
| 48 |
p_ptr->command_new = inkey(); |
|---|
| 49 |
|
|---|
| 50 |
|
|---|
| 51 |
screen_load(); |
|---|
| 52 |
|
|---|
| 53 |
|
|---|
| 54 |
|
|---|
| 55 |
if (p_ptr->command_new == ESCAPE) |
|---|
| 56 |
{ |
|---|
| 57 |
|
|---|
| 58 |
p_ptr->command_new = 0; |
|---|
| 59 |
} |
|---|
| 60 |
} |
|---|
| 61 |
|
|---|
| 62 |
|
|---|
| 63 |
|
|---|
| 64 |
|
|---|
| 65 |
|
|---|
| 66 |
void do_cmd_equip(void) |
|---|
| 67 |
{ |
|---|
| 68 |
|
|---|
| 69 |
p_ptr->command_wrk = (USE_EQUIP); |
|---|
| 70 |
|
|---|
| 71 |
|
|---|
| 72 |
screen_save(); |
|---|
| 73 |
|
|---|
| 74 |
|
|---|
| 75 |
item_tester_full = TRUE; |
|---|
| 76 |
|
|---|
| 77 |
|
|---|
| 78 |
show_equip(); |
|---|
| 79 |
|
|---|
| 80 |
|
|---|
| 81 |
item_tester_full = FALSE; |
|---|
| 82 |
|
|---|
| 83 |
|
|---|
| 84 |
prt("(Equipment) Command: ", 0, 0); |
|---|
| 85 |
|
|---|
| 86 |
|
|---|
| 87 |
p_ptr->command_new = inkey(); |
|---|
| 88 |
|
|---|
| 89 |
|
|---|
| 90 |
screen_load(); |
|---|
| 91 |
|
|---|
| 92 |
|
|---|
| 93 |
|
|---|
| 94 |
if (p_ptr->command_new == ESCAPE) |
|---|
| 95 |
{ |
|---|
| 96 |
|
|---|
| 97 |
p_ptr->command_new = 0; |
|---|
| 98 |
} |
|---|
| 99 |
} |
|---|
| 100 |
|
|---|
| 101 |
|
|---|
| 102 |
|
|---|
| 103 |
|
|---|
| 104 |
|
|---|
| 105 |
void wield_item(object_type *o_ptr, int item) |
|---|
| 106 |
{ |
|---|
| 107 |
object_type object_type_body; |
|---|
| 108 |
object_type *i_ptr = &object_type_body; |
|---|
| 109 |
|
|---|
| 110 |
cptr act; |
|---|
| 111 |
char o_name[80]; |
|---|
| 112 |
|
|---|
| 113 |
int slot = wield_slot(o_ptr); |
|---|
| 114 |
|
|---|
| 115 |
|
|---|
| 116 |
p_ptr->energy_use = 100; |
|---|
| 117 |
|
|---|
| 118 |
|
|---|
| 119 |
object_copy(i_ptr, o_ptr); |
|---|
| 120 |
|
|---|
| 121 |
|
|---|
| 122 |
i_ptr->number = 1; |
|---|
| 123 |
|
|---|
| 124 |
|
|---|
| 125 |
if (item >= 0) |
|---|
| 126 |
{ |
|---|
| 127 |
inven_item_increase(item, -1); |
|---|
| 128 |
inven_item_optimize(item); |
|---|
| 129 |
} |
|---|
| 130 |
|
|---|
| 131 |
|
|---|
| 132 |
else |
|---|
| 133 |
{ |
|---|
| 134 |
floor_item_increase(0 - item, -1); |
|---|
| 135 |
floor_item_optimize(0 - item); |
|---|
| 136 |
} |
|---|
| 137 |
|
|---|
| 138 |
|
|---|
| 139 |
o_ptr = &inventory[slot]; |
|---|
| 140 |
|
|---|
| 141 |
|
|---|
| 142 |
if (o_ptr->k_idx) |
|---|
| 143 |
{ |
|---|
| 144 |
|
|---|
| 145 |
(void)inven_takeoff(slot, 255); |
|---|
| 146 |
} |
|---|
| 147 |
|
|---|
| 148 |
|
|---|
| 149 |
object_copy(o_ptr, i_ptr); |
|---|
| 150 |
|
|---|
| 151 |
|
|---|
| 152 |
p_ptr->total_weight += i_ptr->weight; |
|---|
| 153 |
|
|---|
| 154 |
|
|---|
| 155 |
p_ptr->equip_cnt++; |
|---|
| 156 |
|
|---|
| 157 |
|
|---|
| 158 |
if (slot == INVEN_WIELD) |
|---|
| 159 |
act = "You are wielding"; |
|---|
| 160 |
else if (slot == INVEN_BOW) |
|---|
| 161 |
act = "You are shooting with"; |
|---|
| 162 |
else if (slot == INVEN_LITE) |
|---|
| 163 |
act = "Your light source is"; |
|---|
| 164 |
else |
|---|
| 165 |
act = "You are wearing"; |
|---|
| 166 |
|
|---|
| 167 |
|
|---|
| 168 |
object_desc(o_name, sizeof(o_name), o_ptr, TRUE, ODESC_FULL); |
|---|
| 169 |
|
|---|
| 170 |
|
|---|
| 171 |
sound(MSG_WIELD); |
|---|
| 172 |
msg_format("%s %s (%c).", act, o_name, index_to_label(slot)); |
|---|
| 173 |
|
|---|
| 174 |
|
|---|
| 175 |
if (cursed_p(o_ptr)) |
|---|
| 176 |
{ |
|---|
| 177 |
|
|---|
| 178 |
sound(MSG_CURSED); |
|---|
| 179 |
msg_print("Oops! It feels deathly cold!"); |
|---|
| 180 |
|
|---|
| 181 |
|
|---|
| 182 |
o_ptr->pseudo = INSCRIP_CURSED; |
|---|
| 183 |
|
|---|
| 184 |
|
|---|
| 185 |
o_ptr->ident |= (IDENT_SENSE); |
|---|
| 186 |
|
|---|
| 187 |
|
|---|
| 188 |
p_ptr->notice |= PN_SQUELCH; |
|---|
| 189 |
} |
|---|
| 190 |
|
|---|
| 191 |
|
|---|
| 192 |
p_ptr->update |= (PU_BONUS | PU_TORCH | PU_MANA); |
|---|
| 193 |
p_ptr->redraw |= (PR_INVEN | PR_EQUIP); |
|---|
| 194 |
} |
|---|
| 195 |
|
|---|
| 196 |
|
|---|
| 197 |
|
|---|
| 198 |
|
|---|
| 199 |
|
|---|
| 200 |
|
|---|
| 201 |
void do_cmd_destroy(void) |
|---|
| 202 |
{ |
|---|
| 203 |
int item, amt; |
|---|
| 204 |
|
|---|
| 205 |
object_type *o_ptr; |
|---|
| 206 |
|
|---|
| 207 |
object_type *i_ptr; |
|---|
| 208 |
object_type object_type_body; |
|---|
| 209 |
|
|---|
| 210 |
char o_name[120]; |
|---|
| 211 |
char out_val[160]; |
|---|
| 212 |
|
|---|
| 213 |
cptr q, s; |
|---|
| 214 |
|
|---|
| 215 |
|
|---|
| 216 |
q = "Destroy which item? "; |
|---|
| 217 |
s = "You have nothing to destroy."; |
|---|
| 218 |
if (!get_item(&item, q, s, (USE_INVEN | USE_EQUIP | USE_FLOOR | CAN_SQUELCH))) return; |
|---|
| 219 |
|
|---|
| 220 |
|
|---|
| 221 |
if (item == ALL_SQUELCHED) |
|---|
| 222 |
{ |
|---|
| 223 |
squelch_items(); |
|---|
| 224 |
return; |
|---|
| 225 |
} |
|---|
| 226 |
|
|---|
| 227 |
|
|---|
| 228 |
if (item >= 0) |
|---|
| 229 |
{ |
|---|
| 230 |
o_ptr = &inventory[item]; |
|---|
| 231 |
} |
|---|
| 232 |
|
|---|
| 233 |
|
|---|
| 234 |
else |
|---|
| 235 |
{ |
|---|
| 236 |
o_ptr = &o_list[0 - item]; |
|---|
| 237 |
} |
|---|
| 238 |
|
|---|
| 239 |
|
|---|
| 240 |
amt = get_quantity(NULL, o_ptr->number); |
|---|
| 241 |
|
|---|
| 242 |
|
|---|
| 243 |
if (amt <= 0) return; |
|---|
| 244 |
|
|---|
| 245 |
|
|---|
| 246 |
i_ptr = &object_type_body; |
|---|
| 247 |
|
|---|
| 248 |
|
|---|
| 249 |
object_copy(i_ptr, o_ptr); |
|---|
| 250 |
|
|---|
| 251 |
if ((o_ptr->tval == TV_WAND) || |
|---|
| 252 |
(o_ptr->tval == TV_STAFF) || |
|---|
| 253 |
(o_ptr->tval == TV_ROD)) |
|---|
| 254 |
{ |
|---|
| 255 |
|
|---|
| 256 |
i_ptr->pval = o_ptr->pval * amt / o_ptr->number; |
|---|
| 257 |
} |
|---|
| 258 |
|
|---|
| 259 |
|
|---|
| 260 |
i_ptr->number = amt; |
|---|
| 261 |
|
|---|
| 262 |
|
|---|
| 263 |
object_desc(o_name, sizeof(o_name), i_ptr, TRUE, ODESC_FULL); |
|---|
| 264 |
|
|---|
| 265 |
|
|---|
| 266 |
strnfmt(out_val, sizeof(out_val), "Really destroy %s? ", o_name); |
|---|
| 267 |
if (!get_check(out_val)) return; |
|---|
| 268 |
|
|---|
| 269 |
|
|---|
| 270 |
if (artifact_p(o_ptr)) |
|---|
| 271 |
{ |
|---|
| 272 |
|
|---|
| 273 |
msg_format("You cannot destroy %s.", o_name); |
|---|
| 274 |
|
|---|
| 275 |
|
|---|
| 276 |
if (object_known_p(o_ptr)) return; |
|---|
| 277 |
|
|---|
| 278 |
|
|---|
| 279 |
if (o_ptr->ident & (IDENT_SENSE)) |
|---|
| 280 |
{ |
|---|
| 281 |
|
|---|
| 282 |
if (cursed_p(o_ptr)) |
|---|
| 283 |
o_ptr->pseudo = INSCRIP_TERRIBLE; |
|---|
| 284 |
else |
|---|
| 285 |
o_ptr->pseudo = INSCRIP_SPECIAL; |
|---|
| 286 |
} |
|---|
| 287 |
else |
|---|
| 288 |
{ |
|---|
| 289 |
|
|---|
| 290 |
o_ptr->pseudo = INSCRIP_INDESTRUCTIBLE; |
|---|
| 291 |
} |
|---|
| 292 |
|
|---|
| 293 |
|
|---|
| 294 |
p_ptr->notice |= (PN_COMBINE); |
|---|
| 295 |
|
|---|
| 296 |
|
|---|
| 297 |
p_ptr->redraw |= (PR_INVEN | PR_EQUIP); |
|---|
| 298 |
|
|---|
| 299 |
|
|---|
| 300 |
return; |
|---|
| 301 |
} |
|---|
| 302 |
|
|---|
| 303 |
|
|---|
| 304 |
message_format(MSG_DESTROY, 0, "You destroy %s.", o_name); |
|---|
| 305 |
|
|---|
| 306 |
|
|---|
| 307 |
reduce_charges(o_ptr, amt); |
|---|
| 308 |
|
|---|
| 309 |
|
|---|
| 310 |
if (item >= 0) |
|---|
| 311 |
{ |
|---|
| 312 |
inven_item_increase(item, -amt); |
|---|
| 313 |
inven_item_describe(item); |
|---|
| 314 |
inven_item_optimize(item); |
|---|
| 315 |
} |
|---|
| 316 |
|
|---|
| 317 |
|
|---|
| 318 |
else |
|---|
| 319 |
{ |
|---|
| 320 |
floor_item_increase(0 - item, -amt); |
|---|
| 321 |
floor_item_describe(0 - item); |
|---|
| 322 |
floor_item_optimize(0 - item); |
|---|
| 323 |
} |
|---|
| 324 |
|
|---|
| 325 |
#if 0 |
|---|
| 326 |
|
|---|
| 327 |
|
|---|
| 328 |
|
|---|
| 329 |
|
|---|
| 330 |
|
|---|
| 331 |
|
|---|
| 332 |
if ((item < 0) && (cave_o_idx[p_ptr->py][p_ptr->px])) |
|---|
| 333 |
{ |
|---|
| 334 |
|
|---|
| 335 |
p_ptr->command_cmd = 'k'; |
|---|
| 336 |
p_ptr->command_rep = 2; |
|---|
| 337 |
} |
|---|
| 338 |
#endif |
|---|
| 339 |
} |
|---|
| 340 |
|
|---|
| 341 |
|
|---|
| 342 |
|
|---|
| 343 |
|
|---|
| 344 |
void refill_lamp(object_type *j_ptr, object_type *o_ptr, int item) |
|---|
| 345 |
{ |
|---|
| 346 |
|
|---|
| 347 |
j_ptr->timeout += o_ptr->timeout ? o_ptr->timeout : o_ptr->pval; |
|---|
| 348 |
|
|---|
| 349 |
|
|---|
| 350 |
msg_print("You fuel your lamp."); |
|---|
| 351 |
|
|---|
| 352 |
|
|---|
| 353 |
if (j_ptr->timeout >= FUEL_LAMP) |
|---|
| 354 |
{ |
|---|
| 355 |
j_ptr->timeout = FUEL_LAMP; |
|---|
| 356 |
msg_print("Your lamp is full."); |
|---|
| 357 |
} |
|---|
| 358 |
|
|---|
| 359 |
|
|---|
| 360 |
if (o_ptr->sval == SV_LITE_LANTERN) |
|---|
| 361 |
{ |
|---|
| 362 |
|
|---|
| 363 |
if (o_ptr->number > 1) |
|---|
| 364 |
{ |
|---|
| 365 |
object_type *i_ptr; |
|---|
| 366 |
object_type object_type_body; |
|---|
| 367 |
|
|---|
| 368 |
|
|---|
| 369 |
i_ptr = &object_type_body; |
|---|
| 370 |
|
|---|
| 371 |
|
|---|
| 372 |
object_copy(i_ptr, o_ptr); |
|---|
| 373 |
|
|---|
| 374 |
|
|---|
| 375 |
i_ptr->number = 1; |
|---|
| 376 |
|
|---|
| 377 |
|
|---|
| 378 |
i_ptr->timeout = 0; |
|---|
| 379 |
|
|---|
| 380 |
|
|---|
| 381 |
o_ptr->number--; |
|---|
| 382 |
p_ptr->total_weight -= i_ptr->weight; |
|---|
| 383 |
|
|---|
| 384 |
|
|---|
| 385 |
if (item >= 0) |
|---|
| 386 |
item = inven_carry(i_ptr); |
|---|
| 387 |
else |
|---|
| 388 |
drop_near(i_ptr, 0, p_ptr->py, p_ptr->px); |
|---|
| 389 |
} |
|---|
| 390 |
|
|---|
| 391 |
|
|---|
| 392 |
else |
|---|
| 393 |
{ |
|---|
| 394 |
|
|---|
| 395 |
o_ptr->timeout = 0; |
|---|
| 396 |
} |
|---|
| 397 |
|
|---|
| 398 |
|
|---|
| 399 |
p_ptr->notice |= (PN_COMBINE | PN_REORDER); |
|---|
| 400 |
|
|---|
| 401 |
|
|---|
| 402 |
p_ptr->redraw |= (PR_INVEN); |
|---|
| 403 |
} |
|---|
| 404 |
|
|---|
| 405 |
|
|---|
| 406 |
else |
|---|
| 407 |
{ |
|---|
| 408 |
|
|---|
| 409 |
if (item >= 0) |
|---|
| 410 |
{ |
|---|
| 411 |
inven_item_increase(item, -1); |
|---|
| 412 |
inven_item_describe(item); |
|---|
| 413 |
inven_item_optimize(item); |
|---|
| 414 |
} |
|---|
| 415 |
|
|---|
| 416 |
|
|---|
| 417 |
else |
|---|
| 418 |
{ |
|---|
| 419 |
floor_item_increase(0 - item, -1); |
|---|
| 420 |
floor_item_describe(0 - item); |
|---|
| 421 |
floor_item_optimize(0 - item); |
|---|
| 422 |
} |
|---|
| 423 |
} |
|---|
| 424 |
|
|---|
| 425 |
|
|---|
| 426 |
p_ptr->update |= (PU_TORCH); |
|---|
| 427 |
|
|---|
| 428 |
|
|---|
| 429 |
p_ptr->redraw |= (PR_EQUIP); |
|---|
| 430 |
} |
|---|
| 431 |
|
|---|
| 432 |
|
|---|
| 433 |
void refuel_torch(object_type *j_ptr, object_type *o_ptr, int item) |
|---|
| 434 |
{ |
|---|
| 435 |
|
|---|
| 436 |
j_ptr->timeout += o_ptr->timeout + 5; |
|---|
| 437 |
|
|---|
| 438 |
|
|---|
| 439 |
msg_print("You combine the torches."); |
|---|
| 440 |
|
|---|
| 441 |
|
|---|
| 442 |
if (j_ptr->timeout >= FUEL_TORCH) |
|---|
| 443 |
{ |
|---|
| 444 |
j_ptr->timeout = FUEL_TORCH; |
|---|
| 445 |
msg_print("Your torch is fully fueled."); |
|---|
| 446 |
} |
|---|
| 447 |
|
|---|
| 448 |
|
|---|
| 449 |
else |
|---|
| 450 |
{ |
|---|
| 451 |
msg_print("Your torch glows more brightly."); |
|---|
| 452 |
} |
|---|
| 453 |
|
|---|
| 454 |
|
|---|
| 455 |
if (item >= 0) |
|---|
| 456 |
{ |
|---|
| 457 |
inven_item_increase(item, -1); |
|---|
| 458 |
inven_item_describe(item); |
|---|
| 459 |
inven_item_optimize(item); |
|---|
| 460 |
} |
|---|
| 461 |
|
|---|
| 462 |
|
|---|
| 463 |
else |
|---|
| 464 |
{ |
|---|
| 465 |
floor_item_increase(0 - item, -1); |
|---|
| 466 |
floor_item_describe(0 - item); |
|---|
| 467 |
floor_item_optimize(0 - item); |
|---|
| 468 |
} |
|---|
| 469 |
|
|---|
| 470 |
|
|---|
| 471 |
p_ptr->update |= (PU_TORCH); |
|---|
| 472 |
|
|---|
| 473 |
|
|---|
| 474 |
p_ptr->redraw |= (PR_EQUIP); |
|---|
| 475 |
} |
|---|
| 476 |
|
|---|
| 477 |
|
|---|
| 478 |
|
|---|
| 479 |
|
|---|
| 480 |
|
|---|
| 481 |
|
|---|
| 482 |
|
|---|
| 483 |
|
|---|
| 484 |
|
|---|
| 485 |
void do_cmd_target(void) |
|---|
| 486 |
{ |
|---|
| 487 |
|
|---|
| 488 |
if (target_set_interactive(TARGET_KILL, -1, -1)) |
|---|
| 489 |
{ |
|---|
| 490 |
msg_print("Target Selected."); |
|---|
| 491 |
} |
|---|
| 492 |
|
|---|
| 493 |
|
|---|
| 494 |
else |
|---|
| 495 |
{ |
|---|
| 496 |
msg_print("Target Aborted."); |
|---|
| 497 |
} |
|---|
| 498 |
} |
|---|
| 499 |
|
|---|
| 500 |
|
|---|
| 501 |
|
|---|
| 502 |
|
|---|
| 503 |
|
|---|
| 504 |
|
|---|
| 505 |
void do_cmd_look(void) |
|---|
| 506 |
{ |
|---|
| 507 |
|
|---|
| 508 |
if (target_set_interactive(TARGET_LOOK, -1, -1)) |
|---|
| 509 |
{ |
|---|
| 510 |
msg_print("Target Selected."); |
|---|
| 511 |
} |
|---|
| 512 |
} |
|---|
| 513 |
|
|---|
| 514 |
|
|---|
| 515 |
|
|---|
| 516 |
|
|---|
| 517 |
|
|---|
| 518 |
|
|---|
| 519 |
void do_cmd_locate(void) |
|---|
| 520 |
{ |
|---|
| 521 |
int dir, y1, x1, y2, x2; |
|---|
| 522 |
|
|---|
| 523 |
char tmp_val[80]; |
|---|
| 524 |
|
|---|
| 525 |
char out_val[160]; |
|---|
| 526 |
|
|---|
| 527 |
|
|---|
| 528 |
|
|---|
| 529 |
y1 = Term->offset_y; |
|---|
| 530 |
x1 = Term->offset_x; |
|---|
| 531 |
|
|---|
| 532 |
|
|---|
| 533 |
while (1) |
|---|
| 534 |
{ |
|---|
| 535 |
|
|---|
| 536 |
y2 = Term->offset_y; |
|---|
| 537 |
x2 = Term->offset_x; |
|---|
| 538 |
|
|---|
| 539 |
|
|---|
| 540 |
if ((y2 == y1) && (x2 == x1)) |
|---|
| 541 |
{ |
|---|
| 542 |
tmp_val[0] = '\0'; |
|---|
| 543 |
} |
|---|
| 544 |
else |
|---|
| 545 |
{ |
|---|
| 546 |
strnfmt(tmp_val, sizeof(tmp_val), "%s%s of", |
|---|
| 547 |
((y2 < y1) ? " north" : (y2 > y1) ? " south" : ""), |
|---|
| 548 |
((x2 < x1) ? " west" : (x2 > x1) ? " east" : "")); |
|---|
| 549 |
} |
|---|
| 550 |
|
|---|
| 551 |
|
|---|
| 552 |
strnfmt(out_val, sizeof(out_val), |
|---|
| 553 |
"Map sector [%d,%d], which is%s your sector. Direction?", |
|---|
| 554 |
(y2 / PANEL_HGT), (x2 / PANEL_WID), tmp_val); |
|---|
| 555 |
|
|---|
| 556 |
|
|---|
| 557 |
if (center_player) |
|---|
| 558 |
{ |
|---|
| 559 |
strnfmt(out_val, sizeof(out_val), |
|---|
| 560 |
"Map sector [%d(%02d),%d(%02d)], which is%s your sector. Direction?", |
|---|
| 561 |
(y2 / PANEL_HGT), (y2 % PANEL_HGT), |
|---|
| 562 |
(x2 / PANEL_WID), (x2 % PANEL_WID), tmp_val); |
|---|
| 563 |
} |
|---|
| 564 |
|
|---|
| 565 |
|
|---|
| 566 |
dir = 0; |
|---|
| 567 |
|
|---|
| 568 |
|
|---|
| 569 |
while (!dir) |
|---|
| 570 |
{ |
|---|
| 571 |
char command; |
|---|
| 572 |
|
|---|
| 573 |
|
|---|
| 574 |
if (!get_com(out_val, &command)) break; |
|---|
| 575 |
|
|---|
| 576 |
|
|---|
| 577 |
dir = target_dir(command); |
|---|
| 578 |
|
|---|
| 579 |
|
|---|
| 580 |
if (!dir) bell("Illegal direction for locate!"); |
|---|
| 581 |
} |
|---|
| 582 |
|
|---|
| 583 |
|
|---|
| 584 |
if (!dir) break; |
|---|
| 585 |
|
|---|
| 586 |
|
|---|
| 587 |
change_panel(dir); |
|---|
| 588 |
|
|---|
| 589 |
|
|---|
| 590 |
handle_stuff(); |
|---|
| 591 |
} |
|---|
| 592 |
|
|---|
| 593 |
|
|---|
| 594 |
verify_panel(); |
|---|
| 595 |
} |
|---|
| 596 |
|
|---|
| 597 |
|
|---|
| 598 |
|
|---|
| 599 |
|
|---|
| 600 |
|
|---|
| 601 |
|
|---|
| 602 |
|
|---|
| 603 |
|
|---|
| 604 |
|
|---|
| 605 |
|
|---|
| 606 |
static cptr ident_info[] = |
|---|
| 607 |
{ |
|---|
| 608 |
" :A dark grid", |
|---|
| 609 |
"!:A potion (or oil)", |
|---|
| 610 |
"\":An amulet (or necklace)", |
|---|
| 611 |
"#:A wall (or secret door)", |
|---|
| 612 |
"$:Treasure (gold or gems)", |
|---|
| 613 |
"%:A vein (magma or quartz)", |
|---|
| 614 |
|
|---|
| 615 |
"':An open door", |
|---|
| 616 |
"(:Soft armor", |
|---|
| 617 |
"):A shield", |
|---|
| 618 |
"*:A vein with treasure", |
|---|
| 619 |
"+:A closed door", |
|---|
| 620 |
",:Food (or mushroom patch)", |
|---|
| 621 |
"-:A wand (or rod)", |
|---|
| 622 |
".:Floor", |
|---|
| 623 |
"/:A polearm (Axe/Pike/etc)", |
|---|
| 624 |
|
|---|
| 625 |
"1:Entrance to General Store", |
|---|
| 626 |
"2:Entrance to Armory", |
|---|
| 627 |
"3:Entrance to Weaponsmith", |
|---|
| 628 |
"4:Entrance to Temple", |
|---|
| 629 |
"5:Entrance to Alchemy shop", |
|---|
| 630 |
"6:Entrance to Magic store", |
|---|
| 631 |
"7:Entrance to Black Market", |
|---|
| 632 |
"8:Entrance to your home", |
|---|
| 633 |
|
|---|
| 634 |
"::Rubble", |
|---|
| 635 |
";:A glyph of warding", |
|---|
| 636 |
"<:An up staircase", |
|---|
| 637 |
"=:A ring", |
|---|
| 638 |
">:A down staircase", |
|---|
| 639 |
"?:A scroll", |
|---|
| 640 |
"@:You", |
|---|
| 641 |
"A:Angel", |
|---|
| 642 |
"B:Bird", |
|---|
| 643 |
"C:Canine", |
|---|
| 644 |
"D:Ancient Dragon/Wyrm", |
|---|
| 645 |
"E:Elemental", |
|---|
| 646 |
"F:Dragon Fly", |
|---|
| 647 |
"G:Ghost", |
|---|
| 648 |
"H:Hybrid", |
|---|
| 649 |
"I:Insect", |
|---|
| 650 |
"J:Snake", |
|---|
| 651 |
"K:Killer Beetle", |
|---|
| 652 |
"L:Lich", |
|---|
| 653 |
"M:Multi-Headed Reptile", |
|---|
| 654 |
|
|---|
| 655 |
"O:Ogre", |
|---|
| 656 |
"P:Giant Humanoid", |
|---|
| 657 |
"Q:Quylthulg (Pulsing Flesh Mound)", |
|---|
| 658 |
"R:Reptile/Amphibian", |
|---|
| 659 |
"S:Spider/Scorpion/Tick", |
|---|
| 660 |
"T:Troll", |
|---|
| 661 |
"U:Major Demon", |
|---|
| 662 |
"V:Vampire", |
|---|
| 663 |
"W:Wight/Wraith/etc", |
|---|
| 664 |
"X:Xorn/Xaren/etc", |
|---|
| 665 |
"Y:Yeti", |
|---|
| 666 |
"Z:Zephyr Hound", |
|---|
| 667 |
"[:Hard armor", |
|---|
| 668 |
"\\:A hafted weapon (mace/whip/etc)", |
|---|
| 669 |
"]:Misc. armor", |
|---|
| 670 |
"^:A trap", |
|---|
| 671 |
"_:A staff", |
|---|
| 672 |
|
|---|
| 673 |
"a:Ant", |
|---|
| 674 |
"b:Bat", |
|---|
| 675 |
"c:Centipede", |
|---|
| 676 |
"d:Dragon", |
|---|
| 677 |
"e:Floating Eye", |
|---|
| 678 |
"f:Feline", |
|---|
| 679 |
"g:Golem", |
|---|
| 680 |
"h:Hobbit/Elf/Dwarf", |
|---|
| 681 |
"i:Icky Thing", |
|---|
| 682 |
"j:Jelly", |
|---|
| 683 |
"k:Kobold", |
|---|
| 684 |
"l:Louse", |
|---|
| 685 |
"m:Mold", |
|---|
| 686 |
"n:Naga", |
|---|
| 687 |
"o:Orc", |
|---|
| 688 |
"p:Person/Human", |
|---|
| 689 |
"q:Quadruped", |
|---|
| 690 |
"r:Rodent", |
|---|
| 691 |
"s:Skeleton", |
|---|
| 692 |
"t:Townsperson", |
|---|
| 693 |
"u:Minor Demon", |
|---|
| 694 |
"v:Vortex", |
|---|
| 695 |
"w:Worm/Worm-Mass", |
|---|
| 696 |
|
|---|
| 697 |
"y:Yeek", |
|---|
| 698 |
"z:Zombie/Mummy", |
|---|
| 699 |
"{:A missile (arrow/bolt/shot)", |
|---|
| 700 |
"|:An edged weapon (sword/dagger/etc)", |
|---|
| 701 |
"}:A launcher (bow/crossbow/sling)", |
|---|
| 702 |
"~:A tool (or miscellaneous item)", |
|---|
| 703 |
NULL |
|---|
| 704 |
}; |
|---|
| 705 |
|
|---|
| 706 |
|
|---|
| 707 |
|
|---|
| 708 |
|
|---|
| 709 |
|
|---|
| 710 |
|
|---|
| 711 |
|
|---|
| 712 |
|
|---|
| 713 |
|
|---|
| 714 |
bool ang_sort_comp_hook(const void *u, const void *v, int a, int b) |
|---|
| 715 |
{ |
|---|
| 716 |
const u16b *who = (const u16b *)(u); |
|---|
| 717 |
const u16b *why = (const u16b *)(v); |
|---|
| 718 |
|
|---|
| 719 |
int w1 = who[a]; |
|---|
| 720 |
int w2 = who[b]; |
|---|
| 721 |
|
|---|
| 722 |
int z1, z2; |
|---|
| 723 |
|
|---|
| 724 |
|
|---|
| 725 |
|
|---|
| 726 |
if (*why >= 4) |
|---|
| 727 |
{ |
|---|
| 728 |
|
|---|
| 729 |
z1 = l_list[w1].pkills; |
|---|
| 730 |
z2 = l_list[w2].pkills; |
|---|
| 731 |
|
|---|
| 732 |
|
|---|
| 733 |
if (z1 < z2) return (TRUE); |
|---|
| 734 |
if (z1 > z2) return (FALSE); |
|---|
| 735 |
} |
|---|
| 736 |
|
|---|
| 737 |
|
|---|
| 738 |
|
|---|
| 739 |
if (*why >= 3) |
|---|
| 740 |
{ |
|---|
| 741 |
|
|---|
| 742 |
z1 = l_list[w1].tkills; |
|---|
| 743 |
z2 = l_list[w2].tkills; |
|---|
| 744 |
|
|---|
| 745 |
|
|---|
| 746 |
if (z1 < z2) return (TRUE); |
|---|
| 747 |
if (z1 > z2) return (FALSE); |
|---|
| 748 |
} |
|---|
| 749 |
|
|---|
| 750 |
|
|---|
| 751 |
|
|---|
| 752 |
if (*why >= 2) |
|---|
| 753 |
{ |
|---|
| 754 |
|
|---|
| 755 |
z1 = r_info[w1].level; |
|---|
| 756 |
z2 = r_info[w2].level; |
|---|
| 757 |
|
|---|
| 758 |
|
|---|
| 759 |
if (z1 < z2) return (TRUE); |
|---|
| 760 |
if (z1 > z2) return (FALSE); |
|---|
| 761 |
} |
|---|
| 762 |
|
|---|
| 763 |
|
|---|
| 764 |
|
|---|
| 765 |
if (*why >= 1) |
|---|
| 766 |
{ |
|---|
| 767 |
|
|---|
| 768 |
z1 = r_info[w1].mexp; |
|---|
| 769 |
z2 = r_info[w2].mexp; |
|---|
| 770 |
|
|---|
| 771 |
|
|---|
| 772 |
if (z1 < z2) return (TRUE); |
|---|
| 773 |
if (z1 > z2) return (FALSE); |
|---|
| 774 |
} |
|---|
| 775 |
|
|---|
| 776 |
|
|---|
| 777 |
|
|---|
| 778 |
return (w1 <= w2); |
|---|
| 779 |
} |
|---|
| 780 |
|
|---|
| 781 |
|
|---|
| 782 |
|
|---|
| 783 |
|
|---|
| 784 |
|
|---|
| 785 |
|
|---|
| 786 |
|
|---|
| 787 |
|
|---|
| 788 |
void ang_sort_swap_hook(void *u, void *v, int a, int b) |
|---|
| 789 |
{ |
|---|
| 790 |
u16b *who = (u16b*)(u); |
|---|
| 791 |
|
|---|
| 792 |
u16b holder; |
|---|
| 793 |
|
|---|
| 794 |
|
|---|
| 795 |
(void)v; |
|---|
| 796 |
|
|---|
| 797 |
|
|---|
| 798 |
holder = who[a]; |
|---|
| 799 |
who[a] = who[b]; |
|---|
| 800 |
who[b] = holder; |
|---|
| 801 |
} |
|---|
| 802 |
|
|---|
| 803 |
|
|---|
| 804 |
|
|---|
| 805 |
|
|---|
| 806 |
|
|---|
| 807 |
|
|---|
| 808 |
|
|---|
| 809 |
|
|---|
| 810 |
|
|---|
| 811 |
|
|---|
| 812 |
|
|---|
| 813 |
|
|---|
| 814 |
|
|---|
| 815 |
|
|---|
| 816 |
void do_cmd_query_symbol(void) |
|---|
| 817 |
{ |
|---|
| 818 |
int i, n, r_idx; |
|---|
| 819 |
char sym; |
|---|
| 820 |
char buf[128]; |
|---|
| 821 |
|
|---|
| 822 |
ui_event_data query; |
|---|
| 823 |
|
|---|
| 824 |
bool all = FALSE; |
|---|
| 825 |
bool uniq = FALSE; |
|---|
| 826 |
bool norm = FALSE; |
|---|
| 827 |
|
|---|
| 828 |
bool recall = FALSE; |
|---|
| 829 |
|
|---|
| 830 |
u16b why = 0; |
|---|
| 831 |
u16b *who; |
|---|
| 832 |
|
|---|
| 833 |
|
|---|
| 834 |
|
|---|
| 835 |
if (!get_com("Enter character to be identified: ", &sym)) return; |
|---|
| 836 |
|
|---|
| 837 |
|
|---|
| 838 |
for (i = 0; ident_info[i]; ++i) |
|---|
| 839 |
{ |
|---|
| 840 |
if (sym == ident_info[i][0]) break; |
|---|
| 841 |
} |
|---|
| 842 |
|
|---|
| 843 |
|
|---|
| 844 |
if (sym == KTRL('A')) |
|---|
| 845 |
{ |
|---|
| 846 |
all = TRUE; |
|---|
| 847 |
my_strcpy(buf, "Full monster list.", sizeof(buf)); |
|---|
| 848 |
} |
|---|
| 849 |
else if (sym == KTRL('U')) |
|---|
| 850 |
{ |
|---|
| 851 |
all = uniq = TRUE; |
|---|
| 852 |
my_strcpy(buf, "Unique monster list.", sizeof(buf)); |
|---|
| 853 |
} |
|---|
| 854 |
else if (sym == KTRL('N')) |
|---|
| 855 |
{ |
|---|
| 856 |
all = norm = TRUE; |
|---|
| 857 |
my_strcpy(buf, "Non-unique monster list.", sizeof(buf)); |
|---|
| 858 |
} |
|---|
| 859 |
else if (ident_info[i]) |
|---|
| 860 |
{ |
|---|
| 861 |
strnfmt(buf, sizeof(buf), "%c - %s.", sym, ident_info[i] + 2); |
|---|
| 862 |
} |
|---|
| 863 |
else |
|---|
| 864 |
{ |
|---|
| 865 |
strnfmt(buf, sizeof(buf), "%c - %s.", sym, "Unknown Symbol"); |
|---|
| 866 |
} |
|---|
| 867 |
|
|---|
| 868 |
|
|---|
| 869 |
prt(buf, 0, 0); |
|---|
| 870 |
|
|---|
| 871 |
|
|---|
| 872 |
|
|---|
| 873 |
who = C_ZNEW(z_info->r_max, u16b); |
|---|
| 874 |
|
|---|
| 875 |
|
|---|
| 876 |
for (n = 0, i = 1; i < z_info->r_max - 1; i++) |
|---|
| 877 |
{ |
|---|
| 878 |
monster_race *r_ptr = &r_info[i]; |
|---|
| 879 |
monster_lore *l_ptr = &l_list[i]; |
|---|
| 880 |
|
|---|
| 881 |
|
|---|
| 882 |
if (!cheat_know && !l_ptr->sights) continue; |
|---|
| 883 |
|
|---|
| 884 |
|
|---|
| 885 |
if (norm && (r_ptr->flags[0] & (RF0_UNIQUE))) continue; |
|---|
| 886 |
|
|---|
| 887 |
|
|---|
| 888 |
if (uniq && !(r_ptr->flags[0] & (RF0_UNIQUE))) continue; |
|---|
| 889 |
|
|---|
| 890 |
|
|---|
| 891 |
if (all || (r_ptr->d_char == sym)) who[n++] = i; |
|---|
| 892 |
} |
|---|
| 893 |
|
|---|
| 894 |
|
|---|
| 895 |
if (!n) |
|---|
| 896 |
{ |
|---|
| 897 |
|
|---|
| 898 |
FREE(who); |
|---|
| 899 |
|
|---|
| 900 |
return; |
|---|
| 901 |
} |
|---|
| 902 |
|
|---|
| 903 |
|
|---|
| 904 |
button_add("[y]", 'y'); |
|---|
| 905 |
button_add("[k]", 'k'); |
|---|
| 906 |
|
|---|
| 907 |
button_add("[n]", 'q'); |
|---|
| 908 |
redraw_stuff(); |
|---|
| 909 |
|
|---|
| 910 |
|
|---|
| 911 |
put_str("Recall details? (y/k/n): ", 0, 40); |
|---|
| 912 |
|
|---|
| 913 |
|
|---|
| 914 |
query = inkey_ex(); |
|---|
| 915 |
|
|---|
| 916 |
|
|---|
| 917 |
prt(buf, 0, 0); |
|---|
| 918 |
|
|---|
| 919 |
|
|---|
| 920 |
button_kill('y'); |
|---|
| 921 |
button_kill('k'); |
|---|
| 922 |
button_kill('q'); |
|---|
| 923 |
redraw_stuff(); |
|---|
| 924 |
|
|---|
| 925 |
|
|---|
| 926 |
if (query.key == 'k') |
|---|
| 927 |
{ |
|---|
| 928 |
|
|---|
| 929 |
why = 4; |
|---|
| 930 |
} |
|---|
| 931 |
else if (query.key == 'y' || query.key == 'p') |
|---|
| 932 |
{ |
|---|
| 933 |
|
|---|
| 934 |
why = 2; |
|---|
| 935 |
} |
|---|
| 936 |
else |
|---|
| 937 |
{ |
|---|
| 938 |
|
|---|
| 939 |
|
|---|
| 940 |
|
|---|
| 941 |
FREE(who); |
|---|
| 942 |
|
|---|
| 943 |
return; |
|---|
| 944 |
} |
|---|
| 945 |
|
|---|
| 946 |
|
|---|
| 947 |
|
|---|
| 948 |
ang_sort_comp = ang_sort_comp_hook; |
|---|
| 949 |
ang_sort_swap = ang_sort_swap_hook; |
|---|
| 950 |
|
|---|
| 951 |
|
|---|
| 952 |
ang_sort(who, &why, n); |
|---|
| 953 |
|
|---|
| 954 |
|
|---|
| 955 |
i = n - 1; |
|---|
| 956 |
|
|---|
| 957 |
|
|---|
| 958 |
button_add("[r]", 'r'); |
|---|
| 959 |
button_add("[-]", '-'); |
|---|
| 9 |
|---|