Made move_towards_segment_center() use move_towards_vector() instead of just changing object position suddenly - smoother; Changed back the robot:controlcen collision back to original - the AI just relies to often on no-damage collisions, especially when our segment suddenly is a controlcen

This commit is contained in:
zicodxx 2008-11-03 11:39:56 +00:00
parent 61dfe70f5c
commit 21e59bca6f
3 changed files with 23 additions and 13 deletions

View file

@ -3,6 +3,7 @@ D2X-Rebirth Changelog
20081103
--------
misc/args.c: Fixed Typo
main/ai2.c, main/collide.c: Made move_towards_segment_center() use move_towards_vector() instead of just changing object position suddenly - smoother; Changed back the robot:controlcen collision back to original - the AI just relies to often on no-damage collisions, especially when our segment suddenly is a controlcen
20081101
--------

View file

@ -1584,6 +1584,18 @@ void move_object_to_legal_spot(object *objp)
// If segment center is nearer than 2 radii, move it to center.
void move_towards_segment_center(object *objp)
{
/* ZICO's change of 20081103:
Make move to segment center smoother by using move_towards vector.
Bot's should not jump around and maybe even intersect with each other!
In case it breaks something what I do not see, yet, old code is still there. */
#if 1
int segnum = objp->segnum;
vms_vector vec_to_center, segment_center;
compute_segment_center(&segment_center, &Segments[segnum]);
vm_vec_normalized_dir_quick(&vec_to_center, &segment_center, &objp->pos);
move_towards_vector(objp, &vec_to_center, 1);
#else
int segnum = objp->segnum;
fix dist_to_center;
vms_vector segment_center, goal_dir;
@ -1610,7 +1622,7 @@ void move_towards_segment_center(object *objp)
move_object_to_legal_spot(objp);
}
}
#endif
}
extern int Buddy_objnum;

View file

@ -973,18 +973,15 @@ void collide_robot_and_robot( object * robot1, object * robot2, vms_vector *coll
void collide_robot_and_controlcen( object * obj1, object * obj2, vms_vector *collision_point )
{
// if (obj1->type == OBJ_ROBOT) {
// vms_vector hitvec;
// vm_vec_normalize_quick(vm_vec_sub(&hitvec, &obj2->pos, &obj1->pos));
// bump_one_object(obj1, &hitvec, 0);
// } else {
// vms_vector hitvec;
// vm_vec_normalize_quick(vm_vec_sub(&hitvec, &obj1->pos, &obj2->pos));
// bump_one_object(obj2, &hitvec, 0);
// }
if (!(Robot_info[obj1->id].companion || Robot_info[obj1->id].thief) && !(Robot_info[obj2->id].companion || Robot_info[obj2->id].thief))
bump_two_objects(obj1, obj2, 0);
if (obj1->type == OBJ_ROBOT) {
vms_vector hitvec;
vm_vec_normalize(vm_vec_sub(&hitvec, &obj2->pos, &obj1->pos));
bump_one_object(obj1, &hitvec, 0);
} else {
vms_vector hitvec;
vm_vec_normalize(vm_vec_sub(&hitvec, &obj1->pos, &obj2->pos));
bump_one_object(obj2, &hitvec, 0);
}
}
//##void collide_robot_and_hostage( object * robot, object * hostage, vms_vector *collision_point ) {