string gg_previous_weapon_picture; ///< Previous weapon picture.
float gg_weapon_change_time; ///< Time when the weapon changed.
-/// \brief Returns the picture of the weapon.
-/// \param[in] weapon Index of the weapon.
-/// \return Picture of the weapon.
-string GG_GetWeaponPicture(int weapon)
-{
- FOREACH(Weapons, it != WEP_Null,
- {
- if (it.m_id == weapon)
- {
- return it.model2;
- }
- });
- return "";
-}
-
void HUD_Mod_GG(vector pos, vector mySize)
{
// Required in each mod function that always shows something.
gg_previous_weapon = gg_current_weapon;
gg_previous_weapon_picture = gg_current_weapon_picture;
gg_current_weapon = stat_weapon;
- gg_current_weapon_picture = GG_GetWeaponPicture(gg_current_weapon);
+ gg_current_weapon_picture = Weapons_from(gg_current_weapon).model2;
gg_weapon_change_time = time;
}
vector pic_pos, pic_size;
return NULL;
}
tokenize_console(gungame_weapons);
- string weapon = argv(floor(level / autocvar_g_gg_kills_per_weapon));
- FOREACH(Weapons, it != WEP_Null,
+ string weapon_name = argv(floor(level / autocvar_g_gg_kills_per_weapon));
+ Weapon weapon = Weapons_fromstr(weapon_name);
+ if (weapon == WEP_Null)
{
- if (it.netname == weapon)
- {
- return it;
- }
- });
- LOG_FATAL("GunGame_GetWeapon: Invalid level or weapon name");
- return NULL;
+ LOG_FATAL("GunGame_GetWeapon: Invalid level or weapon name");
+ }
+ return weapon;
}
/// \brief Returns the player level.