… | |
… | |
31 | * this is now tilemap aware. |
31 | * this is now tilemap aware. |
32 | */ |
32 | */ |
33 | object * |
33 | object * |
34 | get_pet_enemy (object *pet, rv_vector * rv) |
34 | get_pet_enemy (object *pet, rv_vector * rv) |
35 | { |
35 | { |
36 | object *owner, *tmp, *attacker, *tmp3; |
36 | object *tmp, *attacker, *tmp3; |
37 | int i; |
37 | int i; |
38 | sint16 x, y; |
38 | sint16 x, y; |
39 | maptile *nm; |
39 | maptile *nm; |
40 | int search_arr[SIZEOFFREE]; |
40 | int search_arr[SIZEOFFREE]; |
41 | int mflags; |
41 | int mflags; |
42 | |
42 | |
43 | attacker = pet->attacked_by; /*pointer to attacking enemy */ |
43 | attacker = pet->attacked_by; /*pointer to attacking enemy */ |
44 | pet->attacked_by = NULL; /*clear this, since we are dealing with it */ |
44 | pet->attacked_by = NULL; /*clear this, since we are dealing with it */ |
45 | |
45 | |
46 | if (owner = pet->owner) |
46 | object *owner = pet->owner; |
47 | { |
47 | |
48 | /* If the owner has turned on the pet, make the pet |
48 | if (!owner) |
49 | * unfriendly. |
|
|
50 | */ |
|
|
51 | if (check_enemy (owner, rv) == pet) |
|
|
52 | { |
|
|
53 | remove_friendly_object (pet); |
|
|
54 | pet->attack_movement &= ~PETMOVE; |
|
|
55 | return owner; |
|
|
56 | } |
|
|
57 | } |
49 | { |
58 | else |
|
|
59 | { |
|
|
60 | /* else the owner is no longer around, so the |
50 | /* the owner is no longer around, so the |
61 | * pet no longer needs to be friendly. |
51 | * pet no longer needs to be friendly. |
62 | */ |
52 | */ |
63 | remove_friendly_object (pet); |
53 | remove_friendly_object (pet); |
64 | pet->attack_movement &= ~PETMOVE; |
54 | pet->attack_movement &= ~PETMOVE; |
65 | return 0; |
55 | return 0; |
|
|
56 | } |
|
|
57 | |
|
|
58 | /* If the owner has turned on the pet, make the pet |
|
|
59 | * unfriendly. |
|
|
60 | */ |
|
|
61 | if (check_enemy (owner, rv) == pet) |
|
|
62 | { |
|
|
63 | remove_friendly_object (pet); |
|
|
64 | pet->attack_movement &= ~PETMOVE; |
|
|
65 | return owner; |
66 | } |
66 | } |
67 | |
67 | |
68 | /* If they are not on the same map, the pet won't be agressive */ |
68 | /* If they are not on the same map, the pet won't be agressive */ |
69 | //if (!on_same_map (pet, owner)) |
69 | //if (!on_same_map (pet, owner)) |
70 | // return 0; |
70 | // return 0; |