Changeset 404
- Timestamp:
- 07/28/07 19:19:51 (1 year ago)
- Files:
-
- trunk/src/birth.c (modified) (3 diffs)
- trunk/src/defines.h (modified) (1 diff)
- trunk/src/load.c (modified) (1 diff)
- trunk/src/obj-info.c (modified) (2 diffs)
- trunk/src/object2.c (modified) (3 diffs)
- trunk/src/save.c (modified) (1 diff)
- trunk/src/store.c (modified) (3 diffs)
- trunk/src/types.h (modified) (3 diffs)
- trunk/src/wizard2.c (modified) (3 diffs)
- trunk/src/xtra2.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/birth.c
r399 r404 627 627 object_prep(i_ptr, k_idx); 628 628 i_ptr->number = (byte)rand_range(e_ptr->min, e_ptr->max); 629 i_ptr->origin = ORIGIN_BIRTH; 629 630 630 631 object_aware(i_ptr); … … 644 645 object_prep(i_ptr, lookup_kind(TV_FOOD, SV_FOOD_RATION)); 645 646 i_ptr->number = (byte)rand_range(3, 7); 647 i_ptr->origin = ORIGIN_BIRTH; 646 648 object_aware(i_ptr); 647 649 object_known(i_ptr); 648 k_info[i_ptr->k_idx].everseen = TRUE;650 k_info[i_ptr->k_idx].everseen = TRUE; 649 651 (void)inven_carry(i_ptr); 650 652 … … 657 659 i_ptr->number = (byte)rand_range(3, 7); 658 660 i_ptr->timeout = rand_range(3, 7) * 500; 661 i_ptr->origin = ORIGIN_BIRTH; 659 662 object_aware(i_ptr); 660 663 object_known(i_ptr); trunk/src/defines.h
r399 r404 666 666 #define FEAT_PERM_OUTER 0x3E 667 667 #define FEAT_PERM_SOLID 0x3F 668 669 670 671 /*** Object origin kinds ***/ 672 673 enum 674 { 675 ORIGIN_NONE = 0, 676 ORIGIN_MIXED, 677 ORIGIN_BIRTH, 678 ORIGIN_STORE, 679 ORIGIN_FLOOR, 680 ORIGIN_DROP, 681 ORIGIN_DROP_UNKNOWN, 682 ORIGIN_ACQUIRE, 683 ORIGIN_CHEAT, 684 ORIGIN_CHEST 685 }; 668 686 669 687 trunk/src/load.c
r320 r404 301 301 rd_byte(&o_ptr->marked); 302 302 303 rd_byte(&o_ptr->origin); 304 rd_byte(&o_ptr->origin_depth); 305 rd_u16b(&o_ptr->origin_xtra); 306 303 307 /* Old flags */ 304 strip_bytes( 12);308 strip_bytes(8); 305 309 306 310 /* Monster holding object */ trunk/src/obj-info.c
r403 r404 603 603 604 604 /* 605 * Describe origin of an item 606 */ 607 static bool describe_origin(const object_type *o_ptr) 608 { 609 /* Abort now if undisplayable origin */ 610 if (o_ptr->origin == ORIGIN_NONE || 611 o_ptr->origin == ORIGIN_MIXED) 612 return FALSE; 613 614 if (o_ptr->number > 1) 615 p_text_out("They were "); 616 else 617 p_text_out("It was "); 618 619 /* Display the right thing */ 620 switch (o_ptr->origin) 621 { 622 case ORIGIN_BIRTH: 623 text_out("an inheritance from your family"); 624 break; 625 626 case ORIGIN_STORE: 627 text_out("bought in a store"); 628 break; 629 630 case ORIGIN_FLOOR: 631 text_out("lying on the floor"); 632 break; 633 634 case ORIGIN_DROP: 635 { 636 const char *name = r_name + r_info[o_ptr->origin_xtra].name; 637 bool unique = (r_info[o_ptr->origin_xtra].flags1 & RF1_UNIQUE) ? TRUE : FALSE; 638 639 text_out("dropped by %s%s", is_a_vowel(name[0]) ? "an " : "a ", name); 640 641 break; 642 } 643 644 case ORIGIN_DROP_UNKNOWN: 645 text_out("dropped by an unknown monster"); 646 break; 647 648 case ORIGIN_ACQUIRE: 649 text_out("conjured forth by magic"); 650 break; 651 652 case ORIGIN_CHEAT: 653 text_out("created by a debug option"); 654 break; 655 656 case ORIGIN_CHEST: 657 text_out("found in a chest"); 658 break; 659 } 660 661 if (o_ptr->origin_depth) 662 { 663 if (depth_in_feet) 664 text_out(" at a depth of %d feet", o_ptr->origin_depth * 50); 665 else 666 text_out(" on dungeon level %d", o_ptr->origin_depth); 667 } 668 669 text_out(". "); 670 return TRUE; 671 } 672 673 674 /* 605 675 * Output object information 606 676 */ … … 726 796 has_info = object_info_out(o_ptr); 727 797 798 /* Dump origin info */ 799 describe_origin(o_ptr); 800 728 801 new_paragraph = TRUE; 729 802 if (!object_known_p(o_ptr)) trunk/src/object2.c
r399 r404 1404 1404 o_ptr->pval += j_ptr->pval; 1405 1405 } 1406 1407 if ((o_ptr->origin != j_ptr->origin) || 1408 (o_ptr->origin_depth != j_ptr->origin_depth) || 1409 (o_ptr->origin_xtra != j_ptr->origin_xtra)) 1410 { 1411 int act = 2; 1412 1413 if ((o_ptr->origin == ORIGIN_DROP) && (o_ptr->origin == j_ptr->origin)) 1414 { 1415 monster_race *r_ptr = &r_info[o_ptr->origin_xtra]; 1416 monster_race *s_ptr = &r_info[j_ptr->origin_xtra]; 1417 1418 bool r_uniq = (r_ptr->flags1 & RF1_UNIQUE) ? TRUE : FALSE; 1419 bool s_uniq = (r_ptr->flags1 & RF1_UNIQUE) ? TRUE : FALSE; 1420 1421 if (r_uniq && !s_uniq) act = 0; 1422 else if (s_uniq && !r_uniq) act = 1; 1423 else act = 2; 1424 } 1425 1426 switch (act) 1427 { 1428 /* Overwrite with j_ptr */ 1429 case 1: 1430 { 1431 o_ptr->origin = j_ptr->origin; 1432 o_ptr->origin_depth = j_ptr->origin_depth; 1433 o_ptr->origin_xtra = j_ptr->origin_xtra; 1434 } 1435 1436 /* Set as "mixed" */ 1437 case 2: 1438 { 1439 o_ptr->origin = ORIGIN_MIXED; 1440 } 1441 } 1442 } 1406 1443 } 1407 1444 … … 3361 3398 /* Make a good (or great) object (if possible) */ 3362 3399 if (!make_object(i_ptr, TRUE, great)) continue; 3400 i_ptr->origin = ORIGIN_ACQUIRE; 3401 i_ptr->origin_depth = p_ptr->depth; 3363 3402 3364 3403 /* Drop the object */ … … 3391 3430 if (make_object(i_ptr, good, great)) 3392 3431 { 3432 i_ptr->origin = ORIGIN_FLOOR; 3433 i_ptr->origin_depth = p_ptr->depth; 3434 3393 3435 /* Give it to the floor */ 3394 3436 if (!floor_carry(y, x, i_ptr)) trunk/src/save.c
r320 r404 123 123 wr_byte(o_ptr->marked); 124 124 125 wr_byte(o_ptr->origin); 126 wr_byte(o_ptr->origin_depth); 127 wr_u16b(o_ptr->origin_xtra); 128 125 129 /* Old flags */ 126 wr_u32b(0L);127 130 wr_u32b(0L); 128 131 wr_u32b(0L); trunk/src/store.c
r399 r404 654 654 o_ptr->pval += j_ptr->pval; 655 655 } 656 657 if ((o_ptr->origin != j_ptr->origin) || 658 (o_ptr->origin_depth != j_ptr->origin_depth) || 659 (o_ptr->origin_xtra != j_ptr->origin_xtra)) 660 { 661 int act = 2; 662 663 if ((o_ptr->origin == ORIGIN_DROP) && (o_ptr->origin == j_ptr->origin)) 664 { 665 monster_race *r_ptr = &r_info[o_ptr->origin_xtra]; 666 monster_race *s_ptr = &r_info[j_ptr->origin_xtra]; 667 668 bool r_uniq = (r_ptr->flags1 & RF1_UNIQUE) ? TRUE : FALSE; 669 bool s_uniq = (r_ptr->flags1 & RF1_UNIQUE) ? TRUE : FALSE; 670 671 if (r_uniq && !s_uniq) act = 0; 672 else if (s_uniq && !r_uniq) act = 1; 673 else act = 2; 674 } 675 676 switch (act) 677 { 678 /* Overwrite with j_ptr */ 679 case 1: 680 { 681 o_ptr->origin = j_ptr->origin; 682 o_ptr->origin_depth = j_ptr->origin_depth; 683 o_ptr->origin_xtra = j_ptr->origin_xtra; 684 } 685 686 /* Set as "mixed" */ 687 case 2: 688 { 689 o_ptr->origin = ORIGIN_MIXED; 690 } 691 } 692 } 656 693 } 657 694 … … 1220 1257 object_known(i_ptr); 1221 1258 i_ptr->ident |= IDENT_STORE; 1259 i_ptr->origin = ORIGIN_STORE; 1222 1260 1223 1261 … … 1312 1350 /* Item belongs to a store */ 1313 1351 object.ident |= IDENT_STORE; 1352 object.origin = ORIGIN_STORE; 1314 1353 1315 1354 /* Charge lights */ trunk/src/types.h
r320 r404 493 493 byte xtra2; /* Extra info index */ 494 494 495 s16b ac; /* Normal AC */ 496 s16b to_a; /* Plusses to AC */ 495 497 s16b to_h; /* Plusses to hit */ 496 498 s16b to_d; /* Plusses to damage */ 497 s16b to_a; /* Plusses to AC */498 499 s16b ac; /* Normal AC */500 499 501 500 byte dd, ds; /* Damage dice/sides */ … … 504 503 505 504 byte ident; /* Special flags */ 506 507 505 byte marked; /* Object is marked */ 508 506 … … 510 508 511 509 s16b next_o_idx; /* Next object in stack (if any) */ 512 513 510 s16b held_m_idx; /* Monster holding us (if any) */ 511 512 byte origin; /* How this item was found */ 513 byte origin_depth; /* What depth the item was found at */ 514 u16b origin_xtra; /* Extra information about origin */ 514 515 }; 515 516 trunk/src/wizard2.c
r399 r404 625 625 if (changed) 626 626 { 627 /* Mark as cheat */ 628 i_ptr->origin = ORIGIN_CHEAT; 629 627 630 /* Restore the position information */ 628 631 i_ptr->iy = o_ptr->iy; … … 1027 1030 /* Apply magic (no messages, no artifacts) */ 1028 1031 apply_magic(i_ptr, p_ptr->depth, FALSE, FALSE, FALSE); 1032 1033 /* Mark as cheat */ 1034 i_ptr->origin = ORIGIN_CHEAT; 1029 1035 1030 1036 if (k_info[k_idx].tval == TV_GOLD) … … 1087 1093 i_ptr->weight = a_ptr->weight; 1088 1094 1089 /* Mark that the artifact has been created. */1095 /* Mark that the artifact has been created. */ 1090 1096 a_ptr->cur_num = 1; 1097 1098 /* Mark as cheat */ 1099 i_ptr->origin = ORIGIN_CHEAT; 1091 1100 1092 1101 /* Drop the artifact from heaven */ trunk/src/xtra2.c
r399 r404 1234 1234 /* Mega-Hack -- Actually create "Grond" */ 1235 1235 apply_magic(i_ptr, -1, TRUE, TRUE, TRUE); 1236 i_ptr->origin = ORIGIN_DROP; 1237 i_ptr->origin_depth = p_ptr->depth; 1238 i_ptr->origin_xtra = m_ptr->r_idx; 1236 1239 1237 1240 /* Drop it in the dungeon */ … … 1244 1247 /* Mega-Hack -- Prepare to make "Morgoth" */ 1245 1248 object_prep(i_ptr, lookup_kind(TV_CROWN, SV_MORGOTH)); 1249 i_ptr->origin = ORIGIN_DROP; 1250 i_ptr->origin_depth = p_ptr->depth; 1251 i_ptr->origin_xtra = m_ptr->r_idx; 1246 1252 1247 1253 /* Mega-Hack -- Mark this item as "Morgoth" */ … … 1298 1304 dump_item++; 1299 1305 } 1306 1307 /* Set origin */ 1308 i_ptr->origin = visible ? ORIGIN_DROP : ORIGIN_DROP_UNKNOWN; 1309 i_ptr->origin_depth = p_ptr->depth; 1310 i_ptr->origin_xtra = m_ptr->r_idx; 1300 1311 1301 1312 /* Drop it in the dungeon */
