Added support for overriding class nvgs. Changed nvgs CVAR to a integer.

This commit is contained in:
richard 2008-10-07 19:05:33 +02:00
parent e615802bb9
commit 180f6923fa
4 changed files with 33 additions and 8 deletions

View File

@ -15,7 +15,7 @@
#undef REQUIRE_PLUGIN
#include <market>
#define VERSION "2.5.1.1"
#define VERSION "2.5.1.2"
#include "zr/zombiereloaded"
#include "zr/global"

View File

@ -17,7 +17,7 @@ enum ZR_ClassOptions
Float:data_jump_distance,
Float:data_jump_height,
Float:data_knockback,
bool:data_nvgs[8],
data_nvgs,
data_fov,
bool:data_regen,
data_regen_health,
@ -97,7 +97,7 @@ LoadClassData()
arrayClasses[classCount][data_jump_distance] = KvGetFloat(kvClasses, "jump_distance"), GetConVarFloat(gCvars[CVAR_ZOMBIE_JUMP_DISTANCE]);
arrayClasses[classCount][data_jump_height] = KvGetFloat(kvClasses, "jump_height"), GetConVarFloat(gCvars[CVAR_ZOMBIE_JUMP_HEIGHT]);
arrayClasses[classCount][data_knockback] = KvGetFloat(kvClasses, "knockback"), GetConVarFloat(gCvars[CVAR_ZOMBIE_KNOCKBACK]);
arrayClasses[classCount][data_nvgs] = bool:KvGetNum(kvClasses, "nvgs"), GetConVarBool(gCvars[CVAR_ZOMBIE_NVGS]);
arrayClasses[classCount][data_nvgs] = KvGetNum(kvClasses, "nvgs"), GetConVarInt(gCvars[CVAR_ZOMBIE_NVGS]);
arrayClasses[classCount][data_fov] = KvGetNum(kvClasses, "fov"), GetConVarInt(gCvars[CVAR_ZOMBIE_FOV]);
arrayClasses[classCount][data_regen] = bool:KvGetNum(kvClasses, "regen"), GetConVarBool(gCvars[CVAR_ZOMBIE_REGEN]);
arrayClasses[classCount][data_regen_health] = KvGetNum(kvClasses, "regen_health"), GetConVarInt(gCvars[CVAR_ZOMBIE_REGEN_HEALTH]);
@ -193,12 +193,26 @@ Float:GetClassKnockback(classindex)
bool:GetClassNVGs(classindex)
{
new bool:classes = GetConVarBool(gCvars[CVAR_CLASSES]);
if (classes)
{
return arrayClasses[classindex][data_nvgs];
// Check if the nvgs CVAR is negative. If not negative, use the CVAR instead of
// the class variable. Makes it possible to override nvgs in per-map configs.
new nvgs_override = GetConVarInt(gCvars[CVAR_ZOMBIE_NVGS]);
if (nvgs_override > -1)
{
return IntToBool(nvgs_override);
}
else
{
return IntToBool(arrayClasses[classindex][data_nvgs]);
}
}
return GetConVarBool(gCvars[CVAR_ZOMBIE_NVGS]);
// Note to config: If classes are disabled, nvgs is disabled if it's non-zero.
return IntToBool(GetConVarInt(gCvars[CVAR_ZOMBIE_NVGS]));
}
GetClassFOV(classindex)

View File

@ -90,9 +90,8 @@ CreateCvars()
gCvars[CVAR_ZOMBIE_SPEED] = CreateConVar("zr_zombie_speed", "350", "How fast zombies travel (300: Default speed, 600: Double speed)");
gCvars[CVAR_ZOMBIE_JUMP_DISTANCE] = CreateConVar("zr_zombie_jump_distance", "0.1", "How far the zombie jumps, (0: Regular jump distance)");
gCvars[CVAR_ZOMBIE_JUMP_HEIGHT] = CreateConVar("zr_zombie_jump_height", "10.0", "How high a zombie jumps (0: Regular jump height)");
gCvars[CVAR_ZOMBIE_KNOCKBACK] = CreateConVar("zr_zombie_knockback", "4", "How far zombies are pushed back when shot (1: Default)");
gCvars[CVAR_ZOMBIE_NVGS] = CreateConVar("zr_zombie_nvgs", "0", "Zombies will receive nightvision and it will automatically be enabled (0: No night vision, recommended if using zvision)");
gCvars[CVAR_ZOMBIE_FOV] = CreateConVar("zr_zombie_fov", "110", "The field of vision of zombies (90: Default vision)");
gCvars[CVAR_ZOMBIE_KNOCKBACK] = CreateConVar("zr_zombie_knockback", "1", "How far zombies are pushed back when shot. If classes are enabled: This one is a multiplier for class knockback values (1: Default)");
gCvars[CVAR_ZOMBIE_NVGS] = CreateConVar("zr_zombie_nvgs", "-1", "Zombies will receive nightvision. Also used to override class nvgs if non-negative. (-1: No override, 0: No night vision, 1: Night vision)"); gCvars[CVAR_ZOMBIE_FOV] = CreateConVar("zr_zombie_fov", "110", "The field of vision of zombies (90: Default vision)");
gCvars[CVAR_ZOMBIE_REGEN] = CreateConVar("zr_zombie_regen", "0", "Zombies will regenerate health");
gCvars[CVAR_ZOMBIE_REGEN_HEALTH] = CreateConVar("zr_zombie_regen_health", "1", "How much health is regenerated when zr_zombie_regen is 1");
gCvars[CVAR_ZOMBIE_REGEN_INTERVAL] = CreateConVar("zr_zombie_regen_interval", "5", "How often, in seconds, a zombie regenerates health when zr_zombie_regen is 1");

View File

@ -176,3 +176,15 @@ bool:IsPlayerInList(client)
return false;
}
bool:IntToBool(intval)
{
if (intval == 0)
{
return false;
}
else
{
return true;
}
}