what would be really nice is the ability to specify this for start or end, you might want for instance a section that is visible only near the end, and we have enough data to allow that in that a negative max length could mean length from end, not start.
I have no development environment set up so I can't just do it and test it and post a proper patch, but if someone who does have such an environment would like to give this a shot what you would have to change is...
weapons.h
beam_weapon_section_info - you need to add a float, lets call it max_length
weapons.cpp
parse_weapon - at the end of the section parse code (after stuff_float(&bsip->translation); before // if we are actually removing this index then reset it and we'l) add
if ( optional_string("+Max Length:") )
stuff_float(&bsip->max_length);
else
bsip->max_length = 0.0f;
beam.cpp
beam_render -- find the chunk that looks like this:
// calculate the beam points
scale = frand_range(1.0f - bwsi->flicker, 1.0f + bwsi->flicker);
beam_calc_facing_pts(&top1, &bottom1, &fvec, &b->last_start, bwsi->width * scale * b->shrink, bwsi->z_add);
beam_calc_facing_pts(&top2, &bottom2, &fvec, &b->last_shot, bwsi->width * scale * scale * b->shrink, bwsi->z_add);
and change it to this
length = vm_vec_dist(&b->last_start, &b->last_shot); //this line is lower in the function, it needs to be moved above start/end point calculation, it actually could be moved out of the loop entirely
vec3d beam_section_start = b->last_start;
vec3d beam_section_end = b->last_shot;
if(bwsi->max_length > 0.0f){
vm_vec_scale_add2(&beam_section_end, &beam_section_start, &fvec, MIN(length, bwsi->max_length));
}
else if(bwsi->max_length < 0.0f){
vm_vec_scale_add2(&beam_section_start, &beam_section_end, &fvec, -MIN(length, -bwsi->max_length));
}
// calculate the beam points
scale = frand_range(1.0f - bwsi->flicker, 1.0f + bwsi->flicker);
beam_calc_facing_pts(&top1, &bottom1, &fvec, &beam_section_start, bwsi->width * scale * b->shrink, bwsi->z_add); //note beam_section_start
beam_calc_facing_pts(&top2, &bottom2, &fvec, &beam_section_end, bwsi->width * scale * scale * b->shrink, bwsi->z_add); //note beam_section_end
{grrrr... cannot add any formatting to code blocks, can't highlight changes}