Skip to content

Commit

Permalink
Small improvements on perfomance
Browse files Browse the repository at this point in the history
  • Loading branch information
PerfectScrash committed Feb 18, 2022
1 parent 43f2374 commit eac73b4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ zp_green_deathmsg "1" // Green Deathmsg when player infecting another player [0-
// Hud
// ----------
zp_hud_display "1" // Enable ZP custom HUD display
zp_hud_icons "1" // Display small HUD icons on infection, burning, and freeze events
zp_default_user_hud "0" // Hud mode (0 - Default, 1 - Classic, 2 - Center, 3 - Antrax Style, 4 - Under Radar, 5 - Center Antrax)
zp_hm_hud_color_r "0"
zp_hm_hud_color_g "100" // Human hud color (RGB)
Expand Down Expand Up @@ -273,7 +274,6 @@ zp_infection_screenshake "1" // Screen shake for infected player
zp_infection_sparkle "1" // Light sparkle on infection
zp_infection_tracers "1" // Tracers on infection
zp_infection_particles "1" // Particles on infection
zp_hud_icons "1" // Display small HUD icons on infection, burning, and freeze events
zp_sniper_frag_gore "1" // When killed by a Sniper, Zombies explode
zp_assassin_frag_gore "1" // When killed by an Assassin, Humans are cut in pieces
zp_zombies_aura_size "25" // Aura size of Nemesis/Assassin or a zombie (in zombie madness)
Expand Down
22 changes: 14 additions & 8 deletions addons/amxmodx/scripting/zombie_plague_special_45.sma
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,7 @@ new g_trailSpr[MAX_GRENADES], g_ExplodeSpr[MAX_GRENADES], g_GibSpr[MAX_GRENADES]
new g_hamczbots, g_fwSpawn, g_fwPrecacheSound, g_infbombcounter, g_antidotecounter, g_madnesscounter, g_arrays_created, g_escape_map;
new g_lastplayerleaving, g_switchingteam, g_buyzone_ent, zm_special_enable[MAX_SPECIALS_ZOMBIES], hm_special_enable[MAX_SPECIALS_HUMANS];
new custom_lighting[2], g_custom_light, g_ForwardParameter[64], g_FW_intParam[10], g_AdditionalHudText[500];
#define CheckAllowed(%1) (%1 == 1 || %1 == 2 && !g_escape_map || %1 >= 3 && g_escape_map) // Check if allowed X function with escape map checks

// Message IDs vars
new g_msgScoreInfo, g_msgNVGToggle, g_msgScoreAttrib, g_msgAmmoPickup, g_msgScreenFade, g_msgDeathMsg, g_msgSetFOV, g_msgFlashlight, g_msgFlashBat,
Expand Down Expand Up @@ -2744,7 +2745,9 @@ public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_type) { /
if(!g_allowinfection || fnGetHumans() == 1) return HAM_IGNORED; // Last human or infection not allowed

// Does human armor need to be reduced before infecting?
if(get_pcvar_num(cvar_humanarmor) == 1 || get_pcvar_num(cvar_humanarmor) == 2 && !g_escape_map || get_pcvar_num(cvar_humanarmor) >= 3 && g_escape_map) {
static CvarValue;
CvarValue = get_pcvar_num(cvar_humanarmor)
if(CheckAllowed(CvarValue)) {

static Float:armor; pev(victim, pev_armorvalue, armor) // Get victim armor
if(armor > 0.0) { // If he has some, block the infection and reduce armor instead
Expand Down Expand Up @@ -3313,7 +3316,7 @@ set_player_maxspeed(id) { // Set proper maxspeed for player
if(!g_hclass_i) // No hclass instaled
g_spd[id] = get_pcvar_float(cvar_hm_spd[g_hm_special[id]])

if(cvarWeight == 1 || cvarWeight == 2 && !g_escape_map || cvarWeight >= 3 && g_escape_map)
if(CheckAllowed(cvarWeight))
set_pev(id, pev_maxspeed, g_spd[id] * weapon_spd_multi[g_currentweapon[id]])
else
set_pev(id, pev_maxspeed, g_spd[id])
Expand Down Expand Up @@ -6917,15 +6920,15 @@ load_customization_from_files() {
formatex(szKey, charsmax(szKey), "ENABLE %s", zombie_special_names[i])
amx_load_setting_int(ZP_CUSTOMIZATION_FILE, "Main Configs", szKey, num)

if(num == 1 || num == 2 && !g_escape_map || num >= 3 && g_escape_map) zm_special_enable[i] = true
if(CheckAllowed(num)) zm_special_enable[i] = true
else zm_special_enable[i] = false
}

for(i = 1; i < MAX_SPECIALS_HUMANS; i++) {
num = 0
amx_load_setting_int(ZP_CUSTOMIZATION_FILE, "Main Configs", fmt("ENABLE %s", human_special_names[i]), num)

if(num == 1 || num == 2 && !g_escape_map || num >= 3 && g_escape_map) hm_special_enable[i] = true
if(CheckAllowed(num)) hm_special_enable[i] = true
else hm_special_enable[i] = false
}

Expand Down Expand Up @@ -9919,7 +9922,7 @@ public native_register_human_special(plugin_id, num_params) {
else ArrayPushCell(g_hm_sp_painfree, value)

if(amx_load_setting_int(ZP_SPECIAL_CLASSES_FILE, section, "ENABLE", value)) {
if(value == 1 || value == 2 && !g_escape_map || value >= 3 && g_escape_map) ArrayPushCell(g_hm_sp_enable, 1)
if(CheckAllowed(value)) ArrayPushCell(g_hm_sp_enable, 1)
else ArrayPushCell(g_hm_sp_enable, 0)
}
else {
Expand Down Expand Up @@ -10172,7 +10175,7 @@ public native_register_zombie_special(plugin_id, num_params) {
else ArrayPushCell(g_zm_sp_allow_frost, value)

if(amx_load_setting_int(ZP_SPECIAL_CLASSES_FILE, section, "ENABLE", value)) {
if(value == 1 || value == 2 && !g_escape_map || value >= 3 && g_escape_map) ArrayPushCell(g_zm_sp_enable, 1)
if(CheckAllowed(value)) ArrayPushCell(g_zm_sp_enable, 1)
else ArrayPushCell(g_zm_sp_enable, 0)
}
else {
Expand Down Expand Up @@ -11439,7 +11442,7 @@ public Float:native_get_user_default_maxspeed(plugin_id, num_params) {
if(!g_hclass_i) // No hclass instaled
g_spd[id] = get_pcvar_float(cvar_hm_spd[g_hm_special[id]])

if(cvarWeight == 1 || cvarWeight == 2 && !g_escape_map || cvarWeight >= 3 && g_escape_map)
if(CheckAllowed(cvarWeight))
return (g_spd[id] * weapon_spd_multi[g_currentweapon[id]]);
else
return (g_spd[id]);
Expand Down Expand Up @@ -13077,7 +13080,10 @@ public is_gamemode_enable(modeid) {
return 1;

if(modeid < MAX_GAME_MODES) { // Internal Game Modes
if(!get_pcvar_num(cvar_mod_enable[modeid]) || get_pcvar_num(cvar_mod_enable[modeid]) == 2 && !g_escape_map || get_pcvar_num(cvar_mod_enable[modeid]) == 3 && g_escape_map)
static CvarValue;
CvarValue = get_pcvar_num(cvar_mod_enable[modeid]);

if(!CheckAllowed(CvarValue))
return 0

switch(modeid) {
Expand Down

0 comments on commit eac73b4

Please sign in to comment.