Trunk Sync: r9389

This commit is contained in:
Zacam committed 2012-12-03 01:06:58 +00:00
1 parent 3fdae2e3c1
commit ee28362f42
5 files changed
+35 -29

No files matched your search

+1 -1
View File
@@ -4821,7 +4821,7 @@ void evade_weapon()
rdot = vm_vec_dot(&Pl_objp->orient.vec.rvec, &vec_from_enemy);
udot = vm_vec_dot(&Pl_objp->orient.vec.uvec, &vec_from_enemy);
if (aip->ai_profile_flags & AIPF_ALLOW_VERTICAL_DODGE && abs(udot) > abs(rdot))
if (aip->ai_profile_flags & AIPF_ALLOW_VERTICAL_DODGE && fl_abs(udot) > fl_abs(rdot))
{
if ((udot < -0.5f) || (udot > 0.5f))
vm_vec_scale_add(&goal_point, &Pl_objp->pos, &Pl_objp->orient.vec.uvec, -200.0f);
+2 -1
View File
@@ -1493,8 +1493,9 @@ void gr_opengl_start_instance_matrix(vec3d *offset, matrix *rotation)
vm_matrix_to_rot_axis_and_angle(rotation, &ang, &axis);
glTranslatef( offset->xyz.x, offset->xyz.y, offset->xyz.z );
if (abs(ang) > 0.0f)
if (fl_abs(ang) > 0.0f) {
glRotatef( fl_degrees(ang), axis.xyz.x, axis.xyz.y, axis.xyz.z );
}
GL_CHECK_FOR_ERRORS("end of start_instance_matrix()");
+1 -1
View File
@@ -2768,7 +2768,7 @@ void vm_vec_dist_squared_to_line(vec3d *p, vec3d *l0, vec3d *l1, vec3d *nearest,
//Scales the vector in-place so that the longest dimension = scale
void vm_vec_boxscale(vec2d *vec, float scale)
{
float ratio = 1.0f / MAX(abs(vec->x), abs(vec->y));
float ratio = 1.0f / MAX(fl_abs(vec->x), fl_abs(vec->y));
vec->x *= ratio;
vec->y *= ratio;
}
+4 -4
View File
@@ -679,11 +679,11 @@ void calculate_ship_ship_collision_physics(collision_info_struct *ship_ship_hit_
light_local_vel.xyz.z < light_sip->collision_physics.landing_max_z &&
light_local_vel.xyz.z > light_sip->collision_physics.landing_min_z &&
light_local_vel.xyz.y > light_sip->collision_physics.landing_min_y &&
abs(light_local_vel.xyz.x) < light_sip->collision_physics.landing_max_x &&
fl_abs(light_local_vel.xyz.x) < light_sip->collision_physics.landing_max_x &&
light_uvec_dot_norm > 0 &&
light_fvec_dot_norm < light_sip->collision_physics.landing_max_angle &&
light_fvec_dot_norm > light_sip->collision_physics.landing_min_angle &&
abs(light_rvec_dot_norm) < light_sip->collision_physics.landing_max_rot_angle)
fl_abs(light_rvec_dot_norm) < light_sip->collision_physics.landing_max_rot_angle)
{
ship_ship_hit_info->is_landing = true;
}
@@ -776,11 +776,11 @@ void calculate_ship_ship_collision_physics(collision_info_struct *ship_ship_hit_
light_local_vel.xyz.z < light_sip->collision_physics.reorient_max_z &&
light_local_vel.xyz.z > light_sip->collision_physics.reorient_min_z &&
light_local_vel.xyz.y > light_sip->collision_physics.reorient_min_y &&
abs(light_local_vel.xyz.x) < light_sip->collision_physics.reorient_max_x &&
fl_abs(light_local_vel.xyz.x) < light_sip->collision_physics.reorient_max_x &&
light_uvec_dot_norm > 0 &&
light_fvec_dot_norm < light_sip->collision_physics.reorient_max_angle &&
light_fvec_dot_norm > light_sip->collision_physics.reorient_min_angle &&
abs(light_rvec_dot_norm) < light_sip->collision_physics.reorient_max_rot_angle)
fl_abs(light_rvec_dot_norm) < light_sip->collision_physics.reorient_max_rot_angle)
{
vec3d landing_delta_rotvel;
landing_delta_rotvel.xyz.x = (light_fvec_dot_norm * light_sip->collision_physics.reorient_mult)
+27 -22
View File
@@ -8974,32 +8974,37 @@ void change_ship_type(int n, int ship_type, int by_sexp)
// Goober5000 - maintain the original hull, shield, and subsystem percentages... gah
// ...except when in FRED, because this stuff is handled in the missionparse/missionsave part. The E
// hull
if (sp->special_hitpoints) {
hull_pct = objp->hull_strength / sp->ship_max_hull_strength;
if (!Fred_running) {
// hull
if (sp->special_hitpoints) {
hull_pct = objp->hull_strength / sp->ship_max_hull_strength;
} else {
Assert( Ship_info[sp->ship_info_index].max_hull_strength > 0.0f );
hull_pct = objp->hull_strength / Ship_info[sp->ship_info_index].max_hull_strength;
}
// extra check
Assert(hull_pct > 0.0f && hull_pct <= 1.0f);
CLAMP(hull_pct, 0.1f, 1.0f);
// shield
if (sp->special_shield > 0) {
shield_pct = shield_get_strength(objp) / sp->ship_max_shield_strength;
} else if (Ship_info[sp->ship_info_index].max_shield_strength > 0.0f) {
shield_pct = shield_get_strength(objp) / Ship_info[sp->ship_info_index].max_shield_strength;
} else {
shield_pct = 0.0f;
}
// extra check
Assert(shield_pct >= 0.0f && shield_pct <= 1.0f);
CLAMP(shield_pct, 0.0f, 1.0f);
} else {
Assert( Ship_info[sp->ship_info_index].max_hull_strength > 0.0f );
hull_pct = objp->hull_strength / Ship_info[sp->ship_info_index].max_hull_strength;
shield_pct = hull_pct = 1.0f;
}
// extra check
Assert(hull_pct > 0.0f && hull_pct <= 1.0f);
CLAMP(hull_pct, 0.1f, 1.0f);
// shield
if (sp->special_shield > 0) {
shield_pct = shield_get_strength(objp) / sp->ship_max_shield_strength;
} else if (Ship_info[sp->ship_info_index].max_shield_strength > 0.0f) {
shield_pct = shield_get_strength(objp) / Ship_info[sp->ship_info_index].max_shield_strength;
} else {
shield_pct = 0.0f;
}
// extra check
Assert(shield_pct >= 0.0f && shield_pct <= 1.0f);
CLAMP(shield_pct, 0.0f, 1.0f);
// subsystems
int num_saved_subsystems = 0;
char **subsys_names = new char *[sip_orig->n_subsystems];