]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/weapons/weapon/arc.qc
Weapons: pass weapon index
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / weapon / arc.qc
index e1796bdf235a4d6bee4873a3e53d9e95c1357048..53359ee98c1c13cb90e9e33025d6c274fd69f791 100644 (file)
@@ -74,12 +74,12 @@ const int ARC_BT_BURST_HEAL =  0x12;
 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)
@@ -130,8 +130,8 @@ vector Draw_ArcBeam_callback_last_bottom; // NOTE: in same coordinate system as
 #ifdef SVQC
 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
@@ -656,13 +656,13 @@ void Arc_Smoke()
                                );
                        }
                }
-               METHOD(Arc, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
+               METHOD(Arc, wr_think, void(entity thiswep, entity actor, int slot, int fire))
                {
                        Arc_Player_SetHeat(actor);
                        Arc_Smoke();
 
                        if (time >= actor.arc_overheat)
-                       if (fire1 || fire2 || actor.arc_beam.beam_bursting)
+                       if ((fire & 1) || (fire & 2) || actor.arc_beam.beam_bursting)
                        {
 
                                if(actor.arc_BUTTON_ATCK_prev)
@@ -677,9 +677,9 @@ void Arc_Smoke()
 
                                if((!actor.arc_beam) || wasfreed(actor.arc_beam))
                                {
-                                       if(weapon_prepareattack(thiswep, actor, fire2, 0))
+                                       if(weapon_prepareattack(thiswep, actor, boolean(fire & 2), 0))
                                        {
-                                               W_Arc_Beam(fire2);
+                                               W_Arc_Beam(boolean(fire & 2));
 
                                                if(!actor.arc_BUTTON_ATCK_prev)
                                                {
@@ -701,7 +701,7 @@ void Arc_Smoke()
                        actor.arc_BUTTON_ATCK_prev = false;
 
                        #if 0
-                       if(fire2)
+                       if(fire & 2)
                        if(weapon_prepareattack(thiswep, actor, true, autocvar_g_balance_arc_secondary_refire))
                        {
                                W_Arc_Attack2();
@@ -850,8 +850,8 @@ void Reset_ArcBeam(void)
        }
 }
 
-void Draw_ArcBeam(void)
-{SELFPARAM();
+void Draw_ArcBeam(entity this)
+{
        float dt = time - self.move_time;
        self.move_time = time;
        if(dt <= 0) { return; }
@@ -1156,11 +1156,7 @@ void Ent_ReadArcBeam(float isnew)
 
        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];