The grabback model setting is now implemented in adjust_grabposition(). This better encapsulates grabbing implementation and fixes
@@ -22339,11 +22339,12 @@ void display_ents()
if(e->modeldata.hpbarstatus.size.x)
{
drawenemystatus(e);
-
}
+
sortid = e->sortid;
scrx = o_scrx - ((e->modeldata.noquake & NO_QUAKEN) ? 0 : gfx_x_offset);
scry = o_scry - ((e->modeldata.noquake & NO_QUAKEN) ? 0 : gfx_y_offset);
+
if(freezeall || !(e->blink && (_time % (GAME_SPEED / 10)) < (GAME_SPEED / 20)))
{
float eheight = T_WALKOFF, eplatheight = 0;
@@ -22378,26 +22379,6 @@ void display_ents()
z = (int)e->position.z; // Set the layer offset
- /*if(e->binding.ent)
- {
- sortid = e->binding.ent->sortid + e->binding.sortid;
- }*/
-
- if(e->grabbing && e->modeldata.grabback)
- {
- sortid = e->link->sortid - 1; // Grab animation displayed behind
- }
- else if(!e->modeldata.grabback && e->grabbing)
- {
- sortid = e->link->sortid + 1;
- }
- /*
- if(e->binding.ent && e->binding.ent->grabbing==e)
- {
- if(e->binding.ent->modeldata.grabback) z--;
- else z++;
- }
- */
if(other && e->position.y >= other->position.y + other->animation->platform[other->animpos][PLATFORM_HEIGHT] && !other->modeldata.setlayer)
{
float zdepth = (float)( (float)e->position.z - (float)other->position.z +
@@ -26244,14 +26225,17 @@ void npc_warp()
int adjust_grabposition(entity *ent, entity *other, float dist, int grabin)
{
- float x1, z1, x2, z2, x;
+ float x1;
+ float z1;
+ float x2;
+ float z2;
+ float x;
- //if(ent->position.y != other->position.y)
if(diff(ent->position.y,other->position.y) > T_WALKOFF)
{
return 0;
}
- //if(ent->base != other->base)
+
if(diff(ent->base,other->base) > T_WALKOFF)
{
return 0;
@@ -26282,6 +26266,23 @@ int adjust_grabposition(entity *ent, entity *other, float dist, int grabin)
other->position.z = z2;
//other->position.y = ent->position.y;
//other->base = ent->base;
+
+ // Sort order control.
+ //
+ // If grabback is set (grabback = 1) the grabbed entity's
+ // sort order is forced 1 greater than grappler so grappler
+ // appears behind. Otherwise grabbed is moved one lower,
+ // forcing grappler to appear in front.
+ if (ent->modeldata.grabback)
+ {
+ other->sortid = ent->sortid + 1;
+ }
+ else if (!ent->modeldata.grabback)
+ {
+ other->sortid = ent->sortid - 1;
+ }
+
+
return 1;
}
