Merge pull request #8 from ScatterBox/main

Fixing frames
This commit is contained in:
Ian 2022-12-20 19:55:32 -05:00 committed by GitHub
commit 78e9e50e6e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 69 additions and 4 deletions

View file

@ -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");
}
}

View file

@ -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)
@ -1743,6 +1747,9 @@ void(entity where) spawn_a_zombieB =
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;
};

View file

@ -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");
@ -396,6 +396,7 @@ 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);
}
}