… | |
… | |
632 | |
632 | |
633 | return firstdir; |
633 | return firstdir; |
634 | } |
634 | } |
635 | |
635 | |
636 | void |
636 | void |
637 | give_initial_items (object *pl, treasurelist * items) |
637 | give_initial_items (object *pl, treasurelist *items) |
638 | { |
638 | { |
639 | if (pl->randomitems) |
639 | if (pl->randomitems) |
640 | create_treasure (items, pl, GT_STARTEQUIP | GT_ONLY_GOOD, 1, 0); |
640 | create_treasure (items, pl, GT_STARTEQUIP | GT_ONLY_GOOD, 1, 0); |
641 | |
641 | |
642 | for (object *next, *op = pl->inv; op; op = next) |
642 | for (object *next, *op = pl->inv; op; op = next) |
… | |
… | |
652 | /* we never give weapons/armour if these cannot be used |
652 | /* we never give weapons/armour if these cannot be used |
653 | * by this player due to race restrictions |
653 | * by this player due to race restrictions |
654 | */ |
654 | */ |
655 | if (pl->type == PLAYER) |
655 | if (pl->type == PLAYER) |
656 | { |
656 | { |
657 | if ((!QUERY_FLAG (pl, FLAG_USE_ARMOUR) && |
657 | if ((!QUERY_FLAG (pl, FLAG_USE_ARMOUR) |
|
|
658 | && |
658 | (op->type == ARMOUR || op->type == BOOTS || |
659 | (op->type == ARMOUR || op->type == BOOTS |
659 | op->type == CLOAK || op->type == HELMET || |
660 | || op->type == CLOAK || op->type == HELMET |
660 | op->type == SHIELD || op->type == GLOVES || |
661 | || op->type == SHIELD || op->type == GLOVES |
|
|
662 | || op->type == BRACERS || op->type == GIRDLE)) |
661 | op->type == BRACERS || op->type == GIRDLE)) || (!QUERY_FLAG (pl, FLAG_USE_WEAPON) && op->type == WEAPON)) |
663 | || (!QUERY_FLAG (pl, FLAG_USE_WEAPON) && op->type == WEAPON)) |
662 | { |
664 | { |
663 | op->destroy (); |
665 | op->destroy (); |
664 | continue; |
666 | continue; |
665 | } |
667 | } |
666 | } |
668 | } |
… | |
… | |
692 | |
694 | |
693 | if (op->type == SPELLBOOK && op->inv) |
695 | if (op->type == SPELLBOOK && op->inv) |
694 | CLEAR_FLAG (op->inv, FLAG_STARTEQUIP); |
696 | CLEAR_FLAG (op->inv, FLAG_STARTEQUIP); |
695 | |
697 | |
696 | /* Give starting characters identified, uncursed, and undamned |
698 | /* Give starting characters identified, uncursed, and undamned |
697 | * items. Just don't identify gold or silver, or it won't be |
699 | * items. Just don't identify gold or silver, or it won't be |
698 | * merged properly. |
700 | * merged properly. |
699 | */ |
701 | */ |
700 | if (need_identify (op)) |
702 | if (need_identify (op)) |
701 | { |
703 | { |
702 | SET_FLAG (op, FLAG_IDENTIFIED); |
704 | SET_FLAG (op, FLAG_IDENTIFIED); |
703 | CLEAR_FLAG (op, FLAG_CURSED); |
705 | CLEAR_FLAG (op, FLAG_CURSED); |
704 | CLEAR_FLAG (op, FLAG_DAMNED); |
706 | CLEAR_FLAG (op, FLAG_DAMNED); |
705 | } |
707 | } |
|
|
708 | |
706 | if (op->type == SPELL) |
709 | if (op->type == SPELL) |
707 | { |
710 | { |
708 | op->destroy (); |
711 | op->destroy (); |
709 | continue; |
712 | continue; |
710 | } |
713 | } |
… | |
… | |
712 | { |
715 | { |
713 | SET_FLAG (op, FLAG_CAN_USE_SKILL); |
716 | SET_FLAG (op, FLAG_CAN_USE_SKILL); |
714 | op->stats.exp = 0; |
717 | op->stats.exp = 0; |
715 | op->level = 1; |
718 | op->level = 1; |
716 | } |
719 | } |
717 | /* lock all 'normal items by default */ |
720 | else /* lock all 'normal items by default */ |
718 | else |
|
|
719 | SET_FLAG (op, FLAG_INV_LOCKED); |
721 | SET_FLAG (op, FLAG_INV_LOCKED); |
720 | } /* for loop of objects in player inv */ |
722 | } /* for loop of objects in player inv */ |
721 | |
723 | |
722 | /* Need to set up the skill pointers */ |
724 | /* Need to set up the skill pointers */ |
723 | link_player_skills (pl); |
725 | link_player_skills (pl); |
… | |
… | |
3049 | * as bad as carrying a light on a pitch dark map */ |
3051 | * as bad as carrying a light on a pitch dark map */ |
3050 | if (has_carried_lights (ob)) |
3052 | if (has_carried_lights (ob)) |
3051 | level = -(10 + (2 * ob->map->darkness)); |
3053 | level = -(10 + (2 * ob->map->darkness)); |
3052 | |
3054 | |
3053 | /* scan through all nearby squares for terrain to hide in */ |
3055 | /* scan through all nearby squares for terrain to hide in */ |
3054 | for (i = 0, x = ob->x, y = ob->y; i < 9; i++, x = ob->x + freearr_x[i], y = ob->y + freearr_y[i]) |
3056 | for (i = 0, x = ob->x, y = ob->y; |
|
|
3057 | i <= SIZEOFFREE1; |
|
|
3058 | i++, x = ob->x + freearr_x[i], y = ob->y + freearr_y[i]) |
3055 | { |
3059 | { |
3056 | mflag = get_map_flags (ob->map, NULL, x, y, NULL, NULL); |
3060 | mflag = get_map_flags (ob->map, NULL, x, y, NULL, NULL); |
3057 | if (mflag & P_OUT_OF_MAP) |
3061 | if (mflag & P_OUT_OF_MAP) |
3058 | { |
|
|
3059 | continue; |
3062 | continue; |
3060 | } |
3063 | |
3061 | if (mflag & P_BLOCKSVIEW) /* something to hide near! */ |
3064 | if (mflag & P_BLOCKSVIEW) /* something to hide near! */ |
3062 | level += 2; |
3065 | level += 2; |
3063 | else /* open terrain! */ |
3066 | else /* open terrain! */ |
3064 | level -= 1; |
3067 | level -= 1; |
3065 | } |
3068 | } |