Counter-Strike: Lots of polish for the weapons, fixes for all sorts of
ammo values, some buy action polish (make sure we limit nade purchases) Other games have the ammo-bar streamlined as well.
This commit is contained in:
parent
fc75a1be11
commit
b10a075b39
63 changed files with 1115 additions and 537 deletions
|
@ -152,6 +152,7 @@ void HUD_DrawAmmo1(void);
|
|||
void HUD_DrawAmmo2(void);
|
||||
void HUD_DrawAmmo3(void);
|
||||
void HUD_WeaponPickupNotify(int);
|
||||
void HUD_DrawAmmoBar(vector pos, float val, float max, float a);
|
||||
|
||||
void Cstrike_DrawCrosshair(void);
|
||||
void Cstrike_DrawSimpleCrosshair(void);
|
||||
|
|
|
@ -466,6 +466,19 @@ HUD_DrawAmmo3(void)
|
|||
HUD_DrawNums(pl.a_ammo3, pos, pSeat->m_flAmmo3Alpha, g_hud_color);
|
||||
}
|
||||
|
||||
/* ammo bar */
|
||||
void
|
||||
HUD_DrawAmmoBar(vector pos, float val, float max, float a)
|
||||
{
|
||||
if (val <= 0)
|
||||
return;
|
||||
|
||||
float perc;
|
||||
perc = val / max;
|
||||
drawfill(pos + [10,5], [20,4], g_hud_color, a, DRAWFLAG_NORMAL);
|
||||
drawfill(pos + [10,5], [20 * perc,4], [0,1,0], a, DRAWFLAG_NORMAL);
|
||||
}
|
||||
|
||||
/* flashlight/torch indicator */
|
||||
void
|
||||
HUD_DrawFlashlight(void)
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
/* values courtesy of https://wiki.alliedmods.net/Cs_weapons_information */
|
||||
int g_cstrikeWeaponPrice[] =
|
||||
{
|
||||
0, /* WEAPON_NONE */
|
||||
0, /* WEAPON_NONE */
|
||||
1700, /* WEAPON_M3 */
|
||||
3000, /* WEAPON_XM1014 */
|
||||
1500, /* WEAPON_MP5 */
|
||||
|
@ -40,11 +40,11 @@ int g_cstrikeWeaponPrice[] =
|
|||
600, /* WEAPON_P228 */
|
||||
800, /* WEAPON_ELITES */
|
||||
750, /* WEAPON_FIVESEVEN */
|
||||
0, /* WEAPON_KNIFE */
|
||||
0, /* WEAPON_KNIFE */
|
||||
300, /* WEAPON_HEGRENADE */
|
||||
200, /* WEAPON_FLASHBANG */
|
||||
300, /* WEAPON_SMOKEGRENADE */
|
||||
0 /* WEAPON_C4BOMB */
|
||||
0 /* WEAPON_C4BOMB */
|
||||
};
|
||||
|
||||
void
|
||||
|
@ -74,6 +74,9 @@ CSEv_BuyWeapon_f(float fWeapon)
|
|||
if (iWeapon == WEAPON_MAC10) { return; }
|
||||
}
|
||||
|
||||
if (Weapons_IsPresent(pl, iWeapon))
|
||||
return;
|
||||
|
||||
if ((pl.money - g_cstrikeWeaponPrice[iWeapon]) >= 0) {
|
||||
/* let's check if we've got a limit */
|
||||
int maxit;
|
||||
|
@ -133,31 +136,64 @@ CSEv_BuyEquipment_f(float fUtil)
|
|||
if ((pl.money - g_cstrikeUtilPrice[iUtil]) >= 0) {
|
||||
switch (iUtil) {
|
||||
case 0:
|
||||
if (pl.armor >= 100)
|
||||
return;
|
||||
|
||||
pl.armor = 100;
|
||||
Sound_Play(pl, CHAN_ITEM, "buy.kevlar");
|
||||
break;
|
||||
case 1:
|
||||
if (pl.g_items & ITEM_HELMET && pl.armor >= 0)
|
||||
return;
|
||||
|
||||
pl.armor = 100;
|
||||
pl.g_items |= ITEM_HELMET;
|
||||
Sound_Play(pl, CHAN_ITEM, "buy.kevlar");
|
||||
break;
|
||||
case 2:
|
||||
Weapons_AddItem(pl, WEAPON_FLASHBANG, -1);
|
||||
if (Weapons_IsPresent(pl, WEAPON_FLASHBANG)) {
|
||||
if (pl.ammo_fbgrenade >= AMMO_MAX_FLASHBANG)
|
||||
return;
|
||||
else
|
||||
pl.ammo_fbgrenade++;
|
||||
} else
|
||||
Weapons_AddItem(pl, WEAPON_FLASHBANG, -1);
|
||||
|
||||
Sound_Play(pl, CHAN_ITEM, "buy.weapon");
|
||||
break;
|
||||
case 3:
|
||||
Weapons_AddItem(pl, WEAPON_HEGRENADE, -1);
|
||||
if (Weapons_IsPresent(pl, WEAPON_HEGRENADE)) {
|
||||
if (pl.ammo_hegrenade >= AMMO_MAX_HENADE)
|
||||
return;
|
||||
else
|
||||
pl.ammo_hegrenade++;
|
||||
} else
|
||||
Weapons_AddItem(pl, WEAPON_HEGRENADE, -1);
|
||||
|
||||
Sound_Play(pl, CHAN_ITEM, "buy.weapon");
|
||||
break;
|
||||
case 4:
|
||||
Weapons_AddItem(pl, WEAPON_SMOKEGRENADE, -1);
|
||||
if (Weapons_IsPresent(pl, WEAPON_SMOKEGRENADE)) {
|
||||
if (pl.ammo_smokegrenade >= AMMO_MAX_SMOKE)
|
||||
return;
|
||||
else
|
||||
pl.ammo_smokegrenade++;
|
||||
} else
|
||||
Weapons_AddItem(pl, WEAPON_SMOKEGRENADE, -1);
|
||||
|
||||
Sound_Play(pl, CHAN_ITEM, "buy.weapon");
|
||||
break;
|
||||
case 5:
|
||||
if (pl.g_items & ITEM_DEFUSAL)
|
||||
return;
|
||||
|
||||
pl.g_items |= ITEM_DEFUSAL;
|
||||
Sound_Play(pl, CHAN_ITEM, "buy.weapon");
|
||||
break;
|
||||
case 6:
|
||||
if (pl.g_items & ITEM_NIGHTVISION)
|
||||
return;
|
||||
|
||||
pl.g_items |= ITEM_NIGHTVISION;
|
||||
Sound_Play(pl, CHAN_ITEM, "buy.weapon");
|
||||
break;
|
||||
|
|
|
@ -822,26 +822,19 @@ CSMultiplayerRules::PlayerMakePlayable(base_player pp, int chara)
|
|||
pl.g_items |= ITEM_SUIT;
|
||||
Weapons_AddItem(pl, WEAPON_KNIFE, -1);
|
||||
|
||||
/* terrorists */
|
||||
if (chara < 5) {
|
||||
/* terrorists */
|
||||
pl.team = TEAM_T;
|
||||
if (autocvar_fcs_knifeonly == FALSE) {
|
||||
Weapons_AddItem(pl, WEAPON_GLOCK18, -1);
|
||||
/*Weapon_GiveAmmo(WEAPON_GLOCK18, 40);*/
|
||||
/*Weapon_Draw(WEAPON_GLOCK18);*/
|
||||
} else {
|
||||
/*Weapon_Draw(WEAPON_KNIFE);*/
|
||||
pl.ammo_9mm = 40;
|
||||
}
|
||||
} else {
|
||||
/* counter */
|
||||
pl.team = TEAM_CT;
|
||||
|
||||
if (autocvar_fcs_knifeonly == FALSE) {
|
||||
Weapons_AddItem(pl, WEAPON_USP45, -1);
|
||||
/*Weapon_GiveAmmo(WEAPON_USP45, 24);*/
|
||||
/*Weapon_Draw(WEAPON_USP45);*/
|
||||
} else {
|
||||
/*Weapon_Draw(WEAPON_KNIFE);*/
|
||||
pl.ammo_45acp = 24;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -85,8 +85,8 @@ w_ak47_pickup(int new, int startammo)
|
|||
else
|
||||
pl.ak47_mag = startammo;
|
||||
} else {
|
||||
if (pl.ammo_762mm < 90) {
|
||||
pl.ammo_762mm = bound(0, pl.ammo_762mm + 30, 90);
|
||||
if (pl.ammo_762mm < AMMO_MAX_762MM) {
|
||||
pl.ammo_762mm = bound(0, pl.ammo_762mm + 30, AMMO_MAX_762MM);
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -202,6 +202,16 @@ void
|
|||
w_ak47_hudpic(int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
player pl = (player)self;
|
||||
vector hud_col;
|
||||
|
||||
if (pl.ak47_mag == 0 && pl.ammo_762mm == 0)
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_762mm, AMMO_MAX_762MM, a);
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
|
@ -209,7 +219,7 @@ w_ak47_hudpic(int selected, vector pos, float a)
|
|||
g_hud11_spr,
|
||||
[0,0],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
1.0f,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
|
@ -220,7 +230,7 @@ w_ak47_hudpic(int selected, vector pos, float a)
|
|||
g_hud11_spr,
|
||||
[0,0],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
1.0f,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
|
|
|
@ -85,8 +85,8 @@ w_aug_pickup(int new, int startammo)
|
|||
else
|
||||
pl.aug_mag = startammo;
|
||||
} else {
|
||||
if (pl.ammo_762mm < 90) {
|
||||
pl.ammo_762mm = bound(0, pl.ammo_762mm + 30, 90);
|
||||
if (pl.ammo_762mm < AMMO_MAX_762MM) {
|
||||
pl.ammo_762mm = bound(0, pl.ammo_762mm + 30, AMMO_MAX_762MM);
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -227,6 +227,16 @@ void
|
|||
w_aug_hudpic(int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
player pl = (player)self;
|
||||
vector hud_col;
|
||||
|
||||
if (pl.aug_mag == 0 && pl.ammo_762mm == 0)
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_762mm, AMMO_MAX_762MM, a);
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
|
@ -234,7 +244,7 @@ w_aug_hudpic(int selected, vector pos, float a)
|
|||
g_hud15_spr,
|
||||
[0,45/256],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
1.0f,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
|
@ -245,7 +255,7 @@ w_aug_hudpic(int selected, vector pos, float a)
|
|||
g_hud14_spr,
|
||||
[0,45/256],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
1.0f,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
|
|
|
@ -254,6 +254,16 @@ void
|
|||
w_awp_hudpic(int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
player pl = (player)self;
|
||||
vector hud_col;
|
||||
|
||||
if (pl.awp_mag == 0 && pl.ammo_338mag == 0)
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_338mag, AMMO_MAX_338MAG, a);
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
|
@ -261,7 +271,7 @@ w_awp_hudpic(int selected, vector pos, float a)
|
|||
g_hud5_spr,
|
||||
[0,135/256],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
1.0f,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
|
@ -272,7 +282,7 @@ w_awp_hudpic(int selected, vector pos, float a)
|
|||
g_hud2_spr,
|
||||
[0,135/256],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
1.0f,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
|
|
|
@ -207,6 +207,16 @@ void
|
|||
w_deagle_hudpic(int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
player pl = (player)self;
|
||||
vector hud_col;
|
||||
|
||||
if (pl.deagle_mag == 0 && pl.ammo_50ae == 0)
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_50ae, AMMO_MAX_50AE, a);
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
|
@ -214,7 +224,7 @@ w_deagle_hudpic(int selected, vector pos, float a)
|
|||
g_hud11_spr,
|
||||
[0,90/256],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
1.0f,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
|
@ -225,7 +235,7 @@ w_deagle_hudpic(int selected, vector pos, float a)
|
|||
g_hud10_spr,
|
||||
[0,90/256],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
1.0f,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
|
|
|
@ -94,8 +94,8 @@ w_elites_pickup(int new, int startammo)
|
|||
else
|
||||
pl.elites_mag = startammo;
|
||||
} else {
|
||||
if (pl.ammo_9mm < 90) {
|
||||
pl.ammo_9mm = bound(0, pl.ammo_9mm + 30, 90);
|
||||
if (pl.ammo_9mm < AMMO_MAX_9MM) {
|
||||
pl.ammo_9mm = bound(0, pl.ammo_9mm + 30, AMMO_MAX_9MM);
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -259,6 +259,16 @@ void
|
|||
w_elites_hudpic(int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
player pl = (player)self;
|
||||
vector hud_col;
|
||||
|
||||
if (pl.elites_mag == 0 && pl.ammo_9mm == 0)
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_9mm, AMMO_MAX_9MM, a);
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
|
@ -266,7 +276,7 @@ w_elites_hudpic(int selected, vector pos, float a)
|
|||
g_hud15_spr,
|
||||
[0,90/256],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
1.0f,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
|
@ -277,7 +287,7 @@ w_elites_hudpic(int selected, vector pos, float a)
|
|||
g_hud14_spr,
|
||||
[0,90/256],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
1.0f,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
|
|
|
@ -84,8 +84,8 @@ w_fiveseven_pickup(int new, int startammo)
|
|||
else
|
||||
pl.fiveseven_mag = startammo;
|
||||
} else {
|
||||
if (pl.ammo_57mm < 40) {
|
||||
pl.ammo_57mm = bound(0, pl.ammo_57mm + 20, 40);
|
||||
if (pl.ammo_57mm < AMMO_MAX_57MM) {
|
||||
pl.ammo_57mm = bound(0, pl.ammo_57mm + 20, AMMO_MAX_57MM);
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -207,6 +207,16 @@ void
|
|||
w_fiveseven_hudpic(int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
player pl = (player)self;
|
||||
vector hud_col;
|
||||
|
||||
if (pl.fiveseven_mag == 0 && pl.ammo_57mm == 0)
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_57mm, AMMO_MAX_57MM, a);
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
|
@ -214,7 +224,7 @@ w_fiveseven_hudpic(int selected, vector pos, float a)
|
|||
g_hud15_spr,
|
||||
[0,135/256],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
1.0f,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
|
@ -225,7 +235,7 @@ w_fiveseven_hudpic(int selected, vector pos, float a)
|
|||
g_hud14_spr,
|
||||
[0,135/256],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
1.0f,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
|
|
|
@ -61,8 +61,8 @@ w_flashbang_pickup(int new, int startammo)
|
|||
#ifdef SERVER
|
||||
player pl = (player)self;
|
||||
|
||||
if (pl.ammo_fbgrenade < 3) {
|
||||
pl.ammo_fbgrenade = bound(0, pl.ammo_fbgrenade + 1, 3);
|
||||
if (pl.ammo_fbgrenade < AMMO_MAX_FLASHBANG) {
|
||||
pl.ammo_fbgrenade = bound(0, pl.ammo_fbgrenade + 1, AMMO_MAX_FLASHBANG);
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -229,6 +229,10 @@ void
|
|||
w_flashbang_hudpic(int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
player pl = (player)self;
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_fbgrenade, AMMO_MAX_FLASHBANG, a);
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
|
|
|
@ -83,8 +83,8 @@ w_g3sg1_pickup(int new, int startammo)
|
|||
else
|
||||
pl.g3sg1_mag = startammo;
|
||||
} else {
|
||||
if (pl.ammo_762mm < 60) {
|
||||
pl.ammo_762mm = bound(0, pl.ammo_762mm + 20, 60);
|
||||
if (pl.ammo_762mm < AMMO_MAX_762MM) {
|
||||
pl.ammo_762mm = bound(0, pl.ammo_762mm + 20, AMMO_MAX_762MM);
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -219,6 +219,16 @@ void
|
|||
w_g3sg1_hudpic(int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
player pl = (player)self;
|
||||
vector hud_col;
|
||||
|
||||
if (pl.g3sg1_mag == 0 && pl.ammo_762mm == 0)
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_762mm, AMMO_MAX_762MM, a);
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
|
@ -226,7 +236,7 @@ w_g3sg1_hudpic(int selected, vector pos, float a)
|
|||
g_hud5_spr,
|
||||
[0,180/256],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
1.0f,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
|
@ -237,7 +247,7 @@ w_g3sg1_hudpic(int selected, vector pos, float a)
|
|||
g_hud2_spr,
|
||||
[0,180/256],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
1.0f,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
|
|
|
@ -94,8 +94,8 @@ w_glock18_pickup(int new, int startammo)
|
|||
else
|
||||
pl.glock18_mag = startammo;
|
||||
} else {
|
||||
if (pl.ammo_9mm < 40) {
|
||||
pl.ammo_9mm = bound(0, pl.ammo_9mm + 20, 40);
|
||||
if (pl.ammo_9mm < AMMO_MAX_9MM) {
|
||||
pl.ammo_9mm = bound(0, pl.ammo_9mm + 20, AMMO_MAX_9MM);
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -275,6 +275,8 @@ w_glock18_hudpic(int selected, vector pos, float a)
|
|||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_9mm, AMMO_MAX_9MM, a);
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
|
@ -282,7 +284,7 @@ w_glock18_hudpic(int selected, vector pos, float a)
|
|||
g_hud4_spr,
|
||||
[0,45/256],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
1.0f,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
|
@ -293,19 +295,11 @@ w_glock18_hudpic(int selected, vector pos, float a)
|
|||
g_hud1_spr,
|
||||
[0,45/256],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
1.0f,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
}
|
||||
|
||||
if (pl.ammo_9mm <= 0)
|
||||
return;
|
||||
|
||||
float perc;
|
||||
perc = pl.ammo_9mm / AMMO_MAX_9MM;
|
||||
drawfill(pos + [10,0], [20,4], hud_col, a, DRAWFLAG_NORMAL);
|
||||
drawfill(pos + [10,0], [20 * perc,4], [0,1,0], a, DRAWFLAG_NORMAL);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -61,8 +61,8 @@ w_hegrenade_pickup(int new, int startammo)
|
|||
#ifdef SERVER
|
||||
player pl = (player)self;
|
||||
|
||||
if (pl.ammo_hegrenade < 3) {
|
||||
pl.ammo_hegrenade = bound(0, pl.ammo_hegrenade + 1, 3);
|
||||
if (pl.ammo_hegrenade < AMMO_MAX_HENADE) {
|
||||
pl.ammo_hegrenade = bound(0, pl.ammo_hegrenade + 1, AMMO_MAX_HENADE);
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -238,6 +238,10 @@ void
|
|||
w_hegrenade_hudpic(int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
player pl = (player)self;
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_hegrenade, AMMO_MAX_HENADE, a);
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
|
|
|
@ -259,6 +259,16 @@ void
|
|||
w_m3_hudpic(int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
player pl = (player)self;
|
||||
vector hud_col;
|
||||
|
||||
if (pl.m3_mag == 0 && pl.ammo_buckshot == 0)
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_buckshot, AMMO_MAX_BUCKSHOT, a);
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
|
@ -266,7 +276,7 @@ w_m3_hudpic(int selected, vector pos, float a)
|
|||
g_hud4_spr,
|
||||
[0,135/256],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
1.0f,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
|
@ -277,7 +287,7 @@ w_m3_hudpic(int selected, vector pos, float a)
|
|||
g_hud1_spr,
|
||||
[0,135/256],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
1.0f,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
|
|
|
@ -94,8 +94,8 @@ w_m4a1_pickup(int new, int startammo)
|
|||
else
|
||||
pl.m4a1_mag = startammo;
|
||||
} else {
|
||||
if (pl.ammo_556mm < AMMO_MAX_762MM) {
|
||||
pl.ammo_556mm = bound(0, pl.ammo_556mm + 30, AMMO_MAX_762MM);
|
||||
if (pl.ammo_556mm < AMMO_MAX_556MM) {
|
||||
pl.ammo_556mm = bound(0, pl.ammo_556mm + 30, AMMO_MAX_556MM);
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -296,6 +296,8 @@ w_m4a1_hudpic(int selected, vector pos, float a)
|
|||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_556mm, AMMO_MAX_556MM, a);
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
|
@ -319,14 +321,6 @@ w_m4a1_hudpic(int selected, vector pos, float a)
|
|||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
}
|
||||
|
||||
if (pl.ammo_556mm <= 0)
|
||||
return;
|
||||
|
||||
float perc;
|
||||
perc = pl.ammo_556mm / AMMO_MAX_556MM;
|
||||
drawfill(pos + [10,0], [20,4], hud_col, a, DRAWFLAG_NORMAL);
|
||||
drawfill(pos + [10,0], [20 * perc,4], [0,1,0], a, DRAWFLAG_NORMAL);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -84,8 +84,8 @@ w_mac10_pickup(int new, int startammo)
|
|||
else
|
||||
pl.mac10_mag = startammo;
|
||||
} else {
|
||||
if (pl.ammo_45acp < 90) {
|
||||
pl.ammo_45acp = bound(0, pl.ammo_45acp + 30, 90);
|
||||
if (pl.ammo_45acp < AMMO_MAX_45ACP) {
|
||||
pl.ammo_45acp = bound(0, pl.ammo_45acp + 30, AMMO_MAX_45ACP);
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -202,6 +202,16 @@ void
|
|||
w_mac10_hudpic(int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
player pl = (player)self;
|
||||
vector hud_col;
|
||||
|
||||
if (pl.mac10_mag == 0 && pl.ammo_45acp == 0)
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_45acp, AMMO_MAX_45ACP, a);
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
|
@ -209,7 +219,7 @@ w_mac10_hudpic(int selected, vector pos, float a)
|
|||
g_hud15_spr,
|
||||
[0,0],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
1.0f,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
|
@ -220,7 +230,7 @@ w_mac10_hudpic(int selected, vector pos, float a)
|
|||
g_hud14_spr,
|
||||
[0,0],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
1.0f,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
|
|
|
@ -202,6 +202,16 @@ void
|
|||
w_mp5_hudpic(int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
player pl = (player)self;
|
||||
vector hud_col;
|
||||
|
||||
if (pl.mp5_mag == 0 && pl.ammo_9mm == 0)
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_9mm, AMMO_MAX_9MM, a);
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
|
@ -209,7 +219,7 @@ w_mp5_hudpic(int selected, vector pos, float a)
|
|||
g_hud4_spr,
|
||||
[0,180/256],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
1.0f,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
|
@ -220,7 +230,7 @@ w_mp5_hudpic(int selected, vector pos, float a)
|
|||
g_hud1_spr,
|
||||
[0,180/256],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
1.0f,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
|
|
|
@ -85,8 +85,8 @@ w_p228_pickup(int new, int startammo)
|
|||
else
|
||||
pl.p228_mag = startammo;
|
||||
} else {
|
||||
if (pl.ammo_357sig < 26) {
|
||||
pl.ammo_357sig = bound(0, pl.ammo_357sig + 13, 26);
|
||||
if (pl.ammo_357sig < AMMO_MAX_357SIG) {
|
||||
pl.ammo_357sig = bound(0, pl.ammo_357sig + 13, AMMO_MAX_357SIG);
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -211,6 +211,16 @@ void
|
|||
w_p228_hudpic(int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
player pl = (player)self;
|
||||
vector hud_col;
|
||||
|
||||
if (pl.p228_mag == 0 && pl.ammo_357sig == 0)
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_357sig, AMMO_MAX_357SIG, a);
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
|
@ -218,7 +228,7 @@ w_p228_hudpic(int selected, vector pos, float a)
|
|||
g_hud13_spr,
|
||||
[0,90/256],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
1.0f,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
|
@ -229,7 +239,7 @@ w_p228_hudpic(int selected, vector pos, float a)
|
|||
g_hud12_spr,
|
||||
[0,90/256],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
1.0f,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
|
|
|
@ -84,8 +84,8 @@ w_p90_pickup(int new, int startammo)
|
|||
else
|
||||
pl.p90_mag = startammo;
|
||||
} else {
|
||||
if (pl.ammo_57mm < 100) {
|
||||
pl.ammo_57mm = bound(0, pl.ammo_57mm + 50, 100);
|
||||
if (pl.ammo_57mm < AMMO_MAX_57MM) {
|
||||
pl.ammo_57mm = bound(0, pl.ammo_57mm + 50, AMMO_MAX_57MM);
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -202,6 +202,16 @@ void
|
|||
w_p90_hudpic(int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
player pl = (player)self;
|
||||
vector hud_col;
|
||||
|
||||
if (pl.p90_mag == 0 && pl.ammo_57mm == 0)
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_57mm, AMMO_MAX_57MM, a);
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
|
@ -209,7 +219,7 @@ w_p90_hudpic(int selected, vector pos, float a)
|
|||
g_hud13_spr,
|
||||
[0,0],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
1.0f,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
|
@ -220,7 +230,7 @@ w_p90_hudpic(int selected, vector pos, float a)
|
|||
g_hud12_spr,
|
||||
[0,0],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
1.0f,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
|
|
|
@ -83,8 +83,8 @@ w_para_pickup(int new, int startammo)
|
|||
else
|
||||
pl.para_mag = startammo;
|
||||
} else {
|
||||
if (pl.ammo_556mmbox < 200) {
|
||||
pl.ammo_556mmbox = bound(0, pl.ammo_556mmbox + 100, 200);
|
||||
if (pl.ammo_556mmbox < AMMO_MAX_556MMBOX) {
|
||||
pl.ammo_556mmbox = bound(0, pl.ammo_556mmbox + 100, AMMO_MAX_556MMBOX);
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -198,6 +198,16 @@ void
|
|||
w_para_hudpic(int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
player pl = (player)self;
|
||||
vector hud_col;
|
||||
|
||||
if (pl.para_mag == 0 && pl.ammo_556mmbox == 0)
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_556mmbox, AMMO_MAX_556MMBOX, a);
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
|
@ -205,7 +215,7 @@ w_para_hudpic(int selected, vector pos, float a)
|
|||
g_hud6_spr,
|
||||
[0,0],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
1.0f,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
|
@ -216,7 +226,7 @@ w_para_hudpic(int selected, vector pos, float a)
|
|||
g_hud3_spr,
|
||||
[0,0],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
1.0f,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
|
|
|
@ -83,8 +83,8 @@ w_scout_pickup(int new, int startammo)
|
|||
else
|
||||
pl.scout_mag = startammo;
|
||||
} else {
|
||||
if (pl.ammo_762mm < 30) {
|
||||
pl.ammo_762mm = bound(0, pl.ammo_762mm + 10, 30);
|
||||
if (pl.ammo_762mm < AMMO_MAX_762MM) {
|
||||
pl.ammo_762mm = bound(0, pl.ammo_762mm + 10, AMMO_MAX_762MM);
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -251,6 +251,16 @@ void
|
|||
w_scout_hudpic(int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
player pl = (player)self;
|
||||
vector hud_col;
|
||||
|
||||
if (pl.scout_mag == 0 && pl.ammo_762mm == 0)
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_762mm, AMMO_MAX_762MM, a);
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
|
@ -258,7 +268,7 @@ w_scout_hudpic(int selected, vector pos, float a)
|
|||
g_hud13_spr,
|
||||
[0,45/256],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
1.0f,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
|
@ -269,7 +279,7 @@ w_scout_hudpic(int selected, vector pos, float a)
|
|||
g_hud12_spr,
|
||||
[0,45/256],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
1.0f,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
|
|
|
@ -83,8 +83,8 @@ w_sg550_pickup(int new, int startammo)
|
|||
else
|
||||
pl.sg550_mag = startammo;
|
||||
} else {
|
||||
if (pl.ammo_556mm < 90) {
|
||||
pl.ammo_556mm = bound(0, pl.ammo_556mm + 30, 90);
|
||||
if (pl.ammo_556mm < AMMO_MAX_556MM) {
|
||||
pl.ammo_556mm = bound(0, pl.ammo_556mm + 30, AMMO_MAX_556MM);
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -219,6 +219,16 @@ void
|
|||
w_sg550_hudpic(int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
player pl = (player)self;
|
||||
vector hud_col;
|
||||
|
||||
if (pl.sg550_mag == 0 && pl.ammo_556mm == 0)
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_556mm, AMMO_MAX_556MM, a);
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
|
@ -226,7 +236,7 @@ w_sg550_hudpic(int selected, vector pos, float a)
|
|||
g_hud15_spr,
|
||||
[0,180/256],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
1.0f,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
|
@ -237,7 +247,7 @@ w_sg550_hudpic(int selected, vector pos, float a)
|
|||
g_hud14_spr,
|
||||
[0,180/256],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
1.0f,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
|
|
|
@ -84,8 +84,8 @@ w_sg552_pickup(int new, int startammo)
|
|||
else
|
||||
pl.sg552_mag = startammo;
|
||||
} else {
|
||||
if (pl.ammo_556mm < 90) {
|
||||
pl.ammo_556mm = bound(0, pl.ammo_556mm + 30, 90);
|
||||
if (pl.ammo_556mm < AMMO_MAX_556MM) {
|
||||
pl.ammo_556mm = bound(0, pl.ammo_556mm + 30, AMMO_MAX_556MM);
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -227,6 +227,16 @@ void
|
|||
w_sg552_hudpic(int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
player pl = (player)self;
|
||||
vector hud_col;
|
||||
|
||||
if (pl.sg552_mag == 0 && pl.ammo_556mm == 0)
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_556mm, AMMO_MAX_556MM, a);
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
|
@ -234,7 +244,7 @@ w_sg552_hudpic(int selected, vector pos, float a)
|
|||
g_hud11_spr,
|
||||
[0,45/256],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
1.0f,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
|
@ -245,7 +255,7 @@ w_sg552_hudpic(int selected, vector pos, float a)
|
|||
g_hud10_spr,
|
||||
[0,45/256],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
1.0f,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
|
|
|
@ -61,8 +61,8 @@ w_smokegrenade_pickup(int new, int startammo)
|
|||
#ifdef SERVER
|
||||
player pl = (player)self;
|
||||
|
||||
if (pl.ammo_smokegrenade < 3) {
|
||||
pl.ammo_smokegrenade = bound(0, pl.ammo_smokegrenade + 1, 3);
|
||||
if (pl.ammo_smokegrenade < AMMO_MAX_SMOKE) {
|
||||
pl.ammo_smokegrenade = bound(0, pl.ammo_smokegrenade + 1, AMMO_MAX_SMOKE);
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -234,6 +234,10 @@ void
|
|||
w_smokegrenade_hudpic(int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
player pl = (player)self;
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_smokegrenade, AMMO_MAX_SMOKE, a);
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
|
@ -263,7 +267,7 @@ w_smokegrenade_hudpic(int selected, vector pos, float a)
|
|||
weapon_t w_smokegrenade =
|
||||
{
|
||||
.name = "smokegrenade",
|
||||
.id = ITEM_SMOKEGRENADE,
|
||||
.id = ITEM_SMOKEGRENADE,
|
||||
.slot = 3,
|
||||
.slot_pos = 2,
|
||||
.allow_drop = FALSE,
|
||||
|
|
|
@ -84,8 +84,8 @@ w_tmp_pickup(int new, int startammo)
|
|||
else
|
||||
pl.tmp_mag = startammo;
|
||||
} else {
|
||||
if (pl.ammo_9mm < 90) {
|
||||
pl.ammo_9mm = bound(0, pl.ammo_9mm + 30, 90);
|
||||
if (pl.ammo_9mm < AMMO_MAX_9MM) {
|
||||
pl.ammo_9mm = bound(0, pl.ammo_9mm + 30, AMMO_MAX_9MM);
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -204,6 +204,16 @@ void
|
|||
w_tmp_hudpic(int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
player pl = (player)self;
|
||||
vector hud_col;
|
||||
|
||||
if (pl.tmp_mag == 0 && pl.ammo_9mm == 0)
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_9mm, AMMO_MAX_9MM, a);
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
|
@ -211,7 +221,7 @@ w_tmp_hudpic(int selected, vector pos, float a)
|
|||
g_hud5_spr,
|
||||
[0,0],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
1.0f,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
|
@ -222,7 +232,7 @@ w_tmp_hudpic(int selected, vector pos, float a)
|
|||
g_hud2_spr,
|
||||
[0,0],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
1.0f,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
|
|
|
@ -218,6 +218,16 @@ void
|
|||
w_ump45_hudpic(int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
player pl = (player)self;
|
||||
vector hud_col;
|
||||
|
||||
if (pl.ump45_mag == 0 && pl.ammo_45acp == 0)
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_45acp, AMMO_MAX_45ACP, a);
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
|
@ -225,7 +235,7 @@ w_ump45_hudpic(int selected, vector pos, float a)
|
|||
g_hud16_spr,
|
||||
[0,0],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
1.0f,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
|
@ -236,7 +246,7 @@ w_ump45_hudpic(int selected, vector pos, float a)
|
|||
g_hud16_spr,
|
||||
[0,0],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
1.0f,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
|
@ -247,7 +257,7 @@ w_ump45_hudpic(int selected, vector pos, float a)
|
|||
weapon_t w_ump45 =
|
||||
{
|
||||
.name = "ump45",
|
||||
.id = ITEM_UMP45,
|
||||
.id = ITEM_UMP45,
|
||||
.slot = 0,
|
||||
.slot_pos = 4,
|
||||
.allow_drop = TRUE,
|
||||
|
|
|
@ -293,6 +293,8 @@ w_usp45_hudpic(int selected, vector pos, float a)
|
|||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_45acp, AMMO_MAX_45ACP, a);
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
|
@ -316,14 +318,6 @@ w_usp45_hudpic(int selected, vector pos, float a)
|
|||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
}
|
||||
|
||||
if (pl.ammo_45acp <= 0)
|
||||
return;
|
||||
|
||||
float perc;
|
||||
perc = pl.ammo_45acp / AMMO_MAX_45ACP;
|
||||
drawfill(pos + [10,0], [20,4], hud_col, a, DRAWFLAG_NORMAL);
|
||||
drawfill(pos + [10,0], [20 * perc,4], [0,1,0], a, DRAWFLAG_NORMAL);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -262,6 +262,16 @@ void
|
|||
w_xm1014_hudpic(int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
player pl = (player)self;
|
||||
vector hud_col;
|
||||
|
||||
if (pl.xm1014_mag == 0 && pl.ammo_buckshot == 0)
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_buckshot, AMMO_MAX_BUCKSHOT, a);
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
|
@ -269,7 +279,7 @@ w_xm1014_hudpic(int selected, vector pos, float a)
|
|||
g_hud13_spr,
|
||||
[0,135/256],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
1.0f,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
|
@ -280,7 +290,7 @@ w_xm1014_hudpic(int selected, vector pos, float a)
|
|||
g_hud12_spr,
|
||||
[0,135/256],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
1.0f,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
|
@ -291,7 +301,7 @@ w_xm1014_hudpic(int selected, vector pos, float a)
|
|||
weapon_t w_xm1014 =
|
||||
{
|
||||
.name = "xm1014",
|
||||
.id = ITEM_XM1014,
|
||||
.id = ITEM_XM1014,
|
||||
.slot = 0,
|
||||
.slot_pos = 1,
|
||||
.allow_drop = TRUE,
|
||||
|
|
|
@ -48,43 +48,15 @@ enum
|
|||
};
|
||||
|
||||
#define AMMO_MAX_50AE 35
|
||||
// drawsubpic(aicon_pos, [24,24], g_hud7_spr, [24/256,72/256], [24/256, 24/256], g_hud_color, pSeat->m_flAmmo2Alpha, DRAWFLAG_ADDITIVE);
|
||||
|
||||
#define AMMO_MAX_762MM 90
|
||||
// drawsubpic(aicon_pos, [24,24], g_hud7_spr, [72/256,72/256], [24/256, 24/256], g_hud_color, pSeat->m_flAmmo2Alpha, DRAWFLAG_ADDITIVE);
|
||||
|
||||
#define AMMO_MAX_556MM 90
|
||||
// drawsubpic(aicon_pos, [24,24], g_hud7_spr, [0,96/256], [24/256, 24/256], g_hud_color, pSeat->m_flAmmo2Alpha, DRAWFLAG_ADDITIVE);
|
||||
|
||||
#define AMMO_MAX_556MMBOX 200
|
||||
// drawsubpic(aicon_pos, [24,24], g_hud7_spr, [0,96/256], [24/256, 24/256], g_hud_color, pSeat->m_flAmmo2Alpha, DRAWFLAG_ADDITIVE);
|
||||
|
||||
#define AMMO_MAX_338MAG 30
|
||||
// drawsubpic(aicon_pos, [24,24], g_hud7_spr, [24/256,96/256], [24/256, 24/256], g_hud_color, pSeat->m_flAmmo2Alpha, DRAWFLAG_ADDITIVE);
|
||||
|
||||
#define AMMO_MAX_9MM 150
|
||||
// drawsubpic(aicon_pos, [24,24], g_hud7_spr, [48/256,72/256], [24/256, 24/256], g_hud_color, pSeat->m_flAmmo2Alpha, DRAWFLAG_ADDITIVE);
|
||||
|
||||
#define AMMO_MAX_BUCKSHOT 32
|
||||
// drawsubpic(aicon_pos, [24,24], g_hud7_spr, [0,72/256], [24/256, 24/256], g_hud_color, pSeat->m_flAmmo2Alpha, DRAWFLAG_ADDITIVE);
|
||||
|
||||
#define AMMO_MAX_45ACP 100
|
||||
// drawsubpic(aicon_pos, [24,24], g_hud7_spr, [96/256,72/256], [24/256, 24/256], g_hud_color, pSeat->m_flAmmo2Alpha, DRAWFLAG_ADDITIVE);
|
||||
|
||||
#define AMMO_MAX_357SIG 52
|
||||
// drawsubpic(aicon_pos, [24,24], g_hud7_spr, [120/256,72/256], [24/256, 24/256], g_hud_color, pSeat->m_flAmmo2Alpha, DRAWFLAG_ADDITIVE);
|
||||
|
||||
#define AMMO_MAX_57MM 100
|
||||
// drawsubpic(aicon_pos, [24,24], g_hud7_spr, [120/256,96/256], [24/256, 24/256], g_hud_color, pSeat->m_flAmmo2Alpha, DRAWFLAG_ADDITIVE);
|
||||
|
||||
// flashbang
|
||||
// drawsubpic(aicon_pos, [24,24], g_hud7_spr, [48/256,96/256], [24/256, 24/256], g_hud_color, pSeat->m_flAmmo2Alpha, DRAWFLAG_ADDITIVE);
|
||||
|
||||
// he
|
||||
// drawsubpic(aicon_pos, [24,24], g_hud7_spr, [72/256,96/256], [24/256, 24/256], g_hud_color, pSeat->m_flAmmo2Alpha, DRAWFLAG_ADDITIVE);
|
||||
|
||||
// smoke
|
||||
// drawsubpic(aicon_pos, [24,24], g_hud7_spr, [144/256,96/256], [24/256, 24/256], g_hud_color, pSeat->m_flAmmo2Alpha, DRAWFLAG_ADDITIVE);
|
||||
|
||||
// c4
|
||||
// drawsubpic(aicon_pos, [24,24], g_hud7_spr, [96/256,96/256], [24/256, 24/256], g_hud_color, pSeat->m_flAmmo2Alpha, DRAWFLAG_ADDITIVE);
|
||||
#define AMMO_MAX_FLASHBANG 2
|
||||
#define AMMO_MAX_SMOKE 1
|
||||
#define AMMO_MAX_HENADE 1
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -42,8 +42,8 @@ void
|
|||
w_displacer_precache(void)
|
||||
{
|
||||
#ifdef SERVER
|
||||
precache_sound("weapons/displacer_fire.wav");
|
||||
precache_sound("weapons/displacer_impact.wav");
|
||||
precache_sound("weapons/displacer_fire.wav");
|
||||
precache_sound("weapons/displacer_self.wav");
|
||||
precache_sound("weapons/displacer_spin.wav");
|
||||
precache_sound("weapons/displacer_spin2.wav");
|
||||
|
@ -51,10 +51,10 @@ w_displacer_precache(void)
|
|||
precache_sound("weapons/displacer_teleport.wav");
|
||||
precache_sound("weapons/displacer_teleport_player.wav");
|
||||
precache_model("models/w_displacer.mdl");
|
||||
precache_model("sprites/exit1.spr");
|
||||
#else
|
||||
precache_model("models/v_displacer.mdl");
|
||||
precache_model("models/p_displacer.mdl");
|
||||
precache_model("sprites/exit1.spr");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -88,8 +88,8 @@ w_displacer_pickup(int new, int startammo)
|
|||
#ifdef SERVER
|
||||
player pl = (player)self;
|
||||
|
||||
if (pl.ammo_uranium < 100) {
|
||||
pl.ammo_uranium = bound(0, pl.ammo_uranium + 40, 100);
|
||||
if (pl.ammo_uranium < MAX_A_URANIUM) {
|
||||
pl.ammo_uranium = bound(0, pl.ammo_uranium + 40, MAX_A_URANIUM);
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -133,37 +133,33 @@ w_displacer_teleport(entity target)
|
|||
void
|
||||
w_displacer_fireball(void)
|
||||
{
|
||||
#ifdef SERVER
|
||||
player pl = (player)self;
|
||||
|
||||
static void displacerball_touch(void)
|
||||
{
|
||||
#ifdef SERVER
|
||||
if (other.flags & FL_CLIENT) {
|
||||
w_displacer_teleport(other);
|
||||
}
|
||||
Damage_Radius(self.origin, self.owner, 250, 250 * 2.5f, TRUE, WEAPON_DISPLACER);
|
||||
sound(self, 1, "weapons/displacer_impact.wav", 1, ATTN_NORM);
|
||||
#endif
|
||||
remove(self);
|
||||
}
|
||||
#ifdef CLIENT
|
||||
static float displacerball_predraw(void)
|
||||
|
||||
static void displacerball_animate(void)
|
||||
{
|
||||
self.frame++;
|
||||
|
||||
addentity(self);
|
||||
return PREDRAW_NEXT;
|
||||
if (self.frame > 25)
|
||||
self.frame = 0;
|
||||
|
||||
self.nextthink = time + 0.1f;
|
||||
}
|
||||
#endif
|
||||
|
||||
Weapons_MakeVectors();
|
||||
entity ball = spawn();
|
||||
|
||||
#ifdef CLIENT
|
||||
setmodel(ball, "sprites/exit1.spr");
|
||||
ball.drawmask = MASK_ENGINE;
|
||||
ball.predraw = displacerball_predraw;
|
||||
#endif
|
||||
|
||||
setmodel(ball, "sprites/exit1.spr");
|
||||
setorigin(ball, Weapons_GetCameraPos() + (v_forward * 16));
|
||||
ball.owner = self;
|
||||
ball.velocity = v_forward * 500;
|
||||
|
@ -171,9 +167,10 @@ w_displacer_fireball(void)
|
|||
ball.solid = SOLID_BBOX;
|
||||
ball.angles = vectoangles(ball.velocity);
|
||||
ball.touch = displacerball_touch;
|
||||
ball.effects = EF_ADDITIVE;
|
||||
ball.think = displacerball_animate;
|
||||
ball.nextthink = time + 0.1f;
|
||||
setsize(ball, [0,0,0], [0,0,0]);
|
||||
|
||||
#ifdef SERVER
|
||||
sound(pl, CHAN_WEAPON, "weapons/displacer_fire.wav", 1, ATTN_NORM);
|
||||
#endif
|
||||
}
|
||||
|
@ -192,12 +189,14 @@ w_displacer_release(void)
|
|||
w_displacer_fireball();
|
||||
pl.mode_displacer = 0;
|
||||
pl.w_idle_next = pl.w_attack_next = 1.0f;
|
||||
pl.ammo_uranium -= 20;
|
||||
return;
|
||||
} else if (pl.mode_displacer == 2) {
|
||||
Weapons_ViewAnimation(DISP_FIRE);
|
||||
w_displacer_teleport(pl);
|
||||
pl.mode_displacer = 0;
|
||||
pl.w_idle_next = pl.w_attack_next = 1.0f;
|
||||
pl.ammo_uranium -= 60;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -207,7 +206,7 @@ w_displacer_release(void)
|
|||
} else {
|
||||
Weapons_ViewAnimation(DISP_IDLE2);
|
||||
}
|
||||
|
||||
|
||||
pl.w_idle_next = 3.0f;
|
||||
}
|
||||
|
||||
|
@ -221,15 +220,9 @@ w_displacer_primary(void)
|
|||
}
|
||||
|
||||
/* ammo check */
|
||||
#ifdef CLIENT
|
||||
if (pl.ammo_uranium < 20) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (pl.ammo_uranium < 20) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* we're already in spinning mode */
|
||||
if (pl.mode_displacer > 0) {
|
||||
|
@ -256,16 +249,9 @@ w_displacer_secondary(void)
|
|||
return;
|
||||
}
|
||||
|
||||
/* ammo check */
|
||||
#ifdef CLIENT
|
||||
if (pl.ammo_uranium < 60) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (pl.ammo_uranium < 60) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* we're already in spinning mode */
|
||||
if (pl.mode_displacer > 0) {
|
||||
|
@ -329,6 +315,16 @@ void
|
|||
w_displacer_hudpic(int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
player pl = (player)self;
|
||||
vector hud_col;
|
||||
|
||||
if (pl.ammo_uranium == 0)
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_uranium, MAX_A_URANIUM, a);
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
|
@ -336,7 +332,7 @@ w_displacer_hudpic(int selected, vector pos, float a)
|
|||
"sprites/640hudof02.spr_0.tga",
|
||||
[0,180/256],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
|
@ -347,7 +343,7 @@ w_displacer_hudpic(int selected, vector pos, float a)
|
|||
"sprites/640hudof01.spr_0.tga",
|
||||
[0,180/256],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
|
@ -358,7 +354,7 @@ w_displacer_hudpic(int selected, vector pos, float a)
|
|||
weapon_t w_displacer =
|
||||
{
|
||||
.name = "displacer",
|
||||
.id = ITEM_DISPLACER,
|
||||
.id = ITEM_DISPLACER,
|
||||
.slot = 5,
|
||||
.slot_pos = 1,
|
||||
.draw = w_displacer_draw,
|
||||
|
|
|
@ -61,8 +61,8 @@ w_eagle_pickup(int new, int startammo)
|
|||
if (new) {
|
||||
pl.eagle_mag = 7;
|
||||
} else {
|
||||
if (pl.ammo_357 < 36) {
|
||||
pl.ammo_357 = bound(0, pl.ammo_357 + 7, 36);
|
||||
if (pl.ammo_357 < MAX_A_357) {
|
||||
pl.ammo_357 = bound(0, pl.ammo_357 + 7, MAX_A_357);
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -344,6 +344,14 @@ void
|
|||
w_eagle_hudpic(int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
player pl = (player)self;
|
||||
vector hud_col;
|
||||
|
||||
if (pl.eagle_mag == 0 && pl.ammo_357 == 0)
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
|
@ -367,13 +375,15 @@ w_eagle_hudpic(int selected, vector pos, float a)
|
|||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
}
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_357, MAX_A_357, a);
|
||||
#endif
|
||||
}
|
||||
|
||||
weapon_t w_eagle =
|
||||
{
|
||||
.name = "eagle",
|
||||
.id = ITEM_EAGLE,
|
||||
.id = ITEM_EAGLE,
|
||||
.slot = 1,
|
||||
.slot_pos = 2,
|
||||
.draw = w_eagle_draw,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
@ -60,8 +60,8 @@ w_m249_pickup(int new, int startammo)
|
|||
if (new) {
|
||||
pl.m249_mag = 50;
|
||||
} else {
|
||||
if (pl.ammo_556 < 200) {
|
||||
pl.ammo_556 = bound(0, pl.ammo_556 + 50, 200);
|
||||
if (pl.ammo_556 < MAX_A_556) {
|
||||
pl.ammo_556 = bound(0, pl.ammo_556 + 50, MAX_A_556);
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -283,6 +283,16 @@ void
|
|||
w_m249_hudpic(int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
player pl = (player)self;
|
||||
vector hud_col;
|
||||
|
||||
if (pl.m249_mag == 0 && pl.ammo_556 == 0)
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_556, MAX_A_556, a);
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
|
@ -290,7 +300,7 @@ w_m249_hudpic(int selected, vector pos, float a)
|
|||
"sprites/640hudof02.spr_0.tga",
|
||||
[0,135/256],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
|
@ -301,7 +311,7 @@ w_m249_hudpic(int selected, vector pos, float a)
|
|||
"sprites/640hudof01.spr_0.tga",
|
||||
[0,135/256],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -39,8 +39,8 @@ w_penguin_pickup(int new, int startammo)
|
|||
#ifdef SERVER
|
||||
player pl = (player)self;
|
||||
|
||||
if (pl.ammo_penguin < 9) {
|
||||
pl.ammo_penguin = bound(0, pl.ammo_penguin + 3, 9);
|
||||
if (pl.ammo_penguin < MAX_A_PENGUIN) {
|
||||
pl.ammo_penguin = bound(0, pl.ammo_penguin + 3, MAX_A_PENGUIN);
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -279,7 +279,7 @@ w_penguin_precache(void)
|
|||
void
|
||||
w_penguin_updateammo(player pl)
|
||||
{
|
||||
Weapons_UpdateAmmo(pl, __NULL__, pl.ammo_penguin, __NULL__);
|
||||
Weapons_UpdateAmmo(pl, -1, pl.ammo_penguin, -1);
|
||||
}
|
||||
|
||||
string
|
||||
|
@ -321,14 +321,24 @@ void
|
|||
w_penguin_hudpic(int s, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
player pl = (player)self;
|
||||
vector hud_col;
|
||||
|
||||
if (pl.ammo_penguin == 0)
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_penguin, MAX_A_PENGUIN, a);
|
||||
|
||||
if (s) {
|
||||
drawsubpic(pos, [170,45], "sprites/640hudof04.spr_0.tga",
|
||||
[0,180/256], [170/256,45/256],
|
||||
g_hud_color, a, DRAWFLAG_ADDITIVE);
|
||||
hud_col, a, DRAWFLAG_ADDITIVE);
|
||||
} else {
|
||||
drawsubpic(pos, [170,45], "sprites/640hudof03.spr_0.tga",
|
||||
[0,180/256], [170/256,45/256],
|
||||
g_hud_color, a, DRAWFLAG_ADDITIVE);
|
||||
hud_col, a, DRAWFLAG_ADDITIVE);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -61,7 +61,7 @@ w_shockrifle_pickup(int new, int startammo)
|
|||
|
||||
/* only pick it up once */
|
||||
if (new) {
|
||||
pl.ammo_shock = 10;
|
||||
pl.ammo_shock = MAX_A_SHOCK;
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
@ -150,18 +150,10 @@ w_shockrifle_release(void)
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
if (pl.ammo_shock < 10) {
|
||||
pl.ammo_shock = bound(0, pl.ammo_shock + 1, 10);
|
||||
if (pl.ammo_shock < MAX_A_SHOCK) {
|
||||
pl.ammo_shock = bound(0, pl.ammo_shock + 1, MAX_A_SHOCK);
|
||||
pl.w_idle_next = 0.35f;
|
||||
}
|
||||
#else
|
||||
if (pl.ammo_shock < 10) {
|
||||
pl.ammo_shock = bound(0, pl.ammo_shock + 1, 10);
|
||||
Weapons_UpdateAmmo(pl, -1, pl.ammo_shock, -1);
|
||||
pl.w_idle_next = 0.35f;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (pl.w_idle_next > 0.0) {
|
||||
return;
|
||||
|
@ -185,17 +177,10 @@ w_shockrifle_primary(void)
|
|||
}
|
||||
|
||||
/* Ammo check */
|
||||
#ifdef CLIENT
|
||||
if (pl.ammo_shock <= 0) {
|
||||
w_shockrifle_release();
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (pl.ammo_shock <= 0) {
|
||||
w_shockrifle_release();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef SERVER
|
||||
|
@ -264,6 +249,16 @@ void
|
|||
w_shockrifle_hudpic(int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
player pl = (player)self;
|
||||
vector hud_col;
|
||||
|
||||
if (pl.ammo_shock == 0)
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_shock, MAX_A_SHOCK, a);
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
|
@ -271,7 +266,7 @@ w_shockrifle_hudpic(int selected, vector pos, float a)
|
|||
"sprites/640hudof04.spr_0.tga",
|
||||
[0,45/256],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
|
@ -282,7 +277,7 @@ w_shockrifle_hudpic(int selected, vector pos, float a)
|
|||
"sprites/640hudof03.spr_0.tga",
|
||||
[0,45/256],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
|
@ -293,7 +288,7 @@ w_shockrifle_hudpic(int selected, vector pos, float a)
|
|||
weapon_t w_shockrifle =
|
||||
{
|
||||
.name = "shockrifle",
|
||||
.id = ITEM_SHOCKRIFLE,
|
||||
.id = ITEM_SHOCKRIFLE,
|
||||
.slot = 6,
|
||||
.slot_pos = 1,
|
||||
.draw = w_shockrifle_draw,
|
||||
|
|
|
@ -58,8 +58,8 @@ w_sniperrifle_pickup(int new, int startammo)
|
|||
if (new) {
|
||||
pl.sniper_mag = 5;
|
||||
} else {
|
||||
if (pl.ammo_762 < 15) {
|
||||
pl.ammo_762 = bound(0, pl.ammo_762 + 5, 15);
|
||||
if (pl.ammo_762 < MAX_A_762) {
|
||||
pl.ammo_762 = bound(0, pl.ammo_762 + 5, MAX_A_762);
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ w_sniperrifle_pickup(int new, int startammo)
|
|||
void
|
||||
w_sniperrifle_updateammo(player pl)
|
||||
{
|
||||
Weapons_UpdateAmmo(pl, pl.sniper_mag, pl.ammo_762, __NULL__);
|
||||
Weapons_UpdateAmmo(pl, pl.sniper_mag, pl.ammo_762, -1);
|
||||
}
|
||||
|
||||
string
|
||||
|
@ -99,7 +99,7 @@ w_sniperrifle_draw(void)
|
|||
Weapons_ViewAnimation(SNIPER_DRAW);
|
||||
#ifdef SERVER
|
||||
player pl = (player)self;
|
||||
Weapons_UpdateAmmo(pl, pl.sniper_mag, pl.ammo_762, __NULL__);
|
||||
Weapons_UpdateAmmo(pl, pl.sniper_mag, pl.ammo_762, -1);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -277,10 +277,20 @@ void
|
|||
w_sniperrifle_hudpic(int s, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
player pl = (player)self;
|
||||
vector hud_col;
|
||||
|
||||
if (pl.sniper_mag == 0 && pl.ammo_762 == 0)
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_762, MAX_A_762, a);
|
||||
|
||||
if (s) {
|
||||
drawsubpic(pos, [170,45], "sprites/640hudof04.spr_0.tga", [0,135/256], [170/256,45/256], g_hud_color, a, DRAWFLAG_ADDITIVE);
|
||||
drawsubpic(pos, [170,45], "sprites/640hudof04.spr_0.tga", [0,135/256], [170/256,45/256], hud_col, a, DRAWFLAG_ADDITIVE);
|
||||
} else {
|
||||
drawsubpic(pos, [170,45], "sprites/640hudof03.spr_0.tga", [0,135/256], [170/256,45/256], g_hud_color, a, DRAWFLAG_ADDITIVE);
|
||||
drawsubpic(pos, [170,45], "sprites/640hudof03.spr_0.tga", [0,135/256], [170/256,45/256], hud_col, a, DRAWFLAG_ADDITIVE);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -190,8 +190,8 @@ w_sporelauncher_pickup(int new, int startammo)
|
|||
if (new) {
|
||||
pl.sporelauncher_mag = 5;
|
||||
} else {
|
||||
if (pl.ammo_spore < 20) {
|
||||
pl.ammo_spore = bound(0, pl.ammo_spore + 5, 20);
|
||||
if (pl.ammo_spore < MAX_A_SPORE) {
|
||||
pl.ammo_spore = bound(0, pl.ammo_spore + 5, MAX_A_SPORE);
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -422,6 +422,16 @@ void
|
|||
w_sporelauncher_hudpic(int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
player pl = (player)self;
|
||||
vector hud_col;
|
||||
|
||||
if (pl.sporelauncher_mag == 0 && pl.ammo_spore == 0)
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_spore, MAX_A_SPORE, a);
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
|
@ -429,7 +439,7 @@ w_sporelauncher_hudpic(int selected, vector pos, float a)
|
|||
"sprites/640hudof04.spr_0.tga",
|
||||
[0,0],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
|
@ -440,7 +450,7 @@ w_sporelauncher_hudpic(int selected, vector pos, float a)
|
|||
"sprites/640hudof03.spr_0.tga",
|
||||
[0,0],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
|
@ -451,7 +461,7 @@ w_sporelauncher_hudpic(int selected, vector pos, float a)
|
|||
weapon_t w_sporelauncher =
|
||||
{
|
||||
.name = "sporelauncher",
|
||||
.id = ITEM_SPORELAUNCHER,
|
||||
.id = ITEM_SPORELAUNCHER,
|
||||
.slot = 6,
|
||||
.slot_pos = 0,
|
||||
.draw = w_sporelauncher_draw,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -56,3 +56,10 @@ enum
|
|||
#define MAX_A_TRIPMINE 10
|
||||
#define MAX_A_SNARK 10
|
||||
#define MAX_A_HORNET 8
|
||||
|
||||
/* gearbox */
|
||||
#define MAX_A_556 200
|
||||
#define MAX_A_PENGUIN 9
|
||||
#define MAX_A_SHOCK 10
|
||||
#define MAX_A_762 15
|
||||
#define MAX_A_SPORE 20
|
||||
|
|
|
@ -114,99 +114,7 @@ HLGameRules::LevelNewParms(void)
|
|||
void
|
||||
HLGameRules::PlayerPostFrame(base_player pp)
|
||||
{
|
||||
player pl = (player)pp;
|
||||
Animation_PlayerUpdate();
|
||||
|
||||
if (autocvar_sv_playerkeepalive)
|
||||
pl.SendFlags |= PLAYER_KEEPALIVE;
|
||||
|
||||
if (pl.old_modelindex != pl.modelindex)
|
||||
pl.SendFlags |= PLAYER_MODELINDEX;
|
||||
|
||||
if (pl.old_origin[0] != pl.origin[0])
|
||||
pl.SendFlags |= PLAYER_ORIGIN;
|
||||
|
||||
if (pl.old_origin[1] != pl.origin[1])
|
||||
pl.SendFlags |= PLAYER_ORIGIN;
|
||||
|
||||
if (pl.old_origin[2] != pl.origin[2])
|
||||
pl.SendFlags |= PLAYER_ORIGIN_Z;
|
||||
|
||||
if (pl.old_angles[0] != pl.v_angle[0])
|
||||
pl.SendFlags |= PLAYER_ANGLES_X;
|
||||
|
||||
if (pl.old_angles[1] != pl.angles[1])
|
||||
pl.SendFlags |= PLAYER_ANGLES_Y;
|
||||
|
||||
if (pl.old_angles[2] != pl.angles[2])
|
||||
pl.SendFlags |= PLAYER_ANGLES_Z;
|
||||
|
||||
if (pl.old_velocity[0] != pl.velocity[0])
|
||||
pl.SendFlags |= PLAYER_VELOCITY;
|
||||
|
||||
if (pl.old_velocity[1] != pl.velocity[1])
|
||||
pl.SendFlags |= PLAYER_VELOCITY;
|
||||
|
||||
if (pl.old_velocity[2] != pl.velocity[2])
|
||||
pl.SendFlags |= PLAYER_VELOCITY_Z;
|
||||
|
||||
if (pl.old_flags != pl.flags)
|
||||
pl.SendFlags |= PLAYER_FLAGS;
|
||||
|
||||
if (pl.old_gflags != pl.gflags)
|
||||
pl.SendFlags |= PLAYER_FLAGS;
|
||||
|
||||
if (pl.old_activeweapon != pl.activeweapon)
|
||||
pl.SendFlags |= PLAYER_WEAPON;
|
||||
|
||||
if (pl.old_items != pl.g_items)
|
||||
pl.SendFlags |= PLAYER_ITEMS;
|
||||
|
||||
if (pl.old_health != pl.health)
|
||||
pl.SendFlags |= PLAYER_HEALTH;
|
||||
|
||||
if (pl.old_armor != pl.armor)
|
||||
pl.SendFlags |= PLAYER_ARMOR;
|
||||
|
||||
if (pl.old_movetype != pl.movetype)
|
||||
pl.SendFlags |= PLAYER_MOVETYPE;
|
||||
|
||||
if (pl.old_viewofs != pl.view_ofs[2])
|
||||
pl.SendFlags |= PLAYER_VIEWOFS;
|
||||
|
||||
if (pl.old_baseframe != pl.baseframe)
|
||||
pl.SendFlags |= PLAYER_BASEFRAME;
|
||||
|
||||
if (pl.old_frame != pl.frame)
|
||||
pl.SendFlags |= PLAYER_FRAME;
|
||||
|
||||
if (pl.old_a_ammo1 != pl.a_ammo1)
|
||||
pl.SendFlags |= PLAYER_AMMO1;
|
||||
|
||||
if (pl.old_a_ammo2 != pl.a_ammo2)
|
||||
pl.SendFlags |= PLAYER_AMMO2;
|
||||
|
||||
if (pl.old_a_ammo3 != pl.a_ammo3)
|
||||
pl.SendFlags |= PLAYER_AMMO3;
|
||||
|
||||
pl.old_modelindex = pl.modelindex;
|
||||
pl.old_origin = pl.origin;
|
||||
pl.old_angles = pl.angles;
|
||||
pl.old_angles[0] = pl.v_angle[0];
|
||||
pl.old_velocity = pl.velocity;
|
||||
pl.old_flags = pl.flags;
|
||||
pl.old_gflags = pl.gflags;
|
||||
pl.old_activeweapon = pl.activeweapon;
|
||||
pl.old_items = pl.g_items;
|
||||
pl.old_health = pl.health;
|
||||
pl.old_armor = pl.armor;
|
||||
pl.old_movetype = pl.movetype;
|
||||
pl.old_viewofs = pl.view_ofs[2];
|
||||
pl.old_baseframe = pl.baseframe;
|
||||
pl.old_frame = pl.frame;
|
||||
pl.old_a_ammo1 = pl.a_ammo1;
|
||||
pl.old_a_ammo2 = pl.a_ammo2;
|
||||
pl.old_a_ammo3 = pl.a_ammo3;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -87,7 +87,6 @@ HLMultiplayerRules::PlayerSpawn(base_player pp)
|
|||
pl.velocity = [0,0,0];
|
||||
pl.gravity = __NULL__;
|
||||
pl.frame = 1;
|
||||
pl.SendEntity = Player_SendEntity;
|
||||
pl.SendFlags = UPDATE_ALL;
|
||||
pl.customphysics = Empty;
|
||||
pl.iBleeds = TRUE;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -14,10 +14,67 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
int input_sequence;
|
||||
/* all potential SendFlags bits we can possibly send */
|
||||
enumflags
|
||||
{
|
||||
PLAYER_KEEPALIVE,
|
||||
PLAYER_MODELINDEX,
|
||||
PLAYER_ORIGIN,
|
||||
PLAYER_ORIGIN_Z,
|
||||
PLAYER_ANGLES_X,
|
||||
PLAYER_ANGLES_Y,
|
||||
PLAYER_ANGLES_Z,
|
||||
PLAYER_VELOCITY,
|
||||
PLAYER_VELOCITY_Z,
|
||||
PLAYER_FLAGS,
|
||||
PLAYER_WEAPON,
|
||||
PLAYER_ITEMS,
|
||||
PLAYER_HEALTH,
|
||||
PLAYER_ARMOR,
|
||||
PLAYER_MOVETYPE,
|
||||
PLAYER_VIEWOFS,
|
||||
PLAYER_BASEFRAME,
|
||||
PLAYER_FRAME,
|
||||
PLAYER_AMMO1,
|
||||
PLAYER_AMMO2,
|
||||
PLAYER_AMMO3,
|
||||
PLAYER_UNUSED1,
|
||||
PLAYER_UNUSED2
|
||||
};
|
||||
|
||||
noref int input_sequence;
|
||||
class player:base_player
|
||||
{
|
||||
/* Weapon specific */
|
||||
int ammo_battery; int ammo_battery_net; // beamgun
|
||||
int ammo_chem; int ammo_chem_net; // chemicalgun
|
||||
int ammo_rocket; int ammo_rocket_net; // dml / grenades
|
||||
int ammo_gauss; int ammo_gauss_net; // gauspistol
|
||||
int ammo_minigun; int ammo_minigun_net; // minigun
|
||||
int ammo_buckshot; int ammo_buckshot_net; // shotgun
|
||||
int fist_mode; int fist_mode_net; // knife/fists
|
||||
int gauss_mode; int gauss_mode_net;
|
||||
int shotgun_shells; int shotgun_shells_net;
|
||||
int shotgun_spread; int shotgun_spread_net;
|
||||
|
||||
int dml_launch; int dml_launch_net; /* when fired, when targeted */
|
||||
int dml_flightpath; int dml_flightpath_net; /* guided, homing, spiral */
|
||||
int dml_detonate; int dml_detonate_net; /* on impact, in proximity, timed, when tripped */
|
||||
int dml_payload; int dml_payload_net; /* explosive, cluster */
|
||||
int chem_acid; int chem_acid_net;
|
||||
int chem_neutral; int chem_neutral_net;
|
||||
int chem_base; int chem_base_net;
|
||||
int chem_pressure; int chem_pressure_net;
|
||||
|
||||
int beam_range; int beam_range_net; /* TOUCH TAZER, SHORT TAZER, MEDIUM BEAM, LONG BEAM */
|
||||
int beam_poweracc; int beam_poweracc_net; /* LOW HIGHEST, MEDIUM HIGH, HIGH MEDIUM, HIGHEST LOW */
|
||||
int beam_lightning; int beam_lightning_net; /* BEAM, CHAIN, BALL */
|
||||
int gren_detonate; int gren_detonate_net; /* when tripped (tripmine), timed, on impact */
|
||||
int gren_payload; int gren_payload_net; /* cluster, explosive */
|
||||
|
||||
int menu_active; int menu_active_net;
|
||||
int dml_state; int dml_state_net;
|
||||
|
||||
#ifdef CLIENT
|
||||
/* External model */
|
||||
entity p_model;
|
||||
|
@ -29,35 +86,497 @@ class player:base_player
|
|||
virtual void(void) draw;
|
||||
virtual float() predraw;
|
||||
virtual void(void) postdraw;
|
||||
virtual void(float) ReceiveEntity;
|
||||
virtual void(void) PredictPreFrame;
|
||||
virtual void(void) PredictPostFrame;
|
||||
#else
|
||||
int ammo_battery; // beamgun
|
||||
int ammo_chem; // chemicalgun
|
||||
int ammo_rocket; // dml / grenades
|
||||
int ammo_gauss; // gauspistol
|
||||
int ammo_minigun; // minigun
|
||||
int ammo_buckshot; // shotgun
|
||||
|
||||
int fist_mode; // knife/fists
|
||||
int gauss_mode;
|
||||
int shotgun_shells;
|
||||
int shotgun_spread;
|
||||
|
||||
int dml_launch; /* when fired, when targeted */
|
||||
int dml_flightpath; /* guided, homing, spiral */
|
||||
int dml_detonate; /* on impact, in proximity, timed, when tripped */
|
||||
int dml_payload; /* explosive, cluster */
|
||||
|
||||
int chem_acid;
|
||||
int chem_neutral;
|
||||
int chem_base;
|
||||
int chem_pressure;
|
||||
|
||||
int beam_range; /* TOUCH TAZER, SHORT TAZER, MEDIUM BEAM, LONG BEAM */
|
||||
int beam_poweracc; /* LOW HIGHEST, MEDIUM HIGH, HIGH MEDIUM, HIGHEST LOW */
|
||||
int beam_lightning; /* BEAM, CHAIN, BALL */
|
||||
|
||||
int gren_detonate; /* when tripped (tripmine), timed, on impact */
|
||||
int gren_payload; /* cluster, explosive */
|
||||
virtual void(void) EvaluateEntity;
|
||||
virtual float(entity, float) SendEntity;
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef CLIENT
|
||||
void Weapons_AmmoUpdate(entity);
|
||||
/*
|
||||
=================
|
||||
player::ReceiveEntity
|
||||
=================
|
||||
*/
|
||||
void
|
||||
player::ReceiveEntity(float new)
|
||||
{
|
||||
float fl;
|
||||
if (new == FALSE) {
|
||||
/* Go through all the physics code between the last received frame
|
||||
* and the newest frame and keep the changes this time around instead
|
||||
* of rolling back, because we'll apply the new server-verified values
|
||||
* right after anyway. */
|
||||
/* FIXME: splitscreen */
|
||||
if (entnum == player_localentnum) {
|
||||
/* FIXME: splitscreen */
|
||||
pSeat = &g_seats[0];
|
||||
|
||||
for (int i = sequence+1; i <= servercommandframe; i++) {
|
||||
/* ...maybe the input state is too old? */
|
||||
if (!getinputstate(i)) {
|
||||
break;
|
||||
}
|
||||
input_sequence = i;
|
||||
PMove_Run();
|
||||
}
|
||||
|
||||
/* any differences in things that are read below are now
|
||||
* officially from prediction misses. */
|
||||
}
|
||||
}
|
||||
|
||||
/* seed for our prediction table */
|
||||
sequence = servercommandframe;
|
||||
|
||||
fl = readfloat();
|
||||
|
||||
/* HACK: we need to make this more reliable */
|
||||
if (fl == UPDATE_ALL) {
|
||||
/* we respawned */
|
||||
gravity = __NULL__;
|
||||
}
|
||||
|
||||
if (fl & PLAYER_MODELINDEX)
|
||||
modelindex = readshort();
|
||||
|
||||
if (fl & PLAYER_ORIGIN) {
|
||||
origin[0] = readcoord();
|
||||
origin[1] = readcoord();
|
||||
}
|
||||
|
||||
if (fl & PLAYER_ORIGIN_Z)
|
||||
origin[2] = readcoord();
|
||||
if (fl & PLAYER_ANGLES_X)
|
||||
pitch = readfloat();
|
||||
if (fl & PLAYER_ANGLES_Y)
|
||||
angles[1] = readfloat();
|
||||
if (fl & PLAYER_ANGLES_Z)
|
||||
angles[2] = readfloat();
|
||||
|
||||
if (fl & PLAYER_VELOCITY) {
|
||||
velocity[0] = readcoord();
|
||||
velocity[1] = readcoord();
|
||||
}
|
||||
|
||||
if (fl & PLAYER_VELOCITY_Z)
|
||||
velocity[2] = readcoord();
|
||||
if (fl & PLAYER_FLAGS) {
|
||||
flags = readfloat();
|
||||
gflags = readfloat();
|
||||
}
|
||||
if (fl & PLAYER_WEAPON)
|
||||
activeweapon = readbyte();
|
||||
if (fl & PLAYER_ITEMS)
|
||||
g_items = (__variant)readfloat();
|
||||
if (fl & PLAYER_HEALTH)
|
||||
health = readbyte();
|
||||
if (fl & PLAYER_ARMOR)
|
||||
armor = readbyte();
|
||||
if (fl & PLAYER_MOVETYPE)
|
||||
movetype = readbyte();
|
||||
if (fl & PLAYER_VIEWOFS)
|
||||
view_ofs[2] = readfloat();
|
||||
if (fl & PLAYER_BASEFRAME)
|
||||
baseframe = readbyte();
|
||||
if (fl & PLAYER_FRAME) {
|
||||
frame = readbyte();
|
||||
frame1time = 0.0f;
|
||||
frame2time = 0.0f;
|
||||
}
|
||||
|
||||
if (fl & PLAYER_AMMO1) {
|
||||
ammo_battery = readbyte();
|
||||
ammo_chem = readbyte();
|
||||
ammo_rocket = readbyte();
|
||||
ammo_gauss = readbyte();
|
||||
ammo_minigun = readbyte();
|
||||
ammo_buckshot = readbyte();
|
||||
fist_mode = readbyte();
|
||||
gauss_mode = readbyte();
|
||||
shotgun_shells = readbyte();
|
||||
shotgun_spread = readbyte();
|
||||
}
|
||||
|
||||
if (fl & PLAYER_AMMO2) {
|
||||
dml_launch = readbyte();
|
||||
dml_flightpath = readbyte();
|
||||
dml_detonate = readbyte();
|
||||
dml_payload = readbyte();
|
||||
chem_acid = readbyte();
|
||||
chem_neutral = readbyte();
|
||||
chem_base = readbyte();
|
||||
chem_pressure = readbyte();
|
||||
}
|
||||
|
||||
if (fl & PLAYER_AMMO3) {
|
||||
beam_range = readbyte();
|
||||
beam_poweracc = readbyte();
|
||||
beam_lightning = readbyte();
|
||||
gren_detonate = readbyte();
|
||||
gren_payload = readbyte();
|
||||
menu_active = readbyte();
|
||||
dml_state = readbyte();
|
||||
}
|
||||
|
||||
if (fl & PLAYER_AMMO1 || fl & PLAYER_AMMO2 || fl & PLAYER_AMMO3)
|
||||
Weapons_AmmoUpdate(this);
|
||||
|
||||
setorigin(this, origin);
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
player::PredictPostFrame
|
||||
|
||||
Save the last valid server values away in the _net variants of each field
|
||||
so we can roll them back later.
|
||||
=================
|
||||
*/
|
||||
void
|
||||
player::PredictPreFrame(void)
|
||||
{
|
||||
ammo_battery_net = ammo_battery; // beamgun
|
||||
ammo_chem_net = ammo_chem; // chemicalgun
|
||||
ammo_rocket_net = ammo_rocket; // dml / grenades
|
||||
ammo_gauss_net = ammo_gauss; // gauspistol
|
||||
ammo_minigun_net = ammo_minigun; // minigun
|
||||
ammo_buckshot_net = ammo_buckshot; // shotgun
|
||||
fist_mode_net = fist_mode; // knife/fists
|
||||
gauss_mode_net = gauss_mode;
|
||||
shotgun_shells_net = shotgun_shells;
|
||||
shotgun_spread_net = shotgun_spread;
|
||||
|
||||
dml_launch_net = dml_launch; /* when fired, when targeted */
|
||||
dml_flightpath_net = dml_flightpath; /* guided, homing, spiral */
|
||||
dml_detonate_net = dml_detonate; /* on impact, in proximity, timed, when tripped */
|
||||
dml_payload_net = dml_payload; /* explosive, cluster */
|
||||
chem_acid_net = chem_acid;
|
||||
chem_neutral_net = chem_neutral;
|
||||
chem_base_net = chem_base;
|
||||
chem_pressure_net = chem_pressure;
|
||||
|
||||
beam_range_net = beam_range; /* TOUCH TAZER, SHORT TAZER, MEDIUM BEAM, LONG BEAM */
|
||||
beam_poweracc_net = beam_poweracc; /* LOW HIGHEST, MEDIUM HIGH, HIGH MEDIUM, HIGHEST LOW */
|
||||
beam_lightning_net = beam_lightning; /* BEAM, CHAIN, BALL */
|
||||
gren_detonate_net = gren_detonate; /* when tripped (tripmine), timed, on impact */
|
||||
gren_payload_net = gren_payload; /* cluster, explosive */
|
||||
menu_active_net = menu_active;
|
||||
dml_state_net = dml_state;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
player::PredictPostFrame
|
||||
|
||||
Where we roll back our values to the ones last sent/verified by the server.
|
||||
=================
|
||||
*/
|
||||
void
|
||||
player::PredictPostFrame(void)
|
||||
{
|
||||
ammo_battery = ammo_battery_net; // beamgun
|
||||
ammo_chem = ammo_chem_net; // chemicalgun
|
||||
ammo_rocket = ammo_rocket_net; // dml / grenades
|
||||
ammo_gauss = ammo_gauss_net; // gauspistol
|
||||
ammo_minigun = ammo_minigun_net; // minigun
|
||||
ammo_buckshot = ammo_buckshot_net; // shotgun
|
||||
fist_mode = fist_mode_net; // knife/fists
|
||||
gauss_mode = gauss_mode_net;
|
||||
shotgun_shells = shotgun_shells_net;
|
||||
shotgun_spread = shotgun_spread_net;
|
||||
|
||||
dml_launch = dml_launch_net; /* when fired, when targeted */
|
||||
dml_flightpath = dml_flightpath_net; /* guided, homing, spiral */
|
||||
dml_detonate = dml_detonate_net; /* on impact, in proximity, timed, when tripped */
|
||||
dml_payload = dml_payload_net; /* explosive, cluster */
|
||||
chem_acid = chem_acid_net;
|
||||
chem_neutral = chem_neutral_net;
|
||||
chem_base = chem_base_net;
|
||||
chem_pressure = chem_pressure_net;
|
||||
|
||||
beam_range = beam_range_net; /* TOUCH TAZER, SHORT TAZER, MEDIUM BEAM, LONG BEAM */
|
||||
beam_poweracc = beam_poweracc_net; /* LOW HIGHEST, MEDIUM HIGH, HIGH MEDIUM, HIGHEST LOW */
|
||||
beam_lightning = beam_lightning_net; /* BEAM, CHAIN, BALL */
|
||||
gren_detonate = gren_detonate_net; /* when tripped (tripmine), timed, on impact */
|
||||
gren_payload = gren_payload_net; /* cluster, explosive */
|
||||
menu_active = menu_active_net;
|
||||
}
|
||||
|
||||
#else
|
||||
void
|
||||
player::EvaluateEntity(void)
|
||||
{
|
||||
SendFlags |= PLAYER_KEEPALIVE;
|
||||
|
||||
if (old_modelindex != modelindex)
|
||||
SendFlags |= PLAYER_MODELINDEX;
|
||||
|
||||
if (old_origin[0] != origin[0])
|
||||
SendFlags |= PLAYER_ORIGIN;
|
||||
|
||||
if (old_origin[1] != origin[1])
|
||||
SendFlags |= PLAYER_ORIGIN;
|
||||
|
||||
if (old_origin[2] != origin[2])
|
||||
SendFlags |= PLAYER_ORIGIN_Z;
|
||||
|
||||
if (old_angles[0] != v_angle[0])
|
||||
SendFlags |= PLAYER_ANGLES_X;
|
||||
|
||||
if (old_angles[1] != angles[1])
|
||||
SendFlags |= PLAYER_ANGLES_Y;
|
||||
|
||||
if (old_angles[2] != angles[2])
|
||||
SendFlags |= PLAYER_ANGLES_Z;
|
||||
|
||||
if (old_velocity[0] != velocity[0])
|
||||
SendFlags |= PLAYER_VELOCITY;
|
||||
|
||||
if (old_velocity[1] != velocity[1])
|
||||
SendFlags |= PLAYER_VELOCITY;
|
||||
|
||||
if (old_velocity[2] != velocity[2])
|
||||
SendFlags |= PLAYER_VELOCITY_Z;
|
||||
|
||||
if (old_flags != flags)
|
||||
SendFlags |= PLAYER_FLAGS;
|
||||
|
||||
if (old_gflags != gflags)
|
||||
SendFlags |= PLAYER_FLAGS;
|
||||
|
||||
if (old_activeweapon != activeweapon)
|
||||
SendFlags |= PLAYER_WEAPON;
|
||||
|
||||
if (old_items != g_items)
|
||||
SendFlags |= PLAYER_ITEMS;
|
||||
|
||||
if (old_health != health)
|
||||
SendFlags |= PLAYER_HEALTH;
|
||||
|
||||
if (old_armor != armor)
|
||||
SendFlags |= PLAYER_ARMOR;
|
||||
|
||||
if (old_movetype != movetype)
|
||||
SendFlags |= PLAYER_MOVETYPE;
|
||||
|
||||
if (old_viewofs != view_ofs[2])
|
||||
SendFlags |= PLAYER_VIEWOFS;
|
||||
|
||||
if (old_baseframe != baseframe)
|
||||
SendFlags |= PLAYER_BASEFRAME;
|
||||
|
||||
if (old_frame != frame)
|
||||
SendFlags |= PLAYER_FRAME;
|
||||
|
||||
/* ammo 1 type updates */
|
||||
if (ammo_battery_net == ammo_battery)
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
if (ammo_chem_net == ammo_chem)
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
if (ammo_rocket_net == ammo_rocket)
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
if (ammo_gauss_net == ammo_gauss)
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
if (ammo_minigun_net == ammo_minigun)
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
if (ammo_buckshot_net == ammo_buckshot)
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
if (fist_mode_net == fist_mode)
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
if (gauss_mode_net == gauss_mode)
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
if (shotgun_shells_net == shotgun_shells)
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
if (shotgun_spread_net == shotgun_spread)
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
|
||||
if (dml_launch_net == dml_launch)
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
if (dml_flightpath_net == dml_flightpath)
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
if (dml_detonate_net == dml_detonate)
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
if (dml_payload_net == dml_payload)
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
if (chem_acid_net == chem_acid)
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
if (chem_neutral_net == chem_neutral)
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
if (chem_base_net == chem_base)
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
if (chem_pressure_net == chem_pressure)
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
|
||||
if (beam_range_net == beam_range)
|
||||
SendFlags |= PLAYER_AMMO3;
|
||||
if (beam_poweracc_net == beam_poweracc)
|
||||
SendFlags |= PLAYER_AMMO3;
|
||||
if (beam_lightning_net == beam_lightning)
|
||||
SendFlags |= PLAYER_AMMO3;
|
||||
if (gren_detonate_net == gren_detonate)
|
||||
SendFlags |= PLAYER_AMMO3;
|
||||
if (gren_payload_net == gren_payload)
|
||||
SendFlags |= PLAYER_AMMO3;
|
||||
if (menu_active_net == menu_active)
|
||||
SendFlags |= PLAYER_AMMO3;
|
||||
if (dml_state_net == dml_state)
|
||||
SendFlags |= PLAYER_AMMO3;
|
||||
|
||||
old_modelindex = modelindex;
|
||||
old_origin = origin;
|
||||
old_angles = angles;
|
||||
old_angles[0] = v_angle[0];
|
||||
old_velocity = velocity;
|
||||
old_flags = flags;
|
||||
old_gflags = gflags;
|
||||
old_activeweapon = activeweapon;
|
||||
old_items = g_items;
|
||||
old_health = health;
|
||||
old_armor = armor;
|
||||
old_movetype = movetype;
|
||||
old_viewofs = view_ofs[2];
|
||||
old_baseframe = baseframe;
|
||||
old_frame = frame;
|
||||
|
||||
ammo_battery_net = ammo_battery;
|
||||
ammo_chem_net = ammo_chem;
|
||||
ammo_rocket_net = ammo_rocket;
|
||||
ammo_gauss_net = ammo_gauss;
|
||||
ammo_minigun_net = ammo_minigun;
|
||||
ammo_buckshot_net = ammo_buckshot;
|
||||
fist_mode_net = fist_mode;
|
||||
gauss_mode_net = gauss_mode;
|
||||
shotgun_shells_net = shotgun_shells;
|
||||
shotgun_spread_net = shotgun_spread;
|
||||
|
||||
dml_launch_net = dml_launch;
|
||||
dml_flightpath_net = dml_flightpath;
|
||||
dml_detonate_net = dml_detonate;
|
||||
dml_payload_net = dml_payload;
|
||||
chem_acid_net = chem_acid;
|
||||
chem_neutral_net = chem_neutral;
|
||||
chem_base_net = chem_base;
|
||||
chem_pressure_net = chem_pressure;
|
||||
|
||||
beam_range_net = beam_range;
|
||||
beam_poweracc_net = beam_poweracc;
|
||||
beam_lightning_net = beam_lightning;
|
||||
gren_detonate_net = gren_detonate;
|
||||
gren_payload_net = gren_payload;
|
||||
menu_active_net = menu_active;
|
||||
dml_state_net = dml_state;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
player::SendEntity
|
||||
=================
|
||||
*/
|
||||
float
|
||||
player::SendEntity(entity ePEnt, float fChanged)
|
||||
{
|
||||
if (health <= 0 && ePEnt != this) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (clienttype(ePEnt) != CLIENTTYPE_REAL) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (ePEnt != self) {
|
||||
fChanged &= ~PLAYER_ITEMS;
|
||||
fChanged &= ~PLAYER_HEALTH;
|
||||
fChanged &= ~PLAYER_ARMOR;
|
||||
fChanged &= ~PLAYER_VIEWOFS;
|
||||
fChanged &= ~PLAYER_AMMO1;
|
||||
fChanged &= ~PLAYER_AMMO2;
|
||||
fChanged &= ~PLAYER_AMMO3;
|
||||
}
|
||||
|
||||
WriteByte(MSG_ENTITY, ENT_PLAYER);
|
||||
WriteFloat(MSG_ENTITY, fChanged);
|
||||
|
||||
/* really trying to get our moneys worth with 23 bits of mantissa */
|
||||
if (fChanged & PLAYER_MODELINDEX)
|
||||
WriteShort(MSG_ENTITY, modelindex);
|
||||
if (fChanged & PLAYER_ORIGIN) {
|
||||
WriteCoord(MSG_ENTITY, origin[0]);
|
||||
WriteCoord(MSG_ENTITY, origin[1]);
|
||||
}
|
||||
if (fChanged & PLAYER_ORIGIN_Z)
|
||||
WriteCoord(MSG_ENTITY, origin[2]);
|
||||
if (fChanged & PLAYER_ANGLES_X)
|
||||
WriteFloat(MSG_ENTITY, v_angle[0]);
|
||||
if (fChanged & PLAYER_ANGLES_Y)
|
||||
WriteFloat(MSG_ENTITY, angles[1]);
|
||||
if (fChanged & PLAYER_ANGLES_Z)
|
||||
WriteFloat(MSG_ENTITY, angles[2]);
|
||||
if (fChanged & PLAYER_VELOCITY) {
|
||||
WriteCoord(MSG_ENTITY, velocity[0]);
|
||||
WriteCoord(MSG_ENTITY, velocity[1]);
|
||||
}
|
||||
if (fChanged & PLAYER_VELOCITY_Z)
|
||||
WriteCoord(MSG_ENTITY, velocity[2]);
|
||||
if (fChanged & PLAYER_FLAGS) {
|
||||
WriteFloat(MSG_ENTITY, flags);
|
||||
WriteFloat(MSG_ENTITY, gflags);
|
||||
}
|
||||
if (fChanged & PLAYER_WEAPON)
|
||||
WriteByte(MSG_ENTITY, activeweapon);
|
||||
if (fChanged & PLAYER_ITEMS)
|
||||
WriteFloat(MSG_ENTITY, (__variant)g_items);
|
||||
if (fChanged & PLAYER_HEALTH)
|
||||
WriteByte(MSG_ENTITY, bound(0, health, 255));
|
||||
if (fChanged & PLAYER_ARMOR)
|
||||
WriteByte(MSG_ENTITY, armor);
|
||||
if (fChanged & PLAYER_MOVETYPE)
|
||||
WriteByte(MSG_ENTITY, movetype);
|
||||
if (fChanged & PLAYER_VIEWOFS)
|
||||
WriteFloat(MSG_ENTITY, view_ofs[2]);
|
||||
if (fChanged & PLAYER_BASEFRAME)
|
||||
WriteByte(MSG_ENTITY, baseframe);
|
||||
if (fChanged & PLAYER_FRAME)
|
||||
WriteByte(MSG_ENTITY, frame);
|
||||
|
||||
if (fChanged & PLAYER_AMMO1) {
|
||||
WriteByte(MSG_ENTITY, ammo_battery);
|
||||
WriteByte(MSG_ENTITY, ammo_chem);
|
||||
WriteByte(MSG_ENTITY, ammo_rocket);
|
||||
WriteByte(MSG_ENTITY, ammo_gauss);
|
||||
WriteByte(MSG_ENTITY, ammo_minigun);
|
||||
WriteByte(MSG_ENTITY, ammo_buckshot);
|
||||
WriteByte(MSG_ENTITY, fist_mode);
|
||||
WriteByte(MSG_ENTITY, gauss_mode);
|
||||
WriteByte(MSG_ENTITY, shotgun_shells);
|
||||
WriteByte(MSG_ENTITY, shotgun_spread);
|
||||
}
|
||||
|
||||
if (fChanged & PLAYER_AMMO2) {
|
||||
WriteByte(MSG_ENTITY, dml_launch);
|
||||
WriteByte(MSG_ENTITY, dml_flightpath);
|
||||
WriteByte(MSG_ENTITY, dml_detonate);
|
||||
WriteByte(MSG_ENTITY, dml_payload);
|
||||
WriteByte(MSG_ENTITY, chem_acid);
|
||||
WriteByte(MSG_ENTITY, chem_neutral);
|
||||
WriteByte(MSG_ENTITY, chem_base);
|
||||
WriteByte(MSG_ENTITY, chem_pressure);
|
||||
}
|
||||
|
||||
if (fChanged & PLAYER_AMMO3) {
|
||||
WriteByte(MSG_ENTITY, beam_range);
|
||||
WriteByte(MSG_ENTITY, beam_poweracc);
|
||||
WriteByte(MSG_ENTITY, beam_lightning);
|
||||
WriteByte(MSG_ENTITY, gren_detonate);
|
||||
WriteByte(MSG_ENTITY, gren_payload);
|
||||
WriteByte(MSG_ENTITY, menu_active);
|
||||
WriteByte(MSG_ENTITY, dml_state);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -95,8 +95,8 @@ w_dml_release(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (pl.a_ammo3 == DS_RELOADING) {
|
||||
if (pl.a_ammo1 == 1) {
|
||||
if (pl.dml_state == DS_RELOADING) {
|
||||
if (pl.menu_active == 1) {
|
||||
Weapons_ViewAnimation(DML_RELOADRIGHT);
|
||||
} else {
|
||||
Weapons_ViewAnimation(DML_RELOADLEFT);
|
||||
|
@ -106,7 +106,7 @@ w_dml_release(void)
|
|||
#endif
|
||||
pl.w_attack_next = 1.6f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
pl.a_ammo3 = DS_FULL;
|
||||
pl.dml_state = DS_FULL;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -135,8 +135,8 @@ w_dml_primary(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (pl.a_ammo1 > 0) {
|
||||
pl.a_ammo1 = 0;
|
||||
if (pl.menu_active > 0) {
|
||||
pl.menu_active = 0;
|
||||
pl.gflags |= GF_SEMI_TOGGLED;
|
||||
Weapons_ViewAnimation(DML_CUSTOMIZE);
|
||||
#ifdef SERVER
|
||||
|
@ -151,7 +151,7 @@ w_dml_primary(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (pl.a_ammo3 == DS_RELOADING) {
|
||||
if (pl.dml_state == DS_RELOADING) {
|
||||
w_dml_release();
|
||||
return;
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ w_dml_primary(void)
|
|||
Weapons_ViewAnimation(DML_FIRE);
|
||||
pl.w_attack_next = 1.222222f;
|
||||
pl.w_idle_next = 1.222222f;
|
||||
pl.a_ammo3 = DS_RELOADING;
|
||||
pl.dml_state = DS_RELOADING;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -184,19 +184,17 @@ w_dml_secondary(void)
|
|||
}
|
||||
|
||||
/* activate menu */
|
||||
if (pl.a_ammo1 <= 0 || pl.a_ammo1 == DMENU_PAYLOAD) {
|
||||
pl.a_ammo1 = 1;
|
||||
if (pl.menu_active <= 0 || pl.menu_active == DMENU_PAYLOAD) {
|
||||
pl.menu_active = 1;
|
||||
} else {
|
||||
pl.a_ammo1 = bound(DMENU_LAUNCH, pl.a_ammo1 + 1, DMENU_PAYLOAD);
|
||||
pl.menu_active = bound(DMENU_LAUNCH, pl.menu_active + 1, DMENU_PAYLOAD);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
w_dml_updateammo(player pl)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Weapons_UpdateAmmo(pl, -1, pl.ammo_rockets, -1);
|
||||
#endif
|
||||
Weapons_UpdateAmmo(pl, -1, pl.ammo_rocket, -1);
|
||||
}
|
||||
|
||||
string
|
||||
|
@ -286,12 +284,12 @@ w_dml_hud(void)
|
|||
);
|
||||
|
||||
/* menu */
|
||||
if (pl.a_ammo1 > 0) {
|
||||
if (pl.menu_active > 0) {
|
||||
vector col1, col2, col3, col4;
|
||||
string txt1, txt2, txt3, txt4;
|
||||
|
||||
col1 = col2 = col3 = col4 = [1,1,1];
|
||||
switch (pl.a_ammo1) {
|
||||
switch (pl.menu_active) {
|
||||
case DMENU_LAUNCH:
|
||||
col1 = [0,1,0];
|
||||
break;
|
||||
|
@ -412,11 +410,11 @@ weapon_dml(void)
|
|||
int
|
||||
w_dml_hudforward(player pl)
|
||||
{
|
||||
if (pl.a_ammo1 <= 0) {
|
||||
if (pl.menu_active <= 0) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
switch (pl.a_ammo1) {
|
||||
switch (pl.menu_active) {
|
||||
case DMENU_LAUNCH:
|
||||
sendevent("w_dml_launch", "i", 1i);
|
||||
break;
|
||||
|
@ -435,11 +433,11 @@ w_dml_hudforward(player pl)
|
|||
int
|
||||
w_dml_hudback(player pl)
|
||||
{
|
||||
if (pl.a_ammo1 <= 0) {
|
||||
if (pl.menu_active <= 0) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
switch (pl.a_ammo1) {
|
||||
switch (pl.menu_active) {
|
||||
case DMENU_LAUNCH:
|
||||
sendevent("w_dml_launch", "i", -1i);
|
||||
break;
|
||||
|
|
|
@ -49,7 +49,7 @@ w_minigun_release(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (pl.a_ammo3 == 1) {
|
||||
if (pl.menu_active == 1) {
|
||||
Weapons_ViewAnimation(MG_IDLELOOP);
|
||||
pl.w_idle_next = 0.666667f;
|
||||
return;
|
||||
|
@ -78,18 +78,10 @@ w_minigun_primary(void)
|
|||
if (pl.w_attack_next) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo2 <= 0) {
|
||||
w_minigun_release();
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (pl.ammo_minigun <= 0) {
|
||||
w_minigun_release();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
src = Weapons_GetCameraPos();
|
||||
|
||||
|
@ -100,13 +92,9 @@ w_minigun_primary(void)
|
|||
Weapons_ViewPunchAngle([-2,0,0]);
|
||||
#endif
|
||||
|
||||
#ifdef CLIENT
|
||||
pl.a_ammo2--;
|
||||
#else
|
||||
pl.ammo_minigun--;
|
||||
#endif
|
||||
|
||||
if (pl.a_ammo3 == 1) {
|
||||
if (pl.menu_active == 1) {
|
||||
#ifdef CLIENT
|
||||
Weapons_ViewAnimation(MG_FIRELOOP);
|
||||
#else
|
||||
|
@ -135,19 +123,19 @@ w_minigun_secondary(void)
|
|||
}
|
||||
|
||||
#ifdef SERVER
|
||||
if (pl.a_ammo3 == 0) {
|
||||
if (pl.menu_active == 0) {
|
||||
Sound_Play(pl, 8, "weapon_minigun.spinup");
|
||||
} else {
|
||||
Sound_Play(pl, 8, "weapon_minigun.spindown");
|
||||
}
|
||||
#else
|
||||
if (pl.a_ammo3 == 0) {
|
||||
if (pl.menu_active == 0) {
|
||||
Weapons_ViewAnimation(MG_SPINUP);
|
||||
} else {
|
||||
Weapons_ViewAnimation(MG_SPINDOWN);
|
||||
}
|
||||
#endif
|
||||
pl.a_ammo3 = 1 - pl.a_ammo3;
|
||||
pl.menu_active = 1 - pl.menu_active;
|
||||
|
||||
pl.w_attack_next = 2.0f;
|
||||
pl.w_idle_next = 2.0f;
|
||||
|
@ -156,9 +144,7 @@ w_minigun_secondary(void)
|
|||
void
|
||||
w_minigun_updateammo(player pl)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Weapons_UpdateAmmo(pl, -1, pl.ammo_minigun, -1);
|
||||
#endif
|
||||
}
|
||||
|
||||
string
|
||||
|
@ -265,7 +251,7 @@ w_minigun_precache(void)
|
|||
weapon_t w_minigun =
|
||||
{
|
||||
.name = "minigun",
|
||||
.id = ITEM_MINIGUN,
|
||||
.id = ITEM_MINIGUN,
|
||||
.slot = 2,
|
||||
.slot_pos = 1,
|
||||
.draw = w_minigun_draw,
|
||||
|
|
|
@ -72,8 +72,8 @@ w_shotgun_primary(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (pl.a_ammo1 > 0) {
|
||||
pl.a_ammo1 = 0;
|
||||
if (pl.menu_active > 0) {
|
||||
pl.menu_active = 0;
|
||||
pl.gflags |= GF_SEMI_TOGGLED;
|
||||
Weapons_ViewAnimation(SHOTGUN_CUSTOMIZE);
|
||||
pl.w_attack_next = 2.25f;
|
||||
|
@ -146,13 +146,13 @@ w_shotgun_secondary(void)
|
|||
}
|
||||
|
||||
/* activate menu */
|
||||
if (pl.a_ammo1 <= 0) {
|
||||
pl.a_ammo1 = 1;
|
||||
if (pl.menu_active <= 0) {
|
||||
pl.menu_active = 1;
|
||||
} else {
|
||||
if (pl.a_ammo1 == 1) {
|
||||
pl.a_ammo1 = 2;
|
||||
if (pl.menu_active == 1) {
|
||||
pl.menu_active = 2;
|
||||
} else {
|
||||
pl.a_ammo1 = 1;
|
||||
pl.menu_active = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -186,9 +186,7 @@ w_shotgun_release(void)
|
|||
void
|
||||
w_shotgun_updateammo(player pl)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Weapons_UpdateAmmo(pl, -1, pl.ammo_buckshot, -1);
|
||||
#endif
|
||||
}
|
||||
|
||||
string
|
||||
|
@ -258,12 +256,12 @@ w_shotgun_hud(void)
|
|||
HUD_DrawAmmo2();
|
||||
|
||||
/* menu */
|
||||
if (pl.a_ammo1 > 0) {
|
||||
if (pl.menu_active > 0) {
|
||||
vector col1, col2;
|
||||
string shellstr, spreadstr;
|
||||
|
||||
col1 = col2 = [1,1,1];
|
||||
switch (pl.a_ammo1) {
|
||||
switch (pl.menu_active) {
|
||||
case SMENU_SHELLS:
|
||||
col1 = [0,1,0];
|
||||
break;
|
||||
|
@ -323,15 +321,13 @@ w_shotgun_precache(void)
|
|||
|
||||
#ifdef SERVER
|
||||
Sound_Precache("weapon_shotgun.fire");
|
||||
clientstat(40, EV_INTEGER, player::shotgun_shells);
|
||||
clientstat(41, EV_INTEGER, player::shotgun_spread);
|
||||
#endif
|
||||
}
|
||||
|
||||
weapon_t w_shotgun =
|
||||
{
|
||||
.name = "shotgun",
|
||||
.id = ITEM_SHOTGUN,
|
||||
.id = ITEM_SHOTGUN,
|
||||
.slot = 2,
|
||||
.slot_pos = 0,
|
||||
.draw = w_shotgun_draw,
|
||||
|
@ -364,11 +360,11 @@ weapon_shotgun(void)
|
|||
int
|
||||
w_shotgun_hudforward(player pl)
|
||||
{
|
||||
if (pl.a_ammo1 <= 0) {
|
||||
if (pl.menu_active <= 0) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
switch (pl.a_ammo1) {
|
||||
switch (pl.menu_active) {
|
||||
case SMENU_SHELLS:
|
||||
sendevent("w_shot_shell", "i", 1i);
|
||||
break;
|
||||
|
@ -382,11 +378,11 @@ w_shotgun_hudforward(player pl)
|
|||
int
|
||||
w_shotgun_hudback(player pl)
|
||||
{
|
||||
if (pl.a_ammo1 <= 0) {
|
||||
if (pl.menu_active <= 0) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
switch (pl.a_ammo1) {
|
||||
switch (pl.menu_active) {
|
||||
case SMENU_SHELLS:
|
||||
sendevent("w_shot_shell", "i", -1i);
|
||||
break;
|
||||
|
|
|
@ -250,13 +250,7 @@ w_cannon_hudpic(int s, vector pos, float a)
|
|||
drawsubpic(pos, [170,45], g_cannon_spr, [0,0], [170/256,45/256], g_hud_color, a, DRAWFLAG_ADDITIVE);
|
||||
}
|
||||
|
||||
if (pl.ammo_buckshot <= 0)
|
||||
return;
|
||||
|
||||
float perc;
|
||||
perc = pl.ammo_buckshot / MAX_A_BUCKSHOT;
|
||||
drawfill(pos + [10,0], [20,4], hud_col, a, DRAWFLAG_NORMAL);
|
||||
drawfill(pos + [10,0], [20 * perc,4], [0,1,0], a, DRAWFLAG_NORMAL);
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_buckshot, MAX_A_BUCKSHOT, a);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -127,4 +127,5 @@ struct
|
|||
void HUD_DrawAmmo1(void);
|
||||
void HUD_DrawAmmo2(void);
|
||||
void HUD_DrawAmmo3(void);
|
||||
void HUD_DrawAmmoBar(vector pos, float val, float max, float a);
|
||||
void HUD_WeaponPickupNotify(int);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -292,6 +292,19 @@ HUD_DrawAmmo3(void)
|
|||
HUD_DrawNums(pl.a_ammo3, pos, pSeat->m_flAmmo3Alpha, g_hud_color);
|
||||
}
|
||||
|
||||
/* ammo bar */
|
||||
void
|
||||
HUD_DrawAmmoBar(vector pos, float val, float max, float a)
|
||||
{
|
||||
if (val <= 0)
|
||||
return;
|
||||
|
||||
float perc;
|
||||
perc = val / max;
|
||||
drawfill(pos + [10,0], [20,4], g_hud_color, a, DRAWFLAG_NORMAL);
|
||||
drawfill(pos + [10,0], [20 * perc,4], [0,1,0], a, DRAWFLAG_NORMAL);
|
||||
}
|
||||
|
||||
/* flashlight/torch indicator */
|
||||
void
|
||||
HUD_DrawFlashlight(void)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -360,13 +360,7 @@ w_crossbow_hudpic(int selected, vector pos, float a)
|
|||
);
|
||||
}
|
||||
|
||||
if (pl.ammo_bolt <= 0)
|
||||
return;
|
||||
|
||||
float perc;
|
||||
perc = pl.ammo_bolt / MAX_A_BOLT;
|
||||
drawfill(pos + [10,0], [20,4], hud_col, a, DRAWFLAG_NORMAL);
|
||||
drawfill(pos + [10,0], [20 * perc,4], [0,1,0], a, DRAWFLAG_NORMAL);
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_bolt, MAX_A_BOLT, a);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -296,13 +296,7 @@ void w_egon_hudpic(int selected, vector pos, float a)
|
|||
drawsubpic(pos, [170,45], g_hud2_spr, [0,135/256], [170/256,45/256], hud_col, a, DRAWFLAG_ADDITIVE);
|
||||
}
|
||||
|
||||
if (pl.ammo_uranium <= 0)
|
||||
return;
|
||||
|
||||
float perc;
|
||||
perc = pl.ammo_uranium / MAX_A_URANIUM;
|
||||
drawfill(pos + [10,0], [20,4], hud_col, a, DRAWFLAG_NORMAL);
|
||||
drawfill(pos + [10,0], [20 * perc,4], [0,1,0], a, DRAWFLAG_NORMAL);
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_uranium, MAX_A_URANIUM, a);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -469,13 +469,7 @@ void w_gauss_hudpic(int selected, vector pos, float a)
|
|||
);
|
||||
}
|
||||
|
||||
if (pl.ammo_uranium <= 0)
|
||||
return;
|
||||
|
||||
float perc;
|
||||
perc = pl.ammo_uranium / MAX_A_URANIUM;
|
||||
drawfill(pos + [10,0], [20,4], hud_col, a, DRAWFLAG_NORMAL);
|
||||
drawfill(pos + [10,0], [20 * perc,4], [0,1,0], a, DRAWFLAG_NORMAL);
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_uranium, MAX_A_URANIUM, a);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -341,13 +341,7 @@ w_glock_hudpic(int selected, vector pos, float a)
|
|||
);
|
||||
}
|
||||
|
||||
if (pl.ammo_9mm <= 0)
|
||||
return;
|
||||
|
||||
float perc;
|
||||
perc = pl.ammo_9mm / MAX_A_9MM;
|
||||
drawfill(pos + [10,0], [20,4], hud_col, a, DRAWFLAG_NORMAL);
|
||||
drawfill(pos + [10,0], [20 * perc,4], [0,1,0], a, DRAWFLAG_NORMAL);
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_9mm, MAX_A_9MM, a);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -237,13 +237,7 @@ w_handgrenade_hudpic(int selected, vector pos, float a)
|
|||
drawsubpic(pos, [170,45], g_hud3_spr, [0,0], [170/256,45/256], g_hud_color, a, DRAWFLAG_ADDITIVE);
|
||||
}
|
||||
|
||||
if (pl.ammo_handgrenade <= 0)
|
||||
return;
|
||||
|
||||
float perc;
|
||||
perc = pl.ammo_handgrenade / MAX_A_HANDGRENADE;
|
||||
drawfill(pos + [10,0], [20,4], g_hud_color, a, DRAWFLAG_NORMAL);
|
||||
drawfill(pos + [10,0], [20 * perc,4], [0,1,0], a, DRAWFLAG_NORMAL);
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_handgrenade, MAX_A_HANDGRENADE, a);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -287,13 +287,7 @@ w_hornetgun_hudpic(int selected, vector pos, float a)
|
|||
);
|
||||
}
|
||||
|
||||
if (pl.ammo_hornet <= 0)
|
||||
return;
|
||||
|
||||
float perc;
|
||||
perc = pl.ammo_hornet / MAX_A_HORNET;
|
||||
drawfill(pos + [10,0], [20,4], g_hud_color, a, DRAWFLAG_NORMAL);
|
||||
drawfill(pos + [10,0], [20 * perc,4], [0,1,0], a, DRAWFLAG_NORMAL);
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_hornet, MAX_A_HORNET, a);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -362,19 +362,8 @@ w_mp5_hudpic(int selected, vector pos, float a)
|
|||
);
|
||||
}
|
||||
|
||||
float perc;
|
||||
|
||||
if (pl.ammo_9mm > 0) {
|
||||
perc = pl.ammo_9mm / MAX_A_9MM;
|
||||
drawfill(pos + [10,0], [20,4], hud_col, a, DRAWFLAG_NORMAL);
|
||||
drawfill(pos + [10,0], [20 * perc,4], [0,1,0], a, DRAWFLAG_NORMAL);
|
||||
}
|
||||
|
||||
if (pl.ammo_m203_grenade > 0) {
|
||||
perc = pl.ammo_m203_grenade / MAX_A_M203_GRENADE;
|
||||
drawfill(pos + [35,0], [20,4], hud_col, a, DRAWFLAG_NORMAL);
|
||||
drawfill(pos + [35,0], [20 * perc,4], [0,1,0], a, DRAWFLAG_NORMAL);
|
||||
}
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_9mm, MAX_A_9MM, a);
|
||||
HUD_DrawAmmoBar(pos + [25, 0], pl.ammo_m203_grenade, MAX_A_M203_GRENADE, a);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -325,13 +325,7 @@ w_python_hudpic(int selected, vector pos, float a)
|
|||
);
|
||||
}
|
||||
|
||||
if (pl.ammo_357 <= 0)
|
||||
return;
|
||||
|
||||
float perc;
|
||||
perc = pl.ammo_357 / MAX_A_357;
|
||||
drawfill(pos + [10,0], [20,4], hud_col, a, DRAWFLAG_NORMAL);
|
||||
drawfill(pos + [10,0], [20 * perc,4], [0,1,0], a, DRAWFLAG_NORMAL);
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_357, MAX_A_357, a);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -264,13 +264,7 @@ void w_rpg_hudpic(int selected, vector pos, float a)
|
|||
drawsubpic(pos, [170,45], g_hud2_spr, [0,45/256], [170/256,45/256], hud_col, a, DRAWFLAG_ADDITIVE);
|
||||
}
|
||||
|
||||
if (pl.ammo_rocket <= 0)
|
||||
return;
|
||||
|
||||
float perc;
|
||||
perc = pl.ammo_rocket / MAX_A_ROCKET;
|
||||
drawfill(pos + [10,0], [20,4], hud_col, a, DRAWFLAG_NORMAL);
|
||||
drawfill(pos + [10,0], [20 * perc,4], [0,1,0], a, DRAWFLAG_NORMAL);
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_rocket, MAX_A_ROCKET, a);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -338,7 +332,7 @@ void w_rpg_hud(void)
|
|||
weapon_t w_rpg =
|
||||
{
|
||||
.name = "rpg_rocket",
|
||||
.id = ITEM_RPG,
|
||||
.id = ITEM_RPG,
|
||||
.slot = 3,
|
||||
.slot_pos = 0,
|
||||
.draw = w_rpg_draw,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -298,13 +298,7 @@ w_satchel_hudpic(int selected, vector pos, float a)
|
|||
drawsubpic(pos, [170,45], g_hud3_spr, [0,45/256], [170/256,45/256], g_hud_color, a, DRAWFLAG_ADDITIVE);
|
||||
}
|
||||
|
||||
if (pl.ammo_satchel <= 0)
|
||||
return;
|
||||
|
||||
float perc;
|
||||
perc = pl.ammo_satchel / MAX_A_SATCHEL;
|
||||
drawfill(pos + [10,0], [20,4], g_hud_color, a, DRAWFLAG_NORMAL);
|
||||
drawfill(pos + [10,0], [20 * perc,4], [0,1,0], a, DRAWFLAG_NORMAL);
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_satchel, MAX_A_SATCHEL, a);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -283,13 +283,7 @@ void w_shotgun_hudpic(int selected, vector pos, float a)
|
|||
drawsubpic(pos, [170,45], g_hud1_spr, [0,180/256], [170/256,45/256], hud_col, a, DRAWFLAG_ADDITIVE);
|
||||
}
|
||||
|
||||
if (pl.ammo_buckshot <= 0)
|
||||
return;
|
||||
|
||||
float perc;
|
||||
perc = pl.ammo_buckshot / MAX_A_BUCKSHOT;
|
||||
drawfill(pos + [10,0], [20,4], hud_col, a, DRAWFLAG_NORMAL);
|
||||
drawfill(pos + [10,0], [20 * perc,4], [0,1,0], a, DRAWFLAG_NORMAL);
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_buckshot, MAX_A_BUCKSHOT, a);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -290,13 +290,7 @@ void w_snark_hudpic(int selected, vector pos, float a)
|
|||
g_hud_color, a, DRAWFLAG_ADDITIVE);
|
||||
}
|
||||
|
||||
if (pl.ammo_snark <= 0)
|
||||
return;
|
||||
|
||||
float perc;
|
||||
perc = pl.ammo_snark / MAX_A_SNARK;
|
||||
drawfill(pos + [10,0], [20,4], g_hud_color, a, DRAWFLAG_NORMAL);
|
||||
drawfill(pos + [10,0], [20 * perc,4], [0,1,0], a, DRAWFLAG_NORMAL);
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_snark, MAX_A_SNARK, a);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -365,13 +365,7 @@ w_tripmine_hudpic(int selected, vector pos, float a)
|
|||
drawsubpic(pos, [170,45], g_hud3_spr, [0,90/256], [170/256,45/256], g_hud_color, a, DRAWFLAG_ADDITIVE);
|
||||
}
|
||||
|
||||
if (pl.ammo_tripmine <= 0)
|
||||
return;
|
||||
|
||||
float perc;
|
||||
perc = pl.ammo_tripmine / MAX_A_TRIPMINE;
|
||||
drawfill(pos + [10,0], [20,4], g_hud_color, a, DRAWFLAG_NORMAL);
|
||||
drawfill(pos + [10,0], [20 * perc,4], [0,1,0], a, DRAWFLAG_NORMAL);
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_tripmine, MAX_A_TRIPMINE, a);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue