SERVER/FTE: Add a proper fix for collision restoration

This commit is contained in:
cypress 2023-07-18 14:31:12 -04:00
parent 72c1a8e70d
commit a207108dc2
3 changed files with 33 additions and 27 deletions

View file

@ -793,11 +793,25 @@ void() AI_SetAllEnemiesBBOX =
// First target zombies // First target zombies
list = find(world, classname, "ai_zombie"); list = find(world, classname, "ai_zombie");
while (list != world) { while (list != world) {
list.last_solid = list.solid;
list.solid = SOLID_BBOX; list.solid = SOLID_BBOX;
list.had_solid_modified = true;
if (list.head) list.head.solid = SOLID_BBOX; if (list.head) {
if (list.larm) list.larm.solid = SOLID_BBOX; list.head.last_solid = list.head.solid;
if (list.rarm) list.rarm.solid = SOLID_BBOX; list.head.solid = SOLID_BBOX;
list.head.had_solid_modified = true;
}
if (list.larm) {
list.larm.last_solid = list.larm.solid;
list.larm.solid = SOLID_BBOX;
list.larm.had_solid_modified = true;
}
if (list.rarm) {
list.rarm.last_solid = list.rarm.solid;
list.rarm.solid = SOLID_BBOX;
list.larm.had_solid_modified = true;
}
list = find(list, classname, "ai_zombie"); list = find(list, classname, "ai_zombie");
} }
@ -805,34 +819,25 @@ void() AI_SetAllEnemiesBBOX =
// Now Dogs // Now Dogs
list = find(world, classname, "ai_dog"); list = find(world, classname, "ai_dog");
while (list != world) { while (list != world) {
list.last_solid = list.solid;
list.solid = SOLID_BBOX; list.solid = SOLID_BBOX;
list.had_solid_modified = true;
list = find(list, classname, "ai_dog"); list = find(list, classname, "ai_dog");
} }
} }
void() AI_SetAllEnemiesCorpse = void() AI_RevertEnemySolidState =
{ {
entity list; entity list;
// First target zombies list = findfloat(world, had_solid_modified, true);
list = find(world, classname, "ai_zombie");
while (list != world) { while (list != world) {
list.solid = SOLID_CORPSE; list.solid = list.last_solid;
list.had_solid_modified = false;
if (list.head) list.head.solid = SOLID_CORPSE; list = findfloat(list, had_solid_modified, true);
if (list.larm) list.larm.solid = SOLID_CORPSE;
if (list.rarm) list.rarm.solid = SOLID_CORPSE;
list = find(list, classname, "ai_zombie");
}
// Now Dogs
list = find(world, classname, "ai_dog");
while (list != world) {
list.solid = SOLID_CORPSE;
list = find(list, classname, "ai_dog");
} }
} }

View file

@ -548,3 +548,8 @@ float G_PERKPOWER;
.vector rendercolor; .vector rendercolor;
float revive_index; float revive_index;
#ifdef FTE
.float last_solid;
.float had_solid_modified;
#endif // FTE

View file

@ -32,7 +32,7 @@ void() GrenadeExplode;
void() W_SprintStart; void() W_SprintStart;
#ifdef FTE #ifdef FTE
void() AI_SetAllEnemiesBBOX; void() AI_SetAllEnemiesBBOX;
void() AI_SetAllEnemiesCorpse; void() AI_RevertEnemySolidState
#endif // FTE #endif // FTE
void() ReturnWeaponModel = void() ReturnWeaponModel =
@ -1006,11 +1006,7 @@ void (float shotcount, float sprd, float Damage, float side) FireTrace =
#ifdef FTE #ifdef FTE
AI_SetAllEnemiesCorpse(); AI_RevertEnemySolidState();
trace_ent.solid = SOLID_CORPSE;
if (trace_ent.head) trace_ent.head.solid = SOLID_CORPSE;
if (trace_ent.larm) trace_ent.larm.solid = SOLID_CORPSE;
if (trace_ent.rarm) trace_ent.rarm.solid = SOLID_CORPSE;
#endif // FTE #endif // FTE