]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/weapons/weapon/porto.qc
Simplify REGISTER_WEAPON (and avoid adding redundant globals), now possible thanks...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / weapon / porto.qc
index ab400856c3e89745aa649e1ee359a7fb35192189..d54b6a71428ebb9a90ced86e89039f2a18e2ef16 100644 (file)
@@ -13,7 +13,7 @@ const int polyline_length = 16;
 .vector polyline[polyline_length];
 void Porto_Draw(entity this)
 {
-       if (spectatee_status || intermission == 1 || intermission == 2 || STAT(HEALTH) <= 0 || WEP_CVAR(porto, secondary)) return;
+       if (spectatee_status || intermission == 1 || intermission == 2 || STAT(HEALTH) <= 0 || WEP_CVAR(WEP_PORTO, secondary)) return;
 
        for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
        {
@@ -121,7 +121,7 @@ void W_Porto_Fail(entity this, float failhard)
                // FIXME: item properties should be obtained from the registry
                setsize(this, ITEM_D_MINS, ITEM_D_MAXS);
                setorigin(this, this.origin + trace_plane_normal);
-               if(move_out_of_solid(this))
+               if(nudgeoutofsolid(this))
                {
                        this.flags = FL_ITEM;
                        IL_PUSH(g_items, this);
@@ -172,7 +172,7 @@ void W_Porto_Touch(entity this, entity toucher)
                traceline(trace_ent.origin, trace_ent.origin + '0 0 2' * PL_MIN_CONST.z, MOVE_WORLDONLY, this);
                if(trace_fraction >= 1)
                        return;
-               if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SLICK || trace_dphitcontents & DPCONTENTS_PLAYERCLIP)
+               if((trace_dphitq3surfaceflags & Q3SURFACEFLAG_SLICK) || (trace_dphitcontents & DPCONTENTS_PLAYERCLIP))
                        return;
                if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
                        return;
@@ -298,21 +298,20 @@ void W_Porto_Attack(Weapon thiswep, entity actor, .entity weaponentity, float ty
        gren.bot_dodgerating = 200;
        set_movetype(gren, MOVETYPE_BOUNCEMISSILE);
        PROJECTILE_MAKETRIGGER(gren);
-       gren.clipgroup = CLIPGROUP_UNHITTABLEPROJ;
        gren.effects = EF_RED;
        gren.scale = 4;
        setorigin(gren, w_shotorg);
-       setsize(gren, UNHITTABLEPROJ_MINS, UNHITTABLEPROJ_MAXS);
+       setsize(gren, '0 0 0', '0 0 0');
 
-       gren.nextthink = time + WEP_CVAR_BOTH(porto, (type <= 0), lifetime);
+       gren.nextthink = time + WEP_CVAR_BOTH(WEP_PORTO, (type <= 0), lifetime);
        setthink(gren, W_Porto_Think);
        settouch(gren, W_Porto_Touch);
 
        // TODO: handle as mutator effect
        if(StatusEffects_active(STATUSEFFECT_Strength, actor))
-               W_SetupProjVelocity_Basic(gren, WEP_CVAR_BOTH(porto, (type <= 0), speed) * autocvar_g_balance_powerup_strength_force, 0);
+               W_SetupProjVelocity_Basic(gren, WEP_CVAR_BOTH(WEP_PORTO, (type <= 0), speed) * autocvar_g_balance_powerup_strength_force, 0);
        else
-               W_SetupProjVelocity_Basic(gren, WEP_CVAR_BOTH(porto, (type <= 0), speed), 0);
+               W_SetupProjVelocity_Basic(gren, WEP_CVAR_BOTH(WEP_PORTO, (type <= 0), speed), 0);
 
        gren.angles = vectoangles(gren.velocity);
        gren.flags = FL_PROJECTILE;
@@ -339,30 +338,30 @@ METHOD(PortoLaunch, wr_aim, void(entity thiswep, entity actor, .entity weaponent
 {
     PHYS_INPUT_BUTTON_ATCK(actor) = false;
     PHYS_INPUT_BUTTON_ATCK2(actor) = false;
-    if(!WEP_CVAR(porto, secondary))
-        if(bot_aim(actor, weaponentity, WEP_CVAR_PRI(porto, speed), 0, WEP_CVAR_PRI(porto, lifetime), false, true))
+    if(!WEP_CVAR(WEP_PORTO, secondary))
+        if(bot_aim(actor, weaponentity, WEP_CVAR_PRI(WEP_PORTO, speed), 0, WEP_CVAR_PRI(WEP_PORTO, lifetime), false, true))
             PHYS_INPUT_BUTTON_ATCK(actor) = true;
 }
 METHOD(PortoLaunch, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
 {
-    if(WEP_CVAR(porto, secondary))
+    if(WEP_CVAR(WEP_PORTO, secondary))
     {
         if(fire & 1)
         if(!actor.porto_current)
         if(!actor.porto_forbidden)
-        if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(porto, refire)))
+        if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(WEP_PORTO, refire)))
         {
             W_Porto_Attack(thiswep, actor, weaponentity, 0);
-            weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(porto, animtime), w_ready);
+            weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_PORTO, animtime), w_ready);
         }
 
         if(fire & 2)
         if(!actor.porto_current)
         if(!actor.porto_forbidden)
-        if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(porto, refire)))
+        if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(WEP_PORTO, refire)))
         {
             W_Porto_Attack(thiswep, actor, weaponentity, 1);
-            weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(porto, animtime), w_ready);
+            weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(WEP_PORTO, animtime), w_ready);
         }
     }
     else
@@ -386,10 +385,10 @@ METHOD(PortoLaunch, wr_think, void(entity thiswep, entity actor, .entity weapone
         if(fire & 1)
         if(!actor.porto_current)
         if(!actor.porto_forbidden)
-        if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(porto, refire)))
+        if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(WEP_PORTO, refire)))
         {
             W_Porto_Attack(thiswep, actor, weaponentity, -1);
-            weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(porto, animtime), w_ready);
+            weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_PORTO, animtime), w_ready);
         }
     }
 }