mirror of
https://github.com/nzp-team/quakec.git
synced 2024-11-28 14:52:29 +00:00
Server: more small perf tweaks
This commit is contained in:
parent
707141ec68
commit
87319e13cf
3 changed files with 57 additions and 192 deletions
|
@ -566,4 +566,4 @@ void(entity inflictor, entity attacker, float damage2, float mindamage, float ra
|
||||||
}
|
}
|
||||||
ent = ent.chain;
|
ent = ent.chain;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -36,72 +36,76 @@ void() main =
|
||||||
localcmd("echo Server starting...\n");
|
localcmd("echo Server starting...\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float ai_delay_time;
|
||||||
|
|
||||||
//called for each frame that QC runs
|
//called for each frame that QC runs
|
||||||
float zombie_cleaned_w;
|
float zombie_cleaned_w;
|
||||||
void() StartFrame =
|
void() StartFrame =
|
||||||
{
|
{
|
||||||
deathmatch = cvar("deathmatch");
|
|
||||||
//coop = cvar("coop");
|
|
||||||
framecount = framecount + 1;
|
framecount = framecount + 1;
|
||||||
|
|
||||||
if (waypoint_mode) {
|
if (waypoint_mode) {
|
||||||
if (!zombie_cleaned_w) {
|
if (!zombie_cleaned_w) {
|
||||||
entity zent;
|
entity zent;
|
||||||
zent = find (world, classname, "ai_zombie");
|
zent = find (world, classname, "ai_zombie");
|
||||||
while (zent)
|
while (zent)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
if (zent.head)
|
if (zent.head)
|
||||||
remove (zent.head);
|
remove (zent.head);
|
||||||
if (zent.larm)
|
if (zent.larm)
|
||||||
remove (zent.larm);
|
remove (zent.larm);
|
||||||
if (zent.rarm)
|
if (zent.rarm)
|
||||||
remove (zent.rarm);
|
remove (zent.rarm);
|
||||||
*/
|
*/
|
||||||
remove (zent);
|
remove (zent);
|
||||||
zent = find (zent, classname, "ai_zombie");
|
zent = find (zent, classname, "ai_zombie");
|
||||||
}
|
}
|
||||||
zombie_cleaned_w = true;
|
zombie_cleaned_w = true;
|
||||||
|
|
||||||
zent = find (world, classname, "waypoint");
|
zent = find (world, classname, "waypoint");
|
||||||
while (zent)
|
while (zent)
|
||||||
{
|
{
|
||||||
if (zent.targetname)
|
if (zent.targetname)
|
||||||
setmodel(zent, "models/way/normal_way_door.spr");
|
setmodel(zent, "models/way/normal_way_door.spr");
|
||||||
else
|
else
|
||||||
setmodel(zent, "models/way/normal_way.spr");
|
setmodel(zent, "models/way/normal_way.spr");
|
||||||
zent = find (zent, classname, "waypoint");
|
zent = find (zent, classname, "waypoint");
|
||||||
}
|
}
|
||||||
zent = find (world, classname, "door_nzp_cost");
|
zent = find (world, classname, "door_nzp_cost");
|
||||||
while (zent)
|
while (zent)
|
||||||
{
|
{
|
||||||
zent.solid = SOLID_NOT;
|
zent.solid = SOLID_NOT;
|
||||||
zent.touch = SUB_Null;
|
zent.touch = SUB_Null;
|
||||||
zent = find (zent, classname, "door_nzp_cost");
|
zent = find (zent, classname, "door_nzp_cost");
|
||||||
}
|
}
|
||||||
zent = find (world, classname, "door_nzp");
|
zent = find (world, classname, "door_nzp");
|
||||||
while (zent)
|
while (zent)
|
||||||
{
|
{
|
||||||
zent.solid = SOLID_NOT;
|
zent.solid = SOLID_NOT;
|
||||||
zent.touch = SUB_Null;
|
zent.touch = SUB_Null;
|
||||||
zent.solid = SOLID_NOT;
|
zent.solid = SOLID_NOT;
|
||||||
zent = find (zent, classname, "door_nzp");
|
zent = find (zent, classname, "door_nzp");
|
||||||
}
|
}
|
||||||
zent = find (world, classname, "window");
|
zent = find (world, classname, "window");
|
||||||
while (zent)
|
while (zent)
|
||||||
{
|
{
|
||||||
zent.solid = SOLID_NOT;
|
zent.solid = SOLID_NOT;
|
||||||
zent.touch = SUB_Null;
|
zent.touch = SUB_Null;
|
||||||
zent = find (zent, classname, "window");
|
zent = find (zent, classname, "window");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (roundinit) {
|
if (roundinit) {
|
||||||
Round_Core();
|
Round_Core();
|
||||||
Do_Zombie_AI ();
|
|
||||||
|
if (ai_delay_time < time) {
|
||||||
|
Do_Zombie_AI ();
|
||||||
|
ai_delay_time = time + 0.05;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
entity SpawnedIn;
|
entity SpawnedIn;
|
||||||
SpawnedIn = find(world, classname, "player");
|
SpawnedIn = find(world, classname, "player");
|
||||||
|
|
|
@ -64,21 +64,8 @@ var struct {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// so we know whether to use normal values or pull from our struct!
|
|
||||||
float(float wep) isCustomWeapon =
|
|
||||||
{
|
|
||||||
if (wep >= 70)
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
string(float wep) GetWeaponName =
|
string(float wep) GetWeaponName =
|
||||||
{
|
{
|
||||||
if (isCustomWeapon(wep)) {
|
|
||||||
return CustomWeapons[wep - 70].name;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (wep)
|
switch (wep)
|
||||||
{
|
{
|
||||||
case W_COLT:
|
case W_COLT:
|
||||||
|
@ -217,11 +204,6 @@ string(float perk) GetPerkName =
|
||||||
|
|
||||||
float(float wep) GetFiretype =
|
float(float wep) GetFiretype =
|
||||||
{
|
{
|
||||||
|
|
||||||
if (isCustomWeapon(wep)) {
|
|
||||||
return CustomWeapons[wep - 70].firetype;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (wep)
|
switch (wep)
|
||||||
{
|
{
|
||||||
case W_COLT:
|
case W_COLT:
|
||||||
|
@ -536,11 +518,6 @@ float(float wep, float type) getWeaponMultiplier =
|
||||||
|
|
||||||
float(float wep) getWeaponMag =
|
float(float wep) getWeaponMag =
|
||||||
{
|
{
|
||||||
|
|
||||||
if (isCustomWeapon(wep)) {
|
|
||||||
return CustomWeapons[wep - 70].magSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (wep)
|
switch (wep)
|
||||||
{
|
{
|
||||||
case W_COLT:
|
case W_COLT:
|
||||||
|
@ -642,11 +619,6 @@ float(float wep) getWeaponMag =
|
||||||
|
|
||||||
float(float wep) getWeaponAmmo =
|
float(float wep) getWeaponAmmo =
|
||||||
{
|
{
|
||||||
|
|
||||||
if (isCustomWeapon(wep)) {
|
|
||||||
return CustomWeapons[wep - 70].reserveSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (wep)
|
switch (wep)
|
||||||
{
|
{
|
||||||
case W_COLT:
|
case W_COLT:
|
||||||
|
@ -750,11 +722,6 @@ float(float wep) getWeaponAmmo =
|
||||||
|
|
||||||
float(float wep) getWeaponDamage =
|
float(float wep) getWeaponDamage =
|
||||||
{
|
{
|
||||||
|
|
||||||
if (isCustomWeapon(wep)) {
|
|
||||||
return CustomWeapons[wep - 70].damage;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (wep)
|
switch (wep)
|
||||||
{
|
{
|
||||||
case W_COLT:
|
case W_COLT:
|
||||||
|
@ -852,10 +819,6 @@ float(float wep) getWeaponDamage =
|
||||||
|
|
||||||
float(float wep) GetWeaponShotcount =
|
float(float wep) GetWeaponShotcount =
|
||||||
{
|
{
|
||||||
if (isCustomWeapon(wep)) {
|
|
||||||
return CustomWeapons[wep - 70].shotcount;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch(wep)
|
switch(wep)
|
||||||
{
|
{
|
||||||
case W_DB:
|
case W_DB:
|
||||||
|
@ -879,13 +842,6 @@ float(float wep, float penetration_times) getWeaponPenetration =
|
||||||
if (!penetration_times)
|
if (!penetration_times)
|
||||||
return 2;
|
return 2;
|
||||||
|
|
||||||
if (isCustomWeapon(wep)) {
|
|
||||||
if (penetration_times >= CustomWeapons[wep - 70].bodypen)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return CustomWeapons[wep - 70].penetration;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (wep)
|
switch (wep)
|
||||||
{
|
{
|
||||||
case W_COLT:
|
case W_COLT:
|
||||||
|
@ -997,10 +953,6 @@ float(float wep, float penetration_times) getWeaponPenetration =
|
||||||
|
|
||||||
float(float wep) GetWeaponSpread =
|
float(float wep) GetWeaponSpread =
|
||||||
{
|
{
|
||||||
if (isCustomWeapon(wep)) {
|
|
||||||
return CustomWeapons[wep - 70].spread;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (wep)
|
switch (wep)
|
||||||
{
|
{
|
||||||
case W_COLT:
|
case W_COLT:
|
||||||
|
@ -1104,14 +1056,6 @@ float(float wep) GetWeaponSpread =
|
||||||
|
|
||||||
float(float wep, float delaytype) getWeaponDelay =
|
float(float wep, float delaytype) getWeaponDelay =
|
||||||
{
|
{
|
||||||
|
|
||||||
if (isCustomWeapon(wep)) {
|
|
||||||
if (delaytype == RELOAD)
|
|
||||||
return CustomWeapons[wep - 70].rdelay;
|
|
||||||
else if (delaytype == FIRE)
|
|
||||||
return CustomWeapons[wep - 70].fdelay;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (wep)
|
switch (wep)
|
||||||
{
|
{
|
||||||
case W_COLT:
|
case W_COLT:
|
||||||
|
@ -1320,10 +1264,6 @@ float GetWeaponWalkSpeed(float perks, float weapontype)
|
||||||
|
|
||||||
spd = 0;
|
spd = 0;
|
||||||
|
|
||||||
if (isCustomWeapon(weapontype)) {
|
|
||||||
spd = CustomWeapons[weapontype - 70].walkspeed;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch(weapontype) {
|
switch(weapontype) {
|
||||||
default: spd = 1;
|
default: spd = 1;
|
||||||
case W_KAR:
|
case W_KAR:
|
||||||
|
@ -1361,10 +1301,6 @@ float GetWeaponWalkSpeed(float perks, float weapontype)
|
||||||
|
|
||||||
vector GetWeaponADSPos(float wep) {
|
vector GetWeaponADSPos(float wep) {
|
||||||
|
|
||||||
if (isCustomWeapon(wep)) {
|
|
||||||
return CustomWeapons[wep - 70].adsofs;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (wep) {
|
switch (wep) {
|
||||||
case W_COLT:
|
case W_COLT:
|
||||||
return [-2.99, 2.77, 0.92];
|
return [-2.99, 2.77, 0.92];
|
||||||
|
@ -2337,13 +2273,6 @@ float(float wep, float frametype, optional float z) GetFrame =
|
||||||
string(float wep, float gorvmodel) GetWeaponModel =
|
string(float wep, float gorvmodel) GetWeaponModel =
|
||||||
{
|
{
|
||||||
|
|
||||||
if (isCustomWeapon(wep)) {
|
|
||||||
if (gorvmodel)
|
|
||||||
return CustomWeapons[wep - 70].gmodel;
|
|
||||||
else
|
|
||||||
return CustomWeapons[wep - 70].vmodel;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (wep)
|
switch (wep)
|
||||||
{
|
{
|
||||||
case W_COLT:
|
case W_COLT:
|
||||||
|
@ -2514,17 +2443,6 @@ string(float wep, float gorvmodel) GetWeaponModel =
|
||||||
|
|
||||||
string(float wep) GetWeapon2Model =
|
string(float wep) GetWeapon2Model =
|
||||||
{
|
{
|
||||||
|
|
||||||
// naievil -- fixme, add support for custom weapon2models
|
|
||||||
/*
|
|
||||||
if (isCustomWeapon(wep)) {
|
|
||||||
if (gorvmodel)
|
|
||||||
return CustomWeapons[wep - 70].gmodel;
|
|
||||||
else
|
|
||||||
return CustomWeapons[wep - 70].vmodel;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
switch (wep)
|
switch (wep)
|
||||||
{
|
{
|
||||||
case W_BIATCH:
|
case W_BIATCH:
|
||||||
|
@ -2543,11 +2461,6 @@ string(float wep) GetWeapon2Model =
|
||||||
|
|
||||||
string(float wep) GetWeaponSound =
|
string(float wep) GetWeaponSound =
|
||||||
{
|
{
|
||||||
|
|
||||||
if (isCustomWeapon(wep)) {
|
|
||||||
return CustomWeapons[wep - 70].firesound;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (wep)
|
switch (wep)
|
||||||
{
|
{
|
||||||
case W_BIATCH:
|
case W_BIATCH:
|
||||||
|
@ -2627,11 +2540,6 @@ string(float wep) GetWeaponSound =
|
||||||
}
|
}
|
||||||
|
|
||||||
float(float wep) IsDualWeapon = {
|
float(float wep) IsDualWeapon = {
|
||||||
|
|
||||||
if (isCustomWeapon(wep)) {
|
|
||||||
return CustomWeapons[wep - 70].isDual;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch(wep) {
|
switch(wep) {
|
||||||
case W_BIATCH:
|
case W_BIATCH:
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -2643,11 +2551,6 @@ float(float wep) IsDualWeapon = {
|
||||||
}
|
}
|
||||||
|
|
||||||
string(float wep) GetLeftWeaponModel = {
|
string(float wep) GetLeftWeaponModel = {
|
||||||
|
|
||||||
if (isCustomWeapon(wep)) {
|
|
||||||
return CustomWeapons[wep - 70].vmodel2;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch(wep) {
|
switch(wep) {
|
||||||
case W_BIATCH:
|
case W_BIATCH:
|
||||||
return "models/weapons/m1911/v_biatch_left.mdl";
|
return "models/weapons/m1911/v_biatch_left.mdl";
|
||||||
|
@ -2659,11 +2562,6 @@ string(float wep) GetLeftWeaponModel = {
|
||||||
}
|
}
|
||||||
|
|
||||||
float(float wep) IsPapWeapon = {
|
float(float wep) IsPapWeapon = {
|
||||||
|
|
||||||
if (isCustomWeapon(wep)) {
|
|
||||||
return CustomWeapons[wep - 70].ispap;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch(wep) {
|
switch(wep) {
|
||||||
case W_BIATCH:
|
case W_BIATCH:
|
||||||
case W_ARMAGEDDON:
|
case W_ARMAGEDDON:
|
||||||
|
@ -2695,11 +2593,6 @@ float(float wep) IsPapWeapon = {
|
||||||
}
|
}
|
||||||
|
|
||||||
float(float wep) GetWepSkin = {
|
float(float wep) GetWepSkin = {
|
||||||
|
|
||||||
if (isCustomWeapon(wep)) {
|
|
||||||
return CustomWeapons[wep - 70].skin;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch(wep) {
|
switch(wep) {
|
||||||
case W_BIATCH:
|
case W_BIATCH:
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -2717,11 +2610,6 @@ float(float wep) GetWepSkin = {
|
||||||
|
|
||||||
float(float wep) EqualNonPapWeapon =
|
float(float wep) EqualNonPapWeapon =
|
||||||
{
|
{
|
||||||
|
|
||||||
if (isCustomWeapon(wep)) {
|
|
||||||
return CustomWeapons[wep - 70].nonpap;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (wep) {
|
switch (wep) {
|
||||||
case W_BIATCH:
|
case W_BIATCH:
|
||||||
return W_COLT;
|
return W_COLT;
|
||||||
|
@ -2785,11 +2673,6 @@ float(float wep) EqualNonPapWeapon =
|
||||||
}
|
}
|
||||||
float(float wep) EqualPapWeapon =
|
float(float wep) EqualPapWeapon =
|
||||||
{
|
{
|
||||||
|
|
||||||
if (isCustomWeapon(wep)) {
|
|
||||||
return CustomWeapons[wep - 70].pap;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (wep) {
|
switch (wep) {
|
||||||
case W_COLT:
|
case W_COLT:
|
||||||
return W_BIATCH;
|
return W_BIATCH;
|
||||||
|
@ -3168,11 +3051,6 @@ void (float wep, float anim_style, float dualwep, float curweaponframe) PlayWeap
|
||||||
|
|
||||||
void(float weptype) precache_extra =
|
void(float weptype) precache_extra =
|
||||||
{
|
{
|
||||||
|
|
||||||
if (isCustomWeapon(weptype)) {
|
|
||||||
precache_model(CustomWeapons[weptype - 70].vmodel);
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (weptype) {
|
switch (weptype) {
|
||||||
case W_COLT:
|
case W_COLT:
|
||||||
case W_BIATCH:
|
case W_BIATCH:
|
||||||
|
@ -3364,11 +3242,6 @@ void(float weptype) precache_extra =
|
||||||
|
|
||||||
float(float wep) getWeaponRecoilReturn =
|
float(float wep) getWeaponRecoilReturn =
|
||||||
{
|
{
|
||||||
|
|
||||||
if (isCustomWeapon(wep)) {
|
|
||||||
return CustomWeapons[wep - 70].recoil;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (wep)
|
switch (wep)
|
||||||
{
|
{
|
||||||
case W_COLT:
|
case W_COLT:
|
||||||
|
@ -3521,10 +3394,6 @@ float(float weapon, float stance) CrossHairWeapon =
|
||||||
|
|
||||||
sprd = 0;
|
sprd = 0;
|
||||||
|
|
||||||
if (isCustomWeapon(weapon)) {
|
|
||||||
sprd = CustomWeapons[weapon - 70].crossmin;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch(weapon)
|
switch(weapon)
|
||||||
{
|
{
|
||||||
case W_COLT:
|
case W_COLT:
|
||||||
|
@ -3647,10 +3516,6 @@ float(float weapon, float stance) CrossHairMaxSpread =
|
||||||
|
|
||||||
sprd = 0;
|
sprd = 0;
|
||||||
|
|
||||||
if (isCustomWeapon(weapon)) {
|
|
||||||
return CustomWeapons[weapon - 70].crossmax;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch(weapon)
|
switch(weapon)
|
||||||
{
|
{
|
||||||
case W_COLT:
|
case W_COLT:
|
||||||
|
@ -4123,10 +3988,6 @@ vector (float wep) GetWeaponFlash_Offset =
|
||||||
|
|
||||||
float (float wep) GetWeaponFlash_Size = {
|
float (float wep) GetWeaponFlash_Size = {
|
||||||
|
|
||||||
if (isCustomWeapon(wep)) {
|
|
||||||
return CustomWeapons[wep - 70].flashsize;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch(wep) {
|
switch(wep) {
|
||||||
case W_COLT:
|
case W_COLT:
|
||||||
return 5;
|
return 5;
|
||||||
|
|
Loading…
Reference in a new issue