|
29 | 29 | #include "tracing/tracing.h"
|
30 | 30 | #include "weapon/weapon.h"
|
31 | 31 | #include "decals/decals.h"
|
| 32 | +#include "freespace.h" |
| 33 | +#include "utils/modular_curves.h" |
32 | 34 |
|
33 | 35 | class sorted_obj
|
34 | 36 | {
|
@@ -142,8 +144,23 @@ int obj_in_view_cone( object * objp )
|
142 | 144 | // Center isn't in... are other points?
|
143 | 145 | ubyte and_codes = 0xff;
|
144 | 146 |
|
| 147 | + float obj_size; |
| 148 | + |
| 149 | + if (objp->type == OBJ_WEAPON && Weapon_info[Weapons[objp->instance].weapon_info_index].render_type == WRT_LASER) { |
| 150 | + auto wp = &Weapons[objp->instance]; |
| 151 | + auto wip = &Weapon_info[wp->weapon_info_index]; |
| 152 | + float length_scalar = wip->weapon_curves.get_output(weapon_info::WeaponCurveOutputs::LASER_LENGTH_MULT, *wp, &wp->modular_curves_instance); |
| 153 | + if (wip->laser_length_by_frametime) { |
| 154 | + length_scalar *= flFrametime; |
| 155 | + } |
| 156 | + float radius_scalar = wip->weapon_curves.get_output(weapon_info::WeaponCurveOutputs::LASER_RADIUS_MULT, *wp, &wp->modular_curves_instance); |
| 157 | + obj_size = (wip->laser_length * length_scalar) + (wip->laser_head_radius * radius_scalar); |
| 158 | + } else { |
| 159 | + obj_size = objp->radius; |
| 160 | + } |
| 161 | + |
145 | 162 | for (i=0; i<8; i++ ) {
|
146 |
| - vm_vec_scale_add( &pt, &objp->pos, &check_offsets[i], objp->radius ); |
| 163 | + vm_vec_scale_add( &pt, &objp->pos, &check_offsets[i], obj_size ); |
147 | 164 | codes=g3_rotate_vector(&tmp,&pt);
|
148 | 165 | if ( !codes ) {
|
149 | 166 | //mprintf(( "A point is inside, so render it.\n" ));
|
|
0 commit comments