trace_t trace;
vec3_t move;
- // don't stick to ground if onground and moving upward
- if (ent->fields.server->velocity[2] >= (1.0 / 32.0) && ((int)ent->fields.server->flags & FL_ONGROUND))
- ent->fields.server->flags = (int)ent->fields.server->flags & ~FL_ONGROUND;
-
// if onground, return without moving
if ((int)ent->fields.server->flags & FL_ONGROUND)
{
- if (ent->fields.server->groundentity == 0 || sv_gameplayfix_noairborncorpse.integer)
- return;
- // if ent was supported by a brush model on previous frame,
- // and groundentity is now freed, set groundentity to 0 (floating)
- if (ent->priv.server->suspendedinairflag && PRVM_PROG_TO_EDICT(ent->fields.server->groundentity)->priv.server->free)
+ // don't stick to ground if onground and moving upward
+ if (ent->fields.server->velocity[2] >= (1.0 / 32.0))
+ ent->fields.server->flags -= FL_ONGROUND;
+ else
{
- // leave it suspended in the air
- ent->fields.server->groundentity = 0;
- return;
+ prvm_edict_t *ground = PRVM_PROG_TO_EDICT(ent->fields.server->groundentity);
+ if (ground->fields.server->solid == SOLID_BSP || !sv_gameplayfix_noairborncorpse.integer)
+ return;
+ // if ent was supported by a brush model on previous frame,
+ // and groundentity is now freed, set groundentity to 0 (floating)
+ if (ent->priv.server->suspendedinairflag && ground->priv.server->free)
+ {
+ // leave it suspended in the air
+ ent->fields.server->groundentity = 0;
+ return;
+ }
}
}
ent->priv.server->suspendedinairflag = false;
*/
void SV_Physics_Step (prvm_edict_t *ent)
{
- // don't stick to ground if onground and moving upward
- if (ent->fields.server->velocity[2] >= (1.0 / 32.0) && ((int)ent->fields.server->flags & FL_ONGROUND))
- ent->fields.server->flags = (int)ent->fields.server->flags & ~FL_ONGROUND;
-
- // freefall if not onground/fly/swim
- if (!((int)ent->fields.server->flags & (FL_ONGROUND | FL_FLY | FL_SWIM)))
+ int flags = (int)ent->fields.server->flags;
+ // don't fall at all if fly/swim
+ if (!(flags & (FL_FLY | FL_SWIM)))
{
- int hitsound = ent->fields.server->velocity[2] < sv_gravity.value * -0.1;
+ if (flags & FL_ONGROUND)
+ {
+ // freefall if onground and moving upward
+ // freefall if not standing on a world surface (it may be a lift)
+ prvm_edict_t *ground = PRVM_PROG_TO_EDICT(ent->fields.server->groundentity);
+ if (ent->fields.server->velocity[2] >= (1.0 / 32.0) || (ground->fields.server->solid != SOLID_BSP && sv_gameplayfix_noairborncorpse.integer))
+ {
+ ent->fields.server->flags -= FL_ONGROUND;
+ SV_AddGravity(ent);
+ SV_CheckVelocity(ent);
+ SV_FlyMove(ent, sv.frametime, NULL);
+ SV_LinkEdict(ent, true);
+ }
+ }
+ else
+ {
+ // freefall if not onground
+ int hitsound = ent->fields.server->velocity[2] < sv_gravity.value * -0.1;
- SV_AddGravity(ent);
- SV_CheckVelocity(ent);
- SV_FlyMove(ent, sv.frametime, NULL);
- SV_LinkEdict(ent, true);
+ SV_AddGravity(ent);
+ SV_CheckVelocity(ent);
+ SV_FlyMove(ent, sv.frametime, NULL);
+ SV_LinkEdict(ent, true);
- // just hit ground
- if (hitsound && (int)ent->fields.server->flags & FL_ONGROUND && gamemode != GAME_NEXUIZ)
- SV_StartSound(ent, 0, "demon/dland2.wav", 255, 1);
+ // just hit ground
+ if (hitsound && (int)ent->fields.server->flags & FL_ONGROUND && gamemode != GAME_NEXUIZ)
+ SV_StartSound(ent, 0, "demon/dland2.wav", 255, 1);
+ }
}
// regular thinking
sv_areagrid_stats_calls++;
sv_areagrid_marknumber++;
- igridmins[0] = (int) ((mins[0] + sv_areagrid_bias[0]) * sv_areagrid_scale[0]);
- igridmins[1] = (int) ((mins[1] + sv_areagrid_bias[1]) * sv_areagrid_scale[1]);
+ igridmins[0] = (int) floor((mins[0] + sv_areagrid_bias[0]) * sv_areagrid_scale[0]);
+ igridmins[1] = (int) floor((mins[1] + sv_areagrid_bias[1]) * sv_areagrid_scale[1]);
//igridmins[2] = (int) ((mins[2] + sv_areagrid_bias[2]) * sv_areagrid_scale[2]);
- igridmaxs[0] = (int) ((maxs[0] + sv_areagrid_bias[0]) * sv_areagrid_scale[0]) + 1;
- igridmaxs[1] = (int) ((maxs[1] + sv_areagrid_bias[1]) * sv_areagrid_scale[1]) + 1;
+ igridmaxs[0] = (int) floor((maxs[0] + sv_areagrid_bias[0]) * sv_areagrid_scale[0]) + 1;
+ igridmaxs[1] = (int) floor((maxs[1] + sv_areagrid_bias[1]) * sv_areagrid_scale[1]) + 1;
//igridmaxs[2] = (int) ((maxs[2] + sv_areagrid_bias[2]) * sv_areagrid_scale[2]) + 1;
igridmins[0] = max(0, igridmins[0]);
igridmins[1] = max(0, igridmins[1]);
list[numlist] = ent;
numlist++;
}
+ // Con_Printf("%d %f %f %f %f %f %f : %d : %f %f %f %f %f %f\n", BoxesOverlap(mins, maxs, ent->fields.server->absmin, ent->fields.server->absmax), ent->fields.server->absmin[0], ent->fields.server->absmin[1], ent->fields.server->absmin[2], ent->fields.server->absmax[0], ent->fields.server->absmax[1], ent->fields.server->absmax[2], PRVM_NUM_FOR_EDICT(ent), mins[0], mins[1], mins[2], maxs[0], maxs[1], maxs[2]);
}
sv_areagrid_stats_entitychecks++;
}
return;
}
- igridmins[0] = (int) ((ent->fields.server->absmin[0] + sv_areagrid_bias[0]) * sv_areagrid_scale[0]);
- igridmins[1] = (int) ((ent->fields.server->absmin[1] + sv_areagrid_bias[1]) * sv_areagrid_scale[1]);
+ igridmins[0] = (int) floor((ent->fields.server->absmin[0] + sv_areagrid_bias[0]) * sv_areagrid_scale[0]);
+ igridmins[1] = (int) floor((ent->fields.server->absmin[1] + sv_areagrid_bias[1]) * sv_areagrid_scale[1]);
//igridmins[2] = (int) ((ent->fields.server->absmin[2] + sv_areagrid_bias[2]) * sv_areagrid_scale[2]);
- igridmaxs[0] = (int) ((ent->fields.server->absmax[0] + sv_areagrid_bias[0]) * sv_areagrid_scale[0]) + 1;
- igridmaxs[1] = (int) ((ent->fields.server->absmax[1] + sv_areagrid_bias[1]) * sv_areagrid_scale[1]) + 1;
+ igridmaxs[0] = (int) floor((ent->fields.server->absmax[0] + sv_areagrid_bias[0]) * sv_areagrid_scale[0]) + 1;
+ igridmaxs[1] = (int) floor((ent->fields.server->absmax[1] + sv_areagrid_bias[1]) * sv_areagrid_scale[1]) + 1;
//igridmaxs[2] = (int) ((ent->fields.server->absmax[2] + sv_areagrid_bias[2]) * sv_areagrid_scale[2]) + 1;
if (igridmins[0] < 0 || igridmaxs[0] > AREA_GRID || igridmins[1] < 0 || igridmaxs[1] > AREA_GRID || ((igridmaxs[0] - igridmins[0]) * (igridmaxs[1] - igridmins[1])) > ENTITYGRIDAREAS)
{
ent->fields.server->absmax[2] += 1;
}
- if (ent->fields.server->solid == SOLID_NOT)
- return;
+ //if (ent->fields.server->solid == SOLID_NOT)
+ // return;
SV_LinkEdict_AreaGrid(ent);