diff --git a/src/shared/w_ak47.qc b/src/shared/w_ak47.qc index 69a8582..75a7df5 100644 --- a/src/shared/w_ak47.qc +++ b/src/shared/w_ak47.qc @@ -180,6 +180,21 @@ w_ak47_reload(void) pl.w_idle_next = pl.w_attack_next; } +void +w_ak47_release(void) +{ + player pl = (player)self; + + w_cstrike_weaponrelease(); + + /* auto-reload if need be */ + if (pl.w_attack_next <= 0.0) + if (pl.ak47_mag == 0 && pl.ammo_762mm > 0) { + Weapons_Reload(); + return; + } +} + float w_ak47_aimanim(void) { @@ -220,7 +235,7 @@ w_ak47_hudpic(int selected, vector pos, float a) [0,0], [170/256,45/256], hud_col, - 1.0f, + a, DRAWFLAG_ADDITIVE ); } else { @@ -231,7 +246,7 @@ w_ak47_hudpic(int selected, vector pos, float a) [0,0], [170/256,45/256], hud_col, - 1.0f, + a, DRAWFLAG_ADDITIVE ); } @@ -250,7 +265,7 @@ weapon_t w_ak47 = .primary = w_ak47_primary, .secondary = __NULL__, .reload = w_ak47_reload, - .release = w_cstrike_weaponrelease, + .release = w_ak47_release, .crosshair = w_ak47_hud, .precache = w_ak47_precache, .pickup = w_ak47_pickup, diff --git a/src/shared/w_aug.qc b/src/shared/w_aug.qc index cc5ce23..d469a70 100644 --- a/src/shared/w_aug.qc +++ b/src/shared/w_aug.qc @@ -200,6 +200,21 @@ w_aug_reload(void) pl.w_idle_next = pl.w_attack_next; } +void +w_aug_release(void) +{ + player pl = (player)self; + + w_cstrike_weaponrelease(); + + /* auto-reload if need be */ + if (pl.w_attack_next <= 0.0) + if (pl.aug_mag == 0 && pl.ammo_762mm > 0) { + Weapons_Reload(); + return; + } +} + float w_aug_aimanim(void) { @@ -245,7 +260,7 @@ w_aug_hudpic(int selected, vector pos, float a) [0,45/256], [170/256,45/256], hud_col, - 1.0f, + a, DRAWFLAG_ADDITIVE ); } else { @@ -256,7 +271,7 @@ w_aug_hudpic(int selected, vector pos, float a) [0,45/256], [170/256,45/256], hud_col, - 1.0f, + a, DRAWFLAG_ADDITIVE ); } @@ -275,7 +290,7 @@ weapon_t w_aug = .primary = w_aug_primary, .secondary = w_aug_secondary, .reload = w_aug_reload, - .release = w_cstrike_weaponrelease, + .release = w_aug_release, .crosshair = w_aug_hud, .precache = w_aug_precache, .pickup = w_aug_pickup, diff --git a/src/shared/w_awp.qc b/src/shared/w_awp.qc index 475b47a..b0a2401 100644 --- a/src/shared/w_awp.qc +++ b/src/shared/w_awp.qc @@ -116,6 +116,13 @@ w_awp_release(void) w_cstrike_weaponrelease(); + /* auto-reload if need be */ + if (pl.w_attack_next <= 0.0) + if (pl.awp_mag == 0 && pl.ammo_338mag > 0) { + Weapons_Reload(); + return; + } + if (pl.w_idle_next > 0.0f) { pl.viewzoom = 1.0f; return; @@ -272,7 +279,7 @@ w_awp_hudpic(int selected, vector pos, float a) [0,135/256], [170/256,45/256], hud_col, - 1.0f, + a, DRAWFLAG_ADDITIVE ); } else { @@ -283,7 +290,7 @@ w_awp_hudpic(int selected, vector pos, float a) [0,135/256], [170/256,45/256], hud_col, - 1.0f, + a, DRAWFLAG_ADDITIVE ); } diff --git a/src/shared/w_c4bomb.qc b/src/shared/w_c4bomb.qc index b1d9cda..703eafc 100644 --- a/src/shared/w_c4bomb.qc +++ b/src/shared/w_c4bomb.qc @@ -107,6 +107,8 @@ void w_c4bomb_release(void) { player pl = (player)self; + + w_cstrike_weaponrelease(); if (pl.mode_temp == C4S_DROPPING) { if (pl.w_idle_next <= 0.0f) { @@ -190,7 +192,7 @@ w_c4bomb_hudpic(int selected, vector pos, float a) [0,0], [170/256,45/256], g_hud_color, - 1.0f, + a, DRAWFLAG_ADDITIVE ); } else { @@ -201,7 +203,7 @@ w_c4bomb_hudpic(int selected, vector pos, float a) [0,0], [170/256,45/256], g_hud_color, - 1.0f, + a, DRAWFLAG_ADDITIVE ); } diff --git a/src/shared/w_deagle.qc b/src/shared/w_deagle.qc index d0b720f..e64545e 100644 --- a/src/shared/w_deagle.qc +++ b/src/shared/w_deagle.qc @@ -185,6 +185,21 @@ w_deagle_reload(void) pl.w_idle_next = pl.w_attack_next; } +void +w_deagle_release(void) +{ + player pl = (player)self; + + w_cstrike_weaponrelease(); + + /* auto-reload if need be */ + if (pl.w_attack_next <= 0.0) + if (pl.deagle_mag == 0 && pl.ammo_50ae > 0) { + Weapons_Reload(); + return; + } +} + float w_deagle_aimanim(void) { @@ -225,7 +240,7 @@ w_deagle_hudpic(int selected, vector pos, float a) [0,90/256], [170/256,45/256], hud_col, - 1.0f, + a, DRAWFLAG_ADDITIVE ); } else { @@ -236,7 +251,7 @@ w_deagle_hudpic(int selected, vector pos, float a) [0,90/256], [170/256,45/256], hud_col, - 1.0f, + a, DRAWFLAG_ADDITIVE ); } @@ -255,7 +270,7 @@ weapon_t w_deagle = .primary = w_deagle_primary, .secondary = __NULL__, .reload = w_deagle_reload, - .release = w_cstrike_weaponrelease, + .release = w_deagle_release, .crosshair = w_deagle_hud, .precache = w_deagle_precache, .pickup = w_deagle_pickup, diff --git a/src/shared/w_elites.qc b/src/shared/w_elites.qc index f4cadda..afcbd1a 100644 --- a/src/shared/w_elites.qc +++ b/src/shared/w_elites.qc @@ -237,6 +237,21 @@ w_elites_reload(void) pl.w_idle_next = pl.w_attack_next; } +void +w_elites_release(void) +{ + player pl = (player)self; + + w_cstrike_weaponrelease(); + + /* auto-reload if need be */ + if (pl.w_attack_next <= 0.0) + if (pl.elites_mag == 0 && pl.ammo_9mm > 0) { + Weapons_Reload(); + return; + } +} + float w_elites_aimanim(void) { @@ -277,7 +292,7 @@ w_elites_hudpic(int selected, vector pos, float a) [0,90/256], [170/256,45/256], hud_col, - 1.0f, + a, DRAWFLAG_ADDITIVE ); } else { @@ -288,7 +303,7 @@ w_elites_hudpic(int selected, vector pos, float a) [0,90/256], [170/256,45/256], hud_col, - 1.0f, + a, DRAWFLAG_ADDITIVE ); } @@ -307,7 +322,7 @@ weapon_t w_elites = .primary = w_elites_primary, .secondary = __NULL__, .reload = w_elites_reload, - .release = w_cstrike_weaponrelease, + .release = w_elites_release, .crosshair = w_elites_hud, .precache = w_elites_precache, .pickup = w_elites_pickup, diff --git a/src/shared/w_fiveseven.qc b/src/shared/w_fiveseven.qc index a0cc0a1..9d65851 100644 --- a/src/shared/w_fiveseven.qc +++ b/src/shared/w_fiveseven.qc @@ -185,6 +185,21 @@ w_fiveseven_reload(void) pl.w_idle_next = pl.w_attack_next; } +void +w_fiveseven_release(void) +{ + player pl = (player)self; + + w_cstrike_weaponrelease(); + + /* auto-reload if need be */ + if (pl.w_attack_next <= 0.0) + if (pl.fiveseven_mag == 0 && pl.ammo_57mm > 0) { + Weapons_Reload(); + return; + } +} + float w_fiveseven_aimanim(void) { @@ -225,7 +240,7 @@ w_fiveseven_hudpic(int selected, vector pos, float a) [0,135/256], [170/256,45/256], hud_col, - 1.0f, + a, DRAWFLAG_ADDITIVE ); } else { @@ -236,7 +251,7 @@ w_fiveseven_hudpic(int selected, vector pos, float a) [0,135/256], [170/256,45/256], hud_col, - 1.0f, + a, DRAWFLAG_ADDITIVE ); } @@ -255,7 +270,7 @@ weapon_t w_fiveseven = .primary = w_fiveseven_primary, .secondary = __NULL__, .reload = w_fiveseven_reload, - .release = w_cstrike_weaponrelease, + .release = w_fiveseven_release, .crosshair = w_fiveseven_hud, .precache = w_fiveseven_precache, .pickup = w_fiveseven_pickup, diff --git a/src/shared/w_flashbang.qc b/src/shared/w_flashbang.qc index 6734d1e..47d712e 100644 --- a/src/shared/w_flashbang.qc +++ b/src/shared/w_flashbang.qc @@ -179,6 +179,8 @@ void w_flashbang_release(void) { player pl = (player)self; + + w_cstrike_weaponrelease(); if (pl.w_idle_next > 0.0) { return; @@ -241,7 +243,7 @@ w_flashbang_hudpic(int selected, vector pos, float a) [0,90/256], [170/256,45/256], g_hud_color, - 1.0f, + a, DRAWFLAG_ADDITIVE ); } else { @@ -252,7 +254,7 @@ w_flashbang_hudpic(int selected, vector pos, float a) [0,90/256], [170/256,45/256], g_hud_color, - 1.0f, + a, DRAWFLAG_ADDITIVE ); } diff --git a/src/shared/w_g3sg1.qc b/src/shared/w_g3sg1.qc index a0688bc..78c6868 100644 --- a/src/shared/w_g3sg1.qc +++ b/src/shared/w_g3sg1.qc @@ -194,6 +194,21 @@ w_g3sg1_reload(void) pl.w_idle_next = pl.w_attack_next; } +void +w_g3sg1_release(void) +{ + player pl = (player)self; + + w_cstrike_weaponrelease(); + + /* auto-reload if need be */ + if (pl.w_attack_next <= 0.0) + if (pl.g3sg1_mag == 0 && pl.ammo_762mm > 0) { + Weapons_Reload(); + return; + } +} + float w_g3sg1_aimanim(void) { @@ -237,7 +252,7 @@ w_g3sg1_hudpic(int selected, vector pos, float a) [0,180/256], [170/256,45/256], hud_col, - 1.0f, + a, DRAWFLAG_ADDITIVE ); } else { @@ -248,7 +263,7 @@ w_g3sg1_hudpic(int selected, vector pos, float a) [0,180/256], [170/256,45/256], hud_col, - 1.0f, + a, DRAWFLAG_ADDITIVE ); } @@ -267,7 +282,7 @@ weapon_t w_g3sg1 = .primary = w_g3sg1_primary, .secondary = w_g3sg1_secondary, .reload = w_g3sg1_reload, - .release = w_cstrike_weaponrelease, + .release = w_g3sg1_release, .crosshair = w_g3sg1_hud, .precache = w_g3sg1_precache, .pickup = w_g3sg1_pickup, diff --git a/src/shared/w_glock18.qc b/src/shared/w_glock18.qc index 07de738..970f42b 100644 --- a/src/shared/w_glock18.qc +++ b/src/shared/w_glock18.qc @@ -141,17 +141,27 @@ w_glock18_primary(void) return; } - Cstrike_ShotMultiplierAdd(pl, 1); - float accuracy = Cstrike_CalculateAccuracy(pl, 200); - pl.glock18_mag--; + int shotcount = (pl.mode_glock18) ? 3 : 1; + + /* fix shotcount if we're < 3 in burst mode */ + if (pl.glock18_mag < 3 && pl.mode_glock18) + shotcount = pl.glock18_mag; + + for (int i = 0; i < shotcount; i ++) { + Cstrike_ShotMultiplierAdd(pl, 1); + float accuracy = Cstrike_CalculateAccuracy(pl, (pl.mode_glock18) ? 175 : 200); + pl.glock18_mag--; +#ifdef SERVER + TraceAttack_SetPenetrationPower(0); + TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 25, [accuracy,accuracy], WEAPON_GLOCK18); +#endif + } #ifdef CLIENT View_SetMuzzleflash(MUZZLE_RIFLE); #else - TraceAttack_SetPenetrationPower(0); - TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 25, [accuracy,accuracy], WEAPON_GLOCK18); - if (self.flags & FL_CROUCHING) + if (pl.flags & FL_CROUCHING) Animation_PlayerTopTemp(ANIM_SHOOT_ONEHAND, 0.45f); else Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_ONEHAND, 0.45f); @@ -245,6 +255,21 @@ w_glock18_reload(void) pl.w_idle_next = pl.w_attack_next; } +void +w_glock18_release(void) +{ + player pl = (player)self; + + w_cstrike_weaponrelease(); + + /* auto-reload if need be */ + if (pl.w_attack_next <= 0.0) + if (pl.glock18_mag == 0 && pl.ammo_9mm > 0) { + Weapons_Reload(); + return; + } +} + float w_glock18_aimanim(void) { @@ -285,7 +310,7 @@ w_glock18_hudpic(int selected, vector pos, float a) [0,45/256], [170/256,45/256], hud_col, - 1.0f, + a, DRAWFLAG_ADDITIVE ); } else { @@ -296,7 +321,7 @@ w_glock18_hudpic(int selected, vector pos, float a) [0,45/256], [170/256,45/256], hud_col, - 1.0f, + a, DRAWFLAG_ADDITIVE ); } @@ -315,7 +340,7 @@ weapon_t w_glock18 = .primary = w_glock18_primary, .secondary = w_glock18_secondary, .reload = w_glock18_reload, - .release = w_cstrike_weaponrelease, + .release = w_glock18_release, .crosshair = w_glock18_hud, .precache = w_glock18_precache, .pickup = w_glock18_pickup, diff --git a/src/shared/w_hegrenade.qc b/src/shared/w_hegrenade.qc index 3340a30..5c651e1 100644 --- a/src/shared/w_hegrenade.qc +++ b/src/shared/w_hegrenade.qc @@ -166,15 +166,9 @@ w_hegrenade_primary(void) } /* Ammo check */ -#ifdef CLIENT if (pl.ammo_hegrenade <= 0) { return; } -#else - if (pl.ammo_hegrenade <= 0) { - return; - } -#endif Weapons_ViewAnimation(HEGRENADE_PULLPIN); @@ -187,17 +181,18 @@ void w_hegrenade_release(void) { player pl = (player)self; + + w_cstrike_weaponrelease(); if (pl.w_idle_next > 0.0) { return; } if (pl.mode_temp == 1) { -#ifdef CLIENT pl.ammo_hegrenade--; +#ifdef CLIENT Weapons_ViewAnimation(HEGRENADE_THROW); #else - pl.ammo_hegrenade--; w_hegrenade_throw(); #endif pl.mode_temp = 2; @@ -250,7 +245,7 @@ w_hegrenade_hudpic(int selected, vector pos, float a) [0,45/256], [170/256,45/256], g_hud_color, - 1.0f, + a, DRAWFLAG_ADDITIVE ); } else { @@ -261,7 +256,7 @@ w_hegrenade_hudpic(int selected, vector pos, float a) [0,45/256], [170/256,45/256], g_hud_color, - 1.0f, + a, DRAWFLAG_ADDITIVE ); } diff --git a/src/shared/w_knife.qc b/src/shared/w_knife.qc index ad8547c..62ddb3b 100644 --- a/src/shared/w_knife.qc +++ b/src/shared/w_knife.qc @@ -192,7 +192,7 @@ w_knife_hudpic(int selected, vector pos, float a) [0,135/256], [170/256,45/256], g_hud_color, - 1.0f, + a, DRAWFLAG_ADDITIVE ); } else { @@ -203,7 +203,7 @@ w_knife_hudpic(int selected, vector pos, float a) [0,135/256], [170/256,45/256], g_hud_color, - 1.0f, + a, DRAWFLAG_ADDITIVE ); } diff --git a/src/shared/w_m3.qc b/src/shared/w_m3.qc index f728555..4f32215 100644 --- a/src/shared/w_m3.qc +++ b/src/shared/w_m3.qc @@ -126,26 +126,19 @@ w_m3_primary(void) return; } -#ifdef CLIENT if (!pl.m3_mag) { return; } -#else - if (!pl.m3_mag) { - return; - } -#endif Cstrike_ShotMultiplierAdd(pl, 9); float accuracy = Cstrike_CalculateAccuracy(pl, 200); + pl.m3_mag--; #ifdef CLIENT - pl.m3_mag--; View_SetMuzzleflash(MUZZLE_RIFLE); #else TraceAttack_SetPenetrationPower(0); TraceAttack_FireBullets(9, pl.origin + pl.view_ofs, 26, [accuracy,accuracy], WEAPON_M3); - pl.m3_mag--; if (self.flags & FL_CROUCHING) Animation_PlayerTopTemp(ANIM_SHOOT_SHOTGUN, 0.45f); @@ -173,21 +166,13 @@ void w_m3_reload(void) { player pl = (player)self; -#ifdef CLIENT - if (pl.m3_mag >= 8) { - return; - } - if (pl.ammo_buckshot <= 0) { - return; - } -#else + if (pl.m3_mag >= 8) { return; } if (pl.ammo_buckshot <= 0) { return; } -#endif if (pl.mode_temp > M3S_IDLE) { return; @@ -203,6 +188,13 @@ w_m3_release(void) w_cstrike_weaponrelease(); + /* auto-reload if need be */ + if (pl.w_attack_next <= 0.0) + if (pl.mode_temp == M3S_IDLE && pl.m3_mag == 0 && pl.ammo_buckshot > 0) { + Weapons_Reload(); + return; + } + if (pl.w_idle_next > 0.0) { return; } @@ -213,21 +205,15 @@ w_m3_release(void) pl.w_idle_next = 0.65f; } else if (pl.mode_temp == M3S_RELOAD) { Weapons_ViewAnimation(M3_INSERT); -#ifdef CLIENT - pl.m3_mag++; - pl.ammo_buckshot--; - - if (pl.ammo_buckshot <= 0 || pl.m3_mag >= 8) { - pl.mode_temp = M3S_RELOAD_END; - } -#else pl.m3_mag++; pl.ammo_buckshot--; w_m3_updateammo(pl); +#ifdef SERVER + //Sound_Play(pl, CHAN_WEAPON, "weapon_m3.insertshell"); +#endif if (pl.ammo_buckshot <= 0 || pl.m3_mag >= 8) { pl.mode_temp = M3S_RELOAD_END; } -#endif pl.w_idle_next = 0.5f; } else if (pl.mode_temp == M3S_RELOAD_END) { Weapons_ViewAnimation(M3_RELOAD_END); @@ -277,7 +263,7 @@ w_m3_hudpic(int selected, vector pos, float a) [0,135/256], [170/256,45/256], hud_col, - 1.0f, + a, DRAWFLAG_ADDITIVE ); } else { @@ -288,7 +274,7 @@ w_m3_hudpic(int selected, vector pos, float a) [0,135/256], [170/256,45/256], hud_col, - 1.0f, + a, DRAWFLAG_ADDITIVE ); } diff --git a/src/shared/w_m4a1.qc b/src/shared/w_m4a1.qc index eba8354..7c02186 100644 --- a/src/shared/w_m4a1.qc +++ b/src/shared/w_m4a1.qc @@ -272,6 +272,13 @@ w_m4a1_release(void) w_cstrike_weaponrelease(); + /* auto-reload if need be */ + if (pl.w_attack_next <= 0.0) + if (pl.m4a1_mag == 0 && pl.ammo_556mm > 0) { + Weapons_Reload(); + return; + } + if (pl.w_idle_next > 0.0) { return; } @@ -306,7 +313,7 @@ w_m4a1_hudpic(int selected, vector pos, float a) [0,45/256], [170/256,45/256], hud_col, - 1.0f, + a, DRAWFLAG_ADDITIVE ); } else { @@ -317,7 +324,7 @@ w_m4a1_hudpic(int selected, vector pos, float a) [0,45/256], [170/256,45/256], hud_col, - 1.0f, + a, DRAWFLAG_ADDITIVE ); } diff --git a/src/shared/w_mac10.qc b/src/shared/w_mac10.qc index 6c75472..b0134a1 100644 --- a/src/shared/w_mac10.qc +++ b/src/shared/w_mac10.qc @@ -180,6 +180,21 @@ w_mac10_reload(void) pl.w_idle_next = pl.w_attack_next; } +void +w_mac10_release(void) +{ + player pl = (player)self; + + w_cstrike_weaponrelease(); + + /* auto-reload if need be */ + if (pl.w_attack_next <= 0.0) + if (pl.mac10_mag == 0 && pl.ammo_45acp > 0) { + Weapons_Reload(); + return; + } +} + float w_mac10_aimanim(void) { @@ -220,7 +235,7 @@ w_mac10_hudpic(int selected, vector pos, float a) [0,0], [170/256,45/256], hud_col, - 1.0f, + a, DRAWFLAG_ADDITIVE ); } else { @@ -231,7 +246,7 @@ w_mac10_hudpic(int selected, vector pos, float a) [0,0], [170/256,45/256], hud_col, - 1.0f, + a, DRAWFLAG_ADDITIVE ); } @@ -250,7 +265,7 @@ weapon_t w_mac10 = .primary = w_mac10_primary, .secondary = __NULL__, .reload = w_mac10_reload, - .release = w_cstrike_weaponrelease, + .release = w_mac10_release, .crosshair = w_mac10_hud, .precache = w_mac10_precache, .pickup = w_mac10_pickup, diff --git a/src/shared/w_mp5.qc b/src/shared/w_mp5.qc index c585234..1d4c563 100644 --- a/src/shared/w_mp5.qc +++ b/src/shared/w_mp5.qc @@ -180,6 +180,21 @@ w_mp5_reload(void) pl.w_idle_next = pl.w_attack_next; } +void +w_mp5_release(void) +{ + player pl = (player)self; + + w_cstrike_weaponrelease(); + + /* auto-reload if need be */ + if (pl.w_attack_next <= 0.0) + if (pl.mp5_mag == 0 && pl.ammo_9mm > 0) { + Weapons_Reload(); + return; + } +} + float w_mp5_aimanim(void) { @@ -220,7 +235,7 @@ w_mp5_hudpic(int selected, vector pos, float a) [0,180/256], [170/256,45/256], hud_col, - 1.0f, + a, DRAWFLAG_ADDITIVE ); } else { @@ -231,7 +246,7 @@ w_mp5_hudpic(int selected, vector pos, float a) [0,180/256], [170/256,45/256], hud_col, - 1.0f, + a, DRAWFLAG_ADDITIVE ); } @@ -250,7 +265,7 @@ weapon_t w_mp5 = .primary = w_mp5_primary, .secondary = __NULL__, .reload = w_mp5_reload, - .release = w_cstrike_weaponrelease, + .release = w_mp5_release, .crosshair = w_mp5_hud, .precache = w_mp5_precache, .pickup = w_mp5_pickup, diff --git a/src/shared/w_p228.qc b/src/shared/w_p228.qc index 50ca274..f5b6daf 100644 --- a/src/shared/w_p228.qc +++ b/src/shared/w_p228.qc @@ -189,6 +189,21 @@ w_p228_reload(void) pl.w_idle_next = pl.w_attack_next; } +void +w_p228_release(void) +{ + player pl = (player)self; + + w_cstrike_weaponrelease(); + + /* auto-reload if need be */ + if (pl.w_attack_next <= 0.0) + if (pl.p228_mag == 0 && pl.ammo_357sig > 0) { + Weapons_Reload(); + return; + } +} + float w_p228_aimanim(void) { @@ -229,7 +244,7 @@ w_p228_hudpic(int selected, vector pos, float a) [0,90/256], [170/256,45/256], hud_col, - 1.0f, + a, DRAWFLAG_ADDITIVE ); } else { @@ -240,7 +255,7 @@ w_p228_hudpic(int selected, vector pos, float a) [0,90/256], [170/256,45/256], hud_col, - 1.0f, + a, DRAWFLAG_ADDITIVE ); } @@ -259,7 +274,7 @@ weapon_t w_p228 = .primary = w_p228_primary, .secondary = __NULL__, .reload = w_p228_reload, - .release = w_cstrike_weaponrelease, + .release = w_p228_release, .crosshair = w_p228_hud, .precache = w_p228_precache, .pickup = w_p228_pickup, diff --git a/src/shared/w_p90.qc b/src/shared/w_p90.qc index 99bd687..4ffb710 100644 --- a/src/shared/w_p90.qc +++ b/src/shared/w_p90.qc @@ -180,6 +180,21 @@ w_p90_reload(void) pl.w_idle_next = pl.w_attack_next; } +void +w_p90_release(void) +{ + player pl = (player)self; + + w_cstrike_weaponrelease(); + + /* auto-reload if need be */ + if (pl.w_attack_next <= 0.0) + if (pl.p90_mag == 0 && pl.ammo_57mm > 0) { + Weapons_Reload(); + return; + } +} + float w_p90_aimanim(void) { @@ -220,7 +235,7 @@ w_p90_hudpic(int selected, vector pos, float a) [0,0], [170/256,45/256], hud_col, - 1.0f, + a, DRAWFLAG_ADDITIVE ); } else { @@ -231,7 +246,7 @@ w_p90_hudpic(int selected, vector pos, float a) [0,0], [170/256,45/256], hud_col, - 1.0f, + a, DRAWFLAG_ADDITIVE ); } @@ -250,7 +265,7 @@ weapon_t w_p90 = .primary = w_p90_primary, .secondary = __NULL__, .reload = w_p90_reload, - .release = w_cstrike_weaponrelease, + .release = w_p90_release, .crosshair = w_p90_hud, .precache = w_p90_precache, .pickup = w_p90_pickup, diff --git a/src/shared/w_para.qc b/src/shared/w_para.qc index b943594..cfe67db 100644 --- a/src/shared/w_para.qc +++ b/src/shared/w_para.qc @@ -176,6 +176,21 @@ w_para_reload(void) pl.w_idle_next = pl.w_attack_next; } +void +w_para_release(void) +{ + player pl = (player)self; + + w_cstrike_weaponrelease(); + + /* auto-reload if need be */ + if (pl.w_attack_next <= 0.0) + if (pl.para_mag == 0 && pl.ammo_556mmbox > 0) { + Weapons_Reload(); + return; + } +} + float w_para_aimanim(void) { @@ -216,7 +231,7 @@ w_para_hudpic(int selected, vector pos, float a) [0,0], [170/256,45/256], hud_col, - 1.0f, + a, DRAWFLAG_ADDITIVE ); } else { @@ -227,7 +242,7 @@ w_para_hudpic(int selected, vector pos, float a) [0,0], [170/256,45/256], hud_col, - 1.0f, + a, DRAWFLAG_ADDITIVE ); } @@ -246,7 +261,7 @@ weapon_t w_para = .primary = w_para_primary, .secondary = __NULL__, .reload = w_para_reload, - .release = w_cstrike_weaponrelease, + .release = w_para_release, .crosshair = w_para_hud, .precache = w_para_precache, .pickup = w_para_pickup, diff --git a/src/shared/w_scout.qc b/src/shared/w_scout.qc index e98e69d..dac8a93 100644 --- a/src/shared/w_scout.qc +++ b/src/shared/w_scout.qc @@ -115,6 +115,13 @@ w_scout_release(void) w_cstrike_weaponrelease(); + /* auto-reload if need be */ + if (pl.w_attack_next <= 0.0) + if (pl.scout_mag == 0 && pl.ammo_762mm > 0) { + Weapons_Reload(); + return; + } + if (pl.w_idle_next > 0.0f) { pl.viewzoom = 1.0f; return; @@ -269,7 +276,7 @@ w_scout_hudpic(int selected, vector pos, float a) [0,45/256], [170/256,45/256], hud_col, - 1.0f, + a, DRAWFLAG_ADDITIVE ); } else { @@ -280,7 +287,7 @@ w_scout_hudpic(int selected, vector pos, float a) [0,45/256], [170/256,45/256], hud_col, - 1.0f, + a, DRAWFLAG_ADDITIVE ); } diff --git a/src/shared/w_sg550.qc b/src/shared/w_sg550.qc index ffd912b..fe50794 100644 --- a/src/shared/w_sg550.qc +++ b/src/shared/w_sg550.qc @@ -194,6 +194,21 @@ w_sg550_reload(void) pl.w_idle_next = pl.w_attack_next; } +void +w_sg550_release(void) +{ + player pl = (player)self; + + w_cstrike_weaponrelease(); + + /* auto-reload if need be */ + if (pl.w_attack_next <= 0.0) + if (pl.sg550_mag == 0 && pl.ammo_556mm > 0) { + Weapons_Reload(); + return; + } +} + float w_sg550_aimanim(void) { @@ -237,7 +252,7 @@ w_sg550_hudpic(int selected, vector pos, float a) [0,180/256], [170/256,45/256], hud_col, - 1.0f, + a, DRAWFLAG_ADDITIVE ); } else { @@ -248,7 +263,7 @@ w_sg550_hudpic(int selected, vector pos, float a) [0,180/256], [170/256,45/256], hud_col, - 1.0f, + a, DRAWFLAG_ADDITIVE ); } diff --git a/src/shared/w_sg552.qc b/src/shared/w_sg552.qc index 34d29eb..1034e8d 100644 --- a/src/shared/w_sg552.qc +++ b/src/shared/w_sg552.qc @@ -200,6 +200,21 @@ w_sg552_reload(void) pl.w_idle_next = pl.w_attack_next; } +void +w_sg552_release(void) +{ + player pl = (player)self; + + w_cstrike_weaponrelease(); + + /* auto-reload if need be */ + if (pl.w_attack_next <= 0.0) + if (pl.sg552_mag == 0 && pl.ammo_556mm > 0) { + Weapons_Reload(); + return; + } +} + float w_sg552_aimanim(void) { @@ -245,7 +260,7 @@ w_sg552_hudpic(int selected, vector pos, float a) [0,45/256], [170/256,45/256], hud_col, - 1.0f, + a, DRAWFLAG_ADDITIVE ); } else { @@ -256,7 +271,7 @@ w_sg552_hudpic(int selected, vector pos, float a) [0,45/256], [170/256,45/256], hud_col, - 1.0f, + a, DRAWFLAG_ADDITIVE ); } diff --git a/src/shared/w_smokegrenade.qc b/src/shared/w_smokegrenade.qc index 1adfef8..bcdb701 100644 --- a/src/shared/w_smokegrenade.qc +++ b/src/shared/w_smokegrenade.qc @@ -164,15 +164,9 @@ w_smokegrenade_primary(void) } /* Ammo check */ -#ifdef CLIENT if (pl.ammo_smokegrenade <= 0) { return; } -#else - if (pl.ammo_smokegrenade <= 0) { - return; - } -#endif Weapons_ViewAnimation(SMOKEGRENADE_PULLPIN); pl.mode_temp = 1; @@ -184,17 +178,18 @@ void w_smokegrenade_release(void) { player pl = (player)self; + + w_cstrike_weaponrelease(); if (pl.w_idle_next > 0.0) { return; } if (pl.mode_temp == 1) { -#ifdef CLIENT pl.ammo_smokegrenade--; +#ifdef CLIENT Weapons_ViewAnimation(SMOKEGRENADE_THROW); #else - pl.ammo_smokegrenade--; w_smokegrenade_throw(); #endif pl.mode_temp = 2; @@ -246,7 +241,7 @@ w_smokegrenade_hudpic(int selected, vector pos, float a) [0,135/256], [170/256,45/256], g_hud_color, - 1.0f, + a, DRAWFLAG_ADDITIVE ); } else { @@ -257,7 +252,7 @@ w_smokegrenade_hudpic(int selected, vector pos, float a) [0,135/256], [170/256,45/256], g_hud_color, - 1.0f, + a, DRAWFLAG_ADDITIVE ); } diff --git a/src/shared/w_tmp.qc b/src/shared/w_tmp.qc index dafd11b..f55d6e2 100644 --- a/src/shared/w_tmp.qc +++ b/src/shared/w_tmp.qc @@ -182,6 +182,21 @@ w_tmp_reload(void) pl.w_idle_next = pl.w_attack_next; } +void +w_tmp_release(void) +{ + player pl = (player)self; + + w_cstrike_weaponrelease(); + + /* auto-reload if need be */ + if (pl.w_attack_next <= 0.0) + if (pl.tmp_mag == 0 && pl.ammo_9mm > 0) { + Weapons_Reload(); + return; + } +} + float w_tmp_aimanim(void) { @@ -222,7 +237,7 @@ w_tmp_hudpic(int selected, vector pos, float a) [0,0], [170/256,45/256], hud_col, - 1.0f, + a, DRAWFLAG_ADDITIVE ); } else { @@ -233,7 +248,7 @@ w_tmp_hudpic(int selected, vector pos, float a) [0,0], [170/256,45/256], hud_col, - 1.0f, + a, DRAWFLAG_ADDITIVE ); } diff --git a/src/shared/w_ump45.qc b/src/shared/w_ump45.qc index faf3060..aa4488b 100644 --- a/src/shared/w_ump45.qc +++ b/src/shared/w_ump45.qc @@ -117,26 +117,19 @@ w_ump45_primary(void) } /* ammo check */ -#ifdef CLIENT if (!pl.ump45_mag) { return; } -#else - if (!pl.ump45_mag) { - return; - } -#endif Cstrike_ShotMultiplierAdd(pl, 1); float accuracy = Cstrike_CalculateAccuracy(pl, 210); + pl.ump45_mag--; #ifdef CLIENT - pl.ump45_mag--; View_SetMuzzleflash(MUZZLE_RIFLE); #else TraceAttack_SetPenetrationPower(0); TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 30, [accuracy,accuracy], WEAPON_UMP45); - pl.ump45_mag--; if (self.flags & FL_CROUCHING) Animation_PlayerTopTemp(ANIM_SHOOT_MP5, 0.45f); @@ -171,31 +164,39 @@ w_ump45_reload(void) if (pl.w_attack_next > 0.0) { return; } + if (pl.ump45_mag >= 25) { + return; + } + if (!pl.ammo_45acp) { + return; + } #ifdef CLIENT - if (pl.ump45_mag >= 25) { - return; - } - if (!pl.ammo_45acp) { - return; - } + Weapons_ViewAnimation(UMP45_RELOAD); #else - if (pl.ump45_mag >= 25) { - return; - } - if (!pl.ammo_45acp) { - return; - } - Weapons_ReloadWeapon(pl, player::ump45_mag, player::ammo_45acp, 25); Weapons_UpdateAmmo(pl, pl.ump45_mag, pl.ammo_45acp, -1); #endif - Weapons_ViewAnimation(UMP45_RELOAD); pl.w_attack_next = 3.5f; pl.w_idle_next = pl.w_attack_next; } +void +w_ump45_release(void) +{ + player pl = (player)self; + + w_cstrike_weaponrelease(); + + /* auto-reload if need be */ + if (pl.w_attack_next <= 0.0) + if (pl.ump45_mag == 0 && pl.ammo_45acp > 0) { + Weapons_Reload(); + return; + } +} + float w_ump45_aimanim(void) { @@ -236,7 +237,7 @@ w_ump45_hudpic(int selected, vector pos, float a) [0,0], [170/256,45/256], hud_col, - 1.0f, + a, DRAWFLAG_ADDITIVE ); } else { @@ -247,7 +248,7 @@ w_ump45_hudpic(int selected, vector pos, float a) [0,0], [170/256,45/256], hud_col, - 1.0f, + a, DRAWFLAG_ADDITIVE ); } @@ -266,7 +267,7 @@ weapon_t w_ump45 = .primary = w_ump45_primary, .secondary = __NULL__, .reload = w_ump45_reload, - .release = w_cstrike_weaponrelease, + .release = w_ump45_release, .crosshair = w_ump45_hud, .precache = w_ump45_precache, .pickup = w_ump45_pickup, diff --git a/src/shared/w_usp45.qc b/src/shared/w_usp45.qc index 3f98c30..04841df 100644 --- a/src/shared/w_usp45.qc +++ b/src/shared/w_usp45.qc @@ -263,6 +263,21 @@ w_usp45_reload(void) pl.w_attack_next = 2.5f; } +void +w_usp45_release(void) +{ + player pl = (player)self; + + w_cstrike_weaponrelease(); + + /* auto-reload if need be */ + if (pl.w_attack_next <= 0.0) + if (pl.usp45_mag == 0 && pl.ammo_45acp > 0) { + Weapons_Reload(); + return; + } +} + float w_usp45_aimanim(void) { @@ -303,7 +318,7 @@ w_usp45_hudpic(int selected, vector pos, float a) [0,90/256], [170/256,45/256], hud_col, - 1.0f, + a, DRAWFLAG_ADDITIVE ); } else { @@ -314,7 +329,7 @@ w_usp45_hudpic(int selected, vector pos, float a) [0,90/256], [170/256,45/256], hud_col, - 1.0f, + a, DRAWFLAG_ADDITIVE ); } @@ -333,7 +348,7 @@ weapon_t w_usp45 = .primary = w_usp45_primary, .secondary = w_usp45_secondary, .reload = w_usp45_reload, - .release = w_cstrike_weaponrelease, + .release = w_usp45_release, .crosshair = w_usp45_hud, .precache = w_usp45_precache, .pickup = w_usp45_pickup, diff --git a/src/shared/w_xm1014.qc b/src/shared/w_xm1014.qc index 7f19f18..8be01de 100644 --- a/src/shared/w_xm1014.qc +++ b/src/shared/w_xm1014.qc @@ -128,26 +128,19 @@ w_xm1014_primary(void) } /* ammo check */ -#ifdef CLIENT if (!pl.xm1014_mag) { return; } -#else - if (!pl.xm1014_mag) { - return; - } -#endif Cstrike_ShotMultiplierAdd(pl, 6); float accuracy = Cstrike_CalculateAccuracy(pl, 200); + pl.xm1014_mag--; #ifdef CLIENT - pl.xm1014_mag--; View_SetMuzzleflash(MUZZLE_RIFLE); #else TraceAttack_SetPenetrationPower(0); TraceAttack_FireBullets(6, pl.origin + pl.view_ofs, 22, [accuracy,accuracy], WEAPON_XM1014); - pl.xm1014_mag--; if (self.flags & FL_CROUCHING) Animation_PlayerTopTemp(ANIM_SHOOT_SHOTGUN, 0.45f); @@ -175,21 +168,13 @@ void w_xm1014_reload(void) { player pl = (player)self; -#ifdef CLIENT - if (pl.xm1014_mag >= 7) { - return; - } - if (pl.ammo_buckshot <= 0) { - return; - } -#else + if (pl.xm1014_mag >= 7) { return; } if (pl.ammo_buckshot <= 0) { return; } -#endif if (pl.mode_temp > XM1014S_IDLE) { return; @@ -205,6 +190,13 @@ w_xm1014_release(void) w_cstrike_weaponrelease(); + /* auto-reload if need be */ + if (pl.w_attack_next <= 0.0) + if (pl.mode_temp == XM1014S_IDLE && pl.xm1014_mag == 0 && pl.ammo_buckshot > 0) { + Weapons_Reload(); + return; + } + if (pl.w_idle_next > 0.0) { return; } @@ -215,22 +207,15 @@ w_xm1014_release(void) pl.w_idle_next = 0.65f; } else if (pl.mode_temp == XM1014S_RELOAD) { Weapons_ViewAnimation(XM1014_INSERT); -#ifdef CLIENT - pl.xm1014_mag++; - pl.ammo_buckshot--; - - if (pl.ammo_buckshot <= 0 || pl.xm1014_mag >= 7) { - pl.mode_temp = XM1014S_RELOAD_END; - } -#else pl.xm1014_mag++; pl.ammo_buckshot--; w_xm1014_updateammo(pl); +#ifdef SERVER Sound_Play(pl, CHAN_WEAPON, "weapon_xm1014.insertshell"); +#endif if (pl.ammo_buckshot <= 0 || pl.xm1014_mag >= 7) { pl.mode_temp = XM1014S_RELOAD_END; } -#endif pl.w_idle_next = 0.5f; } else if (pl.mode_temp == XM1014S_RELOAD_END) { Weapons_ViewAnimation(XM1014_RELOAD_END); @@ -280,7 +265,7 @@ w_xm1014_hudpic(int selected, vector pos, float a) [0,135/256], [170/256,45/256], hud_col, - 1.0f, + a, DRAWFLAG_ADDITIVE ); } else { @@ -291,7 +276,7 @@ w_xm1014_hudpic(int selected, vector pos, float a) [0,135/256], [170/256,45/256], hud_col, - 1.0f, + a, DRAWFLAG_ADDITIVE ); }