34 :
System(WEAPON, d->type, d->name, d->value,
35 d->capacity, d->capacity, d->recharge_rate),
36 design(d), group(d->group), ammo(-1), ripple_count(0),
37 aim_azimuth((float) az), aim_elevation((float) el),
38 old_azimuth(0.0f), old_elevation(0.0f), aim_time(0),
39 enabled(true), refire(0.0f),
40 mass(d->carry_mass), resist(d->carry_resist),
41 guided(d->guided), shot_speed(d->speed),
42 active_barrel(0), locked(false), centered(false), firing(false), blocked(false),
43 index(0), target(0), subtarget(0), beams(0), orders(MANUAL),
44 control(SINGLE_FIRE), sweep(SWEEP_TIGHT), turret(0), turret_base(0)
100 :
System(w), design(w.design), ammo(-1), ripple_count(0),
101 enabled(true), refire(0.0f),
102 mass(w.mass), resist(w.resist),
103 aim_azimuth(w.aim_azimuth), aim_elevation(w.aim_elevation),
104 old_azimuth(0.0f), old_elevation(0.0f), aim_time(0),
105 guided(w.guided), shot_speed(w.shot_speed),
106 active_barrel(0), locked(false), centered(false), firing(false), blocked(false),
107 target(0), subtarget(0), beams(0), orders(MANUAL),
108 control(SINGLE_FIRE), sweep(SWEEP_TIGHT), group(w.group),
109 aim_az_max(w.aim_az_max), aim_az_min(w.aim_az_min), aim_az_rest(w.aim_az_rest),
110 aim_el_max(w.aim_el_max), aim_el_min(w.aim_el_min), aim_el_rest(w.aim_el_rest),
111 turret(0), turret_base(0)
118 for (
int i = 0; i <
nbarrels; i++) {
128 beams =
new(__FILE__,__LINE__)
Shot* [nbarrels];
129 ZeroMemory(
beams,
sizeof(
Shot*) * nbarrels);
144 for (
int i = 0; i <
nbarrels; i++) {
235 for (
int i = 0; i <
nbarrels; i++) {
294 refire -= (float) seconds;
306 for (
int i = 0; i <
nbarrels; i++) {
327 bool aim_beams =
false;
330 for (
int i = 0; i <
nbarrels; i++) {
351 (ammo < 0 || target && target->Integrity() >= 1) &&
358 (ammo < 0 || target && target->Integrity() >= 1) &&
376 energy = (float) (delivered_energy/seconds);
380 energy += (float) (delivered_energy * 1.25);
412 static char name[256];
459 switch (targ->
Type()) {
498 bool select_locked =
false;
520 distance < design->max_range &&
540 if (!c_ship)
continue;
549 if (distance < design->max_range && distance < dist) {
614 bool net_client = net_game ? net_game->
IsClient() :
false;
617 if (active_barrel < 0) {
627 for (
int i = 0; i <
nbarrels; i++) {
674 if (active_barrel < 0 || active_barrel >=
nbarrels)
681 for (
int i = 0; i < count; i++) {
704 if (active_barrel < 0 || active_barrel >=
nbarrels)
834 return new(__FILE__,__LINE__)
Drone(loc, cam, dsn, own);
837 return new(__FILE__,__LINE__)
Shot(loc, cam, dsn, own);
861 Matrix base = orientation;
876 for (
int i = 0; i <
nbarrels; i++) {
886 for (
int i = 0; i <
nbarrels; i++) {
902 for (
int i = 0; i <
nbarrels; i++) {
908 if (len < 1 || len > 1e7)
966 for (
int i = 0; i <
nbarrels; i++) {
968 az_phase = sin(
beams[i]->Life() * 0.4 *
PI);
969 el_phase = sin(
beams[i]->Life() * 1.0 *
PI);
974 az += factor * spread_az * az_phase;
975 el += factor * spread_el * el_phase * 0.25;
981 az +=
Random(-spread_az, spread_az);
984 el +=
Random(-spread_el, spread_el);
1012 az = atan2(fabs(tloc.
x), tloc.
z);
1013 el = atan2(fabs(tloc.
y), tloc.
z);
1015 double firing_cone = 10*
DEGREES;
1020 if (az < firing_cone && el < firing_cone)
1058 double eff_shot_speed = eff_shot_vel.
length();
1061 double time = distance / eff_shot_speed;
1092 if (fabs(pt.
z) < 0.1) pt.
z = 0.1;
1093 az = atan(pt.
x / pt.
z);
1094 if (pt.
z < 0) az -=
PI;
1095 if (az < -
PI) az += 2*
PI;
1104 if (fabs(pt.
z) < 0.1) pt.
z = 0.1;
1105 el = atan(pt.
y / pt.
z);
1131 double firing_cone = 10*
DEGREES;
1136 if (az < firing_cone && el < firing_cone)