Trying to improve reliability to find appropriate homing object by using vm_vec_mag/normalize instead of their *quick equivalents; Removed code which supposedly meant to track objects near reticle - don't like that
This commit is contained in:
parent
152ed8ea60
commit
a8111d203d
|
@ -3,6 +3,7 @@ D1X-Rebirth Changelog
|
||||||
20100709
|
20100709
|
||||||
--------
|
--------
|
||||||
main/mission.c: When reading mission file, check for sanity of possible breifing or ending to make sure author did not just screw up the file
|
main/mission.c: When reading mission file, check for sanity of possible breifing or ending to make sure author did not just screw up the file
|
||||||
|
main/laser.c: Trying to improve reliability to find appropriate homing object by using vm_vec_mag/normalize instead of their *quick equivalents; Removed code which supposedly meant to track objects near reticle - don't like that
|
||||||
|
|
||||||
20100708
|
20100708
|
||||||
--------
|
--------
|
||||||
|
|
56
main/laser.c
56
main/laser.c
|
@ -601,15 +601,10 @@ int find_homing_object(vms_vector *curpos, object *tracker)
|
||||||
int find_homing_object_complete(vms_vector *curpos, object *tracker, int track_obj_type1, int track_obj_type2)
|
int find_homing_object_complete(vms_vector *curpos, object *tracker, int track_obj_type1, int track_obj_type2)
|
||||||
{
|
{
|
||||||
int objnum;
|
int objnum;
|
||||||
//added/killed on 9/30/98 by Victor Rachels to remove unnescesary vars
|
fix max_dot = -F1_0*2;
|
||||||
//-killed- fix max_dot = -F1_0*2;
|
|
||||||
//end this section kill - Victor Rachels
|
|
||||||
int best_objnum = -1;
|
int best_objnum = -1;
|
||||||
|
|
||||||
//added on 8/14/98 by Victor Rachels to fix player/object numbering tracking... doing best distance now
|
fix best_dist=MAX_TRACKABLE_DIST;
|
||||||
//moved on 9/29/98 by Victor Rachels ... DUH! yeesh.
|
|
||||||
// fix best_dist=MAX_TRACKABLE_DIST;
|
|
||||||
//end this section - Victor Rachels
|
|
||||||
fix best_dot= MIN_TRACKABLE_DOT;
|
fix best_dot= MIN_TRACKABLE_DOT;
|
||||||
|
|
||||||
if (!Weapon_info[tracker->id].homing_flag) {
|
if (!Weapon_info[tracker->id].homing_flag) {
|
||||||
|
@ -646,35 +641,26 @@ int find_homing_object_complete(vms_vector *curpos, object *tracker, int track_o
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
vm_vec_sub(&vec_to_curobj, &curobjp->pos, curpos);
|
vm_vec_sub(&vec_to_curobj, &curobjp->pos, curpos);
|
||||||
dist = vm_vec_mag_quick(&vec_to_curobj);
|
dist = vm_vec_mag(&vec_to_curobj);
|
||||||
|
|
||||||
//added/rewritten on 9/30/98 by Victor Rachels to calc less
|
if (dist < max_trackable_dist) {
|
||||||
/* if(dist < best_dist)
|
vm_vec_normalize(&vec_to_curobj);
|
||||||
{
|
dot = vm_vec_dot(&vec_to_curobj, &tracker->orient.fvec);
|
||||||
vm_vec_normalize_quick(&vec_to_curobj);
|
if (is_proximity)
|
||||||
dot = vm_vec_dot(&vec_to_curobj, &tracker->orient.fvec);
|
dot = ((dot << 3) + dot) >> 3; // I suspect Watcom would be too stupid to figure out the obvious...
|
||||||
if(dot > MIN_TRACKABLE_DOT)
|
|
||||||
if(object_to_object_visibility(tracker, &Objects[objnum], FQ_TRANSWALL))
|
// Note: This uses the constant, not-scaled-by-frametime value, because it is only used
|
||||||
{
|
// to determine if an object is initially trackable. find_homing_object is called on subsequent
|
||||||
best_dist = dist;
|
// frames to determine if the object remains trackable.
|
||||||
best_objnum=objnum;
|
if (dot > min_trackable_dot) {
|
||||||
}
|
if (dot > max_dot) {
|
||||||
}*/
|
if (object_to_object_visibility(tracker, &Objects[objnum], FQ_TRANSWALL)) {
|
||||||
//end rewrite - Victor Rachels
|
max_dot = dot;
|
||||||
//added/changed on 10/16/98 by Victor Rachels to track on closest to reticle
|
best_objnum = objnum;
|
||||||
if(dist < MAX_TRACKABLE_DIST)
|
}
|
||||||
{
|
}
|
||||||
vm_vec_normalize_quick(&vec_to_curobj);
|
}
|
||||||
dot = vm_vec_dot(&vec_to_curobj, &tracker->orient.fvec);
|
}
|
||||||
if(dot > best_dot)
|
|
||||||
if(object_to_object_visibility(tracker, &Objects[objnum], FQ_TRANSWALL))
|
|
||||||
{
|
|
||||||
best_dot = dot;
|
|
||||||
best_objnum=objnum;
|
|
||||||
// hud_message(MSGC_GAME_FEEDBACK,"dot: %d bestdot:%d",dot,best_dot);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//end rewrite - Victor Rachels
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue