.entity beam_muzzleentity;
+.float beam_degreespersegment;
+.float beam_distancepersegment;
.float beam_usevieworigin;
.float beam_initialized;
.float beam_maxangle;
self.beam_initialized = TRUE;
}
- // WEAPONTODO: Calculate segments dyanmically similarly to the server code
- segments = 20;
if(self.beam_dir != wantdir)
{
// calculate how much we're going to move the end of the beam to the want position
self.beam_dir = normalize((wantdir * (1 - blendfactor)) + (self.beam_dir * blendfactor));
}
- #if 0
// calculate how many segments are needed
float max_allowed_segments;
- if(WEP_CVAR(arc, beam_distancepersegment))
+ if(self.beam_distancepersegment)
{
max_allowed_segments = min(
ARC_MAX_SEGMENTS,
- 1 + (vlen(w_shotdir / WEP_CVAR(arc, beam_distancepersegment)))
+ 1 + (vlen(wantdir / self.beam_distancepersegment))
);
}
else { max_allowed_segments = ARC_MAX_SEGMENTS; }
- if(WEP_CVAR(arc, beam_degreespersegment))
+ if(self.beam_degreespersegment)
{
segments = bound(
1,
(
min(
angle,
- WEP_CVAR(arc, beam_maxangle)
+ self.beam_maxangle
)
/
- WEP_CVAR(arc, beam_degreespersegment)
+ self.beam_degreespersegment
),
max_allowed_segments
);
}
else { segments = 1; }
- #endif
}
- #if 0
else { segments = 1; }
- #endif
// set the beam direction which the rest of the code will refer to
beamdir = self.beam_dir;
wantdir = self.v_angle;
beamdir = self.angles;
- // WEAPONTODO: Calculate segments dyanmically similarly to the server code
- segments = 20;
- #if 0
if(beamdir != wantdir)
{
+ float angle = vlen(wantdir - beamdir) * RAD2DEG;
+
// calculate how many segments are needed
float max_allowed_segments;
- if(WEP_CVAR(arc, beam_distancepersegment))
+ if(self.beam_distancepersegment)
{
max_allowed_segments = min(
ARC_MAX_SEGMENTS,
- 1 + (vlen(w_shotdir / WEP_CVAR(arc, beam_distancepersegment)))
+ 1 + (vlen(wantdir / self.beam_distancepersegment))
);
}
else { max_allowed_segments = ARC_MAX_SEGMENTS; }
- if(WEP_CVAR(arc, beam_degreespersegment))
+ if(self.beam_degreespersegment)
{
segments = bound(
1,
(
min(
angle,
- WEP_CVAR(arc, beam_maxangle)
+ self.beam_maxangle
)
/
- WEP_CVAR(arc, beam_degreespersegment)
+ self.beam_degreespersegment
),
max_allowed_segments
);
else { segments = 1; }
}
else { segments = 1; }
- #endif
}
setorigin(self, start_pos);
if(sf & 1) // settings information
{
+ self.beam_degreespersegment = ReadShort();
+ self.beam_distancepersegment = ReadShort();
self.beam_maxangle = ReadShort();
self.beam_range = ReadCoord();
self.beam_returnspeed = ReadShort();
w_prop(id, sn, float, weaponthrowable, weaponthrowable)
#ifndef MENUQC
+#define ARC_MAX_SEGMENTS 20
vector arc_shotorigin[4];
.vector beam_start;
.vector beam_dir;
#define ARC_BT_BURSTMASK 10
#endif
#ifdef SVQC
-#define ARC_MAX_SEGMENTS 20
ARC_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
.entity arc_beam;
.float BUTTON_ATCK_prev; // for better animation control
if(sf & 1) // settings information
{
+ WriteShort(MSG_ENTITY, WEP_CVAR(arc, beam_degreespersegment));
+ WriteShort(MSG_ENTITY, WEP_CVAR(arc, beam_distancepersegment));
WriteShort(MSG_ENTITY, WEP_CVAR(arc, beam_maxangle));
WriteCoord(MSG_ENTITY, WEP_CVAR(arc, beam_range));
WriteShort(MSG_ENTITY, WEP_CVAR(arc, beam_returnspeed));