/* ================ SV_Physics_Pusher ================ */ void SV_Physics_Pusher( edict_t *ent ) { float oldtime, oldtime2; float thinktime, movetime; edict_t *pBlocker; pBlocker = NULL; oldtime = ent->v.ltime; thinktime = ent->v.nextthink; if( thinktime < oldtime + host.frametime ) { movetime = thinktime - oldtime; if( movetime < 0.0f ) movetime = 0.0f; } else movetime = host.frametime; if( movetime ) { if( !VectorIsNull( ent->v.avelocity )) { if( !VectorIsNull( ent->v.velocity )) { pBlocker = SV_PushRotate( ent, movetime ); if( !pBlocker ) { oldtime2 = ent->v.ltime; // reset the local time to what it was before we rotated ent->v.ltime = oldtime; pBlocker = SV_PushMove( ent, movetime ); if( oldtime2 < ent->v.ltime ) ent->v.ltime = oldtime2; } } else { pBlocker = SV_PushRotate( ent, movetime ); } } else { pBlocker = SV_PushMove( ent, movetime ); } } // if the pusher has a "blocked" function, call it // otherwise, just stay in place until the obstacle is gone if( pBlocker ) svgame.dllFuncs.pfnBlocked( ent, pBlocker ); if( thinktime > oldtime && (( ent->v.flags & FL_ALWAYSTHINK ) || thinktime <= ent->v.ltime )) { ent->v.nextthink = 0.0f; svgame.globals->time = sv.time; svgame.dllFuncs.pfnThink( ent ); if( ent->free ) return; } }
/* ================ SV_Physics_Pusher ================ */ void SV_Physics_Pusher (edict_t *ent) { float thinktime; float oldltime; float movetime; vec3_t oldorg, move; float l; oldltime = ent->v.ltime; thinktime = ent->v.nextthink; if (thinktime < ent->v.ltime + sv_frametime) { movetime = thinktime - ent->v.ltime; if (movetime < 0) movetime = 0; } else movetime = sv_frametime; if (movetime) { if (ent->v.avelocity[0] || ent->v.avelocity[1] || ent->v.avelocity[2]) SV_PushRotate (ent, sv_frametime); else SV_PushMove (ent, movetime); // advances ent->v.ltime if not blocked } if (thinktime > oldltime && thinktime <= ent->v.ltime) { VectorCopy (ent->v.origin, oldorg); ent->v.nextthink = 0; pr_global_struct->time = sv.time; pr_global_struct->self = EDICT_TO_PROG(ent); pr_global_struct->other = EDICT_TO_PROG(sv.edicts); PR_ExecuteProgram (ent->v.think); if (!ent->inuse) return; VectorSubtract (ent->v.origin, oldorg, move); l = VectorLength(move); if (l > 1.0/64) { // Com_Printf ("**** snap: %f\n", Length (l)); VectorCopy (oldorg, ent->v.origin); SV_Push (ent, move); } } }
/* ================ SV_Physics_Pusher ================ */ void SV_Physics_Pusher (edict_t *ent) { float thinktime; float oldltime; float movetime; oldltime = ent->v.ltime; #ifdef _DEBUG if (!ent->v.classname && ent->v.think) movetime = 0; #endif thinktime = ent->v.nextthink; if (thinktime < ent->v.ltime + host_frametime) { movetime = thinktime - ent->v.ltime; if (movetime < 0) movetime = 0; } else movetime = host_frametime; if (movetime) { #ifdef HEXEN2_SUPPORT if (hexen2 && (ent->v.avelocity[0] || ent->v.avelocity[1] || ent->v.avelocity[2])) { SV_PushRotate (ent, movetime); } else #endif SV_PushMove (ent, movetime); // advances ent->v.ltime if not blocked } if (thinktime > oldltime && thinktime <= ent->v.ltime) { ent->v.nextthink = 0; PR_GLOBAL(time) = sv.time; PR_GLOBAL(self) = EDICT_TO_PROG(ent); PR_GLOBAL(other) = EDICT_TO_PROG(sv.edicts); PR_ExecuteProgram (ent->v.think); if (ent->free) return; } }
/* ================ SV_Physics_Pusher ================ */ void SV_Physics_Pusher (edict_t *ent) { float thinktime; float oldltime; float movetime; oldltime = ent->v.ltime; thinktime = ent->v.nextthink; if (thinktime < ent->v.ltime + host_frametime) { movetime = thinktime - ent->v.ltime; if (movetime < 0) movetime = 0; } else movetime = host_frametime; if (movetime) { #ifdef QUAKE2 if (ent->v.avelocity[0] || ent->v.avelocity[1] || ent->v.avelocity[2]) SV_PushRotate (ent, movetime); else #endif SV_PushMove (ent, movetime); // advances ent->v.ltime if not blocked } if (thinktime > oldltime && thinktime <= ent->v.ltime) { ent->v.nextthink = 0; pr_global_struct->time = sv.time; pr_global_struct->self = EDICT_TO_PROG(ent); pr_global_struct->other = EDICT_TO_PROG(sv.edicts); PR_ExecuteProgram (ent->v.think); if (ent->free) return; } }
/* ================ SV_Physics_Pusher ================ */ void SV_Physics_Pusher (edict_t *ent) { float thinktime; float oldltime; float movetime; oldltime = ent->v.ltime; thinktime = ent->v.nextthink; if (thinktime < ent->v.ltime + host_frametime) { movetime = thinktime - ent->v.ltime; if (movetime < 0) movetime = 0; } else movetime = host_frametime; if (movetime) { //ROTATE START if ((ent->v.avelocity[0] || ent->v.avelocity[1] || ent->v.avelocity[2]) && ent->v.solid == SOLID_BSP) SV_PushRotate (ent, movetime); // was host_frametime else //ROTATE END SV_PushMove (ent, movetime); // advances ent->v.ltime if not blocked } if (thinktime > oldltime && thinktime <= ent->v.ltime) { ent->v.nextthink = 0; pr_global_struct->time = sv.time; pr_global_struct->self = EDICT_TO_PROG(ent); pr_global_struct->other = EDICT_TO_PROG(sv.edicts); PR_ExecuteProgram (ent->v.think); if (ent->free) return; } }