From 240956e24e495a340c32b35506b8c502d75519b2 Mon Sep 17 00:00:00 2001 From: Tyler Young Date: Sun, 27 Nov 2022 15:05:06 -0500 Subject: [PATCH 1/2] Precache sounds until engine side steps aren't borked it is what it is --- source/server/main.qc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/server/main.qc b/source/server/main.qc index a96a68f..f0c6be9 100644 --- a/source/server/main.qc +++ b/source/server/main.qc @@ -186,7 +186,7 @@ void() precaches = // // player-made -#ifdef PC + precache_sound("sounds/player/footstep1.wav"); precache_sound("sounds/player/footstep2.wav"); precache_sound("sounds/player/footstep3.wav"); @@ -195,7 +195,7 @@ void() precaches = precache_sound("sounds/player/jump.wav"); precache_sound("sounds/player/land.wav"); precache_sound("sounds/player/pain4.wav"); -#endif // PC + // weapons precache_sound("sounds/weapons/colt/magin.wav"); From 13087bc1cd3a49a0d32fd6ff26fb6879ae784b40 Mon Sep 17 00:00:00 2001 From: Tyler Young Date: Tue, 20 Dec 2022 19:50:56 -0500 Subject: [PATCH 2/2] Quit linking hitboxes every frame saves frames --- source/server/ai/ai_core.qc | 3 ++ source/server/ai/zombie_core.qc | 9 +++++- source/server/main.qc | 57 ++++++++++++++++++++++++++++++++- 3 files changed, 67 insertions(+), 2 deletions(-) diff --git a/source/server/ai/ai_core.qc b/source/server/ai/ai_core.qc index 492e741..04a1cb1 100644 --- a/source/server/ai/ai_core.qc +++ b/source/server/ai/ai_core.qc @@ -26,6 +26,7 @@ */ void(float what) play_sound_z; +void() LinkZombiesHitbox; void() path_corner_touch = { @@ -489,6 +490,8 @@ void(float dist) Window_Hop = self.enemy = find_new_enemy(self); //self.th_die(); self.th_walk(); + LinkZombiesHitbox(); + //bprint (PRINT_HIGH, "Linked hitboxes"); } } diff --git a/source/server/ai/zombie_core.qc b/source/server/ai/zombie_core.qc index 443aafa..17db8ad 100644 --- a/source/server/ai/zombie_core.qc +++ b/source/server/ai/zombie_core.qc @@ -29,6 +29,7 @@ void() Zombie_Walk_Setup; void() crawler_rip_board1; void() crawler_da1; void() crawler_die1; +void() LinkZombiesHitbox; float EMPTY_BBOX = 0; @@ -1379,6 +1380,8 @@ void() zombieRise = self.frame ++; self.think = zombieRise; self.nextthink = time + 0.1; + LinkZombiesHitbox(); + //bprint (PRINT_HIGH, "Linked hitboxes"); }; void() spawn_zombie = { @@ -1650,6 +1653,7 @@ void(entity where) spawn_a_zombieB = szombie.mins = '-8 -8 -32';//-16 16 -32 szombie.maxs = '8 8 30';//16 16 40 + setsize (szombie, szombie.mins, szombie.maxs);//-16,-16,-32,16,16,40 //Setting Uniform skin================= /*if(random() > 0.5) @@ -1728,7 +1732,7 @@ void(entity where) spawn_a_zombieB = SetZombieWalk(szombie); //================================================================================================== - SetUpHitBoxes(szombie); + SetUpHitBoxes(szombie); //szombie.walktype = 5; //////////////////////////////////////////////////// szombie.reload_delay = 30 + time;//save floats, equals respawn time. @@ -1742,6 +1746,9 @@ void(entity where) spawn_a_zombieB = else self.th_walk(); self = old_self; + + LinkZombiesHitbox(); + //bprint (PRINT_HIGH, "Linked hitboxes"); // set up timer for next spawn zombie_spawn_timer = zombie_spawn_delay + time; diff --git a/source/server/main.qc b/source/server/main.qc index f0c6be9..12fd35d 100644 --- a/source/server/main.qc +++ b/source/server/main.qc @@ -395,7 +395,8 @@ void() RelinkZombies = //if(OnlyOrigin) // continue; - + + /* min = ent2.bbmins + (v_right * ent2.view_ofs_x) + (v_forward * ent2.view_ofs_y) + (v_up * ent2.view_ofs_z); max = ent2.bbmaxs + (v_right * ent2.view_ofs_x) + (v_forward * ent2.view_ofs_y) + (v_up * ent2.view_ofs_z); @@ -404,6 +405,60 @@ void() RelinkZombies = if(min_z > max_z) { min_z += max_z; max_z = min_z - max_z; min_z -= max_z; } setsize(ent2,min,max); + */ + } + + } + } +} + +void() LinkZombiesHitbox = +{ + entity ent,ent2; + local float i; + local vector min, max; + + + //warn + ent = ent2 = world; + + while ((ent = find (ent, classname, "ai_zombie"))) + { + if(ent.currentHitBoxSetup == 0)//empty bbox, we don't care to update + continue; + + makevectors (ent.angles); + + for(i = 0; i < 3; i++) + { + if(i == 0) + ent2 = ent.head; + if(i == 1) + ent2 = ent.larm; + if(i == 2) + ent2 = ent.rarm; + + + if (ent2) + { + ent2.angles = ent.angles; + + if(ent2.deadflag) + ent2.frame = ent.frame; + + //if(OnlyOrigin) + // continue; + + + min = ent2.bbmins + (v_right * ent2.view_ofs_x) + (v_forward * ent2.view_ofs_y) + (v_up * ent2.view_ofs_z); + max = ent2.bbmaxs + (v_right * ent2.view_ofs_x) + (v_forward * ent2.view_ofs_y) + (v_up * ent2.view_ofs_z); + + if(min_x > max_x) { min_x += max_x; max_x = min_x - max_x; min_x -= max_x; } + if(min_y > max_y) { min_y += max_y; max_y = min_y - max_y; min_y -= max_y; } + if(min_z > max_z) { min_z += max_z; max_z = min_z - max_z; min_z -= max_z; } + + setsize(ent2,min,max); + } }