I think I fixed the two bugs I'm likely to be able to fix anytime soon
were it called ship_start_targeting_laser(shipp);
I put this in,
if((winfo_p->wi_flags & WIF_BEAM) && (winfo_p->b_info.beam_type == BEAM_TYPE_C)){
polymodel *po = model_get( Ship_info[shipp->ship_info_index].modelnum );
int num_slots = po->gun_banks[shipp->targeting_laser_bank].num_slots;
shipp->weapon_energy -= num_slots*winfo_p->energy_consumed;
if(shipp->weapon_energy < 0.0f){
shipp->weapon_energy = 0.0f;
}
else{
ship_start_targeting_laser(shipp);
}
continue;
}
I'm sloppy I know, I'll try moving this into the ship_start_targeting_laser() function latter
the processing function is now
void ship_process_targeting_lasers()
{
beam_fire_info fire_info;
ship_obj *so;
ship *shipp;
polymodel *m;
// interate over all ships
for ( so = GET_FIRST(&Ship_obj_list); so != END_OF_LIST(&Ship_obj_list); so = GET_NEXT(so) ) {
// sanity checks
shipp = &Ships[Objects[so->objnum].instance];
polymodel *po = model_get( Ship_info[shipp->ship_info_index].modelnum );
int num_slots = po->gun_banks[shipp->targeting_laser_bank].num_slots;
if(so->objnum < 0){
continue;
}
if(Objects[so->objnum].type != OBJ_SHIP){
continue;
}
if(Objects[so->objnum].instance < 0){
continue;
}
// if our trigger is no longer down, switch it off
if(!(shipp->flags & SF_TRIGGER_DOWN)){
ship_stop_targeting_laser(shipp);
continue;
}
// if we have a bank to fire - fire it
if((shipp->targeting_laser_bank >= 0) && (shipp->targeting_laser_bank < 2)){
// try and get the model
m = model_get(shipp->modelnum);
if(m == NULL){
continue;
}
// fire a targeting laser
if (shipp->targeting_laser_bank != 2){
for ( int j = 0; j < num_slots; j++ ){
fire_info.accuracy = 0.0f;
fire_info.beam_info_index = shipp->weapons.primary_bank_weapons[shipp->targeting_laser_bank];
fire_info.beam_info_override = NULL;
fire_info.shooter = &Objects[shipp->objnum];
fire_info.target = NULL;
fire_info.target_subsys = NULL;
fire_info.turret = NULL;
fire_info.targeting_laser_offset = m->gun_banks[shipp->targeting_laser_bank].pnt[j];
shipp->targeting_laser_objnum = beam_fire_targeting(&fire_info);
// hmm, why didn't it fire?
if(shipp->targeting_laser_objnum < 0){
Int3();
ship_stop_targeting_laser(shipp);
}
}
}
if (shipp->targeting_laser_bank == 2){
for (int q = 1; q<0; q--)
for ( int j = 0; j < num_slots; j++ ){
fire_info.accuracy = 0.0f;
fire_info.beam_info_index = shipp->weapons.primary_bank_weapons[shipp->targeting_laser_bank];
fire_info.beam_info_override = NULL;
fire_info.shooter = &Objects[shipp->objnum];
fire_info.target = NULL;
fire_info.target_subsys = NULL;
fire_info.turret = NULL;
fire_info.targeting_laser_offset = m->gun_banks[q].pnt[j];
shipp->targeting_laser_objnum = beam_fire_targeting(&fire_info);
// hmm, why didn't it fire?
if(shipp->targeting_laser_objnum < 0){
Int3();
ship_stop_targeting_laser(shipp);
}
}
}
}
}
}
I'm sure there is a more eligent way of doing this, actualy I know there is becase I realised it a few seconds after I started the build, but it's 5:00 am and this isn't ever going to be used in anything but me playing around (I'm sure Kaz will have REAL beams, that being a new type with warmup and down and everything in a few days) so to hell with it
now I'm gona look at the AI code and see if there is something simple like
if(WIF_BEAM)
then_don't_fire_stupid()
that I can alter
don't think it'll be that simple though