healspray +movement and cl_weaponcfgs improvements

This commit is contained in:
pierow 2024-03-04 23:10:56 -05:00
parent 3220c418ed
commit 856e71f05a
3 changed files with 38 additions and 34 deletions

View file

@ -414,9 +414,9 @@ void WeaponsResource::UserCmd_MovementOn()
//if (healWeapon != currentWeapon) //if (healWeapon != currentWeapon)
//{ //{
healSprayLastWeapon = currentWeapon; healSprayLastWeapon = currentWeapon;
healSprayAttack2Active = true;
SetCurrentWeapon(healWeapon);
//} //}
ServerCmd(healWeapon->szName);
g_weaponselect = healWeapon->iId;
IN_Attack2Down(); IN_Attack2Down();
} }
@ -452,11 +452,12 @@ void WeaponsResource::UserCmd_MovementOff()
WEAPON* healWeapon = this->GetWeapon(AVH_WEAPON_HEALINGSPRAY); WEAPON* healWeapon = this->GetWeapon(AVH_WEAPON_HEALINGSPRAY);
if (healWeapon != NULL && healSprayLastWeapon != NULL) if (healWeapon != NULL && healSprayLastWeapon != NULL)
{ {
//if (healsprayLastWeapon != healWeapon) //if (healSprayLastWeapon != healWeapon)
//{ //{
ServerCmd(healSprayLastWeapon->szName); SetCurrentWeapon(healSprayLastWeapon);
g_weaponselect = healSprayLastWeapon->iId;
//} //}
healSprayAttack2Active = false;
} }
} }
} }
@ -503,7 +504,35 @@ void WeaponsResource::SetCurrentWeapon(WEAPON* newWeapon)
if( newWeapon != NULL ) if( newWeapon != NULL )
{ {
if( newWeapon != currentWeapon ) if( newWeapon != currentWeapon )
{ lastWeapon = currentWeapon; } {
lastWeapon = currentWeapon;
if (gHUD.GetHUDUser3() == AVH_USER3_ALIEN_PLAYER2 && !healSprayAttack2Active)
{
healSprayLastWeapon = newWeapon;
gEngfuncs.Con_Printf("healspray last change\n");
}
const float wCfgCvar = CVAR_GET_FLOAT("cl_weaponcfgs");
char weapCfg[128];
if (wCfgCvar == 1.0f)
{
ClientCmd("exec weaponcfgs/default.cfg");
sprintf(weapCfg, "exec weaponcfgs/%s.cfg", newWeapon->szName);
ClientCmd(weapCfg);
}
else if (wCfgCvar == 2.0f)
{
ClientCmd("exec weaponcfgs/nsdefaults/default.cfg");
sprintf(weapCfg, "exec weaponcfgs/nsdefaults/%s.cfg", newWeapon->szName);
ClientCmd(weapCfg);
}
}
ServerCmd(newWeapon->szName); ServerCmd(newWeapon->szName);
g_weaponselect = newWeapon->iId; g_weaponselect = newWeapon->iId;
} }
@ -736,32 +765,6 @@ void CHudAmmo::Think(void)
} }
if (gHUD.GetCurrentWeaponID() != gWR.lastWeaponId)
{
gWR.lastWeaponId = gHUD.GetCurrentWeaponID();
const float wCfgCvar = CVAR_GET_FLOAT("cl_weaponcfgs");
if (wCfgCvar == 1.0f)
{
ClientCmd("exec weaponcfgs/default.cfg");
WEAPON* currentWeapon = gWR.GetWeapon(gHUD.GetCurrentWeaponID());
char weapcfg[128];
sprintf(weapcfg, "exec weaponcfgs/%s.cfg", currentWeapon->szName);
ClientCmd(weapcfg);
}
else if (wCfgCvar == 2.0f)
{
ClientCmd("exec weaponcfgs/nsdefaults/default.cfg");
WEAPON* currentWeapon = gWR.GetWeapon(gHUD.GetCurrentWeaponID());
char weapcfg[128];
sprintf(weapcfg, "exec weaponcfgs/nsdefaults/%s.cfg", currentWeapon->szName);
ClientCmd(weapcfg);
}
}
if(gHUD.GetIsAlien()) //check for hive death causing loss of current weapon if(gHUD.GetIsAlien()) //check for hive death causing loss of current weapon
{ {
WEAPON* currentWeapon = gWR.GetWeapon(gHUD.GetCurrentWeaponID()); WEAPON* currentWeapon = gWR.GetWeapon(gHUD.GetCurrentWeaponID());

View file

@ -74,6 +74,7 @@ private:
WEAPON* rgSlots[MAX_WEAPON_SLOTS][MAX_WEAPON_POSITIONS]; // current weapon slot map WEAPON* rgSlots[MAX_WEAPON_SLOTS][MAX_WEAPON_POSITIONS]; // current weapon slot map
WEAPON* lastWeapon; // client-side lastinv WEAPON* lastWeapon; // client-side lastinv
WEAPON* healSprayLastWeapon; WEAPON* healSprayLastWeapon;
bool healSprayAttack2Active;
int riAmmo[MAX_AMMO_TYPES]; // current ammo counts int riAmmo[MAX_AMMO_TYPES]; // current ammo counts
int iOldWeaponBits; int iOldWeaponBits;

View file

@ -8,9 +8,9 @@ cl_cross_circle_outline_inner "0"
cl_cross_circle_radius "10" cl_cross_circle_radius "10"
cl_cross_circle_thickness "1.5" cl_cross_circle_thickness "1.5"
cl_cross_color "255 160 0" cl_cross_color "255 160 0"
cl_cross_dot_alpha "150" cl_cross_dot_alpha "255"
cl_cross_dot_color "" cl_cross_dot_color ""
cl_cross_dot_outline "0.000000" cl_cross_dot_outline "0.75"
cl_cross_dot_outline_alpha "128" cl_cross_dot_outline_alpha "128"
cl_cross_dot_size "2" cl_cross_dot_size "2"
cl_cross_gap "25" cl_cross_gap "25"