Ticket #19: dtrap-vanilla.v1.diff
| File dtrap-vanilla.v1.diff, 11.9 kB (added by takkaria, 1 year ago) |
|---|
-
src-3.0.6/src/cave.c
old new 3883 3883 { 3884 3884 /* Process the grid */ 3885 3885 cave_info[y][x] &= ~(CAVE_MARK); 3886 cave_info2[y][x] &= ~(CAVE2_DTRAP); 3886 3887 } 3887 3888 } 3888 3889 -
src-3.0.6/src/cmd1.c
old new 1231 1231 int y, x; 1232 1232 1233 1233 1234 bool old_dtrap, new_dtrap; 1235 1236 1234 1237 /* Find the result of moving */ 1235 1238 y = py + ddy[dir]; 1236 1239 x = px + ddx[dir]; … … 1330 1333 /* Sound XXX XXX XXX */ 1331 1334 /* sound(MSG_WALK); */ 1332 1335 1333 /* Move player */ 1334 monster_swap(py, px, y, x); 1336 /* See if trap detection status will change */ 1337 old_dtrap = ((cave_info2[py][px] & (CAVE2_DTRAP)) != 0); 1338 new_dtrap = ((cave_info2[y][x] & (CAVE2_DTRAP)) != 0); 1339 1340 /* Note the change in the detect status */ 1341 if (old_dtrap != new_dtrap) p_ptr->redraw |= (PR_DTRAP); 1342 1343 /* Disturb player if the player is about to leave the detect area XXX */ 1344 if (disturb_detect && p_ptr->running && old_dtrap && !new_dtrap) 1345 { 1346 /* Disturb the player */ 1347 disturb(0, 0); 1348 1349 /* Done XXX */ 1350 return; 1351 } 1352 1353 /* Move player */ 1354 monster_swap(py, px, y, x); 1355 1356 1335 1357 1336 1358 /* New location */ 1337 1359 y = py = p_ptr->py; -
src-3.0.6/src/defines.h
old new 531 531 #define ROW_STATE (Term->hgt - 1) 532 532 #define COL_STATE 38 /* <state> */ 533 533 534 #define ROW_DTRAP (Term->hgt - 1) 535 #define COL_DTRAP 49 /* "DTrap" */ 536 534 537 #define ROW_SPEED (Term->hgt - 1) 535 #define COL_SPEED 49/* "Slow (-NN)" or "Fast (+NN)" */538 #define COL_SPEED 55 /* "Slow (-NN)" or "Fast (+NN)" */ 536 539 537 540 #define ROW_STUDY (Term->hgt - 1) 538 #define COL_STUDY 6 4/* "Study" */541 #define COL_STUDY 66 /* "Study" */ 539 542 540 543 #define ROW_DEPTH (Term->hgt - 1) 541 #define COL_DEPTH 7 0/* "Lev NNN" / "NNNN ft" */544 #define COL_DEPTH 72 /* "Lev NNN" / "NNNN ft" */ 542 545 543 546 #define ROW_OPPOSE_ELEMENTS (Term->hgt - 1) 544 547 #define COL_OPPOSE_ELEMENTS 80 /* "Acid Elec Fire Cold Pois" */ … … 1618 1621 #define PR_CUT 0x00001000L /* Display Extra (Cut) */ 1619 1622 #define PR_STUN 0x00002000L /* Display Extra (Stun) */ 1620 1623 #define PR_HUNGER 0x00004000L /* Display Extra (Hunger) */ 1621 /* xxx*/1624 #define PR_DTRAP 0x00008000L /* Display Extra (Trap detection) */ 1622 1625 #define PR_BLIND 0x00010000L /* Display Extra (Blind) */ 1623 1626 #define PR_CONFUSED 0x00020000L /* Display Extra (Confused) */ 1624 1627 #define PR_AFRAID 0x00040000L /* Display Extra (Afraid) */ … … 1679 1682 #define CAVE_TEMP 0x40 /* temp flag */ 1680 1683 #define CAVE_WALL 0x80 /* wall flag */ 1681 1684 1685 #define CAVE2_DTRAP 0x01 /* trap detected grid */ 1682 1686 1683 1687 1684 1688 /*** Object flags ***/ … … 2418 2422 #define OPT_run_use_corners 19 2419 2423 #define OPT_disturb_move 20 2420 2424 #define OPT_disturb_near 21 2421 #define OPT_disturb_ panel222425 #define OPT_disturb_detect 22 2422 2426 #define OPT_disturb_state 23 2423 2427 #define OPT_disturb_minor 24 2424 2428 /* xxx OPT_disturb_other */ … … 2538 2542 #define run_use_corners op_ptr->opt[OPT_run_use_corners] 2539 2543 #define disturb_move op_ptr->opt[OPT_disturb_move] 2540 2544 #define disturb_near op_ptr->opt[OPT_disturb_near] 2541 #define disturb_ panel op_ptr->opt[OPT_disturb_panel]2545 #define disturb_detect op_ptr->opt[OPT_disturb_detect] 2542 2546 #define disturb_state op_ptr->opt[OPT_disturb_state] 2543 2547 #define disturb_minor op_ptr->opt[OPT_disturb_minor] 2544 2548 /* xxx disturb_other */ -
src-3.0.6/src/externs.h
old new 147 147 extern byte *temp_y; 148 148 extern byte *temp_x; 149 149 extern byte (*cave_info)[256]; 150 extern byte (*cave_info2)[256]; 150 151 extern byte (*cave_feat)[DUNGEON_WID]; 151 152 extern s16b (*cave_o_idx)[DUNGEON_WID]; 152 153 extern s16b (*cave_m_idx)[DUNGEON_WID]; -
src-3.0.6/src/generate.c
old new 3383 3383 { 3384 3384 /* No flags */ 3385 3385 cave_info[y][x] = 0; 3386 cave_info2[y][x] = 0; 3386 3387 3387 3388 /* No features */ 3388 3389 cave_feat[y][x] = 0; -
src-3.0.6/src/init2.c
old new 1373 1373 1374 1374 /* Padded into array */ 1375 1375 C_MAKE(cave_info, DUNGEON_HGT, byte_256); 1376 C_MAKE(cave_info2, DUNGEON_HGT, byte_256); 1376 1377 1377 1378 /* Feature array */ 1378 1379 C_MAKE(cave_feat, DUNGEON_HGT, byte_wid); … … 2103 2104 FREE(cave_o_idx); 2104 2105 FREE(cave_m_idx); 2105 2106 FREE(cave_feat); 2107 FREE(cave_info2); 2106 2108 FREE(cave_info); 2107 2109 2108 2110 /* Free the "update_view()" array */ -
src-3.0.6/src/load.c
old new 1501 1501 } 1502 1502 } 1503 1503 1504 /* Load the dungeon data */ 1505 for (x = y = 0; y < DUNGEON_HGT; ) 1506 { 1507 /* Grab RLE info */ 1508 rd_byte(&count); 1509 rd_byte(&tmp8u); 1510 1511 /* Apply the RLE info */ 1512 for (i = count; i > 0; i--) 1513 { 1514 /* Extract "info" */ 1515 cave_info2[y][x] = tmp8u; 1516 1517 /* Advance/Wrap */ 1518 if (++x >= DUNGEON_WID) 1519 { 1520 /* Wrap */ 1521 x = 0; 1522 1523 /* Advance/Wrap */ 1524 if (++y >= DUNGEON_HGT) break; 1525 } 1526 } 1527 } 1528 1504 1529 1505 1530 /*** Run length decoding ***/ 1506 1531 -
src-3.0.6/src/monster2.c
old new 1329 1329 p_ptr->py = y2; 1330 1330 p_ptr->px = x2; 1331 1331 1332 /* Update the trap detection status */ 1333 p_ptr->redraw |= (PR_DTRAP); 1334 1332 1335 /* Update the panel */ 1333 1336 p_ptr->update |= (PU_PANEL); 1334 1337 … … 1362 1365 p_ptr->py = y1; 1363 1366 p_ptr->px = x1; 1364 1367 1368 /* Update the trap detection status */ 1369 p_ptr->redraw |= (PR_DTRAP); 1370 1365 1371 /* Update the panel */ 1366 1372 p_ptr->update |= (PU_PANEL); 1367 1373 -
src-3.0.6/src/save.c
old new 1256 1256 wr_byte((byte)prev_char); 1257 1257 } 1258 1258 1259 /** Now dump the cave_info2[][] stuff **/ 1260 1261 /* Note that this will induce two wasted bytes */ 1262 count = 0; 1263 prev_char = 0; 1264 1265 /* Dump the cave */ 1266 for (y = 0; y < DUNGEON_HGT; y++) 1267 { 1268 for (x = 0; x < DUNGEON_WID; x++) 1269 { 1270 /* Keep all the information from info2 */ 1271 tmp8u = cave_info2[y][x]; 1272 1273 /* If the run is broken, or too full, flush it */ 1274 if ((tmp8u != prev_char) || (count == MAX_UCHAR)) 1275 { 1276 wr_byte((byte)count); 1277 wr_byte((byte)prev_char); 1278 prev_char = tmp8u; 1279 count = 1; 1280 } 1281 1282 /* Continue the run */ 1283 else 1284 { 1285 count++; 1286 } 1287 } 1288 } 1289 1290 /* Flush the data (if any) */ 1291 if (count) 1292 { 1293 wr_byte((byte)count); 1294 wr_byte((byte)prev_char); 1295 } 1296 1259 1297 1260 1298 /*** Simple "Run-Length-Encoding" of cave ***/ 1261 1299 -
src-3.0.6/src/spells2.c
old new 999 999 /* Redraw */ 1000 1000 lite_spot(y, x); 1001 1001 1002 /* Obvious*/1002 /* We found something to detect */ 1003 1003 detect = TRUE; 1004 1004 } 1005 1006 /* Mark as trap-detected */ 1007 cave_info2[y][x] |= (CAVE2_DTRAP); 1005 1008 } 1006 1009 } 1007 1010 1008 1011 /* Describe */ 1009 1012 if (detect) 1010 {1011 1013 msg_print("You sense the presence of traps!"); 1012 } 1014 1015 /* Mark the redraw flag */ 1016 p_ptr->redraw |= (PR_DTRAP); 1013 1017 1014 1018 /* Result */ 1015 return ( detect);1019 return (TRUE); 1016 1020 } 1017 1021 1018 1022 -
src-3.0.6/src/tables.c
old new 1418 1418 "run_use_corners", /* OPT_run_use_corners */ 1419 1419 "disturb_move", /* OPT_disturb_move */ 1420 1420 "disturb_near", /* OPT_disturb_near */ 1421 "disturb_ panel", /* OPT_disturb_panel*/1421 "disturb_detect", /* OPT_disturb_detect */ 1422 1422 "disturb_state", /* OPT_disturb_state */ 1423 1423 "disturb_minor", /* OPT_disturb_minor */ 1424 1424 NULL, /* xxx disturb_other */ … … 1682 1682 "When running, use corners", /* OPT_run_use_corners */ 1683 1683 "Disturb whenever any monster moves", /* OPT_disturb_move */ 1684 1684 "Disturb whenever viewable monster moves", /* OPT_disturb_near */ 1685 "Disturb whenever map panel changes", /* OPT_disturb_panel*/1685 "Disturb whenever leaving trap detected area", /* OPT_disturb_detect */ 1686 1686 "Disturb whenever player state changes", /* OPT_disturb_state */ 1687 1687 "Disturb whenever boring things happen", /* OPT_disturb_minor */ 1688 1688 NULL, /* xxx disturb_other */ … … 1946 1946 TRUE, /* OPT_run_use_corners */ 1947 1947 TRUE, /* OPT_disturb_move */ 1948 1948 TRUE, /* OPT_disturb_near */ 1949 TRUE, /* OPT_disturb_ panel*/1949 TRUE, /* OPT_disturb_detect */ 1950 1950 TRUE, /* OPT_disturb_state */ 1951 1951 TRUE, /* OPT_disturb_minor */ 1952 1952 FALSE, /* xxx disturb_other */ … … 2222 2222 OPT_run_use_corners, 2223 2223 OPT_disturb_move, 2224 2224 OPT_disturb_near, 2225 OPT_disturb_ panel,2225 OPT_disturb_detect, 2226 2226 OPT_disturb_state, 2227 2227 OPT_disturb_minor, 2228 2228 OPT_verify_destroy, -
src-3.0.6/src/variable.c
old new 396 396 /* 397 397 * Array[DUNGEON_HGT][256] of cave grid info flags (padded) 398 398 * 399 * Th is array ispadded to a width of 256 to allow fast access to elements399 * These arrays are padded to a width of 256 to allow fast access to elements 400 400 * in the array via "grid" values (see the GRID() macros). 401 401 */ 402 402 byte (*cave_info)[256]; 403 byte (*cave_info2)[256]; 403 404 404 405 /* 405 406 * Array[DUNGEON_HGT][DUNGEON_WID] of cave grid feature codes -
src-3.0.6/src/xtra1.c
old new 625 625 626 626 627 627 /* 628 * Prints trap detection status 629 * 630 * One could use another p_ptr flag to divorce this function from 631 * cave_info[][], with codes to update it properly in some places. 632 * I can't decide which is better. -- pelpel 633 */ 634 static void prt_dtrap(int row, int col) 635 { 636 byte info = cave_info2[p_ptr->py][p_ptr->px]; 637 638 /* The player is in a trap-detected grid */ 639 if (info & (CAVE2_DTRAP)) 640 { 641 c_put_str(TERM_GREEN, "DTrap", row, col); 642 } 643 644 /* Not in a trap-detected grid */ 645 else 646 { 647 put_str(" ", row, col); 648 } 649 } 650 651 652 /* 628 653 * Prints the speed of a character. -CJS- 629 654 */ 630 655 static void prt_speed(int row, int col) … … 652 677 } 653 678 654 679 /* Display the speed */ 655 c_put_str(attr, format("%-1 4s", buf), row, col);680 c_put_str(attr, format("%-10s", buf), row, col); 656 681 } 657 682 658 683 … … 1154 1179 /* State */ 1155 1180 prt_state(row, COL_STATE); 1156 1181 1182 /* Trap detection */ 1183 prt_dtrap(row, COL_DTRAP); 1184 1157 1185 /* Speed */ 1158 1186 prt_speed(row, COL_SPEED); 1159 1187 … … 3091 3119 prt_state(ROW_STATE, COL_STATE); 3092 3120 } 3093 3121 3122 if (p_ptr->redraw & (PR_DTRAP)) 3123 { 3124 p_ptr->redraw &= ~(PR_DTRAP); 3125 prt_dtrap(ROW_DTRAP, COL_DTRAP); 3126 } 3127 3094 3128 if (p_ptr->redraw & (PR_SPEED)) 3095 3129 { 3096 3130 p_ptr->redraw &= ~(PR_SPEED);
