// ----------------------------------------------------------------------------- // Applies an instantaneous whack on an object, resulting in an instantaneous // change in orientation. void phys_apply_rot(object *obj,vms_vector *force_vec) { fix rate, vecmag; if (obj->movement_type != MT_PHYSICS) return; vecmag = vm_vec_mag(force_vec)/8; if (vecmag < F1_0/256) rate = 4*F1_0; else if (vecmag < obj->mtype.phys_info.mass >> 14) rate = 4*F1_0; else { rate = fixdiv(obj->mtype.phys_info.mass, vecmag); if (obj->type == OBJ_ROBOT) { if (rate < F1_0/4) rate = F1_0/4; obj->ctype.ai_info.SKIP_AI_COUNT = 2; } else { if (rate < F1_0/2) rate = F1_0/2; } } // Turn amount inversely proportional to mass. Third parameter is seconds to do 360 turn. physics_turn_towards_vector(force_vec, obj, rate); }
// ----------------------------------------------------------------------------- // Applies an instantaneous whack on an object, resulting in an instantaneous // change in orientation. void phys_apply_rot(object *obj,vms_vector *force_vec) { fix rate, vecmag; if (obj->movement_type != MT_PHYSICS) return; vecmag = vm_vec_mag(force_vec)/8; if (vecmag < F1_0/256) rate = 4*F1_0; else if (vecmag < obj->mtype.phys_info.mass >> 14) rate = 4*F1_0; else { rate = fixdiv(obj->mtype.phys_info.mass, vecmag); if (obj->type == OBJ_ROBOT) { if (rate < F1_0/4) rate = F1_0/4; // Changed by mk, 10/24/95, claw guys should not slow down when attacking! if (!Robot_info[obj->id].thief && !Robot_info[obj->id].attack_type) { if (obj->ctype.ai_info.SKIP_AI_COUNT * FrameTime < 3*F1_0/4) { fix tval = fixdiv(F1_0, 8*FrameTime); int addval; addval = f2i(tval); if ( (d_rand() * 2) < (tval & 0xffff)) addval++; obj->ctype.ai_info.SKIP_AI_COUNT += addval; // -- mk: too much stuff making hard to see my debug messages...mprintf((0, "FrameTime = %7.3f, addval = %i\n", f2fl(FrameTime), addval)); } } } else { if (rate < F1_0/2) rate = F1_0/2; } } // Turn amount inversely proportional to mass. Third parameter is seconds to do 360 turn. physics_turn_towards_vector(force_vec, obj, rate); }
// ----------------------------------------------------------------------------- // Applies an instantaneous whack on an tObject, resulting in an instantaneous // change in orientation. void PhysApplyRot (tObject *objP, vmsVector *vForce) { fix rate, vecmag; if (objP->movementType != MT_PHYSICS) return; vecmag = VmVecMag (vForce)/8; if (vecmag < F1_0/256) rate = 4*F1_0; else if (vecmag < objP->mType.physInfo.mass >> 14) rate = 4*F1_0; else { rate = FixDiv (objP->mType.physInfo.mass, vecmag); if (objP->nType == OBJ_ROBOT) { if (rate < F1_0/4) rate = F1_0/4; // Changed by mk, 10/24/95, claw guys should not slow down when attacking! if (!gameData.bots.pInfo [objP->id].thief && !gameData.bots.pInfo [objP->id].attackType) { if (objP->cType.aiInfo.SKIP_AI_COUNT * gameData.time.xFrame < 3*F1_0/4) { fix tval = FixDiv (F1_0, 8*gameData.time.xFrame); int addval; addval = f2i (tval); if ((d_rand () * 2) < (tval & 0xffff)) addval++; objP->cType.aiInfo.SKIP_AI_COUNT += addval; } } } else { if (rate < F1_0/2) rate = F1_0/2; } } // Turn amount inversely proportional to mass. Third parameter is seconds to do 360 turn. physics_turn_towards_vector (vForce, objP, rate); }