const int ARC_BT_BURST_HIT = 0x13;
const int ARC_BT_BURSTMASK = 0x10;
-const int ARC_SF_SETTINGS = 1;
-const int ARC_SF_START = 2;
-const int ARC_SF_WANTDIR = 4;
-const int ARC_SF_BEAMDIR = 8;
-const int ARC_SF_BEAMTYPE = 16;
-const int ARC_SF_LOCALMASK = 14;
+const int ARC_SF_SETTINGS = BIT(0);
+const int ARC_SF_START = BIT(1);
+const int ARC_SF_WANTDIR = BIT(2);
+const int ARC_SF_BEAMDIR = BIT(3);
+const int ARC_SF_BEAMTYPE = BIT(4);
+const int ARC_SF_LOCALMASK = ARC_SF_START | ARC_SF_WANTDIR | ARC_SF_BEAMDIR;
#endif
#ifdef SVQC
ARC_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
#endif
#ifdef IMPLEMENTATION
#ifdef SVQC
-void spawnfunc_weapon_arc(void) { weapon_defaultspawnfunc(WEP_ARC.m_id); }
+spawnfunc(weapon_arc) { weapon_defaultspawnfunc(WEP_ARC.m_id); }
-float W_Arc_Beam_Send(entity to, int sf)
-{SELFPARAM();
+bool W_Arc_Beam_Send(entity this, entity to, int sf)
+{
WriteByte(MSG_ENTITY, ENT_CLIENT_ARC_BEAM);
// Truncate information when this beam is displayed to the owner client
}
}
- METHOD(Arc, wr_aim, bool(entity thiswep))
+ METHOD(Arc, wr_aim, void(entity thiswep))
{
SELFPARAM();
if(WEP_CVAR(arc, beam_botaimspeed))
false
);
}
- return true;
}
- METHOD(Arc, wr_think, bool(entity thiswep, bool fire1, bool fire2))
+ METHOD(Arc, wr_think, void(entity thiswep, entity actor, int slot, int fire))
{
- SELFPARAM();
- Arc_Player_SetHeat(self);
+ Arc_Player_SetHeat(actor);
Arc_Smoke();
- if (time >= self.arc_overheat)
- if (fire1 || fire2 || self.arc_beam.beam_bursting)
+ if (time >= actor.arc_overheat)
+ if ((fire & 1) || (fire & 2) || actor.arc_beam.beam_bursting)
{
- if(self.arc_BUTTON_ATCK_prev)
+ if(actor.arc_BUTTON_ATCK_prev)
{
#if 0
- if(self.animstate_startframe == self.anim_shoot.x && self.animstate_numframes == self.anim_shoot.y)
- weapon_thinkf(WFRAME_DONTCHANGE, autocvar_g_balance_arc_primary_animtime, w_ready);
+ if(actor.animstate_startframe == actor.anim_shoot.x && actor.animstate_numframes == actor.anim_shoot.y)
+ weapon_thinkf(actor, WFRAME_DONTCHANGE, autocvar_g_balance_arc_primary_animtime, w_ready);
else
#endif
- weapon_thinkf(WFRAME_FIRE1, WEP_CVAR(arc, beam_animtime), w_ready);
+ weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR(arc, beam_animtime), w_ready);
}
- if((!self.arc_beam) || wasfreed(self.arc_beam))
+ if((!actor.arc_beam) || wasfreed(actor.arc_beam))
{
- if(weapon_prepareattack(fire2, 0))
+ if(weapon_prepareattack(thiswep, actor, boolean(fire & 2), 0))
{
- W_Arc_Beam(fire2);
+ W_Arc_Beam(boolean(fire & 2));
- if(!self.arc_BUTTON_ATCK_prev)
+ if(!actor.arc_BUTTON_ATCK_prev)
{
- weapon_thinkf(WFRAME_FIRE1, WEP_CVAR(arc, beam_animtime), w_ready);
- self.arc_BUTTON_ATCK_prev = true;
+ weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR(arc, beam_animtime), w_ready);
+ actor.arc_BUTTON_ATCK_prev = true;
}
}
}
- return true;
+ return;
}
- if(self.arc_BUTTON_ATCK_prev)
+ if(actor.arc_BUTTON_ATCK_prev)
{
- sound(self, CH_WEAPON_A, SND_ARC_STOP, VOL_BASE, ATTN_NORM);
- weapon_thinkf(WFRAME_FIRE1, WEP_CVAR(arc, beam_animtime), w_ready);
- ATTACK_FINISHED(self) = time + WEP_CVAR(arc, beam_refire) * W_WeaponRateFactor();
+ sound(actor, CH_WEAPON_A, SND_ARC_STOP, VOL_BASE, ATTN_NORM);
+ weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR(arc, beam_animtime), w_ready);
+ ATTACK_FINISHED(actor) = time + WEP_CVAR(arc, beam_refire) * W_WeaponRateFactor();
}
- self.arc_BUTTON_ATCK_prev = false;
+ actor.arc_BUTTON_ATCK_prev = false;
#if 0
- if(fire2)
- if(weapon_prepareattack(true, autocvar_g_balance_arc_secondary_refire))
+ if(fire & 2)
+ if(weapon_prepareattack(thiswep, actor, true, autocvar_g_balance_arc_secondary_refire))
{
W_Arc_Attack2();
- self.arc_count = autocvar_g_balance_arc_secondary_count;
- weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_arc_secondary_animtime, w_arc_checkattack);
- self.arc_secondarytime = time + autocvar_g_balance_arc_secondary_refire2 * W_WeaponRateFactor();
+ actor.arc_count = autocvar_g_balance_arc_secondary_count;
+ weapon_thinkf(actor, WFRAME_FIRE2, autocvar_g_balance_arc_secondary_animtime, w_arc_checkattack);
+ actor.arc_secondarytime = time + autocvar_g_balance_arc_secondary_refire2 * W_WeaponRateFactor();
}
#endif
-
- return true;
}
- METHOD(Arc, wr_init, bool(entity thiswep))
+ METHOD(Arc, wr_init, void(entity thiswep))
{
if(!arc_shotorigin[0])
{
arc_shotorigin[3] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 4);
}
ARC_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
- return true;
}
METHOD(Arc, wr_checkammo1, bool(entity thiswep))
{
return WEP_CVAR(arc, overheat_max) > 0 &&
((!WEP_CVAR(arc, burst_ammo)) || (self.WEP_AMMO(ARC) > 0));
}
- METHOD(Arc, wr_config, bool(entity thiswep))
+ METHOD(Arc, wr_config, void(entity thiswep))
{
ARC_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
- return true;
}
- METHOD(Arc, wr_killmessage, bool(entity thiswep))
+ METHOD(Arc, wr_killmessage, int(entity thiswep))
{
return WEAPON_ARC_MURDER;
}
- METHOD(Arc, wr_drop, bool(entity thiswep))
+ METHOD(Arc, wr_drop, void(entity thiswep))
{
weapon_dropevent_item.arc_overheat = self.arc_overheat;
weapon_dropevent_item.arc_cooldown = self.arc_cooldown;
self.arc_overheat = 0;
self.arc_cooldown = 0;
- return true;
}
- METHOD(Arc, wr_pickup, bool(entity thiswep))
+ METHOD(Arc, wr_pickup, void(entity thiswep))
{
if ( !client_hasweapon(self, WEP_ARC.m_id, false, false) &&
weapon_dropevent_item.arc_overheat > time )
self.arc_overheat = weapon_dropevent_item.arc_overheat;
self.arc_cooldown = weapon_dropevent_item.arc_cooldown;
}
- return true;
}
#endif
#ifdef CSQC
}
}
-void Draw_ArcBeam(void)
-{SELFPARAM();
+void Draw_ArcBeam(entity this)
+{
float dt = time - self.move_time;
self.move_time = time;
if(dt <= 0) { return; }
if(isnew)
{
- // calculate shot origin offset from gun alignment
- int gunalign = autocvar_cl_gunalign;
- if(gunalign != 1 && gunalign != 2 && gunalign != 4)
- gunalign = 3; // default value
- --gunalign;
+ int gunalign = W_GetGunAlignment(world);
self.beam_shotorigin = arc_shotorigin[gunalign];
}
}
- METHOD(Arc, wr_impacteffect, bool(entity thiswep))
- {
- // todo
- return true;
- }
- METHOD(Arc, wr_init, bool(entity thiswep))
- {
- return true;
- }
- METHOD(Arc, wr_zoomreticle, bool(entity thiswep))
- {
- // no weapon specific image for this weapon
- return false;
- }
#endif
#endif