for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
{
.entity weaponentity = weaponentities[slot];
+ if(!pl.(weaponentity))
+ continue; // continue incase other slots exist?
if(pl.(weaponentity).hook)
- {
delete(pl.(weaponentity).hook);
- pl.(weaponentity).hook = NULL;
- }
+ pl.(weaponentity).hook = NULL;
}
//pl.disableclientprediction = false;
void RemoveHook(entity this)
{
- for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
- {
- .entity weaponentity = weaponentities[slot];
- if(this.realowner.(weaponentity).hook == this)
- this.realowner.(weaponentity).hook = NULL;
- }
+ entity player = this.realowner;
+ .entity weaponentity = this.weaponentity_fld;
+
+ if(player.(weaponentity).hook == this)
+ player.(weaponentity).hook = NULL;
- if(this.realowner.move_movetype == MOVETYPE_FLY)
- set_movetype(this.realowner, MOVETYPE_WALK);
+ if(player.move_movetype == MOVETYPE_FLY)
+ set_movetype(player, MOVETYPE_WALK);
delete(this);
}
// weapon switching impulses
-bool autocvar_g_weaponswitch_debug;
-
#define X(slot) \
IMPULSE(weapon_group_##slot) \
{ \
{ \
.entity weaponentity = weaponentities[wepslot]; \
W_NextWeaponOnImpulse(this, slot, weaponentity); \
- if(wepslot == 0 && !autocvar_g_weaponswitch_debug) \
+ if(wepslot == 0 && autocvar_g_weaponswitch_debug != 1) \
break; \
} \
}
{ \
.entity weaponentity = weaponentities[wepslot]; \
W_CycleWeapon(this, this.cvar_cl_weaponpriorities[slot], dir, weaponentity); \
- if(wepslot == 0 && !autocvar_g_weaponswitch_debug) \
+ if(wepslot == 0 && autocvar_g_weaponswitch_debug != 1) \
break; \
} \
}
{ \
.entity weaponentity = weaponentities[slot]; \
W_SwitchWeapon(this, Weapons_from(WEP_FIRST + i), weaponentity); \
- if(slot == 0 && !autocvar_g_weaponswitch_debug) \
+ if(slot == 0 && autocvar_g_weaponswitch_debug != 1) \
break; \
} \
}
.entity weaponentity = weaponentities[slot];
W_NextWeapon(this, 0, weaponentity);
- if(slot == 0 && !autocvar_g_weaponswitch_debug)
+ if(slot == 0 && autocvar_g_weaponswitch_debug != 1)
break;
}
}
.entity weaponentity = weaponentities[slot];
W_PreviousWeapon(this, 0, weaponentity);
- if(slot == 0 && !autocvar_g_weaponswitch_debug)
+ if(slot == 0 && autocvar_g_weaponswitch_debug != 1)
break;
}
}
.entity weaponentity = weaponentities[slot];
W_NextWeapon(this, 1, weaponentity);
- if(slot == 0 && !autocvar_g_weaponswitch_debug)
+ if(slot == 0 && autocvar_g_weaponswitch_debug != 1)
break;
}
}
.entity weaponentity = weaponentities[slot];
W_PreviousWeapon(this, 1, weaponentity);
- if(slot == 0 && !autocvar_g_weaponswitch_debug)
+ if(slot == 0 && autocvar_g_weaponswitch_debug != 1)
break;
}
}
.entity weaponentity = weaponentities[slot];
W_NextWeapon(this, 2, weaponentity);
- if(slot == 0 && !autocvar_g_weaponswitch_debug)
+ if(slot == 0 && autocvar_g_weaponswitch_debug != 1)
break;
}
}
.entity weaponentity = weaponentities[slot];
W_PreviousWeapon(this, 2, weaponentity);
- if(slot == 0 && !autocvar_g_weaponswitch_debug)
+ if(slot == 0 && autocvar_g_weaponswitch_debug != 1)
break;
}
}
.entity weaponentity = weaponentities[slot];
W_LastWeapon(this, weaponentity);
- if(slot == 0 && !autocvar_g_weaponswitch_debug)
+ if(slot == 0 && autocvar_g_weaponswitch_debug != 1)
break;
}
}
.entity weaponentity = weaponentities[slot];
W_SwitchWeapon(this, w_getbestweapon(this, weaponentity), weaponentity);
- if(slot == 0 && !autocvar_g_weaponswitch_debug)
+ if(slot == 0 && autocvar_g_weaponswitch_debug != 1)
break;
}
}
.entity weaponentity = weaponentities[slot];
W_ThrowWeapon(this, weaponentity, W_CalculateProjectileVelocity(this, this.velocity, v_forward * 750, false), '0 0 0', true);
- if(slot == 0 && !autocvar_g_weaponswitch_debug)
+ if(slot == 0 && autocvar_g_weaponswitch_debug != 1)
break;
}
}
Weapon w = this.(weaponentity).m_weapon;
w.wr_reload(w, actor, weaponentity);
- if(slot == 0 && !autocvar_g_weaponswitch_debug)
+ if(slot == 0 && autocvar_g_weaponswitch_debug != 1)
break;
}
}