| 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 |
#include "game-event.h" |
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 |
|
|---|
| 33 |
|
|---|
| 34 |
|
|---|
| 35 |
|
|---|
| 36 |
int distance(int y1, int x1, int y2, int x2) |
|---|
| 37 |
{ |
|---|
| 38 |
int ay, ax; |
|---|
| 39 |
|
|---|
| 40 |
|
|---|
| 41 |
ay = (y1 > y2) ? (y1 - y2) : (y2 - y1); |
|---|
| 42 |
ax = (x1 > x2) ? (x1 - x2) : (x2 - x1); |
|---|
| 43 |
|
|---|
| 44 |
|
|---|
| 45 |
return ((ay > ax) ? (ay + (ax>>1)) : (ax + (ay>>1))); |
|---|
| 46 |
} |
|---|
| 47 |
|
|---|
| 48 |
|
|---|
| 49 |
|
|---|
| 50 |
|
|---|
| 51 |
|
|---|
| 52 |
|
|---|
| 53 |
|
|---|
| 54 |
|
|---|
| 55 |
|
|---|
| 56 |
|
|---|
| 57 |
|
|---|
| 58 |
|
|---|
| 59 |
|
|---|
| 60 |
|
|---|
| 61 |
|
|---|
| 62 |
|
|---|
| 63 |
|
|---|
| 64 |
|
|---|
| 65 |
|
|---|
| 66 |
|
|---|
| 67 |
|
|---|
| 68 |
|
|---|
| 69 |
|
|---|
| 70 |
|
|---|
| 71 |
|
|---|
| 72 |
|
|---|
| 73 |
|
|---|
| 74 |
|
|---|
| 75 |
|
|---|
| 76 |
|
|---|
| 77 |
|
|---|
| 78 |
|
|---|
| 79 |
|
|---|
| 80 |
|
|---|
| 81 |
|
|---|
| 82 |
|
|---|
| 83 |
|
|---|
| 84 |
|
|---|
| 85 |
bool los(int y1, int x1, int y2, int x2) |
|---|
| 86 |
{ |
|---|
| 87 |
|
|---|
| 88 |
int dx, dy; |
|---|
| 89 |
|
|---|
| 90 |
|
|---|
| 91 |
int ax, ay; |
|---|
| 92 |
|
|---|
| 93 |
|
|---|
| 94 |
int sx, sy; |
|---|
| 95 |
|
|---|
| 96 |
|
|---|
| 97 |
int qx, qy; |
|---|
| 98 |
|
|---|
| 99 |
|
|---|
| 100 |
int tx, ty; |
|---|
| 101 |
|
|---|
| 102 |
|
|---|
| 103 |
int f1, f2; |
|---|
| 104 |
|
|---|
| 105 |
|
|---|
| 106 |
int m; |
|---|
| 107 |
|
|---|
| 108 |
|
|---|
| 109 |
|
|---|
| 110 |
dy = y2 - y1; |
|---|
| 111 |
dx = x2 - x1; |
|---|
| 112 |
|
|---|
| 113 |
|
|---|
| 114 |
ay = ABS(dy); |
|---|
| 115 |
ax = ABS(dx); |
|---|
| 116 |
|
|---|
| 117 |
|
|---|
| 118 |
|
|---|
| 119 |
if ((ax < 2) && (ay < 2)) return (TRUE); |
|---|
| 120 |
|
|---|
| 121 |
|
|---|
| 122 |
|
|---|
| 123 |
if (!dx) |
|---|
| 124 |
{ |
|---|
| 125 |
|
|---|
| 126 |
if (dy > 0) |
|---|
| 127 |
{ |
|---|
| 128 |
for (ty = y1 + 1; ty < y2; ty++) |
|---|
| 129 |
{ |
|---|
| 130 |
if (!cave_floor_bold(ty, x1)) return (FALSE); |
|---|
| 131 |
} |
|---|
| 132 |
} |
|---|
| 133 |
|
|---|
| 134 |
|
|---|
| 135 |
else |
|---|
| 136 |
{ |
|---|
| 137 |
for (ty = y1 - 1; ty > y2; ty--) |
|---|
| 138 |
{ |
|---|
| 139 |
if (!cave_floor_bold(ty, x1)) return (FALSE); |
|---|
| 140 |
} |
|---|
| 141 |
} |
|---|
| 142 |
|
|---|
| 143 |
|
|---|
| 144 |
return (TRUE); |
|---|
| 145 |
} |
|---|
| 146 |
|
|---|
| 147 |
|
|---|
| 148 |
if (!dy) |
|---|
| 149 |
{ |
|---|
| 150 |
|
|---|
| 151 |
if (dx > 0) |
|---|
| 152 |
{ |
|---|
| 153 |
for (tx = x1 + 1; tx < x2; tx++) |
|---|
| 154 |
{ |
|---|
| 155 |
if (!cave_floor_bold(y1, tx)) return (FALSE); |
|---|
| 156 |
} |
|---|
| 157 |
} |
|---|
| 158 |
|
|---|
| 159 |
|
|---|
| 160 |
else |
|---|
| 161 |
{ |
|---|
| 162 |
for (tx = x1 - 1; tx > x2; tx--) |
|---|
| 163 |
{ |
|---|
| 164 |
if (!cave_floor_bold(y1, tx)) return (FALSE); |
|---|
| 165 |
} |
|---|
| 166 |
} |
|---|
| 167 |
|
|---|
| 168 |
|
|---|
| 169 |
return (TRUE); |
|---|
| 170 |
} |
|---|
| 171 |
|
|---|
| 172 |
|
|---|
| 173 |
|
|---|
| 174 |
sx = (dx < 0) ? -1 : 1; |
|---|
| 175 |
sy = (dy < 0) ? -1 : 1; |
|---|
| 176 |
|
|---|
| 177 |
|
|---|
| 178 |
|
|---|
| 179 |
if (ax == 1) |
|---|
| 180 |
{ |
|---|
| 181 |
if (ay == 2) |
|---|
| 182 |
{ |
|---|
| 183 |
if (cave_floor_bold(y1 + sy, x1)) return (TRUE); |
|---|
| 184 |
} |
|---|
| 185 |
} |
|---|
| 186 |
|
|---|
| 187 |
|
|---|
| 188 |
else if (ay == 1) |
|---|
| 189 |
{ |
|---|
| 190 |
if (ax == 2) |
|---|
| 191 |
{ |
|---|
| 192 |
if (cave_floor_bold(y1, x1 + sx)) return (TRUE); |
|---|
| 193 |
} |
|---|
| 194 |
} |
|---|
| 195 |
|
|---|
| 196 |
|
|---|
| 197 |
|
|---|
| 198 |
f2 = (ax * ay); |
|---|
| 199 |
|
|---|
| 200 |
|
|---|
| 201 |
f1 = f2 << 1; |
|---|
| 202 |
|
|---|
| 203 |
|
|---|
| 204 |
|
|---|
| 205 |
if (ax >= ay) |
|---|
| 206 |
{ |
|---|
| 207 |
|
|---|
| 208 |
qy = ay * ay; |
|---|
| 209 |
m = qy << 1; |
|---|
| 210 |
|
|---|
| 211 |
tx = x1 + sx; |
|---|
| 212 |
|
|---|
| 213 |
|
|---|
| 214 |
if (qy == f2) |
|---|
| 215 |
{ |
|---|
| 216 |
ty = y1 + sy; |
|---|
| 217 |
qy -= f1; |
|---|
| 218 |
} |
|---|
| 219 |
else |
|---|
| 220 |
{ |
|---|
| 221 |
ty = y1; |
|---|
| 222 |
} |
|---|
| 223 |
|
|---|
| 224 |
|
|---|
| 225 |
|
|---|
| 226 |
while (x2 - tx) |
|---|
| 227 |
{ |
|---|
| 228 |
if (!cave_floor_bold(ty, tx)) return (FALSE); |
|---|
| 229 |
|
|---|
| 230 |
qy += m; |
|---|
| 231 |
|
|---|
| 232 |
if (qy < f2) |
|---|
| 233 |
{ |
|---|
| 234 |
tx += sx; |
|---|
| 235 |
} |
|---|
| 236 |
else if (qy > f2) |
|---|
| 237 |
{ |
|---|
| 238 |
ty += sy; |
|---|
| 239 |
if (!cave_floor_bold(ty, tx)) return (FALSE); |
|---|
| 240 |
qy -= f1; |
|---|
| 241 |
tx += sx; |
|---|
| 242 |
} |
|---|
| 243 |
else |
|---|
| 244 |
{ |
|---|
| 245 |
ty += sy; |
|---|
| 246 |
qy -= f1; |
|---|
| 247 |
tx += sx; |
|---|
| 248 |
} |
|---|
| 249 |
} |
|---|
| 250 |
} |
|---|
| 251 |
|
|---|
| 252 |
|
|---|
| 253 |
else |
|---|
| 254 |
{ |
|---|
| 255 |
|
|---|
| 256 |
qx = ax * ax; |
|---|
| 257 |
m = qx << 1; |
|---|
| 258 |
|
|---|
| 259 |
ty = y1 + sy; |
|---|
| 260 |
|
|---|
| 261 |
if (qx == f2) |
|---|
| 262 |
{ |
|---|
| 263 |
tx = x1 + sx; |
|---|
| 264 |
qx -= f1; |
|---|
| 265 |
} |
|---|
| 266 |
else |
|---|
| 267 |
{ |
|---|
| 268 |
tx = x1; |
|---|
| 269 |
} |
|---|
| 270 |
|
|---|
| 271 |
|
|---|
| 272 |
|
|---|
| 273 |
while (y2 - ty) |
|---|
| 274 |
{ |
|---|
| 275 |
if (!cave_floor_bold(ty, tx)) return (FALSE); |
|---|
| 276 |
|
|---|
| 277 |
qx += m; |
|---|
| 278 |
|
|---|
| 279 |
if (qx < f2) |
|---|
| 280 |
{ |
|---|
| 281 |
ty += sy; |
|---|
| 282 |
} |
|---|
| 283 |
else if (qx > f2) |
|---|
| 284 |
{ |
|---|
| 285 |
tx += sx; |
|---|
| 286 |
if (!cave_floor_bold(ty, tx)) return (FALSE); |
|---|
| 287 |
qx -= f1; |
|---|
| 288 |
ty += sy; |
|---|
| 289 |
} |
|---|
| 290 |
else |
|---|
| 291 |
{ |
|---|
| 292 |
tx += sx; |
|---|
| 293 |
qx -= f1; |
|---|
| 294 |
ty += sy; |
|---|
| 295 |
} |
|---|
| 296 |
} |
|---|
| 297 |
} |
|---|
| 298 |
|
|---|
| 299 |
|
|---|
| 300 |
return (TRUE); |
|---|
| 301 |
} |
|---|
| 302 |
|
|---|
| 303 |
|
|---|
| 304 |
|
|---|
| 305 |
|
|---|
| 306 |
|
|---|
| 307 |
|
|---|
| 308 |
|
|---|
| 309 |
bool no_lite(void) |
|---|
| 310 |
{ |
|---|
| 311 |
return (!player_can_see_bold(p_ptr->py, p_ptr->px)); |
|---|
| 312 |
} |
|---|
| 313 |
|
|---|
| 314 |
|
|---|
| 315 |
|
|---|
| 316 |
|
|---|
| 317 |
|
|---|
| 318 |
|
|---|
| 319 |
|
|---|
| 320 |
|
|---|
| 321 |
|
|---|
| 322 |
bool cave_valid_bold(int y, int x) |
|---|
| 323 |
{ |
|---|
| 324 |
object_type *o_ptr; |
|---|
| 325 |
|
|---|
| 326 |
|
|---|
| 327 |
if (cave_perma_bold(y, x)) return (FALSE); |
|---|
| 328 |
|
|---|
| 329 |
|
|---|
| 330 |
for (o_ptr = get_first_object(y, x); o_ptr; o_ptr = get_next_object(o_ptr)) |
|---|
| 331 |
{ |
|---|
| 332 |
|
|---|
| 333 |
if (artifact_p(o_ptr)) return (FALSE); |
|---|
| 334 |
} |
|---|
| 335 |
|
|---|
| 336 |
|
|---|
| 337 |
return (TRUE); |
|---|
| 338 |
} |
|---|
| 339 |
|
|---|
| 340 |
|
|---|
| 341 |
|
|---|
| 342 |
|
|---|
| 343 |
|
|---|
| 344 |
static u16b hallucinatory_monster(void) |
|---|
| 345 |
{ |
|---|
| 346 |
monster_race *r_ptr; |
|---|
| 347 |
|
|---|
| 348 |
byte a; |
|---|
| 349 |
char c; |
|---|
| 350 |
|
|---|
| 351 |
while (1) |
|---|
| 352 |
{ |
|---|
| 353 |
|
|---|
| 354 |
r_ptr = &r_info[randint0(z_info->r_max)]; |
|---|
| 355 |
|
|---|
| 356 |
|
|---|
| 357 |
if (!r_ptr->name) continue; |
|---|
| 358 |
|
|---|
| 359 |
|
|---|
| 360 |
a = r_ptr->x_attr; |
|---|
| 361 |
c = r_ptr->x_char; |
|---|
| 362 |
|
|---|
| 363 |
|
|---|
| 364 |
return (PICT(a,c)); |
|---|
| 365 |
} |
|---|
| 366 |
} |
|---|
| 367 |
|
|---|
| 368 |
|
|---|
| 369 |
|
|---|
| 370 |
|
|---|
| 371 |
|
|---|
| 372 |
static u16b hallucinatory_object(void) |
|---|
| 373 |
{ |
|---|
| 374 |
object_kind *k_ptr; |
|---|
| 375 |
|
|---|
| 376 |
byte a; |
|---|
| 377 |
char c; |
|---|
| 378 |
|
|---|
| 379 |
while (1) |
|---|
| 380 |
{ |
|---|
| 381 |
|
|---|
| 382 |
k_ptr = &k_info[randint0(z_info->k_max - 1) + 1]; |
|---|
| 383 |
|
|---|
| 384 |
|
|---|
| 385 |
if (!k_ptr->name) continue; |
|---|
| 386 |
|
|---|
| 387 |
|
|---|
| 388 |
a = k_ptr->x_attr; |
|---|
| 389 |
c = k_ptr->x_char; |
|---|
| 390 |
|
|---|
| 391 |
|
|---|
| 392 |
if ((a == 0) || (c == 0)) continue; |
|---|
| 393 |
|
|---|
| 394 |
|
|---|
| 395 |
return (PICT(a,c)); |
|---|
| 396 |
} |
|---|
| 397 |
} |
|---|
| 398 |
|
|---|
| 399 |
|
|---|
| 400 |
|
|---|
| 401 |
|
|---|
| 402 |
|
|---|
| 403 |
|
|---|
| 404 |
bool feat_supports_lighting(int feat) |
|---|
| 405 |
{ |
|---|
| 406 |
|
|---|
| 407 |
if (use_graphics == GRAPHICS_PSEUDO) return FALSE; |
|---|
| 408 |
|
|---|
| 409 |
if ((use_graphics != GRAPHICS_DAVID_GERVAIS) && |
|---|
| 410 |
(feat >= FEAT_TRAP_HEAD) && (feat <= FEAT_TRAP_TAIL)) |
|---|
| 411 |
{ |
|---|
| 412 |
return TRUE; |
|---|
| 413 |
} |
|---|
| 414 |
|
|---|
| 415 |
switch (feat) |
|---|
| 416 |
{ |
|---|
| 417 |
case FEAT_FLOOR: |
|---|
| 418 |
case FEAT_INVIS: |
|---|
| 419 |
case FEAT_SECRET: |
|---|
| 420 |
case FEAT_MAGMA: |
|---|
| 421 |
case FEAT_QUARTZ: |
|---|
| 422 |
case FEAT_MAGMA_H: |
|---|
| 423 |
case FEAT_QUARTZ_H: |
|---|
| 424 |
case FEAT_WALL_EXTRA: |
|---|
| 425 |
case FEAT_WALL_INNER: |
|---|
| 426 |
case FEAT_WALL_OUTER: |
|---|
| 427 |
case FEAT_WALL_SOLID: |
|---|
| 428 |
case FEAT_PERM_EXTRA: |
|---|
| 429 |
case FEAT_PERM_INNER: |
|---|
| 430 |
case FEAT_PERM_OUTER: |
|---|
| 431 |
case FEAT_PERM_SOLID: |
|---|
| 432 |
return TRUE; |
|---|
| 433 |
default: |
|---|
| 434 |
return FALSE; |
|---|
| 435 |
} |
|---|
| 436 |
} |
|---|
| 437 |
|
|---|
| 438 |
|
|---|
| 439 |
|
|---|
| 440 |
|
|---|
| 441 |
|
|---|
| 442 |
|
|---|
| 443 |
|
|---|
| 444 |
|
|---|
| 445 |
|
|---|
| 446 |
|
|---|
| 447 |
|
|---|
| 448 |
static void special_lighting_floor(byte *a, char *c, enum grid_light_level lighting, bool in_view) |
|---|
| 449 |
{ |
|---|
| 450 |
|
|---|
| 451 |
|
|---|
| 452 |
|
|---|
| 453 |
if (lighting == LIGHT_TORCH && view_yellow_lite) |
|---|
| 454 |
{ |
|---|
| 455 |
|
|---|
| 456 |
|
|---|
| 457 |
|
|---|
| 458 |
|
|---|
| 459 |
switch (use_graphics) |
|---|
| 460 |
{ |
|---|
| 461 |
case GRAPHICS_NONE: |
|---|
| 462 |
case GRAPHICS_PSEUDO: |
|---|
| 463 |
|
|---|
| 464 |
if (*a == TERM_WHITE) *a = TERM_YELLOW; |
|---|
| 465 |
break; |
|---|
| 466 |
case GRAPHICS_ADAM_BOLT: |
|---|
| 467 |
*c += 2; |
|---|
| 468 |
break; |
|---|
| 469 |
case GRAPHICS_DAVID_GERVAIS: |
|---|
| 470 |
*c -= 1; |
|---|
| 471 |
break; |
|---|
| 472 |
} |
|---|
| 473 |
} |
|---|
| 474 |
else if (lighting == LIGHT_DARK) |
|---|
| 475 |
{ |
|---|
| 476 |
|
|---|
| 477 |
switch (use_graphics) |
|---|
| 478 |
{ |
|---|
| 479 |
case GRAPHICS_NONE: |
|---|
| 480 |
case GRAPHICS_PSEUDO: |
|---|
| 481 |
|
|---|
| 482 |
if (*a == TERM_WHITE) *a = TERM_L_DARK; |
|---|
| 483 |
break; |
|---|
| 484 |
case GRAPHICS_ADAM_BOLT: |
|---|
| 485 |
case GRAPHICS_DAVID_GERVAIS: |
|---|
| 486 |
*c += 1; |
|---|
| 487 |
break; |
|---|
| 488 |
} |
|---|
| 489 |
} |
|---|
| 490 |
else |
|---|
| 491 |
{ |
|---|
| 492 |
|
|---|
| 493 |
|
|---|
| 494 |
|
|---|
| 495 |
|
|---|
| 496 |
if (view_bright_lite && !in_view) |
|---|
| 497 |
{ |
|---|
| 498 |
switch (use_graphics) |
|---|
| 499 |
{ |
|---|
| 500 |
case GRAPHICS_NONE: |
|---|
| 501 |
case GRAPHICS_PSEUDO: |
|---|
| 502 |
|
|---|
| 503 |
if (*a == TERM_WHITE) *a = TERM_SLATE; |
|---|
| 504 |
else if (*a == TERM_L_GREEN) *a = TERM_GREEN; |
|---|
| 505 |
break; |
|---|
| 506 |
case GRAPHICS_ADAM_BOLT: |
|---|
| 507 |
case GRAPHICS_DAVID_GERVAIS: |
|---|
| 508 |
*c += 1; |
|---|
| 509 |
break; |
|---|
| 510 |
} |
|---|
| 511 |
} |
|---|
| 512 |
} |
|---|
| 513 |
} |
|---|
| 514 |
|
|---|
| 515 |
|
|---|
| 516 |
|
|---|
| 517 |
|
|---|
| 518 |
|
|---|
| 519 |
|
|---|
| 520 |
|
|---|
| 521 |
|
|---|
| 522 |
|
|---|
| 523 |
|
|---|
| 524 |
|
|---|
| 525 |
|
|---|
| 526 |
|
|---|
| 527 |
static void special_wall_display(byte *a, char *c, bool in_view, int feat) |
|---|
| 528 |
{ |
|---|
| 529 |
|
|---|
| 530 |
if (in_view) return; |
|---|
| 531 |
|
|---|
| 532 |
|
|---|
| 533 |
if (p_ptr->timed[TMD_BLIND]) |
|---|
| 534 |
{ |
|---|
| 535 |
switch (use_graphics) |
|---|
| 536 |
{ |
|---|
| 537 |
case GRAPHICS_NONE: |
|---|
| 538 |
case GRAPHICS_PSEUDO: |
|---|
| 539 |
|
|---|
| 540 |
if (*a == TERM_WHITE) *a = TERM_L_DARK; |
|---|
| 541 |
break; |
|---|
| 542 |
case GRAPHICS_ADAM_BOLT: |
|---|
| 543 |
case GRAPHICS_DAVID_GERVAIS: |
|---|
| 544 |
if (feat_supports_lighting(feat)) *c += 1; |
|---|
| 545 |
break; |
|---|
| 546 |
} |
|---|
| 547 |
} |
|---|
| 548 |
|
|---|
| 549 |
|
|---|
| 550 |
else if (view_bright_lite) |
|---|
| 551 |
{ |
|---|
| 552 |
switch (use_graphics) |
|---|
| 553 |
{ |
|---|
| 554 |
case GRAPHICS_NONE: |
|---|
| 555 |
case GRAPHICS_PSEUDO: |
|---|
| 556 |
|
|---|
| 557 |
if (*a == TERM_WHITE) *a = TERM_SLATE; |
|---|
| 558 |
break; |
|---|
| 559 |
case GRAPHICS_ADAM_BOLT: |
|---|
| 560 |
case GRAPHICS_DAVID_GERVAIS: |
|---|
| 561 |
if (feat_supports_lighting(feat)) *c += 1; |
|---|
| 562 |
break; |
|---|
| 563 |
} |
|---|
| 564 |
} |
|---|
| 565 |
else |
|---|
| 566 |
{ |
|---|
| 567 |
|
|---|
| 568 |
switch (use_graphics) |
|---|
| 569 |
{ |
|---|
| 570 |
case GRAPHICS_ADAM_BOLT: |
|---|
| 571 |
if (feat_supports_lighting(feat)) *c += 2; |
|---|
| 572 |
break; |
|---|
| 573 |
case GRAPHICS_DAVID_GERVAIS: |
|---|
| 574 |
if (feat_supports_lighting(feat)) *c -= 1; |
|---|
| 575 |
break; |
|---|
| 576 |
} |
|---|
| 577 |
} |
|---|
| 578 |
} |
|---|
| 579 |
|
|---|
| 580 |
|
|---|
| 581 |
|
|---|
| 582 |
|
|---|
| 583 |
|
|---|
| 584 |
bool dtrap_edge(int y, int x) |
|---|
| 585 |
{ |
|---|
| 586 |
|
|---|
| 587 |
if (!cave_info2[y][x] & CAVE2_DTRAP) return FALSE; |
|---|
| 588 |
|
|---|
| 589 |
|
|---|
| 590 |
if (in_bounds_fully(y + 1, x ) && (!cave_info2[y + 1][x ] & CAVE2_DTRAP)) return TRUE; |
|---|
| 591 |
if (in_bounds_fully(y , x + 1) && (!cave_info2[y ][x + 1] & CAVE2_DTRAP)) return TRUE; |
|---|
| 592 |
if (in_bounds_fully(y - 1, x ) && (!cave_info2[y - 1][x ] & CAVE2_DTRAP)) return TRUE; |
|---|
| 593 |
if (in_bounds_fully(y , x - 1) && (!cave_info2[y ][x - 1] & CAVE2_DTRAP)) return TRUE; |
|---|
| 594 |
|
|---|
| 595 |
return FALSE; |
|---|
| 596 |
} |
|---|
| 597 |
|
|---|
| 598 |
|
|---|
| 599 |
|
|---|
| 600 |
|
|---|
| 601 |
|
|---|
| 602 |
|
|---|
| 603 |
|
|---|
| 604 |
|
|---|
| 605 |
|
|---|
| 606 |
|
|---|
| 607 |
|
|---|
| 608 |
|
|---|
| 609 |
|
|---|
| 610 |
|
|---|
| 611 |
|
|---|
| 612 |
|
|---|
| 613 |
|
|---|
| 614 |
|
|---|
| 615 |
|
|---|
| 616 |
|
|---|
| 617 |
|
|---|
| 618 |
|
|---|
| 619 |
|
|---|
| 620 |
|
|---|
| 621 |
|
|---|
| 622 |
|
|---|
| 623 |
|
|---|
| 624 |
|
|---|
| 625 |
|
|---|
| 626 |
|
|---|
| 627 |
|
|---|
| 628 |
|
|---|
| 629 |
|
|---|
| 630 |
|
|---|
| 631 |
|
|---|
| 632 |
|
|---|
| 633 |
|
|---|
| 634 |
void grid_data_as_text(grid_data *g, byte *ap, char *cp, byte *tap, char *tcp) |
|---|
| 635 |
{ |
|---|
| 636 |
byte a; |
|---|
| 637 |
char c; |
|---|
| 638 |
|
|---|
| 639 |
feature_type *f_ptr = &f_info[g->f_idx]; |
|---|
| 640 |
|
|---|
| 641 |
|
|---|
| 642 |
a = f_ptr->x_attr; |
|---|
| 643 |
c = f_ptr->x_char; |
|---|
| 644 |
|
|---|
| 645 |
|
|---|
| 646 |
if (g->trapborder && g->f_idx == FEAT_FLOOR) a = TERM_L_GREEN; |
|---|
| 647 |
|
|---|
| 648 |
|
|---|
| 649 |
if (g->f_idx <= FEAT_INVIS && view_special_lite) |
|---|
| 650 |
special_lighting_floor(&a, &c, g->lighting, g->in_view); |
|---|
| 651 |
|
|---|
| 652 |
|
|---|
| 653 |
if (g->f_idx > FEAT_INVIS && view_granite_lite) |
|---|
| 654 |
special_wall_display(&a, &c, g->in_view, g->f_idx); |
|---|
| 655 |
|
|---|
| 656 |
|
|---|
| 657 |
(*tap) = a; |
|---|
| 658 |
(*tcp) = c; |
|---|
| 659 |
|
|---|
| 660 |
|
|---|
| 661 |
|
|---|
| 662 |
if (g->first_k_idx) |
|---|
| 663 |
{ |
|---|
| 664 |
if (g->hallucinate) |
|---|
| 665 |
{ |
|---|
| 666 |
|
|---|
| 667 |
int i = hallucinatory_object(); |
|---|
| 668 |
|
|---|
| 669 |
a = PICT_A(i); |
|---|
| 670 |
c = PICT_C(i); |
|---|
| 671 |
} |
|---|
| 672 |
else |
|---|
| 673 |
{ |
|---|
| 674 |
object_kind *k_ptr = &k_info[g->first_k_idx]; |
|---|
| 675 |
|
|---|
| 676 |
|
|---|
| 677 |
a = object_kind_attr(g->first_k_idx); |
|---|
| 678 |
c = object_kind_char(g->first_k_idx); |
|---|
| 679 |
|
|---|
| 680 |
if (show_piles && g->multiple_objects) |
|---|
| 681 |
{ |
|---|
| 682 |
|
|---|
| 683 |
k_ptr = &k_info[0]; |
|---|
| 684 |
|
|---|
| 685 |
a = k_ptr->x_attr; |
|---|
| 686 |
c = k_ptr->x_char; |
|---|
| 687 |
} |
|---|
| 688 |
} |
|---|
| 689 |
} |
|---|
| 690 |
|
|---|
| 691 |
|
|---|
| 692 |
if (g->m_idx > 0) |
|---|
| 693 |
{ |
|---|
| 694 |
if (g->hallucinate) |
|---|
| 695 |
{ |
|---|
| 696 |
|
|---|
| 697 |
int i = hallucinatory_monster(); |
|---|
| 698 |
|
|---|
| 699 |
a = PICT_A(i); |
|---|
| 700 |
c = PICT_C(i); |
|---|
| 701 |
} |
|---|
| 702 |
else |
|---|
| 703 |
{ |
|---|
| 704 |
monster_type *m_ptr = &mon_list[g->m_idx]; |
|---|
| 705 |
monster_race *r_ptr = &r_info[m_ptr->r_idx]; |
|---|
| 706 |
|
|---|
| 707 |
byte da; |
|---|
| 708 |
char dc; |
|---|
| 709 |
|
|---|
| 710 |
|
|---|
| 711 |
da = r_ptr->x_attr; |
|---|
| 712 |
dc = r_ptr->x_char; |
|---|
| 713 |
|
|---|
| 714 |
|
|---|
| 715 |
if ((da & 0x80) && (dc & 0x80)) |
|---|
| 716 |
{ |
|---|
| 717 |
|
|---|
| 718 |
a = da; |
|---|
| 719 |
|
|---|
| 720 |
|
|---|
| 721 |
c = dc; |
|---|
| 722 |
} |
|---|
| 723 |
|
|---|
| 724 |
|
|---|
| 725 |
else if (r_ptr->flags[0] & (RF0_ATTR_MULTI)) |
|---|
| 726 |
{ |
|---|
| 727 |
|
|---|
| 728 |
a = randint1(15); |
|---|
| 729 |
|
|---|
| 730 |
|
|---|
| 731 |
c = dc; |
|---|
| 732 |
} |
|---|
| 733 |
|
|---|
| 734 |
|
|---|
| 735 |
else if (!(r_ptr->flags[0] & (RF0_ATTR_CLEAR | RF0_CHAR_CLEAR))) |
|---|
| 736 |
{ |
|---|
| 737 |
|
|---|
| 738 |
a = da; |
|---|
| 739 |
|
|---|
| 740 |
|
|---|
| 741 |
da = r_ptr->x_attr; |
|---|
| 742 |
dc = r_ptr->x_char; |
|---|
| 743 |
|
|---|
| 744 |
|
|---|
| 745 |
c = dc; |
|---|
| 746 |
} |
|---|
| 747 |
|
|---|
| 748 |
|
|---|
| 749 |
else if ((a & 0x80) || (c & 0x80)) |
|---|
| 750 |
{ |
|---|
| 751 |
|
|---|
| 752 |
a = da; |
|---|
| 753 |
|
|---|
| 754 |
|
|---|
| 755 |
c = dc; |
|---|
| 756 |
} |
|---|
| 757 |
|
|---|
| 758 |
|
|---|
| 759 |
else if (!(r_ptr->flags[0] & (RF0_CHAR_CLEAR))) |
|---|
| 760 |
{ |
|---|
| 761 |
|
|---|
| 762 |
c = dc; |
|---|
| 763 |
} |
|---|
| 764 |
|
|---|
| 765 |
|
|---|
| 766 |
else if (!(r_ptr->flags[0] & (RF0_ATTR_CLEAR))) |
|---|
| 767 |
{ |
|---|
| 768 |
|
|---|
| 769 |
a = da; |
|---|
| 770 |
} |
|---|
| 771 |
} |
|---|
| 772 |
} |
|---|
| 773 |
|
|---|
| 774 |
|
|---|
| 775 |
else if (g->is_player) |
|---|
| 776 |
{ |
|---|
| 777 |
monster_race *r_ptr = &r_info[0]; |
|---|
| 778 |
|
|---|
| 779 |
|
|---|
| 780 |
a = r_ptr->x_attr; |
|---|
| 781 |
if ((hp_changes_color) && (arg_graphics == GRAPHICS_NONE)) |
|---|
| 782 |
{ |
|---|
| 783 |
switch(p_ptr->chp * 10 / p_ptr->mhp) |
|---|
| 784 |
{ |
|---|
| 785 |
case 10: |
|---|
| 786 |
case 9: |
|---|
| 787 |
{ |
|---|
| 788 |
a = TERM_WHITE; |
|---|
| 789 |
break; |
|---|
| 790 |
} |
|---|
| 791 |
case 8: |
|---|
| 792 |
case 7: |
|---|
| 793 |
{ |
|---|
| 794 |
a = TERM_YELLOW; |
|---|
| 795 |
break; |
|---|
| 796 |
} |
|---|
| 797 |
case 6: |
|---|
| 798 |
case 5: |
|---|
| 799 |
{ |
|---|
| 800 |
a = TERM_ORANGE; |
|---|
| 801 |
break; |
|---|
| 802 |
} |
|---|
| 803 |
case 4: |
|---|
| 804 |
case 3: |
|---|
| 805 |
{ |
|---|
| 806 |
a = TERM_L_RED; |
|---|
| 807 |
break; |
|---|
| 808 |
} |
|---|
| 809 |
case 2: |
|---|
| 810 |
case 1: |
|---|
| 811 |
|---|